forked from solana-labs/governance-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Matchday UI changes (solana-labs#4)
* Adding Matchday * Adding Matchday-related UI * Adding the additional scopes for Matchday * Removing .env
- Loading branch information
Showing
12 changed files
with
174 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Run in context of one realm: starts with default realm and disables realms page navigation | ||
# REALM=MNGO | ||
MAINNET_RPC=https://mango.rpcpool.com | ||
DEVNET_RPC=https://mango.devnet.rpcpool.com | ||
|
||
DEFAULT_GOVERNANCE_PROGRAM_ID=GTesTBiEWE32WHXXE2S4XbZvA5CrEc4xs6ZgRe895dP | ||
|
||
NEXT_PUBLIC_API_ENDPOINT=http://localhost:3001/graphql | ||
NEXT_PUBLIC_DISCORD_APPLICATION_CLIENT_ID=1042836142560645130 | ||
NEXT_PUBLIC_DISCORD_MATCHDAY_CLIENT_ID=1044361939322683442 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Application } from '@verify-wallet/constants' | ||
import VerifyPage from '@verify-wallet/components' | ||
|
||
const MatchdayVerifyPage = () => { | ||
const parsedLocationHash = new URLSearchParams( | ||
window.location.search.substring(1) | ||
) | ||
|
||
return ( | ||
<VerifyPage | ||
application={Application.MATCHDAY} | ||
discordCode={parsedLocationHash.get('code')} | ||
/> | ||
) | ||
} | ||
|
||
export default MatchdayVerifyPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,15 @@ | ||
import { GlobalFooter } from '@verify-wallet/components/footer' | ||
import cx from '@hub/lib/cx' | ||
import VerifyWallet from '@verify-wallet/components' | ||
import { Application } from '@verify-wallet/constants' | ||
|
||
import React from 'react' | ||
import { StepOne } from '@verify-wallet/components/step-one' | ||
import { StepTwo } from '@verify-wallet/components/step-two' | ||
import { StepThree } from '@verify-wallet/components/step-three' | ||
import { useQuery } from '@hub/hooks/useQuery' | ||
import * as gql from '@hub/components/GlobalHeader/User/gql' | ||
|
||
enum VerifyWalletSteps { | ||
SIGN_IN_WITH_SOLANA, // Step one | ||
AUTHORIZE_DISCORD_OAUTH, // Step two | ||
UPDATE_DISCORD_METADATA, // Step three | ||
} | ||
|
||
const getCurrentStep = ({ user }, accessToken) => { | ||
if (user && !user.error) { | ||
if (accessToken) { | ||
return VerifyWalletSteps.UPDATE_DISCORD_METADATA | ||
} else { | ||
return VerifyWalletSteps.AUTHORIZE_DISCORD_OAUTH | ||
} | ||
} | ||
return VerifyWalletSteps.SIGN_IN_WITH_SOLANA | ||
} | ||
|
||
const VerifyWallet = (/* props: Props */) => { | ||
export default () => { | ||
const parsedLocationHash = new URLSearchParams( | ||
window.location.search.substring(1) | ||
) | ||
const [user] = useQuery(gql.getUserResp, { query: gql.getUser }) | ||
|
||
const currentStep = getCurrentStep({ user }, parsedLocationHash.get('code')) | ||
|
||
return ( | ||
<> | ||
<div | ||
className={cx('grid', 'overflow-x-visible', 'pt-14', 'min-h-screen')} | ||
> | ||
<div className={cx('overflow-hidden', 'w-full', 'py-8')}> | ||
<div className="grid justify-items-center"> | ||
{currentStep === VerifyWalletSteps.SIGN_IN_WITH_SOLANA && ( | ||
<StepOne /> | ||
)} | ||
{currentStep === VerifyWalletSteps.AUTHORIZE_DISCORD_OAUTH && ( | ||
<StepTwo /> | ||
)} | ||
{currentStep === VerifyWalletSteps.UPDATE_DISCORD_METADATA && ( | ||
<StepThree /> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
<GlobalFooter className="absolute bottom-0 w-full mx-auto pt-8 bg-white h-[138px]" /> | ||
</> | ||
<VerifyWallet | ||
application={Application.SOLANA} | ||
discordCode={parsedLocationHash.get('code')} | ||
/> | ||
) | ||
} | ||
|
||
export default VerifyWallet |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { GlobalFooter } from '@verify-wallet/components/footer'; | ||
import { StepOne } from '@verify-wallet/components/step-one'; | ||
import { StepThree } from '@verify-wallet/components/step-three'; | ||
import { StepTwo } from '@verify-wallet/components/step-two'; | ||
import { Application } from '@verify-wallet/constants'; | ||
|
||
import { useJWT } from '@hub/hooks/useJWT'; | ||
import cx from '@hub/lib/cx'; | ||
|
||
enum VerifyWalletSteps { | ||
SIGN_IN_WITH_SOLANA, // Step one | ||
AUTHORIZE_DISCORD_OAUTH, // Step two | ||
UPDATE_DISCORD_METADATA, // Step three | ||
} | ||
|
||
const getCurrentStep = (jwt: string | null, oauthCode: string | null) => { | ||
if (jwt) { | ||
if (oauthCode) { | ||
return VerifyWalletSteps.UPDATE_DISCORD_METADATA; | ||
} else { | ||
return VerifyWalletSteps.AUTHORIZE_DISCORD_OAUTH; | ||
} | ||
} | ||
return VerifyWalletSteps.SIGN_IN_WITH_SOLANA; | ||
}; | ||
|
||
interface Props { | ||
application: Application; | ||
discordCode: string | null; | ||
} | ||
|
||
const VerifyWallet = (props: Props) => { | ||
const [jwt] = useJWT(); | ||
|
||
const currentStep = getCurrentStep(jwt, props.discordCode); | ||
|
||
return ( | ||
<> | ||
<div | ||
className={cx('grid', 'overflow-x-visible', 'pt-14', 'min-h-screen')} | ||
> | ||
<div className={cx('overflow-hidden', 'w-full', 'py-8')}> | ||
<div className="grid justify-items-center"> | ||
{currentStep === VerifyWalletSteps.SIGN_IN_WITH_SOLANA && ( | ||
<StepOne application={props.application} /> | ||
)} | ||
{currentStep === VerifyWalletSteps.AUTHORIZE_DISCORD_OAUTH && ( | ||
<StepTwo application={props.application} /> | ||
)} | ||
{currentStep === VerifyWalletSteps.UPDATE_DISCORD_METADATA && ( | ||
<StepThree application={props.application} /> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
<GlobalFooter className="absolute bottom-0 w-full mx-auto pt-8 bg-white h-[138px]" /> | ||
</> | ||
); | ||
}; | ||
|
||
export default VerifyWallet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum Application { | ||
SOLANA, | ||
MATCHDAY, | ||
} |