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: use emotion for styling (pt. 8)#10447

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
aslilac merged 23 commits intomainfromemotional-damage-8
Nov 1, 2023
Merged
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
b1a8951
emotion: `Sidebar`
aslilacOct 31, 2023
44ff69b
emotion: `CliAuthPageView`
aslilacOct 31, 2023
a87148e
emotion: `AppearanceSettingsPageView`
aslilacOct 31, 2023
42f5b5d
emotion: `NotFoundPage`
aslilacOct 31, 2023
7f3cff2
emotion: `VariableInput`
aslilacOct 31, 2023
aff4560
🧹
aslilacOct 31, 2023
1c519da
emotion: `GroupPage`
aslilacOct 31, 2023
f1cd22e
emotion: `ChartSection`
aslilacOct 31, 2023
c04d181
emotion: `DividerWithText`
aslilacOct 31, 2023
b58f25e
emotion: `HealthPage`
aslilacOct 31, 2023
b94ec5d
emotion: `ExternalAuthPageView`
aslilacOct 31, 2023
641ede7
emotion: `TemplateDocsPage`
aslilacOct 31, 2023
f06631b
emotion: `AuditLogDiff`
aslilacOct 31, 2023
2958685
emotion: `SignInForm`
aslilacOct 31, 2023
9eec598
emotion: `LicenseCard`
aslilacOct 31, 2023
0cbd32b
emotion: `AuditLogRow`
aslilacOct 31, 2023
3cd4cc3
emotion: `ExternalAuthSettingsPageView`
aslilacOct 31, 2023
a872acd
emotion: `AddNewLicensePageView`
aslilacOct 31, 2023
f17fdb1
emotion: `OAuthSignInForm`
aslilacOct 31, 2023
b3accde
emotion: `LoginPageView`
aslilacOct 31, 2023
d84bf88
emotion: `Logs`
aslilacOct 31, 2023
14dcfc8
Merge branch 'main' into emotional-damage-8
aslilacNov 1, 2023
36af836
🧹
aslilacNov 1, 2023
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
PrevPrevious commit
NextNext commit
emotion:ExternalAuthPageView
  • Loading branch information
@aslilac
aslilac committedOct 31, 2023
commitb94ec5dde814511054290ac67626beb4c2cdbec6
70 changes: 33 additions & 37 deletionssite/src/pages/ExternalAuthPage/ExternalAuthPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
import { type Interpolation, type Theme } from "@emotion/react";
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
import RefreshIcon from "@mui/icons-material/Refresh";
import CircularProgress from "@mui/material/CircularProgress";
import Link from "@mui/material/Link";
import Tooltip from "@mui/material/Tooltip";
import { makeStyles } from "@mui/styles";
import { ApiErrorResponse } from "api/errors";
import { ExternalAuth, ExternalAuthDevice } from "api/typesGenerated";
import type { ApiErrorResponse } from "api/errors";
import type { ExternalAuth, ExternalAuthDevice } from "api/typesGenerated";
import { Alert } from "components/Alert/Alert";
import { Avatar } from "components/Avatar/Avatar";
import { CopyButton } from "components/CopyButton/CopyButton";
import { SignInLayout } from "components/SignInLayout/SignInLayout";
import { Welcome } from "components/Welcome/Welcome";
import { type FC } from "react";
import { type FC, type ReactNode } from "react";

