Skip to content

Commit

Permalink
Show directly when cloud plugin was used
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejewsky committed Dec 13, 2023
1 parent 5ae1eb4 commit 2918541
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/components/Sidebar/menu/EnvironmentLink.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, EnvironmentIcon, List, Text } from "@saleor/macaw-ui-next";
import { Box, List, Text } from "@saleor/macaw-ui-next";
import React from "react";
import { FormattedMessage } from "react-intl";

Expand Down Expand Up @@ -32,7 +32,8 @@ export const EnvironmentLink = () => {
target="__blank"
>
<Box paddingY={1.5} gap={3} display="flex" alignItems="center">
<EnvironmentIcon color="default2" size="medium" />
{/* <EnvironmentIcon color="default2" size="medium" /> */}
<div>icon</div>
<Text size="small" variant="bodyEmp">
<FormattedMessage defaultMessage="Open environment" id="xgpgVX" />
</Text>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Sidebar/menu/Menu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jest.mock("./useMenuStructure", () => ({
useMenuStructure: jest.fn(() => []),
}));

jest.mock("./useEnvironmentLink", () => ({
useEnvironmentLink: jest.fn(() => ({ canRender: true })),
jest.mock("@dashboard/auth/hooks/useCloud", () => ({
useCloud: jest.fn(() => ({ isAuthenticatedViaCloud: true })),
}));

describe("Sidebar menu", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Sidebar/menu/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { useCloud } from "@dashboard/auth/hooks/useCloud";
import { Box, List } from "@saleor/macaw-ui-next";
import React from "react";

import { EnvironmentLink } from "./EnvironmentLink";
import { MenuItem } from "./Item";
import { useEnvironmentLink } from "./useEnvironmentLink";
import { useMenuStructure } from "./useMenuStructure";

export const Menu = () => {
const menuStructure = useMenuStructure();
const envLink = useEnvironmentLink();
const { isAuthenticatedViaCloud } = useCloud();

return (
<Box padding={3} overflowY="auto" className="hide-scrollbar">
<List as="ol" display="grid" gap={1} data-test-id="menu-list">
{envLink.canRender && <EnvironmentLink />}
{isAuthenticatedViaCloud && <EnvironmentLink />}
{menuStructure.map(menuItem => (
<MenuItem menuItem={menuItem} key={menuItem.id} />
))}
Expand Down
9 changes: 0 additions & 9 deletions src/components/Sidebar/menu/useEnvironmentLink.ts

This file was deleted.

0 comments on commit 2918541

Please sign in to comment.