Skip to content

Commit f9feb97

Browse files
committed
frontend hacking
1 parent 390217b commit f9feb97

7 files changed

+45
-14
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,30 @@ export const RequiresExternalAuth: Story = {
130130
],
131131
},
132132
};
133+
134+
export const OptionalExternalAuth: Story = {
135+
args: {
136+
externalAuth: [
137+
{
138+
id: "github",
139+
type: "github",
140+
authenticated: false,
141+
authenticate_url: "",
142+
display_icon: "/icon/github.svg",
143+
display_name: "GitHub",
144+
// @ts-expect-error
145+
optional: true,
146+
},
147+
{
148+
id: "gitlab",
149+
type: "gitlab",
150+
authenticated: true,
151+
authenticate_url: "",
152+
display_icon: "/icon/gitlab.svg",
153+
display_name: "GitLab",
154+
// @ts-expect-error
155+
optional: true,
156+
},
157+
],
158+
},
159+
};

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
CreateWorkspaceMode,
4343
ExternalAuthPollingState,
4444
} from "./CreateWorkspacePage";
45-
import { ExternalAuthBanner } from "./ExternalAuthBanner/ExternalAuthBanner";
45+
import { ExternalAuthWall } from "./ExternalAuthWall/ExternalAuthWall";
4646
import { CreateWSPermissions } from "./permissions";
4747

4848
export const Language = {
@@ -172,7 +172,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
172172
</PageHeader>
173173

174174
{requiresExternalAuth ? (
175-
<ExternalAuthBanner
175+
<ExternalAuthWall
176176
providers={externalAuth}
177177
pollingState={externalAuthPollingState}
178178
onStartPolling={startPollingExternalAuth}

site/src/pages/CreateWorkspacePage/ExternalAuthBanner/ExternalAuthItem.stories.tsx renamed to site/src/pages/CreateWorkspacePage/ExternalAuthWall/ExternalAuthItem.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const MockExternalAuth: TemplateVersionExternalAuth = {
1212
};
1313

1414
const meta: Meta<typeof ExternalAuthItem> = {
15-
title: "pages/CreateWorkspacePage/ExternalAuthBanner/ExternalAuthItem",
15+
title: "pages/CreateWorkspacePage/ExternalAuthWall/ExternalAuthItem",
1616
component: ExternalAuthItem,
1717
decorators: [
1818
(Story) => (

site/src/pages/CreateWorkspacePage/ExternalAuthBanner/ExternalAuthItem.tsx renamed to site/src/pages/CreateWorkspacePage/ExternalAuthWall/ExternalAuthItem.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ExternalImage } from "components/ExternalImage/ExternalImage";
66
import { FC, useEffect, useState } from "react";
77
// eslint-disable-next-line no-restricted-imports -- used to allow extension with "component"
88
import Box, { BoxProps } from "@mui/material/Box";
9+
import { Pill } from "components/Pill/Pill";
910

1011
type Status = "idle" | "connecting";
1112

@@ -36,6 +37,9 @@ export const ExternalAuthItem: FC<ExternalAuthItemProps> = ({
3637
<span css={styles.providerHeader}>
3738
<ExternalImage src={provider.display_icon} css={styles.providerIcon} />
3839
<strong css={styles.providerName}>{provider.display_name}</strong>
40+
{!provider.authenticated && (provider as any).optional && (
41+
<Pill type="notice">Optional</Pill>
42+
)}
3943
</span>
4044
{provider.authenticated ? (
4145
<span css={styles.providerConnectedLabel}>

site/src/pages/CreateWorkspacePage/ExternalAuthBanner/ExternalAuthBanner.stories.tsx renamed to site/src/pages/CreateWorkspacePage/ExternalAuthWall/ExternalAuthWall.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TemplateVersionExternalAuth } from "api/typesGenerated";
2-
import { ExternalAuthBanner } from "./ExternalAuthBanner";
2+
import { ExternalAuthWall } from "./ExternalAuthWall";
33
import type { Meta, StoryObj } from "@storybook/react";
44

55
const MockExternalAuth: TemplateVersionExternalAuth = {
@@ -11,13 +11,13 @@ const MockExternalAuth: TemplateVersionExternalAuth = {
1111
authenticated: false,
1212
};
1313

14-
const meta: Meta<typeof ExternalAuthBanner> = {
15-
title: "pages/CreateWorkspacePage/ExternalAuthBanner",
16-
component: ExternalAuthBanner,
14+
const meta: Meta<typeof ExternalAuthWall> = {
15+
title: "pages/CreateWorkspacePage/ExternalAuthWall",
16+
component: ExternalAuthWall,
1717
};
1818

1919
export default meta;
20-
type Story = StoryObj<typeof ExternalAuthBanner>;
20+
type Story = StoryObj<typeof ExternalAuthWall>;
2121

2222
export const Default: Story = {
2323
args: {

site/src/pages/CreateWorkspacePage/ExternalAuthBanner/ExternalAuthBanner.tsx renamed to site/src/pages/CreateWorkspacePage/ExternalAuthWall/ExternalAuthWall.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { Interpolation, Theme } from "@emotion/react";
2-
import { TemplateVersionExternalAuth } from "api/typesGenerated";
3-
import { ExternalAuthPollingState } from "../CreateWorkspacePage";
1+
import { type Interpolation, type Theme } from "@emotion/react";
2+
import { type FC } from "react";
3+
import { type TemplateVersionExternalAuth } from "api/typesGenerated";
4+
import { type ExternalAuthPollingState } from "../CreateWorkspacePage";
45
import { ExternalAuthItem } from "./ExternalAuthItem";
5-
import { FC } from "react";
66

7-
type ExternalAuthBannerProps = {
7+
type ExternalAuthWallProps = {
88
providers: TemplateVersionExternalAuth[];
99
pollingState: ExternalAuthPollingState;
1010
onStartPolling: () => void;
1111
};
1212

13-
export const ExternalAuthBanner: FC<ExternalAuthBannerProps> = ({
13+
export const ExternalAuthWall: FC<ExternalAuthWallProps> = ({
1414
providers,
1515
pollingState,
1616
onStartPolling,

0 commit comments

Comments
 (0)