"use client"; import { useState } from "react"; import { Download, Trash2, AlertTriangle } from "lucide-react"; import { useChatStore } from "@/lib/store"; import { SettingRow, SectionHeader, Toggle } from "./SettingRow"; import { cn } from "@/lib/utils"; export function DataSettings() { const { settings, updateSettings, conversations, deleteConversation } = useChatStore(); const [showClearConfirm, setShowClearConfirm] = useState(false); function exportConversations(format: "json" | "markdown") { let content: string; let filename: string; const ts = new Date().toISOString().split("T")[0]; if (format === "json") { content = JSON.stringify(conversations, null, 2); filename = `claude-code-conversations-${ts}.json`; } else { content = conversations .map((conv) => { const messages = conv.messages .map((m) => { const role = m.role === "user" ? "**You**" : "**Claude**"; const text = typeof m.content === "string" ? m.content : m.content .filter((b) => b.type === "text") .map((b) => (b as { type: "text"; text: string }).text) .join("\n"); return `${role}\n\n${text}`; }) .join("\n\n---\n\n"); return `# ${conv.title}\n\n${messages}`; }) .join("\n\n====\n\n"); filename = `claude-code-conversations-${ts}.md`; } const blob = new Blob([content], { type: "text/plain" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = filename; a.click(); URL.revokeObjectURL(url); } function clearAllConversations() { const ids = conversations.map((c) => c.id); ids.forEach((id) => deleteConversation(id)); setShowClearConfirm(false); } const totalMessages = conversations.reduce((sum, c) => sum + c.messages.length, 0); return (
{showClearConfirm ? (
Are you sure?
) : ( )}
updateSettings({ telemetryEnabled: v })} />

All data is stored locally in your browser. Claude Code does not send conversation data to any server unless explicitly configured.

); }