Small refactoring
All checks were successful
Deploy to production / build (push) Successful in 1m1s

This commit is contained in:
Sean Edmunds
2026-02-10 12:59:54 -06:00
parent 28802c8698
commit dd5e3dd4f3
38 changed files with 968 additions and 974 deletions

View File

@@ -48,7 +48,7 @@ function DebouncedGroupSettingsItem({
const [popoverOpened, setPopoverOpened] = useState(false);
const { mutateAsync } = useMutationAPI();
const [group, setGroup] = useState<BookmarkGroup>(bookmarkGroup);
const [update, setUpdate] = useState<any>({});
const [update, setUpdate] = useState<BookmarkGroup>();
const [debounced] = useDebouncedValue(update, 1000);
const [newBookmark, setNewBookmark] = useState<Bookmark>({
id: undefined,
@@ -89,18 +89,18 @@ function DebouncedGroupSettingsItem({
}
useEffect(() => {
if (Object.keys(debounced).length) {
if (debounced && Object.keys(debounced).length) {
mutateAsync({
method: 'PATCH',
endpoint: 'api/bookmarkCategories',
body: debounced,
});
setUpdate({});
setUpdate(undefined);
}
}, [debounced]);
useEffect(() => {
if (update !== group && Object.keys(update).length) {
if (update && update !== group && Object.keys(update).length) {
setGroup(update);
}
}, [update]);
@@ -113,28 +113,30 @@ function DebouncedGroupSettingsItem({
return (
<Card w={'400px'} className={cardClasses.settingsItem} classNames={cardClasses}>
<DeleteItemModal
modalOpened={modalOpened}
handleClose={closeModal}
handleDelete={() => {
bookmarks.length > 0 && handleDelete(bookmarks, 'api/bookmarks');
handleDelete(group, 'api/bookmarkCategories');
}}
title='Delete message'
body={
<Stack gap={0} w={'100%'} h={'175px'} align='center'>
<Text>Are you sure you want to delete this bookmark group?</Text>
<Text
className={textClasses.deleteItem}
classNames={textClasses}
>{`"${group.categoryName}"`}</Text>
<Text style={{ fontWeight: 'bold', textTransform: 'uppercase' }}>
This will also delete all bookmarks in this group!
</Text>
<Text c='red'>This action cannot be undone!</Text>
</Stack>
}
/>
{modalOpened && (
<DeleteItemModal
modalOpened={modalOpened}
handleClose={closeModal}
handleDelete={() => {
bookmarks.length > 0 && handleDelete(bookmarks, 'api/bookmarks');
handleDelete(group, 'api/bookmarkCategories');
}}
title='Delete message'
body={
<Stack gap={0} w={'100%'} h={'175px'} align='center'>
<Text>Are you sure you want to delete this bookmark group?</Text>
<Text
className={textClasses.deleteItem}
classNames={textClasses}
>{`"${group.categoryName}"`}</Text>
<Text style={{ fontWeight: 'bold', textTransform: 'uppercase' }}>
This will also delete all bookmarks in this group!
</Text>
<Text c='red'>This action cannot be undone!</Text>
</Stack>
}
/>
)}
<Card.Section
p={'1rem'}
pt={0}