From caf04015bb8f3143e06f59290c5bf46b2b651dd6 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Sun, 5 Oct 2025 16:02:23 -0700 Subject: [PATCH] Fixed default date range handling. Added header to share page. --- .../settings/preferences/DateRangeSetting.tsx | 5 +++- .../websites/[websiteId]/WebsiteHeader.tsx | 23 +++++++++++-------- .../websites/[websiteId]/WebsiteLayout.tsx | 2 +- src/app/share/[...shareId]/SharePage.tsx | 2 ++ src/components/hooks/useDateRange.ts | 10 +++++--- src/styles/global.css | 2 +- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/app/(main)/settings/preferences/DateRangeSetting.tsx b/src/app/(main)/settings/preferences/DateRangeSetting.tsx index e47ce0b6..c0e8221e 100644 --- a/src/app/(main)/settings/preferences/DateRangeSetting.tsx +++ b/src/app/(main)/settings/preferences/DateRangeSetting.tsx @@ -14,7 +14,10 @@ export function DateRangeSetting() { setDate(value); }; - const handleReset = () => setItem(DATE_RANGE_CONFIG, DEFAULT_DATE_RANGE_VALUE); + const handleReset = () => { + setItem(DATE_RANGE_CONFIG, DEFAULT_DATE_RANGE_VALUE); + setDate(DEFAULT_DATE_RANGE_VALUE); + }; return ( diff --git a/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx b/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx index 4a2ffdf0..0f9f8123 100644 --- a/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsiteHeader.tsx @@ -7,7 +7,7 @@ import { WebsiteShareForm } from '@/app/(main)/websites/[websiteId]/settings/Web import { useMessages, useNavigation, useWebsite } from '@/components/hooks'; import { LinkButton } from '@/components/common/LinkButton'; -export function WebsiteHeader() { +export function WebsiteHeader({ showActions }: { showActions?: boolean }) { const website = useWebsite(); const { renderUrl, pathname } = useNavigation(); const isSettings = pathname.endsWith('/settings'); @@ -20,15 +20,18 @@ export function WebsiteHeader() { } marginBottom="3"> - - - - - - - Edit - - + + {showActions && ( + + + + + + + Edit + + + )} ); diff --git a/src/app/(main)/websites/[websiteId]/WebsiteLayout.tsx b/src/app/(main)/websites/[websiteId]/WebsiteLayout.tsx index e25541e9..61766921 100644 --- a/src/app/(main)/websites/[websiteId]/WebsiteLayout.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsiteLayout.tsx @@ -21,7 +21,7 @@ export function WebsiteLayout({ websiteId, children }: { websiteId: string; chil )} - + {children} diff --git a/src/app/share/[...shareId]/SharePage.tsx b/src/app/share/[...shareId]/SharePage.tsx index 0fa3c0bf..f33798a1 100644 --- a/src/app/share/[...shareId]/SharePage.tsx +++ b/src/app/share/[...shareId]/SharePage.tsx @@ -6,6 +6,7 @@ import { useShareTokenQuery } from '@/components/hooks'; import { PageBody } from '@/components/common/PageBody'; import { Header } from './Header'; import { Footer } from './Footer'; +import { WebsiteHeader } from '@/app/(main)/websites/[websiteId]/WebsiteHeader'; export function SharePage({ shareId }) { const { shareToken, isLoading } = useShareTokenQuery(shareId); @@ -19,6 +20,7 @@ export function SharePage({ shareId }) {
+