From 2dfa07e07521a462fc2500cd3d5af5b94f159415 Mon Sep 17 00:00:00 2001 From: Daniil Polienko Date: Wed, 20 Nov 2024 16:38:37 +0300 Subject: [PATCH] chore: layout fixes --- apps/common/components/MobileNavbar.tsx | 5 ++-- apps/common/components/Sidebar.tsx | 38 ++++++++++++------------- apps/common/icons/IconVaults.tsx | 10 +++---- pages/apps/[category].tsx | 14 +++++---- pages/apps/index.tsx | 13 +++++---- 5 files changed, 43 insertions(+), 37 deletions(-) diff --git a/apps/common/components/MobileNavbar.tsx b/apps/common/components/MobileNavbar.tsx index e2e3b5361..84f20d9d5 100644 --- a/apps/common/components/MobileNavbar.tsx +++ b/apps/common/components/MobileNavbar.tsx @@ -11,7 +11,8 @@ import type {ReactElement} from 'react'; export function MobileNavbar({onClose}: {onClose: VoidFunction}): ReactElement { const pathName = usePathname(); - const currentTab = pathName?.startsWith('/apps') ? pathName?.split('/')[2] : '/'; + const currentTab = pathName?.startsWith('/apps/') ? pathName?.split('/')[2] : 'apps'; + return (
+ href={tab.route === 'apps' ? `/${tab.route}` : `/apps/${tab.route}`}>
{iconsDict[tab.route as keyof typeof iconsDict]}
diff --git a/apps/common/components/Sidebar.tsx b/apps/common/components/Sidebar.tsx index 186fe0f58..aada40dbf 100644 --- a/apps/common/components/Sidebar.tsx +++ b/apps/common/components/Sidebar.tsx @@ -19,7 +19,7 @@ export function Sidebar(props: TSidebarProps): ReactElement { const router = useRouter(); const {configuration, dispatch} = useSearch(); - const currentTab = pathName?.startsWith('/apps') ? pathName?.split('/')[2] : '/'; + const currentTab = pathName?.startsWith('/apps/') ? pathName?.split('/')[2] : 'apps'; const onSearchClick = useCallback(() => { if (!configuration.searchValue) { @@ -58,24 +58,24 @@ export function Sidebar(props: TSidebarProps): ReactElement { />
- {props.tabs.map(tab => ( - -
- { - iconsDict[ - tab.route as 'apps' | 'community-apps' | 'vaults' | 'yearn-x' | 'integrations' - ] - } -
-

{tab.title}

- - ))} + {props.tabs.map(tab => { + const href = tab.route === 'apps' ? `/${tab.route}` : `/apps/${tab.route}`; + return ( + +
+ {iconsDict[tab.route as keyof typeof iconsDict]} +
+

{tab.title}

+ + ); + })}
diff --git a/apps/common/icons/IconVaults.tsx b/apps/common/icons/IconVaults.tsx index 6789997aa..cb6cd5213 100644 --- a/apps/common/icons/IconVaults.tsx +++ b/apps/common/icons/IconVaults.tsx @@ -26,35 +26,35 @@ export function IconVaults(props: React.SVGProps): ReactElement { width={'16'} height={'16'} rx={'3'} - stroke={'#9D9D9D'} + stroke={'currentColor'} strokeWidth={'1.5'} strokeLinecap={'round'} strokeLinejoin={'round'} /> (); - const currentCatrgory = useMemo(() => { - const currentTab = props.router.asPath?.startsWith('/apps') ? props.router.asPath?.split('/')[2] : '/'; + const currentCategory = useMemo(() => { + const currentTab = props.router.asPath?.startsWith('/apps/') + ? props.router.asPath?.split('/')[2] + : 'featured-apps'; return CATEGORIES_DICT[currentTab as keyof typeof CATEGORIES_DICT]; }, [props.router.asPath]); @@ -19,10 +21,10 @@ export default function Index(props: {router: NextRouter}): ReactElement { ** On component mount we shuffle the array of Apps to avoid any bias. **********************************************************************************************/ useMountEffect(() => { - if (currentCatrgory?.apps.length < 1) { + if (currentCategory?.apps.length < 1) { return; } - set_shuffledApps(currentCatrgory?.apps.toSorted(() => 0.5 - Math.random())); + set_shuffledApps(currentCategory?.apps.toSorted(() => 0.5 - Math.random())); }); return ( @@ -30,11 +32,11 @@ export default function Index(props: {router: NextRouter}): ReactElement {

- {currentCatrgory?.categoryName} + {currentCategory?.categoryName}

- {currentCatrgory?.categoryDescription} + {currentCategory?.categoryDescription}

diff --git a/pages/apps/index.tsx b/pages/apps/index.tsx index b46f438aa..b11ee993c 100644 --- a/pages/apps/index.tsx +++ b/pages/apps/index.tsx @@ -40,11 +40,14 @@ export default function Home(): ReactElement {
- +
+

{'Featured Apps'}

+ +