frigate/web/src/components/camera/CameraNameLabel.tsx
Josh Hawkins 398a3a7b95
Rename nickname to friendly_name (#19782)
Better aligns with convention from Home Assistant since many Frigate users are also HA users
2025-08-26 15:29:52 -05:00

25 lines
797 B
TypeScript

import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name";
import { CameraConfig } from "@/types/frigateConfig";
interface CameraNameLabelProps
extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
camera?: string | CameraConfig;
}
const CameraNameLabel = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
CameraNameLabelProps
>(({ className, camera, ...props }, ref) => {
const displayName = useCameraFriendlyName(camera);
return (
<LabelPrimitive.Root ref={ref} className={className} {...props}>
{displayName}
</LabelPrimitive.Root>
);
});
CameraNameLabel.displayName = LabelPrimitive.Root.displayName;
export { CameraNameLabel };