Files
frigate/web/src/components/card/EmptyCard.tsx
T
4e90d254ed Miscellaneous fixes (#23177)
* add optional onClick to EmptyCard

* show EmptyCard in face rec when face library is empty

* add loading indicator

* add description to camera management pane

* Cleanup when use snapshot but can't load snapshot

* Migrate files

* fix birdseye color distortion when configured aspect ratio is unsupported

* Skip processing end for object descriptions

* don't crash if stats is null

* fix genai roles in migration

* frigate+ pane updates

- allow users to select a plus model from the select even when one was not previously loaded
- always show model summary card
- add model filter popover
- add restart button totast

* fix frigate+ pane layout and buttons to match other settings panes

* match button layout in go2rtc settings view

* make audio maintainer respond to dynamic config updates

* check correct zone name in publish state

* fix nested translation extraction for Optional dict and list fields

* mypy

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2026-05-12 10:20:39 -06:00

57 lines
1.2 KiB
TypeScript

import React from "react";
import { Button } from "../ui/button";
import Heading from "../ui/heading";
import { Link } from "react-router-dom";
import { cn } from "@/lib/utils";
type EmptyCardProps = {
className?: string;
icon: React.ReactNode;
title: string;
titleHeading?: boolean;
description?: string;
buttonText?: string;
link?: string;
onClick?: () => void;
};
export function EmptyCard({
className,
icon,
title,
titleHeading = true,
description,
buttonText,
link,
onClick,
}: EmptyCardProps) {
let TitleComponent;
if (titleHeading) {
TitleComponent = <Heading as="h4">{title}</Heading>;
} else {
TitleComponent = <div>{title}</div>;
}
return (
<div className={cn("flex flex-col items-center gap-2", className)}>
{icon}
{TitleComponent}
{description && (
<div className="mb-3 text-center text-secondary-foreground">
{description}
</div>
)}
{buttonText?.length &&
(onClick ? (
<Button size="sm" variant="select" onClick={onClick}>
{buttonText}
</Button>
) : (
<Button size="sm" variant="select">
<Link to={link ?? "#"}>{buttonText}</Link>
</Button>
))}
</div>
);
}