import type { ColumnDef } from '@tanstack/react-table'; import { useStore } from '@tanstack/react-form'; import { Link } from '@tanstack/react-router'; import { type AdminMount, deleteAdminMountInput, useDeleteAdminMount } from '@/api/admin/mounts/queries'; import Button from '@/components/elements/Button'; import { Dialog } from '@/components/elements/dialog'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import DataTableColumnHeader from '@/components/elements/table/DataTableColumnHeader'; import { actionsColumn, DeleteAction, EditLinkAction, RowActions } from '@/components/elements/table/RowActions'; import { Form, useAppForm } from '@/components/form'; interface MountDialogProps { mount: AdminMount; open: boolean; onClose: () => void; } function DeleteMountDialog({ mount, open, onClose }: MountDialogProps) { const { attributes } = mount; const deleteMount = useDeleteAdminMount(); const deleteForm = useAppForm({ defaultValues: { confirm: '' }, onSubmit: async () => { try { await deleteMount.mutateAsync(deleteAdminMountInput(attributes.id, attributes.name)); onClose(); } catch { // Error toast is handled by the mutation. } }, }); const isSubmitting = useStore(deleteForm.store, (state) => state.isSubmitting); return ( ); } const MountIdentityCell = ({ mount }: { mount: AdminMount }) => (
{mount.attributes.description}
) : null}
{path}
);
const MountActionsCell = ({ mount }: { mount: AdminMount }) => (