Skip to content

Commit

Permalink
rebase main
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentine1898 committed Apr 23, 2024
1 parent 0d7507d commit cfcd1eb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions apps/minifront/src/components/shared/asset-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import {
Metadata,
ValueView,
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
import { localAssets } from '@penumbra-zone/constants/src/assets';
import { ValueViewComponent } from '@penumbra-zone/ui/components/ui/tx/view/value';
import { useEffect, useMemo, useState } from 'react';
import { IconInput } from '@penumbra-zone/ui/components/ui/icon-input';
import { MagnifyingGlassIcon } from '@radix-ui/react-icons';
import { SwapLoaderResponse } from '../swap/swap-loader';
import { useLoaderData } from 'react-router-dom';

interface AssetSelectorProps {
value?: Metadata;
Expand All @@ -27,10 +28,6 @@ interface AssetSelectorProps {
filter?: (metadata: Metadata) => boolean;
}

const sortedAssets = [...localAssets].sort((a, b) =>
a.symbol.toLocaleLowerCase() < b.symbol.toLocaleLowerCase() ? -1 : 1,
);

/**
* If the `filter` rejects the currently selected `asset`, switch to a different
* `asset`.
Expand All @@ -50,6 +47,9 @@ const switchAssetIfNecessary = ({
};

const useFilteredAssets = ({ value, onChange, filter }: AssetSelectorProps) => {
const { registryAssets } = useLoaderData() as SwapLoaderResponse;
const sortedAssets = [...registryAssets].sort((a, b) => (a.symbol < b.symbol ? -1 : 1));

const [search, setSearch] = useState('');

let assets = filter ? sortedAssets.filter(filter) : sortedAssets;
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

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

0 comments on commit cfcd1eb

Please sign in to comment.