Skip to content

Commit 7fa68f6

Browse files
karooolisfrolic
andauthored
feat(explorer): key columns indicator (#3447)
Co-authored-by: Kevin Ingersoll <kingersoll@gmail.com>
1 parent 32f3091 commit 7fa68f6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/fast-nails-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/explorer": patch
3+
---
4+
5+
Indicated MUD schema key columns in the table view of the Explore tab.

packages/explorer/src/app/(explorer)/[chainName]/worlds/[worldAddress]/explore/TablesViewer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ArrowUpDownIcon, LoaderIcon, TriangleAlertIcon } from "lucide-react";
1+
import { ArrowUpDownIcon, KeyIcon, LoaderIcon, TriangleAlertIcon } from "lucide-react";
22
import { parseAsJson, parseAsString, useQueryState } from "nuqs";
33
import { useMemo } from "react";
44
import { Table as TableType } from "@latticexyz/config";
@@ -38,6 +38,7 @@ export function TablesViewer({ table, query }: { table?: TableType; query?: stri
3838
return tableData.columns.map((name) => {
3939
const schema = table?.schema[name];
4040
const type = schema?.type;
41+
const keySchema = getKeySchema(table);
4142

4243
return {
4344
accessorKey: name,
@@ -48,6 +49,7 @@ export function TablesViewer({ table, query }: { table?: TableType; query?: stri
4849
className="-ml-4"
4950
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
5051
>
52+
{name in keySchema && <KeyIcon className="mr-2 h-3 w-3" />}
5153
<span className="text-orange-500">{name}</span>
5254
{type && <span className="ml-1 opacity-70">({type})</span>}
5355
<ArrowUpDownIcon className="ml-2 h-4 w-4" />

0 commit comments

Comments
 (0)