From a03b87245ffc15baa0833e4576c5f817778b3280 Mon Sep 17 00:00:00 2001 From: Sean Edmunds Date: Mon, 7 Apr 2025 17:29:54 -0500 Subject: [PATCH] Bookmark group deletion update; Icon updates --- README.md | 4 --- .../components/Applications/AppItem.tsx | 8 +++-- .../Applications/AppSettingsItem.tsx | 6 ++-- .../components/Applications/Applications.tsx | 31 ++++++++++++++----- .../Applications/DebouncedApplication.tsx | 29 ++++++++++++++--- .../Bookmarks/DebouncedGroupSettingsItem.tsx | 10 ++++-- 6 files changed, 63 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index dfb1fd9..56c39ab 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,6 @@ sudo pm2 serve ./dist --no-daemon --spa --port 3000 sudo pm2 start server.cjs # TODO -- Reassign/delete bookmarks when group is deleted - -- Find way to list all available icons in dropdown - - Expand settings search to fields other than name - ? Image uploads for backgrounds ? \ No newline at end of file diff --git a/src/pages/homepage/components/Applications/AppItem.tsx b/src/pages/homepage/components/Applications/AppItem.tsx index 0c8c476..aac3f50 100644 --- a/src/pages/homepage/components/Applications/AppItem.tsx +++ b/src/pages/homepage/components/Applications/AppItem.tsx @@ -1,10 +1,14 @@ -import { Icon } from '@iconify/react'; import { Box, Stack, Text } from '@mantine/core'; import { useCommonHooks } from 'hooks'; import { useState } from 'react'; +import * as fa6 from 'react-icons/fa6'; +import * as si from 'react-icons/si'; +import * as vsc from 'react-icons/vsc'; import { stackClasses, textClasses } from 'styles'; function AppItem({ url, icon, name }: any) { + const allIcons: any = { ...fa6, ...vsc, ...si }; + const Icon = allIcons[icon]; const { isMobile } = useCommonHooks(); const [textDecoration, setTextDecoration] = useState('none'); const [hover, setHover] = useState(false); @@ -45,7 +49,7 @@ function AppItem({ url, icon, name }: any) { paddingTop: isMobile ? '0' : '15px', }} > - + {Icon && } ('none'); const [hover, setHover] = useState(false); const { isMobile, theme } = useCommonHooks(); @@ -58,7 +58,7 @@ function AppSettingsItem({ url, icon, name, enabled }: any) { paddingTop: isMobile ? '0' : '32px', }} > - + {Icon && } { + const allIcons: any = { ...fa6, ...vsc, ...si }; const defaultApplication: Application = { id: null, name: '', @@ -157,18 +162,26 @@ const ApplicationSettings = () => { /> - { - setNewApplication({ - ...newApplication, - icon: event.target.value, - }); + data={Object.keys(allIcons).map((icon) => { + return { value: icon, label: icon }; + })} + comboboxProps={{ + zIndex: 1000, }} + renderOption={(item: any) => { + const Icon = allIcons[item.option.value]; + return ( + + {item.option.value} + + + ); + }} + searchable /> { icon={application.icon} name={application.name} enabled={application.enabled} + allIcons={allIcons} /> @@ -354,6 +368,7 @@ const ApplicationSettings = () => { diff --git a/src/pages/settings/components/Applications/DebouncedApplication.tsx b/src/pages/settings/components/Applications/DebouncedApplication.tsx index 7a0a43b..20cc29f 100644 --- a/src/pages/settings/components/Applications/DebouncedApplication.tsx +++ b/src/pages/settings/components/Applications/DebouncedApplication.tsx @@ -3,6 +3,7 @@ import { Button, Card, Group, + Select, Stack, Switch, Text, @@ -20,7 +21,8 @@ import DeleteItemModal from '../Shared/DeleteItemModal'; function DebouncedApplication({ application, setIsOpen, -}: { application: Application; setIsOpen: any }) { + allIcons, +}: { application: Application; setIsOpen: any; allIcons: any }) { const { theme, handleDelete } = useCommonHooks(); const [modalOpened, { open: openModal, close: closeModal }] = useDisclosure(false); const { mutateAsync } = useMutationAPI(); @@ -169,18 +171,35 @@ function DebouncedApplication({ /> - { + return { value: icon, label: icon }; + })} defaultValue={app.icon} - onChange={(event) => { + comboboxProps={{ + zIndex: 3000, + }} + onChange={(event: any) => { setUpdate({ ...app, - icon: event.target.value, + icon: event, }); }} + renderOption={(item: any) => { + const Icon = allIcons[item.option.value]; + return ( + + {item.option.value} + + + ); + }} + searchable + onDropdownOpen={() => setIsOpen(true)} + onDropdownClose={() => setIsOpen(false)} /> + Are you sure you want to delete this bookmark group? {`"${group.categoryName}"`} + + This will also delete all bookmarks in this group! + This action cannot be undone!