Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: update design of External auth section of CreateWorkspacePage#17683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jaaydenh merged 3 commits intomainfromjaaydenh/external-auth-button-component
May 5, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -209,7 +209,7 @@ describe("CreateWorkspacePage", () => {
.mockResolvedValue([MockTemplateVersionExternalAuthGithubAuthenticated]);

await screen.findByText(
"Authenticated with GitHub",
"Authenticated",
{},
{ interval: 500, timeout: 5000 },
);
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -304,7 +304,7 @@ export const CreateWorkspacePageViewExperimental: FC<
<form
onSubmit={form.handleSubmit}
aria-label="Create workspace form"
className="flex flex-col gap-6 w-full border border-border-default border-solid rounded-lg p-6"
className="flex flex-col gap-10 w-full border border-border-default border-solid rounded-lg p-6"
>
{Boolean(error) && <ErrorAlert error={error} />}

Expand DownExpand Up@@ -397,14 +397,14 @@ export const CreateWorkspacePageViewExperimental: FC<
{externalAuth && externalAuth.length > 0 && (
<section>
<hgroup>
<h2 className="text-xl font-semiboldmb-0">
<h2 className="text-xl font-semiboldm-0">
External Authentication
</h2>
<p className="text-sm text-content-secondary mt-0">
This template uses external services for authentication.
</p>
</hgroup>
<div>
<div className="flex flex-col gap-4">
{Boolean(error) && !hasAllRequiredExternalAuth && (
<Alert severity="error">
To create a workspace using this template, please connect to
Expand Down
130 changes: 69 additions & 61 deletionssite/src/pages/CreateWorkspacePage/ExternalAuthButton.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
import ReplayIcon from "@mui/icons-material/Replay";
import LoadingButton from "@mui/lab/LoadingButton";
import Button from "@mui/material/Button";
import Tooltip from "@mui/material/Tooltip";
import { visuallyHidden } from "@mui/utils";
import type { TemplateVersionExternalAuth } from "api/typesGenerated";
import { Badge } from "components/Badge/Badge";
import { Button } from "components/Button/Button";
import { ExternalImage } from "components/ExternalImage/ExternalImage";
import { Pill } from "components/Pill/Pill";
import { Spinner } from "components/Spinner/Spinner";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "components/Tooltip/Tooltip";
import { Check, Redo } from "lucide-react";
import type { FC } from "react";

export interface ExternalAuthButtonProps {
Expand All@@ -24,62 +28,66 @@ export const ExternalAuthButton: FC<ExternalAuthButtonProps> = ({
error,
}) => {
return (
<>
<div css={{ display: "flex", alignItems: "center", gap: 8 }}>
<LoadingButton
fullWidth
loading={isLoading}
variant="contained"
size="xlarge"
startIcon={
auth.display_icon && (
<ExternalImage
src={auth.display_icon}
alt={`${auth.display_name} Icon`}
css={{ width: 16, height: 16 }}
/>
)
}
disabled={auth.authenticated}
onClick={() => {
window.open(
auth.authenticate_url,
"_blank",
"width=900,height=600",
);
onStartPolling();
}}
>
{auth.authenticated ? (
`Authenticated with ${auth.display_name}`
) : (
<>
Login with {auth.display_name}
{!auth.optional && (
<Pill type={error ? "error" : "info"} css={{ marginLeft: 12 }}>
Required
</Pill>
)}
</>
)}
</LoadingButton>
<div className="flex items-center gap-2 border border-border border-solid rounded-md p-3 justify-between">
<span className="flex flex-row items-center gap-2">
{auth.display_icon && (
<ExternalImage
className="w-5 h-5"
src={auth.display_icon}
alt={`${auth.display_name} Icon`}
/>
)}
<p className="font-semibold text-sm m-0">{auth.display_name}</p>
{!auth.optional && (
<Badge size="sm" variant={error ? "destructive" : "warning"}>
Required
</Badge>
)}
</span>

<span className="flex flex-row items-center gap-2">
{auth.authenticated ? (
<>
<Check className="w-4 h-4 text-content-success" />
<p className="text-xs font-semibold text-content-secondary m-0">
Authenticated
</p>
</>
) : (
<Button
variant="default"
size="sm"
disabled={isLoading || auth.authenticated}
onClick={() => {
window.open(
auth.authenticate_url,
"_blank",
"width=900,height=600",
);
onStartPolling();
}}
>
<Spinner loading={isLoading} />
Login with {auth.display_name}
</Button>
)}

{displayRetry && (
<Tooltip title="Retry">
<Button
variant="contained"
size="xlarge"
onClick={onStartPolling}
css={{ minWidth: "auto", aspectRatio: "1" }}
>
<ReplayIcon css={{ width: 20, height: 20 }} />
<span aria-hidden css={{ ...visuallyHidden }}>
Refresh externalauth
</span>
</Button>
</Tooltip>
{displayRetry &&!auth.authenticated &&(
<TooltipProvider>
<Tooltip delayDuration={100}>
<TooltipTrigger asChild>
<Button variant="outline"size="icon" onClick={onStartPolling}>
<Redo />
<span className="sr-only">Refresh external auth</span>
</Button>
</TooltipTrigger>
<TooltipContent>
Retry login with {auth.display_name}
</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
</div>
</>
</span>
</div>
);
};
Loading

[8]ページ先頭

©2009-2025 Movatter.jp