From a35fb60fe9f0a9f737a81bc39bcb58fc19d6f19c Mon Sep 17 00:00:00 2001 From: evavirseda Date: Wed, 27 Mar 2024 16:42:45 +0100 Subject: [PATCH] feat: disable tabs --- packages/desktop/components/SidebarTab.svelte | 3 ++- .../lib/routers/interfaces/sidebar-tab.interface.ts | 1 + packages/desktop/views/dashboard/Sidebar.svelte | 10 +++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/desktop/components/SidebarTab.svelte b/packages/desktop/components/SidebarTab.svelte index c84813ea0b0..f51519ea921 100644 --- a/packages/desktop/components/SidebarTab.svelte +++ b/packages/desktop/components/SidebarTab.svelte @@ -28,8 +28,9 @@ on:mouseenter={handleShowTooltip} on:mouseleave={handleHideTooltip} bind:this={anchor} - class="{$dashboardRoute === tab?.route ? 'text-blue-500' : 'text-gray-500'} relative" + class="{$dashboardRoute === tab?.route ? 'text-blue-500' : 'text-gray-500'} relative disabled:opacity-50" on:click={onClick} + disabled={tab?.disabled} > diff --git a/packages/desktop/lib/routers/interfaces/sidebar-tab.interface.ts b/packages/desktop/lib/routers/interfaces/sidebar-tab.interface.ts index 46d693a8c13..3498fcade49 100644 --- a/packages/desktop/lib/routers/interfaces/sidebar-tab.interface.ts +++ b/packages/desktop/lib/routers/interfaces/sidebar-tab.interface.ts @@ -9,4 +9,5 @@ export interface ISidebarTab { onClick: () => void notificationType?: NotificationType showNotificationBadge?: boolean + disabled?: boolean } diff --git a/packages/desktop/views/dashboard/Sidebar.svelte b/packages/desktop/views/dashboard/Sidebar.svelte index d84e17efd4b..34d8a5516b8 100644 --- a/packages/desktop/views/dashboard/Sidebar.svelte +++ b/packages/desktop/views/dashboard/Sidebar.svelte @@ -6,21 +6,20 @@ import { activeProfile } from '@core/profile/stores' import { DashboardRoute, collectiblesRouter, dashboardRouter, governanceRouter, settingsRouter } from '@core/router' import { isRecentDate } from '@core/utils' + import { selectedWallet } from '@core/wallet' import { ISidebarTab } from '@desktop/routers' import features from '@features/features' import { Icon, Modal, NotificationBadge, ProfileActionsModal, ProfilePicture, Size } from '@ui' let profileModal: Modal + let sidebarTabs: ISidebarTab[] const profileColor = 'blue' // TODO: each profile has a different color - const { shouldOpenProfileModal } = $activeProfile $: lastStrongholdBackupTime = $activeProfile?.lastStrongholdBackupTime $: lastBackupDate = lastStrongholdBackupTime ? new Date(lastStrongholdBackupTime) : null $: isBackupSafe = lastBackupDate && isRecentDate(lastBackupDate)?.lessThanThreeMonths - - let sidebarTabs: ISidebarTab[] $: sidebarTabs = [ ...(features?.wallet?.enabled ? [ @@ -39,6 +38,7 @@ label: localize('tabs.collectibles'), route: DashboardRoute.Collectibles, onClick: openCollectibles, + disabled: Boolean(!$selectedWallet?.mainAccountId), }, ] : []), @@ -49,6 +49,7 @@ label: localize('tabs.governance'), route: DashboardRoute.Governance, onClick: openGovernance, + disabled: Boolean(!$selectedWallet?.mainAccountId), }, ] : []), @@ -59,6 +60,7 @@ label: localize('tabs.vesting'), route: DashboardRoute.Vesting, onClick: openVesting, + disabled: Boolean(!$selectedWallet?.mainAccountId), }, ] : []), @@ -80,6 +82,7 @@ label: localize('tabs.delegation'), route: DashboardRoute.Delegation, onClick: openDelegation, + disabled: Boolean(!$selectedWallet?.mainAccountId), }, ] : []), @@ -90,6 +93,7 @@ label: localize('tabs.developer'), route: DashboardRoute.Developer, onClick: openDeveloper, + disabled: Boolean(!$selectedWallet?.mainAccountId), }, ] : []),