Skip to content

Commit c377cd0

Browse files
fix: Move CLI auth screen outside of dashboard (#5755)
1 parent f0eddba commit c377cd0

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

site/src/AppRouter.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export const AppRouter: FC = () => {
142142
<Route element={<DashboardLayout />}>
143143
<Route index element={<IndexPage />} />
144144

145-
<Route path="cli-auth" element={<CliAuthenticationPage />} />
146145
<Route path="gitauth" element={<GitAuthPage />} />
147146

148147
<Route path="workspaces" element={<WorkspacesPage />} />
@@ -241,11 +240,12 @@ export const AppRouter: FC = () => {
241240
</Route>
242241
</Route>
243242

244-
{/* Terminal page don't have the dashboard layout */}
243+
{/* Terminal and CLI auth pages don't have the dashboard layout */}
245244
<Route
246245
path="/@:username/:workspace/terminal"
247246
element={<TerminalPage />}
248247
/>
248+
<Route path="cli-auth" element={<CliAuthenticationPage />} />
249249
</Route>
250250

251251
{/* Using path="*"" means "match anything", so this route

site/src/components/SignInLayout/SignInLayout.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ export const useStyles = makeStyles((theme) => ({
1515
},
1616
container: {
1717
marginTop: theme.spacing(-8),
18-
minWidth: "320px",
19-
maxWidth: "320px",
18+
maxWidth: 385,
2019
},
21-
copyright: {
22-
marginTop: theme.spacing(2),
20+
footer: {
21+
fontSize: 12,
22+
color: theme.palette.text.secondary,
23+
marginTop: theme.spacing(3),
2324
},
2425
}))
2526

@@ -30,7 +31,7 @@ export const SignInLayout: FC<{ children: ReactNode }> = ({ children }) => {
3031
<div className={styles.root}>
3132
<div className={styles.layout}>
3233
<div className={styles.container}>{children}</div>
33-
<div className={styles.copyright}>
34+
<div className={styles.footer}>
3435
{`\u00a9 ${new Date().getFullYear()} Coder Technologies, Inc.`}
3536
</div>
3637
</div>

site/src/components/Welcome/Welcome.tsx

+11-6
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,20 @@ const useStyles = makeStyles((theme) => ({
3434
justifyContent: "center",
3535
},
3636
logo: {
37-
width: 80,
38-
height: 56,
3937
color: theme.palette.text.primary,
38+
fontSize: theme.spacing(8),
4039
},
4140
title: {
42-
fontSize: 24,
43-
letterSpacing: -0.3,
44-
marginBottom: theme.spacing(3),
45-
marginTop: theme.spacing(6),
4641
textAlign: "center",
42+
fontSize: theme.spacing(4),
43+
fontWeight: 400,
44+
margin: 0,
45+
marginBottom: theme.spacing(2),
46+
marginTop: theme.spacing(2),
47+
lineHeight: 1,
48+
49+
"& strong": {
50+
fontWeight: 600,
51+
},
4752
},
4853
}))

site/src/pages/CliAuthPage/CliAuthPage.tsx

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
import { useActor } from "@xstate/react"
2-
import { useContext, useEffect, useState, FC, PropsWithChildren } from "react"
1+
import { useEffect, useState, FC, PropsWithChildren } from "react"
32
import { Helmet } from "react-helmet-async"
43
import { getApiKey } from "../../api/api"
54
import { pageTitle } from "../../util/page"
6-
import { XServiceContext } from "../../xServices/StateContext"
75
import { CliAuthPageView } from "./CliAuthPageView"
86

97
export const CliAuthenticationPage: FC<PropsWithChildren<unknown>> = () => {
10-
const xServices = useContext(XServiceContext)
11-
const [authState] = useActor(xServices.authXService)
12-
const { me } = authState.context
138
const [apiKey, setApiKey] = useState<string | null>(null)
149

1510
useEffect(() => {
16-
if (me?.id) {
17-
void getApiKey().then(({ key }) => {
11+
getApiKey()
12+
.then(({ key }) => {
1813
setApiKey(key)
1914
})
20-
}
21-
}, [me?.id])
15+
.catch((error) => {
16+
console.error(error)
17+
})
18+
}, [])
2219

2320
return (
2421
<>

site/src/pages/CliAuthPage/CliAuthPageView.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {
2121
return (
2222
<SignInLayout>
2323
<Welcome message="Session token" />
24+
2425
<p className={styles.text}>
2526
Copy the session token below and{" "}
2627
<strong className={styles.lineBreak}>paste it in your terminal</strong>.

0 commit comments

Comments
 (0)