import { Callout, Collapse } from '@blueprintjs/core'; import styled from '@emotion/styled'; import { useSelector } from '@tanstack/react-store'; import { Button, withForm } from 'react-science/ui'; import { defaultGeneralSettingsFormValues, workspaceValidation, } from '../validation.ts'; import { useErrors } from './context.tsx'; export const GeneralSettingsErrorRenderer = withForm({ defaultValues: defaultGeneralSettingsFormValues, validators: { onDynamic: workspaceValidation }, render: function GeneralSettingsErrorRenderer({ form }) { const { isOpen, setIsOpen } = useErrors(); const errors = useSelector(form.store, (state) => { return Object.values(state.errorMap.onDynamic ?? {}).flat(); }); return ( setIsOpen(false)} />
    {errors.map((error, index) => { const path = error.path ?.map((path) => typeof path === 'object' ? path.key : String(path), ) .join('.'); return ( // eslint-disable-next-line @eslint-react/no-array-index-key
  • {path}: {error.message}
  • ); })}
); }, }); const CloseButton = styled(Button)` position: absolute; right: 0; top: 0; `;