-
Notifications
You must be signed in to change notification settings - Fork 103
/
DashboardRouter.svelte
78 lines (75 loc) · 3 KB
/
DashboardRouter.svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<script lang="ts">
import features from '@features/features'
import { selectedActivity, selectedAsset, selectedFilter } from '@/contexts/dashboard'
import {
accountActionsRouter,
accountSwitcherRouter,
activityRouter,
DashboardRoute,
dashboardRoute,
dashboardRouter,
filterRouter,
profileRouter,
resetRouterWithDrawerDelay,
sendRouter,
settingsRouter,
tokenRouter,
} from '@/routers'
import {
AccountActionsDrawer,
AccountSwitcherDrawer,
ActivityDrawer,
ProfileDrawer,
ReceiveDrawer,
SendDrawer,
TokenDrawer,
FilterDrawer,
} from './drawers'
$: $selectedActivity && $dashboardRouter.goTo(DashboardRoute.Activity)
$: $selectedAsset && $dashboardRouter.goTo(DashboardRoute.Token)
$: $selectedFilter && $dashboardRouter.goTo(DashboardRoute.Filter)
function onReceiveDrawerClose(): void {
$dashboardRouter.previous()
}
function onSendDrawerClose(): void {
$sendRouter.closeDrawer()
}
function onAccountSwitcherDrawerClose(): void {
resetRouterWithDrawerDelay($accountSwitcherRouter)
$dashboardRouter.previous()
}
function onAccountActionsDrawerClose(): void {
resetRouterWithDrawerDelay($accountActionsRouter)
$dashboardRouter.previous()
}
function onProfileDrawerClose(): void {
$profileRouter.closeDrawer()
resetRouterWithDrawerDelay($settingsRouter)
}
function onActivityDrawerClose(): void {
$activityRouter.closeDrawer()
}
function onTokenDrawerClose(): void {
$tokenRouter.closeDrawer()
}
function onFilterDrawerClose(): void {
$filterRouter.closeDrawer()
}
</script>
{#if $dashboardRoute === DashboardRoute.Receive && features?.dashboard?.receive?.enabled}
<ReceiveDrawer onClose={onReceiveDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.Send && features?.dashboard?.send?.enabled}
<SendDrawer onClose={onSendDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.AccountSwitcher && features?.dashboard?.accountSwitcher?.enabled}
<AccountSwitcherDrawer onClose={onAccountSwitcherDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.AccountActions && features?.dashboard?.accountActions?.enabled}
<AccountActionsDrawer onClose={onAccountActionsDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.Profile && features?.dashboard?.profileActions?.enabled}
<ProfileDrawer onClose={onProfileDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.Activity && $selectedActivity}
<ActivityDrawer activity={$selectedActivity} onClose={onActivityDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.Token && $selectedAsset}
<TokenDrawer asset={$selectedAsset} onClose={onTokenDrawerClose} />
{:else if $dashboardRoute === DashboardRoute.Filter && $selectedFilter}
<FilterDrawer filter={$selectedFilter} onClose={onFilterDrawerClose} />
{/if}