-
Notifications
You must be signed in to change notification settings - Fork 491
linear v2: Simple Mode #7734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linear v2: Simple Mode #7734
Changes from all commits
e53ac86
ffc9518
2d3d5af
c1e833d
7c99fce
78c2038
cad7aa0
9c98686
4abff4e
bd6cb18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <script setup lang="ts"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Button from '@/components/ui/button/Button.vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { t } from '@/i18n' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useCanvasStore } from '@/renderer/core/canvas/canvasStore' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useCommandStore } from '@/stores/commandStore' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const canvasStore = useCanvasStore() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Move
♻️ Suggested refactor import Button from '@/components/ui/button/Button.vue'
import { t } from '@/i18n'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { useCommandStore } from '@/stores/commandStore'
const canvasStore = useCanvasStore()
+const commandStore = useCommandStore()Then update the click handlers: - @click="useCommandStore().execute('Comfy.ToggleLinear')"
+ @click="commandStore.execute('Comfy.ToggleLinear')"Also applies to: 15-15, 23-23 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="p-1 bg-secondary-background rounded-lg w-10"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="icon" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :title="t('linearMode.linearMode')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :variant="canvasStore.linearMode ? 'inverted' : 'secondary'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click="useCommandStore().execute('Comfy.ToggleLinear')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <i class="icon-[lucide--panels-top-left]" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding While ♿ Add aria-label for accessibility <Button
size="icon"
:title="t('linearMode.linearMode')"
+ :aria-label="t('linearMode.linearMode')"
:variant="canvasStore.linearMode ? 'inverted' : 'secondary'"
@click="useCommandStore().execute('Comfy.ToggleLinear')"
>
<i class="icon-[lucide--panels-top-left]" />
</Button>
<Button
size="icon"
:title="t('linearMode.graphMode')"
+ :aria-label="t('linearMode.graphMode')"
:variant="canvasStore.linearMode ? 'secondary' : 'inverted'"
@click="useCommandStore().execute('Comfy.ToggleLinear')"
>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size="icon" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :title="t('linearMode.graphMode')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :variant="canvasStore.linearMode ? 'secondary' : 'inverted'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click="useCommandStore().execute('Comfy.ToggleLinear')" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <i class="icon-[comfy--workflow]" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
11
to
26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add accessible labels to icon-only buttons. Both buttons are icon-only and should include ♿ Proposed accessibility fix <Button
size="icon"
:title="t('linearMode.linearMode')"
+ :aria-label="t('linearMode.linearMode')"
:variant="canvasStore.linearMode ? 'inverted' : 'secondary'"
@click="useCommandStore().execute('Comfy.ToggleLinear')"
>
<i class="icon-[lucide--panels-top-left]" />
</Button>
<Button
- gize="icon"
+ size="icon"
:title="t('linearMode.graphMode')"
+ :aria-label="t('linearMode.graphMode')"
:variant="canvasStore.linearMode ? 'secondary' : 'inverted'"
@click="useCommandStore().execute('Comfy.ToggleLinear')"
>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,10 @@ | |||||||||||||||||||
| > | ||||||||||||||||||||
| <i class="pi pi-bars" /> | ||||||||||||||||||||
| </Button> | ||||||||||||||||||||
| <i | ||||||||||||||||||||
| v-else-if="workflowOption.workflow.activeState?.extra?.linearMode" | ||||||||||||||||||||
| class="icon-[lucide--panels-top-left] bg-primary-background" | ||||||||||||||||||||
| /> | ||||||||||||||||||||
|
Comment on lines
+19
to
+22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding accessibility attributes to the linear mode icon. This icon conveys that the workflow is in linear mode, but screen reader users have no way to access this information. Based on learnings, elements without visible labels should have an ♿ Suggested accessibility improvement <i
v-else-if="workflowOption.workflow.activeState?.extra?.linearMode"
class="icon-[lucide--panels-top-left] bg-primary-background"
+ :aria-label="t('sideToolbar.workflowTab.linearMode')"
/>Add the corresponding i18n entry to {
"sideToolbar": {
"workflowTab": {
"linearMode": "Simple Mode"
}
}
}Alternatively, if this is purely a visual indicator and not essential information, use 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| <span class="workflow-label inline-block max-w-[150px] truncate text-sm"> | ||||||||||||||||||||
| {{ workflowOption.workflow.filename }} | ||||||||||||||||||||
| </span> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <script setup lang="ts"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PopoverArrow, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PopoverContent, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PopoverPortal, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PopoverRoot, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PopoverTrigger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from 'reka-ui' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Button from '@/components/ui/button/Button.vue' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { cn } from '@/utils/tailwindUtil' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defineOptions({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inheritAttrs: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defineProps<{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| entries?: { label: string; action?: () => void; icon?: string }[][] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| icon?: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to?: string | HTMLElement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }>() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PopoverRoot v-slot="{ close }"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PopoverTrigger as-child> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <slot name="button"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button size="icon"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <i :class="icon ?? 'icon-[lucide--ellipsis]'" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </slot> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add accessible label to default trigger button. The default trigger button is icon-only and lacks an accessible label. Screen reader users won't know what the button does. Add an ♿ Proposed fix to add aria-label <slot name="button">
- <Button size="icon">
+ <Button size="icon" aria-label="Open menu">
<i :class="icon ?? 'icon-[lucide--ellipsis]'" />
</Button>
</slot>Alternatively, allow consumers to provide the label via a prop if the popover's purpose varies by context. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </PopoverTrigger> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PopoverPortal :to> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PopoverContent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| side="bottom" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :side-offset="5" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :collision-padding="10" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-bind="$attrs" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class="rounded-lg p-2 bg-base-background shadow-sm border border-border-subtle will-change-[transform,opacity] data-[state=open]:data-[side=top]:animate-slideDownAndFade data-[state=open]:data-[side=right]:animate-slideLeftAndFade data-[state=open]:data-[side=bottom]:animate-slideUpAndFade data-[state=open]:data-[side=left]:animate-slideRightAndFade" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <slot> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="flex flex-col p-1"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <section | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-for="(entryGroup, index) in entries ?? []" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :key="index" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class="flex flex-col border-b-2 last:border-none border-border-subtle" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v-for="{ label, action, icon } in entryGroup" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AustinMroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :key="label" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+49
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use unique keys in v-for loop. Using 🔑 Proposed fix <div
- v-for="{ label, action, icon } in entryGroup"
- :key="label"
+ v-for="({ label, action, icon }, itemIndex) in entryGroup"
+ :key="`${index}-${itemIndex}`"
:class="🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| :class=" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cn( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'flex flex-row gap-4 p-2 rounded-sm my-1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'cursor-pointer hover:bg-secondary-background-hover' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @click=" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!action) return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| close() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+58
to
+64
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Simplify click handler. The arrow function wrapper is unnecessary. Simplify by directly checking and calling the action. ♻️ Proposed refactor- @click="
- () => {
- if (!action) return
- action()
- close()
- }
- "
+ @click="action && (action(), close())"🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <i v-if="icon" :class="icon" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ label }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+48
to
+68
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Menu items lack accessibility: use The menu items are Consider using ♿ Suggested fix for accessibility- <div
+ <button
v-for="{ label, action, icon } in entryGroup"
:key="label"
:class="
cn(
- 'flex flex-row gap-4 p-2 rounded-sm my-1',
+ 'flex flex-row gap-4 p-2 rounded-sm my-1 w-full text-left bg-transparent border-none',
action &&
'cursor-pointer hover:bg-secondary-background-hover'
)
"
+ :disabled="!action"
@click="
() => {
if (!action) return
action()
close()
}
"
>
<i v-if="icon" :class="icon" />
{{ label }}
- </div>
+ </button>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </section> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+43
to
+69
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add ARIA roles for menu semantics. The popover content renders a menu structure but lacks proper ARIA roles. Add ♿ Proposed accessibility enhancement <div class="flex flex-col p-1">
<section
v-for="(entryGroup, index) in entries ?? []"
:key="index"
class="flex flex-col border-b-2 last:border-none border-border-subtle"
+ role="group"
>
<div
v-for="{ label, action, icon } in entryGroup"
:key="label"
+ :role="action ? 'menuitem' : undefined"
+ :tabindex="action ? 0 : undefined"
:class="Additionally, consider adding keyboard navigation (Enter/Space to activate, arrow keys to navigate) for full accessibility compliance. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </slot> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <PopoverArrow class="fill-base-background stroke-border-subtle" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </PopoverContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </PopoverPortal> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </PopoverRoot> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very nit and can be addressed later: This is more specific of a component and should probably be in a special subdirectory of |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||
| <script setup lang="ts"> | ||||||
| import { whenever } from '@vueuse/core' | ||||||
| import { useTemplateRef } from 'vue' | ||||||
|
|
||||||
| import Popover from '@/components/ui/Popover.vue' | ||||||
| import Button from '@/components/ui/button/Button.vue' | ||||||
|
|
||||||
| defineProps<{ | ||||||
| dataTfWidget: string | ||||||
| }>() | ||||||
|
|
||||||
| const feedbackRef = useTemplateRef('feedbackRef') | ||||||
|
|
||||||
| whenever(feedbackRef, () => { | ||||||
| const scriptEl = document.createElement('script') | ||||||
| scriptEl.src = '//embed.typeform.com/next/embed.js' | ||||||
| feedbackRef.value?.appendChild(scriptEl) | ||||||
| }) | ||||||
AustinMroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| </script> | ||||||
| <template> | ||||||
| <Popover> | ||||||
| <template #button> | ||||||
| <Button variant="inverted" class="rounded-full size-12"> | ||||||
| <i class="icon-[lucide--circle-question-mark] size-6" /> | ||||||
| </Button> | ||||||
| </template> | ||||||
| <div ref="feedbackRef" data-tf-auto-resize :data-tf-widget /> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug:
🐛 Proposed fix- <div ref="feedbackRef" data-tf-auto-resize :data-tf-widget />
+ <div ref="feedbackRef" data-tf-auto-resize :data-tf-widget="dataTfWidget" />📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| </Popover> | ||||||
AustinMroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| </template> | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||
| <script setup lang="ts"> | ||||||
| import { computed, ref, useTemplateRef } from 'vue' | ||||||
|
|
||||||
| const zoomPane = useTemplateRef('zoomPane') | ||||||
|
|
||||||
| const zoom = ref(1.0) | ||||||
| const panX = ref(0.0) | ||||||
| const panY = ref(0.0) | ||||||
|
|
||||||
| function handleWheel(e: WheelEvent) { | ||||||
| const zoomPaneEl = zoomPane.value | ||||||
| if (!zoomPaneEl) return | ||||||
|
|
||||||
| zoom.value -= e.deltaY | ||||||
| const { x, y, width, height } = zoomPaneEl.getBoundingClientRect() | ||||||
| const offsetX = e.clientX - x - width / 2 | ||||||
| const offsetY = e.clientY - y - height / 2 | ||||||
| const scaler = 1.1 ** (e.deltaY / -30) | ||||||
|
|
||||||
| panY.value = panY.value * scaler - offsetY * (scaler - 1) | ||||||
| panX.value = panX.value * scaler - offsetX * (scaler - 1) | ||||||
| } | ||||||
AustinMroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| let dragging = false | ||||||
| function handleDown(e: PointerEvent) { | ||||||
| if (e.button !== 0) return | ||||||
|
|
||||||
| const zoomPaneEl = zoomPane.value | ||||||
| if (!zoomPaneEl) return | ||||||
| zoomPaneEl.parentElement?.focus() | ||||||
|
|
||||||
| zoomPaneEl.setPointerCapture(e.pointerId) | ||||||
| dragging = true | ||||||
| } | ||||||
| function handleMove(e: PointerEvent) { | ||||||
| if (!dragging) return | ||||||
| panX.value += e.movementX | ||||||
| panY.value += e.movementY | ||||||
| } | ||||||
|
Comment on lines
+35
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Verify pointer button state during drag. The Suggested improvement function handleMove(e: PointerEvent) {
- if (!dragging) return
+ if (!dragging.value || !(e.buttons & 1)) return
panX.value += e.movementX
panY.value += e.movementY
}🤖 Prompt for AI Agents
AustinMroz marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| const transform = computed(() => { | ||||||
| const scale = 1.1 ** (zoom.value / 30) | ||||||
| const matrix = [scale, 0, 0, scale, panX.value, panY.value] | ||||||
| return `matrix(${matrix.join(',')})` | ||||||
| }) | ||||||
| </script> | ||||||
| <template> | ||||||
| <div | ||||||
| ref="zoomPane" | ||||||
| class="contain-size flex place-content-center" | ||||||
| @wheel="handleWheel" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prevent default wheel behavior to avoid page scrolling. The wheel event handler should call Proposed fix- @wheel="handleWheel"
+ @wheel.prevent="handleWheel"Or add preventDefault in the handler: function handleWheel(e: WheelEvent) {
+ e.preventDefault()
const zoomPaneEl = zoomPane.value
if (!zoomPaneEl) return📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| @pointerdown.prevent="handleDown" | ||||||
| @pointermove="handleMove" | ||||||
| @pointerup="dragging = false" | ||||||
| @pointercancel="dragging = false" | ||||||
| > | ||||||
| <slot :style="{ transform }" /> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Document slot style prop assumption. The slot receives Consider: Wrapping the slot content in a 🤖 Prompt for AI Agents |
||||||
| </div> | ||||||
| </template> | ||||||
|
Comment on lines
1
to
59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Add accessibility support for keyboard navigation. The ZoomPane currently only supports mouse/pointer interactions. Consider adding keyboard navigation for accessibility:
Suggested keyboard handlerfunction handleKeydown(e: KeyboardEvent) {
const step = e.shiftKey ? 50 : 10
switch (e.key) {
case 'ArrowLeft':
e.preventDefault()
panX.value += step
break
case 'ArrowRight':
e.preventDefault()
panX.value -= step
break
case 'ArrowUp':
e.preventDefault()
panY.value += step
break
case 'ArrowDown':
e.preventDefault()
panY.value -= step
break
case '+':
case '=':
e.preventDefault()
zoom.value += 5
break
case '-':
e.preventDefault()
zoom.value -= 5
break
case '0':
case 'Home':
e.preventDefault()
zoom.value = 1
panX.value = 0
panY.value = 0
break
}
}Add to template: <div
ref="zoomPane"
tabindex="0"
role="img"
:aria-label="$t('zoomPane.label')"
class="contain-size flex justify-center items-center"
@wheel.prevent="handleWheel"
@keydown="handleKeydown"
...
>🤖 Prompt for AI Agents |
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Verify color choice consistency with theming pattern.
Both light and dark themes map
--success-backgroundto the same color value (--color-jade-600). This deviates from the established pattern where light themes typically use lighter shades (e.g., 400) and dark themes use darker shades (e.g., 600-700):--warning-background: gold-400 (light) vs gold-600 (dark)--destructive-background: coral-500 (light) vs coral-700 (dark)--primary-background: azure-400 (light) vs azure-600 (dark)Consider whether line 248 should use
var(--color-jade-400)for consistency, though this may be an intentional design decision if jade-600 provides optimal contrast in both themes.♻️ Proposed refactor for pattern consistency
Apply this change only to line 248 (light theme) if the lighter shade is preferred for consistency.
Also applies to: 374-374
🤖 Prompt for AI Agents