2024-10-15 16:24:47 +03:00
|
|
|
import TimeAgo from "../dynamic/TimeAgo";
|
|
|
|
|
import useSWR from "swr";
|
|
|
|
|
import { FrigateConfig } from "@/types/frigateConfig";
|
|
|
|
|
import { useFormattedTimestamp } from "@/hooks/use-date-utils";
|
|
|
|
|
import { SearchResult } from "@/types/search";
|
2024-10-22 17:01:01 +03:00
|
|
|
import ActivityIndicator from "../indicators/activity-indicator";
|
|
|
|
|
import SearchResultActions from "../menu/SearchResultActions";
|
2024-10-17 14:30:52 +03:00
|
|
|
import { cn } from "@/lib/utils";
|
2024-10-15 16:24:47 +03:00
|
|
|
|
|
|
|
|
type SearchThumbnailProps = {
|
|
|
|
|
searchResult: SearchResult;
|
2024-10-17 14:30:52 +03:00
|
|
|
columns: number;
|
2024-10-15 16:24:47 +03:00
|
|
|
findSimilar: () => void;
|
|
|
|
|
refreshResults: () => void;
|
|
|
|
|
showObjectLifecycle: () => void;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function SearchThumbnailFooter({
|
|
|
|
|
searchResult,
|
2024-10-17 14:30:52 +03:00
|
|
|
columns,
|
2024-10-15 16:24:47 +03:00
|
|
|
findSimilar,
|
|
|
|
|
refreshResults,
|
|
|
|
|
showObjectLifecycle,
|
|
|
|
|
}: SearchThumbnailProps) {
|
|
|
|
|
const { data: config } = useSWR<FrigateConfig>("config");
|
|
|
|
|
|
|
|
|
|
// date
|
|
|
|
|
const formattedDate = useFormattedTimestamp(
|
|
|
|
|
searchResult.start_time,
|
|
|
|
|
config?.ui.time_format == "24hour" ? "%b %-d, %H:%M" : "%b %-d, %I:%M %p",
|
|
|
|
|
config?.ui.timezone,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
2024-10-22 17:01:01 +03:00
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
"flex w-full flex-row items-center justify-between",
|
|
|
|
|
columns > 4 &&
|
|
|
|
|
"items-start sm:flex-col sm:gap-2 lg:flex-row lg:items-center lg:gap-1",
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex flex-col items-start text-xs text-primary-variant">
|
|
|
|
|
{searchResult.end_time ? (
|
|
|
|
|
<TimeAgo time={searchResult.start_time * 1000} dense />
|
|
|
|
|
) : (
|
|
|
|
|
<div>
|
|
|
|
|
<ActivityIndicator size={14} />
|
|
|
|
|
</div>
|
2024-10-15 16:24:47 +03:00
|
|
|
)}
|
2024-10-22 17:01:01 +03:00
|
|
|
{formattedDate}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex flex-row items-center justify-end gap-6 md:gap-4">
|
|
|
|
|
<SearchResultActions
|
|
|
|
|
searchResult={searchResult}
|
|
|
|
|
findSimilar={findSimilar}
|
|
|
|
|
refreshResults={refreshResults}
|
|
|
|
|
showObjectLifecycle={showObjectLifecycle}
|
|
|
|
|
/>
|
2024-10-15 16:24:47 +03:00
|
|
|
</div>
|
2024-10-22 17:01:01 +03:00
|
|
|
</div>
|
2024-10-15 16:24:47 +03:00
|
|
|
);
|
|
|
|
|
}
|