Skip to content

Commit

Permalink
feat: disable tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
evavirseda committed Mar 27, 2024
1 parent a412bff commit a35fb60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/desktop/components/SidebarTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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}
>
<Icon width="24" height="24" icon={tab?.icon} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export interface ISidebarTab {
onClick: () => void
notificationType?: NotificationType
showNotificationBadge?: boolean
disabled?: boolean
}
10 changes: 7 additions & 3 deletions packages/desktop/views/dashboard/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
? [
Expand All @@ -39,6 +38,7 @@
label: localize('tabs.collectibles'),
route: DashboardRoute.Collectibles,
onClick: openCollectibles,
disabled: Boolean(!$selectedWallet?.mainAccountId),
},
]
: []),
Expand All @@ -49,6 +49,7 @@
label: localize('tabs.governance'),
route: DashboardRoute.Governance,
onClick: openGovernance,
disabled: Boolean(!$selectedWallet?.mainAccountId),
},
]
: []),
Expand All @@ -59,6 +60,7 @@
label: localize('tabs.vesting'),
route: DashboardRoute.Vesting,
onClick: openVesting,
disabled: Boolean(!$selectedWallet?.mainAccountId),
},
]
: []),
Expand All @@ -80,6 +82,7 @@
label: localize('tabs.delegation'),
route: DashboardRoute.Delegation,
onClick: openDelegation,
disabled: Boolean(!$selectedWallet?.mainAccountId),
},
]
: []),
Expand All @@ -90,6 +93,7 @@
label: localize('tabs.developer'),
route: DashboardRoute.Developer,
onClick: openDeveloper,
disabled: Boolean(!$selectedWallet?.mainAccountId),
},
]
: []),
Expand Down

0 comments on commit a35fb60

Please sign in to comment.