Skip to content

Commit

Permalink
Merge branch 'main' into multi-fees-max
Browse files Browse the repository at this point in the history
  • Loading branch information
TalDerei authored Jul 3, 2024
2 parents 8686924 + cd8feef commit 7b60848
Show file tree
Hide file tree
Showing 19 changed files with 145 additions and 151 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-pears-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'minifront': patch
---

Combine active + upcoming auctions
5 changes: 5 additions & 0 deletions .changeset/light-clouds-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'minifront': patch
---

Fix issue where the connect page wasn't rendered right on some routes.
2 changes: 1 addition & 1 deletion .github/workflows/compile-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
restore-keys: ${{ hashFiles('**/Cargo.lock') }}
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/deploy-firebase-dapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
- name: Checkout the source code
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/packages-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/turbo-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-lint
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand All @@ -61,7 +61,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-built
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand All @@ -82,7 +82,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-test
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand All @@ -104,7 +104,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-lint:rust
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand All @@ -128,7 +128,7 @@ jobs:
path: .turbo
key: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-test:rust
restore-keys: ${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.ref }}-${{ github.sha }}-compiled
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
- uses: buildjet/setup-node@v4
with:
node-version: '22'
Expand Down
48 changes: 25 additions & 23 deletions apps/minifront/src/components/header/menu/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,32 @@ export const ProviderMenu = () => {
{chainId}
</NavigationMenu.Trigger>
<NavigationMenu.Content className={cn(...dropdownStyle, 'w-64')}>
<NavigationMenu.Item className={cn(...itemStyle)}>
<NavigationMenu.Link className={cn(...linkStyle, 'p-0', 'leading-normal')}>
<div className='ml-4 text-muted-foreground'>
<span className='font-headline text-muted'>
{providerManifest.name} {providerManifest.version}
<ul>
<NavigationMenu.Item className={cn(...itemStyle)}>
<NavigationMenu.Link className={cn(...linkStyle, 'p-0', 'leading-normal')}>
<div className='ml-4 text-muted-foreground'>
<span className='font-headline text-muted'>
{providerManifest.name} {providerManifest.version}
</span>
<p>{providerManifest.description}</p>
</div>
</NavigationMenu.Link>
</NavigationMenu.Item>
<NavigationMenu.Item
hidden={
// hide if injection does not contain disconnect
!window[PenumbraSymbol]?.[providerOrigin]?.disconnect
}
className={cn(...itemStyle)}
>
<NavigationMenu.Link className={cn(...linkStyle)} onSelect={disconnect}>
<span>
<LinkBreak1Icon className={cn('size-[1em]', 'inline-block')} />
&nbsp;Disconnect
</span>
<p>{providerManifest.description}</p>
</div>
</NavigationMenu.Link>
</NavigationMenu.Item>
<NavigationMenu.Item
hidden={
// hide if injection does not contain disconnect
!window[PenumbraSymbol]?.[providerOrigin]?.disconnect
}
className={cn(...itemStyle)}
>
<NavigationMenu.Link className={cn(...linkStyle)} onSelect={disconnect}>
<span>
<LinkBreak1Icon className={cn('size-[1em]', 'inline-block')} />
&nbsp;Disconnect
</span>
</NavigationMenu.Link>
</NavigationMenu.Item>
</NavigationMenu.Link>
</NavigationMenu.Item>
</ul>
</NavigationMenu.Content>
</NavigationMenu.Item>
<NavigationMenu.Viewport className='absolute z-50' />
Expand Down
16 changes: 9 additions & 7 deletions apps/minifront/src/components/header/menu/tablet-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export const TabletNav = () => {
<CaretDownIcon className='inline-block text-right align-middle transition duration-200 group-data-[state=open]:-scale-y-100' />
</NavigationMenu.Trigger>
<NavigationMenu.Content className={cn('w-[138px]', ...dropdownStyle)}>
{[dashboardLink, ...headerLinks].map(({ href, label }) => (
<NavigationMenu.Item key={href} className={cn(...itemStyle)}>
<NavigationMenu.Link className={cn(...linkStyle)} onSelect={() => navigate(href)}>
{label}
</NavigationMenu.Link>
</NavigationMenu.Item>
))}
<ul>
{[dashboardLink, ...headerLinks].map(({ href, label }) => (
<NavigationMenu.Item key={href} className={cn(...itemStyle)}>
<NavigationMenu.Link className={cn(...linkStyle)} onSelect={() => navigate(href)}>
{label}
</NavigationMenu.Link>
</NavigationMenu.Item>
))}
</ul>
</NavigationMenu.Content>
</NavigationMenu.Item>
<NavigationMenu.Viewport className='absolute z-50' />
Expand Down
7 changes: 1 addition & 6 deletions apps/minifront/src/components/root-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const rootRouter: Router = createHashRouter([
path: '/',
element: <Layout />,
errorElement: <ErrorBoundary />,
loader: abortLoader,
children: [
{ index: true, loader: () => redirect(PagePath.DASHBOARD) },
{
Expand All @@ -28,7 +29,6 @@ export const rootRouter: Router = createHashRouter([
children: [
{
index: true,
loader: abortLoader,
element: <AssetsTable />,
},
{
Expand All @@ -43,7 +43,6 @@ export const rootRouter: Router = createHashRouter([
children: [
{
index: true,
loader: abortLoader,
element: <SendForm />,
},
{
Expand All @@ -54,23 +53,19 @@ export const rootRouter: Router = createHashRouter([
},
{
path: PagePath.SWAP,
loader: abortLoader,
element: <SwapLayout />,
},
{
path: PagePath.TRANSACTION_DETAILS,
loader: abortLoader,
element: <TxDetails />,
errorElement: <TxDetailsErrorBoundary />,
},
{
path: PagePath.STAKING,
loader: abortLoader,
element: <StakingLayout />,
},
{
path: PagePath.IBC,
loader: abortLoader,
element: <IbcLayout />,
},
],
Expand Down
50 changes: 34 additions & 16 deletions apps/minifront/src/components/shared/selectors/asset-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import {
ValueView,
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
import { ValueViewComponent } from '@repo/ui/components/ui/value';
import { useEffect, useId, useMemo, useState } from 'react';
import { useCallback, useEffect, useId, useMemo, useState } from 'react';
import { IconInput } from '@repo/ui/components/ui/icon-input';
import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
import { Box } from '@repo/ui/components/ui/box';
import { motion } from 'framer-motion';
import { metadataBySearch } from './search-filters';
import { cn } from '@repo/ui/lib/utils';
import { LoadingIndicator } from './loading-indicator';
import { Table, TableBody, TableCell, TableRow } from '@repo/ui/components/ui/table';

interface AssetSelectorProps {
assets: Metadata[];
Expand Down Expand Up @@ -94,6 +95,13 @@ export const AssetSelector = ({ assets, loading, onChange, value, filter }: Asse
[value],
);

const isSelected = useCallback(
(metadata: Metadata) => {
return value?.equals(metadata);
},
[value],
);

return (
<>
{!isOpen && (
Expand Down Expand Up @@ -139,21 +147,31 @@ export const AssetSelector = ({ assets, loading, onChange, value, filter }: Asse
/>
</Box>

{filteredAssets.map(metadata => (
<div key={metadata.display} className='flex flex-col'>
<DialogClose>
<div
className={
'flex cursor-pointer justify-start gap-[6px] overflow-hidden py-[10px] font-bold text-muted-foreground hover:-mx-4 hover:bg-light-brown hover:px-4'
}
onClick={() => onChange(metadata)}
>
<AssetIcon metadata={metadata} />
<p className='truncate'>{metadata.symbol || 'Unknown asset'}</p>
</div>
</DialogClose>
</div>
))}
<Table>
<TableBody>
{filteredAssets.map(metadata => (
<DialogClose asChild key={metadata.display}>
<TableRow
className='cursor-pointer justify-start overflow-hidden font-bold text-muted-foreground'
onClick={() => onChange(metadata)}
role='button'
>
<TableCell className='p-0'>
<div
className={cn(
'-mx-4 flex h-full gap-[6px] p-4 hover:bg-light-brown',
isSelected(metadata) && 'bg-light-brown',
)}
>
<AssetIcon metadata={metadata} />
<p className='truncate'>{metadata.symbol || 'Unknown asset'}</p>
</div>
</TableCell>
</TableRow>
</DialogClose>
))}
</TableBody>
</Table>
</div>
</div>
</DialogContent>
Expand Down
56 changes: 32 additions & 24 deletions apps/minifront/src/components/shared/selectors/balance-item.tsx
Original file line number Diff line number Diff line change
@@ -1,56 +1,64 @@
import { BalanceOrMetadata, isBalance, isMetadata } from './helpers';
import { getAddressIndex } from '@penumbra-zone/getters/address-view';
import { getMetadataFromBalancesResponseOptional } from '@penumbra-zone/getters/balances-response';
import {
getMetadataFromBalancesResponse,
getMetadataFromBalancesResponseOptional,
} from '@penumbra-zone/getters/balances-response';
import { useMemo } from 'react';
import { DialogClose } from '@repo/ui/components/ui/dialog';
import { cn } from '@repo/ui/lib/utils';
import { AssetIcon } from '@repo/ui/components/ui/asset-icon';
import { ValueViewComponent } from '@repo/ui/components/ui/value';
import { TableCell, TableRow } from '@repo/ui/components/ui/table';
import { BalancesResponse } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb';

interface BalanceItemProps {
asset: BalanceOrMetadata;
value?: BalanceOrMetadata;
value?: BalancesResponse;
onSelect: (value: BalanceOrMetadata) => void;
}

export const BalanceItem = ({ asset, value, onSelect }: BalanceItemProps) => {
const account = isBalance(asset) ? getAddressIndex(asset.accountAddress).account : undefined;
const metadata = isMetadata(asset) ? asset : getMetadataFromBalancesResponseOptional(asset);
const metadataFromAsset = isMetadata(asset)
? asset
: getMetadataFromBalancesResponseOptional(asset);
const metadataFromValue = getMetadataFromBalancesResponse.optional()(value);

const isSelected = useMemo(() => {
if (!value) return false;
if (isMetadata(value) && isMetadata(asset)) {
return value.equals(asset);
}
if (isBalance(value) && isBalance(asset)) {
return value.equals(asset);
}
if (isBalance(asset)) return value.equals(asset);
if (isMetadata(asset)) return metadataFromValue?.equals(metadataFromAsset);
return false;
}, [asset, value]);

return (
<div className='flex flex-col'>
<DialogClose onClick={() => onSelect(asset)}>
<div
className={cn(
'grid grid-cols-5 py-[10px] gap-3 cursor-pointer hover:bg-light-brown hover:px-4 hover:-mx-4 font-bold text-muted-foreground',
isSelected && 'bg-light-brown px-4 -mx-4',
)}
>
<DialogClose asChild onClick={() => onSelect(asset)}>
<TableRow
className={cn(
'cursor-pointer hover:bg-light-brown font-bold text-muted-foreground',
isSelected && 'bg-light-brown',
)}
>
<TableCell>{account}</TableCell>

<TableCell>
<div className='col-span-2 flex items-center justify-start gap-1'>
<AssetIcon metadata={metadata} />
<p className='truncate'>{metadata?.symbol ? metadata.symbol : 'Unknown asset'}</p>
<AssetIcon metadata={metadataFromAsset} />
<p className='truncate'>
{metadataFromAsset?.symbol ? metadataFromAsset.symbol : 'Unknown asset'}
</p>
</div>
</TableCell>

<TableCell>
<div className='col-span-2 flex justify-end'>
{isBalance(asset) && (
<ValueViewComponent showIcon={false} showDenom={false} view={asset.balanceView} />
)}
</div>

<p className='flex justify-center'>{account}</p>
</div>
</DialogClose>
</div>
</TableCell>
</TableRow>
</DialogClose>
);
};
Loading

0 comments on commit 7b60848

Please sign in to comment.