-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathAdminNavigation.utils.tsx
More file actions
79 lines (73 loc) · 2.48 KB
/
AdminNavigation.utils.tsx
File metadata and controls
79 lines (73 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
import { i18n } from '@lingui/core';
import { msg } from '@lingui/macro';
import { CogIcon } from 'web-components/src/components/icons/CogIcon';
import { ShoppingBagIcon } from 'web-components/src/components/icons/ShoppingBagIcon';
// import { EnvelopeIcon } from 'web-components/src/components/icons/EnvelopeIcon';
// import { PaymentInfoIcon } from 'web-components/src/components/icons/PaymentInfoIcon';
// import { PrefinanceIcon } from 'web-components/src/components/icons/PrefinanceIcon';
import { UserMenuIcon } from 'web-components/src/components/icons/UserMenuIcon';
import { NOT_SUPPORTED_TOOLTIP_TEXT } from 'pages/Dashboard/MyProjects/MyProjects.constants';
import {
AdminNavigationItem,
AdminNavigationSection,
} from './AdminNavigation.types';
export const getAdminNavigationSections = ({
showOrders,
loginDisabled,
}: {
showOrders?: boolean;
loginDisabled?: boolean;
}): AdminNavigationSection[] => {
const sections = [
{
heading: i18n._(msg`Profile`),
items: [
{
name: i18n._(msg`Edit profile`),
icon: <UserMenuIcon linearGradient disabled={loginDisabled} />,
path: 'profile',
disabled: loginDisabled,
disabledTooltipText: i18n._(NOT_SUPPORTED_TOOLTIP_TEXT),
},
{
name: i18n._(msg`Settings`),
icon: <CogIcon linearGradient disabled={loginDisabled} />,
path: 'settings',
disabled: loginDisabled,
disabledTooltipText: i18n._(NOT_SUPPORTED_TOOLTIP_TEXT),
},
// {
// name: i18n._(msg`Email updates`),
// icon: <EnvelopeIcon linearGradient />,
// path: 'email-updates',
// },
] as AdminNavigationItem[],
},
];
if (showOrders) {
sections.unshift({
heading: i18n._(msg`Orders`),
items: [
{
name: i18n._(msg`My orders`),
icon: <ShoppingBagIcon linearGradient />,
path: 'my-orders',
},
// {
// name: i18n._(msg`My prefinance projects`),
// icon: <PrefinanceIcon linearGradient width="24" height="24" />,
// path: 'my-prefinance-projects',
// },
// {
// name: i18n._(msg`Saved payment info`),
// icon: <PaymentInfoIcon linearGradient />,
// path: 'payment-info',
// },
],
});
}
return sections;
};
export const isSelected = (path: string, location: string) => {
return path === location.substring(location.lastIndexOf('/') + 1);
};