Skip to content

Commit

Permalink
feat: toggle options based on isProduction
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryQW committed Dec 12, 2023
1 parent de2e774 commit 7cccd43
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
5 changes: 5 additions & 0 deletions packages/site/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* To use this, rename to $(.env.production) and set the production SNAP_ORIGIN here
*/
SNAP_ORIGIN=local:http://localhost:8080
ENVIRONMENT=production
44 changes: 23 additions & 21 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,18 @@ const Index = () => {
{isProduction ? 'Install MetaMask' : 'Install MetaMask Flask'}
</CardTitle>
<CardDescription className="h-[120px]">
Snaps is pre-release software only available in MetaMask Flask,
a canary distribution for developers with access to upcoming
features.
MetaMask Snaps allows users to add features and functionality to
their MetaMask wallet. Individual Snaps are features created by
third-party developers that MetaMask users can install directly
into their wallet.
</CardDescription>
</CardHeader>
<CardFooter>
<InstallFlaskButton />
</CardFooter>
</Card>
)}
{!state.installedSnap && (
{isMetaMaskReady && !state.installedSnap && (
<Card>
<CardHeader>
<CardTitle>Install</CardTitle>
Expand Down Expand Up @@ -194,24 +195,25 @@ const Index = () => {
</CardFooter>
</Card>
)}
{state.installedSnap && (
<Card>
<CardHeader>
<CardTitle>Reset Snap State</CardTitle>
<CardDescription className="h-[120px]">
Reset the Snap's state, in case anything does not work properly.
This does not affect your wallet or assets in anyway.
</CardDescription>
</CardHeader>
<CardFooter>
<ResetButton
onClick={handleSendClearStateClick}
disabled={!state.installedSnap}
/>
</CardFooter>
</Card>
)}

<Card>
<CardHeader>
<CardTitle>Reset Snap State</CardTitle>
<CardDescription className="h-[120px]">
Reset the Snap's state, in case anything does not work properly.
This does not affect your wallet or assets in anyway.
</CardDescription>
</CardHeader>
<CardFooter>
<ResetButton
onClick={handleSendClearStateClick}
disabled={!state.installedSnap}
/>
</CardFooter>
</Card>

{!isProduction && (
{!isProduction && state.installedSnap && (
<>
<Card>
<CardHeader>
Expand Down

0 comments on commit 7cccd43

Please sign in to comment.