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

playground: enable Swap in preview #1136

Merged
merged 6 commits into from
Aug 22, 2024
Merged

playground: enable Swap in preview #1136

merged 6 commits into from
Aug 22, 2024

Conversation

0xAlec
Copy link
Contributor

@0xAlec 0xAlec commented Aug 22, 2024

What changed? Why?

  • create ENVIRONMENT_VARIABLES map
  • disable SwapButton only on production deployments (i.e. onchainkit.xyz/playground)

we can swap on preview deployments off PRs since they are behind authentication

Notes to reviewers

How has it been tested?
can swap on preview deployment attached to this PR

Copy link

vercel bot commented Aug 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 6:17pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 6:17pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 6:17pm


type EnvironmentKey = (typeof ENVIRONMENT)[keyof typeof ENVIRONMENT];

export const ENVARS: Record<EnvironmentKey, string | undefined> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

ENVARS sounds so evil.

Can we call it in a diffeerent 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.

renamed to ENVIRONMENT_VARIABLES (full name) if thats better 🤔

@@ -94,7 +95,9 @@ function SwapComponent() {
token={usdcToken}
type="to"
/>
<SwapButton disabled={true} />
<SwapButton
disabled={ENVARS[ENVIRONMENT.ENVIRONMENT] != 'development'}
Copy link
Contributor

Choose a reason for hiding this comment

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

btw, what you are looking is VERCEL_ENV === 'preview' which is different from NEXT_PUBLIC_VERCEL_ENV.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks - yep it's preview not development

however NEXT_PUBLIC prefix should work

@0xAlec 0xAlec requested a review from Zizzamia August 22, 2024 18:19
@0xAlec 0xAlec changed the title playground: enable Swap in development playground: enable Swap in preview Aug 22, 2024
@Zizzamia Zizzamia merged commit 20b91a6 into main Aug 22, 2024
16 checks passed
@Zizzamia Zizzamia deleted the alec/envars branch August 22, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants