Circle function and UI tool (#3860)
* circle * fix another example * fix bad comment * toPoint fix * cargo fmt * resolve most of the tests * fix last test * missed circle in bracket * remove console error * fmt * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * trigger ci * remove three dot menu for circle * make sure circle can be extruded * fix up after merge * add extrude test for circle * clean up * typo * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)" This reverts commit03f8eeb542
. * update docs again * cmd bar test serialisation improvements * tiny clean up * fix after: Replace kittycad crate with kittycad-modeling-cmds * fmt * rename fix * Update src/lib/toolbar.ts Co-authored-by: Frank Noirot <frank@zoo.dev> * add another error to list * A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest) * image updates * Revert "A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu-latest)" This reverts commit505bb20bea
. * update markdown * skip un reproducable windows test failure * rust review * leave issue todo comment --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
@ -33,11 +33,15 @@ function CommandBarBasicInput({
|
||||
|
||||
return (
|
||||
<form id="arg-form" onSubmit={handleSubmit}>
|
||||
<label className="flex items-center mx-4 my-4">
|
||||
<label
|
||||
data-testid="cmd-bar-arg-name"
|
||||
className="flex items-center mx-4 my-4"
|
||||
>
|
||||
<span className="capitalize px-2 py-1 rounded-l bg-chalkboard-100 dark:bg-chalkboard-80 text-chalkboard-10 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80">
|
||||
{arg.name}
|
||||
</span>
|
||||
<input
|
||||
data-testid="cmd-bar-arg-value"
|
||||
id="arg-form"
|
||||
name={arg.inputType}
|
||||
ref={inputRef}
|
||||
|
@ -74,7 +74,9 @@ function CommandBarHeader({ children }: React.PropsWithChildren<{}>) {
|
||||
selectedCommand.icon && (
|
||||
<CustomIcon name={selectedCommand.icon} className="w-5 h-5" />
|
||||
)}
|
||||
{selectedCommand.displayName || selectedCommand.name}
|
||||
<span data-testid="command-name">
|
||||
{selectedCommand.displayName || selectedCommand.name}
|
||||
</span>
|
||||
</p>
|
||||
{Object.entries(selectedCommand?.args || {})
|
||||
.filter(([_, argConfig]) =>
|
||||
@ -92,6 +94,10 @@ function CommandBarHeader({ children }: React.PropsWithChildren<{}>) {
|
||||
|
||||
return (
|
||||
<button
|
||||
data-testid="cmd-bar-input-tab"
|
||||
data-is-current-arg={
|
||||
argName === currentArgument?.name ? 'true' : 'false'
|
||||
}
|
||||
disabled={!isReviewing && currentArgument?.name === argName}
|
||||
onClick={() => {
|
||||
commandBarSend({
|
||||
@ -110,29 +116,34 @@ function CommandBarHeader({ children }: React.PropsWithChildren<{}>) {
|
||||
>
|
||||
<span
|
||||
data-testid={`arg-name-${argName.toLowerCase()}`}
|
||||
data-test-name="arg-name"
|
||||
className="capitalize"
|
||||
>
|
||||
{argName}
|
||||
</span>
|
||||
<span className="sr-only">: </span>
|
||||
{argValue ? (
|
||||
arg.inputType === 'selection' ? (
|
||||
getSelectionTypeDisplayText(argValue as Selections)
|
||||
) : arg.inputType === 'kcl' ? (
|
||||
roundOff(
|
||||
Number((argValue as KclCommandValue).valueCalculated),
|
||||
4
|
||||
)
|
||||
) : typeof argValue === 'object' ? (
|
||||
arg.valueSummary ? (
|
||||
arg.valueSummary(argValue)
|
||||
<span data-testid="header-arg-value">
|
||||
{argValue ? (
|
||||
arg.inputType === 'selection' ? (
|
||||
getSelectionTypeDisplayText(argValue as Selections)
|
||||
) : arg.inputType === 'kcl' ? (
|
||||
roundOff(
|
||||
Number(
|
||||
(argValue as KclCommandValue).valueCalculated
|
||||
),
|
||||
4
|
||||
)
|
||||
) : typeof argValue === 'object' ? (
|
||||
arg.valueSummary ? (
|
||||
arg.valueSummary(argValue)
|
||||
) : (
|
||||
JSON.stringify(argValue)
|
||||
)
|
||||
) : (
|
||||
JSON.stringify(argValue)
|
||||
<em>{argValue}</em>
|
||||
)
|
||||
) : (
|
||||
<em>{argValue}</em>
|
||||
)
|
||||
) : null}
|
||||
) : null}
|
||||
</span>
|
||||
{showShortcuts && (
|
||||
<small className="absolute -top-[1px] right-full translate-x-1/2 px-0.5 rounded-sm bg-chalkboard-80 text-chalkboard-10 dark:bg-primary dark:text-chalkboard-100">
|
||||
<span className="sr-only">Hotkey: </span>
|
||||
|
@ -139,10 +139,17 @@ function CommandBarKclInput({
|
||||
return (
|
||||
<form id="arg-form" onSubmit={handleSubmit} data-can-submit={canSubmit}>
|
||||
<label className="flex gap-4 items-center mx-4 my-4 border-solid border-b border-chalkboard-50">
|
||||
<span className="capitalize text-chalkboard-80 dark:text-chalkboard-20">
|
||||
<span
|
||||
data-testid="cmd-bar-arg-name"
|
||||
className="capitalize text-chalkboard-80 dark:text-chalkboard-20"
|
||||
>
|
||||
{arg.name}
|
||||
</span>
|
||||
<div ref={editorRef} className={styles.editor} />
|
||||
<div
|
||||
data-testid="cmd-bar-arg-value"
|
||||
ref={editorRef}
|
||||
className={styles.editor}
|
||||
/>
|
||||
<CustomIcon
|
||||
name="equal"
|
||||
className="w-5 h-5 text-chalkboard-70 dark:text-chalkboard-40"
|
||||
|
@ -36,10 +36,14 @@ function CommandBarTextareaInput({
|
||||
return (
|
||||
<form id="arg-form" onSubmit={handleSubmit} ref={formRef}>
|
||||
<label className="flex items-start rounded mx-4 my-4 border border-chalkboard-100 dark:border-chalkboard-80">
|
||||
<span className="capitalize px-2 py-1 rounded-br bg-chalkboard-100 dark:bg-chalkboard-80 text-chalkboard-10 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80">
|
||||
<span
|
||||
data-testid="cmd-bar-arg-name"
|
||||
className="capitalize px-2 py-1 rounded-br bg-chalkboard-100 dark:bg-chalkboard-80 text-chalkboard-10 border-b border-b-chalkboard-100 dark:border-b-chalkboard-80"
|
||||
>
|
||||
{arg.name}
|
||||
</span>
|
||||
<textarea
|
||||
data-testid="cmd-bar-arg-value"
|
||||
id="arg-form"
|
||||
name={arg.inputType}
|
||||
ref={inputRef}
|
||||
|
Reference in New Issue
Block a user