Skip to content

Commit a630e90

Browse files
committed
wip 1
1 parent 680b337 commit a630e90

File tree

7 files changed

+134
-23
lines changed

7 files changed

+134
-23
lines changed

Caddyfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
localhost {
2+
tls internal
3+
reverse_proxy localhost:3000
4+
}

components/Balances.tsx

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
1-
import { useBalances } from '@/components/hooks';
2-
import type { ValueView } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
1+
import { useBalances, useAddresses } from '@/components/hooks';
2+
import type { ValueView, AddressView } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
33
import { ValueViewComponent } from '@penumbra-zone/ui/ValueViewComponent';
4+
import { AddressViewComponent } from '@penumbra-zone/ui/AddressViewComponent';
45
import type React from 'react';
6+
57
export function Balances() {
68
const { data: balances } = useBalances();
9+
const { data: addresses } = useAddresses(1);
10+
11+
const filteredBalances = balances?.filter(b =>
12+
b.balanceView !== undefined &&
13+
b.accountAddress?.addressView.case === 'decoded' &&
14+
b.accountAddress.addressView.value.index?.account === 0
15+
);
16+
17+
if (!filteredBalances?.length || !addresses?.length) return null;
718

8-
return balances?.every((b) => b.balanceView !== undefined)
9-
? balances.map(({ balanceView }) => (
10-
<BalanceRow key={balanceView!.toJsonString()} balance={balanceView!} />
11-
))
12-
: null;
13-
}
19+
const addressView: AddressView = {
20+
addressView: {
21+
case: 'decoded',
22+
value: {
23+
address: addresses[0].address,
24+
index: {
25+
account: 0,
26+
randomizer: new Uint8Array()
27+
}
28+
}
29+
}
30+
};
1431

15-
function BalanceRow({
16-
balance,
17-
}: {
18-
balance: ValueView;
19-
}) {
2032
return (
21-
<div
22-
className="mt-3 flex gap-3 items-center bg-gray-700 text-white p-3"
23-
key={balance.toJsonString()}
24-
>
25-
<ValueViewComponent valueView={balance} />
33+
<div className="p-4">
34+
<div className="flex flex-wrap gap-4 items-center">
35+
<AddressViewComponent addressView={addressView} />
36+
{filteredBalances.map(({ balanceView }) => (
37+
<ValueViewComponent
38+
key={balanceView!.toJsonString()}
39+
valueView={balanceView!}
40+
/>
41+
))}
42+
</div>
2643
</div>
2744
);
28-
}
45+
}

components/WalletInstallSteps.tsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from 'react';
2+
import { useWalletManifests, useConnect } from './hooks';
3+
4+
const WalletInstallSteps = () => {
5+
const { data: wallets } = useWalletManifests();
6+
const { connected, connectionLoading, onConnect } = useConnect();
7+
8+
const isPraxInstalled = wallets &&
9+
Object.values(wallets).some(manifest => manifest.name.includes('Prax'));
10+
11+
return (
12+
<div className="flex items-center justify-center gap-6 py-8">
13+
<div className={`rounded-lg p-4 border-2 ${isPraxInstalled
14+
? 'bg-green-900/20 border-green-500 text-green-400'
15+
: 'bg-gray-900/20 border-blue-500'
16+
}`}>
17+
{isPraxInstalled ? (
18+
<div className="font-medium">
19+
Prax Wallet Installed
20+
</div>
21+
) : (
22+
<a
23+
href="https://praxwallet.com"
24+
target="_blank"
25+
rel="noreferrer"
26+
className="text-blue-400 hover:text-blue-300 font-medium"
27+
>
28+
Install Prax Wallet
29+
</a>
30+
)}
31+
</div>
32+
33+
<div className="flex-grow-0 h-0.5 w-16 bg-gray-700" />
34+
35+
<div className={`rounded-lg p-4 border-2 ${!isPraxInstalled ? 'bg-gray-900/20 border-gray-700 text-gray-500' :
36+
connected ? 'bg-green-900/20 border-green-500 text-green-400' : 'bg-gray-900/20 border-blue-500'
37+
}`}>
38+
{connected ? (
39+
<div className="font-medium">
40+
Wallet Connected
41+
</div>
42+
) : (
43+
<button
44+
onClick={() => isPraxInstalled && onConnect(Object.keys(wallets)[0])}
45+
disabled={!isPraxInstalled || connectionLoading}
46+
className="text-blue-400 hover:text-blue-300 disabled:text-gray-600 font-medium"
47+
>
48+
{connectionLoading ? 'Connecting...' : 'Connect Wallet'}
49+
</button>
50+
)}
51+
</div>
52+
</div>
53+
);
54+
};
55+
56+
export default WalletInstallSteps;

pages/_meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"breadcrumb": false
3636
}
3737
},
38-
"web": "Using Penumbra on the web",
38+
"web": "Getting Started",
3939
"pcli": "Using Penumbra from the command line",
4040
"node": "Running a node",
4141
"frontend": "Running a frontend",
@@ -58,4 +58,4 @@
5858
"breadcrumb": false
5959
}
6060
}
61-
}
61+
}

pages/interchain-privacy.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ across chains.
99

1010
<Steps>
1111

12+
### Test
13+
14+
<Steps>
15+
16+
### Nested
17+
18+
</Steps>
19+
</Steps>
20+
21+
<Steps>
22+
1223
### Deposit
1324

1425
To deposit tokens into Penumbra's shielded pool, users initiate an ordinary IBC

pages/web.md renamed to pages/web.mdx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
# Using Penumbra on the web
1+
import WalletInstallSteps from '@/components/WalletInstallSteps';
2+
import {Balances} from '@/components/Balances';
3+
import { Callout, Steps } from 'nextra/components'
4+
5+
<Steps>
6+
7+
### Install Prax Wallet
8+
9+
To get started, [install Prax Wallet](https://praxwallet.com), then open it from the Chrome extensions toolbar to create a wallet.
10+
11+
<WalletInstallSteps/>
12+
13+
Connected sites, like this one, can view your addresses and balances:
14+
15+
<Balances/>
16+
17+
18+
### Shield Funds
19+
20+
Test
21+
22+
23+
</Steps>
24+
25+
(Old Content)
226

327
Penumbra's web tooling is designed to support a decentralized ecosystem of
428
frontends. This allows different frontends to focus on different user

pages/web/_meta.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"prax": "Prax Wallet",
32
"balances": "Viewing Balances",
43
"ibc-transfers": "Shielding Funds",
54
"send": "Sending Funds",

0 commit comments

Comments
 (0)