mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-21 03:41:55 +03:00
display zone names consistently using friendly_name or raw id without transformation
This commit is contained in:
parent
37ea6b46b5
commit
36e5dcc75a
@ -243,12 +243,7 @@ export default function CameraReviewClassification({
|
||||
handleZoneToggle("alerts.required_zones", zone.name)
|
||||
}
|
||||
/>
|
||||
<Label
|
||||
className={cn(
|
||||
"font-normal",
|
||||
!zone.friendly_name && "smart-capitalize",
|
||||
)}
|
||||
>
|
||||
<Label className="font-normal">
|
||||
{zone.friendly_name || zone.name}
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
@ -29,8 +29,8 @@ function getZoneDisplayName(zoneName: string, context?: FormContext): string {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fallback to cleaning up the zone name
|
||||
return String(zoneName).replace(/_/g, " ");
|
||||
// Fallback to the raw zone id verbatim (no friendly_name available)
|
||||
return String(zoneName);
|
||||
}
|
||||
|
||||
export function ZoneSwitchesWidget(props: WidgetProps) {
|
||||
|
||||
@ -1197,14 +1197,7 @@ function LifecycleIconRow({
|
||||
backgroundColor: `rgb(${color})`,
|
||||
}}
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
item.data?.zones_friendly_names?.[zidx] === zone &&
|
||||
"smart-capitalize",
|
||||
)}
|
||||
>
|
||||
{item.data?.zones_friendly_names?.[zidx]}
|
||||
</span>
|
||||
<span>{item.data?.zones_friendly_names?.[zidx]}</span>
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
|
||||
@ -7,12 +7,12 @@ export function resolveZoneName(
|
||||
zoneId: string,
|
||||
cameraId?: string,
|
||||
) {
|
||||
if (!config) return String(zoneId).replace(/_/g, " ");
|
||||
if (!config) return String(zoneId);
|
||||
|
||||
if (cameraId) {
|
||||
const camera = config.cameras?.[String(cameraId)];
|
||||
const zone = camera?.zones?.[zoneId];
|
||||
return zone?.friendly_name || String(zoneId).replace(/_/g, " ");
|
||||
return zone?.friendly_name || String(zoneId);
|
||||
}
|
||||
|
||||
for (const camKey in config.cameras) {
|
||||
@ -21,12 +21,12 @@ export function resolveZoneName(
|
||||
if (!cam?.zones) continue;
|
||||
if (Object.prototype.hasOwnProperty.call(cam.zones, zoneId)) {
|
||||
const zone = cam.zones[zoneId];
|
||||
return zone?.friendly_name || String(zoneId).replace(/_/g, " ");
|
||||
return zone?.friendly_name || String(zoneId);
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: return a cleaned-up zoneId string
|
||||
return String(zoneId).replace(/_/g, " ");
|
||||
// Fallback: display the raw zone id verbatim (no friendly_name available)
|
||||
return String(zoneId);
|
||||
}
|
||||
|
||||
export function useZoneFriendlyName(zoneId: string, cameraId?: string): string {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user