-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: install shadcn/ui * chore: format the code * chore: add paths and uninstall unused modules * chore: format * chore: update login and signup to shadui component * chore: tables for links * chore: move into datagrids folder * chore: parse to zod * chore: update backend imports * chore: update names * chore: frontend show links * chore: links * chore: format * chore: links
- Loading branch information
1 parent
4897cb4
commit 59bcf5b
Showing
61 changed files
with
4,266 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "default", | ||
"rsc": false, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "src/globals.css", | ||
"baseColor": "slate", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import { | ||
type ColumnDef, | ||
type ColumnFiltersState, | ||
type SortingState, | ||
type VisibilityState, | ||
flexRender, | ||
getCoreRowModel, | ||
getFacetedRowModel, | ||
getFacetedUniqueValues, | ||
getFilteredRowModel, | ||
getPaginationRowModel, | ||
getSortedRowModel, | ||
useReactTable, | ||
} from '@tanstack/react-table'; | ||
import * as React from 'react'; | ||
|
||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
} from './ui/table'; | ||
|
||
import { DataTablePagination } from './datagrids/links/links-table-pagination'; | ||
import { DataTableToolbar } from './datagrids/links/links-table-toolbar'; | ||
|
||
interface DataTableProps<TData, TValue> { | ||
columns: ColumnDef<TData, TValue>[]; | ||
data: TData[]; | ||
} | ||
|
||
export function DataTable<TData, TValue>({ | ||
columns, | ||
data, | ||
}: DataTableProps<TData, TValue>) { | ||
const [rowSelection, setRowSelection] = React.useState({}); | ||
const [columnVisibility, setColumnVisibility] = | ||
React.useState<VisibilityState>({}); | ||
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>( | ||
[], | ||
); | ||
const [sorting, setSorting] = React.useState<SortingState>([]); | ||
|
||
const table = useReactTable({ | ||
data, | ||
columns, | ||
state: { | ||
sorting, | ||
columnVisibility, | ||
rowSelection, | ||
columnFilters, | ||
}, | ||
enableRowSelection: true, | ||
onRowSelectionChange: setRowSelection, | ||
onSortingChange: setSorting, | ||
onColumnFiltersChange: setColumnFilters, | ||
onColumnVisibilityChange: setColumnVisibility, | ||
getCoreRowModel: getCoreRowModel(), | ||
getFilteredRowModel: getFilteredRowModel(), | ||
getPaginationRowModel: getPaginationRowModel(), | ||
getSortedRowModel: getSortedRowModel(), | ||
getFacetedRowModel: getFacetedRowModel(), | ||
getFacetedUniqueValues: getFacetedUniqueValues(), | ||
}); | ||
|
||
return ( | ||
<div className="space-y-4"> | ||
<DataTableToolbar table={table} /> | ||
<div className="rounded-md border"> | ||
<Table> | ||
<TableHeader> | ||
{table.getHeaderGroups().map((headerGroup) => ( | ||
<TableRow key={headerGroup.id}> | ||
{headerGroup.headers.map((header) => { | ||
return ( | ||
<TableHead key={header.id} colSpan={header.colSpan}> | ||
{header.isPlaceholder | ||
? null | ||
: flexRender( | ||
header.column.columnDef.header, | ||
header.getContext(), | ||
)} | ||
</TableHead> | ||
); | ||
})} | ||
</TableRow> | ||
))} | ||
</TableHeader> | ||
<TableBody> | ||
{table.getRowModel().rows?.length ? ( | ||
table.getRowModel().rows.map((row) => ( | ||
<TableRow | ||
key={row.id} | ||
data-state={row.getIsSelected() && 'selected'} | ||
> | ||
{row.getVisibleCells().map((cell) => ( | ||
<TableCell key={cell.id}> | ||
{flexRender( | ||
cell.column.columnDef.cell, | ||
cell.getContext(), | ||
)} | ||
</TableCell> | ||
))} | ||
</TableRow> | ||
)) | ||
) : ( | ||
<TableRow> | ||
<TableCell | ||
colSpan={columns.length} | ||
className="h-24 text-center" | ||
> | ||
No results. | ||
</TableCell> | ||
</TableRow> | ||
)} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
<DataTablePagination table={table} /> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.