diff --git a/app/layout.tsx b/app/layout.tsx index de4199c..382684d 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -9,7 +9,6 @@ interface Props { const RootLayout: FC = ({ children }) => { return {children}; - // test }; export default RootLayout; \ No newline at end of file diff --git a/src/pages/public/assets/AssetsListItem.tsx b/src/pages/public/assets/AssetsListItem.tsx index e332021..91fe43b 100644 --- a/src/pages/public/assets/AssetsListItem.tsx +++ b/src/pages/public/assets/AssetsListItem.tsx @@ -11,15 +11,25 @@ export interface AssetsItem { type Props = { item: AssetsItem; + tags: string[]; }; -const AssetsListItem: FC = ({ item }) => { +const AssetsListItem: FC = ({ item, tags }) => { const { net } = useStore( useShallow((state) => ({ net: state.net, })) ); + const addToHref = (tag: string) => { + if (!tags[0]) return `?tag[]=${tag}`; + return `?tag[]=${tags.join(",")},${tag}`; + }; + + const removeFromHref = (tag: string) => { + return `?tag[]=${tags.filter((t) => t !== tag).join(",")}`; + }; + return (
  • @@ -31,29 +41,36 @@ const AssetsListItem: FC = ({ item }) => { href={`/${net}/account?id=${item?.issuer}`} style={{ marginRight: "1em" }} > - {item?.code} + + {item?.code} + - - {" "} - {item?.tag ? ( - - #{item?.tag} - - ) : ( - - #other - - )} + {" "} + {item?.tag && + (tags.includes(item.tag) ? ( + + #{item?.tag} + + ) : ( + + #{item?.tag} + + ))}
    - {item?.issuer} - + title={item?.issuer} + aria-label={item?.issuer} + className="account-address" + href={`/${net}/account?id=${item?.issuer}`} + style={{ marginRight: "1em" }} + > + + {item?.issuer} + +
  • ); }; diff --git a/src/pages/public/assets/page.tsx b/src/pages/public/assets/page.tsx index 6553794..8fe2c19 100644 --- a/src/pages/public/assets/page.tsx +++ b/src/pages/public/assets/page.tsx @@ -14,7 +14,6 @@ const Assets: FC = () => { const paramsSearch = searchParams?.get("search"); const tags = searchParams?.get("tag[]")?.split(",") || []; const [staticTags, setStaticTags] = useState([]); - const [filter, setFilter] = useState(paramsSearch || ""); const [currentPage, setCurrentPage] = useState(1); const [displayedItems, setDisplayedItems] = useState([]); @@ -54,7 +53,7 @@ const Assets: FC = () => { useEffect(() => { if (!filter) { const uniqueTags = [...new Set(displayedItems.map((item) => item.tag))]; - setStaticTags(uniqueTags); + setStaticTags(uniqueTags.sort()); } }, [displayedItems, filter]); @@ -127,10 +126,10 @@ const Assets: FC = () => { ? displayedItems .filter((item) => tags.includes(item.tag)) .map((value: AssetsItem, index: number) => ( - + )) : displayedItems.map((value: AssetsItem, index: number) => ( - + ))}