This commit is contained in:
Frank Noirot
2025-02-07 17:54:26 -05:00
parent 5e89683801
commit 4ee1c96e78

View File

@ -86,25 +86,25 @@ const ProjectsContextWeb = ({ children }: { children: React.ReactNode }) => {
const [state, send, actor] = useMachine( const [state, send, actor] = useMachine(
projectsMachine.provide({ projectsMachine.provide({
actions: { actions: {
navigateToProject: () => {}, navigateToProject: () => { },
navigateToProjectIfNeeded: () => {}, navigateToProjectIfNeeded: () => { },
navigateToFile: () => {}, navigateToFile: () => { },
toastSuccess: ({ event }) => toastSuccess: ({ event }) =>
toast.success( toast.success(
('data' in event && typeof event.data === 'string' && event.data) || ('data' in event && typeof event.data === 'string' && event.data) ||
('output' in event && ('output' in event &&
'message' in event.output && 'message' in event.output &&
typeof event.output.message === 'string' && typeof event.output.message === 'string' &&
event.output.message) || event.output.message) ||
'' ''
), ),
toastError: ({ event }) => toastError: ({ event }) =>
toast.error( toast.error(
('data' in event && typeof event.data === 'string' && event.data) || ('data' in event && typeof event.data === 'string' && event.data) ||
('output' in event && ('output' in event &&
typeof event.output === 'string' && typeof event.output === 'string' &&
event.output) || event.output) ||
'' ''
), ),
}, },
actors: { actors: {
@ -126,7 +126,7 @@ const ProjectsContextWeb = ({ children }: { children: React.ReactNode }) => {
clearImportSearchParams() clearImportSearchParams()
const codeToWrite = changeKclSettings(input.code ?? '', { const codeToWrite = changeKclSettings(input.code ?? '', {
defaultLengthUnits: unitLengthToUnitLen( defaultLengthUnits: unitLengthToUnitLen(
settings.context.modeling.defaultUnit.current settings.modeling.defaultUnit.current
), ),
defaultAngleUnits: { type: 'Degrees' }, defaultAngleUnits: { type: 'Degrees' },
}) })
@ -307,19 +307,19 @@ const ProjectsContextDesktop = ({
toastSuccess: ({ event }) => toastSuccess: ({ event }) =>
toast.success( toast.success(
('data' in event && typeof event.data === 'string' && event.data) || ('data' in event && typeof event.data === 'string' && event.data) ||
('output' in event && ('output' in event &&
'message' in event.output && 'message' in event.output &&
typeof event.output.message === 'string' && typeof event.output.message === 'string' &&
event.output.message) || event.output.message) ||
'' ''
), ),
toastError: ({ event }) => toastError: ({ event }) =>
toast.error( toast.error(
('data' in event && typeof event.data === 'string' && event.data) || ('data' in event && typeof event.data === 'string' && event.data) ||
('output' in event && ('output' in event &&
typeof event.output === 'string' && typeof event.output === 'string' &&
event.output) || event.output) ||
'' ''
), ),
}, },
actors: { actors: {
@ -383,8 +383,8 @@ const ProjectsContextDesktop = ({
input.method === 'newProject' input.method === 'newProject'
? PROJECT_ENTRYPOINT ? PROJECT_ENTRYPOINT
: input.name.endsWith(FILE_EXT) : input.name.endsWith(FILE_EXT)
? input.name ? input.name
: input.name + FILE_EXT : input.name + FILE_EXT
let message = 'File created successfully' let message = 'File created successfully'
const needsInterpolated = doesProjectNameNeedInterpolated(projectName) const needsInterpolated = doesProjectNameNeedInterpolated(projectName)
@ -417,7 +417,7 @@ const ProjectsContextDesktop = ({
fileName = name fileName = name
const codeToWrite = changeKclSettings(input.code ?? '', { const codeToWrite = changeKclSettings(input.code ?? '', {
defaultLengthUnits: unitLengthToUnitLen( defaultLengthUnits: unitLengthToUnitLen(
settings.context.modeling.defaultUnit.current settings.modeling.defaultUnit.current
), ),
defaultAngleUnits: { type: 'Degrees' }, defaultAngleUnits: { type: 'Degrees' },
}) })