Line data Source code
1 : <template>
2 117 : <nav
3 : class="fixed top-[calc(var(--workflow-tabs-height)+var(--spacing)*1.5)] left-1/2 -translate-x-1/2"
4 : :aria-label="t('builderToolbar.label')"
5 : >
6 : <div
7 : class="inline-flex items-center gap-1 rounded-2xl border bg-background p-2 shadow-md"
8 : >
9 351 : <template v-for="(step, index) in steps" :key="step.id">
10 : <button
11 : :class="
12 : cn(
13 : stepClasses,
14 : activeStep === step.id
15 : ? 'bg-ocean-600/40'
16 : : 'bg-transparent hover:bg-secondary'
17 : )
18 : "
19 : :aria-current="activeStep === step.id ? 'step' : undefined"
20 : @click="navigateToStep(step.id)"
21 : >
22 : <StepBadge :step :index :model-value="activeStep" />
23 : <StepLabel :step />
24 : </button>
25 :
26 : <div
27 : v-if="index < steps.length - 1"
28 : class="mx-1 h-px w-4 bg-border"
29 : role="separator"
30 : />
31 : </template>
32 : </div>
33 : </nav>
34 : </template>
35 :
36 : <script setup lang="ts">
37 : import { useI18n } from 'vue-i18n'
38 :
39 : import { cn } from '@comfyorg/tailwind-utils'
40 :
41 : import StepBadge from './StepBadge.vue'
42 : import StepLabel from './StepLabel.vue'
43 : import type { BuilderToolbarStep } from './types'
44 : import type { BuilderStepId } from './useBuilderSteps'
45 : import { useBuilderSteps } from './useBuilderSteps'
46 :
47 59 : const { t } = useI18n()
48 59 : const { activeStep, navigateToStep } = useBuilderSteps()
49 :
50 2355 : const stepClasses =
51 : 'inline-flex h-14 min-h-8 cursor-pointer items-center gap-3 rounded-lg py-2 pr-4 pl-2 transition-colors border-none'
52 :
53 : const selectInputsStep: BuilderToolbarStep<BuilderStepId> = {
54 : id: 'builder:inputs',
55 : title: t('builderToolbar.inputs'),
56 : subtitle: t('builderToolbar.inputsDescription'),
57 : icon: 'icon-[lucide--mouse-pointer-click]'
58 : }
59 :
60 : const selectOutputsStep: BuilderToolbarStep<BuilderStepId> = {
61 : id: 'builder:outputs',
62 : title: t('builderToolbar.outputs'),
63 : subtitle: t('builderToolbar.outputsDescription'),
64 : icon: 'icon-[lucide--mouse-pointer-click]'
65 : }
66 :
67 : const arrangeStep: BuilderToolbarStep<BuilderStepId> = {
68 : id: 'builder:arrange',
69 : title: t('builderToolbar.arrange'),
70 : subtitle: t('builderToolbar.arrangeDescription'),
71 : icon: 'icon-[lucide--layout-panel-left]'
72 : }
73 :
74 59 : const steps = [selectInputsStep, selectOutputsStep, arrangeStep]
75 : </script>
|