From 63fa79b95e00ec563235d2b8a17e5ed120cc1016 Mon Sep 17 00:00:00 2001 From: null Date: Mon, 25 May 2026 14:30:16 -0500 Subject: [PATCH] reaarange table --- .../git/ForgejoRepositoriesTable.tsx | 39 ++++++++++--------- frontend/src/components/tables/DataTable.tsx | 15 ++++++- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/git/ForgejoRepositoriesTable.tsx b/frontend/src/components/git/ForgejoRepositoriesTable.tsx index b3e8b69..65a9cb9 100644 --- a/frontend/src/components/git/ForgejoRepositoriesTable.tsx +++ b/frontend/src/components/git/ForgejoRepositoriesTable.tsx @@ -26,10 +26,11 @@ import { GitBranch, GitCommitHorizontal, GitFork, - KeyRound, Loader2, + Pencil, RefreshCw, ShieldCheck, + Trash2, } from "lucide-react"; import { DataTable, @@ -45,6 +46,11 @@ import type { const repositoryLabel = (repo: ForgejoRepository) => repo.display_name || `${repo.owner}/${repo.repo}`; +const formatConnectionUrl = (value?: string | null) => { + if (!value) return "No connection"; + return value.replace(/^https?:\/\//i, "").replace(/\/$/, ""); +}; + const repositoryTone = (repo: ForgejoRepository) => { if (repo.last_sync_error) return "danger"; if (!repo.active || repo.is_archived) return "muted"; @@ -143,19 +149,21 @@ export function ForgejoRepositoriesTable({ const rowActions: DataTableRowAction[] = [ { key: "edit", - label: "Edit", + label: , + ariaLabel: "Edit repository", href: (row) => `/git-projects/repositories/${row.id}/edit`, className: - "inline-flex h-8 items-center justify-center rounded-lg px-3 text-xs font-semibold text-muted transition hover:bg-[color:var(--surface-muted)] hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--accent)]", + "inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted transition hover:bg-[color:var(--surface-muted)] hover:text-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--accent)]", }, ...(onDelete ? [ { key: "delete", - label: "Delete", + label: , + ariaLabel: "Delete repository", onClick: onDelete, className: - "h-8 rounded-lg px-3 text-xs font-semibold text-muted transition hover:bg-[color:rgba(248,113,113,0.1)] hover:text-[color:var(--danger)]", + "h-8 w-8 rounded-lg p-0 text-muted transition hover:bg-[color:rgba(248,113,113,0.1)] hover:text-[color:var(--danger)]", } satisfies DataTableRowAction, ] : []), @@ -240,6 +248,10 @@ const columns = ( {repositoryLabel(repo)} + + + Git + {repo.default_branch ? ( @@ -291,11 +303,8 @@ const columns = ( const connection = row.original.connection; return (
- - {connection?.name} - - {connection?.base_url} + {formatConnectionUrl(connection?.base_url)}
); @@ -328,15 +337,9 @@ const columns = ( ) : null} {repo.has_webhook_secret ? ( - Webhook - ) : ( - - - No secret - - )} + ) : null} {repo.last_sync_error ? ( @@ -359,11 +362,11 @@ const columns = ( }, { accessorKey: "openIssues", - header: "Issues", + header: () => Issues, cell: ({ row }) => (
0 ? "border-[color:rgba(251,191,36,0.24)] bg-[color:rgba(251,191,36,0.08)]" : "border-[color:rgba(52,211,153,0.18)] bg-[color:rgba(52,211,153,0.055)]", diff --git a/frontend/src/components/tables/DataTable.tsx b/frontend/src/components/tables/DataTable.tsx index 0aeeddc..459982b 100644 --- a/frontend/src/components/tables/DataTable.tsx +++ b/frontend/src/components/tables/DataTable.tsx @@ -19,7 +19,8 @@ export type DataTableEmptyState = { export type DataTableRowAction = { key: string; - label: string; + label: ReactNode; + ariaLabel?: string; href?: (row: TData) => string | null; onClick?: (row: TData) => void; className?: string; @@ -166,6 +167,12 @@ export function DataTable({ ({ variant="ghost" size="sm" className={action.className} + aria-label={action.ariaLabel} + title={ + typeof action.label === "string" + ? action.label + : action.ariaLabel + } onClick={() => action.onClick?.(row.original)} > {action.label}