import { Button, Card, Group, Loader, Modal, Stack, Text, Tooltip, UnstyledButton, } from "@mantine/core"; import { IconPencil, IconX } from "@tabler/icons-react"; import { useState } from "react"; import { useDisclosure } from "@mantine/hooks"; import { usePatchFlight } from "@/util/hooks"; import { ZeroIntInput } from "@/ui/input/int-input"; export function IntLogItem({ label, content, id = "", field = "", }: { label: string; content: number | string | null; id?: string; field?: string; }) { content = Number(content); const [editValue, setEditValue] = useState(content); const [editError, setEditError] = useState(""); const [editOpened, { open: openEdit, close: closeEdit }] = useDisclosure(false); const updateValue = usePatchFlight(id, field, closeEdit); const editForm = ( ); return ( <> {editForm} {updateValue.isPending ? : null} {updateValue.isError ? ( {updateValue.error?.message} ) : null} {label} {content === null ? : content} ); }