Skip to content

Commit 18b2946

Browse files
authored
Merge pull request #537 from o1-labs/feature/tutorial-4-code-update
Update tutorial 4 code
2 parents 6aea996 + 1b7137a commit 18b2946

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ This tutorial has been tested with:
4646

4747
Before you go through the tutorial steps, take a look at a working zkApp UI example that has already been deployed to GitHub Pages.
4848

49-
1. In a Chrome web browser with the Auro wallet extension, go to [https://es92.github.io/zkApp-examples/index.html](https://es92.github.io/zkApp-examples/index.html).
49+
1. In a Chrome web browser with the Auro wallet extension, go to [https://ymekuria.github.io/04-zkapp-browser-ui/index.html](https://ymekuria.github.io/04-zkapp-browser-ui/index.html).
5050
1. When prompted, select **Connect** to let the website view your Auro wallet account.
5151
1. In network dropdown menu in the wallet UI, select the **Berkeley** network:
5252
<figure>

examples/zkapps/04-zkapp-browser-ui/ui/next.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
/** @type {import('next').NextConfig} */
2+
3+
const isProd = process.env.NODE_ENV === 'production'
24
const nextConfig = {
35
reactStrictMode: false,
46
pageExtensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js'],
7+
8+
/* Used to serve the Next.js app from a subdirectory (the GitHub repo name) and
9+
* assetPrefix is used to serve assets (JS, CSS, images, etc.) from that subdirectory
10+
* when deployed to GitHub Pages. The assetPrefix needs to be added manually to any assets
11+
* if they're not loaded by Next.js' automatic handling (for example, in CSS files or in a <img> element).
12+
*/
13+
basePath: isProd ? '/04-zkapp-browser-ui': '',
14+
assetPrefix: isProd ? '/04-zkapp-browser-ui': '',
515

616
webpack(config) {
717
config.resolve.alias = {

examples/zkapps/04-zkapp-browser-ui/ui/src/pages/index.page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default function Home() {
8585
setDisplayText('Getting zkApp state...');
8686
await zkappWorkerClient.fetchAccount({ publicKey: zkappPublicKey });
8787
const currentNum = await zkappWorkerClient.getNum();
88-
console.log(`Current number in zkApp state: ${currentNum.toString()}`);
88+
console.log(`Current state in zkApp: ${currentNum.toString()}`);
8989
setDisplayText('');
9090

9191
setState({
@@ -179,7 +179,7 @@ export default function Home() {
179179
});
180180
const currentNum = await state.zkappWorkerClient!.getNum();
181181
setState({ ...state, currentNum });
182-
console.log(`Current number in zkApp state: ${currentNum.toString()}`);
182+
console.log(`Current state in zkApp: ${currentNum.toString()}`);
183183
setDisplayText('');
184184
};
185185

@@ -191,12 +191,12 @@ export default function Home() {
191191
const auroLink = 'https://www.aurowallet.com/';
192192
const auroLinkElem = (
193193
<a href={auroLink} target="_blank" rel="noreferrer">
194-
[Link]{' '}
194+
Install Auro wallet here
195195
</a>
196196
);
197197
hasWallet = (
198198
<div>
199-
Could not find a wallet. Install Auro wallet here: {auroLinkElem}
199+
Could not find a wallet. {auroLinkElem}
200200
</div>
201201
);
202202
}
@@ -225,9 +225,9 @@ export default function Home() {
225225
'https://faucet.minaprotocol.com/?address=' + state.publicKey!.toBase58();
226226
accountDoesNotExist = (
227227
<div>
228-
Account does not exist. Please visit the faucet to fund this account
228+
Account does not exist.
229229
<a href={faucetLink} target="_blank" rel="noreferrer">
230-
[Link]{' '}
230+
Visit the faucet to fund this fee payer account
231231
</a>
232232
</div>
233233
);
@@ -238,7 +238,7 @@ export default function Home() {
238238
mainContent = (
239239
<div style={{ justifyContent: 'center', alignItems: 'center' }}>
240240
<div className={styles.center} style={{ padding: 0 }}>
241-
Current Number in zkApp: {state.currentNum!.toString()}{' '}
241+
Current state in zkApp: {state.currentNum!.toString()}{' '}
242242
</div>
243243
<button
244244
className={styles.card}

examples/zkapps/04-zkapp-browser-ui/ui/src/styles/globals.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ a {
4747
color: inherit;
4848
text-decoration: none;
4949
}
50+
5051
a:hover {
5152
text-decoration: underline;
52-
53+
opacity: .7;
5354
}

0 commit comments

Comments
 (0)