Skip to content

Commit

Permalink
Show RPC node images
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepinho committed Apr 2, 2024
1 parent ecf02ca commit 5a8d317
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"exponential-backoff": "^3.1.1",
"framer-motion": "^11.0.22",
"immer": "^10.0.4",
"lucide-react": "^0.363.0",
"node-fetch": "^3.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useStoreShallow } from '../../../utils/use-store-shallow';
import { usePageNav } from '../../../utils/navigate';
import { PagePath } from '../paths';
import { ServicesMessage } from '@penumbra-zone/types/src/services';
import { Network } from 'lucide-react';

const randomSort = () => (Math.random() >= 0.5 ? 1 : -1);

Expand Down Expand Up @@ -55,6 +56,7 @@ export const SetRpcEndpoint = () => {
onSelect={value => void setGRPCEndpoint(value)}
value={rpcEndpoint.url}
isSelected={rpcEndpoint.url === grpcEndpoint}
image={!!rpcEndpoint.imageUrl && <img src={rpcEndpoint.imageUrl} />}
/>
))}

Expand All @@ -75,6 +77,7 @@ export const SetRpcEndpoint = () => {
}}
isSelected={isCustomRpcEndpoint}
value={''}
image={<Network />}
/>
</SelectList>

Expand Down
4 changes: 4 additions & 0 deletions apps/extension/src/shared/rpc-endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { STAKING_TOKEN_METADATA } from '@penumbra-zone/constants/src/assets';

interface RpcEndpoint {
name: string;
url: string;
Expand All @@ -8,9 +10,11 @@ export const RPC_ENDPOINTS: RpcEndpoint[] = [
{
name: 'Penumbra Labs Testnet RPC',
url: 'https://grpc.testnet.penumbra.zone',
imageUrl: STAKING_TOKEN_METADATA.images[0]?.svg,
},
{
name: 'Penumbra Labs Testnet Preview RPC',
url: 'https://grpc.testnet-preview.penumbra.zone',
imageUrl: STAKING_TOKEN_METADATA.images[0]?.svg,
},
];
12 changes: 9 additions & 3 deletions packages/ui/components/ui/select-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,30 @@ const Option = <T,>({
value,
onSelect,
isSelected,
image,
}: {
label: string;
secondaryText?: ReactNode;
value: T;
onSelect: (value: T) => void;
isSelected: boolean;
image?: ReactNode;
}) => (
<div
className={cn(
'bg-charcoal border-[1px] border-solid border-border rounded-[6px] p-4 flex cursor-pointer flex-col gap-1 transition-colors',
'flex items-center cursor-pointer gap-2 rounded-[6px] border-[1px] border-DEFAULT border-solid border-border bg-charcoal p-4 transition-colors',
isSelected && 'border-teal',
)}
role='button'
onClick={() => onSelect(value)}
>
<span>{label}</span>
<div className='flex size-10 shrink-0 items-center justify-center'>{image}</div>

{!!secondaryText && <span className='text-xs text-muted-foreground'>{secondaryText}</span>}
<div className='flex grow flex-col gap-1'>
<div>{label}</div>

{!!secondaryText && <span className='text-xs text-muted-foreground'>{secondaryText}</span>}
</div>
</div>
);

Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a8d317

Please sign in to comment.