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

feat: add auth dapp flow #416

Merged
merged 14 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
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
3 changes: 2 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# EXPLORER_PATH points to the browser-interface/static folder in your local filesystem

EXPLORER_PATH="../unity-renderer/browser-interface/static"
EXPLORER_PATH="../unity-renderer/browser-interface/static"
FAST_REFRESH=false
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
outputs:
public_url: ${{ steps.install.outputs.public_url }}
public_path: ${{ steps.install.outputs.public_path }}
env:
CI: false
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
Expand Down
458 changes: 318 additions & 140 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,23 @@
"@dcl/feature-flags": "^1.2.0",
"@dcl/kernel-interface": "^2.0.0-20230512115658.commit-b582e05",
"@dcl/schemas": "^9.10.0",
"@dcl/single-sign-on-client": "^0.1.0",
"@dcl/urn-resolver": "^1.4.0",
"@sentry/browser": "^7.45.0",
"@sentry/tracing": "^7.45.0",
"@sentry/browser": "^7.91.0",
"@sentry/tracing": "^7.91.0",
"decentraland-connect": "^5.3.4",
"decentraland-dapps": "^16.21.4",
"decentraland-dapps": "^16.21.5",
"decentraland-ui": "^4.31.0",
"detect-browser": "^5.2.0",
"eth-connect": "^6.1.0",
"eth-connect": "^6.2.4",
"md5-file": "^5.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.9",
"react-scripts": "^4.0.3",
"react-virtualized": "^9.22.5",
"redux": "^4.0.5",
"redux-saga": "^1.2.3",
"uuid": "^9.0.1",
"validator": "^13.7.0"
},
Expand All @@ -83,10 +85,11 @@
"babel-loader": "^8.1.0",
"customize-cra": "^1.0.0",
"fs-extra": "^10.0.0",
"http-proxy-middleware": "^2.0.6",
"react-app-rewired": "^2.2.1",
"react-is": "^17.0.2",
"react-test-renderer": "^17.0.2",
"redux-devtools-extension": "^2.13.8",
"typescript": "^4.5.5"
}
}
}
591 changes: 590 additions & 1 deletion src/__snapshots__/storybook.test.ts.snap

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useMemo } from 'react'
import React, { useEffect, useMemo } from 'react'
import { connect } from 'react-redux'
import { ApplicationName } from 'decentraland-dapps/dist/modules/features/types'
import { useMobileMediaQuery } from 'decentraland-ui/dist/components/Media'
import { isMobile } from '../integration/browser'
import { StoreType } from '../state/redux'
import { isElectron } from '../integration/desktop'
import { SHOW_WALLET_SELECTOR } from '../integration/url'
import {
FeatureFlags,
isWaitingForRenderer,
Expand All @@ -13,16 +14,18 @@ import {
getFeatureVariantValue,
isFeatureEnabled
} from '../state/selectors'
import { SHOW_WALLET_SELECTOR } from '../integration/url'
import ErrorContainer from './errors/ErrorContainer'
import LoginContainer from './auth/LoginContainer'
import { isMobile } from '../integration/browser'
import { BeginnersGuide } from './auth/BeginnersGuide'
import { BigFooter } from './common/Layout/BigFooter'
import { Navbar } from './common/Layout/Navbar'
import BannerContainer from './banners/BannerContainer'
import { LoadingRender } from './common/Loading/LoadingRender'
import { Navbar } from './common/Layout/Navbar'
import { initializeKernel } from '../integration/kernel'
import StreamContainer from './common/StreamContainer'
import ErrorContainer from './errors/ErrorContainer'
import LoginContainer from './auth/LoginContainer'
import { Audio } from './common/Audio'
import Start from './start'
import MobileContainer from './common/MobileContainer'
import CatalystWarningContainer from './warning/CatalystWarningContainer'
import { LoginWithAuthServerPage } from './auth/LoginWithAuthServerPage'
Expand Down Expand Up @@ -56,6 +59,8 @@ function mapStateToProps(state: StoreType): AppProps {
trustedCatalyst,
error,
sound,
featureFlagsLoaded: !!state.featureFlags.ready,
isAuthDappEnabled: isFeatureEnabled(state, `${ApplicationName.DAPPS}-${FeatureFlags.AuthDapp}`),
isDesktopClientSignInWithAuthDappEnabled
}
}
Expand All @@ -71,13 +76,21 @@ export interface AppProps {
trustedCatalyst: boolean
error: boolean
sound: boolean
isAuthDappEnabled: boolean
featureFlagsLoaded: boolean
isDesktopClientSignInWithAuthDappEnabled: boolean
}

