diff --git a/bun.lockb b/bun.lockb index 340d0b50..da55e178 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/dappkit b/packages/dappkit index 71bc4b81..6802c581 160000 --- a/packages/dappkit +++ b/packages/dappkit @@ -1 +1 @@ -Subproject commit 71bc4b81aa0aa5eb4f1e857721cbd22633c78f86 +Subproject commit 6802c5810216f8637a904753511f8c1fb226f42a diff --git a/src/components/element/chain/ChainLibrary.tsx b/src/components/element/chain/ChainLibrary.tsx new file mode 100644 index 00000000..3b5a49d5 --- /dev/null +++ b/src/components/element/chain/ChainLibrary.tsx @@ -0,0 +1,15 @@ +import type { Chain } from "@merkl/api"; +import { useMemo } from "react"; +import { ChainTable } from "./ChainTable"; +import ChainTableRow from "./ChainTableRow"; + +export type ChainLibraryProps = { + chains: Chain[]; + count?: number; +}; + +export default function ChainLibrary({ chains, count }: ChainLibraryProps) { + const rows = useMemo(() => chains?.map(c => ), [chains]); + + return {rows}; +} diff --git a/src/components/element/chain/ChainTable.tsx b/src/components/element/chain/ChainTable.tsx new file mode 100644 index 00000000..854384b0 --- /dev/null +++ b/src/components/element/chain/ChainTable.tsx @@ -0,0 +1,11 @@ +import { createTable } from "dappkit"; + +export const [ChainTable, ChainRow, chainColumns] = createTable({ + chain: { + name: "CHAIN", + size: "minmax(350px,1fr)", + compact: "1fr", + className: "justify-start", + main: true, + }, +}); diff --git a/src/components/element/chain/ChainTableRow.tsx b/src/components/element/chain/ChainTableRow.tsx new file mode 100644 index 00000000..5777965e --- /dev/null +++ b/src/components/element/chain/ChainTableRow.tsx @@ -0,0 +1,41 @@ +import type { Chain } from "@merkl/api"; +import { Link } from "@remix-run/react"; +import { Group, Icon } from "dappkit"; +import type { BoxProps } from "dappkit"; +import { Title } from "dappkit"; +import { mergeClass } from "dappkit"; +import type { TagTypes } from "../Tag"; +import { ChainRow } from "./ChainTable"; + +export type ChainTableRowProps = { + hideTags?: (keyof TagTypes)[]; + chain: Chain; +} & BoxProps; + +export default function ChainTableRow({ hideTags, chain, className, ...props }: ChainTableRowProps) { + console.log(chain); + + return ( + + + + + <Icon src={chain.icon} /> + {chain.name} + + + + } + /> + + ); +} diff --git a/src/components/element/functions/SearchBar.tsx b/src/components/element/functions/SearchBar.tsx index 3ca8aee1..9ed747d8 100644 --- a/src/components/element/functions/SearchBar.tsx +++ b/src/components/element/functions/SearchBar.tsx @@ -61,7 +61,7 @@ export default function SearchBar({ icon = false }: SearchBarProps) { switch (category) { case "chain": return ( - ); diff --git a/src/components/element/opportunity/OpportunityTableRow.tsx b/src/components/element/opportunity/OpportunityTableRow.tsx index ffe420d4..1b6960d0 100644 --- a/src/components/element/opportunity/OpportunityTableRow.tsx +++ b/src/components/element/opportunity/OpportunityTableRow.tsx @@ -31,7 +31,6 @@ export default function OpportunityTableRow({ hideTags, opportunity, className, {tags ?.filter(({ type }) => !hideTags || hideTags.includes(type)) .map(tag => { - console.table(tag); return ; })} diff --git a/src/routes/_merkl.chains.$id.tsx b/src/routes/_merkl.chains.$id.tsx index 8439dd49..b24dd2a0 100644 --- a/src/routes/_merkl.chains.$id.tsx +++ b/src/routes/_merkl.chains.$id.tsx @@ -17,18 +17,22 @@ export default function Index() { return ( diff --git a/src/routes/_merkl.chains.(all).(chains).tsx b/src/routes/_merkl.chains.(all).(chains).tsx new file mode 100644 index 00000000..1d034ed9 --- /dev/null +++ b/src/routes/_merkl.chains.(all).(chains).tsx @@ -0,0 +1,22 @@ +import type { LoaderFunctionArgs } from "@remix-run/node"; +import { json, useLoaderData } from "@remix-run/react"; +import { Container, Space } from "packages/dappkit/src"; +import { ChainService } from "src/api/services/chain.service"; +import ChainLibrary from "src/components/element/chain/ChainLibrary"; + +export async function loader({ params: { id }, request }: LoaderFunctionArgs) { + const chains = await ChainService.getAll(); + + return json({ chains, count: chains.length }); +} + +export default function Index() { + const { chains, count } = useLoaderData(); + + return ( + + + + + ); +} diff --git a/src/routes/_merkl.chains.(all).tsx b/src/routes/_merkl.chains.(all).tsx new file mode 100644 index 00000000..c7e8b85c --- /dev/null +++ b/src/routes/_merkl.chains.(all).tsx @@ -0,0 +1,14 @@ +import { Outlet } from "@remix-run/react"; +import Hero from "src/components/composite/Hero"; + +export default function Index() { + return ( + + + + ); +}