Keep/keep-notes/components/demo-mode-toggle.tsx
sepehr 7fb486c9a4 feat: Complete internationalization and code cleanup
## Translation Files
- Add 11 new language files (es, de, pt, ru, zh, ja, ko, ar, hi, nl, pl)
- Add 100+ missing translation keys across all 15 languages
- New sections: notebook, pagination, ai.batchOrganization, ai.autoLabels
- Update nav section with workspace, quickAccess, myLibrary keys

## Component Updates
- Update 15+ components to use translation keys instead of hardcoded text
- Components: notebook dialogs, sidebar, header, note-input, ghost-tags, etc.
- Replace 80+ hardcoded English/French strings with t() calls
- Ensure consistent UI across all supported languages

## Code Quality
- Remove 77+ console.log statements from codebase
- Clean up API routes, components, hooks, and services
- Keep only essential error handling (no debugging logs)

## UI/UX Improvements
- Update Keep logo to yellow post-it style (from-yellow-400 to-amber-500)
- Change selection colors to #FEF3C6 (notebooks) and #EFB162 (nav items)
- Make "+" button permanently visible in notebooks section
- Fix grammar and syntax errors in multiple components

## Bug Fixes
- Fix JSON syntax errors in it.json, nl.json, pl.json, zh.json
- Fix syntax errors in notebook-suggestion-toast.tsx
- Fix syntax errors in use-auto-tagging.ts
- Fix syntax errors in paragraph-refactor.service.ts
- Fix duplicate "fusion" section in nl.json

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Ou une version plus courte si vous préférez :

feat(i18n): Add 15 languages, remove logs, update UI components

- Create 11 new translation files (es, de, pt, ru, zh, ja, ko, ar, hi, nl, pl)
- Add 100+ translation keys: notebook, pagination, AI features
- Update 15+ components to use translations (80+ strings)
- Remove 77+ console.log statements from codebase
- Fix JSON syntax errors in 4 translation files
- Fix component syntax errors (toast, hooks, services)
- Update logo to yellow post-it style
- Change selection colors (#FEF3C6, #EFB162)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-11 22:26:13 +01:00

111 lines
4.1 KiB
TypeScript

'use client'
import { useState } from 'react'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Switch } from '@/components/ui/switch'
import { FlaskConical, Zap, Target, Lightbulb } from 'lucide-react'
import { toast } from 'sonner'
import { useLanguage } from '@/lib/i18n'
interface DemoModeToggleProps {
demoMode: boolean
onToggle: (enabled: boolean) => Promise<void>
}
export function DemoModeToggle({ demoMode, onToggle }: DemoModeToggleProps) {
const [isPending, setIsPending] = useState(false)
const { t } = useLanguage()
const handleToggle = async (checked: boolean) => {
setIsPending(true)
try {
await onToggle(checked)
if (checked) {
toast.success('🧪 Demo Mode activated! Memory Echo will now work instantly.')
} else {
toast.success('Demo Mode disabled. Normal parameters restored.')
}
} catch (error) {
console.error('Error toggling demo mode:', error)
toast.error('Failed to toggle demo mode')
} finally {
setIsPending(false)
}
}
return (
<Card className={`border-2 transition-all ${
demoMode
? 'border-amber-300 bg-gradient-to-br from-amber-50 to-white dark:from-amber-950/30 dark:to-background'
: 'border-amber-100 dark:border-amber-900/30'
}`}>
<CardHeader className="pb-3">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<div className={`p-2 rounded-full transition-colors ${
demoMode
? 'bg-amber-200 dark:bg-amber-900/50'
: 'bg-gray-100 dark:bg-gray-800'
}`}>
<FlaskConical className={`h-5 w-5 ${
demoMode ? 'text-amber-600 dark:text-amber-400' : 'text-gray-500'
}`} />
</div>
<div>
<CardTitle className="text-base flex items-center gap-2">
🧪 Demo Mode
{demoMode && <Zap className="h-4 w-4 text-amber-500 animate-pulse" />}
</CardTitle>
<CardDescription className="text-xs mt-1">
{demoMode
? 'Test Memory Echo instantly with relaxed parameters'
: 'Enable instant testing of Memory Echo feature'
}
</CardDescription>
</div>
</div>
<Switch
checked={demoMode}
onCheckedChange={handleToggle}
disabled={isPending}
className="data-[state=checked]:bg-amber-600"
/>
</div>
</CardHeader>
{demoMode && (
<CardContent className="pt-0 space-y-2">
<div className="rounded-lg bg-white dark:bg-zinc-900 border border-amber-200 dark:border-amber-900/30 p-3">
<p className="text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2">
Demo parameters active:
</p>
<div className="space-y-1.5 text-xs text-gray-600 dark:text-gray-400">
<div className="flex items-start gap-2">
<Target className="h-3.5 w-3.5 mt-0.5 text-amber-600 flex-shrink-0" />
<span>
<strong>50% similarity</strong> threshold (normally 75%)
</span>
</div>
<div className="flex items-start gap-2">
<Zap className="h-3.5 w-3.5 mt-0.5 text-amber-600 flex-shrink-0" />
<span>
<strong>0-day delay</strong> between notes (normally 7 days)
</span>
</div>
<div className="flex items-start gap-2">
<Lightbulb className="h-3.5 w-3.5 mt-0.5 text-amber-600 flex-shrink-0" />
<span>
<strong>Unlimited insights</strong> (no frequency limits)
</span>
</div>
</div>
</div>
<p className="text-xs text-amber-700 dark:text-amber-400 text-center">
💡 Create 2+ similar notes and see Memory Echo in action!
</p>
</CardContent>
)}
</Card>
)
}