Skip to content

Commit af8ad95

Browse files
committed
fix: hide widgets on mount and improve stop button styling
- Add refreshVueWidgets call in hideWidgets to sync Vue state on mount - Update stop camera button with rounded container and square icon - Use bg-destructive-background design token for stop button
1 parent cd5f6fd commit af8ad95

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/locales/en/main.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@
146146
"capturePhoto": "Capture photo",
147147
"captureModeOnRun": "On Run",
148148
"captureModeManual": "Manually",
149-
"captureImage": "Capture",
150149
"retakePhoto": "Retake photo",
151150
"clickToStopLivePreview": "Click to stop live preview",
152151
"failedToCaptureImage": "Failed to capture image",

src/renderer/extensions/vueNodes/widgets/components/WidgetWebcam.vue

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Button
1313
class="text-text-secondary w-full border-0 bg-component-node-widget-background hover:bg-secondary-background-hover"
1414
:disabled="readonly"
15-
@click="startCameraPreview"
15+
@click="restartCameraPreview()"
1616
>
1717
{{ t('g.turnOnCamera', 'Turn on Camera') }}
1818
</Button>
@@ -32,14 +32,30 @@
3232
class="absolute inset-0 flex cursor-pointer flex-col items-center justify-center rounded-lg bg-black/50"
3333
@click="stopCameraPreview"
3434
>
35-
<div class="text-text-secondary mb-4 text-sm">
35+
<div class="text-base-foreground mb-4 text-base">
3636
{{ t('g.clickToStopLivePreview', 'Click to stop live preview') }}
3737
</div>
3838

3939
<div
40-
class="flex size-6 bg-red-600 items-center justify-center bg-danger"
40+
class="flex size-10 items-center justify-center rounded-full bg-destructive-background"
4141
>
42-
<i class="icon-[lucide--square] size-6 bg-red-400" />
42+
<svg
43+
class="size-4 text-white rounded-md"
44+
width="16"
45+
height="16"
46+
viewBox="0 0 16 16"
47+
fill="none"
48+
xmlns="http://www.w3.org/2000/svg"
49+
>
50+
<rect
51+
x="2"
52+
y="2"
53+
width="12"
54+
height="12"
55+
rx="1"
56+
fill="currentColor"
57+
/>
58+
</svg>
4359
</div>
4460
</div>
4561
</div>
@@ -264,7 +280,7 @@ async function handleModeChange(isOnRunMode: boolean) {
264280
updateNodeWidgets(node, (widgets) => {
265281
const captureWidget = createActionWidget({
266282
name: CAPTURE_WIDGET_NAME,
267-
label: t('g.captureImage', 'Capture'),
283+
label: t('g.capturePhoto', 'Capture Photo'),
268284
iconClass: 'icon-[lucide--camera]',
269285
onClick: () => captureImage(node)
270286
})
@@ -338,6 +354,9 @@ function hideWidgets() {
338354
}),
339355
{ dirtyCanvas: false }
340356
)
357+
358+
// Refresh Vue state to pick up the hidden widgets
359+
nodeManager.value?.refreshVueWidgets(String(node.id))
341360
})
342361
}
343362
@@ -401,7 +420,7 @@ function showWidgets() {
401420
402421
const captureWidget = createActionWidget({
403422
name: CAPTURE_WIDGET_NAME,
404-
label: t('g.captureImage', 'Capture'),
423+
label: t('g.captureImage', 'Capture Photo'),
405424
iconClass: 'icon-[lucide--camera]',
406425
onClick: () => captureImage(node)
407426
})

0 commit comments

Comments
 (0)