* Add icons for frigate+ items

* Fix bug where export didn't start

* Fix mobile overflow

* Capitalize first letter function
This commit is contained in:
Nicolas Mowen 2024-05-06 15:18:13 -06:00 committed by GitHub
parent c0073db859
commit e5e18a5026
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 47 additions and 3 deletions

View File

@ -568,7 +568,7 @@ export function CameraGroupEdit({
/> />
<Separator className="flex my-2 bg-secondary" /> <Separator className="flex my-2 bg-secondary" />
<div className="max-h-[40dvh] overflow-y-auto"> <div className="max-h-[25dvh] md:max-h-[40dvh] overflow-y-auto">
<FormField <FormField
control={form.control} control={form.control}
name="cameras" name="cameras"

View File

@ -121,6 +121,14 @@ export default function ExportDialog({
className="flex items-center gap-2" className="flex items-center gap-2"
size="sm" size="sm"
onClick={() => { onClick={() => {
const now = new Date(latestTime * 1000);
let start = 0;
now.setHours(now.getHours() - 1);
start = now.getTime() / 1000;
setRange({
before: latestTime,
after: start,
});
setMode("select"); setMode("select");
}} }}
> >

View File

@ -24,6 +24,7 @@ import ActivityIndicator from "../indicators/activity-indicator";
import { TimeRange } from "@/types/timeline"; import { TimeRange } from "@/types/timeline";
import { NoThumbSlider } from "../ui/slider"; import { NoThumbSlider } from "../ui/slider";
import { PREVIEW_FPS, PREVIEW_PADDING } from "@/types/preview"; import { PREVIEW_FPS, PREVIEW_PADDING } from "@/types/preview";
import { capitalizeFirstLetter } from "@/utils/stringUtil";
type PreviewPlayerProps = { type PreviewPlayerProps = {
review: ReviewSegment; review: ReviewSegment;
@ -263,7 +264,7 @@ export default function PreviewThumbnailPlayer({
.filter( .filter(
(item) => item !== undefined && !item.includes("-verified"), (item) => item !== undefined && !item.includes("-verified"),
) )
.map((text) => text.charAt(0).toUpperCase() + text.substring(1)) .map((text) => capitalizeFirstLetter(text))
.sort() .sort()
.join(", ") .join(", ")
.replaceAll("-verified", "")} .replaceAll("-verified", "")}

View File

@ -3,6 +3,7 @@ import {
CamerasFilterButton, CamerasFilterButton,
GeneralFilterContent, GeneralFilterContent,
} from "@/components/filter/ReviewFilterGroup"; } from "@/components/filter/ReviewFilterGroup";
import Chip from "@/components/indicators/Chip";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
Dialog, Dialog,
@ -23,8 +24,15 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { DualThumbSlider } from "@/components/ui/slider"; import { DualThumbSlider } from "@/components/ui/slider";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { Event } from "@/types/event"; import { Event } from "@/types/event";
import { ATTRIBUTE_LABELS, FrigateConfig } from "@/types/frigateConfig"; import { ATTRIBUTE_LABELS, FrigateConfig } from "@/types/frigateConfig";
import { getIconForLabel } from "@/utils/iconUtil";
import { capitalizeFirstLetter } from "@/utils/stringUtil";
import axios from "axios"; import axios from "axios";
import { useCallback, useEffect, useMemo, useState } from "react"; import { useCallback, useEffect, useMemo, useState } from "react";
import { isMobile } from "react-device-detect"; import { isMobile } from "react-device-detect";
@ -182,9 +190,36 @@ export default function SubmitPlus() {
return ( return (
<div <div
key={event.id} key={event.id}
className="w-full rounded-lg md:rounded-2xl aspect-video flex justify-center items-center bg-black cursor-pointer" className="w-full relative rounded-lg md:rounded-2xl aspect-video flex justify-center items-center bg-black cursor-pointer"
onClick={() => setUpload(event)} onClick={() => setUpload(event)}
> >
<div className="absolute left-0 top-2 z-40">
<Tooltip>
<div className="flex">
<TooltipTrigger asChild>
<div className="mx-3 pb-1 text-white text-sm">
<Chip
className={`flex items-start justify-between space-x-1 bg-gradient-to-br from-gray-400 to-gray-500 bg-gray-500 z-0`}
>
{[event.label].map((object) => {
return getIconForLabel(
object,
"size-3 text-white",
);
})}
</Chip>
</div>
</TooltipTrigger>
</div>
<TooltipContent className="capitalize">
{[event.label]
.map((text) => capitalizeFirstLetter(text))
.sort()
.join(", ")
.replaceAll("-verified", "")}
</TooltipContent>
</Tooltip>
</div>
<img <img
className="aspect-video h-full object-contain rounded-lg md:rounded-2xl" className="aspect-video h-full object-contain rounded-lg md:rounded-2xl"
src={`${baseUrl}api/events/${event.id}/snapshot.jpg`} src={`${baseUrl}api/events/${event.id}/snapshot.jpg`}