Skip to content

Commit 013ccff

Browse files
committed
Apply PR comments
1 parent fb02aec commit 013ccff

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

site/src/pages/DeploySettingsPage/NotificationsPage/NotificationsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ const EventsView: FC<EventsViewProps> = ({
184184
{availableMethods.includes("smtp") &&
185185
deploymentValues.notifications?.email.smarthost === "" && (
186186
<Alert severity="warning">
187-
SMTP notifications are enabled, but no smart host has been
187+
SMTP notifications are enabled, but no smarthost has been
188188
configured.
189189
</Alert>
190190
)}

site/src/pages/ManagementSettingsPage/Sidebar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useQuery } from "react-query";
33
import { useLocation, useParams } from "react-router-dom";
44
import { organizationsPermissions } from "api/queries/organizations";
55
import { useAuthenticated } from "contexts/auth/RequireAuth";
6+
import { useDashboard } from "modules/dashboard/useDashboard";
67
import {
78
canEditOrganization,
89
useOrganizationSettings,
@@ -19,6 +20,7 @@ import { type OrganizationWithPermissions, SidebarView } from "./SidebarView";
1920
export const Sidebar: FC = () => {
2021
const location = useLocation();
2122
const { permissions } = useAuthenticated();
23+
const { experiments } = useDashboard();
2224
const { organizations } = useOrganizationSettings();
2325
const { organization: organizationName } = useParams() as {
2426
organization?: string;
@@ -54,6 +56,7 @@ export const Sidebar: FC = () => {
5456
activeOrganizationName={organizationName}
5557
organizations={editableOrgs}
5658
permissions={permissions}
59+
experiments={experiments}
5760
/>
5861
);
5962
};

site/src/pages/ManagementSettingsPage/SidebarView.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const meta: Meta<typeof SidebarView> = {
3535
},
3636
],
3737
permissions: MockPermissions,
38+
experiments: ["notifications"],
3839
},
3940
};
4041

site/src/pages/ManagementSettingsPage/SidebarView.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import AddIcon from "@mui/icons-material/Add";
44
import SettingsIcon from "@mui/icons-material/Settings";
55
import type { FC, ReactNode } from "react";
66
import { Link, NavLink } from "react-router-dom";
7-
import type { AuthorizationResponse, Organization } from "api/typesGenerated";
7+
import type {
8+
AuthorizationResponse,
9+
Experiments,
10+
Organization,
11+
} from "api/typesGenerated";
812
import { Loader } from "components/Loader/Loader";
913
import { Sidebar as BaseSidebar } from "components/Sidebar/Sidebar";
1014
import { Stack } from "components/Stack/Stack";
@@ -26,6 +30,8 @@ interface SidebarProps {
2630
organizations: OrganizationWithPermissions[] | undefined;
2731
/** Site-wide permissions. */
2832
permissions: AuthorizationResponse;
33+
/** Active experiments */
34+
experiments: Experiments;
2935
}
3036

3137
/**
@@ -36,13 +42,15 @@ export const SidebarView: FC<SidebarProps> = ({
3642
activeOrganizationName,
3743
organizations,
3844
permissions,
45+
experiments,
3946
}) => {
4047
// TODO: Do something nice to scroll to the active org.
4148
return (
4249
<BaseSidebar>
4350
<header css={styles.sidebarHeader}>Deployment</header>
4451
<DeploymentSettingsNavigation
4552
active={!activeOrganizationName && activeSettings}
53+
experiments={experiments}
4654
permissions={permissions}
4755
/>
4856
<OrganizationsSettingsNavigation
@@ -59,6 +67,8 @@ interface DeploymentSettingsNavigationProps {
5967
active: boolean;
6068
/** Site-wide permissions. */
6169
permissions: AuthorizationResponse;
70+
/** Active experiments */
71+
experiments: Experiments;
6272
}
6373

6474
/**
@@ -71,6 +81,7 @@ interface DeploymentSettingsNavigationProps {
7181
const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({
7282
active,
7383
permissions,
84+
experiments,
7485
}) => {
7586
return (
7687
<div css={{ paddingBottom: 12 }}>
@@ -133,9 +144,11 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({
133144
Users
134145
</SidebarNavSubItem>
135146
)}
136-
<SidebarNavSubItem href="notifications">
137-
Notifications
138-
</SidebarNavSubItem>
147+
{experiments.includes("notifications") && (
148+
<SidebarNavSubItem href="notifications">
149+
Notifications
150+
</SidebarNavSubItem>
151+
)}
139152
</Stack>
140153
)}
141154
</div>

0 commit comments

Comments
 (0)