diff --git a/apps/web/app/(app)/page.tsx b/apps/web/app/(app)/page.tsx index 4d35cb687..d2b909522 100644 --- a/apps/web/app/(app)/page.tsx +++ b/apps/web/app/(app)/page.tsx @@ -66,8 +66,13 @@ function ViewErrorFallback() { export default function NewPage() { const isMobile = useIsMobile() const { user, session } = useAuth() - const { selectedProject, isNovaSpaces, novaContainerTags, selectedProjects } = - useProject() + const { + selectedProject, + isNovaSpaces, + novaContainerTags, + selectedProjects, + setSelectedProjects, + } = useProject() const selectedProjectTag = selectedProjects[0] const isNovaContext = isNovaSpaces || @@ -81,6 +86,12 @@ export default function NewPage() { : (allProjects.find((p) => p.containerTag === selectedProjectTag) ?.name ?? selectedProjectTag) : undefined + + const handleSwitchToAllSpacesFromEmptyState = useCallback(() => { + analytics.spaceSwitched({ space_id: "nova_spaces" }) + setSelectedProjects([]) + }, [setSelectedProjects]) + const { viewMode, setViewMode } = useViewMode() const queryClient = useQueryClient() @@ -466,6 +477,9 @@ export default function NewPage() { onOpenIntegrations: handleOpenIntegrations, isAllSpaces: isNovaSpaces, spaceName: emptyStateSpaceName, + onSwitchToAllSpaces: isNovaSpaces + ? undefined + : handleSwitchToAllSpacesFromEmptyState, } : undefined } diff --git a/apps/web/components/memories-grid.tsx b/apps/web/components/memories-grid.tsx index cc7e8453b..ff459432c 100644 --- a/apps/web/components/memories-grid.tsx +++ b/apps/web/components/memories-grid.tsx @@ -100,6 +100,7 @@ interface NovaEmptyStateProps { ) => void isAllSpaces: boolean spaceName?: string + onSwitchToAllSpaces?: () => void } interface MemoriesGridProps { @@ -512,6 +513,7 @@ export function MemoriesGrid({ onOpenIntegrations={emptyStateProps.onOpenIntegrations} isAllSpaces={emptyStateProps.isAllSpaces} spaceName={emptyStateProps.spaceName} + onSwitchToAllSpaces={emptyStateProps.onSwitchToAllSpaces} /> ) : isEmpty ? (
diff --git a/apps/web/components/nova/nova-empty-state.tsx b/apps/web/components/nova/nova-empty-state.tsx index 8156512fe..24be5b791 100644 --- a/apps/web/components/nova/nova-empty-state.tsx +++ b/apps/web/components/nova/nova-empty-state.tsx @@ -15,6 +15,7 @@ interface NovaEmptyStateProps { ) => void isAllSpaces: boolean spaceName?: string + onSwitchToAllSpaces?: () => void } const cardClass = cn( @@ -28,19 +29,13 @@ export function NovaEmptyState({ onOpenIntegrations, isAllSpaces, spaceName, + onSwitchToAllSpaces, }: NovaEmptyStateProps) { const handleInstallChrome = () => { window.open(CHROME_EXTENSION_URL, "_blank", "noopener,noreferrer") } - const title = isAllSpaces - ? "Help Nova get to know you" - : "This space is empty" - const subtitle = isAllSpaces - ? "Add your first memory to get started." - : spaceName - ? `Add memories to ${spaceName} to get started.` - : "Add memories to this space to get started." + const showSingleSpaceEmpty = !isAllSpaces && onSwitchToAllSpaces return (
-

- {title} -

-

- {subtitle} -

+ {isAllSpaces ? ( + <> +

+ Help Nova get to know you +

+

+ Add your first memory to get started. +

+ + ) : showSingleSpaceEmpty ? ( + <> +

+ {spaceName ? ( + <> + + "{spaceName}" + {" "} + is empty + + ) : ( + "This space is empty" + )} +

+

+ Your memories may be in another space. +

+ + + ) : ( + <> +

+ This space is empty +

+

+ {spaceName ? ( + <> + Add memories to{" "} + + "{spaceName}" + {" "} + to get started. + + ) : ( + "Add memories to this space to get started." + )} +

+ + )}