-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathutils.tsx
More file actions
101 lines (96 loc) · 2.48 KB
/
Copy pathutils.tsx
File metadata and controls
101 lines (96 loc) · 2.48 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { Key, ReactNode } from 'react'
import styled, { css } from 'styled-components'
import { Address } from 'viem'
import { CheckSVG, CogSVG, CopySVG, ExitSVG, PersonSVG, WalletSVG } from '@ensdomains/thorin'
import type { DropdownItem } from '@ensdomains/thorin/dist/types/components/molecules/Dropdown/Dropdown'
import { hasValidPrimaryName } from '@app/hooks/ensjs/public/primaryNameUtils'
import { shortenAddress } from '@app/utils/utils'
import BaseLink from '../../@atoms/BaseLink'
const SectionDivider = styled.div(
({ theme }) => css`
width: calc(100% + ${theme.space['4']});
height: 1px;
background-color: ${theme.colors.border};
`,
)
export const getDropdownItems = ({
primary,
disconnect,
copy,
copied,
hasPendingTransactions,
isParaConnected,
t,
address,
}: {
primary: any
disconnect: any
copy: any
copied: any
hasPendingTransactions: any
isParaConnected: boolean
t: any
address: Address
}): DropdownItem[] =>
[
...(hasValidPrimaryName(primary)
? [
{
label: t('wallet.myProfile'),
wrapper: (children: ReactNode, key: Key) => (
<BaseLink href="/my/profile" key={key}>
{children}
</BaseLink>
),
as: 'a' as 'a',
color: 'text',
icon: PersonSVG,
},
]
: []),
{
label: t('navigation.settings'),
color: 'text',
wrapper: (children: ReactNode, key: Key) => (
<BaseLink href="/my/settings" key={key}>
{children}
</BaseLink>
),
as: 'a',
icon: CogSVG,
showIndicator: hasPendingTransactions,
},
<SectionDivider key="divider" />,
{
label: shortenAddress(address),
color: 'text',
onClick: () => copy(address),
icon: copied ? CheckSVG : CopySVG,
},
...(isParaConnected
? [
{
label: t('wallet.myWallet'),
color: 'text',
icon: WalletSVG,
wrapper: (children: ReactNode, key: Key) => (
<a
href="https://connect.getpara.com/"
key={key}
target="_blank"
rel="noreferrer"
style={{ width: '100%' }}
>
{children}
</a>
),
},
]
: []),
{
label: t('wallet.disconnect'),
color: 'red',
onClick: () => disconnect(),
icon: ExitSVG,
},
] as DropdownItem[]