From 44e77210505c55008362382a87af90f6e7e5b61c Mon Sep 17 00:00:00 2001 From: Sebastien Date: Mon, 22 Jul 2024 22:54:34 +0200 Subject: [PATCH] add env --- app/pages/_app.js | 8 ++++++-- app/styles/Proposal.module.css | 7 ++++++- app/utils/constants.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/pages/_app.js b/app/pages/_app.js index d5dcb60..f3e5029 100644 --- a/app/pages/_app.js +++ b/app/pages/_app.js @@ -3,12 +3,14 @@ import { WalletProvider, } from "@solana/wallet-adapter-react"; import { WalletModalProvider } from "@solana/wallet-adapter-react-ui"; +import { WalletAdapterNetwork } from "@solana/wallet-adapter-base"; import { PhantomWalletAdapter, } from "@solana/wallet-adapter-wallets"; import { useMemo } from "react"; import { AppProvider } from "../context/context"; import "../styles/globals.css"; +import { clusterApiUrl } from "@solana/web3.js"; require("@solana/wallet-adapter-react-ui/styles.css"); @@ -16,9 +18,11 @@ import { useRouter } from 'next/router'; import Header from "../components/Header"; import style from "../styles/Home.module.css"; function MyApp({ Component, pageProps }) { - // const endpoint = clusterApiUrl(WalletAdapterNetwork.Devnet); + + const endpoint = process.env.NEXT_PUBLIC_TEST_NETWORK === 'true' ? "http://127.0.0.1:8899" : clusterApiUrl(WalletAdapterNetwork.Devnet); const router = useRouter(); - const endpoint = "http://127.0.0.1:8899"; + + // const endpoint = "http://127.0.0.1:8899"; const wallets = useMemo( () => [ diff --git a/app/styles/Proposal.module.css b/app/styles/Proposal.module.css index c1d8466..1cd01c6 100644 --- a/app/styles/Proposal.module.css +++ b/app/styles/Proposal.module.css @@ -50,10 +50,15 @@ color: #333; } .error, .success { - color: red; margin-bottom: 0.5em; display: inline-block; } +.error { + color: red; +} +.succes { + color: green; +} .listChoices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); diff --git a/app/utils/constants.js b/app/utils/constants.js index 954f147..f004865 100644 --- a/app/utils/constants.js +++ b/app/utils/constants.js @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; export const PROGRAM_ID = new PublicKey( - "4AEtDMG3A5rFTFwj6KyA6K41dxxpagemC4CaG5w9oABc"//"8KcDj4FdPm6Dq6KoLFCAgPrAYEMbXtE9Ruc7B62UGeyJ" + process.env.NEXT_PUBLIC_PROGRAM_ADDRESS );