// * Packages
import { usePage } from "@inertiajs/react";
import { CornerDownRightIcon } from "lucide-react";
import { ReactNode } from "react";
// * Components shadcn
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
// * Other
import str from "@/hooks/use-string";
import useTrans from "@/hooks/use-translations";
import { ConfigField, DynamicFieldTypes } from "@/back/types/global";
type ConfigTableProps = {
config: ConfigField[];
};
export default function ConfigTable({ config }: ConfigTableProps) {
const enumDynamicFieldTypes = usePage().props .enumDynamicFieldTypes as DynamicFieldTypes;
const getEnumDynamicFieldType = (value: number) => {
return Object.values(enumDynamicFieldTypes).find((def) => def.value === value);
};
const GetChildrenRow = (fields: ConfigField[], depth: number = 0): ReactNode => {
return Object.entries(fields).map(
([id, field]) => (
<>
({field.key})