mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-03 22:04:53 +03:00
Fixes based off PR review comments
This commit is contained in:
parent
738197b184
commit
dd5ad11a6e
@ -17,6 +17,7 @@ import {
|
||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { useFormattedTimestamp } from "@/hooks/use-date-utils";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { FrigateConfig } from "@/types/frigateConfig";
|
||||
import { getUTCOffset } from "@/utils/dateUtil";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
@ -204,19 +205,22 @@ export function ShareTimestampContent({
|
||||
{isDesktop && <Separator className="my-4 bg-secondary" />}
|
||||
|
||||
<DialogFooter
|
||||
className={isDesktop ? "mt-4" : "mt-4 flex flex-col-reverse gap-4"}
|
||||
className={cn("mt-4", !isDesktop && "flex flex-col-reverse gap-4")}
|
||||
>
|
||||
{onCancel && (
|
||||
<button
|
||||
<Button
|
||||
type="button"
|
||||
className={`cursor-pointer p-2 text-center ${isDesktop ? "" : "w-full"}`}
|
||||
className={cn(
|
||||
"cursor-pointer p-2 text-center",
|
||||
!isDesktop && "w-full",
|
||||
)}
|
||||
onClick={onCancel}
|
||||
>
|
||||
{t("button.cancel", { ns: "common" })}
|
||||
</button>
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
className={isDesktop ? "" : "w-full"}
|
||||
className={cn(!isDesktop && "w-full")}
|
||||
variant="select"
|
||||
size="sm"
|
||||
onClick={() => onShareTimestamp(Math.floor(selectedTimestamp))}
|
||||
@ -298,7 +302,10 @@ function CustomTimestampSelector({
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex items-center rounded-lg bg-secondary text-secondary-foreground ${isDesktop ? "gap-2 px-2" : "pl-2"}`}
|
||||
className={cn(
|
||||
"flex items-center rounded-lg bg-secondary text-secondary-foreground",
|
||||
isDesktop ? "gap-2 px-2" : "pl-2",
|
||||
)}
|
||||
>
|
||||
<FaCalendarAlt />
|
||||
<div className="flex flex-wrap items-center">
|
||||
@ -312,7 +319,7 @@ function CustomTimestampSelector({
|
||||
>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
className={`text-primary ${isDesktop ? "" : "text-xs"}`}
|
||||
className={cn("text-primary", !isDesktop && "text-xs")}
|
||||
aria-label={label}
|
||||
variant={selectorOpen ? "select" : "default"}
|
||||
size="sm"
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { baseUrl } from "@/api/baseUrl.ts";
|
||||
|
||||
export const RECORDING_REVIEW_LINK_PARAM = "timestamp";
|
||||
|
||||
export type RecordingReviewLinkState = {
|
||||
@ -43,11 +45,12 @@ export function createRecordingReviewUrl(
|
||||
pathname: string,
|
||||
state: RecordingReviewLinkState,
|
||||
): string {
|
||||
const url = new URL(globalThis.location.href);
|
||||
const normalizedPathname = pathname.startsWith("/")
|
||||
? pathname
|
||||
: `/${pathname}`;
|
||||
const reviewLink = `${state.camera}_${Math.floor(state.timestamp)}`;
|
||||
const url = new URL(baseUrl);
|
||||
url.pathname = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
||||
url.searchParams.set(
|
||||
RECORDING_REVIEW_LINK_PARAM,
|
||||
`${state.camera}_${Math.floor(state.timestamp)}`,
|
||||
);
|
||||
|
||||
return `${url.origin}${normalizedPathname}?${RECORDING_REVIEW_LINK_PARAM}=${reviewLink}`;
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
@ -691,7 +691,6 @@ export function RecordingView({
|
||||
)}
|
||||
{isDesktop && (
|
||||
<ShareTimestampDialog
|
||||
key={shareTimestampAtOpen}
|
||||
currentTime={shareTimestampAtOpen}
|
||||
open={shareTimestampOpen}
|
||||
onOpenChange={setShareTimestampOpen}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user