const App: React.FC<AppProps> = (props) => {
const mobile = useMemo(() => isMobile(), [])
const small = useMobileMediaQuery()

useEffect(() => {
if (isElectron() || (props.featureFlagsLoaded && !props.isAuthDappEnabled)) {
initializeKernel()
}
}, [props.isAuthDappEnabled, props.featureFlagsLoaded])

if (!props.trustedCatalyst) {
return <CatalystWarningContainer />
}
Expand All @@ -102,6 +115,10 @@ const App: React.FC<AppProps> = (props) => {
return <LoadingRender />
}

if (props.isAuthDappEnabled && !isElectron()) {
return <Start />
}

if (isElectron() && props.isDesktopClientSignInWithAuthDappEnabled) {
return <LoginWithAuthServerPage />
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/common/MobileContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ export default React.memo(function MobileContainer() {

<section>
<h2>Get a reminder</h2>
<p>Get an email reminder to jump into Decentraland the next time you are back at a computer. You will also be added to the Decentraland Weekly newsletter to receive the latest news and events.</p>
<p>
Get an email reminder to jump into Decentraland the next time you are back at a computer. You will also be
added to the Decentraland Weekly newsletter to receive the latest news and events.
</p>
<iframe
title='subscribe'
className='MobileSubscribe'
title="subscribe"
className="MobileSubscribe"
src="https://embeds.beehiiv.com/d7d652da-adc8-422f-9176-4b653a244020?slim=true"
data-test-id="beehiiv-embed"
></iframe>
Expand Down
15 changes: 15 additions & 0 deletions src/components/start/Start.container.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { connect } from 'react-redux'
import { isConnected, isConnecting, getData as getWallet } from 'decentraland-dapps/dist/modules/wallet/selectors'
import { StoreType } from '../../state/redux'
import { Props } from './Start.types'
import Start from './Start'

const mapStateToProps = (state: StoreType): Props => {
return {
wallet: getWallet(state),
isConnecting: isConnecting(state),
isConnected: isConnected(state),
}
}

export default connect(mapStateToProps)(Start)
128 changes: 128 additions & 0 deletions src/components/start/Start.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#root {
position: fixed;
}

.explorer-website-start {
position: fixed;
width: 100vw;
height: 100vh;
background: radial-gradient(70% 108% at 90% 50%, #ff00f5 0%, #540880 100%);
display: flex;
align-items: center;
}

.explorer-website-start .ui.loader:after {
border-color: #540880 transparent transparent !important
}

.explorer-website-start .start-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 150px;
padding-right: 40px;
height: 100%;
}

.explorer-website-start .start-wearable-preview {
height: 80vh;
width: 50%;
position: relative;
}

.explorer-website-start .start-wearable-preview::before {
border-radius: 595.795px;
opacity: 0.6;
background: #ff00f5;
filter: blur(126.40625px);
content: '';
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}

.explorer-website-start .start-wearable-preview iframe {
background: transparent;
}

.explorer-website-start .start-links {
display: flex;
flex-direction: column;
gap: 20px;
}

.explorer-website-start .start-links .ui.button {
max-width: 300px;
display: flex;
justify-content: center;
}

.explorer-website-start .start-links .ui.button.inverted {
color: white;
border-color: white;
}

.explorer-website-start .start-title {
display: flex;
flex-direction: column;
color: white;
font-size: 30px;
line-height: normal;
margin-bottom: 20px;
letter-spacing: 1px;
}

.explorer-website-start .start-desktop-download {
color: white;
display: flex;
flex-direction: column;
font-size: 18px;
font-weight: 300;
gap: 10px;
border-top: 1px solid white;
padding-top: 20px;
width: fit-content;
letter-spacing: 1px;
}

.explorer-website-start .start-desktop-download a span {
text-decoration: underline;
color: white;
}

.explorer-website-start .start-links .icon:before {
font-size: 20px;
}

.explorer-website-start .start-links .icon {
width: fit-content;
height: fit-content;
opacity: 1;
}

.explorer-website-start .discord-link-button {
position: absolute;
bottom: 20px;
right: 20px;
display: flex;
color: white;
border-radius: 12px;
padding: 14px;
background: #161518;
align-items: flex-end;
gap: 5px;
}

.explorer-website-start .discord-info {
display: flex;
flex-direction: column;
color: white;
}

.explorer-website-start .discord-icon {
font-size: 28px;
}
Loading
Loading