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: cleanup various auth things#11785

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 1 commit intomainfrombroom
Jan 25, 2024
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
@@ -1,4 +1,4 @@
import { Entitlements, Feature, FeatureName } from "api/typesGenerated";
importtype{ Entitlements, Feature, FeatureName } from "api/typesGenerated";

/**
* @param hasLicense true if Enterprise edition
Expand Down
2 changes: 1 addition & 1 deletionsite/src/modules/dashboard/useFeatureVisibility.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import { FeatureName } from "api/typesGenerated";
import { selectFeatureVisibility } from "./entitlements";
import { useDashboard } from "./useDashboard";
import { selectFeatureVisibility } from "utils/entitlements";

export const useFeatureVisibility = (): Record<FeatureName, boolean> => {
const { entitlements } = useDashboard();
Expand Down
21 changes: 7 additions & 14 deletionssite/src/pages/CliAuthPage/CliAuthPage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
import {useEffect, useState, FC, PropsWithChildren } from "react";
import {type FC } from "react";
import { Helmet } from "react-helmet-async";
import { useQuery } from "react-query";
import { getApiKey } from "api/api";
import { pageTitle } from "utils/page";
import { CliAuthPageView } from "./CliAuthPageView";

export const CliAuthenticationPage: FC<PropsWithChildren<unknown>> = () => {
const [apiKey, setApiKey] = useState<string | null>(null);

useEffect(() => {
getApiKey()
.then(({ key }) => {
setApiKey(key);
})
.catch((error) => {
console.error(error);
});
}, []);
export const CliAuthenticationPage: FC = () => {
const { data } = useQuery({
queryFn: () => getApiKey(),
});

return (
<>
<Helmet>
<title>{pageTitle("CLI Auth")}</title>
</Helmet>
<CliAuthPageView sessionToken={apiKey} />
<CliAuthPageView sessionToken={data?.key} />
</>
);
};
Expand Down
40 changes: 20 additions & 20 deletionssite/src/pages/CliAuthPage/CliAuthPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import Button from "@mui/material/Button";
import {useTheme } from "@emotion/react";
import {type Interpolation, type Theme } from "@emotion/react";
import { type FC } from "react";
import { Link as RouterLink } from "react-router-dom";
import { CodeExample } from "components/CodeExample/CodeExample";
Expand All@@ -8,12 +8,10 @@ import { Welcome } from "components/Welcome/Welcome";
import { FullScreenLoader } from "components/Loader/FullScreenLoader";

export interface CliAuthPageViewProps {
sessionToken: string | null;
sessionToken?: string;
}

export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {
const theme = useTheme();

if (!sessionToken) {
return <FullScreenLoader />;
}
Expand All@@ -22,15 +20,7 @@ export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {
<SignInLayout>
<Welcome>Session token</Welcome>

<p
css={{
fontSize: 16,
color: theme.palette.text.secondary,
marginBottom: 32,
textAlign: "center",
lineHeight: "160%",
}}
>
<p css={styles.instructions}>
Copy the session token below and{" "}
<strong css={{ whiteSpace: "nowrap" }}>
paste it in your terminal
Expand All@@ -40,17 +30,27 @@ export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {

<CodeExample code={sessionToken} secret />

<div
css={{
display: "flex",
justifyContent: "flex-end",
paddingTop: 8,
}}
>
<div css={styles.backButton}>
<Button component={RouterLink} size="large" to="/workspaces" fullWidth>
Go to workspaces
</Button>
</div>
</SignInLayout>
);
};

const styles = {
instructions: (theme) => ({
fontSize: 16,
color: theme.palette.text.secondary,
marginBottom: 32,
textAlign: "center",
lineHeight: "160%",
}),

backButton: {
display: "flex",
justifyContent: "flex-end",
paddingTop: 8,
},
} satisfies Record<string, Interpolation<Theme>>;

[8]ページ先頭

©2009-2025 Movatter.jp