8000 ui mocking · coder/coder@715e6f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 715e6f2

Browse files
committed
ui mocking
1 parent 1d14d4e commit 715e6f2

File tree

7 files changed

+45
-14
lines changed

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
@@ -118,3 +118,30 @@ export const RequiresExternalAuth: Story = {
118118
],
119119
},
120120
};
121+
122+
export const OptionalExternalAuth: Story = {
123+
args: {
124+
externalAuth: [
125+
{
126+
id: "github",
127+
type: "github",
128+
authenticated: false,
129+
authenticate_url: "",
130+
display_icon: "/icon/github.svg",
131+
display_name: "GitHub",
132+
// @ts-expect-error
133+
optional: true,
134+
},
135+
{
136+
id: "gitlab",
137+
type: "gitlab",
138+
authenticated: true,
139+
authenticate_url: "",
140+
display_icon: "/icon/gitlab.svg",
141+
display_name: "GitLab",
142+
// @ts-expect-error
143+
optional: true,
144+
},
145+
],
146+
},
147+
};

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
import { useSearchParams } from "react-router-dom";
3232
import { CreateWSPermissions } from "./permissions";
3333
import { Alert } from "components/Alert/Alert";
34-
import { ExternalAuthBanner } from "./ExternalAuthBanner/ExternalAuthBanner";
34+
import { ExternalAuthWall } from "./ExternalAuthWall/ExternalAuthWall";
3535
import { Margins } from "components/Margins/Margins";
3636
import Button from "@mui/material/Button";
3737
import { Avatar } from "components/Avatar/Avatar";
@@ -163,7 +163,7 @@ export const CreateWorkspacePageView: FC<CreateWorkspacePageViewProps> = ({
163163
</PageHeader>
164164

165165
{requiresExternalAuth ? (
166-
<ExternalAuthBanner
166+
<ExternalAuthWall
167167
providers={externalAuth}
168168
pollingState={externalAuthPollingState}
169169
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
< 57AE /tr>
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)
0