MCPcopy
hub / github.com/fosrl/pangolin / OrgLabelsTable

Function OrgLabelsTable

src/components/OrgLabelsTable.tsx:44–238  ·  view source on GitHub ↗
({
    labels,
    orgId,
    pagination,
    rowCount
}: OrgLabelsTableProps)

Source from the content-addressed store, hash-verified

42};
43
44export default function OrgLabelsTable({
45 labels,
46 orgId,
47 pagination,
48 rowCount
49}: OrgLabelsTableProps) {
50 const router = useRouter();
51
52 const {
53 navigate: filter,
54 isNavigating: isFiltering,
55 searchParams
56 } = useNavigationContext();
57
58 const [selectedLabel, setSelectedLabel] = useState<LabelRow | null>(null);
59 const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
60 const [isCreateModalOpen, setIsCreateModalOpen] = useState(false);
61 const [isEditModalOpen, setIsEditModalOpen] = useState(false);
62
63 const [isRefreshing, startTransition] = useTransition();
64
65 const api = createApiClient(useEnvContext());
66 const t = useTranslations();
67
68 function refreshData() {
69 startTransition(async () => {
70 try {
71 router.refresh();
72 } catch {
73 toast({
74 title: t("error"),
75 description: t("refreshError"),
76 variant: "destructive"
77 });
78 }
79 });
80 }
81
82 const handlePaginationChange = (newPage: PaginationState) => {
83 searchParams.set("page", (newPage.pageIndex + 1).toString());
84 searchParams.set("pageSize", newPage.pageSize.toString());
85 filter({ searchParams });
86 };
87
88 const handleSearchChange = useDebouncedCallback((query: string) => {
89 searchParams.set("query", query);
90 searchParams.delete("page");
91 filter({ searchParams });
92 }, 300);
93
94 const columns = useMemo<ExtendedColumnDef<LabelRow>[]>(
95 () => [
96 {
97 accessorKey: "name",
98 enableHiding: false,
99 header: () => {
100 return <span className="p-3">{t("name")}</span>;
101 },

Callers

nothing calls this directly

Calls 6

useNavigationContextFunction · 0.90
createApiClientFunction · 0.90
useEnvContextFunction · 0.90
deleteLabelFunction · 0.85
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected