Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added demo feature #12

Merged
merged 7 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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)' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chevron facing right svg link. Figured this would be better since the rest of the new-connect UI is also using Google Material Icons. Plus one less line of code since chevron faces correct way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/>
}
>
Try the demo
</Button>
</div>
</div>
)
Expand Down