AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
Use Radix Collapsible in settings
yoma59e86b9c8465
diff --git a/apps/web/src/components/settings/AdvancedPlayCard.tsx b/apps/web/src/components/settings/AdvancedPlayCard.tsxindex 6f471d6c..89ea7d7e 100644--- a/apps/web/src/components/settings/AdvancedPlayCard.tsx+++ b/apps/web/src/components/settings/AdvancedPlayCard.tsx@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";import { ChevronDown, Copy, Sparkles } from "lucide-react";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";import { cn } from "@/lib/utils";import { copyTextToClipboard } from "./settings-utils";@@ -25,58 +26,55 @@ export const AdvancedPlayCard = () => {};return (- <Card className="w-full min-w-0 overflow-hidden shadow-none">- <CardHeader className="p-4">- <button- className="flex w-full min-w-0 items-start justify-between gap-3 text-left"- type="button"- aria-expanded={expanded}- onClick={() => setExpanded((current) => !current)}- >- <span className="min-w-0">- <CardTitle className="flex items-center gap-2 text-sm">- <Sparkles className="h-4 w-4 text-emerald-700" />- {t("advancedPlay.title")}- </CardTitle>- <CardDescription className="mt-1 text-xs leading-4">- {t("advancedPlay.description")}- </CardDescription>- </span>- <ChevronDown- className={cn(- "mt-0.5 h-4 w-4 shrink-0 text-slate-400 transition-transform",- expanded ? "rotate-180" : "rotate-0"- )}- />- </button>- </CardHeader>- {expanded && (- <CardContent className="grid gap-3 p-4 pt-0">- {ADVANCED_PROMPT_KEYS.map((key) => {- const title = t(`advancedPlay.prompts.${key}.title`);- const prompt = t(`advancedPlay.prompts.${key}.prompt`);+ <Collapsible open={expanded} onOpenChange={setExpanded} asChild>+ <Card className="w-full min-w-0 overflow-hidden shadow-none">+ <CardHeader className="p-4">+ <CollapsibleTrigger asChild>+ <button className="flex w-full min-w-0 items-start justify-between gap-3 text-left" type="button">+ <span className="min-w-0">+ <CardTitle className="flex items-center gap-2 text-sm">+ <Sparkles className="h-4 w-4 text-emerald-700" />+ {t("advancedPlay.title")}+ </CardTitle>+ <CardDescription className="mt-1 text-xs leading-4">{t("advancedPlay.description")}</CardDescription>+ </span>+ <ChevronDown+ className={cn(+ "mt-0.5 h-4 w-4 shrink-0 text-slate-400 transition-transform",+ expanded ? "rotate-180" : "rotate-0"+ )}+ />+ </button>+ </CollapsibleTrigger>+ </CardHeader>+ <CollapsibleContent asChild>+ <CardContent className="grid gap-3 p-4 pt-0">+ {ADVANCED_PROMPT_KEYS.map((key) => {+ const title = t(`advancedPlay.prompts.${key}.title`);+ const prompt = t(`advancedPlay.prompts.${key}.prompt`);- return (- <div key={key} className="rounded-lg border border-slate-200 bg-white p-3">- <div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">- <div className="text-sm font-bold text-slate-900">{title}</div>- <Button- size="sm"- variant="outline"- className="h-8 w-full justify-center bg-white px-3 text-xs sm:w-auto"- type="button"- onClick={() => void handleCopyPrompt(title, prompt)}- >- <Copy className="h-3.5 w-3.5" />- {copiedPrompt === title ? t("common.copied") : t("advancedPlay.copyPrompt")}- </Button>- </div>- <p className="mt-2 text-xs leading-5 text-slate-500">{prompt}</p>- </div>- );- })}- </CardContent>- )}- </Card>+ return (+ <div key={key} className="rounded-lg border border-slate-200 bg-white p-3">+ <div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">+ <div className="text-sm font-bold text-slate-900">{title}</div>+ <Button+ size="sm"+ variant="outline"+ className="h-8 w-full justify-center bg-white px-3 text-xs sm:w-auto"+ type="button"+ onClick={() => void handleCopyPrompt(title, prompt)}+ >+ <Copy className="h-3.5 w-3.5" />+ {copiedPrompt === title ? t("common.copied") : t("advancedPlay.copyPrompt")}+ </Button>+ </div>+ <p className="mt-2 text-xs leading-5 text-slate-500">{prompt}</p>+ </div>+ );+ })}+ </CardContent>+ </CollapsibleContent>+ </Card>+ </Collapsible>);};diff --git a/apps/web/src/components/settings/McpConfigCard.tsx b/apps/web/src/components/settings/McpConfigCard.tsxindex c75cd986..319c03a7 100644--- a/apps/web/src/components/settings/McpConfigCard.tsx+++ b/apps/web/src/components/settings/McpConfigCard.tsx@@ -6,6 +6,7 @@ import type { ApiToken } from "@edgeever/shared";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";import { Checkbox } from "@/components/ui/checkbox";+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { api } from "@/lib/api";@@ -151,58 +152,53 @@ const ScopePicker = ({ availableScopes, selectedScopes, onToggleScope }: ScopePiconst [expanded, setExpanded] = useState(false);return (- <div className="rounded-lg border border-slate-200 bg-white">- <button- className="flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-left"- type="button"- aria-expanded={expanded}- onClick={() => setExpanded((current) => !current)}- >- <span className="min-w-0">- <span className="block text-xs font-semibold text-slate-700">{t("mcp.scopeTitle")}</span>- <span className="mt-0.5 block text-[11px] font-medium text-slate-400">- {t("mcp.selectedScopes", { selected: selectedScopes.size, total: availableScopes.length })}+ <Collapsible className="rounded-lg border border-slate-200 bg-white" open={expanded} onOpenChange={setExpanded}>+ <CollapsibleTrigger asChild>+ <button className="flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-left" type="button">+ <span className="min-w-0">+ <span className="block text-xs font-semibold text-slate-700">{t("mcp.scopeTitle")}</span>+ <span className="mt-0.5 block text-[11px] font-medium text-slate-400">+ {t("mcp.selectedScopes", { selected: selectedScopes.size, total: availableScopes.length })}+ </span></span>- </span>- <ChevronDown- className={cn(- "h-4 w-4 shrink-0 text-slate-400 transition-transform",- expanded ? "rotate-180" : "rotate-0"- )}- />- </button>- {expanded && (- <div className="grid gap-2 border-t border-slate-100 p-3 sm:grid-cols-2">- {availableScopes.map((scope) => {- const checked = selectedScopes.has(scope);- const checkboxId = `token-scope-${scope.replace(/[^a-z0-9]+/gi, "-")}`;-- return (- <label- key={scope}- htmlFor={checkboxId}- className={cn(- "flex min-h-10 cursor-pointer items-center gap-3 rounded-lg border px-3 py-2 transition-colors",- checked- ? "border-emerald-500/30 bg-emerald-50/70 text-emerald-800"- : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50"- )}- >- <Checkbox- id={checkboxId}- checked={checked}- onCheckedChange={() => onToggleScope(scope)}- className="border-emerald-300"- />- <span className="min-w-0 truncate text-xs font-semibold" title={scope}>- {getTokenScopeLabel(scope, t)}- </span>- </label>- );- })}- </div>- )}- </div>+ <ChevronDown+ className={cn(+ "h-4 w-4 shrink-0 text-slate-400 transition-transform",+ expanded ? "rotate-180" : "rotate-0"+ )}+ />+ </button>+ </CollapsibleTrigger>+ <CollapsibleContent className="grid gap-2 border-t border-slate-100 p-3 sm:grid-cols-2">+ {availableScopes.map((scope) => {+ const checked = selectedScopes.has(scope);+ const checkboxId = `token-scope-${scope.replace(/[^a-z0-9]+/gi, "-")}`;++ return (+ <label+ key={scope}+ htmlFor={checkboxId}+ className={cn(+ "flex min-h-10 cursor-pointer items-center gap-3 rounded-lg border px-3 py-2 transition-colors",+ checked+ ? "border-emerald-500/30 bg-emerald-50/70 text-emerald-800"+ : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50"+ )}+ >+ <Checkbox+ id={checkboxId}+ checked={checked}+ onCheckedChange={() => onToggleScope(scope)}+ className="border-emerald-300"+ />+ <span className="min-w-0 truncate text-xs font-semibold" title={scope}>+ {getTokenScopeLabel(scope, t)}+ </span>+ </label>+ );+ })}+ </CollapsibleContent>+ </Collapsible>);};diff --git a/apps/web/src/components/settings/SystemInfoCard.tsx b/apps/web/src/components/settings/SystemInfoCard.tsxindex b9e055ed..2fac0721 100644--- a/apps/web/src/components/settings/SystemInfoCard.tsx+++ b/apps/web/src/components/settings/SystemInfoCard.tsx@@ -3,6 +3,7 @@ import { ChevronDown, Copy, Info } from "lucide-react";import { useTranslation } from "react-i18next";import { Button } from "@/components/ui/button";import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";import { cn } from "@/lib/utils";import { copyTextToClipboard } from "./settings-utils";@@ -97,60 +98,54 @@ export const SystemInfoCard = () => {};return (- <Card className="w-full min-w-0 overflow-hidden shadow-none">- <CardHeader className="p-4">- <button- className="flex w-full min-w-0 items-start justify-between gap-3 text-left"- type="button"- aria-expanded={expanded}- onClick={() => setExpanded((current) => !current)}- >- <span className="min-w-0">- <CardTitle className="flex items-center gap-2 text-sm">- <Info className="h-4 w-4 text-emerald-700" />- {t("systemInfo.title")}- </CardTitle>- <CardDescription className="mt-1 text-xs leading-4">- {t("systemInfo.description")}- </CardDescription>- </span>- <ChevronDown- className={cn(- "mt-0.5 h-4 w-4 shrink-0 text-slate-400 transition-transform",- expanded ? "rotate-180" : "rotate-0"- )}- />- </button>- </CardHeader>- {expanded && (- <CardContent className="grid gap-3 p-4 pt-0">- <div className="flex justify-end">- <Button- size="sm"- variant="outline"- className="h-8 w-full bg-white px-3 text-xs sm:w-auto"- type="button"- onClick={() => void handleCopy()}- >- <Copy className="h-3.5 w-3.5" />- {copied ? t("common.copied") : t("systemInfo.copy")}- </Button>- </div>- <div className="grid gap-2 sm:grid-cols-2">- {infoItems.map((item) => (- <div- key={item.label}- className="min-w-0 rounded-lg border border-slate-200 bg-white px-3 py-2.5"+ <Collapsible open={expanded} onOpenChange={setExpanded} asChild>+ <Card className="w-full min-w-0 overflow-hidden shadow-none">+ <CardHeader className="p-4">+ <CollapsibleTrigger asChild>+ <button className="flex w-full min-w-0 items-start justify-between gap-3 text-left" type="button">+ <span className="min-w-0">+ <CardTitle className="flex items-center gap-2 text-sm">+ <Info className="h-4 w-4 text-emerald-700" />+ {t("systemInfo.title")}+ </CardTitle>+ <CardDescription className="mt-1 text-xs leading-4">{t("systemInfo.description")}</CardDescription>+ </span>+ <ChevronDown+ className={cn(+ "mt-0.5 h-4 w-4 shrink-0 text-slate-400 transition-transform",+ expanded ? "rotate-180" : "rotate-0"+ )}+ />+ </button>+ </CollapsibleTrigger>+ </CardHeader>+ <CollapsibleContent asChild>+ <CardContent className="grid gap-3 p-4 pt-0">+ <div className="flex justify-end">+ <Button+ size="sm"+ variant="outline"+ className="h-8 w-full bg-white px-3 text-xs sm:w-auto"+ type="button"+ onClick={() => void handleCopy()}>- <div className="text-[11px] font-semibold uppercase text-slate-400">{item.label}</div>- <div className="mt-1 truncate font-mono text-xs font-semibold text-slate-800" title={item.value}>- {item.value}+ <Copy className="h-3.5 w-3.5" />+ {copied ? t("common.copied") : t("systemInfo.copy")}+ </Button>+ </div>+ <div className="grid gap-2 sm:grid-cols-2">+ {infoItems.map((item) => (+ <div key={item.label} className="min-w-0 rounded-lg border border-slate-200 bg-white px-3 py-2.5">+ <div className="text-[11px] font-semibold uppercase text-slate-400">{item.label}</div>+ <div className="mt-1 truncate font-mono text-xs font-semibold text-slate-800" title={item.value}>+ {item.value}+ </div></div>- </div>- ))}- </div>- </CardContent>- )}- </Card>+ ))}+ </div>+ </CardContent>+ </CollapsibleContent>+ </Card>+ </Collapsible>);};diff --git a/apps/web/src/components/ui/collapsible.tsx b/apps/web/src/components/ui/collapsible.tsxnew file mode 100644index 00000000..e3c95b00--- /dev/null+++ b/apps/web/src/components/ui/collapsible.tsx@@ -0,0 +1,7 @@+import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";++const Collapsible = CollapsiblePrimitive.Root;+const CollapsibleTrigger = CollapsiblePrimitive.Trigger;+const CollapsibleContent = CollapsiblePrimitive.Content;++export { Collapsible, CollapsibleTrigger, CollapsibleContent };diff --git a/bun.lock b/bun.lockindex 0354d836..56c64fb8 100644--- a/bun.lock+++ b/bun.lock@@ -8,6 +8,7 @@"@edgeever/shared": "workspace:*","@hono/zod-validator": "latest","@radix-ui/react-checkbox": "^1.3.5",+ "@radix-ui/react-collapsible": "^1.1.15","@radix-ui/react-context-menu": "^2.3.1","@radix-ui/react-dialog": "^1.1.17","@radix-ui/react-dropdown-menu": "^2.1.18",@@ -549,6 +550,8 @@"@radix-ui/react-checkbox": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-presence": "1.1.6", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-use-controllable-state": "1.2.3", "@radix-ui/react-use-previous": "1.1.2", "@radix-ui/react-use-size": "1.1.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-pREzrmNnVwGvYaBoM64huTRK7B3lrTRuwj8A9nwhPiEtMb+yudiWh6zWAqEtP0Dzd5+iBa1Ki7V1pCxV8ExMdA=="],+ "@radix-ui/react-collapsible": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.4", "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-id": "1.1.2", "@radix-ui/react-presence": "1.1.6", "@radix-ui/react-primitive": "2.1.7", "@radix-ui/react-use-controllable-state": "1.2.3", "@radix-ui/react-use-layout-effect": "1.1.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-8A1zibu5skAQ+UVbaeNH5hVMibiFCRJzgMuM14LTWGttnTZKQL9jwYnhAbHRuxrtCqPXa4JvvnVUq1pTNgyZYw=="],+"@radix-ui/react-collection": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.3", "@radix-ui/react-context": "1.1.4", "@radix-ui/react-primitive": "2.1.6", "@radix-ui/react-slot": "1.3.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-IVVz4EvBcKjrzKgof714qDnz/SzQAkLA2Emh5edlHbgcE6fNd3Un6CJLlaYcnm8N4JmAtzQgse4dOKxcD2yc9g=="],"@radix-ui/react-compose-refs": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-rYOP8OMnuuPMQF1uhPVlGNcCDlkokKqGFE3JcxFViIkAXP7EvFWUliJAstrapypaBLJNHbZL6jGhbVDGTwmVhA=="],@@ -2317,6 +2320,8 @@"@poppinss/colors/kleur": ["[email protected]", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],+ "@radix-ui/react-collapsible/@radix-ui/react-primitive": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-slot": "1.3.0" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-bC3NiwsprbxKjuon9l7X6BUTw7FPVzEYaL92MPEY5SCd/9hUTPXVFtVwRix7778wtRsVao+zE062gL79FZleeQ=="],+"@rollup/pluginutils/estree-walker": ["[email protected]", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],"@shikijs/primitive/@shikijs/types": ["@shikijs/[email protected]", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-oc8b9U2SYvofKZk8e/737nIX0qwf6eV2vHFATeObAu7r+mUVpLs8Re0BmVkIjAWAYgkmG/CzLNo7rzuBzRu/wQ=="],diff --git a/package.json b/package.jsonindex 413f3051..f6588c47 100644--- a/package.json+++ b/package.json@@ -45,6 +45,7 @@"@edgeever/shared": "workspace:*","@hono/zod-validator": "latest","@radix-ui/react-checkbox": "^1.3.5",+ "@radix-ui/react-collapsible": "^1.1.15","@radix-ui/react-context-menu": "^2.3.1","@radix-ui/react-dialog": "^1.1.17","@radix-ui/react-dropdown-menu": "^2.1.18",