Skip to content

Commit

Permalink
Add Warning Message for Fillet Engine Limitations in CommandBar (#4076)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-mrgrsk authored Oct 8, 2024
1 parent 24cd1b2 commit 3c5bf70
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/CommandBar/CommandBarSelectionInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function CommandBarSelectionInput({
<form id="arg-form" onSubmit={handleSubmit}>
<label
className={
'relative flex items-center mx-4 my-4 ' +
'relative flex flex-col mx-4 my-4 ' +
(!hasSubmitted || canSubmitSelection || 'text-destroy-50')
}
>
Expand All @@ -100,13 +100,18 @@ function CommandBarSelectionInput({
: `Please select ${
arg.multiple ? 'one or more ' : 'one '
}${getSemanticSelectionType(arg.selectionTypes).join(' or ')}`}
{arg.warningMessage && (
<p className="text-warn-80 bg-warn-10 px-2 py-1 rounded-sm mt-3 mr-2 -mb-2 w-full text-sm cursor-default">
{arg.warningMessage}
</p>
)}
<input
id="selection"
name="selection"
ref={inputRef}
required
placeholder="Select an entity with your mouse"
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
className="absolute inset-0 w-full h-full opacity-0 cursor-default"
onKeyDown={(event) => {
if (event.key === 'Backspace') {
stepBack()
Expand Down
2 changes: 2 additions & 0 deletions src/lib/commandBarConfigs/modelingCommandConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
multiple: true,
required: true,
skip: false,
warningMessage:
'Fillets cannot touch other fillets yet. This is under development.',
},
radius: {
inputType: 'kcl',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/commandTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export type CommandArgumentConfig<
commandBarContext: { argumentsToSubmit: Record<string, unknown> }, // Should be the commandbarMachine's context, but it creates a circular dependency
machineContext?: C
) => boolean)
warningMessage?: string
skip?: boolean
/** For showing a summary display of the current value, such as in
* the command bar's header
Expand Down Expand Up @@ -189,6 +190,7 @@ export type CommandArgument<
) => boolean)
skip?: boolean
machineActor?: Actor<T>
warningMessage?: string
/** For showing a summary display of the current value, such as in
* the command bar's header
*/
Expand Down
1 change: 1 addition & 0 deletions src/lib/createMachineCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export function buildCommandArgument<
skip: arg.skip,
machineActor,
valueSummary: arg.valueSummary,
warningMessage: arg.warningMessage ?? '',
} satisfies Omit<CommandArgument<O, T>, 'inputType'>

if (arg.inputType === 'options') {
Expand Down

0 comments on commit 3c5bf70

Please sign in to comment.