Skip to content

Commit

Permalink
feat: Add Guest Desktop Login (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio authored Mar 4, 2024
1 parent 328a4ee commit 551dc81
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
18 changes: 18 additions & 0 deletions src/components/auth/LoginWithAuthServerPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,21 @@
line-height: 16.94px;
margin-top: 12px;
}

.LoginWithAuthServerPage .guestInfo,
.LoginWithAuthServerPage .guestInfo a {
color: white;
font-size: 16px;
}

.LoginWithAuthServerPage .guestInfo {
border-top: 1px solid white;
padding-top: 15px;
display: flex;
gap: 5px;
margin-top: 50px;
}

.LoginWithAuthServerPage .guestInfo a {
text-decoration: underline;
}
24 changes: 21 additions & 3 deletions src/components/auth/LoginWithAuthServerPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
import { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { ChainId, ProviderType } from '@dcl/schemas'
import { Button } from 'decentraland-ui/dist/components/Button/Button'
import { WearablePreview } from 'decentraland-ui/dist/components/WearablePreview/WearablePreview'
Expand Down Expand Up @@ -122,6 +122,12 @@ export const LoginWithAuthServerPage = () => {
window.location.reload()
}, [])

const handleGuestLogIn = useCallback((event) => {
setView(View.LOADING)
event.preventDefault()
return authenticate(null)
}, [])

const onBack = useCallback(() => {
initSignInResultRef.current = null
setView(View.WELCOME)
Expand All @@ -147,6 +153,12 @@ export const LoginWithAuthServerPage = () => {
<Button disabled={isLoading} className="button" primary loading={isLoading} onClick={onWelcomeStart}>
Start
</Button>
<div className="guestInfo">
Quick dive?{' '}
<a href="#" onClick={handleGuestLogIn}>
Explore as a guest
</a>
</div>
</>
}
/>
Expand Down Expand Up @@ -196,8 +208,14 @@ export const LoginWithAuthServerPage = () => {
<br />
You'll be prompted to confirm it in your web browser to securely link your sign in.
</div>
<div className="code"><span>{initSignInResultRef.current!.requestResponse.code}</span>
<div className='tooltip'><InfoTooltip position="right center" content="Keep this number private. It ensures that your sign-in is secure and unique to you."/></div>
<div className="code">
<span>{initSignInResultRef.current!.requestResponse.code}</span>
<div className="tooltip">
<InfoTooltip
position="right center"
content="Keep this number private. It ensures that your sign-in is secure and unique to you."
/>
</div>
</div>
<div className="code-expiration">
Verification number will expire in {expirationCountdown.minutes}:{expirationCountdown.seconds} minutes
Expand Down

0 comments on commit 551dc81

Please sign in to comment.