diff --git a/apps/web/app/(app)/page.tsx b/apps/web/app/(app)/page.tsx index fb82bcb9..4d35cb68 100644 --- a/apps/web/app/(app)/page.tsx +++ b/apps/web/app/(app)/page.tsx @@ -502,7 +502,6 @@ export default function NewPage() { setAddDoc(null)} - defaultTab={addDoc ?? undefined} /> void - defaultTab?: TabType } -export function AddDocumentModal({ - isOpen, - onClose, - defaultTab, -}: AddDocumentModalProps) { +export function AddDocumentModal({ isOpen, onClose }: AddDocumentModalProps) { const isMobile = useIsMobile() return ( @@ -54,11 +49,7 @@ export function AddDocumentModal({ > Add Document
- +
@@ -97,7 +88,6 @@ export function AddDocument({ onClose, isOpen, }: { - defaultTab?: TabType onClose: () => void isOpen?: boolean }) { diff --git a/apps/web/components/integrations/connections-detail.tsx b/apps/web/components/integrations/connections-detail.tsx index dd1473a0..09913d17 100644 --- a/apps/web/components/integrations/connections-detail.tsx +++ b/apps/web/components/integrations/connections-detail.tsx @@ -8,12 +8,13 @@ import { GoogleDrive, Notion, OneDrive } from "@ui/assets/icons" import { useCustomer } from "autumn-js/react" import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query" import { Check, Plus, Trash2, Zap } from "lucide-react" -import { useEffect, useState } from "react" +import { useEffect } from "react" import { toast } from "sonner" +import { useQueryState } from "nuqs" import type { ConnectionResponseSchema } from "@repo/validation/api" import type { z } from "zod" import { analytics } from "@/lib/analytics" -import { AddDocumentModal } from "@/components/add-document" +import { addDocumentParam } from "@/lib/search-params" import { DEFAULT_PROJECT_ID } from "@lib/constants" import type { Project } from "@lib/types" @@ -167,7 +168,7 @@ function ConnectionRow({ export function ConnectionsDetail() { const queryClient = useQueryClient() const autumn = useCustomer() - const [isAddDocumentOpen, setIsAddDocumentOpen] = useState(false) + const [, setAddDoc] = useQueryState("add", addDocumentParam) const projects = (queryClient.getQueryData(["projects"]) || []) as Project[] @@ -247,157 +248,147 @@ export function ConnectionsDetail() { const isLoading = autumn.isLoading || isCheckingStatus return ( - <> +
+ {!hasProProduct && !isLoading && ( + <> +
+
+
+ +

+ Connect Google Drive, Notion, and OneDrive to import your + knowledge +

+
+ {[ + "Unlimited memories", + "10 connections", + "Advanced search", + "Priority support", + ].map((text) => ( +
+ + + {text} + +
+ ))} +
+ +
+
+ + )} +
- {!hasProProduct && !isLoading && ( - <> -
-
-
- -

- Connect Google Drive, Notion, and OneDrive to import your - knowledge -

-
- {[ - "Unlimited memories", - "10 connections", - "Advanced search", - "Priority support", - ].map((text) => ( -
- - - {text} - -
- ))} -
- -
-
- - )} - -
-
- - Connected to Supermemory - - - {connections.length}/{connectionsLimit} connections used - -
- -
- {isLoadingConnections ? ( -
-
-
- ) : connections.length > 0 ? ( - connections.map((connection) => ( - - deleteConnectionMutation.mutate(connection.id) - } - isDeleting={deleteConnectionMutation.isPending} - disabled={!hasProProduct} - projects={projects} - /> - )) - ) : ( -
- -

- No connections yet -

-

- Connect a service below to import your knowledge -

-
- )} -
- - + Connected to Supermemory + + + {connections.length}/{connectionsLimit} connections used +
-
- setIsAddDocumentOpen(false)} - defaultTab="connect" - /> - +
+ {isLoadingConnections ? ( +
+
+
+ ) : connections.length > 0 ? ( + connections.map((connection) => ( + deleteConnectionMutation.mutate(connection.id)} + isDeleting={deleteConnectionMutation.isPending} + disabled={!hasProProduct} + projects={projects} + /> + )) + ) : ( +
+ +

+ No connections yet +

+

+ Connect a service below to import your knowledge +

+
+ )} +
+ + +
+
) } diff --git a/apps/web/components/select-spaces-modal.tsx b/apps/web/components/select-spaces-modal.tsx index 4c579739..d190052c 100644 --- a/apps/web/components/select-spaces-modal.tsx +++ b/apps/web/components/select-spaces-modal.tsx @@ -92,14 +92,8 @@ export function SelectSpacesModal({ ) } - return result.sort((a, b) => { - const aSelected = localSelection.includes(a.containerTag) - const bSelected = localSelection.includes(b.containerTag) - if (aSelected && !bSelected) return -1 - if (!aSelected && bSelected) return 1 - return 0 - }) - }, [projects, searchQuery, localSelection]) + return result + }, [projects, searchQuery]) return ( diff --git a/apps/web/components/settings/connections-mcp.tsx b/apps/web/components/settings/connections-mcp.tsx index 12fafc45..9a5bbce0 100644 --- a/apps/web/components/settings/connections-mcp.tsx +++ b/apps/web/components/settings/connections-mcp.tsx @@ -10,11 +10,13 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query" import { Check, Plus, Trash2, Zap } from "lucide-react" import { useEffect, useState } from "react" import { toast } from "sonner" +import { useQueryState } from "nuqs" import type { ConnectionResponseSchema } from "@repo/validation/api" import type { z } from "zod" import { analytics } from "@/lib/analytics" import { ConnectAIModal } from "@/components/connect-ai-modal" import { AddDocumentModal } from "@/components/add-document" +import { addDocumentParam } from "@/lib/search-params" import { DEFAULT_PROJECT_ID } from "@lib/constants" import type { Project } from "@lib/types" @@ -333,7 +335,7 @@ function FeatureItem({ text }: { text: string }) { export default function ConnectionsMCP() { const queryClient = useQueryClient() const autumn = useCustomer() - const [isAddDocumentOpen, setIsAddDocumentOpen] = useState(false) + const [addDoc, setAddDoc] = useQueryState("add", addDocumentParam) const [mcpModalOpen, setMcpModalOpen] = useState(false) const projects = (queryClient.getQueryData(["projects"]) || @@ -510,7 +512,7 @@ export default function ConnectionsMCP() {
setIsAddDocumentOpen(true)} + onClick={() => setAddDoc("connect")} disabled={!hasProProduct || !canAddConnection} > @@ -559,9 +561,8 @@ export default function ConnectionsMCP() { {/* Add Document Modal */} setIsAddDocumentOpen(false)} - defaultTab="connect" + isOpen={addDoc !== null} + onClose={() => setAddDoc(null)} />
)