1
0
Fork 0
freesewing/sites/shared/components/workbench/views/print/settings.mjs

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-06-04 09:59:47 -05:00
import { PrintIcon } from 'shared/components/icons.mjs'
import { WorkbenchMenu } from 'shared/components/workbench/menus/shared/index.mjs'
import { ListInput, BoolInput, MmInput } from 'shared/components/workbench/menus/shared/inputs.mjs'
import { ListValue, BoolValue, MmValue } from 'shared/components/workbench/menus/shared/values.mjs'
import { loadPrintConfig, printSettingsPath } from './config.mjs'
2023-06-04 09:59:47 -05:00
import get from 'lodash.get'
const inputs = {
size: ListInput,
orientation: ListInput,
margin: MmInput,
coverPage: BoolInput,
cutlist: BoolInput,
}
const values = {
size: ListValue,
orientation: ListValue,
margin: MmValue,
coverPage: BoolValue,
cutlist: BoolValue,
}
export const ns = ['print']
export const PrintSettings = ({ update, settings, ui, account }) => {
const config = loadPrintConfig(settings.units)
const passProps = { units: settings.units }
const updateFunc = (name, newVal) => update.ui([...printSettingsPath, name], newVal)
2023-06-04 09:59:47 -05:00
return (
<WorkbenchMenu
{...{
config,
control: account.control,
currentValues: get(ui, printSettingsPath, {}),
2023-06-04 09:59:47 -05:00
Icon: PrintIcon,
inputs,
values,
name: 'printSettings',
ns,
passProps,
updateFunc,
}}
/>
)
}