MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / useColumns

Function useColumns

apps/start/src/components/pages/table/columns.tsx:14–206  ·  view source on GitHub ↗
({
  projectId,
  isGscConnected,
  previousMap,
}: {
  projectId: string;
  isGscConnected: boolean;
  previousMap?: Map<string, number>;
})

Source from the content-addressed store, hash-verified

12};
13
14export function useColumns({
15 projectId,
16 isGscConnected,
17 previousMap,
18}: {
19 projectId: string;
20 isGscConnected: boolean;
21 previousMap?: Map<string, number>;
22}): ColumnDef<PageRow>[] {
23 const number = useNumber();
24 const { apiUrl } = useAppContext();
25
26 return useMemo<ColumnDef<PageRow>[]>(() => {
27 const cols: ColumnDef<PageRow>[] = [
28 {
29 id: 'page',
30 accessorFn: (row) => `${row.origin}${row.path} ${row.title ?? ''}`,
31 header: createHeaderColumn('Page'),
32 size: 400,
33 meta: { bold: true },
34 cell: ({ row }) => {
35 const page = row.original;
36 return (
37 <div className="flex min-w-0 items-center gap-3">
38 <img
39 alt=""
40 className="size-4 shrink-0 rounded-sm"
41 loading="lazy"
42 onError={(e) => {
43 (e.target as HTMLImageElement).style.display = 'none';
44 }}
45 src={`${apiUrl}/misc/favicon?url=${page.origin}`}
46 />
47 <div className="min-w-0">
48 {page.title && (
49 <div className="truncate font-medium text-sm leading-tight">
50 {page.title}
51 </div>
52 )}
53 <div className="flex min-w-0 items-center gap-1">
54 <span className="truncate font-mono text-muted-foreground text-xs">
55 {page.path}
56 </span>
57 <a
58 className="shrink-0 opacity-0 transition-opacity group-hover/row:opacity-100"
59 href={page.origin + page.path}
60 onClick={(e) => e.stopPropagation()}
61 rel="noreferrer noopener"
62 target="_blank"
63 >
64 <ExternalLinkIcon className="size-3 text-muted-foreground" />
65 </a>
66 </div>
67 </div>
68 </div>
69 );
70 },
71 },

Callers 1

PagesTableFunction · 0.90

Calls 6

useNumberFunction · 0.90
useAppContextFunction · 0.90
createHeaderColumnFunction · 0.90
fancyMinutesFunction · 0.90
getMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected