From 1031db7ed2cb4c75882b94565afbd4b7fcec2814 Mon Sep 17 00:00:00 2001 From: "Ibrahima G. Coulibaly" Date: Tue, 15 Jul 2025 14:01:38 +0100 Subject: [PATCH] chore: refine bookmarking --- src/components/Hero.tsx | 54 +++++++++++++++++++---------------- src/components/ToolHeader.tsx | 22 ++++++++------ src/components/ToolLayout.tsx | 6 ++-- src/tools/defineTool.tsx | 2 +- 4 files changed, 47 insertions(+), 37 deletions(-) diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx index a05499d..9a2ebe0 100644 --- a/src/components/Hero.tsx +++ b/src/components/Hero.tsx @@ -23,6 +23,7 @@ import { isBookmarked, toggleBookmarked } from '@utils/bookmark'; +import IconButton from '@mui/material/IconButton'; const GroupHeader = styled('div')(({ theme }) => ({ position: 'sticky', @@ -167,24 +168,27 @@ export default function Hero() { - { e.stopPropagation(); toggleBookmarked(option.path); setBookmarkedToolPaths(getBookmarkedToolPaths()); }} - color={ - isBookmarked(option.path) - ? theme.palette.primary.main - : theme.palette.grey[500] - } - icon={ - isBookmarked(option.path) - ? 'mdi:bookmark' - : 'mdi:bookmark-plus-outline' - } - /> + > + + )} @@ -194,9 +198,6 @@ export default function Hero() { } }} /> - {bookmarkedToolPaths.length > 0 && ( - Bookmarked tools: - )} {displayedTools.map((tool) => ( - - {tool.label} + + {tool.label} {bookmarkedToolPaths.length > 0 && ( - { e.stopPropagation(); const path = tool.url.substring(1); toggleBookmarked(path); setBookmarkedToolPaths(getBookmarkedToolPaths()); }} - /> + size={'small'} + > + + )} diff --git a/src/components/ToolHeader.tsx b/src/components/ToolHeader.tsx index 29e0bf0..fa24afb 100644 --- a/src/components/ToolHeader.tsx +++ b/src/components/ToolHeader.tsx @@ -8,6 +8,7 @@ import { categoriesColors } from '../config/uiConfig'; import { getToolsByCategory } from '@tools/index'; import { useEffect, useState } from 'react'; import { isBookmarked, toggleBookmarked } from '@utils/bookmark'; +import IconButton from '@mui/material/IconButton'; const StyledButton = styled(Button)(({ theme }) => ({ backgroundColor: 'white', @@ -107,19 +108,22 @@ export default function ToolHeader({ {title} - { toggleBookmarked(path); setBookmarked(!bookmarked); }} - icon={bookmarked ? 'mdi:bookmark' : 'mdi:bookmark-plus-outline'} - /> + > + + {description} diff --git a/src/components/ToolLayout.tsx b/src/components/ToolLayout.tsx index 6d843f6..1b2e50b 100644 --- a/src/components/ToolLayout.tsx +++ b/src/components/ToolLayout.tsx @@ -14,13 +14,13 @@ export default function ToolLayout({ description, icon, type, - path + fullPath }: { title: string; description: string; icon?: IconifyIcon | string; type: string; - path: string; + fullPath: string; children: ReactNode; }) { const otherCategoryTools = @@ -51,7 +51,7 @@ export default function ToolLayout({ description={description} icon={icon} type={type} - path={path} + path={fullPath} /> {children} diff --git a/src/tools/defineTool.tsx b/src/tools/defineTool.tsx index 1d0a605..6439839 100644 --- a/src/tools/defineTool.tsx +++ b/src/tools/defineTool.tsx @@ -74,7 +74,7 @@ export const defineTool = ( description={description} icon={icon} type={basePath} - path={`${basePath}/${path}`} + fullPath={`${basePath}/${path}`} >