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

refactor: update cli auth page design#17915

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
BrunoQuaresma merged 2 commits intomainfrombq/fix-copy-session-token
May 19, 2025
Merged
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
86 changes: 33 additions & 53 deletionssite/src/pages/CliAuthPage/CliAuthPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,53 @@
import type { Interpolation, Theme } from "@emotion/react";
import { visuallyHidden } from "@mui/utils";
import { CodeExample } from "components/CodeExample/CodeExample";
import { Loader } from "components/Loader/Loader";
import { Button } from "components/Button/Button";
import { SignInLayout } from "components/SignInLayout/SignInLayout";
import { Spinner } from "components/Spinner/Spinner";
import { Welcome } from "components/Welcome/Welcome";
import { useClipboard } from "hooks";
import { CheckIcon, CopyIcon } from "lucide-react";
import type { FC } from "react";
import { Link as RouterLink } from "react-router-dom";

export interface CliAuthPageViewProps {
sessionToken?: string;
}

const VISUALLY_HIDDEN_SPACE = " ";

export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {
if (!sessionToken){
return <Loader fullscreen />;
}
const clipboard = useClipboard({
textToCopy: sessionToken ?? "",
});

return (
<SignInLayout>
<Welcome className="pb-3">Session token</Welcome>
<Welcome>Session token</Welcome>

<p css={styles.instructions}>
Copy the session token below and
{/*
* This looks silly, but it's a case where you want to hide the space
* visually because it messes up the centering, but you want the space
* to still be available to screen readers
*/}
<span css={{ ...visuallyHidden }}>{VISUALLY_HIDDEN_SPACE}</span>
<strong css={{ display: "block" }}>paste it in your terminal.</strong>
<p className="m-0 text-center text-sm text-content-secondary leading-normal">
Copy the session token below and{" "}
<strong className="block">paste it in your terminal.</strong>
</p>

<CodeExample code={sessionToken} secret />

<div css={{ paddingTop: 16 }}>
<RouterLink to="/workspaces" css={styles.backLink}>
Go to workspaces
</RouterLink>
<div className="flex flex-col items-center gap-1 w-full mt-4">
<Button
className="w-full"
size="lg"
disabled={!sessionToken}
onClick={clipboard.copyToClipboard}
>
{clipboard.showCopiedSuccess ? (
<CheckIcon />
) : (
<Spinner loading={!sessionToken}>
<CopyIcon />
</Spinner>
)}
{clipboard.showCopiedSuccess
? "Session token copied!"
: "Copy session token"}
</Button>

<Button className="w-full" variant="subtle" asChild>
<RouterLink to="/workspaces">Go to workspaces</RouterLink>
</Button>
</div>
</SignInLayout>
);
};

const styles = {
instructions: (theme) => ({
fontSize: 16,
color: theme.palette.text.secondary,
paddingBottom: 8,
textAlign: "center",
lineHeight: 1.4,

// Have to undo styling side effects from <Welcome> component
marginTop: -24,
}),

backLink: (theme) => ({
display: "block",
textAlign: "center",
color: theme.palette.text.primary,
textDecoration: "underline",
textUnderlineOffset: 3,
textDecorationColor: "hsla(0deg, 0%, 100%, 0.7)",
paddingTop: 16,
paddingBottom: 16,

"&:hover": {
textDecoration: "none",
},
}),
} satisfies Record<string, Interpolation<Theme>>;
Loading

[8]ページ先頭

©2009-2025 Movatter.jp