mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-04 06:14:52 +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 { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { useFormattedTimestamp } from "@/hooks/use-date-utils";
|
import { useFormattedTimestamp } from "@/hooks/use-date-utils";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
import { FrigateConfig } from "@/types/frigateConfig";
|
import { FrigateConfig } from "@/types/frigateConfig";
|
||||||
import { getUTCOffset } from "@/utils/dateUtil";
|
import { getUTCOffset } from "@/utils/dateUtil";
|
||||||
import { useCallback, useMemo, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
@ -204,19 +205,22 @@ export function ShareTimestampContent({
|
|||||||
{isDesktop && <Separator className="my-4 bg-secondary" />}
|
{isDesktop && <Separator className="my-4 bg-secondary" />}
|
||||||
|
|
||||||
<DialogFooter
|
<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 && (
|
{onCancel && (
|
||||||
<button
|
<Button
|
||||||
type="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}
|
onClick={onCancel}
|
||||||
>
|
>
|
||||||
{t("button.cancel", { ns: "common" })}
|
{t("button.cancel", { ns: "common" })}
|
||||||
</button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
className={isDesktop ? "" : "w-full"}
|
className={cn(!isDesktop && "w-full")}
|
||||||
variant="select"
|
variant="select"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => onShareTimestamp(Math.floor(selectedTimestamp))}
|
onClick={() => onShareTimestamp(Math.floor(selectedTimestamp))}
|
||||||
@ -298,7 +302,10 @@ function CustomTimestampSelector({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<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 />
|
<FaCalendarAlt />
|
||||||
<div className="flex flex-wrap items-center">
|
<div className="flex flex-wrap items-center">
|
||||||
@ -312,7 +319,7 @@ function CustomTimestampSelector({
|
|||||||
>
|
>
|
||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
className={`text-primary ${isDesktop ? "" : "text-xs"}`}
|
className={cn("text-primary", !isDesktop && "text-xs")}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
variant={selectorOpen ? "select" : "default"}
|
variant={selectorOpen ? "select" : "default"}
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { baseUrl } from "@/api/baseUrl.ts";
|
||||||
|
|
||||||
export const RECORDING_REVIEW_LINK_PARAM = "timestamp";
|
export const RECORDING_REVIEW_LINK_PARAM = "timestamp";
|
||||||
|
|
||||||
export type RecordingReviewLinkState = {
|
export type RecordingReviewLinkState = {
|
||||||
@ -43,11 +45,12 @@ export function createRecordingReviewUrl(
|
|||||||
pathname: string,
|
pathname: string,
|
||||||
state: RecordingReviewLinkState,
|
state: RecordingReviewLinkState,
|
||||||
): string {
|
): string {
|
||||||
const url = new URL(globalThis.location.href);
|
const url = new URL(baseUrl);
|
||||||
const normalizedPathname = pathname.startsWith("/")
|
url.pathname = pathname.startsWith("/") ? pathname : `/${pathname}`;
|
||||||
? pathname
|
url.searchParams.set(
|
||||||
: `/${pathname}`;
|
RECORDING_REVIEW_LINK_PARAM,
|
||||||
const reviewLink = `${state.camera}_${Math.floor(state.timestamp)}`;
|
`${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 && (
|
{isDesktop && (
|
||||||
<ShareTimestampDialog
|
<ShareTimestampDialog
|
||||||
key={shareTimestampAtOpen}
|
|
||||||
currentTime={shareTimestampAtOpen}
|
currentTime={shareTimestampAtOpen}
|
||||||
open={shareTimestampOpen}
|
open={shareTimestampOpen}
|
||||||
onOpenChange={setShareTimestampOpen}
|
onOpenChange={setShareTimestampOpen}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user