-
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.
refactor: fix build issue, update notes and notebook features
- Remove duplicate title in SingleNote component - Update Sidebar styles for notebook items
- Loading branch information
Showing
14 changed files
with
3,834 additions
and
1,415 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 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,72 @@ | ||
import { ActionIcon, Modal, Flex } from '@mantine/core'; | ||
import { IconCheck, IconEdit, IconX } from '@tabler/icons-react'; | ||
import { useDisclosure } from '@mantine/hooks'; | ||
import { useAddtrashMutation } from '../redux/features/trash/trashApi'; | ||
import notify from '../utils/notify'; | ||
import { notebookType } from '../types/notebook'; | ||
import EditNotebookForm from '../components/NoteBook/EditNoteBookForm'; | ||
|
||
|
||
|
||
const NotebookAction = ({ notebook, css }: { notebook: notebookType, css: CSSModuleClasses[''] }) => { | ||
const [opened, { open, close }] = useDisclosure(false); | ||
const [addtrash] = useAddtrashMutation(); | ||
return ( | ||
<> | ||
<Modal fullScreen | ||
radius={0} | ||
|
||
transitionProps={{ transition: 'fade', duration: 200 }} | ||
shadow='sm' bg={'dark'} opened={opened} onClose={close}> | ||
<h2>Edit NoteBook</h2> | ||
<EditNotebookForm existingNb={notebook} /> | ||
{/* <EditNote note={note} close={close} /> */} | ||
</Modal> | ||
<Flex justify={'space-evenly'}> | ||
<ActionIcon color='gray' className={css}> | ||
<IconEdit onClick={open} size="1rem" /> | ||
</ActionIcon> | ||
<ActionIcon color='gray' className={css}> | ||
<IconX onClick={async () => { | ||
const res: any = await addtrash({ note_id: notebook.id as number }); | ||
const isSuccess = Boolean(res?.data?.status === 'Success'); | ||
const icon = isSuccess ? <IconCheck /> : <IconX color="red" />; | ||
notify(isSuccess, "Notebook moved to trash, you can retrieve it later", icon); | ||
}} size="1rem" color='red' /> | ||
</ActionIcon> | ||
</Flex> | ||
{/* <Menu width={200} shadow="md"> | ||
<Menu.Target> | ||
<ActionIcon variant='transparent' color="gray" radius="xl" size="xs"> | ||
<IconDotsVertical size={18} /> | ||
</ActionIcon> | ||
</Menu.Target> | ||
<Menu.Dropdown> | ||
<Menu.Item | ||
icon={<IconEdit size={rem(14)} />} | ||
onClick={open} | ||
> | ||
Edit Notebook | ||
</Menu.Item> | ||
<Menu.Item | ||
color='red' | ||
disabled={isLoading} | ||
icon={isLoading ? <IconLoader /> : <IconX size={rem(14)} />} | ||
onClick={async () => { | ||
const res: any = await addtrash({ note_id: notebook.id as number }); | ||
const isSuccess = Boolean(res?.data?.status === 'Success'); | ||
const icon = isSuccess ? <IconCheck /> : <IconX color="red" />; | ||
notify(isSuccess, "Notebook moved to trash, you can retrieve it later", icon); | ||
}} | ||
> | ||
Delete | ||
</Menu.Item> | ||
</Menu.Dropdown> | ||
</Menu> */} | ||
</> | ||
|
||
); | ||
}; | ||
|
||
export default NotebookAction; |
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
Oops, something went wrong.