Skip to content

Commit 3e9fc3c

Browse files
committed
Check pt fix usages that were not based on styling preferences.
1 parent c22f578 commit 3e9fc3c

2 files changed

Lines changed: 29 additions & 21 deletions

File tree

‎web/js/components/preact/StreamConfigModal.jsx‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export function StreamConfigModal({
422422
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
423423
<div className="md:col-span-2">
424424
<label htmlFor="stream-name" className="block text-sm font-medium mb-2">
425-
{t('streamsConfig.streamName')} <span className="text-danger">*</span>
425+
{t('streamsConfig.streamName')} <span className="text-destructive">*</span>
426426
</label>
427427
<input
428428
type="text"
@@ -442,7 +442,7 @@ export function StreamConfigModal({
442442

443443
<div className="md:col-span-2">
444444
<label htmlFor="stream-url" className="block text-sm font-medium mb-2">
445-
{t('streamsConfig.streamUrl')} <span className="text-danger">*</span>
445+
{t('streamsConfig.streamUrl')} <span className="text-destructive">*</span>
446446
</label>
447447
<input
448448
type="text"
@@ -518,7 +518,7 @@ export function StreamConfigModal({
518518
type="checkbox"
519519
id="stream-enabled"
520520
name="enabled"
521-
className="h-4 w-4 rounded border-gray-300"
521+
className="h-4 w-4 rounded border-input"
522522
style={primaryAccentStyle}
523523
checked={currentStream.enabled}
524524
onChange={onInputChange}
@@ -530,7 +530,7 @@ export function StreamConfigModal({
530530
type="checkbox"
531531
id="stream-streaming-enabled"
532532
name="streamingEnabled"
533-
className="h-4 w-4 rounded border-gray-300"
533+
className="h-4 w-4 rounded border-input"
534534
style={primaryAccentStyle}
535535
checked={currentStream.streamingEnabled}
536536
onChange={onInputChange}
@@ -545,7 +545,7 @@ export function StreamConfigModal({
545545
type="checkbox"
546546
id="stream-is-onvif"
547547
name="isOnvif"
548-
className="h-4 w-4 rounded border-gray-300"
548+
className="h-4 w-4 rounded border-input"
549549
style={primaryAccentStyle}
550550
checked={currentStream.isOnvif}
551551
onChange={onInputChange}
@@ -678,7 +678,7 @@ export function StreamConfigModal({
678678
type="checkbox"
679679
id="stream-record"
680680
name="record"
681-
className="h-4 w-4 mt-0.5 rounded border-gray-300"
681+
className="h-4 w-4 mt-0.5 rounded border-input"
682682
style={primaryAccentStyle}
683683
checked={currentStream.record}
684684
onChange={onInputChange}
@@ -701,7 +701,7 @@ export function StreamConfigModal({
701701
type="checkbox"
702702
id="stream-record-on-schedule"
703703
name="recordOnSchedule"
704-
className="h-3.5 w-3.5 rounded border-gray-300"
704+
className="h-3.5 w-3.5 rounded border-input"
705705
style={primaryAccentStyle}
706706
checked={currentStream.recordOnSchedule || false}
707707
onChange={onInputChange}
@@ -734,7 +734,7 @@ export function StreamConfigModal({
734734
type="checkbox"
735735
id="stream-detection-enabled"
736736
name="detectionEnabled"
737-
className="h-4 w-4 mt-0.5 rounded border-gray-300"
737+
className="h-4 w-4 mt-0.5 rounded border-input"
738738
style={primaryAccentStyle}
739739
checked={currentStream.detectionEnabled}
740740
onChange={onInputChange}
@@ -781,7 +781,7 @@ export function StreamConfigModal({
781781
type="checkbox"
782782
id="stream-record-audio"
783783
name="recordAudio"
784-
className="h-4 w-4 rounded border-gray-300"
784+
className="h-4 w-4 rounded border-input"
785785
style={primaryAccentStyle}
786786
checked={currentStream.recordAudio}
787787
onChange={onInputChange}
@@ -793,7 +793,7 @@ export function StreamConfigModal({
793793
type="checkbox"
794794
id="stream-backchannel-enabled"
795795
name="backchannelEnabled"
796-
className="h-4 w-4 rounded border-gray-300"
796+
className="h-4 w-4 rounded border-input"
797797
style={primaryAccentStyle}
798798
checked={currentStream.backchannelEnabled}
799799
onChange={onInputChange}
@@ -1147,14 +1147,14 @@ export function StreamConfigModal({
11471147
<div className="flex items-center space-x-3">
11481148
<div
11491149
className="w-4 h-4 rounded"
1150-
style={{ backgroundColor: zone.color || '#3b82f6' }}
1150+
style={{ backgroundColor: zone.color || 'hsl(var(--primary))' }}
11511151
/>
11521152
<span className="font-medium">{zone.name}</span>
11531153
<span className="text-sm text-muted-foreground">
11541154
({zone.polygon.length} points)
11551155
</span>
11561156
</div>
1157-
<span className={`text-sm px-2 py-1 rounded ${zone.enabled ? 'bg-success/20 text-success' : 'bg-muted text-muted-foreground'}`}>
1157+
<span className={`text-sm px-2 py-1 rounded ${zone.enabled ? 'bg-[hsl(var(--success-muted))] text-[hsl(var(--success-muted-foreground))]' : 'bg-muted text-muted-foreground'}`}>
11581158
{zone.enabled ? t('common.enabled') : t('common.disabled')}
11591159
</span>
11601160
</div>
@@ -1197,7 +1197,7 @@ export function StreamConfigModal({
11971197
type="checkbox"
11981198
id="motion-recording-enabled"
11991199
name="motionRecordingEnabled"
1200-
className="h-4 w-4 rounded border-gray-300"
1200+
className="h-4 w-4 rounded border-input"
12011201
style={primaryAccentStyle}
12021202
checked={currentStream.motionRecordingEnabled}
12031203
onChange={onInputChange}

‎web/js/components/preact/ZoneEditor.jsx‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ export function ZoneEditor({ streamName, zones = [], onZonesChange, onClose }) {
8686
}
8787
}, [streamName]);
8888

89+
// Read a CSS custom property and return a usable hsl() colour string.
90+
// The project's theme variables are stored as bare "H S% L%" triplets so we
91+
// must wrap them in hsl() before passing them to a Canvas 2D context.
92+
const getThemeColor = (varName, fallback) => {
93+
const val = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
94+
return val ? `hsl(${val})` : fallback;
95+
};
96+
8997
// Draw zones on canvas
9098
const drawCanvas = () => {
9199
const canvas = canvasRef.current;
@@ -129,12 +137,12 @@ export function ZoneEditor({ streamName, zones = [], onZonesChange, onClose }) {
129137
// Draw the image with proper aspect ratio
130138
ctx.drawImage(image, offsetX, offsetY, drawWidth, drawHeight);
131139
} else {
132-
// Draw a placeholder background
133-
ctx.fillStyle = '#1a1a1a';
140+
// Draw a placeholder background using the current theme's card colour
141+
ctx.fillStyle = getThemeColor('--card', '#ffffff');
134142
ctx.fillRect(0, 0, canvas.width, canvas.height);
135143

136-
// Draw grid
137-
ctx.strokeStyle = '#333';
144+
// Draw grid using the current theme's border colour
145+
ctx.strokeStyle = getThemeColor('--border', '#e5e7eb');
138146
ctx.lineWidth = 1;
139147
for (let i = 0; i < canvas.width; i += 50) {
140148
ctx.beginPath();
@@ -184,8 +192,8 @@ export function ZoneEditor({ streamName, zones = [], onZonesChange, onClose }) {
184192
ctx.closePath();
185193
}
186194

187-
// Fill with semi-transparent color
188-
const color = zone.color || '#3b82f6';
195+
// Fill with semi-transparent color; fall back to the theme primary colour
196+
const color = zone.color || getThemeColor('--primary', '#6366f1');
189197
ctx.fillStyle = isSelected ? `${color}40` : `${color}20`;
190198
ctx.fill();
191199

@@ -528,7 +536,7 @@ export function ZoneEditor({ streamName, zones = [], onZonesChange, onClose }) {
528536
</div>
529537
)}
530538
{imageLoaded && snapshotError && (
531-
<div className="absolute top-4 left-4 bg-yellow-500/20 border border-yellow-500 text-yellow-200 px-3 py-2 rounded text-sm">
539+
<div className="absolute top-4 left-4 bg-[hsl(var(--warning-muted))] border border-[hsl(var(--warning))] text-[hsl(var(--warning-muted-foreground))] px-3 py-2 rounded text-sm">
532540
⚠️ {t('zoneEditor.snapshotUnavailable')}
533541
</div>
534542
)}
@@ -551,7 +559,7 @@ export function ZoneEditor({ streamName, zones = [], onZonesChange, onClose }) {
551559
</button>
552560
<button
553561
onClick={() => setEditMode('delete')}
554-
className={`px-4 py-2 rounded ${editMode === 'delete' ? 'bg-danger text-white' : 'bg-background'}`}
562+
className={`px-4 py-2 rounded ${editMode === 'delete' ? 'bg-[hsl(var(--danger))] text-[hsl(var(--danger-foreground))]' : 'bg-background'}`}
555563
>
556564
🗑️ {t('common.delete')}
557565
</button>

0 commit comments

Comments
 (0)