Skip to content

Commit fa51b2b

Browse files
committed
Split out LoginScreen
1 parent 7a5fb2b commit fa51b2b

2 files changed

Lines changed: 24 additions & 19 deletions

File tree

hub-client/src/App.tsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ProjectSelector from './components/ProjectSelector';
44
import Editor from './components/Editor';
55
import Toast from './components/Toast';
66
import { ViewModeProvider } from './components/ViewModeContext';
7-
import { LoginButton } from './components/auth/LoginButton';
7+
import { LoginScreen } from './components/auth/LoginScreen';
88
import {
99
connect,
1010
disconnect,
@@ -400,24 +400,7 @@ function App() {
400400
}
401401

402402
if (AUTH_ENABLED && !auth) {
403-
return (
404-
<div className="project-selector" style={{ alignItems: 'center' }}>
405-
<div className="modal" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center', padding: '48px 32px' }}>
406-
<img src="/quarto-icon.svg" alt="Quarto" style={{ width: '48px', height: '48px', marginBottom: '8px' }} />
407-
<h1 style={{ margin: 0 }}>Quarto Hub</h1>
408-
{authError ? (
409-
<p style={{ color: 'var(--posit-red)', fontSize: '14px', margin: '0 0 16px' }}>
410-
Sign-in failed. Your account is not authorized to access this hub.
411-
</p>
412-
) : (
413-
<p style={{ color: 'var(--text-secondary)', fontSize: '14px', margin: '0 0 16px' }}>
414-
Sign in with Google to continue
415-
</p>
416-
)}
417-
<LoginButton />
418-
</div>
419-
</div>
420-
);
403+
return <LoginScreen error={authError} />;
421404
}
422405

423406
return (
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { LoginButton } from './LoginButton';
2+
3+
export function LoginScreen({ error }: { error?: boolean }) {
4+
return (
5+
<div className="project-selector" style={{ alignItems: 'center' }}>
6+
<div className="modal" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center', padding: '48px 32px' }}>
7+
<img src="/quarto-icon.svg" alt="Quarto" style={{ width: '48px', height: '48px', marginBottom: '8px' }} />
8+
<h1 style={{ margin: 0 }}>Quarto Hub</h1>
9+
{error ? (
10+
<p style={{ color: 'var(--posit-red)', fontSize: '14px', margin: '0 0 16px' }}>
11+
Sign-in failed. Your account is not authorized to access this hub.
12+
</p>
13+
) : (
14+
<p style={{ color: 'var(--text-secondary)', fontSize: '14px', margin: '0 0 16px' }}>
15+
Sign in with Google to continue
16+
</p>
17+
)}
18+
<LoginButton />
19+
</div>
20+
</div>
21+
);
22+
}

0 commit comments

Comments
 (0)