From 27f354317f4ce903996e510419b35becab878132 Mon Sep 17 00:00:00 2001 From: ejmg Date: Wed, 31 Jul 2024 23:44:22 -0500 Subject: [PATCH] cleaned up styling for search results table --- src/app/search/[query]/page.tsx | 10 ++++---- src/components/SearchResultsTable/columns.tsx | 24 +++++++++---------- src/components/SearchResultsTable/index.tsx | 12 ++++------ src/components/TransactionsTable/columns.tsx | 2 +- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/app/search/[query]/page.tsx b/src/app/search/[query]/page.tsx index c2b340f..c6e8eaf 100644 --- a/src/app/search/[query]/page.tsx +++ b/src/app/search/[query]/page.tsx @@ -27,11 +27,11 @@ const Page : FC = ({ params }) => { }); return ( -
-

Search results

- - - +
+

Search results

+ + +
); }; diff --git a/src/components/SearchResultsTable/columns.tsx b/src/components/SearchResultsTable/columns.tsx index 73d4785..e42355d 100644 --- a/src/components/SearchResultsTable/columns.tsx +++ b/src/components/SearchResultsTable/columns.tsx @@ -2,13 +2,10 @@ import { type ColumnDef } from "@tanstack/react-table"; import { SearchResult, type RelatedQuery } from "."; import Link from "next/link"; - -type SearchResultsColumns = SearchResult; - // NOTE: Search Results diverges from all the other table stylings in that most of the text is not xs on smaller devices. // Until I start getting more data, it feels overkill to make it so small for now. This could turn out to be a dumb // pre-caution that I will have to revert sooner than later. -export const columns : Array> = [ +export const columns : Array> = [ { accessorKey: "kind", header: () =>
Kind
, @@ -46,16 +43,19 @@ export const columns : Array> = [ // } if (related !== undefined && related.length !== 0) { return ( -
    - {/* {related.map(({ type, indentifier }, i) =>
  • {type} : {indentifier}
  • )} */} - {related.map(({ type, hash }, i) => { - return
  • {type}:
    {hash}
  • ; - }) - } -
+
+ {related.map(({type, hash}, i) => { + return ( +
+

{type}

+
{hash}
+
+ ); + })} +
); } - return

None

; + return

None

; }, }, ]; diff --git a/src/components/SearchResultsTable/index.tsx b/src/components/SearchResultsTable/index.tsx index a708421..de05b49 100644 --- a/src/components/SearchResultsTable/index.tsx +++ b/src/components/SearchResultsTable/index.tsx @@ -5,7 +5,6 @@ import { type FC } from "react"; import { useSuspenseQuery } from "@tanstack/react-query"; import { getBaseURL } from "@/lib/utils"; - export interface RelatedQuery { type: string, hash: string, @@ -16,9 +15,7 @@ export interface SearchResult { identifier: string, related?: RelatedQuery[], } -// TODO? -// interface TransactionSearchResult {} -// interface BlockSearchResult {} + interface SearchResultsTableProps { className?: string, query: string, @@ -33,12 +30,13 @@ const SearchResultsTable : FC = ({ className, query }) return await data.json(); }, queryKey: ["searchResult", query], - }); + }) as { data: SearchResult }; - const relatedVisible = !!(data as SearchResult)?.related?.at(0); + const relatedVisible = !!data?.related?.at(0); + const columnVisibility = { "related": relatedVisible }; return ( - + ); }; diff --git a/src/components/TransactionsTable/columns.tsx b/src/components/TransactionsTable/columns.tsx index 6446f7e..41fa1b2 100644 --- a/src/components/TransactionsTable/columns.tsx +++ b/src/components/TransactionsTable/columns.tsx @@ -33,7 +33,7 @@ export const columns : Array> = [ header: () =>
Hash
, cell: ({ row }) => { const tx_hash : string = row.getValue("tx_hash"); - return
{tx_hash}
; + return
{tx_hash}
; }, }, ];