Add export to cmd bar (#1593)

* Add new exportFile icon

* Isolate exportFromEngine command

* Naive initial export command

* Update types to accept functions for arg defaultValue, required, and options

* Make existing helper functions and configs work with new types

* Make UI components work with new types
support resolving function values and conditional logic

* Add full export command to command bar

* Replace ExportButton with thin wrapper on cmd bar command

* fmt

* Fix stale tests and bugs found by good tests

* fmt

* Update src/components/CommandBar/CommandArgOptionInput.tsx

* Update snapshot tests and onboarding wording

* Move the panel open click into doExport

* Don't need to input storage step in export tests anymore

* Remove console logs, fmt, select options if we need to

* Increase test timeout

---------

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
Frank Noirot
2024-03-04 16:06:43 -05:00
committed by GitHub
parent c1a14a107a
commit c6f080c440
24 changed files with 607 additions and 529 deletions

View File

@ -41,8 +41,9 @@ export const settingsCommandBarConfig: CommandSetConfig<
baseUnit: {
inputType: 'options',
required: true,
defaultValue: (context) => context.baseUnit,
options: (context) =>
defaultValueFromContext: (context) => context.baseUnit,
options: [],
optionsFromContext: (context) =>
Object.values(baseUnitsUnion).map((v) => ({
name: v,
value: v,
@ -57,8 +58,9 @@ export const settingsCommandBarConfig: CommandSetConfig<
cameraControls: {
inputType: 'options',
required: true,
defaultValue: (context) => context.cameraControls,
options: (context) =>
defaultValueFromContext: (context) => context.cameraControls,
options: [],
optionsFromContext: (context) =>
Object.values(cameraSystems).map((v) => ({
name: v,
value: v,
@ -74,7 +76,7 @@ export const settingsCommandBarConfig: CommandSetConfig<
defaultProjectName: {
inputType: 'string',
required: true,
defaultValue: (context) => context.defaultProjectName,
defaultValueFromContext: (context) => context.defaultProjectName,
},
},
},
@ -84,8 +86,9 @@ export const settingsCommandBarConfig: CommandSetConfig<
textWrapping: {
inputType: 'options',
required: true,
defaultValue: (context) => context.textWrapping,
options: (context) => [
defaultValueFromContext: (context) => context.textWrapping,
options: [],
optionsFromContext: (context) => [
{
name: 'On',
value: 'On' as Toggle,
@ -106,8 +109,9 @@ export const settingsCommandBarConfig: CommandSetConfig<
theme: {
inputType: 'options',
required: true,
defaultValue: (context) => context.theme,
options: (context) =>
defaultValueFromContext: (context) => context.theme,
options: [],
optionsFromContext: (context) =>
Object.values(Themes).map((v) => ({
name: v,
value: v,
@ -122,8 +126,9 @@ export const settingsCommandBarConfig: CommandSetConfig<
unitSystem: {
inputType: 'options',
required: true,
defaultValue: (context) => context.unitSystem,
options: (context) => [
defaultValueFromContext: (context) => context.unitSystem,
options: [],
optionsFromContext: (context) => [
{
name: 'Imperial',
value: 'imperial' as UnitSystem,