Clean up and typing
This commit is contained in:
@@ -14,14 +14,15 @@ import { IconTrash } from '@tabler/icons-react';
|
||||
import { useCommonHooks, useMutationAPI } from 'hooks';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { cardClasses, modalClasses, textInputClasses } from 'styles';
|
||||
import type { Bookmark } from 'types';
|
||||
|
||||
function DebouncedBookmarkItem({ bookmarkItem, handleDelete }: any) {
|
||||
const { theme, isMobile } = useCommonHooks();
|
||||
function DebouncedBookmarkItem({ bookmarkItem }: { bookmarkItem: Bookmark }) {
|
||||
const { theme, isMobile, modalStyle, handleDelete } = useCommonHooks();
|
||||
const [modalOpened, { open: openModal, close: closeModal }] = useDisclosure(false);
|
||||
const { mutateAsync } = useMutationAPI();
|
||||
|
||||
const [bookmark, setBookmark] = useState<any>(bookmarkItem);
|
||||
const [update, setUpdate] = useState({});
|
||||
const [bookmark, setBookmark] = useState<Bookmark>(bookmarkItem);
|
||||
const [update, setUpdate] = useState<any>({});
|
||||
const [debounced] = useDebouncedValue(update, 1000);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -47,14 +48,7 @@ function DebouncedBookmarkItem({ bookmarkItem, handleDelete }: any) {
|
||||
onClose={() => {
|
||||
closeModal();
|
||||
}}
|
||||
style={{
|
||||
'--color-text-pri': theme.primaryColor,
|
||||
'--color-text-acc': theme.accentColor,
|
||||
'--color-background': theme.backgroundColor,
|
||||
'--color-border': theme.borderColor,
|
||||
'--color-search-background': theme.searchColor,
|
||||
'--image-background': `url(${theme.backgroundImage})`,
|
||||
}}
|
||||
style={modalStyle}
|
||||
closeOnEscape
|
||||
closeOnClickOutside
|
||||
>
|
||||
@@ -84,7 +78,7 @@ function DebouncedBookmarkItem({ bookmarkItem, handleDelete }: any) {
|
||||
color={'red'}
|
||||
styles={{ label: { color: 'black' } }}
|
||||
onClick={() => {
|
||||
handleDelete(bookmark);
|
||||
handleDelete(bookmark, 'api/links');
|
||||
closeModal();
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user