import { Button, Radio, RadioGroup, Section, SectionCard, SegmentedControl, Tag, } from '@blueprintjs/core'; import type { ExportPreferences } from '@zakodium/nmrium-core'; import { useState } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import { CheckController } from '../../../elements/CheckController.js'; import Label from '../../../elements/Label.js'; import { NumberInput2Controller } from '../../../elements/NumberInput2Controller.js'; import { Select2Controller } from '../../../elements/Select2Controller.js'; import { units } from '../../../elements/export/units.js'; import { useExportConfigurer } from '../../../elements/export/useExportConfigurer.js'; import { getExportDefaultOptionsByMode } from '../../../elements/export/utilities/getExportOptions.js'; import type { Mode } from '../../../elements/export/utilities/getModes.js'; import { MODES } from '../../../elements/export/utilities/getModes.js'; import type { SizeItem } from '../../../elements/print/pageSize.js'; import { getSizesList } from '../../../elements/print/pageSize.js'; import type { WorkspaceWithSource } from '../../../reducer/preferences/preferencesReducer.js'; import { labelStyle } from '../../SaveAsModal.js'; export function ExportTabContent() { return ( <>
); } interface ExportOptionsProps { exportAs: keyof ExportPreferences; } function ExportOptions(props: ExportOptionsProps) { const { exportAs } = props; const path: `export.${keyof ExportPreferences}` = `export.${exportAs}`; const { setValue, control, formState: { isValid, errors }, getValues, watch, } = useFormContext(); const defaultValue = getValues(path); const currentOptions = watch(path) || defaultValue; const { dpi = 0, mode: originalMode } = currentOptions; const layout = 'layout' in currentOptions ? currentOptions.layout : undefined; const unit = 'unit' in currentOptions ? currentOptions.unit : undefined; const [mode, setMode] = useState(originalMode); const { widthInPixel, heightInPixel, isAspectRatioEnabled, changeDPI, enableAspectRatio, changeSize, changeUnit, } = useExportConfigurer(currentOptions); let sizesList: SizeItem[] = []; if (layout) { sizesList = getSizesList(layout); } function handleChangeMode(mode: any) { const options = defaultValue; setMode(mode); if (options.mode === mode) { setValue(path, defaultValue); } else { setValue(path, getExportDefaultOptionsByMode(mode)); } } return ( <>
{mode === 'basic' && ( <> )} {mode === 'advance' && ( <> )} ); }