This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
-
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.
- Loading branch information
Showing
26 changed files
with
1,334 additions
and
95 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
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 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 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,70 @@ | ||
"use client"; | ||
|
||
import { | ||
TableHead, | ||
TableRow, | ||
TableCell, | ||
Checkbox, | ||
TableSortLabel, | ||
} from "@mui/material"; | ||
import { Order, Data, HeadCell } from "@/app/database/databaseTable/types"; | ||
|
||
interface Props { | ||
heads: HeadCell[]; | ||
numSelected: number; | ||
order: Order; | ||
orderBy: number; | ||
rowCount: number; | ||
onRequestSort: (event: React.MouseEvent<unknown>, property: number) => void; | ||
onSelectAllClick: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
export default function DbTableHead(props: Props) { | ||
const { | ||
heads, | ||
onSelectAllClick, | ||
order, | ||
orderBy, | ||
numSelected, | ||
rowCount, | ||
onRequestSort, | ||
} = props; | ||
const createSortHandler = | ||
(property: number) => (event: React.MouseEvent<unknown>) => { | ||
onRequestSort(event, property); | ||
}; | ||
|
||
return ( | ||
<TableHead> | ||
<TableRow> | ||
<TableCell padding="checkbox"> | ||
<Checkbox | ||
color="primary" | ||
indeterminate={numSelected > 0 && numSelected < rowCount} | ||
checked={rowCount > 0 && numSelected === rowCount} | ||
onChange={onSelectAllClick} | ||
inputProps={{ | ||
"aria-label": "select all desserts", | ||
}} | ||
/> | ||
</TableCell> | ||
{heads.map((headCell) => ( | ||
<TableCell | ||
key={headCell.id} | ||
align={headCell.align} | ||
padding="none" | ||
sortDirection={orderBy === headCell.id ? order : false} | ||
> | ||
<TableSortLabel | ||
active={orderBy === headCell.id} | ||
direction={orderBy === headCell.id ? order : "asc"} | ||
onClick={createSortHandler(headCell.id)} | ||
> | ||
{headCell.label} | ||
</TableSortLabel> | ||
</TableCell> | ||
))} | ||
</TableRow> | ||
</TableHead> | ||
); | ||
} |
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,63 @@ | ||
"use client"; | ||
|
||
import { alpha, IconButton, Toolbar, Tooltip, Typography } from "@mui/material"; | ||
import DeleteIcon from "@mui/icons-material/Delete"; | ||
import FilterListIcon from "@mui/icons-material/FilterList"; | ||
|
||
interface Props { | ||
numSelected: number; | ||
title:string; | ||
} | ||
|
||
export default function DbTableToolbar(props: Props) { | ||
const { numSelected ,title } = props; | ||
|
||
return ( | ||
<Toolbar | ||
sx={{ | ||
pl: { sm: 2 }, | ||
pr: { xs: 1, sm: 1 }, | ||
...(numSelected > 0 && { | ||
bgcolor: (theme) => | ||
alpha( | ||
theme.palette.primary.main, | ||
theme.palette.action.activatedOpacity | ||
), | ||
}), | ||
}} | ||
> | ||
{numSelected > 0 ? ( | ||
<Typography | ||
sx={{ flex: "1 1 100%" }} | ||
color="inherit" | ||
variant="subtitle1" | ||
component="div" | ||
> | ||
{numSelected} selected | ||
</Typography> | ||
) : ( | ||
<Typography | ||
sx={{ flex: "1 1 100%" }} | ||
variant="h6" | ||
id="tableTitle" | ||
component="div" | ||
> | ||
{title} | ||
</Typography> | ||
)} | ||
{numSelected > 0 ? ( | ||
<Tooltip title="Delete"> | ||
<IconButton> | ||
<DeleteIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
) : ( | ||
<Tooltip title="Filter list"> | ||
<IconButton> | ||
<FilterListIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
)} | ||
</Toolbar> | ||
); | ||
} |
Oops, something went wrong.