Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/web/src/newhotness/ActionWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
"
@click="clickHandler"
>
<Toggle :selected="!!props.actionId" class="flex-none" />
<StatusIndicatorIcon type="action" :status="actionPrototypeView.kind" tone="inherit" class="flex-none" />
<div class="font-bold leading-normal text-sm">
{{ actionPrototypeView.displayName || actionPrototypeView.name }}
</div>

<Icon v-if="actionBifrosting" name="loader" class="ml-auto" size="sm" />
<Toggle
:selected="!!props.actionId"
class="flex-none ml-auto"
onLabel="Queued"
offLabel="UnQueued"
labelWidth="w-[70px]"
/>
<Icon v-if="actionBifrosting" name="loader" size="sm" />
</div>
</template>

Expand Down
59 changes: 37 additions & 22 deletions lib/vue-lib/src/design-system/general/Toggle.vue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good UX if the label can take up the same amount of width in both states so that the toggle doesn't move around when you click on it. A simple way to achieve that would be to just have a prop for adding classes to the label itself, then giving it the appropriate fixed width class to fit both label texts.

Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
<template>
<div
:class="
clsx(
size === 'sm' ? 'w-6 h-4' : 'w-9 h-6',
'cursor-pointer flex-none flex items-center rounded-full p-1 duration-300 ease-in-out',
props.selected
? themeClasses('bg-action-300', 'bg-action-500')
: themeClasses('bg-neutral-400', 'bg-neutral-500'),
)
"
@click="click"
>
<div :class="clsx('flex flex-row items-center')">
<div
:class="
clsx(
'bg-white rounded-full shadow-md transform duration-300 ease-in-out',
size === 'sm'
? [
'w-3 h-3',
props.selected
? 'translate-x-[0.35rem]'
: 'translate-x-[-0.1rem]',
]
: ['w-4 h-4', props.selected ? 'translate-x-3' : ''],
size === 'sm' ? 'w-6 h-4' : 'w-9 h-6',
'cursor-pointer flex-none flex items-center rounded-full p-1 duration-300 ease-in-out',
props.selected
? themeClasses('bg-action-300', 'bg-action-500')
: themeClasses('bg-neutral-400', 'bg-neutral-500'),
)
"
></div>
@click="click"
>
<div
:class="
clsx(
'bg-white rounded-full shadow-md transform duration-300 ease-in-out',
size === 'sm'
? [
'w-3 h-3',
props.selected
? 'translate-x-[0.35rem]'
: 'translate-x-[-0.1rem]',
]
: ['w-4 h-4', props.selected ? 'translate-x-3' : ''],
)
"
></div>
</div>
<span
:class="clsx('px-1 text-xs', props.labelWidth)"
v-if="props.onLabel && props.selected"
>{{ props.onLabel }}</span
>
<span
:class="clsx('px-1 text-xs', props.labelWidth)"
v-if="props.offLabel && !props.selected"
>{{ props.offLabel }}</span
>
</div>
</template>

Expand All @@ -40,5 +52,8 @@ const props = defineProps({
size: { type: String, default: "md" },
selected: { type: Boolean },
click: { type: Function as PropType<clickFn>, default: () => {} },
onLabel: { type: String, required: false },
offLabel: { type: String, required: false },
labelWidth: { type: String, required: false, default: "" },
});
</script>