-
Notifications
You must be signed in to change notification settings - Fork 103
/
SendDrawer.svelte
62 lines (57 loc) · 1.69 KB
/
SendDrawer.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
<script lang="typescript">
import { selectedAccount } from '@core/account'
import { localize } from '@core/i18n'
import { Drawer } from '../../../../components'
import { sendRoute, SendRoute, sendRouter } from '../../../../lib/routers'
import SendRouter from './SendRouter.svelte'
export let onClose: () => unknown = () => {}
let title: string
let allowBack: boolean
let fullScreen: boolean
$: $sendRoute, (setTitle(), setAllowBack(), setFullScreen())
function setTitle(): void {
switch ($sendRoute) {
case SendRoute.Reference:
title = localize('actions.addReference')
break
case SendRoute.Expiration:
title = localize('general.expirationTime')
break
default:
title = localize('popups.sendForm.title')
break
}
}
function setAllowBack(): void {
switch ($sendRoute) {
case SendRoute.Token:
allowBack = false
break
default:
allowBack = true
break
}
}
function setFullScreen(): void {
switch ($sendRoute) {
case SendRoute.Unit:
case SendRoute.Expiration:
case SendRoute.CustomExpiration:
case SendRoute.Password:
fullScreen = false
break
default:
fullScreen = true
break
}
}
</script>
<Drawer
{onClose}
{title}
{fullScreen}
allowBack={!$selectedAccount.isTransferring && allowBack}
onBackClick={() => $sendRouter.previous()}
>
<SendRouter />
</Drawer>