diff --git a/ui/src/components/FieldLabel.tsx b/ui/src/components/FieldLabel.tsx index 42e6ede..614e3c3 100644 --- a/ui/src/components/FieldLabel.tsx +++ b/ui/src/components/FieldLabel.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { LuInfo } from "react-icons/lu"; import { cx } from "@/cva.config"; @@ -8,6 +9,7 @@ interface Props { as?: "label" | "span"; description?: string | React.ReactNode | null; disabled?: boolean; + info?: string; } export default function FieldLabel({ label, @@ -15,7 +17,36 @@ export default function FieldLabel({ as = "label", description, disabled, + info, }: Props) { + const labelContent = ( + <> +
+ {label} + {info && ( +
+ + +
+ )} +
+ {description && ( + + {description} + + )} + + ); + if (as === "label") { return ( ); } else if (as === "span") { return (
- {label} + {labelContent} - {description && ( - - {description} - - )}
); } else { diff --git a/ui/src/components/MacroForm.tsx b/ui/src/components/MacroForm.tsx index b7768a0..b85a0f9 100644 --- a/ui/src/components/MacroForm.tsx +++ b/ui/src/components/MacroForm.tsx @@ -9,6 +9,7 @@ import Fieldset from "@/components/Fieldset"; import { MacroStepCard } from "@/components/MacroStepCard"; import Modal from "@/components/Modal"; import { DEFAULT_DELAY, MAX_STEPS_PER_MACRO, MAX_KEYS_PER_STEP } from "@/constants/macros"; +import FieldLabel from "@/components/FieldLabel"; interface ValidationErrors { name?: string; @@ -192,15 +193,7 @@ export function MacroForm({
- -
- -
-

Each step is a collection of keys and/or modifiers that will be executed in order. You can add up to a maximum of {MAX_STEPS_PER_MACRO} steps per macro.

-
-
+
{macro.steps?.length || 0}/{MAX_STEPS_PER_MACRO} steps diff --git a/ui/src/components/MacroStepCard.tsx b/ui/src/components/MacroStepCard.tsx index 1bd6329..60a5ab1 100644 --- a/ui/src/components/MacroStepCard.tsx +++ b/ui/src/components/MacroStepCard.tsx @@ -6,6 +6,7 @@ import { SelectMenuBasic } from "@/components/SelectMenuBasic"; import Card from "@/components/Card"; import { keys, modifiers, keyDisplayMap } from "@/keyboardMappings"; import { MAX_KEYS_PER_STEP } from "@/constants/macros"; +import FieldLabel from "@/components/FieldLabel";1 // Filter out modifier keys since they're handled in the modifiers section const modifierKeyPrefixes = ['Alt', 'Control', 'Shift', 'Meta']; @@ -128,9 +129,7 @@ export function MacroStepCard({
- +
{Object.entries(groupedModifiers).map(([group, mods]) => (
@@ -139,7 +138,7 @@ export function MacroStepCard({
{mods.map(option => ( - + ))}
@@ -170,15 +169,7 @@ export function MacroStepCard({
- -
- -
-

You can add up to a maximum of {MAX_KEYS_PER_STEP} keys to press per step.

-
-
+
{ensureArray(step.keys).map((key, keyIndex) => ( @@ -220,15 +211,7 @@ export function MacroStepCard({
- -
- -
-

The time to wait after pressing the keys in this step before moving to the next step. This helps ensure reliable key presses when automating keyboard input.

-
-
+
handleDuplicateMacro(macro)} disabled={actionLoadingId === macro.id} aria-label={`Duplicate macro ${macro.name}`} @@ -188,6 +189,7 @@ export default function SettingsMacrosRoute() { size="XS" theme="light" LeadingIcon={LuPenLine} + text="Edit" onClick={() => navigate(`${macro.id}/edit`)} disabled={actionLoadingId === macro.id} aria-label={`Edit macro ${macro.name}`}