mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 15:15:22 +03:00
Always show snapshot but hide buttons for frigate+ if not applicable
This commit is contained in:
parent
305a67f83b
commit
425323e6c8
@ -49,14 +49,14 @@ import { TooltipPortal } from "@radix-ui/react-tooltip";
|
|||||||
type ObjectLifecycleProps = {
|
type ObjectLifecycleProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
event: Event;
|
event: Event;
|
||||||
showBack?: boolean;
|
fullscreen?: boolean;
|
||||||
setPane: React.Dispatch<React.SetStateAction<ReviewDetailPaneType>>;
|
setPane: React.Dispatch<React.SetStateAction<ReviewDetailPaneType>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function ObjectLifecycle({
|
export default function ObjectLifecycle({
|
||||||
className,
|
className,
|
||||||
event,
|
event,
|
||||||
showBack = true,
|
fullscreen = false,
|
||||||
setPane,
|
setPane,
|
||||||
}: ObjectLifecycleProps) {
|
}: ObjectLifecycleProps) {
|
||||||
const { data: eventSequence } = useSWR<ObjectLifecycleSequence[]>([
|
const { data: eventSequence } = useSWR<ObjectLifecycleSequence[]>([
|
||||||
@ -227,7 +227,7 @@ export default function ObjectLifecycle({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
{showBack && (
|
{!fullscreen && (
|
||||||
<div className={cn("flex items-center gap-2")}>
|
<div className={cn("flex items-center gap-2")}>
|
||||||
<Button
|
<Button
|
||||||
className="flex items-center gap-2.5 rounded-lg"
|
className="flex items-center gap-2.5 rounded-lg"
|
||||||
@ -351,7 +351,10 @@ export default function ObjectLifecycle({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="relative flex flex-col items-center justify-center">
|
<div className="relative flex flex-col items-center justify-center">
|
||||||
<Carousel className="m-0 w-full" setApi={setMainApi}>
|
<Carousel
|
||||||
|
className={cn("m-0 w-full", fullscreen && isDesktop && "w-[75%]")}
|
||||||
|
setApi={setMainApi}
|
||||||
|
>
|
||||||
<CarouselContent>
|
<CarouselContent>
|
||||||
{eventSequence.map((item, index) => (
|
{eventSequence.map((item, index) => (
|
||||||
<CarouselItem key={index}>
|
<CarouselItem key={index}>
|
||||||
@ -459,7 +462,7 @@ export default function ObjectLifecycle({
|
|||||||
</CarouselContent>
|
</CarouselContent>
|
||||||
</Carousel>
|
</Carousel>
|
||||||
</div>
|
</div>
|
||||||
<div className="relative flex flex-col items-center justify-center">
|
<div className="relative mt-4 flex flex-col items-center justify-center">
|
||||||
<Carousel
|
<Carousel
|
||||||
opts={{
|
opts={{
|
||||||
align: "center",
|
align: "center",
|
||||||
@ -478,7 +481,10 @@ export default function ObjectLifecycle({
|
|||||||
{eventSequence.map((item, index) => (
|
{eventSequence.map((item, index) => (
|
||||||
<CarouselItem
|
<CarouselItem
|
||||||
key={index}
|
key={index}
|
||||||
className={cn("basis-1/4 cursor-pointer pl-1 md:basis-[10%]")}
|
className={cn(
|
||||||
|
"basis-1/4 cursor-pointer pl-1 md:basis-[10%]",
|
||||||
|
fullscreen && "md:basis-16",
|
||||||
|
)}
|
||||||
onClick={() => handleThumbnailClick(index)}
|
onClick={() => handleThumbnailClick(index)}
|
||||||
>
|
>
|
||||||
<div className="p-1">
|
<div className="p-1">
|
||||||
|
|||||||
@ -34,14 +34,14 @@ import { baseUrl } from "@/api/baseUrl";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import ActivityIndicator from "@/components/indicators/activity-indicator";
|
import ActivityIndicator from "@/components/indicators/activity-indicator";
|
||||||
import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
import { ASPECT_VERTICAL_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
||||||
import { FaRegListAlt, FaVideo } from "react-icons/fa";
|
import { FaImage, FaRegListAlt, FaVideo } from "react-icons/fa";
|
||||||
import FrigatePlusIcon from "@/components/icons/FrigatePlusIcon";
|
import FrigatePlusIcon from "@/components/icons/FrigatePlusIcon";
|
||||||
import { FaRotate } from "react-icons/fa6";
|
import { FaRotate } from "react-icons/fa6";
|
||||||
import ObjectLifecycle from "./ObjectLifecycle";
|
import ObjectLifecycle from "./ObjectLifecycle";
|
||||||
|
|
||||||
const SEARCH_TABS = [
|
const SEARCH_TABS = [
|
||||||
"details",
|
"details",
|
||||||
"frigate+",
|
"snapshot",
|
||||||
"video",
|
"video",
|
||||||
"object lifecycle",
|
"object lifecycle",
|
||||||
] as const;
|
] as const;
|
||||||
@ -73,8 +73,8 @@ export default function SearchDetailDialog({
|
|||||||
|
|
||||||
const views = [...SEARCH_TABS];
|
const views = [...SEARCH_TABS];
|
||||||
|
|
||||||
if (!config.plus.enabled || !search.has_snapshot) {
|
if (!search.has_snapshot) {
|
||||||
const index = views.indexOf("frigate+");
|
const index = views.indexOf("snapshot");
|
||||||
views.splice(index, 1);
|
views.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ export default function SearchDetailDialog({
|
|||||||
<Content
|
<Content
|
||||||
className={
|
className={
|
||||||
isDesktop
|
isDesktop
|
||||||
? "sm:max-w-xl md:max-w-xl lg:max-w-3xl xl:max-w-6xl"
|
? "sm:max-w-xl md:max-w-4xl lg:max-w-4xl xl:max-w-7xl"
|
||||||
: "max-h-[75dvh] overflow-hidden px-2 pb-4"
|
: "max-h-[75dvh] overflow-hidden px-2 pb-4"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -143,7 +143,7 @@ export default function SearchDetailDialog({
|
|||||||
aria-label={`Select ${item}`}
|
aria-label={`Select ${item}`}
|
||||||
>
|
>
|
||||||
{item == "details" && <FaRegListAlt className="size-4" />}
|
{item == "details" && <FaRegListAlt className="size-4" />}
|
||||||
{item == "frigate+" && <FrigatePlusIcon className="size-4" />}
|
{item == "snapshot" && <FaImage className="size-4" />}
|
||||||
{item == "video" && <FaVideo className="size-4" />}
|
{item == "video" && <FaVideo className="size-4" />}
|
||||||
{item == "object lifecycle" && (
|
{item == "object lifecycle" && (
|
||||||
<FaRotate className="size-4" />
|
<FaRotate className="size-4" />
|
||||||
@ -163,9 +163,14 @@ export default function SearchDetailDialog({
|
|||||||
setSimilarity={setSimilarity}
|
setSimilarity={setSimilarity}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{page == "frigate+" && (
|
{page == "snapshot" && (
|
||||||
<FrigatePlusDialog
|
<FrigatePlusDialog
|
||||||
upload={search as unknown as Event}
|
upload={
|
||||||
|
{
|
||||||
|
...search,
|
||||||
|
plus_id: config?.plus?.enabled ? search.plus_id : "not_enabled",
|
||||||
|
} as unknown as Event
|
||||||
|
}
|
||||||
dialog={false}
|
dialog={false}
|
||||||
onClose={() => {}}
|
onClose={() => {}}
|
||||||
onEventUploaded={() => {
|
onEventUploaded={() => {
|
||||||
@ -178,7 +183,7 @@ export default function SearchDetailDialog({
|
|||||||
<ObjectLifecycle
|
<ObjectLifecycle
|
||||||
className="w-full"
|
className="w-full"
|
||||||
event={search as unknown as Event}
|
event={search as unknown as Event}
|
||||||
showBack={false}
|
fullscreen={true}
|
||||||
setPane={() => {}}
|
setPane={() => {}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user