supermemory/apps/web/lib/search-params.ts
MaheshtheDev 065fcf4ab5 fix: dashboard Notion/Google Drive suggestions open connect modal (#978)
The home dashboard suggestion cards routed Notion/Google Drive clicks through setViewMode("notion"|"google-drive"), but those values aren't in viewLiterals, so nuqs rejected them and silently fell back to the dashboard view — the click did nothing.

Route those two providers to the connect modal (setAddDoc("connect")), matching the Integrations 'Connections' card, and widen IntegrationParamValue to include them.
2026-05-20 03:37:49 +00:00

60 lines
1.6 KiB
TypeScript

import {
parseAsString,
parseAsBoolean,
parseAsStringLiteral,
parseAsArrayOf,
} from "nuqs"
// Modal states
export const addDocumentParam = parseAsStringLiteral([
"note",
"link",
"file",
"connect",
] as const)
export const mcpParam = parseAsBoolean.withDefault(false)
export const searchParam = parseAsBoolean.withDefault(false)
export const qParam = parseAsString.withDefault("")
export const docParam = parseAsString
export const fullscreenParam = parseAsBoolean.withDefault(false)
export const chatParam = parseAsBoolean
export const threadParam = parseAsString
export const shareParam = parseAsBoolean.withDefault(false)
export const feedbackParam = parseAsBoolean.withDefault(false)
// View & filter states
const viewLiterals = [
"dashboard",
"graph",
"list",
"integrations",
"chat",
// Integration sub-views — each card is its own view
"mcp",
"plugins",
"chrome",
"connections",
"shortcuts",
"raycast",
"import",
] as const
export type ViewParamValue = (typeof viewLiterals)[number]
export const viewParam =
parseAsStringLiteral(viewLiterals).withDefault("dashboard")
// Kept for backwards compat with components that pass integration hints.
// "notion"/"google-drive" are connection providers, not view modes — they open the connect modal.
export type IntegrationParamValue =
| "mcp"
| "plugins"
| "chrome"
| "connections"
| "shortcuts"
| "raycast"
| "import"
| "notion"
| "google-drive"
export const categoriesParam = parseAsArrayOf(parseAsString, ",").withDefault(
[],
)
export const projectParam = parseAsArrayOf(parseAsString, ",").withDefault([])