Skip to content

Commit

Permalink
feat: hide sidebar menus in cloud (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikalli committed Sep 20, 2023
1 parent 8d1d4c8 commit 36e59b4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { flexRowCenteredStyle } from '../../styles/box';
import CollpaseSidebarMenu from './CollapseSidebarMenu';
import useRefresh from '../../hooks/useRefresh';
import useOrganizationContext from '../../hooks/context/useOrganizationContext';
import { IS_CLOUD } from '../../../pages/_app';

type MenuItem = Required<MenuProps>['items'];

Expand Down Expand Up @@ -52,11 +53,7 @@ const OrganizationSideBar = () => {
label: collapsed
? undefined
: organization && (
<SideBarTitle
profileImageUrl={organization.profileImageUrl}
name={organization.name}
accessId={process.env.NEXT_PUBLIC_ENV !== 'production' ? 'sb-title' : undefined}
/>
<SideBarTitle profileImageUrl={organization.profileImageUrl} name={organization.name} accessId="sb-title" />
),
},
{
Expand Down Expand Up @@ -84,29 +81,31 @@ const OrganizationSideBar = () => {
),
style: { borderRadius: '6px' },
},
{
key: 'device-farm',
icon: collapsed ? (
<StyledIconLink
selected={router.asPath.startsWith(`/dashboard/${orgId}/device-farm`)}
href={`/dashboard/${orgId}/device-farm/hosts`}
>
<ClusterOutlined />
</StyledIconLink>
) : undefined,
label: collapsed ? (
t('organization:deviceFarmPageTitle')
) : (
<SideBarMenu
icon={<ClusterOutlined style={{ fontSize: '1.2rem' }} />}
path={`/dashboard/${orgId}/device-farm/hosts`}
text={t('organization:deviceFarmPageTitle')}
startWith={`/dashboard/${orgId}/device-farm`}
accessId="side-bar-device-farm"
/>
),
style: { borderRadius: '6px' },
},
IS_CLOUD
? null
: {
key: 'device-farm',
icon: collapsed ? (
<StyledIconLink
selected={router.asPath.startsWith(`/dashboard/${orgId}/device-farm`)}
href={`/dashboard/${orgId}/device-farm/hosts`}
>
<ClusterOutlined />
</StyledIconLink>
) : undefined,
label: collapsed ? (
t('organization:deviceFarmPageTitle')
) : (
<SideBarMenu
icon={<ClusterOutlined style={{ fontSize: '1.2rem' }} />}
path={`/dashboard/${orgId}/device-farm/hosts`}
text={t('organization:deviceFarmPageTitle')}
startWith={`/dashboard/${orgId}/device-farm`}
accessId="side-bar-device-farm"
/>
),
style: { borderRadius: '6px' },
},
{ type: 'divider' },
{
key: 'member',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import CollpaseSidebarMenu from './CollapseSidebarMenu';
import ProjectSwitch from '../projects/ProjectSwitch';
import useRefresh from '../../hooks/useRefresh';
import useProjectContext from '../../hooks/context/useProjectContext';
import { IS_CLOUD } from '../../../pages/_app';

type MenuItem = Required<MenuProps>['items'];

Expand Down Expand Up @@ -64,34 +65,6 @@ const ProjectSideBar = () => {
</ProjectSwitch>
),
},
// {
// type: 'group',
// label: collapsed ? null : 'Test Automation',
// children: [
// {
// key: 'remote',
// label: collapsed ? (
// t('project:tabMenuRemoteTitle')
// ) : (
// <SideBarMenu
// path={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/remotes`}
// text={t('project:tabMenuRemoteTitle')}
// accessId="project-side-bar-remote"
// icon={<RiRemoteControlLine style={{ fontSize: '1.2rem' }} />}
// startWith={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/remotes`}
// />
// ),
// icon: collapsed ? (
// <StyledIconLink
// selected={router.asPath.startsWith(`/dashboard/${project?.organizationId}/projects/${project?.projectId}/remotes`)}
// href={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/remotes`}
// >
// <RiRemoteControlLine />
// </StyledIconLink>
// ) : undefined,
// },
// ],
// },
{
type: 'group',
label: collapsed ? null : 'Manual Testing',
Expand Down Expand Up @@ -177,35 +150,37 @@ const ProjectSideBar = () => {
},
],
},
{
type: 'group',
label: collapsed ? null : 'Device Farm',
children: [
{
key: 'devices',
label: collapsed ? (
t('project:tabMenuDeviceTitle')
) : (
<SideBarMenu
path={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/devices`}
text={t('project:tabMenuDeviceTitle')}
accessId="project-side-bar-devices"
icon={<MobileOutlined style={{ fontSize: '1.2rem' }} />}
/>
),
icon: collapsed ? (
<StyledIconLink
selected={
router.asPath === `/dashboard/${project?.organizationId}/projects/${project?.projectId}/devices`
}
href={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/devices`}
>
<MobileOutlined />
</StyledIconLink>
) : undefined,
IS_CLOUD
? null
: {
type: 'group',
label: collapsed ? null : 'Device Farm',
children: [
{
key: 'devices',
label: collapsed ? (
t('project:tabMenuDeviceTitle')
) : (
<SideBarMenu
path={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/devices`}
text={t('project:tabMenuDeviceTitle')}
accessId="project-side-bar-devices"
icon={<MobileOutlined style={{ fontSize: '1.2rem' }} />}
/>
),
icon: collapsed ? (
<StyledIconLink
selected={
router.asPath === `/dashboard/${project?.organizationId}/projects/${project?.projectId}/devices`
}
href={`/dashboard/${project?.organizationId}/projects/${project?.projectId}/devices`}
>
<MobileOutlined />
</StyledIconLink>
) : undefined,
},
],
},
],
},
project?.type === PROJECT_TYPE.APP
? {
type: 'group',
Expand Down

0 comments on commit 36e59b4

Please sign in to comment.