From 8d8c2ed3ab82e7813e087a64cd28f0d47a7b9eb6 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Tue, 11 Aug 2026 15:10:37 +0545 Subject: [PATCH] fix(OUT-4032): gate actions widget on content only Drop the never-saved timestamp check: a segment duplicated from a customized default is a fresh insert (createdAt === updatedAt) yet its content is already personalized, so the timestamp check wrongly hid the card. Rely on isDefaultContent alone. Co-Authored-By: Claude Opus 4.8 --- .../editor/components/ClientEditorWrapper.tsx | 6 ++---- src/features/editor/components/EditorWrapper.tsx | 6 ++---- src/features/editor/components/Preview/Preview.tsx | 6 ++---- src/features/editor/utils/content.ts | 13 ------------- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/features/editor/components/ClientEditorWrapper.tsx b/src/features/editor/components/ClientEditorWrapper.tsx index 07f69fa..8e35100 100644 --- a/src/features/editor/components/ClientEditorWrapper.tsx +++ b/src/features/editor/components/ClientEditorWrapper.tsx @@ -2,7 +2,7 @@ import { ReadonlyEditor } from '@editor/components/Editor/ReadonlyEditor' import { useViewStore } from '@editor/stores/viewStore' -import { isDefaultClientHome } from '@editor/utils/content' +import { isDefaultContent } from '@editor/utils/content' import { useSettingsStore } from '@settings/providers/settings.provider' import { useQuery } from '@tanstack/react-query' import { ActionsCard } from '@/features/action-items/components/actions-card' @@ -24,8 +24,6 @@ export const ClientEditorWrapper = () => { const bannerPositionX = useSettingsStore((store) => store.bannerPositionX) ?? 50 const bannerPositionY = useSettingsStore((store) => store.bannerPositionY) ?? 50 const showGreeting = useSettingsStore((store) => store.showGreeting) - const createdAt = useSettingsStore((store) => store.createdAt) - const updatedAt = useSettingsStore((store) => store.updatedAt) useQuery({ queryKey: ['tasks-app-id'], @@ -63,7 +61,7 @@ export const ClientEditorWrapper = () => { /> )} - {!isDefaultClientHome({ content, createdAt, updatedAt }) && } + {!isDefaultContent(content) && } diff --git a/src/features/editor/components/EditorWrapper.tsx b/src/features/editor/components/EditorWrapper.tsx index fa577de..c855593 100644 --- a/src/features/editor/components/EditorWrapper.tsx +++ b/src/features/editor/components/EditorWrapper.tsx @@ -5,7 +5,7 @@ import { Heading } from '@editor/components/Heading' import { Preview } from '@editor/components/Preview' import { Subheading } from '@editor/components/Subheading' import { useAppControls } from '@editor/hooks/useAppControls' -import { isDefaultClientHome } from '@editor/utils/content' +import { isDefaultContent } from '@editor/utils/content' import { useBannerSettingsMutation } from '@settings/hooks/useBannerSettingsMutation' import { useSegmentSettings } from '@settings/hooks/useSegmentSettings' import { useSettingsStore } from '@settings/providers/settings.provider' @@ -33,8 +33,6 @@ export function EditorWrapper({ className }: EditorWrapperProps) { const bannerPositionX = useSettingsStore((store) => store.bannerPositionX) ?? 50 const bannerPositionY = useSettingsStore((store) => store.bannerPositionY) ?? 50 const showGreeting = useSettingsStore((store) => store.showGreeting) - const createdAt = useSettingsStore((store) => store.createdAt) - const updatedAt = useSettingsStore((store) => store.updatedAt) const setSidebarView = useSidebarStore((store) => store.setSidebarView) const bannerRepositioning = useSidebarStore((store) => store.bannerRepositioning) const setBannerRepositioning = useSidebarStore((store) => store.setBannerRepositioning) @@ -82,7 +80,7 @@ export function EditorWrapper({ className }: EditorWrapperProps) { } /> )} - {!isDefaultClientHome({ content, createdAt, updatedAt }) && } + {!isDefaultContent(content) && } diff --git a/src/features/editor/components/Preview/Preview.tsx b/src/features/editor/components/Preview/Preview.tsx index d76a967..4382eb5 100644 --- a/src/features/editor/components/Preview/Preview.tsx +++ b/src/features/editor/components/Preview/Preview.tsx @@ -2,7 +2,7 @@ import { Loader } from '@common/components/Loader' import { ReadonlyEditor } from '@editor/components/Editor/ReadonlyEditor' import { PreviewTopBar } from '@editor/components/Preview/PreviewTopBar' import { DisplayMode, useViewStore } from '@editor/stores/viewStore' -import { isDefaultClientHome } from '@editor/utils/content' +import { isDefaultContent } from '@editor/utils/content' import { useSettingsStore } from '@settings/providers/settings.provider' import { useUsersStore } from '@users/stores/usersStore' import { ActionsCard } from '@/features/action-items/components/actions-card' @@ -25,8 +25,6 @@ export function Preview({ content, backgroundColor, bannerUrl, bannerPositionX, const displayMode = useViewStore((store) => store.displayMode) const workspace = useViewStore((store) => store.workspace) const showGreeting = useSettingsStore((store) => store.showGreeting) - const createdAt = useSettingsStore((store) => store.createdAt) - const updatedAt = useSettingsStore((store) => store.updatedAt) const isDark = isDarkColor(backgroundColor) const isInitialized = useUsersStore((store) => store.isInitialized) @@ -66,7 +64,7 @@ export function Preview({ content, backgroundColor, bannerUrl, bannerPositionX, {bannerUrl ? ( ) : null} - {!isDefaultClientHome({ content, createdAt, updatedAt }) && } + {!isDefaultContent(content) && } )} diff --git a/src/features/editor/utils/content.ts b/src/features/editor/utils/content.ts index 590576e..c9a0bc5 100644 --- a/src/features/editor/utils/content.ts +++ b/src/features/editor/utils/content.ts @@ -9,16 +9,3 @@ export const isBlankContent = (html?: string): boolean => { // True when the body still matches the seeded default copy. export const isDefaultContent = (html?: string): boolean => html === defaultContent - -// True when the row was never saved (createdAt and updatedAt match on insert). -export const isNeverSaved = (createdAt?: string | Date | null, updatedAt?: string | Date | null): boolean => { - if (!createdAt || !updatedAt) return false - return new Date(createdAt).getTime() === new Date(updatedAt).getTime() -} - -// True while the client home is still the untouched default. -export const isDefaultClientHome = (params: { - content?: string - createdAt?: string | Date | null - updatedAt?: string | Date | null -}): boolean => isDefaultContent(params.content) || isNeverSaved(params.createdAt, params.updatedAt)