Skip to content

Commit df42b7e

Browse files
committed
remove marketplace from sidebar, add billing
1 parent 9fb54f9 commit df42b7e

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

www/src/components/layout/Sidebar.tsx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
import {
2-
ComponentProps,
3-
ReactElement,
4-
useCallback,
5-
useContext,
6-
useRef,
7-
useState,
8-
} from 'react'
9-
import { Link, useLocation } from 'react-router-dom'
10-
import { Avatar, Menu, MenuItem } from 'honorable'
111
import {
122
ArrowTopRightIcon,
13-
BrowseAppsIcon,
143
ClusterIcon,
154
CookieIcon,
5+
CreditCardIcon,
166
Sidebar as DSSidebar,
177
DiscordIcon,
188
GitHubLogoIcon,
@@ -26,15 +16,25 @@ import {
2616
SidebarSection,
2717
TerminalIcon,
2818
} from '@pluralsh/design-system'
29-
import styled, { useTheme } from 'styled-components'
3019
import { useClickOutside } from '@react-hooks-library/core'
20+
import { Avatar, Menu, MenuItem } from 'honorable'
21+
import {
22+
ComponentProps,
23+
ReactElement,
24+
useCallback,
25+
useContext,
26+
useRef,
27+
useState,
28+
} from 'react'
29+
import { Link, useLocation } from 'react-router-dom'
30+
import styled, { useTheme } from 'styled-components'
3131

32+
import CurrentUserContext from '../../contexts/CurrentUserContext'
3233
import { getPreviousUserData } from '../../helpers/authentication'
34+
import { clearLocalStorage } from '../../helpers/localStorage'
3335
import { handlePreviousUserClick } from '../login/CurrentUser'
34-
import CurrentUserContext from '../../contexts/CurrentUserContext'
35-
import { useIsCurrentlyOnboarding } from '../shell/hooks/useOnboarded'
3636
import CreatePublisherModal from '../publisher/CreatePublisherModal'
37-
import { clearLocalStorage } from '../../helpers/localStorage'
37+
import { useIsCurrentlyOnboarding } from '../shell/hooks/useOnboarded'
3838

3939
import Cookiebot from '../../utils/cookiebot'
4040

@@ -58,12 +58,6 @@ const MENU_ITEMS: MenuItem[] = [
5858
path: '/shell',
5959
pathRegexp: /^\/(shell|oauth\/callback\/.+\/shell)/,
6060
},
61-
{
62-
text: 'Marketplace',
63-
icon: <BrowseAppsIcon />,
64-
path: '/marketplace',
65-
pathRegexp: /^\/(marketplace|installed|repository|stack)/,
66-
},
6761
{
6862
text: 'Audits',
6963
icon: <ListIcon />,
@@ -73,6 +67,13 @@ const MENU_ITEMS: MenuItem[] = [
7367
text: 'Account',
7468
icon: <PeopleIcon />,
7569
path: '/account',
70+
pathRegexp: /^\/account(\/(?!billing)[^/]*)?$/,
71+
},
72+
{
73+
text: 'Billing',
74+
icon: <CreditCardIcon />,
75+
path: '/account/billing',
76+
pathRegexp: /^\/account\/billing(\/.*)?$/,
7677
},
7778
// {
7879
// text: 'Roadmap',
@@ -85,10 +86,8 @@ function isActiveMenuItem(
8586
{ path, pathRegexp }: Pick<MenuItem, 'path' | 'pathRegexp'>,
8687
currentPath
8788
) {
88-
return (
89-
(path === '/' ? currentPath === path : currentPath.startsWith(path)) ||
90-
(pathRegexp && (currentPath.match(pathRegexp)?.length ?? 0 > 0))
91-
)
89+
if (pathRegexp) return currentPath.match(pathRegexp) !== null
90+
return path === '/' ? currentPath === path : currentPath.startsWith(path)
9291
}
9392

9493
function SidebarWrapper() {

0 commit comments

Comments
 (0)