-
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: reorganize files and add comments
- Loading branch information
1 parent
7f5203c
commit d6cdefb
Showing
12 changed files
with
2,003 additions
and
1,711 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
] | ||
}, | ||
"devDependencies": { | ||
"@types/uuid": "^9.0.7", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
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,35 @@ | ||
import { Check } from '@mui/icons-material'; | ||
import { Dialog, Input, Paper } from '@mui/material'; | ||
import Button from '@mui/material/Button'; | ||
import React from 'react'; | ||
|
||
export function AddCategoryDialog({ addCategoryDialogOpen, setAddCategoryDialogOpen, handleAddCategory }: { addCategoryDialogOpen: boolean; setAddCategoryDialogOpen: React.Dispatch<React.SetStateAction<boolean>>; handleAddCategory: (category: string) => void; }) { | ||
const [category, setCategory] = React.useState(''); | ||
return <Dialog open={addCategoryDialogOpen} onClose={() => setAddCategoryDialogOpen(false)}> | ||
<Paper style={{ minWidth: 300, paddingInline: 16, paddingBottom: 16 }}> | ||
<h3>Add a new category</h3> | ||
<div style={{ display: 'flex', gap: 8 }}> | ||
<Input placeholder="Type a category name" fullWidth | ||
onKeyDown={ | ||
(event) => { | ||
if (event.key === 'Enter') { | ||
setCategory(''); | ||
handleAddCategory(category); | ||
} | ||
} | ||
} | ||
onChange={(event) => {setCategory(event.target.value); }} | ||
value={category} /> | ||
<Button variant="contained" | ||
onClick={ | ||
() => { | ||
if(category === '') return; | ||
handleAddCategory(category); | ||
setAddCategoryDialogOpen(false); | ||
}} startIcon={<Check />}> | ||
Done | ||
</Button> | ||
</div> | ||
</Paper> | ||
</Dialog>; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import AppRegistrationIcon from '@mui/icons-material/AppRegistration'; | ||
import { Tooltip } from '@mui/material'; | ||
import Button from '@mui/material/Button'; | ||
import React from 'react'; | ||
|
||
export function CategoryBtn({ setOpenCategoryDialog }: { setOpenCategoryDialog: React.Dispatch<React.SetStateAction<boolean>>; }) { | ||
return ( | ||
<Tooltip title="Update category"> | ||
<Button onClick={() => setOpenCategoryDialog(true)}> | ||
<AppRegistrationIcon /> | ||
</Button> | ||
</Tooltip> | ||
); | ||
} |
Oops, something went wrong.