Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0107ad1

Browse files
committed
Remove experiment reference & show beta badge in frontend
Signed-off-by: Danny Kopping <[email protected]>
1 parent 7c571ae commit 0107ad1

File tree

6 files changed

+38
-23
lines changed

6 files changed

+38
-23
lines changed

site/src/components/FeatureStageBadge/FeatureStageBadge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { docs } from "utils/docs";
1010
* All types of feature that we are currently supporting. Defined as record to
1111
* ensure that we can't accidentally make typos when writing the badge text.
1212
*/
13-
const featureStageBadgeTypes = {
13+
export const featureStageBadgeTypes = {
1414
beta: "beta",
1515
experimental: "experimental",
1616
} as const satisfies Record<string, ReactNode>;

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

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const NotificationsPage: FC = () => {
4343
title="Notifications"
4444
description="Control delivery methods for notifications on this deployment."
4545
layout="fluid"
46+
featureStage={"beta"}
4647
>
4748
<Tabs active={tab}>
4849
<TabsList>

site/src/pages/DeploySettingsPage/Sidebar.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "components/Sidebar/Sidebar";
1515
import { useDashboard } from "modules/dashboard/useDashboard";
1616
import type { FC } from "react";
17+
import { FeatureStageBadge } from "components/FeatureStageBadge/FeatureStageBadge";
1718

1819
export const Sidebar: FC = () => {
1920
const { experiments } = useDashboard();
@@ -51,11 +52,9 @@ export const Sidebar: FC = () => {
5152
<SidebarNavItem href="observability" icon={InsertChartIcon}>
5253
Observability
5354
</SidebarNavItem>
54-
{experiments.includes("notifications") && (
55-
<SidebarNavItem href="notifications" icon={NotificationsIcon}>
56-
Notifications
57-
</SidebarNavItem>
58-
)}
55+
<SidebarNavItem href="notifications" icon={NotificationsIcon}>
56+
Notifications <FeatureStageBadge contentType="beta" size="sm" />
57+
</SidebarNavItem>
5958
</BaseSidebar>
6059
);
6160
};

site/src/pages/ManagementSettingsPage/SidebarView.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ const DeploymentSettingsNavigation: FC<DeploymentSettingsNavigationProps> = ({
148148
Users
149149
</SidebarNavSubItem>
150150
)}
151-
{experiments.includes("notifications") && (
151+
<Stack direction={"row"} alignItems={"center"} css={{ gap: 0 }}>
152152
<SidebarNavSubItem href="notifications">
153153
Notifications
154154
</SidebarNavSubItem>
155-
)}
155+
<FeatureStageBadge contentType="beta" size="sm" />
156+
</Stack>
156157
</Stack>
157158
)}
158159
</div>

site/src/pages/UserSettingsPage/Section.tsx

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
import type { Interpolation, Theme } from "@emotion/react";
2+
import {
3+
FeatureStageBadge,
4+
type featureStageBadgeTypes,
5+
} from "components/FeatureStageBadge/FeatureStageBadge";
6+
import { Stack } from "components/Stack/Stack";
27
import type { FC, ReactNode } from "react";
38

49
type SectionLayout = "fixed" | "fluid";
@@ -13,6 +18,7 @@ export interface SectionProps {
1318
layout?: SectionLayout;
1419
className?: string;
1520
children?: ReactNode;
21+
featureStage?: keyof typeof featureStageBadgeTypes;
1622
}
1723

1824
export const Section: FC<SectionProps> = ({
@@ -24,6 +30,7 @@ export const Section: FC<SectionProps> = ({
2430
className = "",
2531
children,
2632
layout = "fixed",
33+
featureStage,
2734
}) => {
2835
return (
2936
<section className={className} id={id} data-testid={id}>
@@ -32,16 +39,25 @@ export const Section: FC<SectionProps> = ({
3239
<div css={styles.header}>
3340
<div>
3441
{title && (
35-
<h4
36-
css={{
37-
fontSize: 24,
38-
fontWeight: 500,
39-
margin: 0,
40-
marginBottom: 8,
41-
}}
42-
>
43-
{title}
44-
</h4>
42+
<Stack direction={"row"} alignItems="center">
43+
<h4
44+
css={{
45+
fontSize: 24,
46+
fontWeight: 500,
47+
margin: 0,
48+
marginBottom: 8,
49+
}}
50+
>
51+
{title}
52+
</h4>
53+
{featureStage && (
54+
<FeatureStageBadge
55+
contentType={featureStage}
56+
size="lg"
57+
css={{ marginBottom: "5px" }}
58+
/>
59+
)}
60+
</Stack>
4561
)}
4662
{description && typeof description === "string" && (
4763
<p css={styles.description}>{description}</p>

site/src/pages/UserSettingsPage/Sidebar.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ export const Sidebar: FC<SidebarProps> = ({ user }) => {
5757
<SidebarNavItem href="tokens" icon={VpnKeyOutlined}>
5858
Tokens
5959
</SidebarNavItem>
60-
{experiments.includes("notifications") && (
61-
<SidebarNavItem href="notifications" icon={NotificationsIcon}>
62-
Notifications
63-
</SidebarNavItem>
64-
)}
60+
<SidebarNavItem href="notifications" icon={NotificationsIcon}>
61+
Notifications
62+
</SidebarNavItem>
6563
</BaseSidebar>
6664
);
6765
};

0 commit comments

Comments
 (0)