import { useState } from 'react'; import { IoAdd } from 'react-icons/io5'; import { Button } from '@chakra-ui/react'; import { CustomField, CustomFieldLabel } from 'ontime-types'; import { deleteCustomField, editCustomField, postCustomField } from '../../../../../common/api/customFields'; import Info from '../../../../../common/components/info/Info'; import ExternalLink from '../../../../../common/components/link/external-link/ExternalLink'; import useCustomFields from '../../../../../common/hooks-query/useCustomFields'; import { customFieldsDocsUrl } from '../../../../../externals'; import * as Panel from '../../../panel-utils/PanelUtils'; import CustomFieldEntry from './CustomFieldEntry'; import CustomFieldForm from './CustomFieldForm'; export default function CustomFields() { const { data, refetch } = useCustomFields(); const [isAdding, setIsAdding] = useState(false); const handleInitiateCreate = () => { setIsAdding(true); }; const handleCancel = () => { setIsAdding(false); }; const handleCreate = async (customField: CustomField) => { await postCustomField(customField); refetch(); setIsAdding(false); }; const handleEditField = async (label: CustomFieldLabel, customField: CustomField) => { await editCustomField(label, customField); refetch(); }; const handleDelete = async (label: string) => { try { await deleteCustomField(label); refetch(); } catch (_error) { /** we do not handle errors here */ } }; return ( Custom fields Custom fields allow for additional information to be added to an event.

This data is not used by Ontime, but provides place for cueing or department specific information (eg. light, sound, camera).

Custom fields can be used width the Integrations feature using the generated key. See the docs
{isAdding && } Colour Type Name Key (used in Integrations) {Object.entries(data).map(([key, { colour, label, type }]) => { return ( ); })}
); }