Spaces:
Running
Running
Commit ·
0dcbaee
1
Parent(s): b1dd449
feat: new landing, template system, auto-layout, Free/Plus plans; remove AI and hide habits
Browse files- Remove AI assistant UI (chat overlay, AI goal generation, AI toolbar button)
- Plans: Free/Plus with shared limits config (src/config/plans.js), new subscription page
- Hide habits: habit nodes hidden on the canvas (kept in data), sidebar item and /habits route removed
- Template system: built-in starters laid out automatically, template gallery with
previews, search and categories, save board or selection as template, insert into any board
- One-click auto-layout (toolbar, context menu, Shift+L) powered by dagre, animated
- New landing page with motion animations and an honest feature/roadmap description
- en/uk translations for the new UI; health ping instead of the public user list
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Files changed (32)
- package-lock.json+19
- package.json+1
- src/App.jsx+3-8
- src/components/Sidebar.jsx+17-13
- src/config/plans.jsAdded+20
- src/context/AuthContext.jsx+1-1
- src/features/canvas/components/AIHintOverlay.jsxDeleted-428
- src/features/canvas/components/CanvasToolbar.jsx+28-36
- src/features/canvas/components/PaywallModal.jsx+5-4
- src/features/canvas/components/nodes/SketchNode.jsx+2-2
- src/features/canvas/hooks/useCanvasLogic.js+191-284
- src/features/canvas/layout.jsAdded+143
- src/features/dashboard/hooks/useDashboardLogic.js+14-38
- src/features/landing/HeroBoardDemo.jsxAdded+243
- src/features/landing/components/AIFeatureSection.jsxDeleted-76
- src/features/landing/components/HeroSection.jsxDeleted-130
- src/features/landing/components/PricingSection.jsxDeleted-105
- src/features/landing/landingCopy.jsAdded+199
- src/features/templates/SaveTemplateModal.jsxAdded+146
- src/features/templates/TemplateGallery.jsxAdded+322
- src/features/templates/TemplatePreview.jsxAdded+105
- src/features/templates/builtinTemplates.jsAdded+174
- src/features/templates/templatesApi.jsAdded+121
- src/layouts/Layout.jsx+37-19
- src/locales/en.json+541-466
- src/locales/uk.json+541-466
- src/pages/CanvasPage.jsx+93-171
- src/pages/DashboardPage.jsx+16-427
- src/pages/LandingPage.jsx+343-616
- src/pages/OnboardingPage.jsx+8-8
- src/pages/SettingsPage.jsx-6
- src/pages/SubscriptionPage.jsx+92-134
7 unmodified lines8910111213286 unmodified lines3003013023033043057 unmodified lines"name": "flowweb","version": "0.0.0","dependencies": {"@microsoft/signalr": "^10.0.0","@react-oauth/google": "^0.13.5","@xyflow/react": "^12.10.2",286 unmodified lines"node": ">=6.9.0"}},"node_modules/@emnapi/core": {"version": "1.10.0","resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",7 unmodified lines891011121314286 unmodified lines3013023033043053063073083093103113123133143153163173183193203213223233247 unmodified lines"name": "flowweb","version": "0.0.0","dependencies": {"@dagrejs/dagre": "^1.1.8","@microsoft/signalr": "^10.0.0","@react-oauth/google": "^0.13.5","@xyflow/react": "^12.10.2",286 unmodified lines"node": ">=6.9.0"}},"node_modules/@dagrejs/dagre": {"version": "1.1.8","resolved": "https://registry.npmjs.org/@dagrejs/dagre/-/dagre-1.1.8.tgz","integrity": "sha512-5SEDlndt4W/LaVzPYJW+bSmSEZc9EzTf8rJ20WCKvjS5EAZAN0b+x0Yww7VMT4R3Wootkg+X9bUfUxazYw6Blw==","license": "MIT","dependencies": {"@dagrejs/graphlib": "2.2.4"}},"node_modules/@dagrejs/graphlib": {"version": "2.2.4","resolved": "https://registry.npmjs.org/@dagrejs/graphlib/-/graphlib-2.2.4.tgz","integrity": "sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==","license": "MIT","engines": {"node": ">17.0.0"}},"node_modules/@emnapi/core": {"version": "1.10.0","resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
9 unmodified lines1011121314159 unmodified lines"preview": "vite preview"},"dependencies": {"@microsoft/signalr": "^10.0.0","@react-oauth/google": "^0.13.5","@xyflow/react": "^12.10.2",9 unmodified lines101112131415169 unmodified lines"preview": "vite preview"},"dependencies": {"@dagrejs/dagre": "^1.1.8","@microsoft/signalr": "^10.0.0","@react-oauth/google": "^0.13.5","@xyflow/react": "^12.10.2",
123451 unmodified line7891011121313 unmodified lines272829303132331 unmodified line353637383940414243import React from 'react';import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';import Layout from './layouts/Layout';import LandingPage from './pages/LandingPage';import AuthPage from './pages/AuthPage';1 unmodified lineimport DashboardPage from './pages/DashboardPage';import ProfilePage from './pages/ProfilePage';import CanvasPage from './pages/CanvasPage';import HabitTrackerPage from './pages/HabitTrackerPage';import SubscriptionPage from './pages/SubscriptionPage';import SettingsPage from './pages/SettingsPage';import ClaimPage from './pages/ClaimPage';13 unmodified lines<Route path="/profile" element={<ProfilePage />} /><Route path="/canvas" element={<CanvasPage />} /><Route path="/canvas/:id" element={<CanvasPage />} /><Route path="/habits" element={<HabitTrackerPage />} /><Route path="/subscription" element={<SubscriptionPage />} /><Route path="/settings" element={<SettingsPage />} /></Routes>1 unmodified line);}export default App;123451 unmodified line78910111213 unmodified lines26272829303132331 unmodified line35363738import React from 'react';import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';import Layout from './layouts/Layout';import LandingPage from './pages/LandingPage';import AuthPage from './pages/AuthPage';1 unmodified lineimport DashboardPage from './pages/DashboardPage';import ProfilePage from './pages/ProfilePage';import CanvasPage from './pages/CanvasPage';import SubscriptionPage from './pages/SubscriptionPage';import SettingsPage from './pages/SettingsPage';import ClaimPage from './pages/ClaimPage';13 unmodified lines<Route path="/profile" element={<ProfilePage />} /><Route path="/canvas" element={<CanvasPage />} /><Route path="/canvas/:id" element={<CanvasPage />} />{/* Habit tracker is hidden until habits get their own space (see ROADMAP.md) */}<Route path="/habits" element={<Navigate to="/dashboard" replace />} /><Route path="/subscription" element={<SubscriptionPage />} /><Route path="/settings" element={<SettingsPage />} /></Routes>1 unmodified line);}export default App;
1234567891011121336 unmodified lines5051525354553 unmodified lines59606162636415 unmodified lines8081828384858628 unmodified lines115116117118119120121122123124125126127128129130131132133134135136137138139140import React, { useState, useEffect } from 'react';import axios from 'axios';import { motion } from 'framer-motion';import { useNavigate, useLocation } from 'react-router-dom';import { useAuth } from '../context/AuthContext';import { useTranslation } from 'react-i18next';import {LayoutDashboard,PenTool,Calendar,Trophy,Settings,LogOut,36 unmodified linesreturn stored ? parseInt(stored, 10) : 0;});useEffect(() => {if (!user) return;const fetchProjectCount = async () => {3 unmodified linesif (Array.isArray(res.data)) {const count = res.data.length;setProjectCount(count);cachedProjectCount = count;localStorage.setItem('tf_project_count', count.toString());}15 unmodified linesconst menuItems = [{ icon: LayoutDashboard, labelKey: 'projects', path: '/dashboard' },{ icon: PenTool, labelKey: 'canvas', path: '/canvas' },{ icon: Calendar, labelKey: 'habits', path: '/habits' },{ icon: User, labelKey: 'profile', path: '/profile' },{ icon: Settings, labelKey: 'settings', path: '/settings' },];28 unmodified lines<div className="flex flex-col gap-1"><div className="flex items-center justify-between"><span className="font-accent-note text-2xl text-secondary">{user?.subscriptionTier === 'Ultra' ? 'Ultra' : user?.subscriptionTier === 'Pro' ? 'Pro' : t('sidebar.free_plan')}</span>{(!user?.subscriptionTier || user?.subscriptionTier === 'Free') && (<span className="text-xs font-bold text-primary">{projectCount}/3 Slots</span>)}</div><p className="text-[10px] text-on-surface-variant/70 font-semibold tracking-wide uppercase mt-1">{user?.subscriptionTier === 'Ultra'? t('sidebar.ultra_active', 'All Limits Unlocked'): user?.subscriptionTier === 'Pro'? t('sidebar.pro_active', 'AI: {{count}}/200 daily', { count: user?.dailyAiGenerationsCount || 0 }): t('sidebar.free_active', 'AI: {{count}}/3 daily', { count: user?.dailyAiGenerationsCount || 0 })}</p></div>{user?.subscriptionTier !== 'Ultra' && (<buttononClick={() => navigate('/subscription')}className="w-full py-2 bg-primary text-on-primary text-sm font-bold rounded-lg hover:bg-secondary hover:text-primary transition-all cursor-pointer">{user?.subscriptionTier === 'Pro' ? t('sidebar.go_ultra', 'Go Ultra') : t('sidebar.upgrade_now')}</button>)}</div>1234567891011121336 unmodified lines5051525354555657583 unmodified lines6263646566676815 unmodified lines8485868788899028 unmodified lines119120121122123124125126127128129130131132133134135136137138139140141142143144import React, { useState, useEffect } from 'react';import axios from 'axios';import { motion } from 'framer-motion';import { useNavigate, useLocation } from 'react-router-dom';import { useAuth } from '../context/AuthContext';import { useTranslation } from 'react-i18next';import { FREE_LIMITS, isPlus } from '../config/plans';import {LayoutDashboard,PenTool,Trophy,Settings,LogOut,36 unmodified linesreturn stored ? parseInt(stored, 10) : 0;});const [ownedCount, setOwnedCount] = useState(0);const userIsPlus = isPlus(user);useEffect(() => {if (!user) return;const fetchProjectCount = async () => {3 unmodified linesif (Array.isArray(res.data)) {const count = res.data.length;setProjectCount(count);setOwnedCount(res.data.filter(p => !p.isShared).length);cachedProjectCount = count;localStorage.setItem('tf_project_count', count.toString());}15 unmodified linesconst menuItems = [{ icon: LayoutDashboard, labelKey: 'projects', path: '/dashboard' },{ icon: PenTool, labelKey: 'canvas', path: '/canvas' },// Habits are hidden until they get their own space (see ROADMAP.md){ icon: User, labelKey: 'profile', path: '/profile' },{ icon: Settings, labelKey: 'settings', path: '/settings' },];28 unmodified lines<div className="flex flex-col gap-1"><div className="flex items-center justify-between"><span className="font-accent-note text-2xl text-secondary">{userIsPlus ? 'Plus' : 'Free'}</span>{!userIsPlus && (<span className="text-xs font-bold text-primary">{t('sidebar.boards_used', { used: ownedCount, max: FREE_LIMITS.boards, defaultValue: `${ownedCount}/${FREE_LIMITS.boards} boards` })}</span>)}</div><p className="text-[10px] text-on-surface-variant/70 font-semibold tracking-wide uppercase mt-1">{userIsPlus? t('sidebar.plus_active', 'No limits'): t('sidebar.free_limits', { nodes: FREE_LIMITS.nodesPerBoard, defaultValue: `Up to ${FREE_LIMITS.nodesPerBoard} nodes per board` })}</p></div>{!userIsPlus && (<buttononClick={() => navigate('/subscription')}className="w-full py-2 bg-primary text-on-primary text-sm font-bold rounded-lg hover:bg-secondary hover:text-primary transition-all cursor-pointer">{t('sidebar.get_plus', 'Get Plus')}</button>)}</div>
1234567891011121314151617181920// Subscription plans. Mirrors FlowAPI.Application/Services/Plans.cs — keep both in sync.export const PLAN_FREE = 'Free';export const PLAN_PLUS = 'Plus';
export const PLUS_PRICE_USD = 10;
export const FREE_LIMITS = { boards: 5, nodesPerBoard: 300, guestsPerBoard: 2, templates: 3,};
// Legacy tiers ("Pro", "Ultra") are treated as Plus.export const normalizePlan = (tier) => !tier || String(tier).trim().toLowerCase() === 'free' ? PLAN_FREE : PLAN_PLUS;
export const isPlus = (user) => normalizePlan(user?.subscriptionTier) === PLAN_PLUS;
export const limitFor = (user, key) => (isPlus(user) ? Infinity : FREE_LIMITS[key]);12 unmodified lines1314151617181912 unmodified lines// Keep HF Space alive — ping every 25 minutes to prevent sleepinguseEffect(() => {const ping = () => axios.get(`${API_URL}/users`).catch(() => {});ping(); // initial ping on loadconst interval = setInterval(ping, 25 * 60 * 1000);return () => clearInterval(interval);12 unmodified lines1314151617181912 unmodified lines// Keep HF Space alive — ping every 25 minutes to prevent sleepinguseEffect(() => {const ping = () => axios.get(`${API_URL}/health`).catch(() => {});ping(); // initial ping on loadconst interval = setInterval(ping, 25 * 60 * 1000);return () => clearInterval(interval);
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428import React, { useState, useEffect, useRef } from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import { Sparkles, X, Send, Lightbulb, Compass, Award, AlertCircle, Pencil, Loader2 } from 'lucide-react';
const AIHintOverlay = ({ isAIActive, setIsAIActive, aiLoading, submitAICanvasPrompt, chatMessages = [], setChatMessages, chatThreads = [], activeThreadId = 'default', setActiveThreadId, createNewThread, deleteThread, renameThread}) => { const { t } = useTranslation(); const [prompt, setPrompt] = useState(''); const [loadingStepIndex, setLoadingStepIndex] = useState(0); const [isEditingThreadTitle, setIsEditingThreadTitle] = useState(false); const [editTitleVal, setEditTitleVal] = useState(''); const messagesEndRef = useRef(null);
const activeThread = chatThreads.find(t => t.id === activeThreadId) || chatThreads[0] || { title: '' };
const handleStartRename = () => { setEditTitleVal(activeThread.title); setIsEditingThreadTitle(true); };
const handleFinishRename = () => { if (editTitleVal.trim()) { renameThread(activeThreadId, editTitleVal.trim()); } setIsEditingThreadTitle(false); };
const loadingSteps = [ "Гостримо графітові олівці...", "Відкриваємо чистий пергамент...", "Калібруємо творчий компас...", "Консультуємось з цифровим оракулом...", "Малюємо контури вузлів...", "Накладаємо зв'язки...", "Задуваємо свіже чорнило..." ];
const suggestions = [ { text: t('canvas.ai_suggest_details', 'Розпиши поточний крок на підзадачі'), icon: <Lightbulb size={14} className="text-amber-600" />, tag: t('canvas.ai_suggest_details_tag', 'Деталізація') }, { text: t('canvas.ai_suggest_route', 'Запропонуй альтернативний шлях на випадок сбою'), icon: <Compass size={14} className="text-emerald-600" />, tag: t('canvas.ai_suggest_route_tag', 'Альтернатива') }, { text: t('canvas.ai_suggest_habits', 'Створи щоденні звички для підкріплення цієї цілі'), icon: <Award size={14} className="text-indigo-600" />, tag: t('canvas.ai_suggest_habits_tag', 'Звички') } ];
useEffect(() => { let interval; if (aiLoading) { setLoadingStepIndex(0); interval = setInterval(() => { setLoadingStepIndex((prev) => (prev + 1) % loadingSteps.length); }, 3000); } return () => clearInterval(interval); }, [aiLoading]);
// Auto scroll to bottom useEffect(() => { if (isAIActive) { const timer = setTimeout(() => { messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, 100); return () => clearTimeout(timer); } }, [chatMessages, aiLoading, isAIActive, activeThreadId]);
const handleSubmit = async (e) => { if (e) e.preventDefault(); if (!prompt.trim() || aiLoading) return; const promptToSend = prompt; setPrompt(''); await submitAICanvasPrompt(promptToSend); };
const handleKeyDown = (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSubmit(); } };
const parseInlineMarkdown = (text) => { const parts = []; let remaining = text; const boldRegex = /\*\*([^*]+)\*\*/g; let match; let lastIndex = 0; while ((match = boldRegex.exec(text)) !== null) { const textBefore = text.substring(lastIndex, match.index); if (textBefore) parts.push(textBefore); parts.push(<strong key={match.index} className="font-extrabold text-primary">{match[1]}</strong>); lastIndex = boldRegex.lastIndex; } const textAfter = text.substring(lastIndex); if (textAfter) parts.push(textAfter); return parts.length > 0 ? parts : text; };
const renderMarkdown = (text) => { if (!text) return null; return text.split('\n').map((line, idx) => { const cleanLine = line.trim(); if (!cleanLine) return <div key={idx} className="h-2" />; const listMatch = cleanLine.match(/^[\*\-\u2022]\s+(.*)/); if (listMatch) { return ( <li key={idx} className="ml-4 list-disc pl-1 text-sm text-primary/80 font-body my-1"> {parseInlineMarkdown(listMatch[1])} </li> ); } const numListMatch = cleanLine.match(/^\d+\.\s+(.*)/); if (numListMatch) { return ( <li key={idx} className="ml-4 list-decimal pl-1 text-sm text-primary/80 font-body my-1"> {parseInlineMarkdown(numListMatch[1])} </li> ); }
const headingMatch = cleanLine.match(/^(#{1,6})\s+(.*)/); if (headingMatch) { const level = headingMatch[1].length; const headingText = headingMatch[2]; const classes = level === 1 ? "text-xl font-bold font-display mt-3 mb-1.5" : level === 2 ? "text-lg font-bold font-display mt-2.5 mb-1.5" : "text-base font-bold font-display mt-2 mb-1"; return <div key={idx} className={`${classes} text-primary`}>{parseInlineMarkdown(headingText)}</div>; } return ( <p key={idx} className="text-sm text-primary/85 font-body leading-relaxed mb-1.5 break-words"> {parseInlineMarkdown(cleanLine)} </p> ); }); };
return ( <AnimatePresence> {isAIActive && ( <> {/* Backdrop overlay (no blur) */} <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} onClick={() => !aiLoading && setIsAIActive(false)} className="fixed inset-0 bg-primary/20 z-40 cursor-pointer" />
{/* Sketchbook Parchment Drawer */} <motion.div initial={{ x: '100%', opacity: 0.9 }} animate={{ x: 0, opacity: 1 }} exit={{ x: '100%', opacity: 0.9 }} transition={{ type: 'spring', damping: 25, stiffness: 150 }} className="fixed top-0 right-0 h-full w-[460px] max-w-full bg-[#fdfbf7] border-l-4 border-primary z-50 shadow-2xl flex flex-col overflow-hidden" > {/* Spiral binding rings style visualization on the left edge */} <div className="absolute left-0 top-0 bottom-0 w-3 flex flex-col justify-around py-8 pointer-events-none z-10"> {[...Array(12)].map((_, i) => ( <div key={i} className="w-6 h-3 bg-gradient-to-r from-stone-400 to-stone-600 rounded-full border border-stone-800 -ml-3 shadow-md" /> ))} </div>
{/* Notebook Margin Line */} <div className="absolute left-10 top-0 bottom-0 w-[2px] bg-red-400/40 pointer-events-none" />
{/* Notebook Paper Lines Pattern */} <div className="absolute inset-0 opacity-[0.03] pointer-events-none" style={{ backgroundImage: 'linear-gradient(#000 1px, transparent 1px)', backgroundSize: '100% 28px' }} />
{/* Content Container */} <div className="flex-grow flex flex-col pl-14 pr-6 py-6 overflow-hidden relative z-0"> {/* Header */} <div className="flex items-start justify-between mb-4 border-b-2 border-primary/10 pb-4"> <div> <div className="flex items-center gap-2 mb-1"> <Sparkles className="text-amber-500 animate-pulse" size={20} /> <span className="font-accent-note text-amber-600 font-bold uppercase tracking-wider text-xs">TaskFlow AI</span> </div> <h2 className="font-display text-2xl text-primary leading-none"> {t('canvas.ai_roadmap_strategist', 'Roadmap Strategist')} </h2> </div> <button onClick={() => !aiLoading && setIsAIActive(false)} disabled={aiLoading} className="p-1.5 border-2 border-primary/20 hover:border-primary rounded-xl transition-all hover:scale-105 cursor-pointer disabled:opacity-50" > <X size={18} className="text-primary/70" /> </button> </div>
{/* Thread Selector Section */} <div className="flex items-center justify-between gap-2 mb-3 bg-[#f5efe0]/30 border-2 border-primary/10 p-2 rounded-xl relative"> <div className="flex-1 flex items-center gap-2 overflow-hidden"> {isEditingThreadTitle ? ( <input type="text" value={editTitleVal} onChange={(e) => setEditTitleVal(e.target.value)} onBlur={handleFinishRename} onKeyDown={(e) => { if (e.key === 'Enter') handleFinishRename(); if (e.key === 'Escape') setIsEditingThreadTitle(false); }} autoFocus className="flex-grow bg-transparent text-sm font-bold text-primary border-b-2 border-primary outline-none py-0.5 px-1 font-display" /> ) : ( <div className="flex-grow relative flex items-center overflow-hidden"> <select value={activeThreadId} onChange={(e) => setActiveThreadId(e.target.value)} className="w-full bg-[#faf7f2] border-2 border-primary/30 rounded-lg py-1 pl-2 pr-6 text-xs font-bold text-primary focus:border-primary outline-none cursor-pointer appearance-none font-display" > {chatThreads.map(thread => ( <option key={thread.id} value={thread.id}> {thread.title} </option> ))} </select> <span className="absolute right-2 pointer-events-none text-primary/60 text-[10px]">▼</span> </div> )} </div>
<div className="flex items-center gap-1.5"> {!isEditingThreadTitle && ( <button onClick={handleStartRename} title={t('canvas.ai_rename_title', 'Перейменувати чат')} className="p-1.5 border-2 border-primary/10 hover:border-primary/40 rounded-lg hover:bg-[#faf7f2] transition-all cursor-pointer flex items-center justify-center" > <Pencil size={12} className="text-primary/70" /> </button> )} <button onClick={() => { const newId = createNewThread(); // Start renaming the new thread immediately setActiveThreadId(newId); setEditTitleVal(`Чат ${chatThreads.length + 1}`); setIsEditingThreadTitle(true); }} title={t('canvas.ai_new_chat', 'Новий')} className="h-[28px] border-2 border-primary/30 hover:border-primary rounded-lg bg-[#faf7f2] hover:bg-primary/5 px-2 text-[11px] font-bold text-primary transition-all cursor-pointer flex items-center gap-1 shadow-[1px_1px_0px_0px_rgba(0,0,0,0.1)] active:translate-y-[1px]" > <span>+ {t('canvas.ai_new_chat', 'Новий')}</span> </button>
<button onClick={() => { if (window.confirm(t('canvas.ai_delete_confirm', "Ви впевнені, що хочете видалити цей чат?"))) { deleteThread(activeThreadId); } }} title={t('canvas.ai_delete_title', 'Видалити чат')} disabled={chatThreads.length <= 1} className="p-1.5 border-2 border-red-200 hover:border-red-400 rounded-lg hover:bg-red-50 transition-all cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed flex items-center justify-center" > <X size={12} className="text-red-600" /> </button> </div> </div>
{/* Chat Message Area */} <div className="flex-1 overflow-y-auto pr-2 mb-4 space-y-4 scrollbar-hide"> {chatMessages.map((msg) => ( <div key={msg.id} className={`flex flex-col ${msg.sender === 'user' ? 'items-end' : 'items-start'}`} > <div className={`max-w-[90%] p-3.5 rounded-2xl shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)] border-2 ${ msg.sender === 'user' ? 'bg-[#eef5fc] border-blue-500/30 text-primary rounded-tr-none rotate-[0.5deg]' : msg.isError ? 'bg-red-50 border-red-500/30 text-red-700 rounded-tl-none rotate-[-0.5deg]' : 'bg-[#faf7f2] border-primary/20 text-primary rounded-tl-none rotate-[-0.5deg]' }`} > {msg.sender === 'user' ? ( <p className="text-sm font-body leading-relaxed whitespace-pre-wrap">{msg.text}</p> ) : ( <div className="space-y-1"> {renderMarkdown(msg.text)} </div> )} </div> {/* Timestamp */} <span className="text-[9px] font-extrabold text-primary/40 uppercase tracking-widest mt-1.5 px-2"> {msg.sender === 'user' ? 'Ви' : 'Стратег'} </span> </div> ))}
{/* Loading state showing pencil sketching & steps */} {aiLoading && ( <div className="flex flex-col items-start animate-pulse"> <div className="max-w-[90%] p-4 bg-[#faf7f2] border-2 border-primary/20 rounded-2xl rounded-tl-none shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)] flex flex-col gap-3"> <div className="flex items-center gap-3"> {/* Pencil writing micro-animation */} <motion.div animate={{ x: [0, 8, -8, 6, 0], y: [0, -5, 8, -4, 0], rotate: [0, 15, -15, 10, 0] }} transition={{ duration: 2, repeat: Infinity, ease: "easeInOut" }} className="w-8 h-8 rounded-lg bg-[#faf7f2] border border-primary flex items-center justify-center shadow-sm" > <Pencil className="text-amber-500" size={16} /> </motion.div> <div className="flex flex-col"> <span className="text-xs font-bold text-primary">Стратег планує...</span> <span className="text-[10px] font-extrabold text-primary/40 uppercase tracking-wider">Генерація графів</span> </div> </div>
<div className="flex items-center gap-2 bg-[#f4ebd0]/30 border border-primary/10 px-3 py-2 rounded-xl"> <Loader2 className="animate-spin text-amber-600" size={14} /> <span className="text-xs font-body italic text-primary/75">{loadingSteps[loadingStepIndex]}</span> </div> </div> </div> )} <div ref={messagesEndRef} /> </div>
{/* Suggestions chips (only visible if not loading) */} {!aiLoading && chatMessages.length === 1 && ( <div className="flex flex-col gap-2 mb-4 bg-primary/5 p-3 rounded-2xl border-2 border-dashed border-primary/10"> <span className="text-[10px] font-extrabold uppercase text-primary/60 tracking-wider flex items-center gap-1.5"> <Sparkles size={12} className="text-amber-500" /> <span>Підказки для старту</span> </span> <div className="flex flex-wrap gap-2"> {suggestions.map((sug, idx) => ( <button key={idx} onClick={() => setPrompt(sug.text)} className="flex items-center gap-1.5 px-3 py-1.5 bg-[#faf7f2] hover:bg-[#faf7f2]/80 border border-primary/20 hover:border-primary rounded-xl text-xs font-bold text-primary transition-all cursor-pointer shadow-[1px_1px_0px_0px_rgba(0,0,0,0.1)] hover:scale-[1.02]" > {sug.icon} <span>{sug.tag}</span> </button> ))} </div> </div> )}
{/* Chat Input Form */} <form onSubmit={handleSubmit} className="mt-auto"> <div className="relative border-2 border-primary rounded-2xl bg-[#faf7f2] shadow-[3px_3px_0px_0px_var(--color-primary)] flex items-center p-1 group focus-within:shadow-[4px_4px_0px_0px_var(--color-primary)] transition-all"> <textarea rows={1} value={prompt} onChange={(e) => setPrompt(e.target.value)} onKeyDown={handleKeyDown} disabled={aiLoading} placeholder={t('canvas.ask_ai_placeholder', 'Спроси стратега...')} className="flex-grow pl-3 pr-12 py-2 bg-transparent text-sm text-primary font-body outline-none resize-none max-h-24 scrollbar-hide placeholder:text-primary/40 placeholder:font-bold disabled:opacity-50" /> <button type="submit" disabled={!prompt.trim() || aiLoading} className="absolute right-2 top-1/2 -translate-y-1/2 p-2 bg-primary text-white rounded-xl hover:scale-105 active:scale-95 disabled:scale-100 disabled:opacity-35 disabled:cursor-not-allowed transition-all cursor-pointer flex items-center justify-center" > <Send size={14} /> </button> </div> </form>
</div> </motion.div> </> )} </AnimatePresence> );};
export default AIHintOverlay;1 unmodified line2345678910115 unmodified lines1718192021222326 unmodified lines50515253545556577 unmodified lines6566676869707113 unmodified lines85868788899091929394959697989910010110210310410510610710810911011111233 unmodified lines14614714814915015115215315415515615715815928 unmodified lines1881891901911921931 unmodified lineimport { motion } from 'framer-motion';import { useTranslation } from 'react-i18next';import {Sparkles,Target,GitFork,Timer,Copy,Scissors,Clipboard,5 unmodified linesPencil,Type,Download,MousePointer2} from 'lucide-react';const TooltipButton = ({ children, tooltip, onClick, disabled = false, className = "", active = false }) => {26 unmodified lines};const CanvasToolbar = ({handleAIRequest,isAIActive,addNewNodeAt,handleCopy,handleCut,7 unmodified linescanUndo,canRedo,drawingMode,setDrawingMode}) => {const { t } = useTranslation();const fileInputRef = React.useRef(null);13 unmodified lines<divclassName="absolute top-1/2 -translate-y-1/2 left-6 z-20 flex flex-col items-center gap-1.5 bg-surface-container-lowest border-2 border-primary shadow-[3px_3px_0px_0px_var(--color-primary)] p-1.5 rounded-2xl transition-all">{/* AI Assistant Section */}<div className="relative group"><motion.buttonwhileHover={{ scale: isAIActive ? 1 : 1.05 }}whileTap={{ scale: isAIActive ? 1 : 0.95 }}onClick={handleAIRequest}className={`p-1.5 rounded-xl font-bold transition-all flex items-center justify-center relative border-2 ${isAIActive? 'bg-secondary text-primary border-primary shadow-[2px_2px_0px_0px_var(--color-primary)] animate-pulse': 'bg-primary text-on-primary border-transparent hover:border-primary hover:bg-primary/95 hover:shadow-[2px_2px_0px_0px_var(--color-primary)]'}`}><Sparkles size={16} /></motion.button><div className="absolute left-full ml-3 top-1/2 -translate-y-1/2 px-3 py-1.5 bg-primary text-on-primary font-bold text-xs rounded-md shadow-lg border border-primary/20 whitespace-nowrap z-50 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity">{isAIActive ? t('canvas.ai_thinking', 'AI Thinking...') : t('canvas.ai_assistant', 'AI Assistant')}<div className="absolute right-full top-1/2 -translate-y-1/2 border-8 border-transparent border-r-primary"></div></div></div><div className="w-full h-[1px] bg-primary/10 my-0.5"></div>{/* Main Tools: Selection vs Brush */}<div className="flex flex-col gap-1"><TooltipButton33 unmodified lines<GitFork size={16} /></TooltipButton><TooltipButtontooltip={t('canvas.toolbar.add_habit', 'Додати звичку')}onClick={() => addNewNodeAt(undefined, undefined, 'habit')}disabled={drawingMode}><Timer size={16} /></TooltipButton><TooltipButtontooltip={t('canvas.toolbar.add_comment', 'Додати стікер')}onClick={() => addNewNodeAt(undefined, undefined, 'comment')}28 unmodified lines<div className="w-full h-[1px] bg-primary/10 my-0.5"></div>{/* Clipboard Actions */}<div className="flex flex-col gap-1"><TooltipButton1 unmodified line234567895 unmodified lines15161718192021222326 unmodified lines5051525354557 unmodified lines6364656667686970717213 unmodified lines86878889909133 unmodified lines12512612712812913028 unmodified lines1591601611621631641651661671681691701711721731741751761771781791801811821831841851 unmodified lineimport { motion } from 'framer-motion';import { useTranslation } from 'react-i18next';import {Target,GitFork,Copy,Scissors,Clipboard,5 unmodified linesPencil,Type,Download,MousePointer2,Network,LayoutTemplate} from 'lucide-react';const TooltipButton = ({ children, tooltip, onClick, disabled = false, className = "", active = false }) => {26 unmodified lines};const CanvasToolbar = ({addNewNodeAt,handleCopy,handleCut,7 unmodified linescanUndo,canRedo,drawingMode,setDrawingMode,onAutoLayout,onOpenTemplates,canAutoLayout}) => {const { t } = useTranslation();const fileInputRef = React.useRef(null);13 unmodified lines<divclassName="absolute top-1/2 -translate-y-1/2 left-6 z-20 flex flex-col items-center gap-1.5 bg-surface-container-lowest border-2 border-primary shadow-[3px_3px_0px_0px_var(--color-primary)] p-1.5 rounded-2xl transition-all">{/* Main Tools: Selection vs Brush */}<div className="flex flex-col gap-1"><TooltipButton33 unmodified lines<GitFork size={16} /></TooltipButton><TooltipButtontooltip={t('canvas.toolbar.add_comment', 'Додати стікер')}onClick={() => addNewNodeAt(undefined, undefined, 'comment')}28 unmodified lines<div className="w-full h-[1px] bg-primary/10 my-0.5"></div>{/* Layout & Templates */}<div className="flex flex-col gap-1"><TooltipButtontooltip={t('canvas.toolbar.auto_layout', 'Авто-розкладка (Shift+L)')}onClick={onAutoLayout}disabled={!canAutoLayout || drawingMode}><Network size={16} /></TooltipButton><TooltipButtontooltip={t('canvas.toolbar.templates', 'Шаблони')}onClick={onOpenTemplates}disabled={drawingMode}><LayoutTemplate size={16} /></TooltipButton></div><div className="w-full h-[1px] bg-primary/10 my-0.5"></div>{/* Clipboard Actions */}<div className="flex flex-col gap-1"><TooltipButton
1234567814 unmodified lines2324252627282930313233343536import React from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import { useNavigate } from 'react-router-dom';import { Lock } from 'lucide-react';const PaywallModal = ({ showPaywall, setShowPaywall }) => {const { t } = useTranslation();14 unmodified lines><Lock size={48} className="mx-auto mb-4 text-primary" /><h2 className="text-4xl font-display-lg mb-4 text-primary">{t('pricing.premium_feature', 'Premium Feature')}</h2><p className="text-xl mb-6 text-on-surface-variant font-medium">{t('pricing.paywall_desc', 'AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.')}</p><div className="flex flex-col gap-3"><button onClick={() => { setShowPaywall(false); navigate('/subscription'); }} className="w-full py-4 bg-primary text-on-primary font-bold rounded-xl shadow-lg hover:translate-y-[-2px] transition-all cursor-pointer">{t('pricing.upgrade_premium', 'Upgrade to Premium')}</button><button onClick={() => setShowPaywall(false)} className="w-full py-4 font-bold text-on-surface-variant border-2 border-primary/10 rounded-xl cursor-pointer">{t('pricing.maybe_later', 'Maybe Later')}12345678914 unmodified lines2425262728293031323334353637import React from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import { useNavigate } from 'react-router-dom';import { Lock } from 'lucide-react';import { FREE_LIMITS } from '../../../config/plans';const PaywallModal = ({ showPaywall, setShowPaywall }) => {const { t } = useTranslation();14 unmodified lines><Lock size={48} className="mx-auto mb-4 text-primary" /><h2 className="text-4xl font-display-lg mb-4 text-primary">{t('plans.limit_title', 'Free plan limit')}</h2><p className="text-xl mb-6 text-on-surface-variant font-medium">{t('plans.limit_nodes_desc', { count: FREE_LIMITS.nodesPerBoard, defaultValue: `A board on the Free plan can hold up to ${FREE_LIMITS.nodesPerBoard} nodes. Plus has no limits.` })}</p><div className="flex flex-col gap-3"><button onClick={() => { setShowPaywall(false); navigate('/subscription'); }} className="w-full py-4 bg-primary text-on-primary font-bold rounded-xl shadow-lg hover:translate-y-[-2px] transition-all cursor-pointer">{t('plans.see_plus', 'See Plus')}</button><button onClick={() => setShowPaywall(false)} className="w-full py-4 font-bold text-on-surface-variant border-2 border-primary/10 rounded-xl cursor-pointer">{t('pricing.maybe_later', 'Maybe Later')}
123456245 unmodified lines252253254255256257258import React, { useState, useRef, useEffect } from 'react';import { Handle, Position, useReactFlow, useUpdateNodeInternals } from '@xyflow/react';import { CheckCircle2, Circle, X, ArrowRight, Sparkles, AlertCircle, CheckSquare, Settings } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useTheme } from '../../../../context/ThemeContext';import { isDefaultLabel } from '../../utils';245 unmodified lines{data.status}</span><div className="flex items-center gap-2">{data.ai && <Sparkles size={12} className="text-secondary animate-pulse" />}{assignees.length > 0 && (<divtitle={tooltipText}123456245 unmodified lines252253254255256257258import React, { useState, useRef, useEffect } from 'react';import { Handle, Position, useReactFlow, useUpdateNodeInternals } from '@xyflow/react';import { CheckCircle2, Circle, X, ArrowRight, AlertCircle, CheckSquare, Settings } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useTheme } from '../../../../context/ThemeContext';import { isDefaultLabel } from '../../utils';245 unmodified lines{data.status}</span><div className="flex items-center gap-2">{assignees.length > 0 && (<divtitle={tooltipText}
12 unmodified lines131415161718130 unmodified lines149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274602 unmodified lines877878879880881882524 unmodified lines14071408140914101411141268 unmodified lines1481148214831484148514861487169 unmodified lines1657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825105 unmodified lines19311932193319341935193623 unmodified lines19601961196219631964196519661967196819691970197119721973197422 unmodified lines19971998199920002001200220032004200520062007200812 unmodified linesuseReactFlow,} from '@xyflow/react';import { useSignalR } from './useSignalR';export const getConditionSourceHandle = (sourceNode, condition) => {if (!sourceNode) return null;130 unmodified linesconst [cursors, setCursors] = useState({});const [clipboardVersion, setClipboardVersion] = useState(0);const [isAIActive, setIsAIActive] = useState(false);const [aiLoading, setAiLoading] = useState(false);const defaultThread = {id: 'default',title: 'Основний чат',messages: [{id: 'welcome',sender: 'agent',text: 'Привіт! Я твій ШІ-стратег. Опиши, що ти хочеш додати на доску або як хочеш змінити поточний план. Я можу будувати підзадачі, умови та звички, позначаючи всі зв\'язки.'}]};const [chatThreads, setChatThreads] = useState(() => {if (!projectId) return [defaultThread];const saved = localStorage.getItem(`flow_chats_${projectId}`);if (saved) {try {return JSON.parse(saved);} catch (e) {console.error(e);}}return [defaultThread];});const [activeThreadId, setActiveThreadId] = useState(() => {if (!projectId) return 'default';const savedActive = localStorage.getItem(`flow_chats_active_${projectId}`);return savedActive || 'default';});useEffect(() => {if (!projectId) return;const saved = localStorage.getItem(`flow_chats_${projectId}`);let loadedThreads = [];if (saved) {try {loadedThreads = JSON.parse(saved);} catch (e) {console.error(e);}}if (!loadedThreads || loadedThreads.length === 0) {loadedThreads = [defaultThread];}setChatThreads(loadedThreads);const savedActive = localStorage.getItem(`flow_chats_active_${projectId}`);if (savedActive && loadedThreads.some(t => t.id === savedActive)) {setActiveThreadId(savedActive);} else {setActiveThreadId(loadedThreads[0].id);}}, [projectId]);useEffect(() => {if (!projectId || chatThreads.length === 0) return;localStorage.setItem(`flow_chats_${projectId}`, JSON.stringify(chatThreads));}, [chatThreads, projectId]);useEffect(() => {if (!projectId) return;localStorage.setItem(`flow_chats_active_${projectId}`, activeThreadId);}, [activeThreadId, projectId]);const activeThread = chatThreads.find(t => t.id === activeThreadId) || chatThreads[0] || defaultThread;const chatMessages = activeThread.messages || [];const setChatMessages = (updater) => {setChatThreads(prevThreads => {return prevThreads.map(thread => {if (thread.id === activeThreadId) {const newMessages = typeof updater === 'function' ? updater(thread.messages) : updater;return { ...thread, messages: newMessages };}return thread;});});};const createNewThread = (title = '') => {const newId = crypto.randomUUID();const newThread = {id: newId,title: title.trim() || `Чат ${chatThreads.length + 1}`,messages: [{id: 'welcome',sender: 'agent',text: 'Привіт! Я твій ШІ-стратег. Опиши, що ти хочеш додати на доску або як хочеш змінити поточний план. Я можу будувати підзадачі, умови та звички, позначаючи всі зв\'язки.'}],createdAt: new Date().toISOString()};setChatThreads(prev => [...prev, newThread]);setActiveThreadId(newId);return newId;};const deleteThread = (threadId) => {const remaining = chatThreads.filter(t => t.id !== threadId);if (remaining.length === 0) {setChatThreads([defaultThread]);setActiveThreadId('default');return;}setChatThreads(remaining);if (activeThreadId === threadId) {setActiveThreadId(remaining[0].id);}};const renameThread = (threadId, newTitle) => {if (!newTitle.trim()) return;setChatThreads(prev => prev.map(t => t.id === threadId ? { ...t, title: newTitle.trim() } : t));};const [showPaywall, setShowPaywall] = useState(false);const [isSaving, setIsSaving] = useState(false);const [isManualSaving, setIsManualSaving] = useState(false);602 unmodified linestype: n.type || 'sketch',position: { x: n.posX, y: n.posY },draggable: !isPinned,width: width,height: height,style: (width && height) ? { width, height } : undefined,524 unmodified lines);const addNewNodeAt = useCallback((x, y, type = 'sketch', initialData = {}) => {takeHistorySnapshot();let position;68 unmodified lines});}return id;}, [setNodes, screenToFlowPosition, updateNodeDataCallback, takeHistorySnapshot]);const handleCopy = useCallback(() => {const selectedNodes = nodes.filter((n) => n.selected);169 unmodified lines}));}, [setNodes, setEdges, screenToFlowPosition, updateNodeDataCallback, projectData, takeHistorySnapshot]);const submitAICanvasPrompt = async (promptText) => {if (!promptText || !projectId) return false;const historyPayload = chatMessages.filter(msg => msg.id !== 'welcome' && !msg.isError).map(msg => ({role: msg.sender === 'user' ? 'user' : 'model',text: msg.text}));// Append user messageconst userMsg = {id: crypto.randomUUID(),sender: 'user',text: promptText,timestamp: new Date()};setChatMessages(prev => [...prev, userMsg]);setAiLoading(true);try {const res = await axios.post(`${API_URL}/AI/assist`, {graphId: projectId,userPrompt: promptText,history: historyPayload});const { newNodes, newEdges, explanation } = res.data;if (newNodes && newNodes.length > 0) {const mappedNewNodes = newNodes.map((n) => {let options = [];let selectedOptions = [];let multiSelect = false;let resetRule = { type: 'daily', time: '00:00' };let lastResetTime = undefined;let createdAt = undefined;let description = n.description || '';let decision = n.decision || (n.type === 'condition' ? 'True' : 'bottom');if (n.type === 'condition') {if (n.decision && n.decision.startsWith('{')) {try {const parsed = JSON.parse(n.decision);options = parsed.options || [];selectedOptions = parsed.selected || [];multiSelect = !!parsed.multiSelect;decision = undefined;} catch (e) {console.error('Failed to parse dynamic options JSON in AI response', e);options = [{ id: 'opt-yes', label: 'Так' },{ id: 'opt-no', label: 'Ні' }];selectedOptions = n.decision === 'True' ? ['opt-yes'] : (n.decision === 'False' ? ['opt-no'] : []);}} else {options = [{ id: 'opt-yes', label: 'Так' },{ id: 'opt-no', label: 'Ні' }];selectedOptions = n.decision === 'True' ? ['opt-yes'] : (n.decision === 'False' ? ['opt-no'] : []);}} else if (n.type === 'habit') {resetRule = { type: 'daily', time: '00:00' };createdAt = new Date().toISOString();lastResetTime = new Date().toISOString();}return {id: n.id,type: n.type || 'sketch',position: { x: n.posX, y: n.posY },data: {label: n.label,status: n.state === 1 ? 'Done' : 'Todo',tags: [],decision,options,selectedOptions,multiSelect,resetRule,lastResetTime,createdAt,description: description || '',updateNodeData: updateNodeDataCallback}};});const mappedNewEdges = newEdges.map((e) => {const sourceNode = [...nodes, ...mappedNewNodes].find(nodeItem => nodeItem.id.toLowerCase() === e.fromNodeId.toLowerCase());const targetNode = [...nodes, ...mappedNewNodes].find(nodeItem => nodeItem.id.toLowerCase() === e.toNodeId.toLowerCase());let sourceHandle = getConditionSourceHandle(sourceNode, e.condition);let targetHandle = undefined;if (sourceNode && sourceNode.type === 'sketch') {if (e.condition === 'SubgoalLeft' ||e.condition === 'subgoals-source-left' ||e.condition === 'SubgoalRight' ||e.condition === 'subgoals-source-right') {sourceHandle = (e.condition === 'SubgoalLeft' || e.condition === 'subgoals-source-left')? 'subgoals-source-left': 'subgoals-source-right';targetHandle = 'main-target';} else {sourceHandle = 'main-source';targetHandle = (targetNode && ['sketch', 'habit', 'condition'].includes(targetNode.type))? 'main-target': null;}} else if (sourceNode && (sourceNode.type === 'habit' || sourceNode.type === 'condition')) {targetHandle = (targetNode && ['sketch', 'habit', 'condition'].includes(targetNode.type))? 'main-target': null;}return {id: e.id,source: e.fromNodeId,target: e.toNodeId,sourceHandle: sourceHandle,targetHandle: targetHandle,animated: false};});setNodes((nds) => nds.concat(mappedNewNodes));setEdges((eds) => eds.concat(mappedNewEdges));}// Append agent messageconst agentMsg = {id: crypto.randomUUID(),sender: 'agent',text: explanation || 'Я оновив твою доску та додав необхідні елементи.',timestamp: new Date()};setChatMessages(prev => [...prev, agentMsg]);return true;} catch (err) {console.error('AI assistant error:', err);const errorMsg = {id: crypto.randomUUID(),sender: 'agent',text: 'Помилка: ' + (err.response?.data?.message || 'Не вдалося зв\'язатися з ШІ-стратегом.'),isError: true,timestamp: new Date()};setChatMessages(prev => [...prev, errorMsg]);return false;} finally {setAiLoading(false);}};const handleAIRequest = () => {// Open access for regular users for nowsetIsAIActive(true);};const handleMouseDown = (event) => {if (event.button !== 0 || !event.target.classList.contains('react-flow__pane')) return;105 unmodified lines}, [nodes, resetDownstreamNodes, setNodes, triggerNotification, t]);return {setNodes,nodes,edges,23 unmodified lines}},updateNodeData: updateNodeDataCallback,isAIActive,setIsAIActive,aiLoading,submitAICanvasPrompt,chatMessages,setChatMessages,showPaywall,setShowPaywall,handleAIRequest,addNewNodeAt,handleCopy,handleCut,22 unmodified linescanRedo: futureRef.current.length > 0,takeHistorySnapshot,updateProjectMetadata,chatThreads,activeThreadId,setActiveThreadId,createNewThread,deleteThread,renameThread,isLoading};};12 unmodified lines1314151617181920130 unmodified lines151152153154155156602 unmodified lines759760761762763764765766767524 unmodified lines129212931294129512961297129812991300130168 unmodified lines1370137113721373137413751376169 unmodified lines15461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742105 unmodified lines18481849185018511852185318541855185623 unmodified lines1880188118821883188418851886188722 unmodified lines19101911191219131914191512 unmodified linesuseReactFlow,} from '@xyflow/react';import { useSignalR } from './useSignalR';import { computeAutoLayout, layoutFresh, getNodeSize, easeInOutCubic } from '../layout';import { FREE_LIMITS, isPlus } from '../../../config/plans';export const getConditionSourceHandle = (sourceNode, condition) => {if (!sourceNode) return null;130 unmodified linesconst [cursors, setCursors] = useState({});const [clipboardVersion, setClipboardVersion] = useState(0);const [showPaywall, setShowPaywall] = useState(false);const [isSaving, setIsSaving] = useState(false);const [isManualSaving, setIsManualSaving] = useState(false);602 unmodified linestype: n.type || 'sketch',position: { x: n.posX, y: n.posY },draggable: !isPinned,// Habits are hidden on the canvas until they get their own space (ROADMAP.md).// The nodes stay in state so saving the board does not delete them.hidden: n.type === 'habit',width: width,height: height,style: (width && height) ? { width, height } : undefined,524 unmodified lines);const addNewNodeAt = useCallback((x, y, type = 'sketch', initialData = {}) => {if (!isPlus(user) && nodesRef.current.length >= FREE_LIMITS.nodesPerBoard) {setShowPaywall(true);return null;}takeHistorySnapshot();let position;68 unmodified lines});}return id;}, [setNodes, screenToFlowPosition, updateNodeDataCallback, takeHistorySnapshot, user]);const handleCopy = useCallback(() => {const selectedNodes = nodes.filter((n) => n.selected);169 unmodified lines}));}, [setNodes, setEdges, screenToFlowPosition, updateNodeDataCallback, projectData, takeHistorySnapshot]);// --- Auto-layout ---const layoutAnimationRef = useRef(null);const animateToPositions = useCallback((targets, duration = 550) => {const ids = Object.keys(targets);if (ids.length === 0) return;if (layoutAnimationRef.current) cancelAnimationFrame(layoutAnimationRef.current);const starts = {};nodesRef.current.forEach((n) => {if (targets[n.id]) starts[n.id] = { ...n.position };});const startTime = performance.now();const step = (now) => {const t = Math.min(1, (now - startTime) / duration);const k = easeInOutCubic(t);setNodes((nds) => nds.map((n) => {const from = starts[n.id];const to = targets[n.id];if (!from || !to) return n;return { ...n, position: { x: from.x + (to.x - from.x) * k, y: from.y + (to.y - from.y) * k } };}));if (t < 1) {layoutAnimationRef.current = requestAnimationFrame(step);} else {layoutAnimationRef.current = null;if (broadcastMessageRef.current) {ids.forEach((id) => broadcastMessageRef.current({ type: 'NODE_MOVE', payload: { id, position: targets[id] } }));}}};layoutAnimationRef.current = requestAnimationFrame(step);}, [setNodes]);useEffect(() => () => {if (layoutAnimationRef.current) cancelAnimationFrame(layoutAnimationRef.current);}, []);// Arranges the selection (2+ nodes) or the whole board. Returns the number of moved nodes.const autoLayout = useCallback(() => {if (projectData?.permission === 'Read') return 0;const current = nodesRef.current;const selectedIds = current.filter((n) => n.selected).map((n) => n.id);const targets = computeAutoLayout(current, edgesRef.current, {onlyIds: selectedIds.length >= 2 ? selectedIds : null});const moved = Object.keys(targets).length;if (moved === 0) return 0;takeHistorySnapshot();animateToPositions(targets);return moved;}, [projectData, takeHistorySnapshot, animateToPositions]);// --- Templates ---const buildTemplateEdge = (edge, typeOf) => {const isStickerType = (type) => ['comment', 'image', 'text', 'path'].includes(type);const isSticker = isStickerType(typeOf(edge.source)) || isStickerType(typeOf(edge.target));return {...edge,sourceHandle: isSticker ? null : (edge.sourceHandle ?? 'main-source'),targetHandle: isSticker ? null : (edge.targetHandle ?? 'main-target'),type: isSticker ? 'sticker' : undefined,animated: !isSticker,markerEnd: isSticker ? null : { type: MarkerType.ArrowClosed, color: '#31363F' }};};/*** Inserts template content ({ nodes, edges } in React Flow format) into the board.* Nodes without positions are auto-laid-out. The block is centered on `screenPoint`* (defaults to the middle of the window). Returns the new node ids, or null when blocked.*/const insertTemplate = useCallback((content, { screenPoint } = {}) => {if (projectData?.permission === 'Read') return null;const tplNodes = (content?.nodes || []).filter((n) => n && n.type !== 'habit');const tplEdges = content?.edges || [];if (tplNodes.length === 0) return null;if (!isPlus(user) && nodesRef.current.length + tplNodes.length > FREE_LIMITS.nodesPerBoard) {setShowPaywall(true);return null;}const needsLayout = tplNodes.some((n) => !n.position);const positioned = needsLayout ? layoutFresh(tplNodes, tplEdges) : tplNodes;let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;positioned.forEach((n) => {const { width, height } = getNodeSize(n);minX = Math.min(minX, n.position.x);minY = Math.min(minY, n.position.y);maxX = Math.max(maxX, n.position.x + width);maxY = Math.max(maxY, n.position.y + height);});const point = screenPoint || { x: window.innerWidth / 2, y: window.innerHeight / 2 };const center = screenToFlowPosition(point);const dx = center.x - (minX + maxX) / 2;const dy = center.y - (minY + maxY) / 2;takeHistorySnapshot();const idMap = {};const newNodes = positioned.map((n) => {const id = crypto.randomUUID();idMap[n.id] = id;return {id,type: n.type || 'sketch',position: { x: Math.round(n.position.x + dx), y: Math.round(n.position.y + dy) },width: n.width,height: n.height,style: n.width && n.height ? { width: n.width, height: n.height } : undefined,selected: true,data: {label: '',status: 'Todo',description: '',tags: [],assignees: [],...(n.type === 'condition' ? {options: [{ id: 'opt-yes', label: 'Так' }, { id: 'opt-no', label: 'Ні' }],selectedOptions: [],multiSelect: false} : { decision: 'bottom' }),...n.data,updateNodeData: updateNodeDataCallback}};});const typeOfNew = (id) => newNodes.find((n) => n.id === id)?.type;const newEdges = tplEdges.filter((e) => idMap[e.source] && idMap[e.target]).map((e) => buildTemplateEdge({id: `edge-${crypto.randomUUID()}`,source: idMap[e.source],target: idMap[e.target],sourceHandle: e.sourceHandle,targetHandle: e.targetHandle}, typeOfNew));setNodes((nds) => nds.map((n) => (n.selected ? { ...n, selected: false } : n)).concat(newNodes));setEdges((eds) => eds.concat(newEdges));if (broadcastMessageRef.current) {newNodes.forEach((n) => broadcastMessageRef.current({ type: 'NODE_ADD', payload: n }));newEdges.forEach((e) => broadcastMessageRef.current({ type: 'EDGE_ADD', payload: e }));}return newNodes.map((n) => n.id);}, [projectData, user, screenToFlowPosition, takeHistorySnapshot, setNodes, setEdges, updateNodeDataCallback]);/*** Serializes the selection (or the whole board) into template content.* Progress, statuses, assignees and heavy images are stripped so the template is a clean starting point.*/const serializeTemplate = useCallback((selectedOnly = false) => {const source = nodesRef.current.filter((n) => !n.hidden && n.type !== 'habit' && n.type !== 'path');const picked = selectedOnly ? source.filter((n) => n.selected) : source;const usable = picked.filter((n) => n.type !== 'image' || (n.data?.url && n.data.url.length < 400000));const ids = new Set(usable.map((n) => n.id));const nodesOut = usable.map((n) => {const d = n.data || {};const data = {label: d.label || '',description: d.description || '',tags: d.tags || [],color: d.color};if (n.type === 'condition') {data.options = d.options || [];data.multiSelect = !!d.multiSelect;} else if (n.type === 'sketch') {data.decision = d.decision || 'bottom';data.showProgress = !!d.showProgress;} else if (n.type === 'text') {data.fontSize = d.fontSize;data.textAlign = d.textAlign;} else if (n.type === 'image') {data.url = d.url;}const size = n.type === 'comment' || n.type === 'image' ? getNodeSize(n) : {};return { id: n.id, type: n.type, position: { x: Math.round(n.position.x), y: Math.round(n.position.y) }, ...size, data };});const edgesOut = edgesRef.current.filter((e) => ids.has(e.source) && ids.has(e.target)).map((e) => ({ id: e.id, source: e.source, target: e.target, sourceHandle: e.sourceHandle, targetHandle: e.targetHandle }));return { version: 2, nodes: nodesOut, edges: edgesOut };}, []);const handleMouseDown = (event) => {if (event.button !== 0 || !event.target.classList.contains('react-flow__pane')) return;105 unmodified lines}, [nodes, resetDownstreamNodes, setNodes, triggerNotification, t]);return {autoLayout,insertTemplate,serializeTemplate,setNodes,nodes,edges,23 unmodified lines}},updateNodeData: updateNodeDataCallback,showPaywall,setShowPaywall,addNewNodeAt,handleCopy,handleCut,22 unmodified linescanRedo: futureRef.current.length > 0,takeHistorySnapshot,updateProjectMetadata,isLoading};};
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143import dagre from '@dagrejs/dagre';
// Node types that form the plan itself; they are arranged as a layered graph.const FLOW_TYPES = new Set(['sketch', 'condition']);// Annotation-like nodes; they follow the flow node they are attached to.const STICKER_TYPES = new Set(['comment', 'image', 'text']);
const DEFAULT_SIZES = { sketch: { width: 230, height: 115 }, condition: { width: 170, height: 150 }, comment: { width: 200, height: 150 }, image: { width: 300, height: 200 }, text: { width: 200, height: 60 },};
const toNumber = (value) => { if (typeof value === 'number') return Number.isFinite(value) ? value : undefined; if (typeof value === 'string') { const parsed = parseFloat(value); return Number.isFinite(parsed) ? parsed : undefined; } return undefined;};
export const getNodeSize = (node) => { const fallback = DEFAULT_SIZES[node.type] || DEFAULT_SIZES.sketch; return { width: toNumber(node.measured?.width) ?? toNumber(node.width) ?? toNumber(node.style?.width) ?? fallback.width, height: toNumber(node.measured?.height) ?? toNumber(node.height) ?? toNumber(node.style?.height) ?? fallback.height, };};
const boundsOf = (nodes, positionOf) => { let minX = Infinity; let minY = Infinity; nodes.forEach((n) => { const p = positionOf(n); minX = Math.min(minX, p.x); minY = Math.min(minY, p.y); }); return { x: minX, y: minY };};
/** * Computes tidy positions for the plan nodes. * * - Goals and conditions are laid out top-to-bottom with dagre, following the edges. * - Stickers, texts and images connected to a moved node keep their offset to it. * - Pinned, hidden and free-floating annotation nodes are left where they are. * - When `onlyIds` is given (e.g. the current selection), only those nodes are arranged. * - The arranged block keeps its top-left corner, so the board does not jump. * * Returns a map { [nodeId]: { x, y } } with the new positions of the nodes that move. */export const computeAutoLayout = (nodes, edges, { direction = 'TB', onlyIds = null } = {}) => { const scope = onlyIds ? new Set(onlyIds) : null; const movable = nodes.filter( (n) => FLOW_TYPES.has(n.type) && !n.hidden && !n.data?.isPinned && (!scope || scope.has(n.id)) ); if (movable.length < 2) return {};
const movableIds = new Set(movable.map((n) => n.id)); const g = new dagre.graphlib.Graph({ multigraph: true }); g.setGraph({ rankdir: direction, nodesep: 70, ranksep: 110, edgesep: 30, marginx: 0, marginy: 0 }); g.setDefaultEdgeLabel(() => ({}));
movable.forEach((n) => g.setNode(n.id, getNodeSize(n))); edges.forEach((e) => { if (movableIds.has(e.source) && movableIds.has(e.target) && e.source !== e.target) { g.setEdge(e.source, e.target, {}, e.id); } });
dagre.layout(g);
// dagre returns centers; React Flow positions are top-left corners const laidOut = {}; movable.forEach((n) => { const { x, y } = g.node(n.id); const { width, height } = getNodeSize(n); laidOut[n.id] = { x: x - width / 2, y: y - height / 2 }; });
// Keep the block anchored where it was const before = boundsOf(movable, (n) => n.position); const after = boundsOf(movable, (n) => laidOut[n.id]); const dx = before.x - after.x; const dy = before.y - after.y;
const result = {}; movable.forEach((n) => { result[n.id] = { x: Math.round(laidOut[n.id].x + dx), y: Math.round(laidOut[n.id].y + dy) }; });
// Attached annotations move together with their anchor node const nodeById = new Map(nodes.map((n) => [n.id, n])); nodes .filter((n) => STICKER_TYPES.has(n.type) && !n.hidden && !n.data?.isPinned && !result[n.id]) .forEach((sticker) => { const link = edges.find( (e) => (e.source === sticker.id && result[e.target]) || (e.target === sticker.id && result[e.source]) ); if (!link) return; const anchorId = link.source === sticker.id ? link.target : link.source; const anchor = nodeById.get(anchorId); result[sticker.id] = { x: Math.round(sticker.position.x + (result[anchorId].x - anchor.position.x)), y: Math.round(sticker.position.y + (result[anchorId].y - anchor.position.y)), }; });
return result;};
/** * Lays out a node list that has no meaningful positions yet (e.g. a built-in template). * Mutates nothing; returns a new node array. */export const layoutFresh = (nodes, edges, options) => { const seeded = nodes.map((n, i) => ({ ...n, position: n.position || { x: 0, y: i } })); const flowOnly = seeded.filter((n) => FLOW_TYPES.has(n.type)); const positions = computeAutoLayout(flowOnly, edges, options); const placed = seeded.map((n) => (positions[n.id] ? { ...n, position: positions[n.id] } : n)); const byId = new Map(placed.map((n) => [n.id, n]));
// Annotations without a position go to the right of the node they are linked to let looseY = 0; return placed.map((n) => { if (FLOW_TYPES.has(n.type) || n.position.x !== 0 || nodes.find((o) => o.id === n.id)?.position) return n; const link = edges.find((e) => (e.source === n.id && positions[e.target]) || (e.target === n.id && positions[e.source])); if (link) { const anchor = byId.get(link.source === n.id ? link.target : link.source); return { ...n, position: { x: anchor.position.x + getNodeSize(anchor).width + 80, y: anchor.position.y } }; } const position = { x: -getNodeSize(n).width - 80, y: looseY }; looseY += getNodeSize(n).height + 40; return { ...n, position }; });};
export const easeInOutCubic = (t) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);1234567891011121319 unmodified lines3334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868717 unmodified lines105106107108109110111112113114115import { useState, useEffect } from 'react';import axios from 'axios';import { useNavigate } from 'react-router-dom';export const useDashboardLogic = (user) => {const navigate = useNavigate();const [projects, setProjects] = useState([]);const [allProjects, setAllProjects] = useState([]);const [loading, setLoading] = useState(true);const [aiGenerating, setAiGenerating] = useState(false);const [searchTerm, setSearchTerm] = useState('');const API_URL = import.meta.env.VITE_API_URL;19 unmodified lines}};const handleCreateProject = async (title, templateKey = null) => {if (!title || !user) return;try {const res = await axios.post(`${API_URL}/graphs`, {userId: user.id,title,description: 'New strategy path...',templateKey});navigate(`/canvas/${res.data.id}`);} catch (err) {const msg = err.response?.data?.message;if (err.response?.status === 400 && msg) {alert(msg);if (msg.toLowerCase().includes('canvas') || msg.toLowerCase().includes('limit')) {navigate('/subscription');}} else {console.error('Error creating project', err);}}};const handleCreateProjectWithAI = async (goal) => {if (!goal || !user) return;setAiGenerating(true);try {const res = await axios.post(`${API_URL}/AI/generate-goal`, {userId: user.id,goal});navigate(`/canvas/${res.data.id}`);return res.data;} catch (err) {const msg = err.response?.data?.message;if (msg) {alert(msg);if (err.response?.status === 403 && msg.toLowerCase().includes('daily')) {navigate('/subscription');} else if ((err.response?.status === 400) && (msg.toLowerCase().includes('canvas') || msg.toLowerCase().includes('limit'))) {navigate('/subscription');}} else {console.error('Error creating project with AI', err);}throw err;} finally {setAiGenerating(false);}};17 unmodified linesreturn {projects: filteredProjects,loading,aiGenerating,searchTerm,setSearchTerm,handleCreateProject,handleCreateProjectWithAI,handleDeleteProject,ownedCount};123456789101112131419 unmodified lines3435363738394041424344454647484950515253545556575859606162636417 unmodified lines82838485868788899091import { useState, useEffect } from 'react';import axios from 'axios';import { useNavigate } from 'react-router-dom';import { setPendingTemplate } from '../../templates/templatesApi';export const useDashboardLogic = (user) => {const navigate = useNavigate();const [projects, setProjects] = useState([]);const [allProjects, setAllProjects] = useState([]);const [loading, setLoading] = useState(true);const [creating, setCreating] = useState(false);const [searchTerm, setSearchTerm] = useState('');const API_URL = import.meta.env.VITE_API_URL;19 unmodified lines}};// Creates a board; when a template is given, the canvas inserts it right after openingconst handleCreateProject = async (title, template = null) => {if (!title || !user) return;setCreating(true);try {const res = await axios.post(`${API_URL}/graphs`, {title,description: template ? template.title : ''});if (template?.content?.nodes?.length) {setPendingTemplate(res.data.id, template.content);}navigate(`/canvas/${res.data.id}`);return true;} catch (err) {const msg = err.response?.data?.message;if (err.response?.status === 400 && msg) {alert(msg);if (/plan|limit/i.test(msg)) navigate('/subscription');} else {console.error('Error creating project', err);}return false;} finally {setCreating(false);}};17 unmodified linesreturn {projects: filteredProjects,loading,creating,searchTerm,setSearchTerm,handleCreateProject,handleDeleteProject,ownedCount};
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243import React, { useEffect, useState } from 'react';import { motion, useReducedMotion } from 'framer-motion';import { Check, Network, MousePointer2, ArrowRight, GitFork } from 'lucide-react';
// A scripted, looping mini-board that shows real TaskFlow behaviour:// messy nodes -> auto-layout -> steps ticked off -> a fork picks a branch -> next step highlighted.// Coordinates are in a 100 x 70 box (node centers).
const SIZE = { card: { w: 23, h: 8.5 }, condition: { w: 22, h: 9.5 }, sticker: { w: 18, h: 8 },};
const NODES = [ { id: 'goal', kind: 'card', color: '#dbeafe', messy: [32, 40], tidy: [50, 9] }, { id: 'design', kind: 'card', messy: [76, 13], tidy: [27, 27] }, { id: 'copy', kind: 'card', messy: [18, 15], tidy: [73, 27] }, { id: 'check', kind: 'condition', messy: [63, 56], tidy: [50, 45] }, { id: 'publish', kind: 'card', color: '#dcfce7', messy: [15, 60], tidy: [28, 62] }, { id: 'fix', kind: 'card', color: '#fce7f3', messy: [85, 41], tidy: [72, 62] }, { id: 'sticker', kind: 'sticker', messy: [50, 23], tidy: [86, 9] },];
const EDGES = [ { id: 'e1', from: 'goal', to: 'design' }, { id: 'e2', from: 'goal', to: 'copy' }, { id: 'e3', from: 'design', to: 'check' }, { id: 'e4', from: 'copy', to: 'check' }, { id: 'e5', from: 'check', to: 'publish', branch: 'yes' }, { id: 'e6', from: 'check', to: 'fix', branch: 'no' }, { id: 'e7', from: 'sticker', to: 'goal', sticker: true },];
// phase: 0 messy, 1 cursor to button, 2 layout, 3 steps done, 4 branch chosenconst TIMINGS = [1900, 1300, 1500, 1900, 2800];
const nodeCenter = (node, phase) => (phase >= 2 ? node.tidy : node.messy);
const edgePath = (from, to, phase, sticker) => { const [fx, fy] = nodeCenter(from, phase); const [tx, ty] = nodeCenter(to, phase); if (sticker) { return `M ${fx - SIZE.sticker.w / 2} ${fy} C ${fx - 10} ${fy}, ${tx + 18} ${ty}, ${tx + SIZE.card.w / 2} ${ty}`; } const sy = fy + SIZE[from.kind].h / 2; const ty2 = ty - SIZE[to.kind].h / 2; const my = (sy + ty2) / 2; return `M ${fx} ${sy} C ${fx} ${my}, ${tx} ${my}, ${tx} ${ty2}`;};
const HeroBoardDemo = ({ copy }) => { const reduceMotion = useReducedMotion(); const [phase, setPhase] = useState(reduceMotion ? 4 : 0); const [cycle, setCycle] = useState(0);
useEffect(() => { if (reduceMotion) return undefined; const timer = setTimeout(() => { if (phase < TIMINGS.length - 1) { setPhase(phase + 1); } else { setPhase(0); setCycle((c) => c + 1); } }, TIMINGS[phase]); return () => clearTimeout(timer); }, [phase, reduceMotion]);
const labels = { goal: copy.goal, design: copy.design, copy: copy.copy, check: copy.check, publish: copy.publish, fix: copy.fix, sticker: copy.sticker, }; const done = (id) => phase >= 3 && (id === 'design' || id === 'copy' || id === 'goal'); const nextStep = phase === 3 ? 'check' : phase >= 4 ? 'publish' : null; const byId = Object.fromEntries(NODES.map((n) => [n.id, n])); const spring = { type: 'spring', stiffness: 90, damping: 16, mass: 0.9 };
return ( <div className="relative w-full rough-border rough-shadow bg-surface-container-lowest overflow-hidden select-none" aria-hidden="true"> {/* Mock toolbar */} <div className="flex items-center justify-between px-4 py-2.5 border-b-2 border-primary/10 bg-surface-container-low"> <div className="flex gap-1.5"> <span className="w-3 h-3 rounded-full bg-red-400/70" /> <span className="w-3 h-3 rounded-full bg-yellow-400/70" /> <span className="w-3 h-3 rounded-full bg-green-400/70" /> </div> <motion.div animate={phase === 1 ? { scale: [1, 1, 0.9, 1.05, 1] } : { scale: 1 }} transition={{ duration: 1.2, times: [0, 0.6, 0.75, 0.9, 1] }} className={`flex items-center gap-1.5 px-3 py-1 rounded-lg border-2 text-xs font-bold transition-colors ${ phase === 2 ? 'bg-primary text-on-primary border-primary' : 'border-primary/30 text-primary' }`} > <Network size={13} /> <span>{copy.autoLayout}</span> <span className="opacity-50 font-mono">⇧L</span> </motion.div> </div>
<div className="relative w-full graph-paper-bg" style={{ aspectRatio: '100 / 72' }}> {/* Edges */} <svg viewBox="0 0 100 72" preserveAspectRatio="none" className="absolute inset-0 w-full h-full"> {EDGES.map((e, i) => { const active = e.branch === 'yes' && phase >= 4; const dimmed = e.branch === 'no' && phase >= 4; return ( <motion.path key={`${cycle}-${e.id}`} initial={{ pathLength: 0, opacity: 0, d: edgePath(byId[e.from], byId[e.to], 0, e.sticker) }} animate={{ pathLength: 1, opacity: dimmed ? 0.18 : 1, d: edgePath(byId[e.from], byId[e.to], phase, e.sticker), }} transition={{ pathLength: { duration: 0.7, delay: 0.5 + i * 0.12 }, opacity: { duration: 0.4, delay: phase === 0 ? 0.5 + i * 0.12 : 0 }, d: spring, }} fill="none" stroke={active ? '#22c55e' : 'currentColor'} className="text-primary" strokeOpacity={e.sticker ? 0.35 : 0.7} strokeWidth={active ? 0.9 : 0.5} strokeDasharray={e.sticker ? '1.4 1.2' : undefined} vectorEffect="non-scaling-stroke" style={{ strokeWidth: active ? 3.5 : 2 }} /> ); })} </svg>
{/* Nodes */} {NODES.map((n, i) => { const [cx, cy] = nodeCenter(n, phase); const size = SIZE[n.kind]; const isDone = done(n.id); const isNext = nextStep === n.id; const isDimmed = phase >= 4 && n.id === 'fix'; return ( <motion.div key={`${cycle}-${n.id}`} initial={{ opacity: 0, scale: 0.4, rotate: -6 }} animate={{ opacity: isDimmed ? 0.35 : 1, scale: 1, rotate: phase >= 2 ? 0 : (i % 2 ? 3 : -3), left: `${cx - size.w / 2}%`, top: `${((cy - size.h / 2) / 72) * 100}%`, }} transition={{ opacity: { duration: 0.3, delay: phase === 0 ? i * 0.1 : 0 }, scale: { type: 'spring', stiffness: 300, damping: 18, delay: i * 0.1 }, left: spring, top: spring, rotate: spring, }} className="absolute" style={{ width: `${size.w}%`, height: `${(size.h / 72) * 100}%` }} > {n.kind === 'condition' ? ( <div className={`w-full h-full flex items-center justify-center gap-1 px-1 rounded-xl border-2 border-dashed text-center transition-shadow duration-300 ${ isNext ? 'border-green-500 shadow-[0_0_0_4px_rgba(34,197,94,0.25)]' : 'border-primary' } bg-surface-container-lowest`} > <GitFork size={12} className="shrink-0 text-primary hidden sm:block" /> <span className="text-[8px] sm:text-[11px] font-bold text-primary leading-tight">{labels[n.id]}</span> {phase >= 4 && ( <motion.span initial={{ scale: 0 }} animate={{ scale: 1 }} className="absolute -bottom-2.5 left-1/2 -translate-x-1/2 px-1.5 rounded-md bg-green-500 text-white text-[8px] sm:text-[10px] font-bold" > {copy.yes} </motion.span> )} </div> ) : n.kind === 'sticker' ? ( <div className="w-full h-full rounded-md bg-yellow-100 border-2 border-yellow-500/70 px-1.5 flex items-center shadow-sm rotate-2"> <span className="font-accent-note text-[11px] sm:text-[17px] text-yellow-900 leading-none">{labels[n.id]}</span> </div> ) : ( <div className={`relative w-full h-full rounded-xl border-2 px-2 flex items-center gap-1.5 transition-shadow duration-300 ${ isNext ? 'border-green-500 shadow-[0_0_0_4px_rgba(34,197,94,0.25)]' : 'border-primary' }`} style={{ backgroundColor: n.color || 'var(--color-surface-container-lowest)' }} > <motion.span animate={isDone ? { scale: [1, 1.35, 1] } : { scale: 1 }} transition={{ duration: 0.4, delay: n.id === 'copy' ? 0.35 : n.id === 'goal' ? 0.7 : 0 }} className={`shrink-0 w-3 h-3 sm:w-4 sm:h-4 rounded-full border-2 flex items-center justify-center ${ isDone ? 'bg-green-500 border-green-500 text-white' : 'border-primary/50' }`} > {isDone && <Check size={9} strokeWidth={4} />} </motion.span> <span className={`text-[8px] sm:text-[11px] font-bold leading-tight text-[#181919] ${isDone ? 'line-through opacity-60' : ''}`}> {labels[n.id]} </span> {isNext && ( <motion.span initial={{ opacity: 0, y: 4 }} animate={{ opacity: 1, y: 0 }} className="absolute -top-3 right-1 flex items-center gap-0.5 px-1.5 rounded-md bg-green-500 text-white text-[7px] sm:text-[9px] font-bold whitespace-nowrap" > {copy.nextStep} <ArrowRight size={9} /> </motion.span> )} </div> )} </motion.div> ); })}
{/* Fake cursor heading to the auto-layout button */} {!reduceMotion && ( <motion.div className="absolute z-10 text-primary drop-shadow" initial={false} animate={ phase === 0 ? { left: '55%', top: '70%', opacity: 0 } : phase === 1 ? { left: '74%', top: '-7%', opacity: 1 } : { left: '78%', top: '20%', opacity: 0 } } transition={{ duration: phase === 1 ? 0.8 : 0.5, ease: 'easeInOut' }} > <MousePointer2 size={22} className="fill-surface-container-lowest" /> </motion.div> )} </div> </div> );};
export default HeroBoardDemo;12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576import React from 'react';import { motion } from 'framer-motion';import { useTranslation } from 'react-i18next';
const AIFeatureSection = () => { const { t } = useTranslation(); return ( <section id="ai-agent" className="w-full grid grid-cols-1 lg:grid-cols-2 gap-20 items-center py-32 px-margin_edge max-w-screen-2xl mx-auto border-t-2 border-primary/10"> <motion.div initial={{ opacity: 0, x: -50 }} whileInView={{ opacity: 1, x: 0 }} viewport={{ once: true }} className="flex flex-col gap-8" > <div className="flex items-center gap-4 text-secondary"> <span className="material-symbols-outlined text-4xl">neurology</span> <span className="text-xl font-bold uppercase tracking-widest">{t('landing.adhd_edge', 'The ADHD Edge')}</span> </div> <h2 className="text-6xl font-display-lg text-primary">{t('landing.ai_find_path', 'Let AI find the path when you get stuck.')}</h2> <p className="text-2xl text-on-surface-variant leading-relaxed"> {t('landing.ai_desc', "TaskFlow handles the cognitive load. When a plan hits a wall, our AI agent sketches out a comprehensive strategy tree, finding alternatives so you don't have to.")} </p> <motion.div whileHover={{ rotate: 0 }} className="mt-4 bg-surface-container-lowest p-8 rough-border rough-shadow inline-block transform rotate-1 max-w-md" > <div className="flex items-center gap-4 border-b-2 border-primary/20 pb-4 mb-6"> <span className="material-symbols-outlined text-4xl text-primary">robot_2</span> <span className="text-sm font-bold text-on-surface-variant uppercase tracking-[0.2em]">{t('canvas.ai_assistant', 'AI Assistant')}</span> </div> <p className="font-accent-note text-3xl text-primary"> "{t('landing.ai_example_input', "I'm blocked on user growth. What now?")}" </p> <div className="flex justify-end mt-6"> <button className="bg-primary text-on-primary font-bold py-2 px-6 rough-border shadow-sm"> {t('landing.ai_adapt_plan', 'Adapt Plan')} </button> </div> </motion.div> </motion.div> <motion.div initial={{ opacity: 0, scale: 0.95 }} whileInView={{ opacity: 1, scale: 1 }} viewport={{ once: true }} className="relative min-h-[600px] w-full bg-surface-container-lowest rough-border rough-shadow overflow-hidden rounded-2xl flex items-center justify-center p-8" > <div className="absolute inset-0 graph-paper-bg opacity-30 pointer-events-none"></div> <svg viewBox="0 0 1000 600" className="w-full h-full max-w-[950px] z-10 overflow-visible"> <motion.circle cx="150" cy="300" r="40" fill="none" stroke="var(--color-secondary)" strokeWidth="1" strokeDasharray="4 4" animate={{ r: [40, 60, 40], opacity: [0.5, 0, 0.5] }} transition={{ repeat: Infinity, duration: 2, ease: "easeInOut" }} /> <motion.path initial={{ pathLength: 0 }} whileInView={{ pathLength: 1 }} viewport={{ once: true }} transition={{ delay: 0.8, duration: 2, ease: "easeInOut" }} d="M 280 300 Q 350 300 380 200 Q 400 120 500 120 M 280 300 Q 380 300 500 300 M 280 300 Q 350 300 380 400 Q 400 480 500 480" fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round" className="opacity-70" /> {/* Nodes simplified for extraction */} <foreignObject x="20" y="240" width="260" height="120"> <div className="bg-secondary-container/20 p-5 rough-border text-center font-bold text-2xl h-full flex items-center justify-center"> {t('landing.ai_early_users', 'Acquire Early Users')} </div> </foreignObject> </svg> </motion.div> </section> );};
export default AIFeatureSection;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130import React from 'react';import { motion } from 'framer-motion';import { useTranslation } from 'react-i18next';
const HeroSection = () => { const { t } = useTranslation(); return ( <section className="w-full flex flex-col items-center text-center gap-10 px-margin_edge max-w-screen-2xl mx-auto py-12 md:py-24"> <div className="max-w-4xl flex flex-col gap-6"> <motion.h1 initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.6 }} className="text-5xl md:text-8xl font-display-lg text-primary leading-tight" > {t('landing.hero_title_p1', 'Plans break.')} <br /> <span className="highlighter-bg px-4">{t('landing.hero_title_p2', 'TaskFlow adapts.')}</span> </motion.h1> <motion.p initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.6, delay: 0.2 }} className="text-2xl md:text-3xl text-on-surface-variant max-w-3xl mx-auto leading-relaxed" > {t('landing.hero_desc', "The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life's \"If/Then\" moments.")} </motion.p> <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.6, delay: 0.4 }} className="mt-6 font-accent-note text-3xl text-secondary flex items-center justify-center gap-3" > <span className="material-symbols-outlined text-4xl" style={{ fontVariationSettings: '"FILL" 1' }}>psychology</span> {t('landing.hero_badge', 'ADHD-friendly. Resilience-driven.')} </motion.div> </div>
{/* Hero Visual: Mockup */} <motion.div initial={{ opacity: 0, scale: 0.95 }} whileInView={{ opacity: 1, scale: 1 }} viewport={{ once: true }} transition={{ duration: 1, ease: "easeOut" }} className="w-full max-w-5xl mt-12 relative min-h-[500px] flex items-center justify-center border-2 border-dashed border-primary/30 rounded-2xl bg-white rough-shadow p-12 overflow-visible" > {/* SVG Connections */} <svg className="absolute inset-0 w-full h-full pointer-events-none overflow-visible" style={{ zIndex: 0 }}> <defs> <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto"> <polygon points="0 0, 10 3.5, 0 7" fill="#181919" /> </marker> </defs> <motion.path initial={{ pathLength: 0 }} whileInView={{ pathLength: 1 }} viewport={{ once: true }} transition={{ duration: 1.5, ease: "easeInOut" }} d="M 180 250 Q 260 220 340 250" fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round" strokeDasharray="8 6" /> <motion.path initial={{ pathLength: 0 }} whileInView={{ pathLength: 1 }} viewport={{ once: true }} transition={{ duration: 1.2, delay: 0.5 }} d="M 460 250 Q 530 250 580 250" fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round" /> <motion.path initial={{ pathLength: 0 }} whileInView={{ pathLength: 1 }} viewport={{ once: true }} transition={{ duration: 1.2, delay: 1.5 }} d="M 720 250 Q 780 160 850 160" fill="none" stroke="#45a84a" strokeWidth="4" strokeLinecap="round" /> <motion.path initial={{ pathLength: 0 }} whileInView={{ pathLength: 1 }} viewport={{ once: true }} transition={{ duration: 1.2, delay: 1.7 }} d="M 720 250 Q 780 340 850 340" fill="none" stroke="#ba1a1a" strokeWidth="4" strokeLinecap="round" /> </svg>
{/* Nodes */} {[ { label: t('landing.node_a', 'Task A'), pos: 'left-12 top-[210px]', rot: -2, delay: 0.2 }, { label: t('landing.node_b', 'Task B'), pos: 'left-[340px] top-[210px]', rot: 1, delay: 0.4 }, { label: t('landing.node_failed', 'Failed?'), pos: 'left-[580px] top-[180px]', rot: 45, diamond: true, delay: 0.6 }, { label: t('landing.node_c', 'Task C'), pos: 'right-12 top-[120px]', rot: 2, delay: 0.8, color: '#45a84a' }, { label: t('landing.node_d', 'Task D'), pos: 'right-12 top-[300px]', rot: -1, delay: 1.0, color: '#ba1a1a' } ].map((node, i) => ( <motion.div key={i} initial={{ opacity: 0, scale: 0 }} whileInView={{ opacity: 1, scale: 1 }} animate={{ y: [0, i % 2 === 0 ? -8 : 8, 0], rotate: node.diamond ? [45, 47, 43, 45] : [node.rot, node.rot + 1, node.rot - 1, node.rot] }} transition={{ initial: { delay: node.delay, type: "spring", stiffness: 200 }, animate: { repeat: Infinity, duration: 5 + i, ease: "easeInOut" } }} viewport={{ once: true }} className={`absolute ${node.pos} z-10 flex items-center justify-center p-2 group overflow-visible`} > {node.diamond ? ( <div className="w-36 h-36 flex items-center justify-center relative"> <div className="absolute inset-0 border-4 border-primary bg-white shadow-[8px_8px_0px_0px_rgba(0,0,0,0.15)] rotate-45 transform transition-transform group-hover:scale-105" /> <span className="relative font-display-lg text-2xl text-primary font-bold">{node.label}</span> </div> ) : ( <div style={{ borderColor: node.color || 'var(--color-primary)' }} className={`bg-white p-6 border-4 rounded-xl shadow-[8px_8px_0px_0px_rgba(0,0,0,0.1)] w-40 text-center transform transition-transform group-hover:scale-105 group-hover:-rotate-2`} > <span className="text-2xl font-bold">{node.label}</span> </div> )} </motion.div> ))} </motion.div> </section> );};
export default HeroSection;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105import React from 'react';import { motion } from 'framer-motion';import { useTranslation } from 'react-i18next';
const PricingSection = () => { const { t } = useTranslation(); return ( <section id="pricing" className="w-full py-32 px-margin_edge max-w-screen-2xl mx-auto flex flex-col items-center gap-16 border-t-2 border-primary/10"> <div className="text-center"> <h2 className="text-7xl font-display-lg text-primary">{t('pricing.title', 'Simple Pricing')}</h2> <p className="font-accent-note text-4xl text-on-surface-variant mt-4 transform -rotate-2"> {t('pricing.subtitle', 'No hidden fees, just plain ink.')} </p> </div> <div className="grid grid-cols-1 md:grid-cols-3 gap-12 w-full max-w-6xl items-start"> {/* Free Tier */} <motion.div initial={{ opacity: 0, x: -20 }} whileInView={{ opacity: 1, x: 0 }} viewport={{ once: true }} className="bg-surface-container-lowest p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1" > <div> <h3 className="text-4xl font-display-lg text-primary">{t('pricing.free', 'Free')}</h3> <div className="font-accent-note text-3xl mt-2 text-secondary">$0 / {t('pricing.month', 'month')}</div> </div> <ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow"> {[ t('pricing.free_feat1', '3 Infinite Canvases'), t('pricing.free_feat2', 'Basic shapes & logic'), t('pricing.free_feat3', 'Community templates') ].map(item => ( <li key={item} className="flex items-center gap-3"> <span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item} </li> ))} </ul> <button className="w-full py-3 rough-border text-primary font-bold text-lg hover:bg-surface-variant transition-colors"> {t('pricing.start_free', 'Start Free')} </button> </motion.div>
{/* Pro Tier */} <motion.div initial={{ opacity: 0, scale: 0.9 }} whileInView={{ opacity: 1, scale: 1.05 }} viewport={{ once: true }} className="bg-surface-container-lowest p-10 rough-border rough-shadow flex flex-col gap-8 transform rotate-1 border-primary border-[4px] z-10 shadow-[10px_10px_0px_0px_var(--color-primary)] dark:shadow-[10px_10px_0px_0px_rgba(255,255,255,0.07)]" > <div> <h3 className="text-5xl font-display-lg text-primary"> <span className="highlighter-bg px-2">{t('pricing.pro', 'Pro')}</span> </h3> <div className="font-accent-note text-4xl mt-3 text-secondary">$10 / {t('pricing.month', 'month')}</div> </div> <ul className="flex flex-col gap-5 text-xl text-on-surface-variant flex-grow font-medium"> {[ t('pricing.pro_feat1', 'Unlimited Canvases'), t('pricing.pro_feat2', 'AI Path Generation'), t('pricing.pro_feat3', 'Advanced Habit Tracking'), t('pricing.pro_feat4', 'Priority Support') ].map(item => ( <li key={item} className="flex items-center gap-3"> <span className="material-symbols-outlined text-secondary font-bold text-3xl">done</span> {item} </li> ))} </ul> <button className="w-full py-4 bg-primary text-on-primary rough-border font-bold text-xl rough-shadow-hover hover:bg-secondary-container hover:text-primary transition-all"> {t('pricing.go_pro', 'Go Pro')} </button> </motion.div>
{/* Team Tier */} <motion.div initial={{ opacity: 0, x: 20 }} whileInView={{ opacity: 1, x: 0 }} viewport={{ once: true }} className="bg-surface-container-lowest p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1" > <div> <h3 className="text-4xl font-display-lg text-primary">{t('pricing.team', 'Team')}</h3> <div className="font-accent-note text-3xl mt-2 text-secondary">$25 / {t('pricing.user', 'user')}</div> </div> <ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow"> {[ t('pricing.team_feat1', 'Everything in Pro'), t('pricing.team_feat2', 'Real-time Collaboration'), t('pricing.team_feat3', 'Team Workspaces'), t('pricing.team_feat4', 'Admin Tools') ].map(item => ( <li key={item} className="flex items-center gap-3"> <span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item} </li> ))} </ul> <button className="w-full py-3 rough-border text-primary font-bold text-lg hover:bg-surface-variant transition-colors"> {t('pricing.contact_us', 'Contact Us')} </button> </motion.div> </div> </section> );};
export default PricingSection;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199// Landing page copy. Everything here describes what the product does today;// planned work is listed separately under `roadmap`.import { FREE_LIMITS, PLUS_PRICE_USD } from '../../config/plans';
const en = { nav: { product: 'Product', how: 'How it works', templates: 'Templates', pricing: 'Pricing', login: 'Log in', start: 'Start free', workspace: 'Open workspace' }, hero: { badge: 'Visual planner · free to start', title1: 'Plans break.', title2: 'Your map adapts.', subtitle: 'TaskFlow turns a goal into a map: steps, if/then forks and notes on one infinite board. Tick off a step and the board shows what comes next.', ctaPrimary: 'Start free', ctaSecondary: 'See how it works', note: `Free plan: ${FREE_LIMITS.boards} boards, no card required.`, }, demo: { goal: 'Launch the website', design: 'Design', copy: 'Write copy', check: 'Ready for review?', yes: 'Yes', no: 'No', publish: 'Publish', fix: 'Fix feedback', sticker: 'Ask Anna for the logo', autoLayout: 'Auto-layout', nextStep: 'Next step', }, facts: ['Infinite canvas', 'If/then forks', 'One-click auto-layout', 'Live collaboration', 'English & Ukrainian', 'Dark mode'], product: { kicker: 'What you get', title: 'Everything on one board', subtitle: 'No lists hiding the big picture. Your goal, its steps and the decisions in between stay visible.', features: [ { icon: 'Target', title: 'Goals as a graph', text: 'Every step is a card with a status, progress bar, tags, assignees and one of eight colors. Connect cards to show what depends on what.' }, { icon: 'GitFork', title: 'If/then forks', text: 'Condition nodes split the plan into branches: "Yes / No" or any options you need. Pick an answer and the matching branch lights up.' }, { icon: 'Footprints', title: 'Always the next step', text: 'When a step is done, the board highlights the next one on the path, so you never have to re-read the whole plan.' }, { icon: 'Network', title: 'Auto-layout', text: 'One click (or Shift+L) arranges the whole board — or just the selection — into a tidy top-down flow. Notes move with their cards.' }, { icon: 'ListTodo', title: 'Map and task list', text: 'Switch the same board to a task list with search and filters by tag or person. Same data, two views.' }, { icon: 'Users', title: 'Real-time collaboration', text: 'Invite people by email with view or edit access. See their cursors and changes live.' }, { icon: 'StickyNote', title: 'Notes, text, images, brush', text: 'Pin stickers to cards, drop in screenshots, write headings or sketch with the brush right on the canvas.' }, { icon: 'Download', title: 'Yours to take', text: 'Export a board to PNG or JSON. Undo/redo, copy and paste between boards work as you expect.' }, ], }, how: { kicker: 'How it works', title: 'From goal to next step in three moves', steps: [ { title: 'Start from a template or a blank board', text: 'Six starters cover projects, decisions, launches, learning, sprints and job search. Or save your own board as a template.' }, { title: 'Sketch the steps and the forks', text: 'Add cards, connect them, add a condition where the plan can go two ways. Press Shift+L when it gets messy.' }, { title: 'Tick things off', text: 'Mark steps as done and choose answers at forks. The board keeps pointing at what to do next.' }, ], }, templates: { kicker: 'Templates', title: 'Start with a shape, not a blank page', subtitle: 'Built-in starters are laid out automatically. Save any board — or just a selection — as your own template and insert it into other boards.', }, pricing: { kicker: 'Pricing', title: 'Two plans. No fine print.', perMonth: '/ month', free: { name: 'Free', desc: 'For planning on your own.', features: [ `Up to ${FREE_LIMITS.boards} boards`, `Up to ${FREE_LIMITS.nodesPerBoard} nodes per board`, `Up to ${FREE_LIMITS.guestsPerBoard} guests per board`, `${FREE_LIMITS.templates} saved templates`, 'All node types, auto-layout, export', ], cta: 'Start free', }, plus: { name: 'Plus', desc: 'For big plans and teams.', features: ['Unlimited boards', 'Unlimited nodes', 'Unlimited collaborators', 'Unlimited saved templates', 'Everything in Free'], cta: 'Get Plus', badge: 'No limits', }, price: PLUS_PRICE_USD, paymentsNote: 'Online payment for Plus is being connected right now.', }, roadmap: { kicker: 'In the works', title: 'What we are building next', subtitle: 'Not available yet — we would rather say so than pretend.', items: [ { icon: 'Repeat', title: 'A separate space for habits', text: 'Habits are moving out of the goal board into their own place with streaks and a calendar.' }, { icon: 'TerminalSquare', title: 'Terminal agents', text: 'Connect your own AI agents from the terminal to read and update your boards.' }, { icon: 'CreditCard', title: 'Online payment for Plus', text: 'Card payment for the Plus plan.' }, ], }, cta: { title: 'Draw your next plan', subtitle: 'It takes a minute to start. Free plan, no card.', button: 'Start free', },};
const uk = { nav: { product: 'Продукт', how: 'Як це працює', templates: 'Шаблони', pricing: 'Ціни', login: 'Увійти', start: 'Почати безкоштовно', workspace: 'Відкрити простір' }, hero: { badge: 'Візуальний планер · старт безкоштовно', title1: 'Плани ламаються.', title2: 'Ваша карта підлаштовується.', subtitle: 'TaskFlow перетворює ціль на карту: кроки, розвилки «якщо/то» і нотатки на одній нескінченній дошці. Позначте крок виконаним — і дошка покаже, що далі.', ctaPrimary: 'Почати безкоштовно', ctaSecondary: 'Як це працює', note: `Тариф Free: ${FREE_LIMITS.boards} дошок, без картки.`, }, demo: { goal: 'Запустити сайт', design: 'Дизайн', copy: 'Написати тексти', check: 'Готово до перевірки?', yes: 'Так', no: 'Ні', publish: 'Опублікувати', fix: 'Виправити зауваження', sticker: 'Попросити в Анни логотип', autoLayout: 'Авто-розкладка', nextStep: 'Наступний крок', }, facts: ['Нескінченний холст', 'Розвилки «якщо/то»', 'Авто-розкладка в один клік', 'Спільна робота наживо', 'Українська та англійська', 'Темна тема'], product: { kicker: 'Що ви отримуєте', title: 'Усе на одній дошці', subtitle: 'Жодних списків, за якими не видно картини. Ціль, кроки і рішення між ними завжди перед очима.', features: [ { icon: 'Target', title: 'Цілі у вигляді графа', text: 'Кожен крок — картка зі статусом, прогресом, тегами, виконавцями і одним із восьми кольорів. З’єднуйте картки, щоб показати залежності.' }, { icon: 'GitFork', title: 'Розвилки «якщо/то»', text: 'Вузли-умови ділять план на гілки: «Так / Ні» або будь-які варіанти. Оберіть відповідь — і відповідна гілка підсвітиться.' }, { icon: 'Footprints', title: 'Завжди видно наступний крок', text: 'Коли крок виконано, дошка підсвічує наступний на шляху — не треба перечитувати весь план.' }, { icon: 'Network', title: 'Авто-розкладка', text: 'Один клік (або Shift+L) впорядковує всю дошку чи лише виділене в акуратний потік згори донизу. Нотатки рухаються разом із картками.' }, { icon: 'ListTodo', title: 'Карта і список задач', text: 'Перемкніть ту саму дошку на список із пошуком і фільтрами за тегом чи людиною. Ті самі дані — два види.' }, { icon: 'Users', title: 'Спільна робота наживо', text: 'Запрошуйте людей за email з правом перегляду чи редагування. Бачите їхні курсори та зміни в реальному часі.' }, { icon: 'StickyNote', title: 'Нотатки, текст, зображення, пензель', text: 'Чіпляйте стікери до карток, вставляйте скриншоти, пишіть заголовки або малюйте пензлем прямо на холсті.' }, { icon: 'Download', title: 'Ваші дані — ваші', text: 'Експорт дошки в PNG або JSON. Скасування/повтор, копіювання між дошками працюють як звично.' }, ], }, how: { kicker: 'Як це працює', title: 'Від цілі до наступного кроку за три дії', steps: [ { title: 'Почніть із шаблону або порожньої дошки', text: 'Шість стартових шаблонів: проєкти, рішення, запуск продукту, навчання, спринти, пошук роботи. Або збережіть власну дошку як шабло��.' }, { title: 'Накидайте кроки й розвилки', text: 'Додайте картки, з’єднайте їх, поставте умову там, де план може піти двома шляхами. Стало безладно — Shift+L.' }, { title: 'Позначайте виконане', text: 'Відмічайте кроки й обирайте відповіді на розвилках. Дошка весь час показує, що робити далі.' }, ], }, templates: { kicker: 'Шаблони', title: 'Почніть з форми, а не з порожнього аркуша', subtitle: 'Вбудовані шаблони розкладаються автоматично. Збережіть будь-яку дошку чи виділений фрагмент як свій шаблон і вставляйте його в інші дошки.', }, pricing: { kicker: 'Ціни', title: 'Два тарифи. Без дрібного шрифту.', perMonth: '/ міс', free: { name: 'Free', desc: 'Для власних планів.', features: [ `До ${FREE_LIMITS.boards} дошок`, `До ${FREE_LIMITS.nodesPerBoard} вузлів на дошці`, `До ${FREE_LIMITS.guestsPerBoard} гостей на дошці`, `${FREE_LIMITS.templates} збережені шаблони`, 'Усі типи вузлів, авто-розкладка, експорт', ], cta: 'Почати безкоштовно', }, plus: { name: 'Plus', desc: 'Для великих планів і команд.', features: ['Безліміт дошок', 'Безліміт вузлів', 'Безліміт учасників', 'Безліміт шаблонів', 'Усе з Free'], cta: 'Отримати Plus', badge: 'Без лімітів', }, price: PLUS_PRICE_USD, paymentsNote: 'Онлайн-оплату Plus зараз підключаємо.', }, roadmap: { kicker: 'У розробці', title: 'Що ми робимо далі', subtitle: 'Цього ще немає — краще сказати чесно.', items: [ { icon: 'Repeat', title: 'Окремий простір для звичок', text: 'Звички переїжджають з дошки цілей у власний розділ із серіями та календарем.' }, { icon: 'TerminalSquare', title: 'Термінальні агенти', text: 'Підключайте власних ШІ-агентів з терміналу, щоб вони читали й оновлювали ваші дошки.' }, { icon: 'CreditCard', title: 'Онлайн-оплата Plus', text: 'Оплата тарифу Plus карткою.' }, ], }, cta: { title: 'Намалюйте свій наступний план', subtitle: 'Старт займає хвилину. Тариф Free, без картки.', button: 'Почати безкоштовно', },};
export const getLandingCopy = (lang) => (lang?.startsWith('uk') ? uk : en);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146import React, { useState } from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import { useNavigate } from 'react-router-dom';import { X, BookOpen, Check, Loader2 } from 'lucide-react';import TemplatePreview from './TemplatePreview';import { createTemplate } from './templatesApi';
/** * Saves the board — or only the selected nodes — as a personal template. * `serialize(selectedOnly)` returns the template content from the canvas. */const SaveTemplateModal = ({ open, onClose, serialize, selectedCount, initialTitle, initialDesc }) => { const { t } = useTranslation(); const navigate = useNavigate(); const [title, setTitle] = useState(initialTitle || ''); const [desc, setDesc] = useState(initialDesc || ''); const [category, setCategory] = useState(''); const [selectedOnly, setSelectedOnly] = useState(selectedCount >= 2); const [saving, setSaving] = useState(false); const [error, setError] = useState(''); const [limitHit, setLimitHit] = useState(false); const [done, setDone] = useState(false);
const content = open ? serialize(selectedOnly) : null;
const handleSubmit = async (e) => { e.preventDefault(); if (!title.trim() || !content?.nodes.length) return; setSaving(true); setError(''); setLimitHit(false); try { await createTemplate({ title: title.trim(), description: desc.trim(), category: category.trim() || t('templates.my_category', 'My templates'), icon: 'BookOpen', content, }); setDone(true); setTimeout(onClose, 1100); } catch (err) { const msg = err.response?.data?.message || t('templates.save_failed', 'Could not save the template.'); setError(msg); setLimitHit(/plan|limit/i.test(msg)); } finally { setSaving(false); } };
return ( <AnimatePresence> {open && ( <div className="fixed inset-0 z-[70] flex items-center justify-center p-4"> <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} onClick={onClose} className="absolute inset-0 bg-primary/25 backdrop-blur-sm" /> <motion.div initial={{ opacity: 0, y: 24, rotate: -1 }} animate={{ opacity: 1, y: 0, rotate: 0 }} exit={{ opacity: 0, y: 24 }} transition={{ type: 'spring', stiffness: 260, damping: 24 }} className="relative z-10 bg-surface-container-lowest w-full max-w-lg p-8 rough-border rough-shadow flex flex-col gap-5 max-h-[92vh] overflow-y-auto" > <button type="button" onClick={onClose} className="absolute top-4 right-4 text-on-surface-variant hover:text-primary cursor-pointer"> <X size={24} /> </button> <h3 className="text-3xl font-display-lg text-primary flex items-center gap-2"> <BookOpen size={24} /> <span>{t('templates.save_title', 'Save as template')}</span> </h3>
{done ? ( <motion.div initial={{ scale: 0.6, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} className="py-8 flex flex-col items-center gap-3 text-primary"> <div className="w-16 h-16 rounded-full bg-secondary flex items-center justify-center border-4 border-primary"><Check size={32} /></div> <span className="font-bold text-lg">{t('templates.saved', 'Template saved')}</span> </motion.div> ) : ( <form onSubmit={handleSubmit} className="flex flex-col gap-5"> <div className="rounded-xl border-2 border-primary/10 graph-paper-bg px-3 pt-3"> <TemplatePreview content={content} height={150} /> </div>
{selectedCount >= 2 && ( <div className="flex bg-secondary/5 border-2 border-primary rounded-xl p-1"> {[false, true].map((only) => ( <button key={String(only)} type="button" onClick={() => setSelectedOnly(only)} className={`flex-1 py-2 rounded-lg text-xs font-bold uppercase tracking-wider cursor-pointer transition-colors ${selectedOnly === only ? 'bg-primary text-on-primary' : 'text-primary'}`} > {only ? t('templates.only_selected', { count: selectedCount, defaultValue: `Selected (${selectedCount})` }) : t('templates.whole_board', 'Whole board')} </button> ))} </div> )}
<label className="flex flex-col gap-1"> <span className="text-xs font-bold text-primary uppercase tracking-wider">{t('templates.field_title', 'Title')}</span> <input value={title} onChange={(e) => setTitle(e.target.value)} maxLength={80} required className="bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-2 text-lg outline-none" /> </label> <label className="flex flex-col gap-1"> <span className="text-xs font-bold text-primary uppercase tracking-wider">{t('templates.field_desc', 'Description')}</span> <textarea rows={2} value={desc} onChange={(e) => setDesc(e.target.value)} maxLength={300} className="bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-2 outline-none resize-none" /> </label> <label className="flex flex-col gap-1"> <span className="text-xs font-bold text-primary uppercase tracking-wider">{t('templates.field_category', 'Category')}</span> <input value={category} onChange={(e) => setCategory(e.target.value)} placeholder={t('templates.my_category', 'My templates')} maxLength={40} className="bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-2 outline-none" /> </label>
<p className="text-[11px] text-on-surface-variant"> {t('templates.save_hint', 'Statuses, progress and assignees are not saved — the template is a clean starting point.')} </p>
{error && ( <div className="bg-error/10 text-error p-3 rough-border text-sm font-bold flex flex-col gap-2"> <span>{error}</span> {limitHit && ( <button type="button" onClick={() => navigate('/subscription')} className="self-start underline cursor-pointer"> {t('templates.go_plus', 'Plus removes the limit')} </button> )} </div> )}
<div className="flex gap-3"> <button type="button" onClick={onClose} className="flex-1 py-3 text-sm font-bold border-2 border-primary/10 rounded-xl hover:bg-primary/5 cursor-pointer"> {t('common.cancel', 'Cancel')} </button> <button type="submit" disabled={saving || !title.trim() || !content?.nodes.length} className="flex-1 py-3 text-sm font-bold text-on-primary bg-primary border-2 border-primary rounded-xl cursor-pointer disabled:opacity-50 flex items-center justify-center gap-2"> {saving && <Loader2 size={16} className="animate-spin" />} {t('templates.save_btn', 'Save template')} </button> </div> </form> )} </motion.div> </div> )} </AnimatePresence> );};
export default SaveTemplateModal;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322import React, { useEffect, useMemo, useState } from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import { useNavigate } from 'react-router-dom';import { X, Search, Plus, Trash2, Loader2, LayoutTemplate, Milestone, GitFork, Rocket, GraduationCap, CalendarRange, Briefcase, BookOpen, FilePlus2,} from 'lucide-react';import TemplatePreview from './TemplatePreview';import { getBuiltinTemplates } from './builtinTemplates';import { fetchMyTemplates, deleteTemplate } from './templatesApi';import { useAuth } from '../../context/AuthContext';import { FREE_LIMITS, isPlus } from '../../config/plans';
const ICONS = { LayoutTemplate, Milestone, GitFork, Rocket, GraduationCap, CalendarRange, Briefcase, BookOpen };
const BLANK = { id: 'blank', blank: true, content: { nodes: [], edges: [] } };
/** * Template picker. * mode="create": first card is a blank board, the footer asks for the board name; onUse(template | null, title). * mode="insert": picks a template to drop onto the current board; onUse(template). */const TemplateGallery = ({ open, onClose, mode = 'create', onUse, busy = false }) => { const { t, i18n } = useTranslation(); const { user } = useAuth(); const navigate = useNavigate();
const [tab, setTab] = useState('all'); // all | builtin | mine const [category, setCategory] = useState('all'); const [query, setQuery] = useState(''); const [mine, setMine] = useState([]); const [mineLoading, setMineLoading] = useState(false); const [selected, setSelected] = useState(null); const [boardTitle, setBoardTitle] = useState(''); const [confirmDeleteId, setConfirmDeleteId] = useState(null);
const builtin = useMemo(() => getBuiltinTemplates(i18n.language), [i18n.language]);
useEffect(() => { if (!open) return; setSelected(mode === 'create' ? BLANK : null); setBoardTitle(''); setQuery(''); setCategory('all'); setConfirmDeleteId(null); setMineLoading(true); fetchMyTemplates() .then(setMine) .catch((err) => console.error('[Templates] Failed to load user templates', err)) .finally(() => setMineLoading(false)); }, [open, mode]);
const source = tab === 'builtin' ? builtin : tab === 'mine' ? mine : [...mine, ...builtin]; const categories = useMemo(() => [...new Set(source.map((tpl) => tpl.category).filter(Boolean))], [source]); const q = query.trim().toLowerCase(); const visible = source.filter((tpl) => (category === 'all' || tpl.category === category) && (!q || tpl.title.toLowerCase().includes(q) || (tpl.description || '').toLowerCase().includes(q)) );
const handleSelect = (tpl) => { setSelected(tpl); if (mode === 'create' && !tpl.blank && (!boardTitle || builtin.some((b) => b.title === boardTitle) || mine.some((m) => m.title === boardTitle))) { setBoardTitle(tpl.title); } };
const handleDelete = async (tpl) => { try { await deleteTemplate(tpl.id); setMine((list) => list.filter((m) => m.id !== tpl.id)); if (selected?.id === tpl.id) setSelected(mode === 'create' ? BLANK : null); } catch (err) { console.error('[Templates] Delete failed', err); } finally { setConfirmDeleteId(null); } };
const submit = (e) => { e?.preventDefault(); if (!selected || busy) return; if (mode === 'create') { const title = boardTitle.trim() || (selected.blank ? t('templates.untitled', 'Untitled board') : selected.title); onUse(selected.blank ? null : selected, title); } else { onUse(selected); } };
const userIsPlus = isPlus(user); const tabs = [ { key: 'all', label: t('templates.tab_all', 'All') }, { key: 'builtin', label: t('templates.tab_builtin', 'Starters') }, { key: 'mine', label: t('templates.tab_mine', 'My templates') }, ];
const renderCard = (tpl, index) => { const isSelected = selected?.id === tpl.id; const Icon = tpl.blank ? FilePlus2 : ICONS[tpl.icon] || LayoutTemplate; const nodeCount = tpl.content?.nodes?.length || 0; return ( <motion.div layout key={tpl.id} initial={{ opacity: 0, y: 16 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, scale: 0.95 }} transition={{ delay: Math.min(index, 8) * 0.03 }} onClick={() => handleSelect(tpl)} onDoubleClick={() => { handleSelect(tpl); if (mode === 'insert') onUse(tpl); }} className={`group relative flex flex-col rounded-2xl border-2 cursor-pointer overflow-hidden transition-all ${ isSelected ? 'border-primary bg-primary/5 shadow-[4px_4px_0px_0px_var(--color-primary)] -translate-y-0.5' : 'border-primary/15 bg-surface-container-low hover:border-primary/40 hover:-translate-y-0.5' }`} > <div className="relative bg-surface-container-lowest border-b-2 border-primary/10 graph-paper-bg px-3 pt-3"> {tpl.blank ? ( <div className="h-[170px] flex items-center justify-center"> <Plus size={44} className="text-primary/30 group-hover:text-primary/60 group-hover:rotate-90 transition-all duration-300" /> </div> ) : ( <TemplatePreview content={tpl.content} height={170} /> )} {!tpl.builtIn && !tpl.blank && ( <div className="absolute top-2 right-2" onClick={(e) => e.stopPropagation()}> {confirmDeleteId === tpl.id ? ( <div className="flex items-center gap-1 bg-surface-container-lowest border-2 border-primary rounded-lg p-1"> <button onClick={() => handleDelete(tpl)} className="px-2 py-0.5 text-[10px] font-bold uppercase text-white bg-red-500 rounded cursor-pointer"> {t('templates.delete_confirm', 'Delete')} </button> <button onClick={() => setConfirmDeleteId(null)} className="px-2 py-0.5 text-[10px] font-bold uppercase text-primary cursor-pointer"> {t('common.cancel', 'Cancel')} </button> </div> ) : ( <button onClick={() => setConfirmDeleteId(tpl.id)} title={t('templates.delete', 'Delete template')} className="p-1.5 bg-surface-container-lowest border-2 border-primary/20 rounded-lg text-red-500 opacity-0 group-hover:opacity-100 hover:border-red-500 transition-all cursor-pointer" > <Trash2 size={14} /> </button> )} </div> )} </div> <div className="p-4 flex gap-3"> <div className={`w-10 h-10 shrink-0 rounded-xl flex items-center justify-center transition-colors ${isSelected ? 'bg-primary text-on-primary' : 'bg-primary/10 text-primary'}`}> <Icon size={20} /> </div> <div className="min-w-0 flex flex-col gap-1"> <span className="font-bold text-primary leading-tight"> {tpl.blank ? t('templates.blank', 'Blank board') : tpl.title} </span> <div className="flex items-center gap-2 flex-wrap"> {!tpl.blank && tpl.category && ( <span className="text-[9px] uppercase font-bold tracking-wider px-1.5 py-0.5 rounded-sm bg-secondary/15 text-secondary">{tpl.category}</span> )} {!tpl.blank && ( <span className="text-[10px] font-bold text-on-surface-variant/60"> {t('templates.node_count', { count: nodeCount, defaultValue: `${nodeCount} nodes` })} </span> )} </div> <p className="text-xs text-on-surface-variant/80 line-clamp-2"> {tpl.blank ? t('templates.blank_desc', 'Start from an empty canvas.') : tpl.description} </p> </div> </div> </motion.div> ); };
return ( <AnimatePresence> {open && ( <div className="fixed inset-0 z-[70] flex items-center justify-center p-4 sm:p-6"> <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} onClick={onClose} className="absolute inset-0 bg-primary/25 backdrop-blur-sm" /> <motion.div initial={{ opacity: 0, y: 30, scale: 0.97 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={{ opacity: 0, y: 30, scale: 0.97 }} transition={{ type: 'spring', stiffness: 260, damping: 26 }} className="relative z-10 w-full max-w-5xl max-h-[92vh] flex flex-col bg-surface-container-lowest rough-border rough-shadow" > {/* Header */} <div className="p-6 pb-4 flex flex-col gap-4 border-b-2 border-primary/10"> <div className="flex items-start justify-between gap-4"> <div> <h3 className="text-3xl font-display-lg text-primary flex items-center gap-2"> <LayoutTemplate size={26} /> <span>{mode === 'create' ? t('templates.create_title', 'New board') : t('templates.insert_title', 'Insert a template')}</span> </h3> <p className="text-sm text-on-surface-variant mt-1"> {mode === 'create' ? t('templates.create_desc', 'Start empty or from a template. Templates are laid out automatically.') : t('templates.insert_desc', 'The template is added to the center of the screen and stays selected so you can move it.')} </p> </div> <button onClick={onClose} className="p-1 text-on-surface-variant hover:text-primary transition-colors cursor-pointer"> <X size={24} /> </button> </div>
<div className="flex flex-col md:flex-row gap-3 md:items-center"> <div className="flex bg-secondary/5 border-2 border-primary rounded-xl p-1 shrink-0"> {tabs.map((tb) => ( <button key={tb.key} onClick={() => { setTab(tb.key); setCategory('all'); }} className={`relative px-4 py-1.5 rounded-lg text-xs font-bold uppercase tracking-wider cursor-pointer transition-colors ${tab === tb.key ? 'text-on-primary' : 'text-primary hover:bg-secondary/10'}`} > {tab === tb.key && ( <motion.span layoutId="tpl-tab" className="absolute inset-0 bg-primary rounded-lg" transition={{ type: 'spring', stiffness: 400, damping: 32 }} /> )} <span className="relative">{tb.label}{tb.key === 'mine' && mine.length > 0 ? ` · ${mine.length}` : ''}</span> </button> ))} </div> <div className="relative flex-grow"> <Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-on-surface-variant" /> <input value={query} onChange={(e) => setQuery(e.target.value)} placeholder={t('templates.search', 'Search templates...')} className="w-full pl-9 pr-3 py-2 bg-surface-container-low border-2 border-transparent focus:border-primary rounded-xl text-sm outline-none transition-all" /> </div> </div>
{categories.length > 1 && ( <div className="flex gap-2 flex-wrap"> {['all', ...categories].map((c) => ( <button key={c} onClick={() => setCategory(c)} className={`px-3 py-1 rounded-full text-[11px] font-bold border-2 cursor-pointer transition-all ${ category === c ? 'bg-secondary text-primary border-primary' : 'border-primary/15 text-primary/70 hover:border-primary/40' }`} > {c === 'all' ? t('templates.all_categories', 'All categories') : c} </button> ))} </div> )} </div>
{/* Grid */} <div className="flex-grow overflow-y-auto p-6 custom-scrollbar"> {tab === 'mine' && mineLoading ? ( <div className="flex justify-center py-16"><Loader2 className="animate-spin text-primary" size={28} /></div> ) : ( <motion.div layout className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5"> <AnimatePresence mode="popLayout"> {mode === 'create' && tab !== 'mine' && !q && category === 'all' && renderCard(BLANK, 0)} {visible.map((tpl, i) => renderCard(tpl, i + 1))} </AnimatePresence> </motion.div> )} {!mineLoading && visible.length === 0 && ( <div className="text-center py-12 flex flex-col items-center gap-2"> <span className="font-accent-note text-2xl text-secondary"> {tab === 'mine' && !q ? t('templates.empty_mine', 'No saved templates yet') : t('templates.nothing_found', 'Nothing found')} </span> {tab === 'mine' && !q && ( <p className="text-sm text-on-surface-variant max-w-sm"> {t('templates.empty_mine_hint', 'Open any board and press "Save as template" — the whole board or just the selected nodes.')} </p> )} </div> )} </div>
{/* Footer */} <form onSubmit={submit} className="p-5 border-t-2 border-primary/10 flex flex-col sm:flex-row gap-3 sm:items-center"> <div className="flex-grow text-xs text-on-surface-variant"> {!userIsPlus && ( <span> {t('templates.free_note', { used: mine.length, max: FREE_LIMITS.templates, defaultValue: `Free plan: ${mine.length}/${FREE_LIMITS.templates} saved templates.` })}{' '} <button type="button" onClick={() => navigate('/subscription')} className="font-bold text-secondary underline cursor-pointer"> {t('templates.go_plus', 'Plus removes the limit')} </button> </span> )} </div> {mode === 'create' && ( <input autoFocus value={boardTitle} onChange={(e) => setBoardTitle(e.target.value)} placeholder={t('dashboard.project_name_placeholder', 'Board name')} className="sm:w-72 bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-3 py-2 font-body-md outline-none transition-all" /> )} <motion.button whileHover={{ scale: selected ? 1.04 : 1 }} whileTap={{ scale: selected ? 0.97 : 1 }} type="submit" disabled={!selected || busy} className="bg-primary text-on-primary px-7 py-3 text-lg font-bold rough-border flex items-center justify-center gap-2 cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed" > {busy ? <Loader2 size={18} className="animate-spin" /> : <Plus size={18} />} <span>{mode === 'create' ? t('templates.create_btn', 'Create board') : t('templates.insert_btn', 'Insert')}</span> </motion.button> </form> </motion.div> </div> )} </AnimatePresence> );};
export default TemplateGallery;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105import React, { useMemo } from 'react';import { motion } from 'framer-motion';import { layoutFresh, getNodeSize } from '../canvas/layout';
const NODE_FILL = { blue: '#dbeafe', green: '#dcfce7', pink: '#fce7f3', purple: '#f3e8ff', orange: '#ffedd5', yellow: '#fef9c3',};
// Miniature, non-interactive drawing of a template's graph.const TemplatePreview = ({ content, height = 140 }) => { const layout = useMemo(() => { const nodes = content?.nodes || []; const edges = content?.edges || []; if (nodes.length === 0) return null; const placed = nodes.some((n) => !n.position) ? layoutFresh(nodes, edges) : nodes;
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity; const boxes = placed.map((n) => { const { width, height: h } = getNodeSize(n); minX = Math.min(minX, n.position.x); minY = Math.min(minY, n.position.y); maxX = Math.max(maxX, n.position.x + width); maxY = Math.max(maxY, n.position.y + h); return { id: n.id, type: n.type, color: n.data?.color, x: n.position.x, y: n.position.y, w: width, h }; }); const byId = new Map(boxes.map((b) => [b.id, b])); const lines = edges .map((e) => [byId.get(e.source), byId.get(e.target)]) .filter(([a, b]) => a && b) .map(([a, b], i) => ({ key: i, x1: a.x + a.w / 2, y1: a.y + a.h, x2: b.x + b.w / 2, y2: b.y, sticker: a.type === 'comment' || b.type === 'comment' })); const pad = 40; // Keep strokes legible whatever the size of the graph const stroke = Math.max(6, Math.max(maxX - minX, maxY - minY) / 70); return { boxes, lines, stroke, viewBox: `${minX - pad} ${minY - pad} ${maxX - minX + pad * 2} ${maxY - minY + pad * 2}` }; }, [content]);
if (!layout) { return ( <div style={{ height }} className="w-full flex items-center justify-center text-primary/30 font-accent-note text-2xl"> ∅ </div> ); }
return ( <svg viewBox={layout.viewBox} preserveAspectRatio="xMidYMid meet" style={{ height }} className="w-full" aria-hidden="true"> {layout.lines.map((l, i) => ( <motion.path key={l.key} d={`M ${l.x1} ${l.y1} C ${l.x1} ${(l.y1 + l.y2) / 2}, ${l.x2} ${(l.y1 + l.y2) / 2}, ${l.x2} ${l.y2}`} fill="none" stroke="currentColor" strokeOpacity={l.sticker ? 0.25 : 0.55} strokeWidth={layout.stroke} strokeDasharray={l.sticker ? '18 14' : undefined} className="text-primary" initial={{ pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: 0.6, delay: 0.05 * i, ease: 'easeOut' }} /> ))} {layout.boxes.map((b, i) => { const fill = NODE_FILL[b.color] || (b.type === 'comment' ? NODE_FILL.yellow : 'var(--color-surface-container-lowest, #fff)'); const common = { initial: { opacity: 0, scale: 0.6 }, animate: { opacity: 1, scale: 1 }, transition: { delay: 0.04 * i, type: 'spring', stiffness: 260, damping: 20 }, style: { transformOrigin: `${b.x + b.w / 2}px ${b.y + b.h / 2}px`, transformBox: 'view-box' }, }; if (b.type === 'condition') { const cx = b.x + b.w / 2; const cy = b.y + b.h / 2; return ( <motion.polygon key={b.id} {...common} points={`${cx},${b.y} ${b.x + b.w},${cy} ${cx},${b.y + b.h} ${b.x},${cy}`} fill={fill} stroke="currentColor" strokeWidth={layout.stroke} className="text-primary" /> ); } return ( <motion.rect key={b.id} {...common} x={b.x} y={b.y} width={b.w} height={b.h} rx={b.type === 'comment' ? 6 : 28} fill={fill} stroke="currentColor" strokeWidth={layout.stroke} className="text-primary" /> ); })} </svg> );};
export default TemplatePreview;123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174// Built-in starter templates. Nodes have no positions: they are arranged by the// auto-layout when inserted, so every template stays tidy whatever the label lengths.// Text is given as [en, uk].
const L = (lang, pair) => (lang?.startsWith('uk') ? pair[1] : pair[0]);
const goal = (id, label, description, extra = {}) => ({ id, type: 'sketch', label, description, ...extra });const choice = (id, label, yes, no) => ({ id, type: 'condition', label, yes, no });const note = (id, label, color = 'yellow') => ({ id, type: 'comment', label, color });
// Compact definitions; `edges` are [from, to, branch?] where branch is 'yes' | 'no' for conditions.const DEFINITIONS = [ { key: 'project-phases', icon: 'Milestone', category: ['Projects', 'Проєкти'], title: ['Project in phases', 'Проєкт по етапах'], description: ['Goal, three phases, launch and a retrospective.', 'Ціль, три етапи, запуск і ретроспектива.'], nodes: [ goal('goal', ['Project goal', 'Ціль проєкту'], ['What does "done" look like?', 'Як виглядає «готово»?'], { color: 'blue' }), goal('plan', ['Plan & scope', 'План і обсяг'], ['List the deliverables and the deadline.', 'Перелік результатів і дедлайн.']), goal('p1', ['Phase 1', 'Етап 1'], ['First milestone', 'Перша віха']), goal('p2', ['Phase 2', 'Етап 2'], ['Second milestone', 'Друга віха']), goal('p3', ['Phase 3', 'Етап 3'], ['Final milestone', 'Фінальна віха']), goal('launch', ['Launch', 'Запуск'], ['Ship it and announce.', 'Випустити й оголосити.'], { color: 'green' }), goal('retro', ['Retrospective', 'Ретроспектива'], ['What worked, what to change next time.', 'Що спрацювало, що змінити наступного разу.']), note('n1', ['Tip: select nodes and press Shift+L to tidy them up.', 'Порада: виділіть ноди й натисніть Shift+L, щоб упорядкувати їх.']), ], edges: [['goal', 'plan'], ['plan', 'p1'], ['p1', 'p2'], ['p2', 'p3'], ['p3', 'launch'], ['launch', 'retro'], ['n1', 'plan']], }, { key: 'decision', icon: 'GitFork', category: ['Decisions', 'Рішення'], title: ['Decision with a fork', 'Рішення з розвилкою'], description: ['A yes/no checkpoint with a plan for each outcome.', 'Контрольна точка «так/ні» з планом для кожного результату.'], nodes: [ goal('problem', ['Problem', 'Проблема'], ['Describe what needs a decision.', 'Опишіть, що потребує рішення.'], { color: 'orange' }), goal('research', ['Gather facts', 'Зібрати факти'], ['Data, opinions, constraints.', 'Дані, думки, обмеження.']), choice('check', ['Is option A viable?', 'Варіант A реальний?'], ['Yes', 'Так'], ['No', 'Ні']), goal('a', ['Go with A', 'Обрати A'], ['Next concrete step for A.', 'Наступний конкретний крок для A.'], { color: 'green' }), goal('b', ['Plan B', 'План Б'], ['Fallback path.', 'Запасний шлях.'], { color: 'pink' }), goal('review', ['Review in 2 weeks', 'Переглянути через 2 тижні'], ['Did the choice pay off?', 'Чи виправдав себе вибір?']), ], edges: [['problem', 'research'], ['research', 'check'], ['check', 'a', 'yes'], ['check', 'b', 'no'], ['a', 'review'], ['b', 'review']], }, { key: 'product-launch', icon: 'Rocket', category: ['Projects', 'Проєкти'], title: ['Product launch', 'Запуск продукту'], description: ['From idea to launch, with a demand check before building.', 'Від ідеї до запуску з перевіркою попиту до розробки.'], nodes: [ goal('idea', ['Idea', 'Ідея'], ['One sentence: who is it for and why?', 'Одне речення: для кого і навіщо?'], { color: 'purple' }), goal('interviews', ['Talk to 10 users', 'Поговорити з 10 користувачами'], ['Validate the problem.', 'Перевірити проблему.']), choice('demand', ['Is there demand?', 'Є попит?'], ['Yes', 'Так'], ['No', 'Ні']), goal('mvp', ['Build MVP', 'Зробити MVP'], ['Smallest version that solves the problem.', 'Найменша версія, що вирішує проблему.']), goal('pivot', ['Pivot the idea', 'Змінити ідею'], ['Adjust the audience or the problem.', 'Змінити аудиторію або проблему.'], { color: 'pink' }), goal('beta', ['Closed beta', 'Закрита бета'], ['5–20 real users.', '5–20 реальних користувачів.']), goal('launch', ['Public launch', 'Публічний запуск'], ['Landing page, announcement, feedback loop.', 'Лендинг, анонс, збір відгуків.'], { color: 'green' }), ], edges: [['idea', 'interviews'], ['interviews', 'demand'], ['demand', 'mvp', 'yes'], ['demand', 'pivot', 'no'], ['mvp', 'beta'], ['beta', 'launch']], }, { key: 'learning', icon: 'GraduationCap', category: ['Learning', 'Навчання'], title: ['Learning roadmap', 'План навчання'], description: ['Basics, practice, deeper topics and a portfolio piece.', 'Основи, практика, поглиблення і проєкт у портфоліо.'], nodes: [ goal('skill', ['Skill to learn', 'Навичка'], ['Why do you need it?', 'Навіщо вона вам?'], { color: 'blue' }), goal('basics', ['Basics', 'Основи'], ['Course or book, 1–2 weeks.', 'Курс або книга, 1–2 тижні.']), goal('practice', ['Small practice project', 'Невеликий практичний проєкт'], ['Apply the basics right away.', 'Одразу застосувати основи.']), goal('advanced', ['Advanced topics', 'Поглиблені теми'], ['Pick 2–3 topics that matter for you.', 'Оберіть 2–3 важливі для вас теми.']), goal('portfolio', ['Portfolio piece', 'Проєкт у портфоліо'], ['Something you can show.', 'Те, що можна показати.'], { color: 'green' }), note('res', ['Resources: add links here.', 'Ресурси: додайте посилання сюди.']), ], edges: [['skill', 'basics'], ['basics', 'practice'], ['practice', 'advanced'], ['advanced', 'portfolio'], ['res', 'basics']], }, { key: 'sprint', icon: 'CalendarRange', category: ['Teams', 'Команди'], title: ['Two-week sprint', 'Двотижневий спринт'], description: ['Sprint goal, parallel tasks, review and demo.', 'Ціль спринту, паралельні задачі, рев’ю і демо.'], nodes: [ goal('goal', ['Sprint goal', 'Ціль спринту'], ['One outcome the team commits to.', 'Один результат, який команда обіцяє.'], { color: 'blue' }), goal('t1', ['Task A', 'Задача A'], ['Owner, estimate.', 'Відповідальний, оцінка.']), goal('t2', ['Task B', 'Задача B'], ['Owner, estimate.', 'Відповідальний, оцінка.']), goal('t3', ['Task C', 'Задача C'], ['Owner, estimate.', 'Відповідальний, оцінка.']), goal('review', ['Code / work review', 'Рев’ю роботи'], ['Check quality before the demo.', 'Перевірити якість до демо.']), goal('demo', ['Demo & retro', 'Демо і ретро'], ['Show results, agree on improvements.', 'Показати результат, домовитися про покращення.'], { color: 'green' }), ], edges: [['goal', 't1'], ['goal', 't2'], ['goal', 't3'], ['t1', 'review'], ['t2', 'review'], ['t3', 'review'], ['review', 'demo']], }, { key: 'job-search', icon: 'Briefcase', category: ['Career', 'Кар’єра'], title: ['Job search', 'Пошук роботи'], description: ['CV, applications and what to do after each answer.', 'Резюме, відгуки і що робити після кожної відповіді.'], nodes: [ goal('target', ['Target role', 'Бажана посада'], ['Role, level, location, salary range.', 'Посада, рівень, локація, зарплата.'], { color: 'blue' }), goal('cv', ['Update CV & profile', 'Оновити резюме і профіль'], ['Tailor to the target role.', 'Під цільову посаду.']), goal('apply', ['Send 20 applications', 'Надіслати 20 відгуків'], ['Track them in a list.', 'Ведіть їх у списку.']), choice('invite', ['Got interviews?', 'Є запрошення?'], ['Yes', 'Так'], ['No', 'Ні']), goal('prepare', ['Prepare for interviews', 'Підготуватися до співбесід'], ['Stories, questions, test tasks.', 'Історії, питання, тестові.']), goal('improve', ['Improve CV, ask for feedback', 'Покращити резюме, попросити фідбек'], ['Change one thing at a time.', 'Змінюйте по одному.'], { color: 'pink' }), goal('offer', ['Offer', 'Офер'], ['Compare and negotiate.', 'Порівняти й домовитися.'], { color: 'green' }), ], edges: [['target', 'cv'], ['cv', 'apply'], ['apply', 'invite'], ['invite', 'prepare', 'yes'], ['invite', 'improve', 'no'], ['prepare', 'offer']], },];
const toContent = (def, lang) => { const nodes = def.nodes.map((n) => { if (n.type === 'condition') { return { id: n.id, type: 'condition', data: { label: L(lang, n.label), options: [ { id: 'opt-yes', label: L(lang, n.yes) }, { id: 'opt-no', label: L(lang, n.no) }, ], selectedOptions: [], multiSelect: false, }, }; } if (n.type === 'comment') { return { id: n.id, type: 'comment', width: 220, height: 150, data: { label: L(lang, ['Note', 'Нотатка']), description: L(lang, n.label), color: n.color }, }; } return { id: n.id, type: 'sketch', data: { label: L(lang, n.label), description: L(lang, n.description), color: n.color, decision: 'bottom' }, }; });
const typeOf = (id) => def.nodes.find((n) => n.id === id)?.type; const edges = def.edges.map(([from, to, branch], i) => { if (typeOf(from) === 'comment' || typeOf(to) === 'comment') { return { id: `e${i}`, source: from, target: to, sourceHandle: null, targetHandle: null }; } return { id: `e${i}`, source: from, target: to, sourceHandle: typeOf(from) === 'condition' ? (branch === 'no' ? 'opt-no' : 'opt-yes') : 'main-source', targetHandle: 'main-target', }; });
return { version: 2, nodes, edges };};
export const getBuiltinTemplates = (lang) => DEFINITIONS.map((def) => ({ id: `builtin:${def.key}`, builtIn: true, icon: def.icon, category: L(lang, def.category), title: L(lang, def.title), description: L(lang, def.description), content: toContent(def, lang), }));123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121import axios from 'axios';
const API_URL = import.meta.env.VITE_API_URL;
// Templates saved before the v2 format stored backend node DTOs ({ Nodes: [{ Label, PosX, ... }] }).const convertLegacy = (legacy) => { const nodes = (legacy.Nodes || legacy.nodes || []).map((n) => { const type = n.Type || n.type || 'sketch'; let extra = {}; const decision = n.Decision ?? n.decision; if (typeof decision === 'string' && decision.startsWith('{')) { try { const parsed = JSON.parse(decision); extra = type === 'condition' ? { options: parsed.options || [], multiSelect: !!parsed.multiSelect } : { description: parsed.description, tags: parsed.tags || [], color: parsed.color }; } catch { // keep defaults } } return { id: String(n.Id || n.id), type, position: { x: n.PosX ?? n.posX ?? 0, y: n.PosY ?? n.posY ?? 0 }, data: { label: n.Label || n.label || '', description: n.Description || n.description || '', color: n.Color || n.color || undefined, ...extra, }, }; }).filter((n) => n.type !== 'habit' && n.type !== 'path');
const ids = new Set(nodes.map((n) => n.id)); const typeOf = (id) => nodes.find((n) => n.id === id)?.type; const edges = (legacy.Edges || legacy.edges || []) .map((e, i) => { const source = String(e.FromNodeId || e.fromNodeId); const target = String(e.ToNodeId || e.toNodeId); const condition = e.Condition || e.condition; return { id: `legacy-${i}`, source, target, sourceHandle: typeOf(source) === 'condition' ? (condition === 'False' ? 'opt-no' : 'opt-yes') : 'main-source', targetHandle: 'main-target', }; }) .filter((e) => ids.has(e.source) && ids.has(e.target));
return { version: 2, nodes, edges };};
export const parseTemplateContent = (raw) => { try { const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw; if (parsed?.version === 2) return parsed; return convertLegacy(parsed || {}); } catch { return { version: 2, nodes: [], edges: [] }; }};
const fromDto = (dto) => ({ id: dto.id, builtIn: false, icon: dto.icon, category: dto.category, title: dto.title, description: dto.description, createdAt: dto.createdAt, content: parseTemplateContent(dto.content),});
export const fetchMyTemplates = async () => { const res = await axios.get(`${API_URL}/templates`); return (res.data || []).map(fromDto);};
export const createTemplate = async ({ title, description, category, icon, content }) => { const res = await axios.post(`${API_URL}/templates`, { title, description, category, icon, content: JSON.stringify(content), }); return fromDto(res.data);};
export const updateTemplate = async (id, patch) => { const res = await axios.put(`${API_URL}/templates/${id}`, patch); return fromDto(res.data);};
export const deleteTemplate = async (id) => { await axios.delete(`${API_URL}/templates/${id}`);};
// A board created from a template on the dashboard receives its content through// sessionStorage; the canvas inserts it right after the (empty) board loads.const pendingKey = (boardId) => `tf_pending_template_${boardId}`;
export const setPendingTemplate = (boardId, content) => { try { sessionStorage.setItem(pendingKey(boardId), JSON.stringify(content)); } catch { // storage full or unavailable: the board just starts empty }};
export const takePendingTemplate = (boardId) => { try { const raw = sessionStorage.getItem(pendingKey(boardId)); if (!raw) return null; sessionStorage.removeItem(pendingKey(boardId)); return JSON.parse(raw); } catch { return null; }};123456782 unmodified lines11121314151617181920212223249 unmodified lines343536373839401 unmodified line4243444546474844 unmodified lines9394959697982 unmodified lines1011021031041051061071081091101111121131 unmodified line11511611711811912012112239 unmodified lines16216316416516616716816917017117217317417517618 unmodified lines195196197198199200201202203204205206import React from 'react';import { motion, AnimatePresence } from 'framer-motion';import { Link, useLocation } from 'react-router-dom';import { useAuth } from '../context/AuthContext';import logo from '../assets/logo.png';const Layout = ({ children }) => {const { user } = useAuth();2 unmodified linesconst [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false);const navItems = [{ name: 'Product', href: '#ai-agent' },{ name: 'How it Flows', href: '#how-it-works' },{ name: 'Templates', href: '#templates' },{ name: 'Pricing', href: '#pricing' }];const [activeSection, setActiveSection] = React.useState('#ai-agent');React.useEffect(() => {if (!isLanding) return;9 unmodified linesentries.forEach(entry => {if (entry.isIntersecting) {if (entry.target.id === 'hero') {setActiveSection('#ai-agent');} else {setActiveSection(`#${entry.target.id}`);}1 unmodified line});}, observerOptions);const sectionsToObserve = ['hero', 'ai-agent', 'how-it-works', 'templates', 'pricing'];sectionsToObserve.forEach(id => {const el = document.getElementById(id);if (el) observer.observe(el);44 unmodified lines</div><div className="flex gap-6 items-center"><div className="hidden sm:flex gap-6 items-center">{user ? (<Link to="/dashboard">2 unmodified lineswhileTap={{ scale: 0.95 }}className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all text-xl">Go to Workspace</motion.button></Link>) : (<><Link to="/auth"><button className="text-xl font-medium text-on-surface-variant hover:text-primary transition-colors">Log In</button></Link><Link to="/auth"><motion.button1 unmodified linewhileTap={{ scale: 0.95 }}className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all">Start Sketching</motion.button></Link></>)}39 unmodified lines<div className="flex flex-col gap-4 pt-6 border-t border-dashed border-primary/20">{user ? (<Link to="/dashboard" onClick={() => setIsMobileMenuOpen(false)}><button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">Go to Workspace</button></Link>) : (<><Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}><button className="w-full py-4 text-2xl font-bold text-primary rough-border">Log In</button></Link><Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}><button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">Start Sketching</button></Link></>)}18 unmodified lines<span>TaskFlow</span></div><div className="text-xl text-on-surface-variant">© 2026 TaskFlow. Designed for focus, built for resilience.</div></div><div className="flex flex-wrap gap-10 items-center md:justify-end">{['Privacy', 'Terms', 'Twitter', 'Changelog'].map(item => (<a key={item} className="text-xl font-bold text-on-surface-variant hover:text-primary underline decoration-secondary decoration-4 transition-all" href="#">{item}</a>))}</div></div>123456789102 unmodified lines13141516171819202122232425262728293031323334359 unmodified lines454647484950511 unmodified line5354555657585944 unmodified lines1041051061071081091101111121131141151162 unmodified lines1191201211221231241251261271281291301311 unmodified line13313413513613713813914039 unmodified lines18018118218318418518618718818919019119219319418 unmodified lines213214215216217218219220221222223224import React from 'react';import { motion, AnimatePresence } from 'framer-motion';import { Link, useLocation } from 'react-router-dom';import { useAuth } from '../context/AuthContext';import logo from '../assets/logo.png';import { useTranslation } from 'react-i18next';import { getLandingCopy } from '../features/landing/landingCopy';const Layout = ({ children }) => {const { user } = useAuth();2 unmodified linesconst [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false);const { i18n } = useTranslation();const copy = getLandingCopy(i18n.language).nav;const isUk = i18n.language?.startsWith('uk');const toggleLanguage = () => {const next = isUk ? 'en' : 'uk';i18n.changeLanguage(next);try { localStorage.setItem('language', next); } catch { /* ignore */ }};const navItems = [{ name: copy.product, href: '#product' },{ name: copy.how, href: '#how-it-works' },{ name: copy.templates, href: '#templates' },{ name: copy.pricing, href: '#pricing' }];const [activeSection, setActiveSection] = React.useState('#product');React.useEffect(() => {if (!isLanding) return;9 unmodified linesentries.forEach(entry => {if (entry.isIntersecting) {if (entry.target.id === 'hero') {setActiveSection('#product');} else {setActiveSection(`#${entry.target.id}`);}1 unmodified line});}, observerOptions);const sectionsToObserve = ['hero', 'product', 'how-it-works', 'templates', 'pricing'];sectionsToObserve.forEach(id => {const el = document.getElementById(id);if (el) observer.observe(el);44 unmodified lines</div><div className="flex gap-6 items-center"><buttononClick={toggleLanguage}className="px-2.5 py-1 rounded-lg border-2 border-primary/20 hover:border-primary text-sm font-bold text-primary transition-colors cursor-pointer"title={isUk ? 'English' : 'Українська'}>{isUk ? 'EN' : 'UA'}</button><div className="hidden sm:flex gap-6 items-center">{user ? (<Link to="/dashboard">2 unmodified lineswhileTap={{ scale: 0.95 }}className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all text-xl">{copy.workspace}</motion.button></Link>) : (<><Link to="/auth"><button className="text-xl font-medium text-on-surface-variant hover:text-primary transition-colors">{copy.login}</button></Link><Link to="/auth"><motion.button1 unmodified linewhileTap={{ scale: 0.95 }}className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all">{copy.start}</motion.button></Link></>)}39 unmodified lines<div className="flex flex-col gap-4 pt-6 border-t border-dashed border-primary/20">{user ? (<Link to="/dashboard" onClick={() => setIsMobileMenuOpen(false)}><button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">{copy.workspace}</button></Link>) : (<><Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}><button className="w-full py-4 text-2xl font-bold text-primary rough-border">{copy.login}</button></Link><Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}><button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">{copy.start}</button></Link></>)}18 unmodified lines<span>TaskFlow</span></div><div className="text-xl text-on-surface-variant">© 2026 TaskFlow</div></div><div className="flex flex-wrap gap-10 items-center md:justify-end">{navItems.map(item => (<a key={item.href} className="text-xl font-bold text-on-surface-variant hover:text-primary underline decoration-secondary decoration-4 transition-all" href={isLanding ? item.href : `/${item.href}`}>{item.name}</a>))}</div></div>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466{"common": {"back": "Back","yes": "Yes","no": "No","hours_short": "h","minutes_short": "m","seconds_short": "s","add": "Add","apply": "Apply","cancel": "Cancel","delete": "Delete","days_short": {"sun": "Sun","mon": "Mon","tue": "Tue","wed": "Wed","thu": "Thu","fri": "Fri","sat": "Sat"},"days": {"sun": "Sunday","mon": "Monday","tue": "Tuesday","wed": "Wednesday","thu": "Thursday","fri": "Friday","sat": "Saturday"}},"sidebar": {"projects": "Projects","canvas": "Canvas","habits": "Habits","profile": "Profile","settings": "Settings","free_plan": "Free Plan","upgrade_now": "Upgrade Now","logout": "Log Out","free_active": "AI: {{count}}/3 daily","pro_active": "AI: {{count}}/200 daily","ultra_active": "All Limits Unlocked","go_ultra": "Go Ultra"},"landing": {"slogan": "TaskFlow in your pocket. Always in sync","title": "TaskFlow","description": "Unleash your potential, track goals, and build habits.","get_started": "Get Started","login": "Log In","features": "Features","visual_goals": "Visual Goals","ai_generation": "AI Generation","habit_streaks": "Habit Streaks","hero_title_p1": "Plans break.","hero_title_p2": "TaskFlow adapts.","hero_desc": "The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life\u0027s \"If/Then\" moments.","hero_badge": "ADHD-friendly. Resilience-driven.","node_a": "Task A","node_b": "Task B","node_failed": "Failed?","node_c": "Task C","node_d": "Task D","adhd_edge": "The ADHD Edge","ai_find_path": "Let AI find the path when you get stuck.","ai_desc": "TaskFlow handles the cognitive load. When a plan hits a wall, our AI agent sketches out a comprehensive strategy tree, finding alternatives so you don\u0027t have to.","ai_example_input": "I\u0027m blocked on user growth. What now?","ai_adapt_plan": "Adapt Plan","ai_early_users": "Acquire Early Users","cross_platform": "Cross-Platform","cross_platform_desc": "Don\u0027t lose your flow when you\u0027re on the move. TaskFlow is designed to be offline-first, syncing your goal graphs seamlessly across all your devices the moment you\u0027re back online.","cta_title_p1": "Stop fighting your brain.","cta_title_p2": "Start sketching paths."},"pricing": {"title": "Simple Pricing","subtitle": "No hidden fees, just plain ink.","free": "Free","pro": "Pro","team": "Team","month": "month","user": "user","start_free": "Start Free","go_pro": "Go Pro","contact_us": "Contact Us","free_feat1": "3 Infinite Canvases","free_feat2": "Basic shapes \u0026 logic","free_feat3": "Community templates","pro_feat1": "Unlimited Canvases","pro_feat2": "AI Path Generation","pro_feat3": "Advanced Habit Tracking","pro_feat4": "Priority Support","team_feat1": "Everything in Pro","team_feat2": "Real-time Collaboration","team_feat3": "Team Workspaces","team_feat4": "Admin Tools","premium_feature": "Premium Feature","paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.","upgrade_premium": "Upgrade to Premium","maybe_later": "Maybe Later"},"auth": {"welcome_back": "Welcome Back!","create_account": "Create Account","sign_in_desc": "Sign in to continue your journey","sign_up_desc": "Join TaskFlow to achieve your goals","email": "Email Address","password": "Password","name": "Full Name","sign_in": "Sign In","sign_up": "Sign Up","no_account": "Don\u0027t have an account? Sign up","has_account": "Already have an account? Sign in","passwords_do_not_match": "Passwords do not match","start_flow": "Start Your Flow","plans_waiting": "Your plans are waiting for you.","join_revolution": "Join the visual revolution.","full_name": "Full Name","enter_name": "Enter your name","forgot": "Forgot?","confirm_password": "Confirm Password","processing": "Processing...","enter_workspace": "Enter Workspace","or_continue": "Or continue with","google_failed": "Google Login Failed","dont_have_account": "Don\u0027t have an account? Sign Up","already_member": "Already a member? Log In"},"onboarding": {"title": "Welcome to TaskFlow","subtitle": "Let\u0027s set up your goal strategist","step1_title": "Visual Goal Nodes","step1_desc": "Map your dreams as interconnected nodes on a gorgeous canvas. Break down large goals into small steps.","step2_title": "Dynamic Logic \u0026 Streaks","step2_desc": "Add condition checks (Yes/No choices) to model alternative paths. Hook up habits and watch your streaks thrive.","step3_title": "AI Goal Adaptation","step3_desc": "Ask our AI strategist to adapt your plan when blocks happen. TaskFlow automatically drafts new paths.","next": "Next","back": "Back","lets_go": "Let\u0027s Go!","step_0": {"title": "The Canvas of Goals","description": "Forget linear lists. TaskFlow is a digital sketchbook where your ideas live in a visual graph. Pan, zoom, and expand your thoughts infinitely.","note": "Your brain isn\u0027t a list, so why should your tasks be?"},"step_1": {"title": "Logic \u0026 Connections","description": "Connect nodes with \u0027If/Then\u0027 logic. Define what happens if a task succeeds or fails. Build a resilient plan that handles every contingency.","note": "If A happens, then B. If not, try C."},"step_2": {"title": "AI Adaptation","description": "Hit a wall? Mark a node as \u0027Blocked\u0027 and let the AI Assistant sketch out alternative routes to your goal instantly.","note": "AI handles the cognitive load when you\u0027re stuck."},"step_3": {"title": "Dopamine \u0026 Focus","description": "Earn points for completing branches and maintain daily streaks. TaskFlow is designed to keep you motivated and focused on the big picture.","note": "Turn the grind into a game you enjoy."},"visual": {"goal": "Goal","success": "Success","blocked": "Blocked","ai_generating": "AI generating...","streak_text": "14 Day Streak!"},"step_indicator": "Step {{current}} of {{total}}","begin": "Let\u0027s Begin!","next_chapter": "Next Chapter"},"dashboard": {"your_projects": "Your Projects","search_placeholder": "Search projects...","new_blank_canvas": "New Blank Canvas","project": "Project","active_steps": "active steps","loading_projects": "Loading projects...","no_projects": "No projects yet. Create a blank canvas to begin!","create_project_title": "Create New Project","project_name": "Project Name","project_desc": "Project Description","cancel": "Cancel","create": "Create","delete_title": "Delete Project","delete_confirm": "Are you sure you want to delete this project? This action cannot be undone.","delete": "Delete"},"habits": {"habit_tracker": "Habit Tracker","consistency_score": "Consistency Score","consistency_desc": "You\u0027re in the top 5% of strategists this week!","active_streak": "Active Streak","days": "days","today_check_in": "Today\u0027s Habit Checklist","weekly_streak": "Weekly Streak Calendar","streak": "streak","no_habits": "No habits currently tracked. Add custom habits to your goal canvas to see them here!","complete": "Complete","pending": "Pending","loading": "Loading habit canvases...","no_habits_title": "No Habit Canvases Yet","reward_desc": "Complete habits on your strategy maps to level up quicker.","track_for_date": "Track for {{date}}","complete_notification_title": "Habit Completed! 🔥","complete_notification_desc_custom": "Recorded check-in for {{date}}","complete_notification_desc": "Dynamic streak increased! +50 XP awarded!","recharge_notification_title": "Habit Recharged! ⚡","recharge_notification_desc": "Habit \"{{name}}\" is ready to be performed again!","recharge_notification_header": "HABIT READY"},"profile": {"profile": "Profile","user_level": "User Level","experience": "Experience","stats": "Statistics","completed_goals": "Completed Goals","active_habits": "Active Habits","experience_points": "Experience Points","level_progress": "Level Progress","achievements": "Achievements Notebook","unlocked": "Unlocked","locked": "Locked","total_points": "Total Points"},"settings": {"settings": "Settings","general": "General","canvas": "Canvas Settings","account_billing": "Account \u0026 Billing","theme": "App Preferences","preferred_language": "Preferred Language","theme_label": "Visual Theme","dark_mode": "Dark Theme","light_mode": "Light Theme","security": "Security","update_password": "Update Password","delete_account": "Delete Account","subscription": "Subscription Plan","upgrade_pro": "Upgrade to TaskFlow Pro","cancel_sub": "Cancel Subscription","saved_success": "Settings updated successfully!","slogan": "Tune your workspace to perfection.","general_preferences": "General Preferences","theme_desc": "Switch between light and dark themes.","notifications_title": "Desktop Notifications","notifications_desc": "Receive alerts for task deadlines and habit reminders.","language_desc": "Select your primary interface language.","canvas_behavior": "Canvas Behavior","ai_guidance_title": "AI Active Guidance","ai_guidance_desc": "Let AI proactively suggest alternative paths when you mark a node as blocked.","snap_to_grid_title": "Snap to Grid","snap_to_grid_desc": "Automatically align nodes to the graph paper lines for a cleaner look.","default_node_color": "Default Node Color","data_management": "Data Management","export_json": "Export as JSON","import_vault": "Import Vault","danger_zone": "Danger Zone","delete_desc": "This action is irreversible. All your maps and habits will be wiped.","delete_forever": "Delete Forever"},"canvas": {"new_goal": "New Goal","new_habit": "New Habit","new_condition": "New Condition?","ai_assistant": "AI Assistant","ai_thinking": "AI Thinking...","premium_feature": "Premium Feature","paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.","upgrade_premium": "Upgrade to Premium","maybe_later": "Maybe Later","roadmap_strategist": "Roadmap Strategist","drafting_roadmap": "Drafting your Roadmap...","strategist_desc": "\" The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas... \"","bubble_text": "\" Tell me what you want to achieve or where you are stuck. I will procedurally sketch tasks, alternatives, and conditions directly onto your digital canvas. \"","quick_suggestions": "Quick Suggestions","suggestion_detail": "Detail current step into subtasks","suggestion_route": "Suggest alternative route in case of failure","suggestion_habits": "Create daily habits to reinforce this goal","input_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...","tag_detail": "Detailing","tag_route": "Route","tag_habits": "Habits","condition_yes": "Yes","condition_no": "No","condition_node_label": "Condition","ai_suggest_details": "Break down the current step into subtasks","ai_suggest_details_tag": "Breakdown","ai_suggest_route": "Suggest an alternative route in case of failure","ai_suggest_route_tag": "Alternative","canvas.ai_suggest_habits": "Create daily habits to reinforce this goal","ai_suggest_habits_tag": "Habits","ai_roadmap_strategist": "Roadmap Strategist","ai_maintenance_title": "AI Under Maintenance","ai_maintenance_desc": "We are upgrading our AI strategist to deliver even faster, more accurate, and flexible plan generation. Thank you for your patience!","ai_maintenance_btn": "Got it","ai_drafting": "Drafting your Roadmap...","ai_drafting_desc": "The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas...","ai_bubble_desc": "Tell me what you want to achieve or where you are stuck. I will procedurally sketch tasks, alternatives, and conditions directly onto your digital canvas.","ai_quick_suggestions": "Quick Suggestions","ai_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...","condition": "Condition","strategic_goal_map": "Strategic Goal Map","save_strategy": "Save Strategy","saving": "Saving...","export_empty_error": "The map is empty! Add nodes before exporting.","subgoal_warning": "Cannot complete: please finish all sub-goals first!","subgoals_progress": "Sub-goals: {{done}}/{{total}} Done","export_error": "Error exporting to PNG:","habit": "Habit","habit_status": "Status","habit_status_done": "Done","habit_status_pending": "Pending","habit_action_done": "Done!","habit_action_todo": "Complete","habit_reset_rule": "Reset Rule","habit_countdown_label": "Reset in","habit_resetting": "Resetting...","habit_signal_active": "SENDING SIGNAL ⚡","habit_signal_inactive": "SIGNAL OFF 💤","habit_test_reset": "Test Reset","habit_test_reset_tooltip": "Reset habit and all downstream goals in the chain now","habit_rule_daily": "Daily at {{time}}","habit_rule_weekly": "Weekly ({{day}}) at {{time}}","habit_rule_hourly": "Every {{hours}}h","habit_rule_minutely": "Every {{minutes}}m","habit_rule_days": "Every {{days}}d","habit_rule_mixed": "Every {{hours}}h {{minutes}}m","habit_reset_hours_label": "Hours","habit_reset_minutes_label": "Minutes","condition_min_options_error": "A condition must have at least one option (pin)!","condition_settings_title": "Condition Settings","condition_text_label": "Condition Text","condition_text_placeholder": "e.g. Payment successful?","condition_options_label": "Options (Output Pins)","condition_multiselect_label": "Multi-choice Options","condition_multiselect_desc": "Allow multiple outputs to activate simultaneously","habit_settings_title": "Habit Settings","habit_name_label": "Habit Name","habit_name_placeholder": "e.g. Learning English","habit_description_label": "Description / Note","habit_description_placeholder": "Details or motivation...","habit_reset_mode_label": "Reset Mode","habit_reset_daily": "Every day (Daily)","habit_reset_weekly": "Every week (Weekly)","habit_reset_interval": "Custom Interval","habit_reset_time_label": "Reset Time (default 00:00)","habit_reset_time_label_short": "Reset Time","habit_reset_day_label": "Day of the week","habit_reset_interval_value": "Reset every","habit_interval_minutes": "minutes","habit_interval_hours": "hours","habit_interval_days": "days","context_menu": {"create_node": "Create Node","goal_node": "Goal (Sketch Node)","subgoal_node": "Sub-goal","condition_node": "Condition","habit_node": "Habit","export_png": "Export to PNG","delete": "Delete"}},"achievements": {"unlocked_header": "Achievement Unlocked!","notification_header": "Notification","blank_canvas": {"title": "Blank Canvas","description": "Create your first project (Graph)."},"connecting_the_dots": {"title": "Connecting the Dots","description": "Create 10 connections (Edges) between tasks."},"sketch_master": {"title": "Sketch Master","description": "Create 100 task nodes overall."},"daily_doodler": {"title": "Daily Doodler","description": "Track habits 7 times."},"decision_maker": {"title": "Decision Maker","description": "Complete 50 tasks."},"clear_desk": {"title": "Clear Desk","description": "Delete 5 projects."},"first_milestone": {"title": "First Milestone","description": "Complete your first task."},"self_portrait": {"title": "Self Portrait","description": "Upload your profile avatar."}},"subscription": {"title": "Unlock the Pro Tools of TaskFlow","title_p1": "Unlock the ","title_highlight": "Pro Tools","title_p2": " of TaskFlow","subtitle": "Stop guessing. Start mapping with AI guidance and unlimited creative freedom.","most_recommended": "Most Recommended","per_month": "/ month","social_proof": "Trusted by 10,000+ Visionary Strategists worldwide","features": {"ai_genius": "AI Genius","ai_genius_desc": "GPT-4 powered path generation","infinite": "Infinite","infinite_desc": "No limits on nodes or connections","secure": "Secure","secure_desc": "Bank-level AES-256 encryption","custom": "Custom","custom_desc": "Full palette of sketchbook themes"},"plans": {"free": {"title": "Free Starter","desc": "Perfect for testing and simple goal mapping.","btn": "Stay on Free","feat1": "3 AI generations per day","feat2": "Maximum 3 canvases","feat3": "Maximum 200 nodes per canvas","feat4": "Maximum 3 habits","feat5": "Maximum 2 people on board"},"pro": {"title": "Sketchbook Pro","desc": "Unlock unlimited strategies with 200 daily AI construct operations.","btn": "Upgrade to Pro","feat1": "200 AI generations per day","feat2": "Unlimited canvases \u0026 nodes","feat3": "Unlimited habits","feat4": "Maximum 10 people on board","feat5": "Advanced Strategy analytics"},"ultra": {"title": "Sketchbook Ultra","desc": "The ultimate strategy sandbox. Fully unlimited everything + templates.","btn": "Upgrade to Ultra","feat1": "Unlimited AI generations","feat2": "Unlimited canvases \u0026 nodes","feat3": "Unlimited habits","feat4": "Unlimited people on board","feat5": "Create custom templates","feat6": "Priority support \u0026 VIP strategy tools"}},"upgrade_success": "Plan switched to {{tier}} successfully!","upgrading": "Upgrading...","current_plan": "Current Plan","compare": {"feature": "Feature","ai_gens": "AI Generations / day","canvases": "Canvases","nodes": "Nodes per canvas","habits": "Habits","board_members": "Board members","custom_templates": "Custom Templates"}}}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541{"common": {"back": "Back","yes": "Yes","no": "No","hours_short": "h","minutes_short": "m","seconds_short": "s","add": "Add","apply": "Apply","cancel": "Cancel","delete": "Delete","days_short": {"sun": "Sun","mon": "Mon","tue": "Tue","wed": "Wed","thu": "Thu","fri": "Fri","sat": "Sat"},"days": {"sun": "Sunday","mon": "Monday","tue": "Tuesday","wed": "Wednesday","thu": "Thursday","fri": "Friday","sat": "Saturday"}},"sidebar": {"projects": "Projects","canvas": "Canvas","habits": "Habits","profile": "Profile","settings": "Settings","free_plan": "Free Plan","upgrade_now": "Upgrade Now","logout": "Log Out","free_active": "AI: {{count}}/3 daily","pro_active": "AI: {{count}}/200 daily","ultra_active": "All Limits Unlocked","go_ultra": "Go Ultra","boards_used": "{{used}}/{{max}} boards","plus_active": "No limits","free_limits": "Up to {{nodes}} nodes per board","get_plus": "Get Plus"},"landing": {"slogan": "TaskFlow in your pocket. Always in sync","title": "TaskFlow","description": "Unleash your potential, track goals, and build habits.","get_started": "Get Started","login": "Log In","features": "Features","visual_goals": "Visual Goals","ai_generation": "AI Generation","habit_streaks": "Habit Streaks","hero_title_p1": "Plans break.","hero_title_p2": "TaskFlow adapts.","hero_desc": "The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life's \"If/Then\" moments.","hero_badge": "ADHD-friendly. Resilience-driven.","node_a": "Task A","node_b": "Task B","node_failed": "Failed?","node_c": "Task C","node_d": "Task D","adhd_edge": "The ADHD Edge","ai_find_path": "Let AI find the path when you get stuck.","ai_desc": "TaskFlow handles the cognitive load. When a plan hits a wall, our AI agent sketches out a comprehensive strategy tree, finding alternatives so you don't have to.","ai_example_input": "I'm blocked on user growth. What now?","ai_adapt_plan": "Adapt Plan","ai_early_users": "Acquire Early Users","cross_platform": "Cross-Platform","cross_platform_desc": "Don't lose your flow when you're on the move. TaskFlow is designed to be offline-first, syncing your goal graphs seamlessly across all your devices the moment you're back online.","cta_title_p1": "Stop fighting your brain.","cta_title_p2": "Start sketching paths."},"pricing": {"title": "Simple Pricing","subtitle": "No hidden fees, just plain ink.","free": "Free","pro": "Pro","team": "Team","month": "month","user": "user","start_free": "Start Free","go_pro": "Go Pro","contact_us": "Contact Us","free_feat1": "3 Infinite Canvases","free_feat2": "Basic shapes & logic","free_feat3": "Community templates","pro_feat1": "Unlimited Canvases","pro_feat2": "AI Path Generation","pro_feat3": "Advanced Habit Tracking","pro_feat4": "Priority Support","team_feat1": "Everything in Pro","team_feat2": "Real-time Collaboration","team_feat3": "Team Workspaces","team_feat4": "Admin Tools","premium_feature": "Premium Feature","paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.","upgrade_premium": "Upgrade to Premium","maybe_later": "Maybe Later"},"auth": {"welcome_back": "Welcome Back!","create_account": "Create Account","sign_in_desc": "Sign in to continue your journey","sign_up_desc": "Join TaskFlow to achieve your goals","email": "Email Address","password": "Password","name": "Full Name","sign_in": "Sign In","sign_up": "Sign Up","no_account": "Don't have an account? Sign up","has_account": "Already have an account? Sign in","passwords_do_not_match": "Passwords do not match","start_flow": "Start Your Flow","plans_waiting": "Your plans are waiting for you.","join_revolution": "Join the visual revolution.","full_name": "Full Name","enter_name": "Enter your name","forgot": "Forgot?","confirm_password": "Confirm Password","processing": "Processing...","enter_workspace": "Enter Workspace","or_continue": "Or continue with","google_failed": "Google Login Failed","dont_have_account": "Don't have an account? Sign Up","already_member": "Already a member? Log In"},"onboarding": {"title": "Welcome to TaskFlow","subtitle": "Let's set up your goal map","step1_title": "Visual Goal Nodes","step1_desc": "Map your dreams as interconnected nodes on a gorgeous canvas. Break down large goals into small steps.","step2_title": "Dynamic logic","step2_desc": "Add condition checks (Yes/No choices) to model alternative paths.","step3_title": "Auto-layout & templates","step3_desc": "Start from a template and keep the board tidy with one click.","next": "Next","back": "Back","lets_go": "Let's Go!","step_0": {"title": "The Canvas of Goals","description": "Forget linear lists. TaskFlow is a digital sketchbook where your ideas live in a visual graph. Pan, zoom, and expand your thoughts infinitely.","note": "Your brain isn't a list, so why should your tasks be?"},"step_1": {"title": "Logic & Connections","description": "Connect nodes with 'If/Then' logic. Define what happens if a task succeeds or fails. Build a resilient plan that handles every contingency.","note": "If A happens, then B. If not, try C."},"step_2": {"title": "Auto-layout & templates","description": "Start from a template, and when the board gets messy press Shift+L — TaskFlow arranges every step into a tidy flow.","note": "Less time dragging boxes, more time doing."},"step_3": {"title": "Dopamine & Focus","description": "Earn points for completed steps and unlock achievements. TaskFlow keeps you motivated and focused on the big picture.","note": "Turn the grind into a game you enjoy."},"visual": {"goal": "Goal","success": "Success","blocked": "Messy board","ai_generating": "Shift+L","streak_text": "Achievement unlocked!"},"step_indicator": "Step {{current}} of {{total}}","begin": "Let's Begin!","next_chapter": "Next Chapter"},"dashboard": {"your_projects": "Your Projects","search_placeholder": "Search projects...","new_blank_canvas": "New Blank Canvas","project": "Project","active_steps": "active steps","loading_projects": "Loading projects...","no_projects": "No projects yet. Create a blank canvas to begin!","create_project_title": "Create New Project","project_name": "Project Name","project_desc": "Project Description","cancel": "Cancel","create": "Create","delete_title": "Delete Project","delete_confirm": "Are you sure you want to delete this project? This action cannot be undone.","delete": "Delete"},"habits": {"habit_tracker": "Habit Tracker","consistency_score": "Consistency Score","consistency_desc": "You're in the top 5% of strategists this week!","active_streak": "Active Streak","days": "days","today_check_in": "Today's Habit Checklist","weekly_streak": "Weekly Streak Calendar","streak": "streak","no_habits": "No habits currently tracked. Add custom habits to your goal canvas to see them here!","complete": "Complete","pending": "Pending","loading": "Loading habit canvases...","no_habits_title": "No Habit Canvases Yet","reward_desc": "Complete habits on your strategy maps to level up quicker.","track_for_date": "Track for {{date}}","complete_notification_title": "Habit Completed! 🔥","complete_notification_desc_custom": "Recorded check-in for {{date}}","complete_notification_desc": "Dynamic streak increased! +50 XP awarded!","recharge_notification_title": "Habit Recharged! ⚡","recharge_notification_desc": "Habit \"{{name}}\" is ready to be performed again!","recharge_notification_header": "HABIT READY"},"profile": {"profile": "Profile","user_level": "User Level","experience": "Experience","stats": "Statistics","completed_goals": "Completed Goals","active_habits": "Active Habits","experience_points": "Experience Points","level_progress": "Level Progress","achievements": "Achievements Notebook","unlocked": "Unlocked","locked": "Locked","total_points": "Total Points"},"settings": {"settings": "Settings","general": "General","canvas": "Canvas Settings","account_billing": "Account & Billing","theme": "App Preferences","preferred_language": "Preferred Language","theme_label": "Visual Theme","dark_mode": "Dark Theme","light_mode": "Light Theme","security": "Security","update_password": "Update Password","delete_account": "Delete Account","subscription": "Subscription Plan","upgrade_pro": "Upgrade to TaskFlow Pro","cancel_sub": "Cancel Subscription","saved_success": "Settings updated successfully!","slogan": "Tune your workspace to perfection.","general_preferences": "General Preferences","theme_desc": "Switch between light and dark themes.","notifications_title": "Desktop Notifications","notifications_desc": "Receive alerts for task deadlines and habit reminders.","language_desc": "Select your primary interface language.","canvas_behavior": "Canvas Behavior","ai_guidance_title": "AI Active Guidance","ai_guidance_desc": "Let AI proactively suggest alternative paths when you mark a node as blocked.","snap_to_grid_title": "Snap to Grid","snap_to_grid_desc": "Automatically align nodes to the graph paper lines for a cleaner look.","default_node_color": "Default Node Color","data_management": "Data Management","export_json": "Export as JSON","import_vault": "Import Vault","danger_zone": "Danger Zone","delete_desc": "This action is irreversible. All your maps and habits will be wiped.","delete_forever": "Delete Forever"},"canvas": {"new_goal": "New Goal","new_habit": "New Habit","new_condition": "New Condition?","ai_assistant": "AI Assistant","ai_thinking": "AI Thinking...","premium_feature": "Premium Feature","paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.","upgrade_premium": "Upgrade to Premium","maybe_later": "Maybe Later","roadmap_strategist": "Roadmap Strategist","drafting_roadmap": "Drafting your Roadmap...","strategist_desc": "\" The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas... \"","bubble_text": "\" Tell me what you want to achieve or where you are stuck. I will procedurally sketch tasks, alternatives, and conditions directly onto your digital canvas. \"","quick_suggestions": "Quick Suggestions","suggestion_detail": "Detail current step into subtasks","suggestion_route": "Suggest alternative route in case of failure","suggestion_habits": "Create daily habits to reinforce this goal","input_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...","tag_detail": "Detailing","tag_route": "Route","tag_habits": "Habits","condition_yes": "Yes","condition_no": "No","condition_node_label": "Condition","ai_suggest_details": "Break down the current step into subtasks","ai_suggest_details_tag": "Breakdown","ai_suggest_route": "Suggest an alternative route in case of failure","ai_suggest_route_tag": "Alternative","canvas.ai_suggest_habits": "Create daily habits to reinforce this goal","ai_suggest_habits_tag": "Habits","ai_roadmap_strategist": "Roadmap Strategist","ai_maintenance_title": "AI Under Maintenance","ai_maintenance_desc": "We are upgrading our AI strategist to deliver even faster, more accurate, and flexible plan generation. Thank you for your patience!","ai_maintenance_btn": "Got it","ai_drafting": "Drafting your Roadmap...","ai_drafting_desc": "The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas...","ai_bubble_desc": "Tell me what you want to achieve or where you are stuck. I will procedurally sketch tasks, alternatives, and conditions directly onto your digital canvas.","ai_quick_suggestions": "Quick Suggestions","ai_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...","condition": "Condition","strategic_goal_map": "Strategic Goal Map","save_strategy": "Save Strategy","saving": "Saving...","export_empty_error": "The map is empty! Add nodes before exporting.","subgoal_warning": "Cannot complete: please finish all sub-goals first!","subgoals_progress": "Sub-goals: {{done}}/{{total}} Done","export_error": "Error exporting to PNG:","habit": "Habit","habit_status": "Status","habit_status_done": "Done","habit_status_pending": "Pending","habit_action_done": "Done!","habit_action_todo": "Complete","habit_reset_rule": "Reset Rule","habit_countdown_label": "Reset in","habit_resetting": "Resetting...","habit_signal_active": "SENDING SIGNAL ⚡","habit_signal_inactive": "SIGNAL OFF 💤","habit_test_reset": "Test Reset","habit_test_reset_tooltip": "Reset habit and all downstream goals in the chain now","habit_rule_daily": "Daily at {{time}}","habit_rule_weekly": "Weekly ({{day}}) at {{time}}","habit_rule_hourly": "Every {{hours}}h","habit_rule_minutely": "Every {{minutes}}m","habit_rule_days": "Every {{days}}d","habit_rule_mixed": "Every {{hours}}h {{minutes}}m","habit_reset_hours_label": "Hours","habit_reset_minutes_label": "Minutes","condition_min_options_error": "A condition must have at least one option (pin)!","condition_settings_title": "Condition Settings","condition_text_label": "Condition Text","condition_text_placeholder": "e.g. Payment successful?","condition_options_label": "Options (Output Pins)","condition_multiselect_label": "Multi-choice Options","condition_multiselect_desc": "Allow multiple outputs to activate simultaneously","habit_settings_title": "Habit Settings","habit_name_label": "Habit Name","habit_name_placeholder": "e.g. Learning English","habit_description_label": "Description / Note","habit_description_placeholder": "Details or motivation...","habit_reset_mode_label": "Reset Mode","habit_reset_daily": "Every day (Daily)","habit_reset_weekly": "Every week (Weekly)","habit_reset_interval": "Custom Interval","habit_reset_time_label": "Reset Time (default 00:00)","habit_reset_time_label_short": "Reset Time","habit_reset_day_label": "Day of the week","habit_reset_interval_value": "Reset every","habit_interval_minutes": "minutes","habit_interval_hours": "hours","habit_interval_days": "days","context_menu": {"create_node": "Create Node","goal_node": "Goal (Sketch Node)","subgoal_node": "Sub-goal","condition_node": "Condition","habit_node": "Habit","export_png": "Export to PNG","delete": "Delete","insert_template": "Insert template","auto_layout": "Auto-layout"},"toolbar": {"auto_layout": "Auto-layout (Shift+L)","templates": "Templates"}},"achievements": {"unlocked_header": "Achievement Unlocked!","notification_header": "Notification","blank_canvas": {"title": "Blank Canvas","description": "Create your first project (Graph)."},"connecting_the_dots": {"title": "Connecting the Dots","description": "Create 10 connections (Edges) between tasks."},"sketch_master": {"title": "Sketch Master","description": "Create 100 task nodes overall."},"daily_doodler": {"title": "Daily Doodler","description": "Track habits 7 times."},"decision_maker": {"title": "Decision Maker","description": "Complete 50 tasks."},"clear_desk": {"title": "Clear Desk","description": "Delete 5 projects."},"first_milestone": {"title": "First Milestone","description": "Complete your first task."},"self_portrait": {"title": "Self Portrait","description": "Upload your profile avatar."}},"subscription": {"title": "Unlock the Pro Tools of TaskFlow","title_p1": "Unlock the ","title_highlight": "Pro Tools","title_p2": " of TaskFlow","subtitle": "Stop guessing. Start mapping with AI guidance and unlimited creative freedom.","most_recommended": "Most Recommended","per_month": "/ month","social_proof": "Trusted by 10,000+ Visionary Strategists worldwide","features": {"ai_genius": "AI Genius","ai_genius_desc": "GPT-4 powered path generation","infinite": "Infinite","infinite_desc": "No limits on nodes or connections","secure": "Secure","secure_desc": "Bank-level AES-256 encryption","custom": "Custom","custom_desc": "Full palette of sketchbook themes"},"plans": {"free": {"title": "Free Starter","desc": "Perfect for testing and simple goal mapping.","btn": "Stay on Free","feat1": "3 AI generations per day","feat2": "Maximum 3 canvases","feat3": "Maximum 200 nodes per canvas","feat4": "Maximum 3 habits","feat5": "Maximum 2 people on board"},"pro": {"title": "Sketchbook Pro","desc": "Unlock unlimited strategies with 200 daily AI construct operations.","btn": "Upgrade to Pro","feat1": "200 AI generations per day","feat2": "Unlimited canvases & nodes","feat3": "Unlimited habits","feat4": "Maximum 10 people on board","feat5": "Advanced Strategy analytics"},"ultra": {"title": "Sketchbook Ultra","desc": "The ultimate strategy sandbox. Fully unlimited everything + templates.","btn": "Upgrade to Ultra","feat1": "Unlimited AI generations","feat2": "Unlimited canvases & nodes","feat3": "Unlimited habits","feat4": "Unlimited people on board","feat5": "Create custom templates","feat6": "Priority support & VIP strategy tools"}},"upgrade_success": "Plan switched to {{tier}} successfully!","upgrading": "Upgrading...","current_plan": "Current Plan","compare": {"feature": "Feature","ai_gens": "AI Generations / day","canvases": "Canvases","nodes": "Nodes per canvas","habits": "Habits","board_members": "Board members","custom_templates": "Custom Templates"}},"plans": {"no_limits": "No limits","switched": "Your plan is now {{plan}}.","payments_soon": "Online payments are not connected yet. Plus will be available soon.","switch_failed": "Could not change the plan. Please try again.","free_desc": "Everything you need to plan on your own.","free_btn": "Switch to Free","plus_desc": "For big plans and teams. No caps on anything.","plus_btn": "Get Plus","feat_boards": "Up to {{count}} boards","feat_nodes": "Up to {{count}} nodes per board","feat_guests": "Up to {{count}} guests per board","feat_templates": "{{count}} saved templates","feat_core": "All node types, auto-layout, PNG/JSON export","feat_unlimited_boards": "Unlimited boards","feat_unlimited_nodes": "Unlimited nodes","feat_unlimited_guests": "Unlimited collaborators","feat_unlimited_templates": "Unlimited saved templates","feat_everything_free": "Everything in Free","row_boards": "Boards","row_nodes": "Nodes per board","row_guests": "Guests per board","row_templates": "Saved templates","title_p1": "Two plans. ","title_highlight": "No fine print.","subtitle": "Free has small creation limits. Plus has none.","limit_title": "Free plan limit","limit_nodes_desc": "A board on the Free plan can hold up to {{count}} nodes. Plus has no limits.","see_plus": "See Plus"},"templates": {"untitled": "Untitled board","tab_all": "All","tab_builtin": "Starters","tab_mine": "My templates","delete_confirm": "Delete","delete": "Delete template","blank": "Blank board","blank_desc": "Start from an empty canvas.","node_count": "{{count}} nodes","create_title": "New board","insert_title": "Insert a template","create_desc": "Start empty or from a template. Templates are laid out automatically.","insert_desc": "The template is added to the center of the screen and stays selected so you can move it.","search": "Search templates...","all_categories": "All categories","empty_mine": "No saved templates yet","nothing_found": "Nothing found","empty_mine_hint": "Open any board and press \"Save as template\" — the whole board or just the selected nodes.","free_note": "Free plan: {{used}}/{{max}} saved templates.","go_plus": "Plus removes the limit","create_btn": "Create board","insert_btn": "Insert","my_category": "My templates","save_failed": "Could not save the template.","save_title": "Save as template","saved": "Template saved","only_selected": "Selected ({{count}})","whole_board": "Whole board","field_title": "Title","field_desc": "Description","field_category": "Category","save_hint": "Statuses, progress and assignees are not saved — the template is a clean starting point.","save_btn": "Save template"}}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466{"common": {"back": "Назад","yes": "Так","no": "Ні","hours_short": "год","minutes_short": "хв","seconds_short": "с","add": "Додати","apply": "Застосувати","cancel": "Скасувати","delete": "Видалити","days_short": {"sun": "Нд","mon": "Пн","tue": "Вт","wed": "Ср","thu": "Чт","fri": "Пт","sat": "Сб"},"days": {"sun": "Неділя","mon": "Понеділок","tue": "Вівторок","wed": "Середа","thu": "Четвер","fri": "П\u0027ятниця","sat": "Субота"}},"sidebar": {"projects": "Проекти","canvas": "Полотно","habits": "Звички","profile": "Профіль","settings": "Налаштування","free_plan": "Безкоштовний тариф","upgrade_now": "Оновити зараз","logout": "Вийти","free_active": "ШІ: {{count}}/3 на день","pro_active": "ШІ: {{count}}/200 на день","ultra_active": "Усі ліміти знято","go_ultra": "Перейти на Ultra"},"landing": {"slogan": "TaskFlow у вашій кишені. Завжди синхронізовано","title": "TaskFlow","description": "Розкрийте свій потенціал, відстежуйте цілі та створюйте корисні звички.","get_started": "Почати","login": "Увійти","features": "Функції","visual_goals": "Візуальні цілі","ai_generation": "ШІ-генерація","habit_streaks": "Серії звичок","hero_title_p1": "Плани руйнуються.","hero_title_p2": "TaskFlow адаптується.","hero_desc": "Перший візуальний конструктор цілей, створений для фокусу. Переходьте від лінійних списків до адаптивних графів, які впораються з життєвими моментами «Якщо/То».","hero_badge": "Підходить для людей з РДУГ. Створено для стійкості.","node_a": "Завдання А","node_b": "Завдання Б","node_failed": "Невдача?","node_c": "Завдання В","node_d": "Завдання Г","adhd_edge": "РДУГ-перевага","ai_find_path": "Дозвольте ШІ знайти шлях, коли ви застрягли.","ai_desc": "TaskFlow бере на себе когнітивне навантаження. Коли план заходить у глухий кут, наш ШІ-агент малює повне дерево стратегії, знаходячи альтернативи, щоб вам не доводилося робити це вручну.","ai_example_input": "Я застряг на залученні користувачів. Що робити?","ai_adapt_plan": "Адаптувати план","ai_early_users": "Залучити перших користувачів","cross_platform": "Кросплатформність","cross_platform_desc": "Не втрачайте свій потік у дорозі. TaskFlow працює за принципом offline-first, безперешкодно синхронізуючи ваші графи цілей між усіма пристроями, щойно ви знову з\u0027явитеся в мережі.","cta_title_p1": "Припиніть боротися зі своїм мозком.","cta_title_p2": "Почніть малювати шляхи."},"pricing": {"title": "Прості тарифи","subtitle": "Жодних прихованих комісій, лише чисте чорнило.","free": "Безкоштовно","pro": "Pro","team": "Team","month": "місяць","user": "користувач","start_free": "Почати безкоштовно","go_pro": "Спробувати Pro","contact_us": "Зв\u0027язатися з нами","free_feat1": "3 нескінченних полотна","free_feat2": "Базові форми та логіка","free_feat3": "Шаблони спільноти","pro_feat1": "Необмежена кількість полотен","pro_feat2": "ШІ-генерація шляхів","pro_feat3": "Розширене відстеження звичок","pro_feat4": "Пріоритетна підтримка","team_feat1": "Усе з тарифу Pro","team_feat2": "Спільна робота в реальному часі","team_feat3": "Командні робочі простори","team_feat4": "Адміністративні інструменти","premium_feature": "Преміум функція","paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.","upgrade_premium": "Оновити до Преміум","maybe_later": "Можливо пізніше"},"auth": {"welcome_back": "З поверненням!","create_account": "Створити акаунт","sign_in_desc": "Увійдіть, щоб продовжити свою подорож","sign_up_desc": "Приєднуйтесь до TaskFlow, щоб досягати своїх цілей","email": "Електронна адреса","password": "Пароль","name": "Повне ім\u0027я","sign_in": "Увійти","sign_up": "Зареєструватися","no_account": "Немає акаунту? Зареєструватися","has_account": "Вже маєте акаунт? Увійти","passwords_do_not_match": "Паролі не збігаються","start_flow": "Почніть свій потік","plans_waiting": "Ваші плани чекають на вас.","join_revolution": "Приєднуйтесь до візуальної революції.","full_name": "Повне ім\u0027я","enter_name": "Введіть ваше ім\u0027я","forgot": "Забули?","confirm_password": "Підтвердьте пароль","processing": "Обробка...","enter_workspace": "Увійти в робочий простір","or_continue": "Або продовжити за допомогою","google_failed": "Помилка входу через Google","dont_have_account": "Немає акаунту? Зареєструватися","already_member": "Вже є учасником? Увійти"},"onboarding": {"title": "Ласкаво просимо до TaskFlow","subtitle": "Давайте налаштуємо вашого стратега цілей","step1_title": "Візуальні вузли цілей","step1_desc": "Зобразіть свої мрії у вигляді взаємопов\u0027язаних вузлів на чудовому полотні. Розбивайте великі цілі на дрібні кроки.","step2_title": "Динамічна логіка та серії","step2_desc": "Додавайте перевірки умов (вибір Так/Ні), щоб моделювати альтернативні шляхи. Підключайте звички та спостерігайте за вашими серіями.","step3_title": "ШІ-адаптація цілей","step3_desc": "Попросіть нашого ШІ-стратега адаптувати ваш план, коли виникають труднощі. TaskFlow автоматично створить нові шляхи.","next": "Далі","back": "Назад","lets_go": "Поїхали!","step_0": {"title": "Полотно цілей","description": "Забудьте про лінійні списки. TaskFlow — це цифровий альбом для малювання, де ваші ідеї живуть у візуальному графі. Вільно масштабуйте, панорамуйте та розширюйте свої думки до нескінченності.","note": "Ваш мозок не працює як список, то чому ваші завдання мають бути такими?"},"step_1": {"title": "Логіка та зв\u0027язки","description": "З\u0027єднуйте вузли за допомогою логіки «Якщо/То». Визначайте, що відбувається у разі успіху або невдачі завдання. Будуйте стійкий план на будь-який випадок.","note": "Якщо відбувається А, то робимо Б. Якщо ні, спробуйте В."},"step_2": {"title": "ШІ-адаптація","description": "Зіткнулися з перешкодою? Позначте вузол як «Заблоковано» і дозвольте ШІ-помічнику миттєво розробити альтернативні маршрути до вашої цілі.","note": "ШІ бере на себе когнітивне навантаження, коли ви застрягли."},"step_3": {"title": "Дофамін та фокус","description": "Заробляйте очки за завершення гілок та підтримуйте щоденні серії. TaskFlow розроблено, щоб тримати вас у тонусі та мотивувати бачити повну картину.","note": "Перетворіть рутину на гру, яка вам подобається."},"visual": {"goal": "Ціль","success": "Успіх","blocked": "Заблоковано","ai_generating": "ШІ генерує...","streak_text": "14 днів серії!"},"step_indicator": "Крок {{current}} з {{total}}","begin": "Почнемо!","next_chapter": "Наступний розділ"},"dashboard": {"your_projects": "Ваші проекти","search_placeholder": "Пошук проектів...","new_blank_canvas": "Нове чисте полотно","project": "Проект","active_steps": "активних кроків","loading_projects": "Завантаження проектів...","no_projects": "Проектів ще немає. Створіть чисте полотно, щоб почати!","create_project_title": "Створити новий проект","project_name": "Назва проекту","project_desc": "Опис проекту","cancel": "Скасувати","create": "Створити","delete_title": "Видалити проект","delete_confirm": "Ви впевнені, що хочете видалити цей проект? Цю дію не можна скасувати.","delete": "Видалити"},"habits": {"habit_tracker": "Трекер звичок","consistency_score": "Показник стабільності","consistency_desc": "Цього тижня ви входите до 5% найкращих стратегів!","active_streak": "Активна серія","days": "днів","today_check_in": "Сьогоднішній чеклист звичок","weekly_streak": "Календар тижневої серії","streak": "серія","no_habits": "Звички поки що не відстежуються. Додайте власні звички на ваше полотно цілей, щоб побачити їх тут!","complete": "Виконано","pending": "Очікується","loading": "Завантаження полотен зі звичками...","no_habits_title": "Поки що немає полотен зі звичками","reward_desc": "Виконуйте звички на ваших картах стратегій, щоб швидше підвищувати рівень.","track_for_date": "Відстежити для {{date}}","complete_notification_title": "Звичку виконано! 🔥","complete_notification_desc_custom": "Зафіксовано виконання для {{date}}","complete_notification_desc": "Активну серію збільшено! Нараховано +50 XP!","recharge_notification_title": "Звичку перезаряджено! ⚡","recharge_notification_desc": "Звичка \"{{name}}\" знову готова до виконання!","recharge_notification_header": "ЗВИЧКА ГОТОВА"},"profile": {"profile": "Профіль","user_level": "Рівень користувача","experience": "Досвід","stats": "Статистика","completed_goals": "Виконані цілі","active_habits": "Активні звички","experience_points": "Очки досвіду","level_progress": "Прогрес рівня","achievements": "Блокнот досягнень","unlocked": "Розблоковано","locked": "Заблоковано","total_points": "Всього очок"},"settings": {"settings": "Налаштування","general": "Загальні","canvas": "Налаштування полотна","account_billing": "Обліковий запис та оплата","theme": "Налаштування додатка","preferred_language": "Бажана мова","theme_label": "Візуальна тема","dark_mode": "Темна тема","light_mode": "Світла тема","security": "Безпека","update_password": "Оновити пароль","delete_account": "Видалити акаунт","subscription": "Тарифний план","upgrade_pro": "Оновити до TaskFlow Pro","cancel_sub": "Скасувати підписку","saved_success": "Налаштування успішно оновлено!","slogan": "Налаштуйте свій робочий простір до ідеалу.","general_preferences": "Загальні налаштування","theme_desc": "Перемикання між світлою та темною темами.","notifications_title": "Сповіщення на робочому столі","notifications_desc": "Отримуйте сповіщення про терміни виконання завдань та нагадування про звички.","language_desc": "Виберіть основну мову інтерфейсу.","canvas_behavior": "Поведінка полотна","ai_guidance_title": "Активне керівництво ШІ","ai_guidance_desc": "Дозволити ШІ проактивно пропонувати альтернативні шляхи, коли ви відз��ачаєте вузол як заблокований.","snap_to_grid_title": "Прив\u0027язка до сітки","snap_to_grid_desc": "Автоматично вирівнювати вузли по лініях сітки для охайнішого вигляду.","default_node_color": "Колір вузла за замовчуванням","data_management": "Управління даними","export_json": "Експорт у JSON","import_vault": "Імпорт сховища","danger_zone": "Небезпечна зона","delete_desc": "Ця дія є незворотною. Всі ваші карти та звички будуть стерті.","delete_forever": "Видалити назавжди"},"canvas": {"new_goal": "Нова ціль","new_habit": "Нова звичка","new_condition": "Нова умова?","ai_assistant": "ШІ-помічник","ai_thinking": "ШІ думає...","premium_feature": "Преміум функція","paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.","upgrade_premium": "Оновити до Преміум","maybe_later": "Можливо пізніше","roadmap_strategist": "Стратег дорожньої карти","drafting_roadmap": "Створення вашої дорожньої карти...","strategist_desc": "\" Стратег малює оптимальні з\u0027єднання шляхів, підцілі та контрольні точки на вашому полотні... \"","bubble_text": "\" Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні. \"","quick_suggestions": "Швидкі пропозиції","suggestion_detail": "Розбити поточний крок на підзавдання","suggestion_route": "Запропонувати альтернативний шлях у разі невдачі","suggestion_habits": "Створити щоденні звички для зміцнення цієї цілі","input_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...","tag_detail": "Деталізація","tag_route": "Маршрут","tag_habits": "Звички","condition_yes": "Так","condition_no": "Ні","condition_node_label": "Умова","ai_suggest_details": "Розбити поточний крок на підзавдання","ai_suggest_details_tag": "Деталізація","ai_suggest_route": "Запропонувати альтернативний шлях у разі невдачі","ai_suggest_route_tag": "Альтернатива","canvas.ai_suggest_habits": "Створити щоденні звички для зміцнення цієї цілі","ai_suggest_habits_tag": "Звички","ai_roadmap_strategist": "Стратег дорожньої карти","ai_maintenance_title": "ШІ на обслуговуванні","ai_maintenance_desc": "Ми оновлюємо нашого ШІ-стратега для забезпечення ще швидшої, точнішої та гнучкішої генерації планів. Дякуємо за ваше терпіння!","ai_maintenance_btn": "Зрозуміло","ai_drafting": "Створення вашої дорожньої карти...","ai_drafting_desc": "Стратег малює оптимальні з\u0027єднання шляхів, підцілі та контрольні точки на вашому полотні...","ai_bubble_desc": "Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні.","ai_quick_suggestions": "Швидкі пропозиції","ai_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...","condition": "Умова","strategic_goal_map": "Візуальна карта цілей","save_strategy": "Зберегти стратегію","saving": "Збереження...","export_empty_error": "Карта порожня! Додайте вузли перед експортом.","subgoal_warning": "Неможливо виконати: спочатку завершіть всі суб-цілі!","subgoals_progress": "Суб-цілі: {{done}} з {{total}} виконано","export_error": "Помилка при експорті в PNG:","habit": "Звичка","habit_status": "Status","habit_status_done": "Виконано","habit_status_pending": "Очікує","habit_action_done": "Зроблено!","habit_action_todo": "Виконати","habit_reset_rule": "Правило скидання","habit_countdown_label": "До скидання","habit_resetting": "Скидання...","habit_signal_active": "ДАЄ СИГНАЛ ⚡","habit_signal_inactive": "СИГНАЛ ВИМК. 💤","habit_test_reset": "Тест-скидання","habit_test_reset_tooltip": "Скинути звичку та всі пов\u0027язані з нею наступні цілі прямо зараз","habit_rule_daily": "Щодня о {{time}}","habit_rule_weekly": "Щотижня ({{day}}) о {{time}}","habit_rule_hourly": "Кожні {{hours}} год","habit_rule_minutely": "Кожні {{minutes}} хв","habit_rule_days": "Кожні {{days}} дн","habit_rule_mixed": "Кожні {{hours}} год {{minutes}} хв","habit_reset_hours_label": "Годин","habit_reset_minutes_label": "Хвилин","condition_min_options_error": "Умова повинна мати принаймні один варіант (пін)!","condition_settings_title": "Налаштування умови","condition_text_label": "Текст умови","condition_text_placeholder": "наприклад, Оплата пройшла успешно?","condition_options_label": "Варіанти (Вихідні піни)","condition_multiselect_label": "Кілька варіантів вибору","condition_multiselect_desc": "Дозволити одночасну активацію кількох виходів","habit_settings_title": "Налаштування звички","habit_name_label": "Назва звички","habit_name_placeholder": "наприклад, Вивчення англійської","habit_description_label": "Опис / Примітка","habit_description_placeholder": "Деталі або мотивація...","habit_reset_mode_label": "Режим скидання","habit_reset_daily": "Щодня (Daily)","habit_reset_weekly": "Щотижня (Weekly)","habit_reset_interval": "Свій інтервал","habit_reset_time_label": "Час скидання (типово 00:00)","habit_reset_time_label_short": "Час скидання","habit_reset_day_label": "День тижня","habit_reset_interval_value": "Скидати кожні","habit_interval_minutes": "хвилин","habit_interval_hours": "годин","habit_interval_days": "днів","context_menu": {"create_node": "СТВОРИТИ НОДУ","goal_node": "Ціль (Sketch Node)","subgoal_node": "Суб-ціль (Sub-goal)","condition_node": "Умова (Condition)","habit_node": "Звичка (Habit)","export_png": "Експорт в PNG","delete": "Видалити"}},"achievements": {"unlocked_header": "Досягнення розблоковано!","notification_header": "Сповіщення","blank_canvas": {"title": "Чисте полотно","description": "Створіть свій перший проект (граф)."},"connecting_the_dots": {"title": "З\u0027єднання точок","description": "Створіть 10 зв\u0027язків між завданнями."},"sketch_master": {"title": "Майстер ескізів","description": "Створіть загалом 100 вузлів завдань."},"daily_doodler": {"title": "Щоденний рисувальник","description": "Відстежте звички 7 разів."},"decision_maker": {"title": "Рішучий діяч","description": "Виконайте 50 завдань."},"clear_desk": {"title": "Чистий стіл","description": "Видаліть 5 проектів."},"first_milestone": {"title": "Перша віха","description": "Виконайте своє перше завдання."},"self_portrait": {"title": "Автопортрет","description": "Завантажте свій аватар профілю."}},"subscription": {"title": "Розблокуйте професійні інструменти TaskFlow","title_p1": "Розблокуйте ","title_highlight": "професійні інструменти","title_p2": " TaskFlow","subtitle": "Припиніть гадати. Почніть проектувати за допомогою ШІ та отримайте повну творчу свободу.","most_recommended": "Найбільш рекомендовано","per_month": "/ міс","social_proof": "Нам довіряють понад 10 000 стратегів у всьому світі","features": {"ai_genius": "ШІ-Геній","ai_genius_desc": "Генерація шляхів на базі GPT-4","infinite": "Нескінченність","infinite_desc": "Без обмежень на вузли чи зв\u0027язки","secure": "Безпека","secure_desc": "Шифрування банківського рівня AES-256","custom": "Персоналізація","custom_desc": "Повна палітра тем для вашого полотна"},"plans": {"free": {"title": "Безкоштовний старт","desc": "Ідеально підходить для швидких особистих ескізів і простого проектування цілей.","btn": "Залишитися на Безкоштовному","feat1": "3 ШІ-генерації на день","feat2": "Максимум 3 полотна","feat3": "Максимум 200 вузлів на полотні","feat4": "Максимум 3 звички","feat5": "Максимум 2 особи на дошці"},"pro": {"title": "Альбом Pro","desc": "Розкрийте весь потенціал стратегії під керівництвом ШІ та отримайте безмежні можливості створення карт.","btn": "Оновити до Pro","feat1": "200 ШІ-генерацій на день","feat2": "Необмежено полотен та вузлів","feat3": "Необмежено звичок","feat4": "Максимум 10 осіб на дошці","feat5": "Розширена аналітика стратегій"},"ultra": {"title": "Альбом Ultra","desc": "Ідеальний інструмент для повної свободи творчості та власних шаблонів.","btn": "Оновити до Ultra","feat1": "Необмежено ШІ-генерацій","feat2": "Необмежено полотен та вузлів","feat3": "Необмежено звичок","feat4": "Необмежено осіб на дошці","feat5": "Створення власних шаблонів","feat6": "Пріоритетна підтримка та VIP інструменти"}},"upgrade_success": "Тарифний план успішно змінено на {{tier}}!","upgrading": "Оновлення...","current_plan": "Поточний тариф","compare": {"feature": "Функція","ai_gens": "Генерацій ШІ / день","canvases": "Канваси","nodes": "Нод на канвас","habits": "Звички","board_members": "Учасники дошки","custom_templates": "Власні шаблони"}}}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541{"common": {"back": "Назад","yes": "Так","no": "Ні","hours_short": "год","minutes_short": "хв","seconds_short": "с","add": "Додати","apply": "Застосувати","cancel": "Скасувати","delete": "Видалити","days_short": {"sun": "Нд","mon": "Пн","tue": "Вт","wed": "Ср","thu": "Чт","fri": "Пт","sat": "Сб"},"days": {"sun": "Неділя","mon": "Понеділок","tue": "Вівторок","wed": "Середа","thu": "Четвер","fri": "П'ятниця","sat": "Субота"}},"sidebar": {"projects": "Проекти","canvas": "Полотно","habits": "Звички","profile": "Профіль","settings": "Налаштування","free_plan": "Безкоштовний тариф","upgrade_now": "Оновити зараз","logout": "Вийти","free_active": "ШІ: {{count}}/3 на день","pro_active": "ШІ: {{count}}/200 на день","ultra_active": "Усі ліміти знято","go_ultra": "Перейти на Ultra","boards_used": "{{used}}/{{max}} дошок","plus_active": "Без лімітів","free_limits": "Д�� {{nodes}} вузлів на дошці","get_plus": "Отримати Plus"},"landing": {"slogan": "TaskFlow у вашій кишені. Завжди синхронізовано","title": "TaskFlow","description": "Розкрийте свій потенціал, відстежуйте цілі та створюйте корисні звички.","get_started": "Почати","login": "Увійти","features": "Функції","visual_goals": "Візуальні цілі","ai_generation": "ШІ-генерація","habit_streaks": "Серії звичок","hero_title_p1": "Плани руйнуються.","hero_title_p2": "TaskFlow адаптується.","hero_desc": "Перший візуальний конструктор цілей, створений для фокусу. Переходьте від лінійних списків до адаптивних графів, які впораються з життєвими моментами «Якщо/То».","hero_badge": "Підходить для людей з РДУГ. Створено для стійкості.","node_a": "Завдання А","node_b": "Завдання Б","node_failed": "Невдача?","node_c": "Завдання В","node_d": "Завдання Г","adhd_edge": "РДУГ-перевага","ai_find_path": "Дозвольте ШІ знайти шлях, коли ви застрягли.","ai_desc": "TaskFlow бере на себе когнітивне навантаження. Коли план заходить у глухий кут, наш ШІ-агент малює повне дерево стратегії, знаходячи альтернативи, щоб вам не доводилося робити це вручну.","ai_example_input": "Я застряг на залученні користувачів. Що робити?","ai_adapt_plan": "Адаптувати план","ai_early_users": "Залучити перших користувачів","cross_platform": "Кросплатформність","cross_platform_desc": "Не втрачайте свій потік у дорозі. TaskFlow працює за принципом offline-first, безперешкодно синхронізуючи ваші графи цілей між усіма пристроями, щойно ви знову з'явитеся в мережі.","cta_title_p1": "Припиніть боротися зі своїм мозком.","cta_title_p2": "Почніть малювати шляхи."},"pricing": {"title": "Прості тарифи","subtitle": "Жодних прихованих комісій, лише чисте чорнило.","free": "Безкоштовно","pro": "Pro","team": "Team","month": "місяць","user": "користувач","start_free": "Почати безкоштовно","go_pro": "Спробувати Pro","contact_us": "Зв'язатися з нами","free_feat1": "3 нескінченних полотна","free_feat2": "Базові форми та логіка","free_feat3": "Шаблони спільноти","pro_feat1": "Необмежена кількість полотен","pro_feat2": "ШІ-генерація шляхів","pro_feat3": "Розширене відстеження звичок","pro_feat4": "Пріоритетна підтримка","team_feat1": "Усе з тарифу Pro","team_feat2": "Спільна робота в реальному часі","team_feat3": "Командні робочі простори","team_feat4": "Адміністративні інструменти","premium_feature": "Преміум функція","paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.","upgrade_premium": "Оновити до Преміум","maybe_later": "Можливо пізніше"},"auth": {"welcome_back": "З поверненням!","create_account": "Створити акаунт","sign_in_desc": "Увійдіть, щоб продовжити свою подорож","sign_up_desc": "Приєднуйтесь до TaskFlow, щоб досягати своїх цілей","email": "Електронна адреса","password": "Пароль","name": "Повне ім'я","sign_in": "Увійти","sign_up": "Зареєструватися","no_account": "Немає акаунту? Зареєструватися","has_account": "Вже маєте акаунт? Увійти","passwords_do_not_match": "Паролі не збігаються","start_flow": "Почніть свій потік","plans_waiting": "Ваші плани чекають на вас.","join_revolution": "Приєднуйтесь до візуальної революції.","full_name": "Повне ім'я","enter_name": "Введіть ваше ім'я","forgot": "Забули?","confirm_password": "Підтвердьте пароль","processing": "Обробка...","enter_workspace": "Увійти в робочий простір","or_continue": "Або продовжити за допомогою","google_failed": "Помилка входу через Google","dont_have_account": "Немає акаунту? Зареєструватися","already_member": "Вже є учасником? Увійти"},"onboarding": {"title": "Ласкаво просимо до TaskFlow","subtitle": "Давайте налаштуємо вашу карту цілей","step1_title": "Візуальні вузли цілей","step1_desc": "Зобразіть свої мрії у вигляді взаємопов'язаних вузлів на чудовому полотні. Розбивайте великі цілі на дрібні кроки.","step2_title": "Динамічна логіка","step2_desc": "Додавайте перевірки умов (вибір Так/Ні), щоб моделювати альтернативні шляхи.","step3_title": "Авто-розкладка і шаблони","step3_desc": "Почніть із шаблону й тримайте дошку в порядку одним кліком.","next": "Далі","back": "Назад","lets_go": "Поїхали!","step_0": {"title": "Полотно цілей","description": "Забудьте про лінійні списки. TaskFlow — це цифровий альбом для малювання, де ваші ідеї живуть у візуальному графі. Вільно масштабуйте, панорамуйте та розширюйте свої думки до нескінченності.","note": "Ваш мозок не працює як список, то чому ваші завдання мають бути такими?"},"step_1": {"title": "Логіка та зв'язки","description": "З'єднуйте вузли за допомогою логіки «Якщо/То». Визначайте, що відбувається у разі успіху або невдачі завдання. Будуйте стійкий план на будь-який випадок.","note": "Якщо відбувається А, то робимо Б. Якщо ні, спробуйте В."},"step_2": {"title": "Авто-розкладка і шаблони","description": "Почніть із шаблону, а коли на дошці стане безладно, натисніть Shift+L — TaskFlow вишикує кроки в акуратний потік.","note": "Менше перетягування блоків — більше справ."},"step_3": {"title": "Дофамін та фокус","description": "Отримуйте бали за виконані кроки й відкривайте досягнення. TaskFlow тримає мотивацію і фокус на головному.","note": "Перетворіть рутину на гру, яка вам подобається."},"visual": {"goal": "Ціль","success": "Успіх","blocked": "Безлад на дошці","ai_generating": "Shift+L","streak_text": "Досягнення відкрито!"},"step_indicator": "Крок {{current}} з {{total}}","begin": "Почнемо!","next_chapter": "Наступний розділ"},"dashboard": {"your_projects": "Ваші проекти","search_placeholder": "Пошук проектів...","new_blank_canvas": "Нове чисте полотно","project": "Проект","active_steps": "активних кроків","loading_projects": "Завантаження проектів...","no_projects": "Проектів ще немає. Створіть чисте полотно, щоб почати!","create_project_title": "Створити новий проект","project_name": "Назва проекту","project_desc": "Опис проекту","cancel": "Скасувати","create": "Створити","delete_title": "Видалити проект","delete_confirm": "Ви впевнені, що хочете видалити цей проект? Цю дію не можна скасувати.","delete": "Видалити"},"habits": {"habit_tracker": "Трекер звичок","consistency_score": "Показник стабільнос��і","consistency_desc": "Цього тижня ви входите до 5% найкращих стратегів!","active_streak": "Активна серія","days": "днів","today_check_in": "Сьогоднішній чеклист звичок","weekly_streak": "Календар тижневої серії","streak": "серія","no_habits": "Звички поки що не відстежуються. Додайте власні звички на ваше полотно цілей, щоб побачити їх тут!","complete": "Виконано","pending": "Очікується","loading": "Завантаження полотен зі звичками...","no_habits_title": "Поки що немає полотен зі звичками","reward_desc": "Виконуйте звички на ваших картах стратегій, щоб швидше підвищувати рівень.","track_for_date": "Відстежити для {{date}}","complete_notification_title": "Звичку виконано! 🔥","complete_notification_desc_custom": "Зафіксовано виконання для {{date}}","complete_notification_desc": "Активну серію збільшено! Нараховано +50 XP!","recharge_notification_title": "Звичку перезаряджено! ⚡","recharge_notification_desc": "Звичка \"{{name}}\" знову готова до виконання!","recharge_notification_header": "ЗВИЧКА ГОТОВА"},"profile": {"profile": "Профіль","user_level": "Рівень користувача","experience": "Досвід","stats": "Статистика","completed_goals": "Виконані цілі","active_habits": "Активні звички","experience_points": "Очки досвіду","level_progress": "Прогрес рівня","achievements": "Блокнот досягнень","unlocked": "Розблоковано","locked": "Заблоковано","total_points": "Всього очок"},"settings": {"settings": "Налаштування","general": "Загальні","canvas": "Налаштування полотна","account_billing": "Обліковий запис та оплата","theme": "Налаштування додатка","preferred_language": "Бажана мова","theme_label": "Візуальна тема","dark_mode": "Темна тема","light_mode": "Світла тема","security": "Безпека","update_password": "Оновити пароль","delete_account": "Видалити акаунт","subscription": "Тарифний план","upgrade_pro": "Оновити до TaskFlow Pro","cancel_sub": "Скасувати підписку","saved_success": "Налаштування успішно оновлено!","slogan": "Налаштуйте свій робочий простір до ідеалу.","general_preferences": "Загальні налаштування","theme_desc": "Перемикання між світлою та темною темами.","notifications_title": "Сповіщення на робочому столі","notifications_desc": "Отримуйте сповіщення про терміни виконання завдань та нагадування про звички.","language_desc": "Виберіть основну мову інтерфейсу.","canvas_behavior": "Поведінка полотна","ai_guidance_title": "Активне керівництво ШІ","ai_guidance_desc": "Дозволити ШІ проактивно пропонувати альтернативні шляхи, коли ви відзначаєте вузол як заблокований.","snap_to_grid_title": "Прив'язка до сітки","snap_to_grid_desc": "Автоматично вирівнювати вузли по лініях сітки для охайнішого вигляду.","default_node_color": "Колір вузла за замовчуванням","data_management": "Управління даними","export_json": "Експорт у JSON","import_vault": "Імпорт сховища","danger_zone": "Небезпечна зона","delete_desc": "Ця дія є незворотною. Всі ваші карти та звички будуть стерті.","delete_forever": "Видалити назавжди"},"canvas": {"new_goal": "Нова ціль","new_habit": "Нова звичка","new_condition": "Нова умова?","ai_assistant": "ШІ-помічник","ai_thinking": "ШІ думає...","premium_feature": "Преміум функція","paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.","upgrade_premium": "Оновити до Преміум","maybe_later": "Можливо пізніше","roadmap_strategist": "Стратег дорожньої карти","drafting_roadmap": "Створення вашої дорожньої карти...","strategist_desc": "\" Стратег малює оптимальні з'єднання шляхів, підцілі та контрольні точки на вашому полотні... \"","bubble_text": "\" Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні. \"","quick_suggestions": "Швидкі пропозиції","suggestion_detail": "Розбити поточний крок на підзавдання","suggestion_route": "Запропонувати альтернативний шлях у разі невдачі","suggestion_habits": "Створити щоденні звички для зміцнення цієї цілі","input_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...","tag_detail": "Деталізація","tag_route": "Маршрут","tag_habits": "Звички","condition_yes": "Так","condition_no": "Ні","condition_node_label": "Умова","ai_suggest_details": "Розбити поточний крок на підзавдання","ai_suggest_details_tag": "Деталізація","ai_suggest_route": "Запропонувати альтернативний шлях у разі невдачі","ai_suggest_route_tag": "Альтернатива","canvas.ai_suggest_habits": "Створити щоденні звички для зміцнення цієї цілі","ai_suggest_habits_tag": "Звички","ai_roadmap_strategist": "Стратег дорожньої карти","ai_maintenance_title": "ШІ на обслуговуванні","ai_maintenance_desc": "Ми оновлюємо нашого ШІ-стратега для забезпечення ще швидшої, точнішої та гнучкішої генерації планів. Дякуємо за ваше терпіння!","ai_maintenance_btn": "Зрозуміло","ai_drafting": "Створення вашої дорожньої карти...","ai_drafting_desc": "Стратег малює оптимальні з'єднання шляхів, підцілі та контрольні точки на вашому полотні...","ai_bubble_desc": "Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні.","ai_quick_suggestions": "Швидкі пропозиції","ai_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...","condition": "Умова","strategic_goal_map": "Візуальна карта цілей","save_strategy": "Зберегти стратегію","saving": "Збереження...","export_empty_error": "Карта порожня! Додайте вузли перед експортом.","subgoal_warning": "Неможливо виконати: спочатку завершіть всі суб-цілі!","subgoals_progress": "Суб-цілі: {{done}} з {{total}} виконано","export_error": "Помилка при експорті в PNG:","habit": "Звичка","habit_status": "Status","habit_status_done": "Виконано","habit_status_pending": "Очікує","habit_action_done": "Зроблено!","habit_action_todo": "Виконати","habit_reset_rule": "Правило скидання","habit_countdown_label": "До скидання","habit_resetting": "Скидання...","habit_signal_active": "ДАЄ СИГНАЛ ⚡","habit_signal_inactive": "СИГНАЛ ВИМК. 💤","habit_test_reset": "Тест-скидання","habit_test_reset_tooltip": "Скинути звичку та всі пов'язані з нею наступні цілі прямо зараз","habit_rule_daily": "Щодня о {{time}}","habit_rule_weekly": "Щотижня ({{day}}) о {{time}}","habit_rule_hourly": "Кожні {{hours}} год","habit_rule_minutely": "Кожні {{minutes}} хв","habit_rule_days": "К��жні {{days}} дн","habit_rule_mixed": "Кожні {{hours}} год {{minutes}} хв","habit_reset_hours_label": "Годин","habit_reset_minutes_label": "Хвилин","condition_min_options_error": "Умова повинна мати принаймні один варіант (пін)!","condition_settings_title": "Налаштування умови","condition_text_label": "Текст умови","condition_text_placeholder": "наприклад, Оплата пройшла успешно?","condition_options_label": "Варіанти (Вихідні піни)","condition_multiselect_label": "Кілька варіантів вибору","condition_multiselect_desc": "Дозволити одночасну активацію кількох виходів","habit_settings_title": "Налаштування звички","habit_name_label": "Назва звички","habit_name_placeholder": "наприклад, Вивчення англійської","habit_description_label": "Опис / Примітка","habit_description_placeholder": "Деталі або мотивація...","habit_reset_mode_label": "Режим скидання","habit_reset_daily": "Щодня (Daily)","habit_reset_weekly": "Щотижня (Weekly)","habit_reset_interval": "Свій інтервал","habit_reset_time_label": "Час скидання (типово 00:00)","habit_reset_time_label_short": "Час скидання","habit_reset_day_label": "День тижня","habit_reset_interval_value": "Скидати кожні","habit_interval_minutes": "хвилин","habit_interval_hours": "годин","habit_interval_days": "днів","context_menu": {"create_node": "СТВОРИТИ НОДУ","goal_node": "Ціль (Sketch Node)","subgoal_node": "Суб-ціль (Sub-goal)","condition_node": "Умова (Condition)","habit_node": "Звичка (Habit)","export_png": "Експорт в PNG","delete": "Видалити","insert_template": "Вставити шаблон","auto_layout": "Авто-розкладка"},"toolbar": {"auto_layout": "Авто-розкладка (Shift+L)","templates": "Шаблони"}},"achievements": {"unlocked_header": "Досягнення розблоковано!","notification_header": "Сповіщення","blank_canvas": {"title": "Чисте полотно","description": "Створіть свій перший проект (граф)."},"connecting_the_dots": {"title": "З'єднання точок","description": "Створіть 10 зв'язків між завданнями."},"sketch_master": {"title": "Майстер ескізів","description": "Створіть загалом 100 вузлів завдань."},"daily_doodler": {"title": "Щоденний рисувальник","description": "Відстежте звички 7 разів."},"decision_maker": {"title": "Рішучий діяч","description": "Виконайте 50 завдань."},"clear_desk": {"title": "Чистий стіл","description": "Видаліть 5 проектів."},"first_milestone": {"title": "Перша віха","description": "Виконайте своє перше завдання."},"self_portrait": {"title": "Автопортрет","description": "Завантажте свій аватар профілю."}},"subscription": {"title": "Розблокуйте професійні інструменти TaskFlow","title_p1": "Розблокуйте ","title_highlight": "професійні інструменти","title_p2": " TaskFlow","subtitle": "Припиніть гадати. Почніть проектувати за допомогою ШІ та отримайте повну творчу свободу.","most_recommended": "Найбільш рекомендовано","per_month": "/ міс","social_proof": "Нам довіряють понад 10 000 стратегів у всьому світі","features": {"ai_genius": "ШІ-Геній","ai_genius_desc": "Генерація шляхів на базі GPT-4","infinite": "Нескінченність","infinite_desc": "Без обмежень на вузли чи зв'язки","secure": "Безпека","secure_desc": "Шифрування банківського рівня AES-256","custom": "Персоналізація","custom_desc": "Повна палітра тем для вашого полотна"},"plans": {"free": {"title": "Безкоштовний старт","desc": "Ідеально підходить для швидких особистих ескізів і простого проектування цілей.","btn": "Залишитися на Безкоштовному","feat1": "3 ШІ-генерації на день","feat2": "Максимум 3 полотна","feat3": "Максимум 200 вузлів на полотні","feat4": "Максимум 3 звички","feat5": "Максимум 2 особи на дошці"},"pro": {"title": "Альбом Pro","desc": "Розкрийте весь потенціал стратегії під керівництвом ШІ та отримайте безмежні можливості створення карт.","btn": "Оновити до Pro","feat1": "200 ШІ-генерацій на день","feat2": "Необмежено полотен та вузлів","feat3": "Необмежено звичок","feat4": "Максимум 10 осіб на дошці","feat5": "Розширена аналітика стратегій"},"ultra": {"title": "Альбом Ultra","desc": "Ідеальний інструмент для повної свободи творчості та власних шаблонів.","btn": "Оновити до Ultra","feat1": "Необмежено ШІ-генерацій","feat2": "Необмежено полотен та вузлів","feat3": "Необмежено звичок","feat4": "Необмежено осіб на дошці","feat5": "Створення власних шаблонів","feat6": "Пріоритетна підтримка та VIP інструменти"}},"upgrade_success": "Тарифний план успішно змінено на {{tier}}!","upgrading": "Оновлення...","current_plan": "Поточний тариф","compare": {"feature": "Функція","ai_gens": "Генерацій ШІ / день","canvases": "Канваси","nodes": "Нод на канвас","habits": "Звички","board_members": "Учасники дошки","custom_templates": "Власні шаблони"}},"plans": {"no_limits": "Без лімітів","switched": "Ваш тариф тепер {{plan}}.","payments_soon": "Онлайн-оплату ще не підключено. Plus скоро стане доступним.","switch_failed": "Не вдалося змінити тариф. Спробуйте ще раз.","free_desc": "Усе, що потрібно для власних планів.","free_btn": "Перейти на Free","plus_desc": "Для великих планів і команд. Жодних обмежень.","plus_btn": "Отримати Plus","feat_boards": "До {{count}} дошок","feat_nodes": "До {{count}} вузлів на дошці","feat_guests": "До {{count}} гостей на дошці","feat_templates": "Збережених шаблонів: {{count}}","feat_core": "Усі типи вузлів, авто-розкладка, експорт PNG/JSON","feat_unlimited_boards": "Безліміт дошок","feat_unlimited_nodes": "Безліміт вузлів","feat_unlimited_guests": "Безліміт учасників","feat_unlimited_templates": "Безліміт шаблонів","feat_everything_free": "Усе з Free","row_boards": "Дошки","row_nodes": "Вузлів на дошці","row_guests": "Гостей на дошці","row_templates": "Збережені шаблони","title_p1": "Два тарифи. ","title_highlight": "Без дрібного шрифту.","subtitle": "У Free невеликі ліміти на створення. У Plus їх немає.","limit_title": "Ліміт тарифу Free","limit_nodes_desc": "На тарифі Free дошка вміщує до {{count}} вузлів. У Plus лімітів немає.","see_plus": "Детальніше про Plus"},"templates": {"untitled": "Дошка без назви","tab_all": "Усі","tab_builtin": "Стартові","tab_mine": "Мої шаблони","delete_confirm": "Видалити","delete": "Видалити шаблон","blank": "Порожня дошка","blank_desc": "Почати з чистого холста.","node_count": "Вузлів: {{count}}","create_title": "Нова дошка","insert_title": "Вставити шаблон","create_desc": "Почніть з порожньої дошки або з шаблону. Шаблони розкладаються автоматично.","insert_desc": "Шабл��н додається в центр екрана й лишається виділеним, щоб його можна було перемістити.","search": "Пошук шаблонів...","all_categories": "Усі категорії","empty_mine": "Збережених шаблонів ще немає","nothing_found": "Нічого не знайдено","empty_mine_hint": "Відкрийте будь-яку дошку й натисніть «Зберегти як шаблон» — усю дошку або лише виділені вузли.","free_note": "Тариф Free: {{used}}/{{max}} збережених шаблонів.","go_plus": "У Plus ліміту немає","create_btn": "Створити дошку","insert_btn": "Вставити","my_category": "Мої шаблони","save_failed": "Не вдалося зберегти шаблон.","save_title": "Зберегти як шаблон","saved": "Шаблон збережено","only_selected": "Виділене ({{count}})","whole_board": "Уся дошка","field_title": "Назва","field_desc": "Опис","field_category": "Категорія","save_hint": "Статуси, прогрес і виконавці не зберігаються — шаблон стає чистою відправною точкою.","save_btn": "Зберегти шаблон"}}
82 unmodified lines838485868788896 unmodified lines969798991001011021031041051119 unmodified lines1225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327230 unmodified lines155815591560156115621563156454 unmodified lines1619162016211622162316241625435 unmodified lines206120622063206420652066206713 unmodified lines20812082208320842085208620871 unmodified line20892090209120922093209420952096209720982099210021012102210325 unmodified lines212921302131213221332134213521362137213821392140112 unmodified lines22532254225522562257225822592260226122622263226422652266339 unmodified lines26062607260826092610261111 unmodified lines2623262426252626262726282629281 unmodified lines29112912291329142915291629172918291927 unmodified lines2947294829492950295129522953295413 unmodified lines29682969297029712972297364 unmodified lines30383039304030413042304330443045304630473048304930503051305230533054305530563057150 unmodified lines3208320932103211321232133214321532163217321832193220322132223223322493 unmodified lines33183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334473 unmodified lines341834193420342134223423342434253426342734283429343082 unmodified linesimport Sidebar from '../components/Sidebar';import { useAuth } from '../context/AuthContext';import { useTheme } from '../context/ThemeContext';import { Maximize2, Play, Settings, Save, ChevronLeft, ChevronDown, ChevronUp, Loader2, Trash2, Target, GitFork, Image, X, Plus, Timer, Milestone, Share2, User, Copy, Scissors, Clipboard, Check, StickyNote, Pin, Type, Tag, Search, ListTodo, Map, Download, FileJson, BookOpen } from 'lucide-react';// Feature componentsimport SketchNode from '../features/canvas/components/nodes/SketchNode';6 unmodified linesimport PathNode from '../features/canvas/components/nodes/PathNode';import StickerEdge from '../features/canvas/components/StickerEdge';import CanvasToolbar from '../features/canvas/components/CanvasToolbar';import AIHintOverlay from '../features/canvas/components/AIHintOverlay';import PaywallModal from '../features/canvas/components/PaywallModal';import { useCanvasLogic } from '../features/canvas/hooks/useCanvasLogic';import { isDefaultLabel } from '../features/canvas/utils';// Premium digital sketchbook style settings modal for condition nodesconst ConditionSettingsModal = ({ node, onClose, onSave }) => {1119 unmodified lines);};const SaveTemplateModal = ({ projectId, initialTitle, initialDesc, onClose }) => {const { t } = useTranslation();const [title, setTitle] = useState(initialTitle || '');const [desc, setDesc] = useState(initialDesc || '');const [loading, setLoading] = useState(false);const [error, setError] = useState('');const [success, setSuccess] = useState(false);const handleSubmit = async (e) => {e.preventDefault();if (!title.trim()) return;setLoading(true);setError('');try {const API_URL = import.meta.env.VITE_API_URL;await axios.post(`${API_URL}/graphs/${projectId}/save-as-template`, {title,description: desc});setSuccess(true);setTimeout(() => {onClose();}, 1500);} catch (err) {console.error('[SaveTemplate] Failed to save template:', err);setError(err.response?.data?.message || 'Не вдалося зберегти шаблон. Перевірте підключення.');} finally {setLoading(false);}};return (<div className="fixed inset-0 z-[60] flex items-center justify-center p-4"><div onClick={onClose} className="absolute inset-0 bg-primary/20 backdrop-blur-sm z-[60]" /><div className="relative bg-surface-container-lowest w-full max-w-md p-8 rough-border rough-shadow flex flex-col gap-6 z-[70]"><button type="button" onClick={onClose} className="absolute top-4 right-4 text-on-surface-variant hover:text-primary transition-colors cursor-pointer"><X size={24} /></button><h3 className="text-3xl font-display-lg text-primary flex items-center gap-2"><BookOpen size={24} /><span>Зберегти як шаблон</span></h3>{success ? (<div className="py-6 text-center text-green-600 font-bold text-xl">Шаблон успішно збережено!</div>) : (<form onSubmit={handleSubmit} className="space-y-6">{error && (<div className="bg-error/10 text-error p-3 rough-border text-sm font-bold">{error}</div>)}<div className="relative group"><label className="text-xs font-bold text-primary uppercase tracking-wider block mb-1">Назва шаблону</label><inputtype="text"value={title}onChange={(e) => setTitle(e.target.value)}placeholder="Введіть назву..."className="w-full bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-2 text-lg font-body-md outline-none transition-all"required/></div><div className="relative group"><label className="text-xs font-bold text-primary uppercase tracking-wider block mb-1">Опис шаблону</label><textarearows={3}value={desc}onChange={(e) => setDesc(e.target.value)}placeholder="Введіть короткий опис..."className="w-full bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-2 text-lg font-body-md outline-none transition-all resize-none"/></div><div className="flex gap-4"><buttontype="button"onClick={onClose}className="flex-1 py-3 text-sm font-bold border-2 border-primary/10 rounded-xl hover:bg-primary/5 cursor-pointer">Скасувати</button><buttontype="submit"disabled={loading || !title.trim()}className="flex-1 py-3 text-sm font-bold text-white bg-primary border-2 border-primary rounded-xl hover:bg-primary/95 cursor-pointer disabled:opacity-50">{loading ? 'Збереження...' : 'Зберегти'}</button></div></form>)}</div></div>);};const ShareModal = ({ projectId, onClose }) => {const { t } = useTranslation();const [email, setEmail] = useState('');230 unmodified linesconst getSubtasks = useCallback((parentId) => {const list = nodes.filter(n => n.type === 'sketch' || n.type === 'habit').filter(n => findParentId(n.id) === parentId);return [...list].sort((a, b) => (a.position?.y || 0) - (b.position?.y || 0));54 unmodified linesconst orderedRootTasks = useMemo(() => {const rootTasks = nodes.filter(n => n.type === 'sketch' || n.type === 'habit').filter(n => findParentId(n.id) === null);return [...rootTasks]435 unmodified lines</div><h4 className="text-lg font-display-md text-primary mb-2">Немає завдань</h4><p className="text-xs font-bold uppercase tracking-widest text-primary/50 max-w-md mx-auto leading-relaxed">Створіть цілі або звички на холсті або змініть налаштування фільтрації у верхній панелі!</p></div>) : (13 unmodified linesconst { screenToFlowPosition, getNodes, fitView } = useReactFlow();const mousePosRef = useRef({ x: window.innerWidth / 2, y: window.innerHeight / 2 });const {setNodes,nodes,edges,1 unmodified lineonEdgesChange,onConnect,onEdgesDelete,isAIActive,setIsAIActive,aiLoading,submitAICanvasPrompt,chatMessages,setChatMessages,showPaywall,setShowPaywall,handleAIRequest,addNewNodeAt,handleCopy,handleCut,25 unmodified linescanRedo,takeHistorySnapshot,updateProjectMetadata,chatThreads,activeThreadId,setActiveThreadId,createNewThread,deleteThread,renameThread,isLoading} = useCanvasLogic(id, user);112 unmodified linesconst [isShareModalOpen, setIsShareModalOpen] = useState(false);const [isEditingMetadata, setIsEditingMetadata] = useState(false);const [isSaveTemplateOpen, setIsSaveTemplateOpen] = useState(false);const [saveTemplateTitle, setSaveTemplateTitle] = useState('');const [saveTemplateDesc, setSaveTemplateDesc] = useState('');const handleSaveTemplateClick = () => {setSaveTemplateTitle(projectTitle || '');setSaveTemplateDesc(projectData?.description || '');setIsSaveTemplateOpen(true);};// Global Brush Mode Statesconst [drawingMode, setDrawingMode] = useState(false);339 unmodified linesreturn;}if (event.key === 'Delete' || event.key === 'Backspace') {if (permission === 'Read') return; // Read-only restriction!11 unmodified lineswindow.addEventListener('keydown', handleKeyDown, { capture: true });return () => window.removeEventListener('keydown', handleKeyDown, { capture: true });}, [nodes, edges, deleteNode, deleteEdge, permission, handleCopy, handleCut, handlePaste, undo, redo, requestDeletion, processClipboardData]);const handleNodeContextMenu = useCallback((event, node) => {281 unmodified lines</button>)}{permission === 'Owner' && user?.subscriptionTier === 'Ultra' && (<buttononClick={handleSaveTemplateClick}className="flex items-center gap-2 px-6 py-3 rounded-xl font-bold bg-secondary text-on-secondary hover:scale-105 active:scale-95 transition-all rough-border cursor-pointer shadow-[3px_3px_0px_0px_var(--color-primary)] hover:shadow-[1px_1px_0px_0px_var(--color-primary)] active:translate-y-0.5"><BookOpen size={20} />27 unmodified lines>{permission !== 'Read' && (<CanvasToolbarhandleAIRequest={handleAIRequest}isAIActive={isAIActive}user={user}addNewNodeAt={addNewNodeAt}handleCopy={handleCopy}13 unmodified linescanRedo={canRedo}drawingMode={drawingMode}setDrawingMode={setDrawingMode}/>)}64 unmodified lines</svg>)}<AIHintOverlayisAIActive={isAIActive}setIsAIActive={setIsAIActive}aiLoading={aiLoading}submitAICanvasPrompt={submitAICanvasPrompt}chatMessages={chatMessages}setChatMessages={setChatMessages}chatThreads={chatThreads}activeThreadId={activeThreadId}setActiveThreadId={setActiveThreadId}createNewThread={createNewThread}deleteThread={deleteThread}renameThread={renameThread}/><PaywallModal showPaywall={showPaywall} setShowPaywall={setShowPaywall} />{contextMenu && contextMenu.type === 'node' && (150 unmodified lines<GitFork size={15} className="text-primary" /><span>{t('canvas.context_menu.condition_node')}</span></button><buttononClick={(e) => {e.stopPropagation();addNewNodeAt(contextMenu.clientX, contextMenu.clientY, 'habit');setContextMenu(null);}}className="w-full text-left px-2.5 py-1.5 hover:bg-surface-variant text-primary font-bold rounded-md transition-colors flex items-center gap-2 text-xs"><Timer size={15} className="text-secondary" /><span>{t('canvas.context_menu.habit_node')}</span></button>{window.__flowClipboard && window.__flowClipboard.nodes && window.__flowClipboard.nodes.length > 0 && (<>93 unmodified lines<GitFork size={15} className="text-primary" /><span>{t('canvas.context_menu.condition_node')}</span></button><buttononClick={(e) => {e.stopPropagation();const newNodeId = addNewNodeAt(contextMenu.clientX, contextMenu.clientY, 'habit');if (contextMenu.connectionSource && newNodeId) {const { nodeId, handleId, handleType } = contextMenu.connectionSource;const isSource = handleType === 'source';onConnect({source: isSource ? nodeId : newNodeId,target: isSource ? newNodeId : nodeId,sourceHandle: isSource ? handleId : null,targetHandle: isSource ? null : handleId});}setContextMenu(null);}}className="w-full text-left px-2.5 py-1.5 hover:bg-surface-variant text-primary font-bold rounded-md transition-colors flex items-center gap-2 text-xs"><Timer size={15} className="text-secondary" /><span>{t('canvas.context_menu.habit_node')}</span></button></div>)}</div>73 unmodified lines)}{isSaveTemplateOpen && (<SaveTemplateModalprojectId={id}initialTitle={saveTemplateTitle}initialDesc={saveTemplateDesc}onClose={() => setIsSaveTemplateOpen(false)}/>)}</main></div>);82 unmodified lines838485868788896 unmodified lines969798991001011021031041051061071119 unmodified lines122712281229123012311232230 unmodified lines146314641465146614671468146954 unmodified lines1524152515261527152815291530435 unmodified lines196619671968196919701971197213 unmodified lines19861987198819891990199119921993199419951 unmodified line1997199819992000200120022003200425 unmodified lines203020312032203320342035112 unmodified lines21482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191339 unmodified lines2531253225332534253525362537253825392540254125422543254411 unmodified lines2556255725582559256025612562281 unmodified lines28442845284628472848284928502851285227 unmodified lines28802881288228832884288513 unmodified lines28992900290129022903290429052906290764 unmodified lines297229732974297529762977150 unmodified lines312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315893 unmodified lines32523253325432553256325773 unmodified lines333133323333333433353336333733383339334033413342334333443345334633473348334933503351335282 unmodified linesimport Sidebar from '../components/Sidebar';import { useAuth } from '../context/AuthContext';import { useTheme } from '../context/ThemeContext';import { Maximize2, Play, Settings, Save, ChevronLeft, ChevronDown, ChevronUp, Loader2, Trash2, Target, GitFork, Image, X, Plus, Timer, Milestone, Share2, User, Copy, Scissors, Clipboard, Check, StickyNote, Pin, Type, Tag, Search, ListTodo, Map, Download, FileJson, BookOpen, Network, LayoutTemplate } from 'lucide-react';// Feature componentsimport SketchNode from '../features/canvas/components/nodes/SketchNode';6 unmodified linesimport PathNode from '../features/canvas/components/nodes/PathNode';import StickerEdge from '../features/canvas/components/StickerEdge';import CanvasToolbar from '../features/canvas/components/CanvasToolbar';import PaywallModal from '../features/canvas/components/PaywallModal';import { useCanvasLogic } from '../features/canvas/hooks/useCanvasLogic';import { isDefaultLabel } from '../features/canvas/utils';import TemplateGallery from '../features/templates/TemplateGallery';import SaveTemplateModal from '../features/templates/SaveTemplateModal';import { takePendingTemplate } from '../features/templates/templatesApi';// Premium digital sketchbook style settings modal for condition nodesconst ConditionSettingsModal = ({ node, onClose, onSave }) => {1119 unmodified lines);};const ShareModal = ({ projectId, onClose }) => {const { t } = useTranslation();const [email, setEmail] = useState('');230 unmodified linesconst getSubtasks = useCallback((parentId) => {const list = nodes.filter(n => n.type === 'sketch').filter(n => findParentId(n.id) === parentId);return [...list].sort((a, b) => (a.position?.y || 0) - (b.position?.y || 0));54 unmodified linesconst orderedRootTasks = useMemo(() => {const rootTasks = nodes.filter(n => n.type === 'sketch').filter(n => findParentId(n.id) === null);return [...rootTasks]435 unmodified lines</div><h4 className="text-lg font-display-md text-primary mb-2">Немає завдань</h4><p className="text-xs font-bold uppercase tracking-widest text-primary/50 max-w-md mx-auto leading-relaxed">Створіть цілі на холсті або змініть налаштування фільтрації у верхній панелі!</p></div>) : (13 unmodified linesconst { screenToFlowPosition, getNodes, fitView } = useReactFlow();const mousePosRef = useRef({ x: window.innerWidth / 2, y: window.innerHeight / 2 });const {autoLayout,insertTemplate,serializeTemplate,setNodes,nodes,edges,1 unmodified lineonEdgesChange,onConnect,onEdgesDelete,showPaywall,setShowPaywall,addNewNodeAt,handleCopy,handleCut,25 unmodified linescanRedo,takeHistorySnapshot,updateProjectMetadata,isLoading} = useCanvasLogic(id, user);112 unmodified linesconst [isShareModalOpen, setIsShareModalOpen] = useState(false);const [isEditingMetadata, setIsEditingMetadata] = useState(false);const [isSaveTemplateOpen, setIsSaveTemplateOpen] = useState(false);const [isTemplateGalleryOpen, setIsTemplateGalleryOpen] = useState(false);const [templateDropPoint, setTemplateDropPoint] = useState(null);const flowNodeCount = nodes.filter(n => !n.hidden && (n.type === 'sketch' || n.type === 'condition')).length;const handleAutoLayout = useCallback(() => {const moved = autoLayout();if (moved > 0 && !nodes.some(n => n.selected)) {setTimeout(() => fitView({ duration: 600, padding: 0.15, maxZoom: 1 }), 600);}}, [autoLayout, fitView, nodes]);const openTemplateGallery = useCallback((point = null) => {setTemplateDropPoint(point);setIsTemplateGalleryOpen(true);}, []);const handleInsertTemplate = useCallback((template) => {const ids = insertTemplate(template.content, { screenPoint: templateDropPoint || undefined });setIsTemplateGalleryOpen(false);if (ids && ids.length) {setTimeout(() => fitView({ nodes: ids.map(id => ({ id })), duration: 600, padding: 0.3, maxZoom: 1 }), 80);}}, [insertTemplate, templateDropPoint, fitView]);// A board created from a template on the dashboard: insert it once the empty board has loadeduseEffect(() => {if (!id || isLoading || !isVisualizing) return;const pending = takePendingTemplate(id);if (!pending) return;const ids = insertTemplate(pending);if (ids && ids.length) {setTimeout(() => {setNodes(nds => nds.map(n => (n.selected ? { ...n, selected: false } : n)));fitView({ duration: 700, padding: 0.2, maxZoom: 1 });}, 80);}}, [id, isLoading, isVisualizing, insertTemplate, fitView, setNodes]);// Global Brush Mode Statesconst [drawingMode, setDrawingMode] = useState(false);339 unmodified linesreturn;}// Shift+L: auto-layout (selection or whole board)if (event.shiftKey && !event.ctrlKey && !event.metaKey && (event.code === 'KeyL')) {if (permission === 'Read') return;event.preventDefault();handleAutoLayout();return;}if (event.key === 'Delete' || event.key === 'Backspace') {if (permission === 'Read') return; // Read-only restriction!11 unmodified lineswindow.addEventListener('keydown', handleKeyDown, { capture: true });return () => window.removeEventListener('keydown', handleKeyDown, { capture: true });}, [nodes, edges, deleteNode, deleteEdge, permission, handleCopy, handleCut, handlePaste, undo, redo, requestDeletion, processClipboardData, handleAutoLayout]);const handleNodeContextMenu = useCallback((event, node) => {281 unmodified lines</button>)}{permission !== 'Read' && (<buttononClick={() => setIsSaveTemplateOpen(true)}className="flex items-center gap-2 px-6 py-3 rounded-xl font-bold bg-secondary text-on-secondary hover:scale-105 active:scale-95 transition-all rough-border cursor-pointer shadow-[3px_3px_0px_0px_var(--color-primary)] hover:shadow-[1px_1px_0px_0px_var(--color-primary)] active:translate-y-0.5"><BookOpen size={20} />27 unmodified lines>{permission !== 'Read' && (<CanvasToolbaruser={user}addNewNodeAt={addNewNodeAt}handleCopy={handleCopy}13 unmodified linescanRedo={canRedo}drawingMode={drawingMode}setDrawingMode={setDrawingMode}onAutoLayout={handleAutoLayout}onOpenTemplates={() => openTemplateGallery()}canAutoLayout={flowNodeCount >= 2}/>)}64 unmodified lines</svg>)}<PaywallModal showPaywall={showPaywall} setShowPaywall={setShowPaywall} />{contextMenu && contextMenu.type === 'node' && (150 unmodified lines<GitFork size={15} className="text-primary" /><span>{t('canvas.context_menu.condition_node')}</span></button><buttononClick={(e) => {e.stopPropagation();openTemplateGallery({ x: contextMenu.clientX, y: contextMenu.clientY });setContextMenu(null);}}className="w-full text-left px-2.5 py-1.5 hover:bg-surface-variant text-primary font-bold rounded-md transition-colors flex items-center gap-2 text-xs"><LayoutTemplate size={15} className="text-primary" /><span>{t('canvas.context_menu.insert_template', 'Вставити шаблон')}</span></button>{flowNodeCount >= 2 && (<buttononClick={(e) => {e.stopPropagation();handleAutoLayout();setContextMenu(null);}}className="w-full text-left px-2.5 py-1.5 hover:bg-surface-variant text-primary font-bold rounded-md transition-colors flex items-center gap-2 text-xs"><Network size={15} className="text-primary" /><span>{t('canvas.context_menu.auto_layout', 'Авто-розкладка')}</span></button>)}{window.__flowClipboard && window.__flowClipboard.nodes && window.__flowClipboard.nodes.length > 0 && (<>93 unmodified lines<GitFork size={15} className="text-primary" /><span>{t('canvas.context_menu.condition_node')}</span></button></div>)}</div>73 unmodified lines)}{isSaveTemplateOpen && (<SaveTemplateModalopenserialize={serializeTemplate}selectedCount={nodes.filter(n => n.selected && !n.hidden).length}initialTitle={projectTitle || ''}initialDesc={projectData?.description || ''}onClose={() => setIsSaveTemplateOpen(false)}/>)}<TemplateGalleryopen={isTemplateGalleryOpen}mode="insert"onClose={() => setIsTemplateGalleryOpen(false)}onUse={handleInsertTemplate}/></main></div>);
1234567891011121314151617181920212223249 unmodified lines3435363738394041424344454647484950517 unmodified lines596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315483 unmodified lines238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567import React, { useState, useEffect } from 'react';import axios from 'axios';import { motion, AnimatePresence } from 'framer-motion';import { useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';import { Search, Plus, X, Sparkles, BookOpen, Pencil, Rocket, Code, Languages, Activity, Gamepad, DollarSign } from 'lucide-react';const ICON_MAP = {Rocket,Code,Languages,Activity,Gamepad,DollarSign,BookOpen};import Sidebar from '../components/Sidebar';import { useAuth } from '../context/AuthContext';import ProjectCard from '../features/dashboard/components/ProjectCard';import { useDashboardLogic } from '../features/dashboard/hooks/useDashboardLogic';import Modal from '../components/shared/Modal';const DashboardPage = () => {const { user } = useAuth();9 unmodified linesconst {projects,loading,aiGenerating,searchTerm,setSearchTerm,handleCreateProject,handleCreateProjectWithAI,handleDeleteProject,ownedCount} = useDashboardLogic(user);const isFree = !user?.subscriptionTier || user?.subscriptionTier === 'Free';const canvasLimit = isFree ? 3 : Infinity;const isAtCanvasLimit = isFree && ownedCount >= canvasLimit;const handleOpenCreate = () => {if (isAtCanvasLimit) {7 unmodified linesconst [isDeleteOpen, setIsDeleteOpen] = useState(false);const [projectToDelete, setProjectToDelete] = useState(null);// Custom Creation Modal statesconst [scratchTitle, setScratchTitle] = useState('');const [createMode, setCreateMode] = useState('ai'); // 'ai' | 'manual'const [aiGoal, setAiGoal] = useState('');// Templates selection statesconst [templates, setTemplates] = useState([]);const [templatesLoading, setTemplatesLoading] = useState(true);const [selectedTemplate, setSelectedTemplate] = useState(null);const [templateProjectName, setTemplateProjectName] = useState('');useEffect(() => {if (!isCreateOpen) {setScratchTitle('');setAiGoal('');setCreateMode('manual');setSelectedTemplate(null);setTemplateProjectName('');}}, [isCreateOpen]);useEffect(() => {const fetchTemplates = async () => {try {const API_URL = import.meta.env.VITE_API_URL;const res = await axios.get(`${API_URL}/graphs/templates`);setTemplates(res.data || []);} catch (err) {console.error('[Templates] Failed to fetch templates:', err);} finally {setTemplatesLoading(false);}};fetchTemplates();}, []);const selectTemplate = (template) => {setSelectedTemplate(template);setTemplateProjectName(template.title);};const handleTemplateSubmit = (e) => {e.preventDefault();if (!selectedTemplate) return;const title = templateProjectName.trim() || selectedTemplate.title;handleCreateProject(title, selectedTemplate.key);setIsCreateOpen(false);};// Sketchbook Loader statesconst [loadingStepIndex, setLoadingStepIndex] = useState(0);const loadingSteps = [t('canvas.loading_step1', "Sharpening graphite pencils..."),t('canvas.loading_step2', "Opening clean parchment..."),t('canvas.loading_step3', "Calibrating creative compass..."),t('canvas.loading_step4', "Consulting the digital oracle..."),t('canvas.loading_step5', "Sketching outline nodes..."),t('canvas.loading_step6', "Inking critical paths..."),t('canvas.loading_step7', "Blowing dry the ink...")];useEffect(() => {let interval;if (aiGenerating) {setLoadingStepIndex(0);interval = setInterval(() => {setLoadingStepIndex((prev) => (prev + 1) % loadingSteps.length);}, 3500);}return () => clearInterval(interval);}, [aiGenerating]);const openDeleteModal = (id) => {setProjectToDelete(id);setIsDeleteOpen(true);};const handleScratchSubmit = (e) => {e.preventDefault();if (!scratchTitle.trim()) return;handleCreateProject(scratchTitle);setIsCreateOpen(false);};const handleAISubmit = (e) => {e.preventDefault();if (!aiGoal.trim()) return;handleCreateProjectWithAI(aiGoal);setIsCreateOpen(false);};return (83 unmodified lines</div></section>{/* Tabbed Creation Modal */}<AnimatePresence>{isCreateOpen && (<div className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6">{/* Backdrop */}<motion.divinitial={{ opacity: 0 }}animate={{ opacity: 1 }}exit={{ opacity: 0 }}onClick={() => setIsCreateOpen(false)}className="absolute inset-0 bg-primary/20 backdrop-blur-sm animate-fade-in"/>{/* Modal Card */}<motion.divinitial={{ scale: 0.9, opacity: 0, y: 20, rotate: -1 }}animate={{ scale: 1, opacity: 1, y: 0, rotate: 0 }}exit={{ scale: 0.9, opacity: 0, y: 20, rotate: 1 }}className={`relative bg-surface-container-lowest w-full ${createMode === 'template' ? 'max-w-3xl' : 'max-w-lg'} p-8 rough-border rough-shadow flex flex-col gap-6 z-10 transition-all duration-300`}>{/* Close Button */}<buttononClick={() => setIsCreateOpen(false)}className="absolute top-4 right-4 text-on-surface-variant hover:text-primary transition-colors"><X size={24} /></button><div className="flex flex-col gap-2 mt-2"><h3 className="text-3xl font-display-lg text-primary flex items-center gap-2"><BookOpen size={24} /><span>{t('dashboard.create_project_title')}</span></h3><p className="font-body-md text-on-surface-variant">{createMode === 'ai'? 'Дозвольте ШІ розробити для вас детальну дорожню карту цілі.': t('dashboard.create_project_desc', 'Create an empty roadmap and shape your connections manually.')}</p></div>{/* Tab Switcher */}<div className="flex border-b-2 border-primary/10 gap-2 pb-1"><buttontype="button"onClick={() => setCreateMode('ai')}className={`flex-grow py-2 text-sm font-bold uppercase transition-all flex items-center justify-center gap-1.5 border-2 ${createMode === 'ai'? 'bg-primary text-white border-primary shadow-[2px_2px_0px_0px_var(--color-primary)]': 'border-transparent text-primary/75 hover:bg-secondary/5 hover:border-primary/20'} rounded-xl cursor-pointer`}><Sparkles size={16} /><span>AI Стратег</span></button><buttontype="button"onClick={() => setCreateMode('template')}className={`flex-grow py-2 text-sm font-bold uppercase transition-all flex items-center justify-center gap-1.5 border-2 ${createMode === 'template'? 'bg-primary text-white border-primary shadow-[2px_2px_0px_0px_var(--color-primary)]': 'border-transparent text-primary/75 hover:bg-secondary/5 hover:border-primary/20'} rounded-xl cursor-pointer`}><BookOpen size={16} /><span>Шаблони</span></button><buttontype="button"onClick={() => setCreateMode('manual')}className={`flex-grow py-2 text-sm font-bold uppercase transition-all flex items-center justify-center gap-1.5 border-2 ${createMode === 'manual'? 'bg-primary text-white border-primary shadow-[2px_2px_0px_0px_var(--color-primary)]': 'border-transparent text-primary/75 hover:bg-secondary/5 hover:border-primary/20'} rounded-xl cursor-pointer`}><Pencil size={16} /><span>Ручний ескіз</span></button></div>{createMode === 'ai' ? (<form onSubmit={handleAISubmit} className="flex flex-col gap-6 mt-2"><div className="relative group"><label className="text-sm font-bold text-primary uppercase tracking-wider block mb-1">Опишіть вашу мету</label><textareaautoFocusrows={3}value={aiGoal}onChange={(e) => setAiGoal(e.target.value)}placeholder="Наприклад: Вивчити основи React та побудувати портф��ліо за 4 тижні"className="w-full bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-3 text-lg font-body-md outline-none transition-all resize-none"/><p className="text-[10px] font-extrabold uppercase text-amber-600 mt-1">* Наш ШІ розіб'є вашу мету на кроки, додасть звички та розрахує позиції!</p></div><div className="flex items-center justify-end gap-4 mt-2"><buttontype="button"onClick={() => setIsCreateOpen(false)}className="px-6 py-2 font-bold text-lg text-on-surface-variant hover:text-primary transition-all">{t('dashboard.cancel')}</button><motion.buttonwhileHover={{ scale: 1.05, rotate: -1 }}whileTap={{ scale: 0.95 }}type="submit"disabled={!aiGoal.trim()}className="bg-primary text-on-primary px-8 py-3 text-xl font-bold rough-border rough-shadow-hover flex items-center gap-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"><Sparkles size={20} /><span>Генерувати</span></motion.button></div></form>) : createMode === 'template' ? (<div className="flex flex-col gap-6 mt-2">{templatesLoading ? (<div className="flex justify-center py-12"><div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div></div>) : (<div className="grid grid-cols-1 md:grid-cols-2 gap-4 max-h-[320px] overflow-y-auto pr-2 custom-scrollbar">{templates.map((tpl) => {const IconComp = ICON_MAP[tpl.icon] || BookOpen;const isSelected = selectedTemplate?.key === tpl.key;return (<divkey={tpl.key}onClick={() => selectTemplate(tpl)}className={`border-2 rounded-xl p-4 transition-all duration-200 cursor-pointer flex gap-4 relative overflow-hidden group ${isSelected? 'bg-primary/5 border-primary shadow-[3px_3px_0px_0px_var(--color-primary)]': 'border-primary/10 hover:border-primary/30 bg-surface-container-low hover:bg-surface-container-high'}`}><div className={`w-12 h-12 rounded-xl flex items-center justify-center shrink-0 transition-transform group-hover:scale-105 ${isSelected ? 'bg-primary text-white' : 'bg-primary/10 text-primary'}`}><IconComp size={24} /></div><div className="flex flex-col flex-grow min-w-0"><div className="flex justify-between items-start gap-2"><span className="font-display-lg text-lg text-primary font-bold leading-tight break-words">{tpl.title}</span></div><span className="text-[9px] uppercase font-bold tracking-wider px-1.5 py-0.5 rounded-sm bg-secondary/10 text-secondary w-fit mt-1">{tpl.category}</span><p className="font-body-sm text-xs text-on-surface-variant/80 mt-2 line-clamp-2">{tpl.description}</p></div></div>);})}</div>)}{selectedTemplate && (<form onSubmit={handleTemplateSubmit} className="flex flex-col gap-4 border-t-2 border-primary/5 pt-4 animate-fade-in"><div className="relative group"><label className="text-xs font-bold text-primary uppercase tracking-wider block mb-1">Назва проекту</label><inputtype="text"value={templateProjectName}onChange={(e) => setTemplateProjectName(e.target.value)}placeholder={selectedTemplate.title}className="w-full bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-2 text-lg font-body-md outline-none transition-all"required/></div><div className="flex items-center justify-end gap-4 mt-2"><buttontype="button"onClick={() => setIsCreateOpen(false)}className="px-6 py-2 font-bold text-lg text-on-surface-variant hover:text-primary transition-all">{t('dashboard.cancel')}</button><motion.buttonwhileHover={{ scale: 1.05, rotate: -1 }}whileTap={{ scale: 0.95 }}type="submit"className="bg-primary text-on-primary px-8 py-3 text-xl font-bold rough-border rough-shadow-hover flex items-center gap-2 cursor-pointer"><Plus size={20} /><span>{t('dashboard.create')}</span></motion.button></div></form>)}</div>) : (<form onSubmit={handleScratchSubmit} className="flex flex-col gap-6 mt-2"><div className="relative group"><label className="text-sm font-bold text-primary uppercase tracking-wider block mb-1">{t('dashboard.project_name')}</label><inputautoFocustype="text"value={scratchTitle}onChange={(e) => setScratchTitle(e.target.value)}placeholder={t('dashboard.project_name_placeholder', 'e.g. Master Classical Piano')}className="w-full bg-surface-container-low border-b-2 border-primary/20 focus:border-primary px-2 py-3 text-xl font-body-md outline-none transition-all"/></div><div className="flex items-center justify-end gap-4 mt-4"><buttontype="button"onClick={() => setIsCreateOpen(false)}className="px-6 py-2 font-bold text-lg text-on-surface-variant hover:text-primary transition-all">{t('dashboard.cancel')}</button><motion.buttonwhileHover={{ scale: 1.05, rotate: -1 }}whileTap={{ scale: 0.95 }}type="submit"disabled={!scratchTitle.trim()}className="bg-primary text-on-primary px-8 py-3 text-xl font-bold rough-border rough-shadow-hover flex items-center gap-2 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"><Plus size={20} /><span>{t('dashboard.create')}</span></motion.button></div></form>)}</motion.div></div>)}</AnimatePresence>{/* Playful Sketchbook Loading Overlay */}<AnimatePresence>{aiGenerating && (<motion.divinitial={{ opacity: 0 }}animate={{ opacity: 1 }}exit={{ opacity: 0 }}className="fixed inset-0 z-[100] flex items-center justify-center p-6 bg-background/80 backdrop-blur-md"><div className="relative bg-surface-container-lowest max-w-lg w-full p-12 text-center rough-border rough-shadow flex flex-col items-center gap-8 graph-paper-bg">{/* Animated Sketching Pencil and Notebook */}<div className="relative w-32 h-32 flex items-center justify-center border-4 border-dashed border-primary/20 rounded-full"><motion.divanimate={{x: [0, 15, -15, 10, -10, 0],y: [0, -10, 10, -5, 5, 0],rotate: [0, 10, -10, 5, -5, 0]}}transition={{repeat: Infinity,duration: 2.5,ease: "easeInOut"}}className="absolute z-10"><Pencil size={56} className="text-primary" /></motion.div><motion.divanimate={{ scale: [1, 1.05, 0.95, 1] }}transition={{ repeat: Infinity, duration: 2.5 }}className="opacity-20 text-secondary"><BookOpen size={64} /></motion.div></div><div className="flex flex-col gap-3"><h2 className="text-4xl font-display-lg text-primary tracking-tight">{t('canvas.drafting_roadmap')}</h2><p className="font-accent-note text-2xl text-secondary">{t('canvas.strategist_desc')}</p></div>{/* Rotating playful loading step */}<div className="min-h-[50px] flex items-center justify-center px-6 py-3 bg-surface-container-low rounded-xl w-full border-2 border-primary/10"><AnimatePresence mode="wait"><motion.pkey={loadingStepIndex}initial={{ opacity: 0, y: 10 }}animate={{ opacity: 1, y: 0 }}exit={{ opacity: 0, y: -10 }}transition={{ duration: 0.3 }}className="text-lg font-body-md text-on-surface-variant italic font-semibold">{loadingSteps[loadingStepIndex]}</motion.p></AnimatePresence></div>{/* Sketchy loading progress bar */}<div className="w-full bg-surface-container-high h-3 rounded-full overflow-hidden border-2 border-primary/20"><motion.divanimate={{width: ["0%", "30%", "65%", "85%", "95%", "95%"],}}transition={{duration: 25,ease: "easeOut"}}className="bg-primary h-full"/></div></div></motion.div>)}</AnimatePresence><ModalisOpen={isDeleteOpen}1234567891011121314159 unmodified lines2526272829303132333435363738397 unmodified lines474849505152535455565758596083 unmodified lines144145146147148149150151152153154155156import React, { useState, useEffect } from 'react';import { motion } from 'framer-motion';import { useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';import { Search, Plus } from 'lucide-react';import Sidebar from '../components/Sidebar';import { useAuth } from '../context/AuthContext';import ProjectCard from '../features/dashboard/components/ProjectCard';import { useDashboardLogic } from '../features/dashboard/hooks/useDashboardLogic';import Modal from '../components/shared/Modal';import TemplateGallery from '../features/templates/TemplateGallery';import { FREE_LIMITS, isPlus } from '../config/plans';const DashboardPage = () => {const { user } = useAuth();9 unmodified linesconst {projects,loading,creating,searchTerm,setSearchTerm,handleCreateProject,handleDeleteProject,ownedCount} = useDashboardLogic(user);const isAtCanvasLimit = !isPlus(user) && ownedCount >= FREE_LIMITS.boards;const handleOpenCreate = () => {if (isAtCanvasLimit) {7 unmodified linesconst [isDeleteOpen, setIsDeleteOpen] = useState(false);const [projectToDelete, setProjectToDelete] = useState(null);const openDeleteModal = (id) => {setProjectToDelete(id);setIsDeleteOpen(true);};const handleUseTemplate = async (template, title) => {const ok = await handleCreateProject(title, template);if (ok) setIsCreateOpen(false);};return (83 unmodified lines</div></section><TemplateGalleryopen={isCreateOpen}mode="create"busy={creating}onClose={() => setIsCreateOpen(false)}onUse={handleUseTemplate}/><ModalisOpen={isDeleteOpen}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674import React, { useEffect } from 'react';import { motion } from 'framer-motion';import { useNavigate } from 'react-router-dom';import { useAuth } from '../context/AuthContext';const fadeInUp = {initial: { opacity: 0, y: 30 },animate: { opacity: 1, y: 0 },transition: { duration: 0.8, ease: "easeOut" }};const staggerContainer = {animate: {transition: {staggerChildren: 0.2}}};const LandingPage = () => {const { user } = useAuth();const navigate = useNavigate();useEffect(() => {if (user) {navigate('/dashboard');}}, [user, navigate]);// Force Light Theme on Landing PageuseEffect(() => {const root = document.documentElement;const wasDark = root.classList.contains('dark');if (wasDark) {root.classList.remove('dark');}return () => {const savedTheme = localStorage.getItem('theme');if (savedTheme === 'dark') {root.classList.add('dark');}};}, []);return (<div className="flex flex-col items-center w-full">{/* Section 1: Hero */}<section id="hero" className="w-full flex flex-col items-center text-center gap-10 pt-12 px-margin_edge max-w-screen-2xl mx-auto"><motion.divvariants={staggerContainer}initial="initial"animate="animate"className="max-w-4xl flex flex-col gap-6"><motion.h1variants={fadeInUp}className="text-7xl md:text-8xl font-display-lg text-primary leading-tight">Plans break. <br /><span className="highlighter-bg px-4">TaskFlow adapts.</span></motion.h1><motion.pvariants={fadeInUp}className="text-2xl md:text-3xl text-on-surface-variant max-w-3xl mx-auto leading-relaxed">The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life's "If/Then" moments.</motion.p><motion.divvariants={fadeInUp}className="mt-6 font-accent-note text-3xl text-secondary flex items-center justify-center gap-3"><span className="material-symbols-outlined text-4xl" style={{ fontVariationSettings: '"FILL" 1' }}>psychology</span>ADHD-friendly. Resilience-driven.</motion.div></motion.div>{/* Hero Visual: Mockup */}<motion.divinitial={{ opacity: 0, scale: 0.95 }}whileInView={{ opacity: 1, scale: 1 }}viewport={{ once: true }}transition={{ duration: 1, ease: "easeOut" }}className="w-full max-w-5xl mt-12 relative min-h-[500px] flex items-center justify-center border-2 border-dashed border-primary/30 rounded-2xl bg-white rough-shadow p-12 overflow-visible">{/* SVG Connections - Premium Organic Curves */}<svg className="absolute inset-0 w-full h-full pointer-events-none overflow-visible" style={{ zIndex: 0 }}><defs><marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#181919" /></marker></defs>{/* Path A -> B */}<motion.pathinitial={{ pathLength: 0 }}whileInView={{ pathLength: 1 }}viewport={{ once: true }}transition={{ duration: 1.5, ease: "easeInOut" }}d="M 180 250 Q 260 220 340 250"fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round" strokeDasharray="8 6"/>{/* Path B -> Decision */}<motion.pathinitial={{ pathLength: 0 }}whileInView={{ pathLength: 1 }}viewport={{ once: true }}transition={{ duration: 1.2, delay: 0.5 }}d="M 460 250 Q 530 250 580 250"fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round"/>{/* Path Decision -> C */}<motion.pathinitial={{ pathLength: 0 }}whileInView={{ pathLength: 1 }}viewport={{ once: true }}transition={{ duration: 1.2, delay: 1.5 }}d="M 720 250 Q 780 160 850 160"fill="none" stroke="#45a84a" strokeWidth="4" strokeLinecap="round"/>{/* Path Decision -> D */}<motion.pathinitial={{ pathLength: 0 }}whileInView={{ pathLength: 1 }}viewport={{ once: true }}transition={{ duration: 1.2, delay: 1.7 }}d="M 720 250 Q 780 340 850 340"fill="none" stroke="#ba1a1a" strokeWidth="4" strokeLinecap="round"/>{/* Hand-drawn Annotations */}<motion.g initial={{ opacity: 0 }} whileInView={{ opacity: 1 }} transition={{ delay: 2.2 }}><text fill="#45a84a" fontFamily="Caveat" fontSize="34" x="780" y="130" className="rotate-[-5deg]">Success!</text><text fill="#ba1a1a" fontFamily="Caveat" fontSize="34" x="780" y="390" className="rotate-[5deg]">Try Again</text><text fill="#181919" fontFamily="Caveat" fontSize="24" x="250" y="210">Step 1</text></motion.g>{/* Decorative Scribble */}<motion.pathinitial={{ pathLength: 0, opacity: 0 }}whileInView={{ pathLength: 1, opacity: 0.15 }}transition={{ delay: 3, duration: 2 }}d="M 50 100 Q 150 50 100 150 T 200 100"fill="none" stroke="var(--color-primary)" strokeWidth="2"/></svg>{/* Nodes */}{[{ label: 'Task A', pos: 'left-12 top-[210px]', rot: -2, delay: 0.2 },{ label: 'Task B', pos: 'left-[340px] top-[210px]', rot: 1, delay: 0.4 },{ label: 'Failed?', pos: 'left-[580px] top-[180px]', rot: 45, diamond: true, delay: 0.6 },{ label: 'Task C', pos: 'right-12 top-[120px]', rot: 2, delay: 0.8, color: '#45a84a' },{ label: 'Task D', pos: 'right-12 top-[300px]', rot: -1, delay: 1.0, color: '#ba1a1a' }].map((node, i) => (<motion.divkey={i}initial={{ opacity: 0, scale: 0 }}whileInView={{ opacity: 1, scale: 1 }}animate={{y: [0, i % 2 === 0 ? -8 : 8, 0],rotate: node.diamond ? [45, 47, 43, 45] : [node.rot, node.rot + 1, node.rot - 1, node.rot]}}transition={{initial: { delay: node.delay, type: "spring", stiffness: 200 },animate: { repeat: Infinity, duration: 5 + i, ease: "easeInOut" }}}viewport={{ once: true }}className={`absolute ${node.pos} z-10 flex items-center justify-center p-2 group overflow-visible`}>{node.diamond ? (<div className="w-36 h-36 flex items-center justify-center relative"><div className="absolute inset-0 border-4 border-primary bg-white shadow-[8px_8px_0px_0px_rgba(0,0,0,0.15)] rotate-45 transform transition-transform group-hover:scale-105" /><span className="relative font-display-lg text-2xl text-primary font-bold">Failed?</span></div>) : (<divstyle={{ borderColor: node.color || 'var(--color-primary)' }}className={`bg-white p-6 border-4 rounded-xl shadow-[8px_8px_0px_0px_rgba(0,0,0,0.1)] w-40 text-center transform transition-transform group-hover:scale-105 group-hover:-rotate-2`}><span className="text-2xl font-bold">{node.label}</span>{node.color && (<div className="absolute -top-3 -right-3 bg-white border-2 border-inherit rounded-full p-1 shadow-sm"><span className="material-symbols-outlined text-lg">{node.color === '#45a84a' ? 'check' : 'close'}</span></div>)}</div>)}</motion.div>))}</motion.div></section>{/* Section 2: AI Agent Feature */}<section id="ai-agent" className="w-full grid grid-cols-1 lg:grid-cols-2 gap-20 items-center py-16 px-margin_edge max-w-screen-2xl mx-auto border-t-2 border-primary/10"><motion.divinitial={{ opacity: 0, x: -50 }}whileInView={{ opacity: 1, x: 0 }}viewport={{ once: true }}className="flex flex-col gap-8"><div className="flex items-center gap-4 text-secondary"><span className="material-symbols-outlined text-4xl">neurology</span><span className="text-xl font-bold uppercase tracking-widest">The ADHD Edge</span></div><h2 className="text-6xl font-display-lg text-primary">Let AI build and execute <br />while you orchestrate.</h2><p className="text-2xl text-on-surface-variant leading-relaxed">TaskFlow transforms task management into active delegation. Our AI agent sketches out the project tree, does the heavy lifting (web research, drafting, analysis), and uploads visual evidence (Proof-of-Work) for your review.</p><motion.divwhileHover={{ rotate: 0 }}className="mt-4 bg-white p-8 rough-border rough-shadow inline-block transform rotate-1 max-w-md"><div className="flex items-center gap-4 border-b-2 border-primary/20 pb-4 mb-6"><span className="material-symbols-outlined text-4xl text-primary">robot_2</span><span className="text-sm font-bold text-on-surface-variant uppercase tracking-[0.2em]">AI Orchestrator</span></div><p className="font-accent-note text-3xl text-primary">"Analyze competitor landing pages and show screenshots."</p><div className="flex justify-end mt-6"><button onClick={() => navigate('/auth')} className="bg-primary text-white font-bold py-2 px-6 rough-border shadow-sm">Review Proof</button></div></motion.div></motion.div><motion.divinitial={{ opacity: 0, scale: 0.95 }}whileInView={{ opacity: 1, scale: 1 }}viewport={{ once: true }}className="relative min-h-[600px] w-full bg-white rough-border rough-shadow overflow-hidden rounded-2xl flex items-center justify-center p-8"><div className="absolute inset-0 graph-paper-bg opacity-30 pointer-events-none"></div>{/* Visual Tree with Organic Curves and Advanced Animations */}<svg viewBox="0 0 1000 600" className="w-full h-full max-w-[950px] z-10 overflow-visible">{/* Pulsating Thinking Effect */}<motion.circlecx="150" cy="300" r="40"fill="none" stroke="var(--color-secondary)" strokeWidth="1" strokeDasharray="4 4"animate={{ r: [40, 60, 40], opacity: [0.5, 0, 0.5] }}transition={{ repeat: Infinity, duration: 2, ease: "easeInOut" }}/>{/* Connection Lines - Organic Curves */}<motion.pathinitial={{ pathLength: 0 }}whileInView={{ pathLength: 1 }}viewport={{ once: true }}transition={{ delay: 0.8, duration: 2, ease: "easeInOut" }}d="M 280 300 Q 350 300 380 200 Q 400 120 500 120 M 280 300 Q 380 300 500 300 M 280 300 Q 350 300 380 400 Q 400 480 500 480"fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round"className="opacity-70"/>{/* Root Node */}<foreignObject x="20" y="240" width="260" height="120"><motion.divinitial={{ scale: 0.8, opacity: 0, rotate: -2 }}whileInView={{ scale: 1, opacity: 1, rotate: 0 }}animate={{rotate: [0, 1, -1, 0],y: [0, -4, 0]}}transition={{initial: { duration: 0.5 },animate: { repeat: Infinity, duration: 4, ease: "easeInOut" }}}className="bg-secondary-container/20 p-5 rough-border text-center font-bold text-2xl h-full flex items-center justify-center relative shadow-[4px_4px_0px_0px_rgba(0,0,0,0.05)]"><span className="material-symbols-outlined absolute -top-8 -left-4 text-secondary text-4xl transform -rotate-12">psychology</span>Acquire Early Users</motion.div></foreignObject>{/* Leaf Nodes */}{[{ text: 'Cold Emailing', y: 60, delay: 1.2, rot: 2 },{ text: 'Content Marketing', y: 240, delay: 1.4, rot: -1 },{ text: 'Community Groups', y: 420, delay: 1.6, rot: 1, highlight: true }].map((leaf, i) => (<React.Fragment key={i}><foreignObject x="480" y={leaf.y - 20} width="320" height="170" className="overflow-visible"><motion.divinitial={{ opacity: 0, x: 50, rotate: 5 }}whileInView={{ opacity: 1, x: 0, rotate: leaf.rot }}animate={{y: [0, i % 2 === 0 ? -6 : 6, 0],rotate: [leaf.rot, leaf.rot + 0.5, leaf.rot - 0.5, leaf.rot]}}transition={{initial: { delay: leaf.delay, duration: 0.8 },animate: { repeat: Infinity, duration: 5 + i, ease: "easeInOut" }}}className="p-4 h-full w-full"><div className={`bg-white p-6 border-4 border-primary rounded-xl text-center font-bold text-2xl h-full flex items-center justify-center relative shadow-[8px_8px_0px_0px_rgba(0,0,0,0.1)] ${leaf.highlight ? 'border-secondary shadow-[10px_10px_0px_0px_rgba(102,96,0,0.2)]' : ''}`}>{leaf.text}</div></motion.div></foreignObject>{/* High Impact Annotation */}{leaf.highlight && (<foreignObject x="800" y={leaf.y - 40} width="250" height="150" className="overflow-visible"><motion.divinitial={{ opacity: 0, scale: 0 }}whileInView={{ opacity: 1, scale: 1 }}transition={{ delay: 2.2 }}className="flex flex-col items-start gap-1 p-2"><span className="font-accent-note text-4xl text-secondary transform rotate-6 whitespace-nowrap">High Impact!</span><svg width="100" height="50" viewBox="0 0 100 50" fill="none"><motion.pathinitial={{ pathLength: 0 }}whileInView={{ pathLength: 1 }}transition={{ delay: 2.5, duration: 1 }}d="M 10 20 Q 50 40 90 10"stroke="var(--color-secondary)" strokeWidth="4" strokeLinecap="round"/></svg></motion.div></foreignObject>)}</React.Fragment>))}{/* Hand-drawn scribble */}<motion.pathinitial={{ opacity: 0 }}whileInView={{ opacity: 0.2 }}transition={{ delay: 3 }}d="M 850 100 Q 950 150 850 200 T 800 300"fill="none" stroke="var(--color-primary)" strokeWidth="3"/></svg></motion.div></section>{/* Section 4: Habit Tracking & Gamification */}<section id="habits-feature" className="w-full py-16 grid grid-cols-1 lg:grid-cols-2 gap-20 items-center border-t-2 border-primary/10 px-margin_edge max-w-screen-2xl mx-auto"><motion.divinitial={{ opacity: 0, scale: 0.95 }}whileInView={{ opacity: 1, scale: 1 }}viewport={{ once: true }}className="order-2 lg:order-1 relative">{/* Sketchy Habit Tracker UI */}<div className="bg-white p-8 rough-border rough-shadow rotate-1 relative z-10"><div className="flex justify-between items-center mb-8"><h3 className="font-display-lg text-4xl text-primary">Daily Habits</h3><div className="flex items-center gap-2 text-secondary font-bold"><span className="material-symbols-outlined">local_fire_department</span><span className="text-2xl">14 Day Streak!</span></div></div><div className="grid grid-cols-7 gap-4 mb-8">{[...Array(28)].map((_, i) => (<div key={i} className={`aspect-square rough-border flex items-center justify-center relative ${i < 14 ? 'bg-secondary/10' : 'bg-transparent'}`}>{i < 14 && (<svg className="absolute inset-0 w-full h-full p-2 text-secondary" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round"><path d="M5 13l4 4L19 7" /></svg>)}<span className="text-sm font-bold text-on-surface-variant/40">{i + 1}</span></div>))}</div><div className="flex gap-4"><div className="flex-1 p-4 bg-primary/5 rough-border border-dashed"><div className="text-sm font-bold uppercase text-on-surface-variant mb-1">XP Earned</div><div className="text-3xl font-display-lg text-primary">+1,240</div></div><div className="flex-1 p-4 bg-secondary/5 rough-border border-dashed"><div className="text-sm font-bold uppercase text-on-surface-variant mb-1">Rank</div><div className="text-3xl font-display-lg text-secondary">Strategist</div></div></div></div>{/* Hand-drawn annotation */}<div className="absolute -bottom-8 -right-8 font-accent-note text-3xl text-secondary -rotate-6 z-20">Consistency = Progress</div></motion.div><motion.divinitial={{ opacity: 0, x: 50 }}whileInView={{ opacity: 1, x: 0 }}viewport={{ once: true }}className="order-1 lg:order-2 flex flex-col gap-8"><div className="flex items-center gap-4 text-secondary"><span className="material-symbols-outlined text-4xl">military_tech</span><span className="text-xl font-bold uppercase tracking-widest">Gamified Progress</span></div><h2 className="text-6xl font-display-lg text-primary">Turn habits into <br />fuel for your goals.</h2><p className="text-2xl text-on-surface-variant leading-relaxed">Every habit completed feeds into your Goal Graph. Earn XP, maintain streaks, and level up your strategy. TaskFlow makes the "boring" work feel like progress in a game.</p><ul className="flex flex-col gap-4 text-xl text-on-surface-variant font-medium"><li className="flex items-center gap-3"><span className="material-symbols-outlined text-secondary font-bold">check_circle</span>Sync habits directly with graph nodes</li><li className="flex items-center gap-3"><span className="material-symbols-outlined text-secondary font-bold">check_circle</span>Point-based rewards for branch completion</li><li className="flex items-center gap-3"><span className="material-symbols-outlined text-secondary font-bold">check_circle</span>Visual streak trackers for long-term focus</li></ul></motion.div></section>{/* Section 5: Templates Showcase */}<section id="templates" className="w-full py-16 flex flex-col gap-12 border-t-2 border-primary/10 px-margin_edge max-w-screen-2xl mx-auto"><div className="flex flex-col md:flex-row justify-between items-end gap-6"><div className="flex flex-col gap-4"><div className="flex items-center gap-4 text-secondary"><span className="material-symbols-outlined text-4xl">library_books</span><span className="text-xl font-bold uppercase tracking-widest">Goal Blueprints</span></div><h2 className="text-6xl font-display-lg text-primary">Start with a template, <br />finish with a success.</h2></div><button onClick={() => navigate('/auth')} className="text-2xl font-bold text-primary underline underline-offset-8 hover:text-secondary transition-colors font-accent-note">Browse all 50+ templates →</button></div><div className="grid grid-cols-1 md:grid-cols-3 gap-12">{[{ title: 'Launch a Startup', tags: ['Business', 'Tech'], color: 'bg-blue-50', nodes: 8 },{ title: 'Master a New Language', tags: ['Learning', 'Habits'], color: 'bg-green-50', nodes: 12 },{ title: 'Home Renovation', tags: ['Project', 'Home'], color: 'bg-orange-50', nodes: 15 }].map((tpl, i) => (<motion.divkey={i}whileHover={{ y: -10, rotate: i % 2 === 0 ? 1 : -1 }}onClick={() => navigate('/auth')}className={`${tpl.color} p-8 rough-border rough-shadow cursor-pointer group`}><div className="flex justify-between items-start mb-6"><div className="flex flex-wrap gap-2">{tpl.tags.map(tag => (<span key={tag} className="text-xs font-bold uppercase tracking-widest bg-white/50 px-2 py-1 rounded-full">{tag}</span>))}</div><span className="text-sm font-bold opacity-40">{tpl.nodes} nodes</span></div><h3 className="text-4xl font-display-lg text-primary mb-8">{tpl.title}</h3>{/* Mini Sketch Preview */}<div className="h-32 border-2 border-dashed border-primary/20 rounded-lg relative overflow-hidden bg-white/30 mb-6"><svg className="absolute inset-0 w-full h-full p-4 opacity-30 group-hover:opacity-60 transition-opacity"><circle cx="20%" cy="50%" r="8" fill="currentColor" /><path d="M 25% 50% Q 40% 50% 50% 30% M 25% 50% Q 40% 50% 50% 70%" stroke="currentColor" strokeWidth="2" fill="none" /><rect x="55%" y="20%" width="30%" height="20%" stroke="currentColor" strokeWidth="2" fill="none" /><rect x="55%" y="60%" width="30%" height="20%" stroke="currentColor" strokeWidth="2" fill="none" /></svg></div><div className="flex items-center gap-2 text-primary font-bold"><span>Use this blueprint</span><span className="material-symbols-outlined transition-transform group-hover:translate-x-2">arrow_forward</span></div></motion.div>))}</div></section>{/* Section 6: The ADHD Advantage */}<section id="adhd-advantage" className="w-full py-24 bg-primary text-white rounded-[4rem] rough-border rough-shadow p-16 relative overflow-hidden my-16 max-w-screen-2xl mx-auto"><div className="absolute top-0 right-0 w-1/3 h-full opacity-10 pointer-events-none"><svg className="w-full h-full" viewBox="0 0 100 100"><path d="M0,50 Q25,0 50,50 T100,50" fill="none" stroke="white" strokeWidth="0.5" /><path d="M0,30 Q25,80 50,30 T100,30" fill="none" stroke="white" strokeWidth="0.5" /></svg></div><div className="max-w-4xl flex flex-col gap-10 relative z-10"><div className="flex items-center gap-4 text-secondary-container"><span className="material-symbols-outlined text-5xl">auto_fix_high</span><span className="text-2xl font-bold uppercase tracking-widest">Built for the ADHD Mind</span></div><h2 className="text-7xl font-display-lg leading-tight">Why TaskFlow works when <br />other planners fail.</h2><div className="grid grid-cols-1 md:grid-cols-2 gap-12 mt-4"><div className="flex flex-col gap-4"><h4 className="text-3xl font-bold text-secondary-container">Lower Cognitive Load</h4><p className="text-xl opacity-80 leading-relaxed">Lists are overwhelming. TaskFlow uses visual hierarchy to show you exactly what matters now, hiding the noise of future steps until you're ready.</p></div><div className="flex flex-col gap-4"><h4 className="text-3xl font-bold text-secondary-container">Visual Dependencies</h4><p className="text-xl opacity-80 leading-relaxed">See the "Why" behind the "How". Connecting tasks visually helps your brain understand the impact of every action on the big picture.</p></div><div className="flex flex-col gap-4"><h4 className="text-3xl font-bold text-secondary-container">Adaptive Resilience</h4><p className="text-xl opacity-80 leading-relaxed">Traditional plans are brittle. TaskFlow embraces changes. When a node fails, the graph adapts, preventing the "all-or-nothing" burnout.</p></div><div className="flex flex-col gap-4"><h4 className="text-3xl font-bold text-secondary-container">Dopamine Rewards</h4><p className="text-xl opacity-80 leading-relaxed">Our XP and streak systems provide the immediate feedback non-linear brains crave, turning mundane progress into visible achievements.</p></div></div></div><div className="absolute -bottom-10 -right-10 font-accent-note text-4xl text-secondary-container -rotate-12">Designed with psychologists.</div></section>{/* Section 7: How it Works */}<section id="how-it-works" className="w-full py-16 flex flex-col items-center gap-20 px-margin_edge max-w-screen-2xl mx-auto"><motion.h2initial={{ opacity: 0 }}whileInView={{ opacity: 1 }}className="text-7xl font-display-lg text-primary text-center">How it flows</motion.h2><div className="grid grid-cols-1 md:grid-cols-3 gap-16 w-full max-w-6xl">{[{ icon: 'draw', title: '1. Sketch', desc: "Dump your messy thoughts onto the canvas. Don't worry about structure yet.", rot: '-rotate-3' },{ icon: 'account_tree', title: '2. Connect', desc: "Draw lines between ideas. Define the logic, conditions, and flow.", rot: 'rotate-2' },{ icon: 'bolt', title: '3. Automate', desc: "Let the AI turn your visual logic into actionable plans or alternative paths.", rot: '-rotate-1' }].map((step, i) => (<motion.divkey={i}initial={{ opacity: 0, y: 40 }}whileInView={{ opacity: 1, y: 0 }}transition={{ delay: i * 0.2 }}viewport={{ once: true }}className="flex flex-col items-center text-center gap-6"><div className={`w-24 h-24 bg-white rough-border rough-shadow flex items-center justify-center transform ${step.rot}`}><span className="material-symbols-outlined text-6xl text-primary">{step.icon}</span></div><h3 className="text-4xl font-display-lg text-primary">{step.title}</h3><p className="text-xl text-on-surface-variant leading-relaxed">{step.desc}</p></motion.div>))}</div></section>{/* Section 8: Features Grid */}<section id="features" className="w-full py-16 flex flex-col gap-12 px-margin_edge max-w-screen-2xl mx-auto"><div className="grid grid-cols-1 md:grid-cols-3 gap-12 w-full">{[{ icon: 'crop_free', title: 'Endless Canvas', desc: 'Never run out of space. Pan, zoom, and expand your ideas across an infinite grid.', rot: 'rotate-1' },{ icon: 'group', title: 'Collaboration', desc: 'Invite your team to sketch together. See their cursors and logic built in real-time.', rot: '-rotate-2' },{ icon: 'settings_accessibility', title: 'ADHD Focused', desc: 'Built for minds that think differently. Minimalist UI with high contrast and focus modes.', rot: 'rotate-1' }].map((feat, i) => (<motion.divkey={i}whileHover={{ rotate: 0, scale: 1.02 }}onClick={() => navigate('/auth')}className={`bg-white p-10 rough-border rough-shadow transform ${feat.rot} transition-transform cursor-pointer group`}><span className="material-symbols-outlined text-secondary text-5xl mb-6 group-hover:scale-110 transition-transform block">{feat.icon}</span><h3 className="text-4xl font-display-lg text-primary mb-4">{feat.title}</h3><p className="text-lg text-on-surface-variant leading-relaxed">{feat.desc}</p></motion.div>))}</div></section>{/* Section 9: Pricing */}<section id="pricing" className="w-full py-20 flex flex-col items-center gap-16 px-margin_edge max-w-screen-2xl mx-auto border-t-2 border-primary/10"><div className="text-center"><h2 className="text-7xl font-display-lg text-primary">Simple Pricing</h2><p className="font-accent-note text-4xl text-on-surface-variant mt-4 transform -rotate-2">No hidden fees, just plain ink.</p></div><div className="grid grid-cols-1 md:grid-cols-3 gap-12 w-full max-w-6xl items-start">{/* Free Tier */}<motion.divinitial={{ opacity: 0, x: -20 }}whileInView={{ opacity: 1, x: 0 }}viewport={{ once: true }}className="bg-white p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1"><div><h3 className="text-4xl font-display-lg text-primary">Free</h3><div className="font-accent-note text-3xl mt-2 text-secondary">$0 / month</div></div><ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow">{['3 Infinite Canvases', 'Basic shapes & logic', 'Community templates'].map(item => (<li key={item} className="flex items-center gap-3"><span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item}</li>))}</ul><button onClick={() => navigate('/auth')} className="w-full py-3 rough-border text-primary font-bold text-lg hover:bg-surface-variant transition-colors">Start Free</button></motion.div>{/* Pro Tier */}<motion.divinitial={{ opacity: 0, scale: 0.9 }}whileInView={{ opacity: 1, scale: 1.05 }}viewport={{ once: true }}className="bg-white p-10 rough-border rough-shadow flex flex-col gap-8 transform rotate-1 border-primary border-[4px] z-10 shadow-[10px_10px_0px_0px_rgba(0,0,0,0.2)]"><div><h3 className="text-5xl font-display-lg text-primary"><span className="highlighter-bg px-2">Pro</span></h3><div className="font-accent-note text-4xl mt-3 text-secondary">$10 / month</div></div><ul className="flex flex-col gap-5 text-xl text-on-surface-variant flex-grow font-medium">{['Unlimited Canvases', 'AI Path Generation', 'Advanced Habit Tracking', 'Priority Support'].map(item => (<li key={item} className="flex items-center gap-3"><span className="material-symbols-outlined text-secondary font-bold text-3xl">done</span> {item}</li>))}</ul><button onClick={() => navigate('/auth')} className="w-full py-4 bg-primary text-white rough-border font-bold text-xl rough-shadow-hover hover:bg-secondary-container hover:text-primary transition-all">Go Pro</button></motion.div>{/* Team Tier */}<motion.divinitial={{ opacity: 0, x: 20 }}whileInView={{ opacity: 1, x: 0 }}viewport={{ once: true }}className="bg-white p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1"><div><h3 className="text-4xl font-display-lg text-primary">Team</h3><div className="font-accent-note text-3xl mt-2 text-secondary">$25 / user</div></div><ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow">{['Everything in Pro', 'Real-time Collaboration', 'Team Workspaces', 'Admin Tools'].map(item => (<li key={item} className="flex items-center gap-3"><span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item}</li>))}</ul><button onClick={() => navigate('/auth')} className="w-full py-3 rough-border text-primary font-bold text-lg hover:bg-surface-variant transition-colors">Contact Us</button></motion.div></div></section>{/* Final CTA */}<section id="cta" className="w-full py-32 flex flex-col items-center gap-12 text-center bg-primary/5 rounded-[4rem] rough-border relative overflow-hidden my-16 max-w-screen-2xl mx-auto"><div className="absolute top-0 left-0 w-full h-full opacity-5 pointer-events-none"><div className="absolute top-10 left-10 w-64 h-64 border-4 border-primary rounded-full animate-pulse" /><div className="absolute bottom-10 right-10 w-96 h-96 border-4 border-secondary rounded-full animate-pulse delay-700" /></div><motion.divinitial={{ opacity: 0, y: 30 }}whileInView={{ opacity: 1, y: 0 }}viewport={{ once: true }}className="flex flex-col gap-6 relative z-10"><h2 className="text-7xl font-display-lg text-primary">Stop fighting your brain. <br /><span className="highlighter-bg px-4">Start sketching paths.</span></h2><p className="text-2xl text-on-surface-variant max-w-2xl mx-auto">Join thousands of strategists who use TaskFlow to turn overwhelming goals into manageable, adaptive paths.</p></motion.div><motion.divinitial={{ opacity: 0, scale: 0.9 }}whileInView={{ opacity: 1, scale: 1 }}viewport={{ once: true }}className="flex flex-col md:flex-row gap-6 relative z-10"><button onClick={() => navigate('/auth')} className="bg-primary text-white font-bold py-6 px-12 text-2xl rough-border rough-shadow hover:scale-105 transition-transform">Get Started for Free</button><button onClick={() => navigate('/auth')} className="bg-white text-primary font-bold py-6 px-12 text-2xl rough-border hover:bg-primary/5 transition-colors">View Templates</button></motion.div><div className="mt-8 font-accent-note text-3xl text-secondary -rotate-2">No credit card required. Free forever for individuals.</div></section></div>);};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401import React, { useEffect, useMemo, useRef } from 'react';import { motion, useScroll, useSpring, useTransform, useReducedMotion } from 'framer-motion';import { useNavigate } from 'react-router-dom';import { useTranslation } from 'react-i18next';import {ArrowRight, Check, Target, GitFork, Footprints, Network, ListTodo, Users, StickyNote, Download,Repeat, TerminalSquare, CreditCard, Infinity as InfinityIcon,} from 'lucide-react';import { useAuth } from '../context/AuthContext';import HeroBoardDemo from '../features/landing/HeroBoardDemo';import TemplatePreview from '../features/templates/TemplatePreview';import { getBuiltinTemplates } from '../features/templates/builtinTemplates';import { getLandingCopy } from '../features/landing/landingCopy';const ICONS = { Target, GitFork, Footprints, Network, ListTodo, Users, StickyNote, Download, Repeat, TerminalSquare, CreditCard };const reveal = {hidden: { opacity: 0, y: 40 },show: { opacity: 1, y: 0, transition: { type: 'spring', stiffness: 80, damping: 18 } },};const stagger = (delay = 0.08) => ({ hidden: {}, show: { transition: { staggerChildren: delay } } });const SectionHeader = ({ kicker, title, subtitle, center = true }) => (<motion.divvariants={stagger(0.1)}initial="hidden"whileInView="show"viewport={{ once: true, margin: '-80px' }}className={`flex flex-col gap-4 ${center ? 'items-center text-center' : ''} max-w-3xl ${center ? 'mx-auto' : ''}`}><motion.span variants={reveal} className="font-accent-note text-3xl text-secondary -rotate-1">{kicker}</motion.span><motion.h2 variants={reveal} className="text-5xl md:text-7xl font-display-lg text-primary leading-[0.95]">{title}</motion.h2>{subtitle && <motion.p variants={reveal} className="text-lg md:text-xl text-on-surface-variant">{subtitle}</motion.p>}</motion.div>);// Hand-drawn underline that draws itselfconst Scribble = ({ delay = 0.9 }) => (<svg viewBox="0 0 300 20" className="absolute -bottom-3 left-0 w-full h-5 text-secondary" preserveAspectRatio="none" aria-hidden="true"><motion.pathd="M4 14 C 60 4, 120 18, 180 9 S 270 6, 296 12"fill="none"stroke="currentColor"strokeWidth="6"strokeLinecap="round"initial={{ pathLength: 0 }}animate={{ pathLength: 1 }}transition={{ duration: 0.9, delay, ease: 'easeOut' }}/></svg>);const FeatureCard = ({ feature, index }) => {const Icon = ICONS[feature.icon] || Target;return (<motion.divvariants={reveal}whileHover={{ y: -8, rotate: index % 2 ? 0.6 : -0.6 }}transition={{ type: 'spring', stiffness: 300, damping: 20 }}className="group relative bg-surface-container-lowest rough-border rough-shadow p-7 flex flex-col gap-4"><motion.divwhileHover={{ rotate: [0, -12, 10, 0], scale: 1.1 }}transition={{ duration: 0.5 }}className="w-14 h-14 rounded-2xl bg-secondary/15 border-2 border-primary flex items-center justify-center text-primary group-hover:bg-secondary group-hover:text-on-secondary transition-colors"><Icon size={26} /></motion.div><h3 className="text-3xl font-display-lg text-primary leading-none">{feature.title}</h3><p className="text-on-surface-variant leading-relaxed">{feature.text}</p></motion.div>);};const HowItWorks = ({ copy }) => {const ref = useRef(null);const { scrollYProgress } = useScroll({ target: ref, offset: ['start 70%', 'end 60%'] });const lineScale = useSpring(scrollYProgress, { stiffness: 120, damping: 30 });return (<section id="how-it-works" className="w-full py-24 px-margin_edge max-w-screen-xl mx-auto"><SectionHeader kicker={copy.kicker} title={copy.title} /><div ref={ref} className="relative mt-20 flex flex-col gap-16 md:gap-24"><div className="absolute left-7 md:left-1/2 top-0 bottom-0 w-1 -translate-x-1/2 bg-primary/10 rounded-full" /><motion.div style={{ scaleY: lineScale }} className="absolute left-7 md:left-1/2 top-0 bottom-0 w-1 -translate-x-1/2 bg-secondary rounded-full origin-top" />{copy.steps.map((step, i) => (<motion.divkey={i}initial={{ opacity: 0, x: i % 2 ? 60 : -60 }}whileInView={{ opacity: 1, x: 0 }}viewport={{ once: true, margin: '-120px' }}transition={{ type: 'spring', stiffness: 70, damping: 16 }}className={`relative flex items-start gap-6 md:w-1/2 pl-16 md:pl-0 ${i % 2 ? 'md:ml-auto md:pl-16' : 'md:pr-16 md:text-right md:flex-row-reverse'}`}><motion.divinitial={{ scale: 0 }}whileInView={{ scale: 1 }}viewport={{ once: true, margin: '-120px' }}transition={{ type: 'spring', stiffness: 260, damping: 14, delay: 0.15 }}className={`absolute top-0 left-7 -translate-x-1/2 md:left-auto ${i % 2 ? 'md:-left-0 md:-translate-x-1/2' : 'md:-right-0 md:translate-x-1/2'} w-14 h-14 rounded-full bg-primary text-on-primary flex items-center justify-center text-3xl font-display-lg border-4 border-background z-10`}>{i + 1}</motion.div><div className="bg-surface-container-lowest rough-border rough-shadow p-7 flex flex-col gap-2"><h3 className="text-3xl font-display-lg text-primary leading-none">{step.title}</h3><p className="text-on-surface-variant">{step.text}</p></div></motion.div>))}</div></section>);};const TemplatesMarquee = ({ templates, reduceMotion }) => {const row = [...templates, ...templates];return (<div className="relative w-full overflow-hidden py-4 [mask-image:linear-gradient(90deg,transparent,black_8%,black_92%,transparent)]"><motion.divclassName="flex gap-6 w-max"animate={reduceMotion ? undefined : { x: ['0%', '-50%'] }}transition={{ duration: 40, ease: 'linear', repeat: Infinity }}>{row.map((tpl, i) => (<motion.divkey={`${tpl.id}-${i}`}whileHover={{ y: -6, scale: 1.02 }}className="w-72 shrink-0 bg-surface-container-lowest rough-border rough-shadow overflow-hidden"><div className="graph-paper-bg border-b-2 border-primary/10 px-3 pt-3"><TemplatePreview content={tpl.content} height={150} /></div><div className="p-4 flex flex-col gap-1"><span className="text-[10px] uppercase font-bold tracking-wider text-secondary">{tpl.category}</span><span className="text-2xl font-display-lg text-primary leading-none">{tpl.title}</span><span className="text-sm text-on-surface-variant line-clamp-2">{tpl.description}</span></div></motion.div>))}</motion.div></div>);};const PriceCard = ({ plan, price, perMonth, highlighted, onClick, delay }) => (<motion.divinitial={{ opacity: 0, y: 50, rotate: highlighted ? 2 : -2 }}whileInView={{ opacity: 1, y: 0, rotate: 0 }}viewport={{ once: true, margin: '-100px' }}transition={{ type: 'spring', stiffness: 80, damping: 15, delay }}whileHover={{ y: -10 }}className={`relative flex flex-col gap-7 p-10 bg-surface-container-lowest rough-border ${highlighted ? 'shadow-[12px_12px_0px_0px_var(--color-primary)]' : 'rough-shadow'}`}>{highlighted && plan.badge && (<motion.spaninitial={{ scale: 0, rotate: -20 }}whileInView={{ scale: 1, rotate: -4 }}viewport={{ once: true }}transition={{ type: 'spring', stiffness: 300, damping: 12, delay: delay + 0.3 }}className="absolute -top-5 right-8 bg-secondary text-on-secondary px-4 py-1.5 rough-border font-bold text-sm uppercase tracking-widest">{plan.badge}</motion.span>)}<div><h3 className="text-5xl font-display-lg text-primary">{plan.name}</h3><p className="text-on-surface-variant mt-1">{plan.desc}</p></div><div className="flex items-end gap-2"><span className="text-7xl font-display-lg text-primary leading-none">${price}</span><span className="text-sm font-bold uppercase tracking-widest text-on-surface-variant mb-2">{perMonth}</span></div><ul className="flex flex-col gap-3 flex-grow">{plan.features.map((f, i) => (<motion.likey={i}initial={{ opacity: 0, x: -10 }}whileInView={{ opacity: 1, x: 0 }}viewport={{ once: true }}transition={{ delay: delay + 0.2 + i * 0.06 }}className="flex items-start gap-3">{highlighted ? <InfinityIcon size={18} className="text-secondary mt-1 shrink-0" /> : <Check size={18} className="text-secondary mt-1 shrink-0" />}<span className="font-bold text-primary">{f}</span></motion.li>))}</ul><motion.buttonwhileHover={{ scale: 1.03 }}whileTap={{ scale: 0.97 }}onClick={onClick}className={`w-full py-4 text-xl font-bold rough-border flex items-center justify-center gap-2 cursor-pointer ${highlighted ? 'bg-primary text-on-primary' : 'bg-surface-container-lowest text-primary hover:bg-primary/5'}`}>{plan.cta} <ArrowRight size={20} /></motion.button></motion.div>);const LandingPage = () => {const { user } = useAuth();const navigate = useNavigate();const { i18n } = useTranslation();const reduceMotion = useReducedMotion();const copy = getLandingCopy(i18n.language);const templates = useMemo(() => getBuiltinTemplates(i18n.language), [i18n.language]);useEffect(() => {if (user) navigate('/dashboard');}, [user, navigate]);// The landing page is designed for the light themeuseEffect(() => {const root = document.documentElement;root.classList.remove('dark');return () => {if (localStorage.getItem('theme') === 'dark') root.classList.add('dark');};}, []);const heroRef = useRef(null);const { scrollYProgress: heroProgress } = useScroll({ target: heroRef, offset: ['start start', 'end start'] });const demoY = useTransform(heroProgress, [0, 1], [0, reduceMotion ? 0 : 120]);const demoRotate = useTransform(heroProgress, [0, 1], [0, reduceMotion ? 0 : -4]);const doodleY = useTransform(heroProgress, [0, 1], [0, reduceMotion ? 0 : -160]);const { scrollYProgress } = useScroll();const progressX = useSpring(scrollYProgress, { stiffness: 140, damping: 30 });const goAuth = () => navigate('/auth');return (<div className="flex flex-col items-center w-full overflow-x-clip">{/* Reading progress */}<motion.div style={{ scaleX: progressX }} className="fixed top-0 left-0 right-0 h-1.5 bg-secondary origin-left z-[60]" />{/* Hero */}<section id="hero" ref={heroRef} className="relative w-full px-margin_edge pt-16 pb-24 max-w-screen-2xl mx-auto grid grid-cols-1 lg:grid-cols-[1fr_1.1fr] gap-14 items-center"><motion.div style={{ y: doodleY }} className="pointer-events-none absolute -top-6 right-[8%] text-secondary/30 hidden lg:block" aria-hidden="true"><svg width="160" height="160" viewBox="0 0 160 160"><motion.circle cx="80" cy="80" r="64" fill="none" stroke="currentColor" strokeWidth="6" strokeDasharray="14 12"animate={reduceMotion ? undefined : { rotate: 360 }} transition={{ duration: 40, repeat: Infinity, ease: 'linear' }} style={{ originX: '80px', originY: '80px' }} /></svg></motion.div><motion.div variants={stagger(0.12)} initial="hidden" animate="show" className="flex flex-col gap-8 relative z-10"><motion.span variants={reveal} className="self-start px-4 py-1.5 rounded-full border-2 border-primary bg-secondary/15 text-primary text-sm font-bold uppercase tracking-widest">{copy.hero.badge}</motion.span><h1 className="text-6xl sm:text-7xl xl:text-8xl font-display-lg text-primary leading-[0.9]"><motion.span variants={reveal} className="block">{copy.hero.title1}</motion.span><motion.span variants={reveal} className="relative inline-block mt-2">{copy.hero.title2}<Scribble /></motion.span></h1><motion.p variants={reveal} className="text-xl text-on-surface-variant max-w-xl leading-relaxed">{copy.hero.subtitle}</motion.p><motion.div variants={reveal} className="flex flex-wrap gap-4 items-center"><motion.buttonwhileHover={{ scale: 1.05, rotate: -1 }}whileTap={{ scale: 0.96 }}onClick={goAuth}className="group bg-primary text-on-primary text-2xl font-bold px-9 py-4 rough-border rough-shadow-hover flex items-center gap-3 cursor-pointer">{copy.hero.ctaPrimary}<ArrowRight className="group-hover:translate-x-1.5 transition-transform" /></motion.button><a href="#how-it-works" className="text-xl font-bold text-primary underline decoration-secondary decoration-4 underline-offset-8 hover:decoration-primary transition-colors">{copy.hero.ctaSecondary}</a></motion.div><motion.p variants={reveal} className="text-sm font-bold text-on-surface-variant/70">{copy.hero.note}</motion.p></motion.div><motion.divinitial={{ opacity: 0, y: 60, rotate: 3 }}animate={{ opacity: 1, y: 0, rotate: 0 }}transition={{ type: 'spring', stiffness: 60, damping: 16, delay: 0.3 }}style={{ y: demoY, rotate: demoRotate }}className="relative z-10"><HeroBoardDemo copy={copy.demo} /></motion.div></section>{/* Facts strip */}<section className="w-full border-y-2 border-primary bg-primary text-on-primary overflow-hidden py-5"><motion.divclassName="flex gap-12 w-max"animate={reduceMotion ? undefined : { x: ['0%', '-50%'] }}transition={{ duration: 28, ease: 'linear', repeat: Infinity }}>{[...copy.facts, ...copy.facts, ...copy.facts, ...copy.facts].map((fact, i) => (<span key={i} className="flex items-center gap-12 text-3xl font-display-lg whitespace-nowrap">{fact}<span className="text-secondary-container">✦</span></span>))}</motion.div></section>{/* Product */}<section id="product" className="w-full py-28 px-margin_edge max-w-screen-2xl mx-auto flex flex-col gap-16"><SectionHeader kicker={copy.product.kicker} title={copy.product.title} subtitle={copy.product.subtitle} /><motion.divvariants={stagger(0.07)}initial="hidden"whileInView="show"viewport={{ once: true, margin: '-60px' }}className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8">{copy.product.features.map((f, i) => <FeatureCard key={f.title} feature={f} index={i} />)}</motion.div></section><HowItWorks copy={copy.how} />{/* Templates */}<section id="templates" className="w-full py-24 flex flex-col gap-12 bg-surface-container-low border-y-2 border-primary/10"><div className="px-margin_edge"><SectionHeader kicker={copy.templates.kicker} title={copy.templates.title} subtitle={copy.templates.subtitle} /></div><TemplatesMarquee templates={templates} reduceMotion={reduceMotion} /></section>{/* Pricing */}<section id="pricing" className="w-full py-28 px-margin_edge max-w-5xl mx-auto flex flex-col gap-16"><SectionHeader kicker={copy.pricing.kicker} title={copy.pricing.title} /><div className="grid grid-cols-1 md:grid-cols-2 gap-10"><PriceCard plan={copy.pricing.free} price={0} perMonth={copy.pricing.perMonth} onClick={goAuth} delay={0} /><PriceCard plan={copy.pricing.plus} price={copy.pricing.price} perMonth={copy.pricing.perMonth} onClick={goAuth} highlighted delay={0.12} /></div><p className="text-center text-sm font-bold text-on-surface-variant/70">{copy.pricing.paymentsNote}</p></section>{/* Roadmap */}<section id="roadmap" className="w-full py-24 px-margin_edge max-w-screen-xl mx-auto flex flex-col gap-14"><SectionHeader kicker={copy.roadmap.kicker} title={copy.roadmap.title} subtitle={copy.roadmap.subtitle} /><motion.divvariants={stagger(0.1)}initial="hidden"whileInView="show"viewport={{ once: true, margin: '-60px' }}className="grid grid-cols-1 md:grid-cols-3 gap-8">{copy.roadmap.items.map((item) => {const Icon = ICONS[item.icon] || Target;return (<motion.div key={item.title} variants={reveal} className="p-7 rounded-2xl border-2 border-dashed border-primary/30 flex flex-col gap-3"><div className="flex items-center gap-3"><Icon size={22} className="text-secondary" /><span className="text-[10px] font-bold uppercase tracking-widest px-2 py-0.5 rounded bg-primary/5 text-on-surface-variant">{copy.roadmap.kicker}</span></div><h3 className="text-3xl font-display-lg text-primary leading-none">{item.title}</h3><p className="text-on-surface-variant">{item.text}</p></motion.div>);})}</motion.div></section>{/* Final CTA */}<section className="w-full px-margin_edge pb-10 max-w-screen-xl mx-auto"><motion.divinitial={{ opacity: 0, scale: 0.92 }}whileInView={{ opacity: 1, scale: 1 }}viewport={{ once: true, margin: '-80px' }}transition={{ type: 'spring', stiffness: 70, damping: 16 }}className="relative overflow-hidden bg-primary text-on-primary rounded-[3rem] rough-border px-8 py-20 flex flex-col items-center text-center gap-8">{!reduceMotion && [0, 1, 2, 3, 4].map((i) => (<motion.spankey={i}className="absolute w-24 h-14 rounded-xl border-2 border-on-primary/20"style={{ left: `${8 + i * 20}%`, top: i % 2 ? '12%' : '70%' }}animate={{ y: [0, -14, 0], rotate: [0, i % 2 ? 6 : -6, 0] }}transition={{ duration: 4 + i, repeat: Infinity, ease: 'easeInOut' }}aria-hidden="true"/>))}<h2 className="relative text-6xl md:text-8xl font-display-lg leading-none">{copy.cta.title}</h2><p className="relative text-xl opacity-80">{copy.cta.subtitle}</p><motion.buttonwhileHover={{ scale: 1.06, rotate: 1 }}whileTap={{ scale: 0.95 }}onClick={goAuth}className="relative bg-secondary-container text-primary text-2xl font-bold px-10 py-4 rough-border flex items-center gap-3 cursor-pointer">{copy.cta.button} <ArrowRight /></motion.button></motion.div></section></div>);};
123439 unmodified lines444546474849505152535455565758596061626364656667686970717273import React, { useState } from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';39 unmodified lines)},{title: t('onboarding.step_2.title', 'AI Adaptation'),description: t('onboarding.step_2.description', "Hit a wall? Mark a node as 'Blocked' and let the AI Assistant sketch out alternative routes to your goal instantly."),icon: "psychology",accent: "bg-yellow-50/10 dark:bg-yellow-950/20",note: t('onboarding.step_2.note', "AI handles the cognitive load when you're stuck."),visual: (<div className="relative w-full h-48 flex items-center justify-center"><div className="w-24 h-24 border-4 border-primary rounded-xl bg-surface-container-lowest flex flex-col items-center justify-center font-bold opacity-40"><span className="material-symbols-outlined text-red-500">block</span>{t('onboarding.visual.blocked', 'Blocked')}</div><motion.divanimate={{ x: [0, 50, 0], opacity: [0, 1, 1] }}transition={{ repeat: Infinity, duration: 2 }}className="absolute right-12 bottom-12 font-accent-note text-secondary text-2xl">{t('onboarding.visual.ai_generating', 'AI generating...')}</motion.div></div>)},{title: t('onboarding.step_3.title', 'Dopamine & Focus'),description: t('onboarding.step_3.description', "Earn points for completing branches and maintain daily streaks. TaskFlow is designed to keep you motivated and focused on the big picture."),icon: "local_fire_department",accent: "bg-orange-50/10 dark:bg-orange-950/20",note: t('onboarding.step_3.note', "Turn the grind into a game you enjoy."),123439 unmodified lines444546474849505152535455565758596061626364656667686970717273import React, { useState } from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';39 unmodified lines)},{title: t('onboarding.step_2.title', 'Auto-layout & templates'),description: t('onboarding.step_2.description', "Start from a template, and when the board gets messy press Shift+L — TaskFlow arranges every step into a tidy flow."),icon: "psychology",accent: "bg-yellow-50/10 dark:bg-yellow-950/20",note: t('onboarding.step_2.note', "Less time dragging boxes, more time doing."),visual: (<div className="relative w-full h-48 flex items-center justify-center"><div className="w-24 h-24 border-4 border-primary rounded-xl bg-surface-container-lowest flex flex-col items-center justify-center font-bold opacity-40"><span className="material-symbols-outlined">account_tree</span>{t('onboarding.visual.blocked', 'Messy board')}</div><motion.divanimate={{ x: [0, 50, 0], opacity: [0, 1, 1] }}transition={{ repeat: Infinity, duration: 2 }}className="absolute right-12 bottom-12 font-accent-note text-secondary text-2xl">{t('onboarding.visual.ai_generating', 'Shift+L')}</motion.div></div>)},{title: t('onboarding.step_3.title', 'Dopamine & Focus'),description: t('onboarding.step_3.description', "Earn points for completed steps and unlock achievements. TaskFlow keeps you motivated and focused on the big picture."),icon: "local_fire_department",accent: "bg-orange-50/10 dark:bg-orange-950/20",note: t('onboarding.step_3.note', "Turn the grind into a game you enjoy."),
220 unmodified lines221222223224225226227228229230231232220 unmodified lines</h2><div className="flex flex-col"><SettingTogglelabel={t('settings.ai_guidance_title', 'AI Active Guidance')}desc={t('settings.ai_guidance_desc', 'Let AI proactively suggest alternative paths when you mark a node as blocked.')}active={settings.aiGuidance}onToggle={() => toggleSetting('aiGuidance')}/><SettingTogglelabel={t('settings.snap_to_grid_title', 'Snap to Grid')}desc={t('settings.snap_to_grid_desc', 'Automatically align nodes to the graph paper lines for a cleaner look.')}220 unmodified lines221222223224225226220 unmodified lines</h2><div className="flex flex-col"><SettingTogglelabel={t('settings.snap_to_grid_title', 'Snap to Grid')}desc={t('settings.snap_to_grid_desc', 'Automatically align nodes to the graph paper lines for a cleaner look.')}
123456789101112131415161718192021222324252627282930313233343536373839404142431 unmodified line45464748495051525354555657584 unmodified lines63646566676869707172737475763 unmodified lines80818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731742 unmodified lines1771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132143 unmodified lines2182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522536 unmodified lines260261262263import React from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import Sidebar from '../components/Sidebar';import { useAuth } from '../context/AuthContext';import axios from 'axios';import {Sparkles,Check,X,Zap,ArrowRight,Bot,Layout,Heart,Users,BookTemplate} from 'lucide-react';const PricingCard = ({ type, price, description, features, popular, color, buttonText, isCurrentPlan, onClick, loading }) => {const { t } = useTranslation();return (<motion.divwhileHover={isCurrentPlan ? {} : { y: -10 }}className={`relative bg-surface-container-lowest p-10 rough-border flex flex-col gap-8 h-full ${popular ? 'shadow-[12px_12px_0px_0px_var(--color-primary)] dark:shadow-[12px_12px_0px_0px_rgba(255,255,255,0.07)] border-secondary' : 'rough-shadow opacity-90'}`}>{popular && (<div className="absolute -top-6 left-1/2 -translate-x-1/2 bg-secondary text-primary px-6 py-2 rough-border font-bold text-sm uppercase tracking-widest">{t("subscription.most_recommended")}</div>)}<div className="text-center border-b-2 border-primary/10 pb-8"><h3 className={`text-5xl font-display-lg text-primary mb-2`}>{type}</h3><div className="flex items-center justify-center gap-1"><span className="text-2xl font-display-lg text-secondary">$</span><span className="text-6xl font-display-lg text-primary">{price}</span><span className="text-sm font-bold text-on-surface-variant uppercase tracking-widest mt-4">{t("subscription.per_month")}</span></div><p className="mt-4 text-sm text-on-surface-variant font-medium">{description}</p></div>1 unmodified line<ul className="flex flex-col gap-4 flex-grow">{features.map((f, i) => (<li key={i} className="flex items-start gap-3">{f.included ? (<Check size={18} className="text-secondary mt-1 flex-shrink-0" />) : (<X size={18} className="text-on-surface-variant/30 mt-1 flex-shrink-0" />)}<span className={`text-sm font-bold ${f.included ? 'text-primary' : 'text-on-surface-variant/40'}`}>{f.text}</span></li>))}</ul>4 unmodified linesonClick={isCurrentPlan ? undefined : onClick}disabled={isCurrentPlan || loading}className={`w-full py-4 text-xl font-bold flex items-center justify-center gap-2 rough-border transition-all ${isCurrentPlan? 'bg-surface-container-high text-on-surface-variant/50 border-primary/20 cursor-default': popular? 'bg-primary text-white hover:bg-primary/95 cursor-pointer': 'bg-surface-container-lowest text-primary border-primary hover:bg-primary/5 cursor-pointer'}`}><span>{isCurrentPlan ? t("subscription.current_plan", "Current Plan") : loading ? t("subscription.upgrading", "Upgrading...") : buttonText}</span>{!isCurrentPlan && !loading && <ArrowRight size={20} />}</motion.button></motion.div>3 unmodified linesconst SubscriptionPage = () => {const { t } = useTranslation();const { user, updateUser } = useAuth();const [loadingTier, setLoadingTier] = React.useState(null);const [notification, setNotification] = React.useState(null);const handleUpgrade = async (tierName) => {if (!user) return;setLoadingTier(tierName);try {const API_URL = import.meta.env.VITE_API_URL;const res = await axios.post(`${API_URL}/payments/change-tier/${user.id}`, { tier: tierName });updateUser(res.data);setNotification({type: 'success',message: t('subscription.upgrade_success', { tier: tierName }) || `Plan switched to ${tierName} successfully!`});setTimeout(() => setNotification(null), 4000);} catch (err) {console.error('[Subscription] Upgrade failed:', err);setNotification({type: 'error',message: err.response?.data?.message || 'Upgrade failed. Please try again.'});setTimeout(() => setNotification(null), 4000);} finally {setLoadingTier(null);}};const plans = [{key: "Free",type: t("subscription.plans.free.title"),price: "0",description: t("subscription.plans.free.desc"),buttonText: t("subscription.plans.free.btn"),features: [{ text: t("subscription.plans.free.feat1"), included: true },{ text: t("subscription.plans.free.feat2"), included: true },{ text: t("subscription.plans.free.feat3"), included: true },{ text: t("subscription.plans.free.feat4"), included: true },{ text: t("subscription.plans.free.feat5"), included: true },]},{key: "Pro",type: t("subscription.plans.pro.title"),price: "10",popular: true,description: t("subscription.plans.pro.desc"),buttonText: t("subscription.plans.pro.btn"),features: [{ text: t("subscription.plans.pro.feat1"), included: true },{ text: t("subscription.plans.pro.feat2"), included: true },{ text: t("subscription.plans.pro.feat3"), included: true },{ text: t("subscription.plans.pro.feat4"), included: true },{ text: t("subscription.plans.pro.feat5"), included: true },]},{key: "Ultra",type: t("subscription.plans.ultra.title"),price: "25",description: t("subscription.plans.ultra.desc"),buttonText: t("subscription.plans.ultra.btn"),features: [{ text: t("subscription.plans.ultra.feat1"), included: true },{ text: t("subscription.plans.ultra.feat2"), included: true },{ text: t("subscription.plans.ultra.feat3"), included: true },{ text: t("subscription.plans.ultra.feat4"), included: true },{ text: t("subscription.plans.ultra.feat5"), included: true },{ text: t("subscription.plans.ultra.feat6"), included: true },]}];const currentUserTier = user?.subscriptionTier || "Free";return (<div className="flex h-screen bg-background overflow-hidden"><Sidebar /><main className="flex-grow flex flex-col relative overflow-y-auto graph-paper-bg scrollbar-hide">{/* Notification Banner */}<AnimatePresence>{notification && (<motion.divinitial={{ opacity: 0, y: -50 }}animate={{ opacity: 1, y: 0 }}exit={{ opacity: 0, y: -50 }}className={`fixed top-6 left-1/2 -translate-x-1/2 px-8 py-4 z-50 rough-border shadow-2xl font-bold text-lg text-white ${notification.type === 'success' ? 'bg-primary' : 'bg-error'}`}>2 unmodified lines)}</AnimatePresence>{/* Background Elements */}<div className="absolute top-0 right-0 p-20 opacity-10 pointer-events-none"><Sparkles size={400} className="text-secondary" /></div><section className="p-8 md:p-16 flex flex-col gap-10 max-w-7xl mx-auto w-full relative z-10 pb-16"><div className="text-center flex flex-col items-center gap-6"><motion.divinitial={{ scale: 0 }}animate={{ scale: 1 }}className="w-24 h-24 bg-secondary rounded-full flex items-center justify-center border-4 border-primary shadow-xl"><Zap size={48} className="text-primary" /></motion.div><h1 className="text-7xl font-display-lg text-primary leading-tight max-w-3xl">{t("subscription.title_p1", "Unlock the ")}<span className="highlighter-bg">{t("subscription.title_highlight", "Pro Tools")}</span>{t("subscription.title_p2", " of TaskFlow")}</h1><p className="font-accent-note text-3xl text-secondary -rotate-1 max-w-xl">{t("subscription.subtitle")}</p></div><div className="grid grid-cols-1 lg:grid-cols-3 gap-10 items-stretch">{plans.map((plan, i) => (<PricingCardkey={i}{...plan}isCurrentPlan={currentUserTier.toLowerCase() === plan.key.toLowerCase()}onClick={() => handleUpgrade(plan.key)}loading={loadingTier === plan.key}/>))}</div>3 unmodified lines<thead><tr className="border-b-2 border-primary/15"><th className="text-left p-4 font-bold text-on-surface-variant uppercase tracking-widest text-xs">{t('subscription.compare.feature', 'Feature')}</th><th className="p-4 font-bold text-primary text-center">{t('subscription.plans.free.title', 'Free')}</th><th className="p-4 font-bold text-secondary text-center bg-secondary/5">{t('subscription.plans.pro.title', 'Pro')}</th><th className="p-4 font-bold text-primary text-center">{t('subscription.plans.ultra.title', 'Ultra')}</th></tr></thead><tbody>{[{ icon: Bot, label: t('subscription.compare.ai_gens', 'AI Generations / day'), free: '3', pro: '200', ultra: '∞' },{ icon: Layout, label: t('subscription.compare.canvases', 'Canvases'), free: '3', pro: '∞', ultra: '∞' },{ icon: Sparkles, label: t('subscription.compare.nodes', 'Nodes per canvas'), free: '200', pro: '∞', ultra: '∞' },{ icon: Heart, label: t('subscription.compare.habits', 'Habits'), free: '3', pro: '∞', ultra: '∞' },{ icon: Users, label: t('subscription.compare.board_members', 'Board members'), free: '2', pro: '10', ultra: '∞' },{ icon: BookTemplate, label: t('subscription.compare.custom_templates', 'Custom Templates'), free: false, pro: false, ultra: true },].map((row, i) => (<tr key={i} className={`border-b border-primary/10 ${i % 2 === 0 ? '' : 'bg-primary/2'}`}><td className="p-4 font-semibold text-on-surface-variant flex items-center gap-2"><row.icon size={16} className="text-secondary flex-shrink-0" />{row.label}</td>{[row.free, row.pro, row.ultra].map((val, j) => (<td key={j} className={`p-4 text-center font-bold ${j === 1 ? 'bg-secondary/5' : ''}`}>{val === true ? (<Check size={18} className="text-secondary mx-auto" />) : val === false ? (<X size={18} className="text-on-surface-variant/30 mx-auto" />) : (<span className={val === '∞' ? 'text-secondary text-lg' : 'text-primary'}>{val}</span>)}</td>))}</tr>))}</tbody>6 unmodified lines};export default SubscriptionPage;1234567891011121314151617181920212223242526272829303132333435361 unmodified line38394041424344454 unmodified lines50515253545556575859606162633 unmodified lines6768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511522 unmodified lines1551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871883 unmodified lines1921931941951961971981992002012022032042052062072082092102112126 unmodified lines219220221import React from 'react';import { motion, AnimatePresence } from 'framer-motion';import { useTranslation } from 'react-i18next';import axios from 'axios';import { Check, Zap, ArrowRight, Layout, Network, Users, LayoutTemplate, Infinity as InfinityIcon } from 'lucide-react';import Sidebar from '../components/Sidebar';import { useAuth } from '../context/AuthContext';import { FREE_LIMITS, PLAN_FREE, PLAN_PLUS, PLUS_PRICE_USD, normalizePlan } from '../config/plans';const PlanCard = ({ title, price, description, features, highlighted, buttonText, isCurrentPlan, onClick, loading, delay }) => {const { t } = useTranslation();return (<motion.divinitial={{ opacity: 0, y: 30 }}animate={{ opacity: 1, y: 0 }}transition={{ delay, type: 'spring', stiffness: 120, damping: 18 }}whileHover={isCurrentPlan ? {} : { y: -8 }}className={`relative bg-surface-container-lowest p-10 rough-border flex flex-col gap-8 h-full ${highlighted ? 'shadow-[12px_12px_0px_0px_var(--color-primary)] border-secondary' : 'rough-shadow'}`}>{highlighted && (<div className="absolute -top-5 left-1/2 -translate-x-1/2 bg-secondary text-primary px-6 py-2 rough-border font-bold text-sm uppercase tracking-widest whitespace-nowrap">{t('plans.no_limits', 'No limits')}</div>)}<div className="text-center border-b-2 border-primary/10 pb-8"><h3 className="text-5xl font-display-lg text-primary mb-2">{title}</h3><div className="flex items-center justify-center gap-1"><span className="text-2xl font-display-lg text-secondary">$</span><span className="text-6xl font-display-lg text-primary">{price}</span><span className="text-sm font-bold text-on-surface-variant uppercase tracking-widest mt-4">{t('subscription.per_month')}</span></div><p className="mt-4 text-sm text-on-surface-variant font-medium">{description}</p></div>1 unmodified line<ul className="flex flex-col gap-4 flex-grow">{features.map((f, i) => (<li key={i} className="flex items-start gap-3"><Check size={18} className="text-secondary mt-1 flex-shrink-0" /><span className="text-sm font-bold text-primary">{f}</span></li>))}</ul>4 unmodified linesonClick={isCurrentPlan ? undefined : onClick}disabled={isCurrentPlan || loading}className={`w-full py-4 text-xl font-bold flex items-center justify-center gap-2 rough-border transition-all ${isCurrentPlan? 'bg-surface-container-high text-on-surface-variant/50 border-primary/20 cursor-default': highlighted? 'bg-primary text-on-primary hover:bg-primary/95 cursor-pointer': 'bg-surface-container-lowest text-primary border-primary hover:bg-primary/5 cursor-pointer'}`}><span>{isCurrentPlan ? t('subscription.current_plan', 'Current plan') : loading ? t('subscription.upgrading', 'Switching...') : buttonText}</span>{!isCurrentPlan && !loading && <ArrowRight size={20} />}</motion.button></motion.div>3 unmodified linesconst SubscriptionPage = () => {const { t } = useTranslation();const { user, updateUser } = useAuth();const [loadingPlan, setLoadingPlan] = React.useState(null);const [notification, setNotification] = React.useState(null);const notify = (type, message) => {setNotification({ type, message });setTimeout(() => setNotification(null), 4500);};const handleChangePlan = async (plan) => {if (!user) return;setLoadingPlan(plan);try {const API_URL = import.meta.env.VITE_API_URL;const res = await axios.post(`${API_URL}/payments/change-tier`, { tier: plan });updateUser(res.data);notify('success', t('plans.switched', { plan, defaultValue: `Your plan is now ${plan}.` }));} catch (err) {if (err.response?.status === 402) {notify('error', t('plans.payments_soon', 'Online payments are not connected yet. Plus will be available soon.'));} else {notify('error', err.response?.data?.message || t('plans.switch_failed', 'Could not change the plan. Please try again.'));}} finally {setLoadingPlan(null);}};const currentPlan = normalizePlan(user?.subscriptionTier);const plans = [{key: PLAN_FREE,title: 'Free',price: '0',description: t('plans.free_desc', 'Everything you need to plan on your own.'),buttonText: t('plans.free_btn', 'Switch to Free'),features: [t('plans.feat_boards', { count: FREE_LIMITS.boards, defaultValue: `Up to ${FREE_LIMITS.boards} boards` }),t('plans.feat_nodes', { count: FREE_LIMITS.nodesPerBoard, defaultValue: `Up to ${FREE_LIMITS.nodesPerBoard} nodes per board` }),t('plans.feat_guests', { count: FREE_LIMITS.guestsPerBoard, defaultValue: `Up to ${FREE_LIMITS.guestsPerBoard} guests per board` }),t('plans.feat_templates', { count: FREE_LIMITS.templates, defaultValue: `${FREE_LIMITS.templates} saved templates` }),t('plans.feat_core', 'All node types, auto-layout, PNG/JSON export'),],},{key: PLAN_PLUS,title: 'Plus',price: String(PLUS_PRICE_USD),highlighted: true,description: t('plans.plus_desc', 'For big plans and teams. No caps on anything.'),buttonText: t('plans.plus_btn', 'Get Plus'),features: [t('plans.feat_unlimited_boards', 'Unlimited boards'),t('plans.feat_unlimited_nodes', 'Unlimited nodes'),t('plans.feat_unlimited_guests', 'Unlimited collaborators'),t('plans.feat_unlimited_templates', 'Unlimited saved templates'),t('plans.feat_everything_free', 'Everything in Free'),],},];const rows = [{ icon: Layout, label: t('plans.row_boards', 'Boards'), free: FREE_LIMITS.boards },{ icon: Network, label: t('plans.row_nodes', 'Nodes per board'), free: FREE_LIMITS.nodesPerBoard },{ icon: Users, label: t('plans.row_guests', 'Guests per board'), free: FREE_LIMITS.guestsPerBoard },{ icon: LayoutTemplate, label: t('plans.row_templates', 'Saved templates'), free: FREE_LIMITS.templates },];return (<div className="flex h-screen bg-background overflow-hidden"><Sidebar /><main className="flex-grow flex flex-col relative overflow-y-auto graph-paper-bg scrollbar-hide"><AnimatePresence>{notification && (<motion.divinitial={{ opacity: 0, y: -50 }}animate={{ opacity: 1, y: 0 }}exit={{ opacity: 0, y: -50 }}className={`fixed top-6 left-1/2 -translate-x-1/2 px-8 py-4 z-50 rough-border shadow-2xl font-bold text-lg text-white max-w-[90vw] text-center ${notification.type === 'success' ? 'bg-primary' : 'bg-error'}`}>2 unmodified lines)}</AnimatePresence><section className="p-8 md:p-16 flex flex-col gap-12 max-w-5xl mx-auto w-full relative z-10 pb-16"><div className="text-center flex flex-col items-center gap-6"><motion.divinitial={{ scale: 0, rotate: -30 }}animate={{ scale: 1, rotate: 0 }}transition={{ type: 'spring', stiffness: 200, damping: 12 }}className="w-24 h-24 bg-secondary rounded-full flex items-center justify-center border-4 border-primary shadow-xl"><Zap size={48} className="text-primary" /></motion.div><h1 className="text-6xl md:text-7xl font-display-lg text-primary leading-tight max-w-3xl">{t('plans.title_p1', 'Two plans. ')}<span className="highlighter-bg">{t('plans.title_highlight', 'No fine print.')}</span></h1><p className="font-accent-note text-3xl text-secondary -rotate-1 max-w-xl">{t('plans.subtitle', 'Free has small creation limits. Plus has none.')}</p></div><div className="grid grid-cols-1 md:grid-cols-2 gap-10 items-stretch">{plans.map((plan, i) => (<PlanCardkey={plan.key}{...plan}delay={0.1 + i * 0.1}isCurrentPlan={currentPlan === plan.key}onClick={() => handleChangePlan(plan.key)}loading={loadingPlan === plan.key}/>))}</div>3 unmodified lines<thead><tr className="border-b-2 border-primary/15"><th className="text-left p-4 font-bold text-on-surface-variant uppercase tracking-widest text-xs">{t('subscription.compare.feature', 'Feature')}</th><th className="p-4 font-bold text-primary text-center">Free</th><th className="p-4 font-bold text-secondary text-center bg-secondary/5">Plus</th></tr></thead><tbody>{rows.map((row, i) => (<tr key={i} className="border-b border-primary/10"><td className="p-4 font-semibold text-on-surface-variant flex items-center gap-2"><row.icon size={16} className="text-secondary flex-shrink-0" />{row.label}</td><td className="p-4 text-center font-bold text-primary">{row.free}</td><td className="p-4 text-center font-bold bg-secondary/5"><InfinityIcon size={20} className="text-secondary mx-auto" /></td></tr>))}</tbody>6 unmodified lines};export default SubscriptionPage;
package-lock.json+19
package.json+1
src/App.jsx+3-8
src/components/Sidebar.jsx+17-13
src/config/plans.jsAdded+20
src/context/AuthContext.jsx+1-1
src/features/canvas/components/AIHintOverlay.jsxDeleted-428
src/features/canvas/components/CanvasToolbar.jsx+28-36
src/features/canvas/components/PaywallModal.jsx+5-4
src/features/canvas/components/nodes/SketchNode.jsx+2-2
src/features/canvas/hooks/useCanvasLogic.js+191-284
src/features/canvas/layout.jsAdded+143
src/features/dashboard/hooks/useDashboardLogic.js+14-38
src/features/landing/HeroBoardDemo.jsxAdded+243
src/features/landing/components/AIFeatureSection.jsxDeleted-76
src/features/landing/components/HeroSection.jsxDeleted-130
src/features/landing/components/PricingSection.jsxDeleted-105
src/features/landing/landingCopy.jsAdded+199
src/features/templates/SaveTemplateModal.jsxAdded+146
src/features/templates/TemplateGallery.jsxAdded+322
src/features/templates/TemplatePreview.jsxAdded+105
src/features/templates/builtinTemplates.jsAdded+174
src/features/templates/templatesApi.jsAdded+121
src/layouts/Layout.jsx+37-19
src/locales/en.json+541-466
src/locales/uk.json+541-466
src/pages/CanvasPage.jsx+93-171
src/pages/DashboardPage.jsx+16-427
src/pages/LandingPage.jsx+343-616
src/pages/OnboardingPage.jsx+8-8
src/pages/SettingsPage.jsx-6
src/pages/SubscriptionPage.jsx+92-134