• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

teableio / teable / 8388153768

22 Mar 2024 09:25AM UTC coverage: 28.048% (-0.2%) from 28.208%
8388153768

Pull #484

github

web-flow
Merge 27e748d45 into a06c6afb1
Pull Request #484: feat: support increment import

2099 of 3215 branches covered (65.29%)

24 of 738 new or added lines in 21 files covered. (3.25%)

4 existing lines in 3 files now uncovered.

25814 of 92035 relevant lines covered (28.05%)

5.53 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/nextjs-app/src/features/app/blocks/table-list/TableList.tsx
1
import { File, FileCsv, FileExcel } from '@teable/icons';
×
NEW
2
import { SUPPORTEDTYPE } from '@teable/openapi';
×
3
import { useConnection, useTablePermission } from '@teable/sdk';
×
4
import {
×
5
  DropdownMenu,
×
6
  DropdownMenuContent,
×
7
  DropdownMenuItem,
×
8
  DropdownMenuLabel,
×
9
  DropdownMenuSeparator,
×
10
  DropdownMenuTrigger,
×
11
} from '@teable/ui-lib';
×
12
import AddBoldIcon from '@teable/ui-lib/icons/app/add-bold.svg';
×
13
import { Button } from '@teable/ui-lib/shadcn/ui/button';
×
14
import { useTranslation } from 'next-i18next';
×
15
import { useState } from 'react';
×
16
import { GUIDE_CREATE_TABLE } from '@/components/Guide';
×
17
import { TableImport } from '../import-table';
×
18
import { DraggableList } from './DraggableList';
×
19
import { NoDraggableList } from './NoDraggableList';
×
20
import { useAddTable } from './useAddTable';
×
21

×
22
export const TableList: React.FC = () => {
×
23
  const { connected } = useConnection();
×
24
  const addTable = useAddTable();
×
25
  const permission = useTablePermission();
×
26
  const { t } = useTranslation(['table']);
×
27
  const [dialogVisible, setDialogVisible] = useState(false);
×
28
  const [fileType, setFileType] = useState<SUPPORTEDTYPE>(SUPPORTEDTYPE.CSV);
×
29
  const importFile = (type: SUPPORTEDTYPE) => {
×
30
    setDialogVisible(true);
×
31
    setFileType(type);
×
32
  };
×
33

×
34
  return (
×
35
    <div className="flex w-full flex-col gap-2 overflow-auto pt-4">
×
36
      <DropdownMenu modal={false}>
×
37
        <DropdownMenuTrigger asChild>
×
38
          <div className="px-3">
×
39
            {permission['table|create'] && (
×
40
              <Button variant={'outline'} size={'xs'} className={`${GUIDE_CREATE_TABLE} w-full`}>
×
41
                <AddBoldIcon />
×
42
              </Button>
×
43
            )}
×
44
          </div>
×
45
        </DropdownMenuTrigger>
×
46
        <DropdownMenuContent className="w-64">
×
47
          <DropdownMenuItem onClick={addTable} className="cursor-pointer">
×
48
            <Button variant="ghost" size="xs" className="h-4">
×
49
              <File className="size-4" />
×
50
              {t('table.operator.createBlank')}
×
51
            </Button>
×
52
          </DropdownMenuItem>
×
53
          <DropdownMenuSeparator />
×
54
          <DropdownMenuLabel className="px-4 text-xs font-normal text-muted-foreground">
×
55
            {t('table:import.menu.addFromOtherSource')}
×
56
          </DropdownMenuLabel>
×
57
          <DropdownMenuItem
×
58
            className="cursor-pointer"
×
59
            onClick={() => importFile(SUPPORTEDTYPE.CSV)}
×
60
          >
×
61
            <Button variant="ghost" size="xs" className="h-4">
×
62
              <FileCsv className="size-4" />
×
63
              {t('table:import.menu.csvFile')}
×
64
            </Button>
×
65
          </DropdownMenuItem>
×
66
          <DropdownMenuItem
×
67
            className="cursor-pointer"
×
68
            onClick={() => importFile(SUPPORTEDTYPE.EXCEL)}
×
69
          >
×
70
            <Button variant="ghost" size="xs" className="h-4">
×
71
              <FileExcel className="size-4" />
×
72
              {t('table:import.menu.excelFile')}
×
73
            </Button>
×
74
          </DropdownMenuItem>
×
75
        </DropdownMenuContent>
×
76
      </DropdownMenu>
×
77

×
78
      {dialogVisible && (
×
79
        <TableImport
×
80
          fileType={fileType}
×
81
          open={dialogVisible}
×
82
          onOpenChange={(open) => setDialogVisible(open)}
×
83
        ></TableImport>
×
84
      )}
×
85

×
86
      <div className="overflow-y-auto px-3">
×
87
        {connected && permission['table|update'] ? <DraggableList /> : <NoDraggableList />}
×
88
      </div>
×
89
    </div>
×
90
  );
×
91
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc