Fixes based off PR review comments

This commit is contained in:
0x464e 2026-03-20 21:19:00 +02:00
parent 738197b184
commit dd5ad11a6e
No known key found for this signature in database
GPG Key ID: E6D221DF6CBFBFFA
3 changed files with 23 additions and 14 deletions

View File

@ -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"

View File

@ -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();
} }

View File

@ -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}