export interface ExternalAuthPageViewProps {
externalAuth: ExternalAuth;
Expand All@@ -30,8 +30,6 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
onReauthenticate,
viewExternalAuthConfig,
}) => {
const styles = useStyles();

if (!externalAuth.authenticated) {
return (
<SignInLayout>
Expand All@@ -50,7 +48,7 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
const hasInstallations = externalAuth.installations.length > 0;

// We only want to wrap this with a link if an install URL is available!
let installTheApp:React.ReactNode = `install the ${externalAuth.display_name} App`;
let installTheApp: ReactNode = `install the ${externalAuth.display_name} App`;
if (externalAuth.app_install_url) {
installTheApp = (
<Link
Expand All@@ -68,15 +66,15 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
<Welcome
message={`You've authenticated with ${externalAuth.display_name}!`}
/>
<pclassName={styles.text}>
<pcss={styles.text}>
{externalAuth.user?.login && `Hey @${externalAuth.user?.login}! 👋 `}
{(!externalAuth.app_installable ||
externalAuth.installations.length > 0) &&
"You are now authenticated. Feel free to close this window!"}
</p>

{externalAuth.installations.length > 0 && (
<divclassName={styles.authorizedInstalls}>
<divcss={styles.authorizedInstalls}>
{externalAuth.installations.map((install) => {
if (!install.account) {
return;
Expand DownExpand Up@@ -105,9 +103,9 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
</div>
)}

<divclassName={styles.links}>
<divcss={styles.links}>
{!hasInstallations && externalAuth.app_installable && (
<Alert severity="warning"className={styles.installAlert}>
<Alert severity="warning"css={styles.installAlert}>
You must {installTheApp} to clone private repositories. Accounts
will appear here once authorized.
</Alert>
Expand All@@ -120,7 +118,7 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
href={externalAuth.app_install_url}
target="_blank"
rel="noreferrer"
className={styles.link}
css={styles.link}
>
<OpenInNewIcon fontSize="small" />
{externalAuth.installations.length > 0
Expand All@@ -130,7 +128,7 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
</Link>
)}
<Link
className={styles.link}
css={styles.link}
href="#"
onClick={() => {
onReauthenticate();
Expand All@@ -147,10 +145,8 @@ const GitDeviceAuth: FC<{
externalAuthDevice?: ExternalAuthDevice;
deviceExchangeError?: ApiErrorResponse;
}> = ({ externalAuthDevice, deviceExchangeError }) => {
const styles = useStyles();

let status = (
<pclassName={styles.status}>
<pcss={styles.status}>
<CircularProgress size={16} color="secondary" data-chromatic="ignore" />
Checking for authentication...
</p>
Expand DownExpand Up@@ -189,18 +185,18 @@ const GitDeviceAuth: FC<{

return (
<div>
<pclassName={styles.text}>
<pcss={styles.text}>
Copy your one-time code:&nbsp;
<divclassName={styles.copyCode}>
<spanclassName={styles.code}>{externalAuthDevice.user_code}</span>
<divcss={styles.copyCode}>
<spancss={styles.code}>{externalAuthDevice.user_code}</span>
&nbsp; <CopyButton text={externalAuthDevice.user_code} />
</div>
<br />
Then open the link below and paste it:
</p>
<divclassName={styles.links}>
<divcss={styles.links}>
<Link
className={styles.link}
css={styles.link}
href={externalAuthDevice.verification_uri}
target="_blank"
rel="noreferrer"
Expand All@@ -217,56 +213,56 @@ const GitDeviceAuth: FC<{

export default ExternalAuthPageView;

constuseStyles =makeStyles((theme) => ({
text: {
conststyles = {
text:(theme) => ({
fontSize: 16,
color: theme.palette.text.secondary,
textAlign: "center",
lineHeight: "160%",
margin: 0,
},
}),

copyCode: {
display: "inline-flex",
alignItems: "center",
},

code: {
code:(theme) => ({
fontWeight: "bold",
color: theme.palette.text.primary,
},
}),

installAlert: {
installAlert:(theme) => ({
margin: theme.spacing(2),
},
}),

links: {
links:(theme) => ({
display: "flex",
gap: theme.spacing(0.5),
margin: theme.spacing(2),
flexDirection: "column",
},
}),

link: {
link:(theme) => ({
display: "flex",
alignItems: "center",
justifyContent: "center",
fontSize: 16,
gap: theme.spacing(1),
},
}),

status: {
status:(theme) => ({
display: "flex",
alignItems: "center",
justifyContent: "center",
gap: theme.spacing(1),
color: theme.palette.text.disabled,
},
}),

authorizedInstalls: {
authorizedInstalls:(theme) => ({
display: "flex",
gap: 4,
color: theme.palette.text.disabled,
margin: theme.spacing(4),
},
}));
}),
} satisfies Record<string, Interpolation<Theme>>;

[8]ページ先頭

©2009-2025 Movatter.jp