1import { Row, Box, Icon, BaseButton } from '@tlon/indigo-react';
3import { useEffect, useState } from 'react';
4import { useInvites } from './useInvites';
5import { generateCsvName } from 'lib/utils/invite';
6import { DEFAULT_CSV_NAME } from 'lib/constants';
7import Point from 'lib/types/Point';
9interface CSVModalProps {
11 invitesUpdating: boolean;
14export const CSVButton = ({ point, invitesUpdating }: CSVModalProps) => {
15 const { generateCsv } = useInvites();
16 const [csv, setCsv] = useState<string | null>(null);
17 const [error, setError] = useState('');
20 if (invitesUpdating) {
25 const csv = generateCsv();
28 setError((e as Error).message);
30 }, [generateCsv, invitesUpdating]);
32 if (!csv || invitesUpdating) {
34 <BaseButton display="flex" className="download-csv" disabled>
35 <Icon icon="Download" />
43 href={`data:text/csv;charset=utf-8,${encodeURIComponent(csv)}`}
44 download={generateCsvName(
46 point.patp?.slice(1) || 'bridge'
48 <Row className="download-csv">
49 <Icon icon="Download" />
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list