1
0
Fork 0

wip: Saving works now

This commit is contained in:
joostdecock 2025-02-01 17:09:06 +01:00
parent ce7f7c65e0
commit 77ee973355
19 changed files with 363 additions and 278 deletions

View file

@ -1,7 +1,7 @@
// Dependencies
import React from 'react'
import { defaultConfig } from '../config/index.mjs'
import { round, formatMm } from '@freesewing/utils'
import { round, formatMm, randomLoadingMessage, horFlexClasses } from '@freesewing/utils'
import { formatDesignOptionValue, menuCoreSettingsStructure } from './index.mjs'
import { menuUiPreferencesStructure } from './ui-preferences.mjs'
// Components
@ -13,6 +13,7 @@ import {
UiIcon,
} from '@freesewing/react/components/Icon'
import { HtmlSpan } from '../components/HtmlSpan.mjs'
import { Spinner } from '@freesewing/react/components/Spinner'
/*
* This method drafts the pattern
@ -531,6 +532,8 @@ export function stateUpdateFactory(setState, setEphemeralState, config) {
return eph
})
},
// Pattern ID (pid)
pid: (val) => setState((cur) => ({ ...cur, pid: val })),
ux: (val) => setState((cur) => objUpdate({ ...cur }, 'ux', val)),
clearPattern: () =>
setState((cur) => {
@ -555,7 +558,8 @@ export function stateUpdateFactory(setState, setEphemeralState, config) {
if (typeof newState.loading !== 'object') newState.loading = {}
if (typeof conf.color === 'undefined') conf.color = 'info'
newState.loading[id] = {
msg: t('pe:genericLoadingMsg'),
msg: randomLoadingMessage(),
icon: 'spinner',
...conf,
}
return newState