Skip to content

Commit

Permalink
layout based on indexer type
Browse files Browse the repository at this point in the history
  • Loading branch information
karooolis committed Jan 16, 2025
1 parent 3d765b2 commit 2535b2d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import { Button } from "../../../../../../components/ui/Button";
import { Input } from "../../../../../../components/ui/Input";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../../../../../components/ui/Table";
import { cn } from "../../../../../../utils";
import { useChain } from "../../../../hooks/useChain";
import { TData, TDataRow, useTableDataQuery } from "../../../../queries/useTableDataQuery";
import { indexerForChainId } from "../../../../utils/indexerForChainId";
import { EditableTableCell } from "./EditableTableCell";
import { ExportButton } from "./ExportButton";
import { typeSortingFn } from "./utils/typeSortingFn";
Expand All @@ -27,10 +29,12 @@ const initialSortingState: SortingState = [];
const initialRows: TData["rows"] = [];

export function TablesViewer({ table, query }: { table?: TableType; query?: string }) {
const { id: chainId } = useChain();
const { data: tableData, isLoading: isTDataLoading, isFetched, isError, error } = useTableDataQuery({ table, query });
const isLoading = isTDataLoading || !isFetched;
const [globalFilter, setGlobalFilter] = useQueryState("filter", parseAsString.withDefault(""));
const [sorting, setSorting] = useQueryState("sort", parseAsJson<SortingState>().withDefault(initialSortingState));
const indexer = indexerForChainId(chainId);

const tableColumns: ColumnDef<TDataRow>[] = useMemo(() => {
if (!table || !tableData) return [];
Expand Down Expand Up @@ -98,7 +102,11 @@ export function TablesViewer({ table, query }: { table?: TableType; query?: stri
});

return (
<div className="!-mt-10 space-y-4">
<div
className={cn("space-y-4", {
"!-mt-10": indexer.type === "hosted",
})}
>
<div className="flex w-1/2 items-center gap-4">
<Input
placeholder="Filter..."
Expand Down

0 comments on commit 2535b2d

Please sign in to comment.