Skip to content

Commit

Permalink
added demo feature
Browse files Browse the repository at this point in the history
  • Loading branch information
sarem-h committed Jun 10, 2024
1 parent 0ec254a commit e669372
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
6 changes: 6 additions & 0 deletions public/images/chevron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ render(
</Suspense>
)}
>
<Route path="/login" component={Login} />
<Route path="/logout" component={Logout} />
<Route path="/login" component={Login} />
<Route path="/logout" component={Logout} />
<Route path="/auth" component={Auth} />

<Route path="/*dongleId" component={Dashboard} />
Expand Down
28 changes: 25 additions & 3 deletions src/pages/auth/login.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { getGoogleAuthUrl, getAppleAuthUrl, getGitHubAuthUrl } from '~/api/auth'
import { setAccessToken } from '~/api/auth/client'

import Button from '~/components/material/Button'
import Typography from '~/components/material/Typography'

export default function Login() {
const loginAsDemoUser = function() {
setAccessToken('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NDg1ODI0NjUsIm5iZiI6MTcxNzA0NjQ2NSwiaWF0IjoxNzE3MDQ2NDY1LCJpZGVudGl0eSI6IjBkZWNkZGNmZGYyNDFhNjAifQ.g3khyJgOkNvZny6Vh579cuQj1HLLGSDeauZbfZri9jw');
window.location.href = window.location.origin;
};

return (
<div class="flex min-h-screen flex-col items-center justify-center bg-background p-6">
<div class="flex max-w-sm flex-col items-center gap-8">
Expand Down Expand Up @@ -31,7 +37,7 @@ export default function Login() {

<div class="flex flex-col items-stretch gap-4 self-stretch">
<Button
class="h-16 gap-4"
class="h-16 gap-4 hover:bg-gray-200"
href={getGoogleAuthUrl()}
leading={
<img
Expand All @@ -45,7 +51,7 @@ export default function Login() {
Sign in with Google
</Button>
<Button
class="h-16 gap-5 pr-7"
class="h-16 gap-5 pr-7 hover:bg-gray-200"
href={getAppleAuthUrl()}
leading={
<div class="relative size-8">
Expand All @@ -62,7 +68,7 @@ export default function Login() {
Sign in with Apple
</Button>
<Button
class="h-16 gap-4"
class="h-16 gap-4 hover:bg-gray-200"
href={getGitHubAuthUrl()}
leading={
<img
Expand Down Expand Up @@ -90,6 +96,22 @@ export default function Login() {
height={32}
/>
</div>

<Button
class="h-13 gap-4 hover:bg-gray-200"
onclick={loginAsDemoUser}
trailing={
<img
src="/images/chevron.svg"
alt=""
width={18}
height={18}
style={{ transform: 'rotate(180deg)' }}
/>
}
>
Try the demo
</Button>
</div>
</div>
)
Expand Down

0 comments on commit e669372

Please sign in to comment.