danylokhodus Claude Opus 5.5 commited on
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>

package-lock.json CHANGED
@@ -8,6 +8,7 @@
8
  "name": "flowweb",
9
  "version": "0.0.0",
10
  "dependencies": {
 
11
  "@microsoft/signalr": "^10.0.0",
12
  "@react-oauth/google": "^0.13.5",
13
  "@xyflow/react": "^12.10.2",
@@ -300,6 +301,24 @@
300
  "node": ">=6.9.0"
301
  }
302
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  "node_modules/@emnapi/core": {
304
  "version": "1.10.0",
305
  "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
 
8
  "name": "flowweb",
9
  "version": "0.0.0",
10
  "dependencies": {
11
+ "@dagrejs/dagre": "^1.1.8",
12
  "@microsoft/signalr": "^10.0.0",
13
  "@react-oauth/google": "^0.13.5",
14
  "@xyflow/react": "^12.10.2",
 
301
  "node": ">=6.9.0"
302
  }
303
  },
304
+ "node_modules/@dagrejs/dagre": {
305
+ "version": "1.1.8",
306
+ "resolved": "https://registry.npmjs.org/@dagrejs/dagre/-/dagre-1.1.8.tgz",
307
+ "integrity": "sha512-5SEDlndt4W/LaVzPYJW+bSmSEZc9EzTf8rJ20WCKvjS5EAZAN0b+x0Yww7VMT4R3Wootkg+X9bUfUxazYw6Blw==",
308
+ "license": "MIT",
309
+ "dependencies": {
310
+ "@dagrejs/graphlib": "2.2.4"
311
+ }
312
+ },
313
+ "node_modules/@dagrejs/graphlib": {
314
+ "version": "2.2.4",
315
+ "resolved": "https://registry.npmjs.org/@dagrejs/graphlib/-/graphlib-2.2.4.tgz",
316
+ "integrity": "sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==",
317
+ "license": "MIT",
318
+ "engines": {
319
+ "node": ">17.0.0"
320
+ }
321
+ },
322
  "node_modules/@emnapi/core": {
323
  "version": "1.10.0",
324
  "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
package.json CHANGED
@@ -10,6 +10,7 @@
10
  "preview": "vite preview"
11
  },
12
  "dependencies": {
 
13
  "@microsoft/signalr": "^10.0.0",
14
  "@react-oauth/google": "^0.13.5",
15
  "@xyflow/react": "^12.10.2",
 
10
  "preview": "vite preview"
11
  },
12
  "dependencies": {
13
+ "@dagrejs/dagre": "^1.1.8",
14
  "@microsoft/signalr": "^10.0.0",
15
  "@react-oauth/google": "^0.13.5",
16
  "@xyflow/react": "^12.10.2",
src/App.jsx CHANGED
@@ -1,5 +1,5 @@
1
  import React from 'react';
2
- import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
3
  import Layout from './layouts/Layout';
4
  import LandingPage from './pages/LandingPage';
5
  import AuthPage from './pages/AuthPage';
@@ -7,7 +7,6 @@ import OnboardingPage from './pages/OnboardingPage';
7
  import DashboardPage from './pages/DashboardPage';
8
  import ProfilePage from './pages/ProfilePage';
9
  import CanvasPage from './pages/CanvasPage';
10
- import HabitTrackerPage from './pages/HabitTrackerPage';
11
  import SubscriptionPage from './pages/SubscriptionPage';
12
  import SettingsPage from './pages/SettingsPage';
13
  import ClaimPage from './pages/ClaimPage';
@@ -27,7 +26,8 @@ function App() {
27
  <Route path="/profile" element={<ProfilePage />} />
28
  <Route path="/canvas" element={<CanvasPage />} />
29
  <Route path="/canvas/:id" element={<CanvasPage />} />
30
- <Route path="/habits" element={<HabitTrackerPage />} />
 
31
  <Route path="/subscription" element={<SubscriptionPage />} />
32
  <Route path="/settings" element={<SettingsPage />} />
33
  </Routes>
@@ -35,9 +35,4 @@ function App() {
35
  );
36
  }
37
 
38
-
39
-
40
-
41
-
42
  export default App;
43
-
 
1
  import React from 'react';
2
+ import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
3
  import Layout from './layouts/Layout';
4
  import LandingPage from './pages/LandingPage';
5
  import AuthPage from './pages/AuthPage';
 
7
  import DashboardPage from './pages/DashboardPage';
8
  import ProfilePage from './pages/ProfilePage';
9
  import CanvasPage from './pages/CanvasPage';
 
10
  import SubscriptionPage from './pages/SubscriptionPage';
11
  import SettingsPage from './pages/SettingsPage';
12
  import ClaimPage from './pages/ClaimPage';
 
26
  <Route path="/profile" element={<ProfilePage />} />
27
  <Route path="/canvas" element={<CanvasPage />} />
28
  <Route path="/canvas/:id" element={<CanvasPage />} />
29
+ {/* Habit tracker is hidden until habits get their own space (see ROADMAP.md) */}
30
+ <Route path="/habits" element={<Navigate to="/dashboard" replace />} />
31
  <Route path="/subscription" element={<SubscriptionPage />} />
32
  <Route path="/settings" element={<SettingsPage />} />
33
  </Routes>
 
35
  );
36
  }
37
 
 
 
 
 
38
  export default App;
 
src/components/Sidebar.jsx CHANGED
@@ -1,13 +1,13 @@
1
- import React, { useState, useEffect } from 'react';
2
  import axios from 'axios';
3
  import { motion } from 'framer-motion';
4
  import { useNavigate, useLocation } from 'react-router-dom';
5
  import { useAuth } from '../context/AuthContext';
6
  import { useTranslation } from 'react-i18next';
 
7
  import {
8
  LayoutDashboard,
9
  PenTool,
10
- Calendar,
11
  Trophy,
12
  Settings,
13
  LogOut,
@@ -50,6 +50,9 @@ const Sidebar = () => {
50
  return stored ? parseInt(stored, 10) : 0;
51
  });
52
 
 
 
 
53
  useEffect(() => {
54
  if (!user) return;
55
  const fetchProjectCount = async () => {
@@ -59,6 +62,7 @@ const Sidebar = () => {
59
  if (Array.isArray(res.data)) {
60
  const count = res.data.length;
61
  setProjectCount(count);
 
62
  cachedProjectCount = count;
63
  localStorage.setItem('tf_project_count', count.toString());
64
  }
@@ -80,7 +84,7 @@ const Sidebar = () => {
80
  const menuItems = [
81
  { icon: LayoutDashboard, labelKey: 'projects', path: '/dashboard' },
82
  { icon: PenTool, labelKey: 'canvas', path: '/canvas' },
83
- { icon: Calendar, labelKey: 'habits', path: '/habits' },
84
  { icon: User, labelKey: 'profile', path: '/profile' },
85
  { icon: Settings, labelKey: 'settings', path: '/settings' },
86
  ];
@@ -115,26 +119,26 @@ const Sidebar = () => {
115
  <div className="flex flex-col gap-1">
116
  <div className="flex items-center justify-between">
117
  <span className="font-accent-note text-2xl text-secondary">
118
- {user?.subscriptionTier === 'Ultra' ? 'Ultra' : user?.subscriptionTier === 'Pro' ? 'Pro' : t('sidebar.free_plan')}
119
  </span>
120
- {(!user?.subscriptionTier || user?.subscriptionTier === 'Free') && (
121
- <span className="text-xs font-bold text-primary">{projectCount}/3 Slots</span>
 
 
122
  )}
123
  </div>
124
  <p className="text-[10px] text-on-surface-variant/70 font-semibold tracking-wide uppercase mt-1">
125
- {user?.subscriptionTier === 'Ultra'
126
- ? t('sidebar.ultra_active', 'All Limits Unlocked')
127
- : user?.subscriptionTier === 'Pro'
128
- ? t('sidebar.pro_active', 'AI: {{count}}/200 daily', { count: user?.dailyAiGenerationsCount || 0 })
129
- : t('sidebar.free_active', 'AI: {{count}}/3 daily', { count: user?.dailyAiGenerationsCount || 0 })}
130
  </p>
131
  </div>
132
- {user?.subscriptionTier !== 'Ultra' && (
133
  <button
134
  onClick={() => navigate('/subscription')}
135
  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"
136
  >
137
- {user?.subscriptionTier === 'Pro' ? t('sidebar.go_ultra', 'Go Ultra') : t('sidebar.upgrade_now')}
138
  </button>
139
  )}
140
  </div>
 
1
+ import React, { useState, useEffect } from 'react';
2
  import axios from 'axios';
3
  import { motion } from 'framer-motion';
4
  import { useNavigate, useLocation } from 'react-router-dom';
5
  import { useAuth } from '../context/AuthContext';
6
  import { useTranslation } from 'react-i18next';
7
+ import { FREE_LIMITS, isPlus } from '../config/plans';
8
  import {
9
  LayoutDashboard,
10
  PenTool,
 
11
  Trophy,
12
  Settings,
13
  LogOut,
 
50
  return stored ? parseInt(stored, 10) : 0;
51
  });
52
 
53
+ const [ownedCount, setOwnedCount] = useState(0);
54
+ const userIsPlus = isPlus(user);
55
+
56
  useEffect(() => {
57
  if (!user) return;
58
  const fetchProjectCount = async () => {
 
62
  if (Array.isArray(res.data)) {
63
  const count = res.data.length;
64
  setProjectCount(count);
65
+ setOwnedCount(res.data.filter(p => !p.isShared).length);
66
  cachedProjectCount = count;
67
  localStorage.setItem('tf_project_count', count.toString());
68
  }
 
84
  const menuItems = [
85
  { icon: LayoutDashboard, labelKey: 'projects', path: '/dashboard' },
86
  { icon: PenTool, labelKey: 'canvas', path: '/canvas' },
87
+ // Habits are hidden until they get their own space (see ROADMAP.md)
88
  { icon: User, labelKey: 'profile', path: '/profile' },
89
  { icon: Settings, labelKey: 'settings', path: '/settings' },
90
  ];
 
119
  <div className="flex flex-col gap-1">
120
  <div className="flex items-center justify-between">
121
  <span className="font-accent-note text-2xl text-secondary">
122
+ {userIsPlus ? 'Plus' : 'Free'}
123
  </span>
124
+ {!userIsPlus && (
125
+ <span className="text-xs font-bold text-primary">
126
+ {t('sidebar.boards_used', { used: ownedCount, max: FREE_LIMITS.boards, defaultValue: `${ownedCount}/${FREE_LIMITS.boards} boards` })}
127
+ </span>
128
  )}
129
  </div>
130
  <p className="text-[10px] text-on-surface-variant/70 font-semibold tracking-wide uppercase mt-1">
131
+ {userIsPlus
132
+ ? t('sidebar.plus_active', 'No limits')
133
+ : t('sidebar.free_limits', { nodes: FREE_LIMITS.nodesPerBoard, defaultValue: `Up to ${FREE_LIMITS.nodesPerBoard} nodes per board` })}
 
 
134
  </p>
135
  </div>
136
+ {!userIsPlus && (
137
  <button
138
  onClick={() => navigate('/subscription')}
139
  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"
140
  >
141
+ {t('sidebar.get_plus', 'Get Plus')}
142
  </button>
143
  )}
144
  </div>
src/config/plans.js ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Subscription plans. Mirrors FlowAPI.Application/Services/Plans.cs — keep both in sync.
2
+ export const PLAN_FREE = 'Free';
3
+ export const PLAN_PLUS = 'Plus';
4
+
5
+ export const PLUS_PRICE_USD = 10;
6
+
7
+ export const FREE_LIMITS = {
8
+ boards: 5,
9
+ nodesPerBoard: 300,
10
+ guestsPerBoard: 2,
11
+ templates: 3,
12
+ };
13
+
14
+ // Legacy tiers ("Pro", "Ultra") are treated as Plus.
15
+ export const normalizePlan = (tier) =>
16
+ !tier || String(tier).trim().toLowerCase() === 'free' ? PLAN_FREE : PLAN_PLUS;
17
+
18
+ export const isPlus = (user) => normalizePlan(user?.subscriptionTier) === PLAN_PLUS;
19
+
20
+ export const limitFor = (user, key) => (isPlus(user) ? Infinity : FREE_LIMITS[key]);
src/context/AuthContext.jsx CHANGED
@@ -13,7 +13,7 @@ export const AuthProvider = ({ children }) => {
13
 
14
  // Keep HF Space alive — ping every 25 minutes to prevent sleeping
15
  useEffect(() => {
16
- const ping = () => axios.get(`${API_URL}/users`).catch(() => {});
17
  ping(); // initial ping on load
18
  const interval = setInterval(ping, 25 * 60 * 1000);
19
  return () => clearInterval(interval);
 
13
 
14
  // Keep HF Space alive — ping every 25 minutes to prevent sleeping
15
  useEffect(() => {
16
+ const ping = () => axios.get(`${API_URL}/health`).catch(() => {});
17
  ping(); // initial ping on load
18
  const interval = setInterval(ping, 25 * 60 * 1000);
19
  return () => clearInterval(interval);
src/features/canvas/components/AIHintOverlay.jsx DELETED
@@ -1,428 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import { motion, AnimatePresence } from 'framer-motion';
3
- import { useTranslation } from 'react-i18next';
4
- import { Sparkles, X, Send, Lightbulb, Compass, Award, AlertCircle, Pencil, Loader2 } from 'lucide-react';
5
-
6
- const AIHintOverlay = ({
7
- isAIActive,
8
- setIsAIActive,
9
- aiLoading,
10
- submitAICanvasPrompt,
11
- chatMessages = [],
12
- setChatMessages,
13
- chatThreads = [],
14
- activeThreadId = 'default',
15
- setActiveThreadId,
16
- createNewThread,
17
- deleteThread,
18
- renameThread
19
- }) => {
20
- const { t } = useTranslation();
21
- const [prompt, setPrompt] = useState('');
22
- const [loadingStepIndex, setLoadingStepIndex] = useState(0);
23
- const [isEditingThreadTitle, setIsEditingThreadTitle] = useState(false);
24
- const [editTitleVal, setEditTitleVal] = useState('');
25
- const messagesEndRef = useRef(null);
26
-
27
- const activeThread = chatThreads.find(t => t.id === activeThreadId) || chatThreads[0] || { title: '' };
28
-
29
- const handleStartRename = () => {
30
- setEditTitleVal(activeThread.title);
31
- setIsEditingThreadTitle(true);
32
- };
33
-
34
- const handleFinishRename = () => {
35
- if (editTitleVal.trim()) {
36
- renameThread(activeThreadId, editTitleVal.trim());
37
- }
38
- setIsEditingThreadTitle(false);
39
- };
40
-
41
- const loadingSteps = [
42
- "Гостримо графітові олівці...",
43
- "Відкриваємо чистий пергамент...",
44
- "Калібруємо творчий компас...",
45
- "Консультуємось з цифровим оракулом...",
46
- "Малюємо контури вузлів...",
47
- "Накладаємо зв'язки...",
48
- "Задуваємо свіже чорнило..."
49
- ];
50
-
51
- const suggestions = [
52
- {
53
- text: t('canvas.ai_suggest_details', 'Розпиши поточний крок на підзадачі'),
54
- icon: <Lightbulb size={14} className="text-amber-600" />,
55
- tag: t('canvas.ai_suggest_details_tag', 'Деталізація')
56
- },
57
- {
58
- text: t('canvas.ai_suggest_route', 'Запропонуй альтернативний шлях на випадок сбою'),
59
- icon: <Compass size={14} className="text-emerald-600" />,
60
- tag: t('canvas.ai_suggest_route_tag', 'Альтернатива')
61
- },
62
- {
63
- text: t('canvas.ai_suggest_habits', 'Створи щоденні звички для підкріплення цієї цілі'),
64
- icon: <Award size={14} className="text-indigo-600" />,
65
- tag: t('canvas.ai_suggest_habits_tag', 'Звички')
66
- }
67
- ];
68
-
69
- useEffect(() => {
70
- let interval;
71
- if (aiLoading) {
72
- setLoadingStepIndex(0);
73
- interval = setInterval(() => {
74
- setLoadingStepIndex((prev) => (prev + 1) % loadingSteps.length);
75
- }, 3000);
76
- }
77
- return () => clearInterval(interval);
78
- }, [aiLoading]);
79
-
80
- // Auto scroll to bottom
81
- useEffect(() => {
82
- if (isAIActive) {
83
- const timer = setTimeout(() => {
84
- messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
85
- }, 100);
86
- return () => clearTimeout(timer);
87
- }
88
- }, [chatMessages, aiLoading, isAIActive, activeThreadId]);
89
-
90
- const handleSubmit = async (e) => {
91
- if (e) e.preventDefault();
92
- if (!prompt.trim() || aiLoading) return;
93
- const promptToSend = prompt;
94
- setPrompt('');
95
- await submitAICanvasPrompt(promptToSend);
96
- };
97
-
98
- const handleKeyDown = (e) => {
99
- if (e.key === 'Enter' && !e.shiftKey) {
100
- e.preventDefault();
101
- handleSubmit();
102
- }
103
- };
104
-
105
- const parseInlineMarkdown = (text) => {
106
- const parts = [];
107
- let remaining = text;
108
- const boldRegex = /\*\*([^*]+)\*\*/g;
109
- let match;
110
- let lastIndex = 0;
111
-
112
- while ((match = boldRegex.exec(text)) !== null) {
113
- const textBefore = text.substring(lastIndex, match.index);
114
- if (textBefore) parts.push(textBefore);
115
- parts.push(<strong key={match.index} className="font-extrabold text-primary">{match[1]}</strong>);
116
- lastIndex = boldRegex.lastIndex;
117
- }
118
-
119
- const textAfter = text.substring(lastIndex);
120
- if (textAfter) parts.push(textAfter);
121
-
122
- return parts.length > 0 ? parts : text;
123
- };
124
-
125
- const renderMarkdown = (text) => {
126
- if (!text) return null;
127
- return text.split('\n').map((line, idx) => {
128
- const cleanLine = line.trim();
129
- if (!cleanLine) return <div key={idx} className="h-2" />;
130
-
131
- const listMatch = cleanLine.match(/^[\*\-\u2022]\s+(.*)/);
132
- if (listMatch) {
133
- return (
134
- <li key={idx} className="ml-4 list-disc pl-1 text-sm text-primary/80 font-body my-1">
135
- {parseInlineMarkdown(listMatch[1])}
136
- </li>
137
- );
138
- }
139
-
140
- const numListMatch = cleanLine.match(/^\d+\.\s+(.*)/);
141
- if (numListMatch) {
142
- return (
143
- <li key={idx} className="ml-4 list-decimal pl-1 text-sm text-primary/80 font-body my-1">
144
- {parseInlineMarkdown(numListMatch[1])}
145
- </li>
146
- );
147
- }
148
-
149
- const headingMatch = cleanLine.match(/^(#{1,6})\s+(.*)/);
150
- if (headingMatch) {
151
- const level = headingMatch[1].length;
152
- const headingText = headingMatch[2];
153
- const classes = level === 1 ? "text-xl font-bold font-display mt-3 mb-1.5" :
154
- level === 2 ? "text-lg font-bold font-display mt-2.5 mb-1.5" :
155
- "text-base font-bold font-display mt-2 mb-1";
156
- return <div key={idx} className={`${classes} text-primary`}>{parseInlineMarkdown(headingText)}</div>;
157
- }
158
-
159
- return (
160
- <p key={idx} className="text-sm text-primary/85 font-body leading-relaxed mb-1.5 break-words">
161
- {parseInlineMarkdown(cleanLine)}
162
- </p>
163
- );
164
- });
165
- };
166
-
167
- return (
168
- <AnimatePresence>
169
- {isAIActive && (
170
- <>
171
- {/* Backdrop overlay (no blur) */}
172
- <motion.div
173
- initial={{ opacity: 0 }}
174
- animate={{ opacity: 1 }}
175
- exit={{ opacity: 0 }}
176
- onClick={() => !aiLoading && setIsAIActive(false)}
177
- className="fixed inset-0 bg-primary/20 z-40 cursor-pointer"
178
- />
179
-
180
- {/* Sketchbook Parchment Drawer */}
181
- <motion.div
182
- initial={{ x: '100%', opacity: 0.9 }}
183
- animate={{ x: 0, opacity: 1 }}
184
- exit={{ x: '100%', opacity: 0.9 }}
185
- transition={{ type: 'spring', damping: 25, stiffness: 150 }}
186
- 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"
187
- >
188
- {/* Spiral binding rings style visualization on the left edge */}
189
- <div className="absolute left-0 top-0 bottom-0 w-3 flex flex-col justify-around py-8 pointer-events-none z-10">
190
- {[...Array(12)].map((_, i) => (
191
- <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" />
192
- ))}
193
- </div>
194
-
195
- {/* Notebook Margin Line */}
196
- <div className="absolute left-10 top-0 bottom-0 w-[2px] bg-red-400/40 pointer-events-none" />
197
-
198
- {/* Notebook Paper Lines Pattern */}
199
- <div
200
- className="absolute inset-0 opacity-[0.03] pointer-events-none"
201
- style={{
202
- backgroundImage: 'linear-gradient(#000 1px, transparent 1px)',
203
- backgroundSize: '100% 28px'
204
- }}
205
- />
206
-
207
- {/* Content Container */}
208
- <div className="flex-grow flex flex-col pl-14 pr-6 py-6 overflow-hidden relative z-0">
209
-
210
- {/* Header */}
211
- <div className="flex items-start justify-between mb-4 border-b-2 border-primary/10 pb-4">
212
- <div>
213
- <div className="flex items-center gap-2 mb-1">
214
- <Sparkles className="text-amber-500 animate-pulse" size={20} />
215
- <span className="font-accent-note text-amber-600 font-bold uppercase tracking-wider text-xs">TaskFlow AI</span>
216
- </div>
217
- <h2 className="font-display text-2xl text-primary leading-none">
218
- {t('canvas.ai_roadmap_strategist', 'Roadmap Strategist')}
219
- </h2>
220
- </div>
221
-
222
- <button
223
- onClick={() => !aiLoading && setIsAIActive(false)}
224
- disabled={aiLoading}
225
- className="p-1.5 border-2 border-primary/20 hover:border-primary rounded-xl transition-all hover:scale-105 cursor-pointer disabled:opacity-50"
226
- >
227
- <X size={18} className="text-primary/70" />
228
- </button>
229
- </div>
230
-
231
- {/* Thread Selector Section */}
232
- <div className="flex items-center justify-between gap-2 mb-3 bg-[#f5efe0]/30 border-2 border-primary/10 p-2 rounded-xl relative">
233
- <div className="flex-1 flex items-center gap-2 overflow-hidden">
234
- {isEditingThreadTitle ? (
235
- <input
236
- type="text"
237
- value={editTitleVal}
238
- onChange={(e) => setEditTitleVal(e.target.value)}
239
- onBlur={handleFinishRename}
240
- onKeyDown={(e) => {
241
- if (e.key === 'Enter') handleFinishRename();
242
- if (e.key === 'Escape') setIsEditingThreadTitle(false);
243
- }}
244
- autoFocus
245
- 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"
246
- />
247
- ) : (
248
- <div className="flex-grow relative flex items-center overflow-hidden">
249
- <select
250
- value={activeThreadId}
251
- onChange={(e) => setActiveThreadId(e.target.value)}
252
- 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"
253
- >
254
- {chatThreads.map(thread => (
255
- <option key={thread.id} value={thread.id}>
256
- {thread.title}
257
- </option>
258
- ))}
259
- </select>
260
- <span className="absolute right-2 pointer-events-none text-primary/60 text-[10px]">▼</span>
261
- </div>
262
- )}
263
- </div>
264
-
265
- <div className="flex items-center gap-1.5">
266
- {!isEditingThreadTitle && (
267
- <button
268
- onClick={handleStartRename}
269
- title={t('canvas.ai_rename_title', 'Перейменувати чат')}
270
- 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"
271
- >
272
- <Pencil size={12} className="text-primary/70" />
273
- </button>
274
- )}
275
-
276
- <button
277
- onClick={() => {
278
- const newId = createNewThread();
279
- // Start renaming the new thread immediately
280
- setActiveThreadId(newId);
281
- setEditTitleVal(`Чат ${chatThreads.length + 1}`);
282
- setIsEditingThreadTitle(true);
283
- }}
284
- title={t('canvas.ai_new_chat', 'Новий')}
285
- 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]"
286
- >
287
- <span>+ {t('canvas.ai_new_chat', 'Новий')}</span>
288
- </button>
289
-
290
- <button
291
- onClick={() => {
292
- if (window.confirm(t('canvas.ai_delete_confirm', "Ви впевнені, що хочете видалити цей чат?"))) {
293
- deleteThread(activeThreadId);
294
- }
295
- }}
296
- title={t('canvas.ai_delete_title', 'Видалити чат')}
297
- disabled={chatThreads.length <= 1}
298
- 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"
299
- >
300
- <X size={12} className="text-red-600" />
301
- </button>
302
- </div>
303
- </div>
304
-
305
- {/* Chat Message Area */}
306
- <div className="flex-1 overflow-y-auto pr-2 mb-4 space-y-4 scrollbar-hide">
307
- {chatMessages.map((msg) => (
308
- <div
309
- key={msg.id}
310
- className={`flex flex-col ${msg.sender === 'user' ? 'items-end' : 'items-start'}`}
311
- >
312
- <div
313
- className={`max-w-[90%] p-3.5 rounded-2xl shadow-[2px_2px_0px_0px_rgba(0,0,0,0.15)] border-2 ${
314
- msg.sender === 'user'
315
- ? 'bg-[#eef5fc] border-blue-500/30 text-primary rounded-tr-none rotate-[0.5deg]'
316
- : msg.isError
317
- ? 'bg-red-50 border-red-500/30 text-red-700 rounded-tl-none rotate-[-0.5deg]'
318
- : 'bg-[#faf7f2] border-primary/20 text-primary rounded-tl-none rotate-[-0.5deg]'
319
- }`}
320
- >
321
- {msg.sender === 'user' ? (
322
- <p className="text-sm font-body leading-relaxed whitespace-pre-wrap">{msg.text}</p>
323
- ) : (
324
- <div className="space-y-1">
325
- {renderMarkdown(msg.text)}
326
- </div>
327
- )}
328
- </div>
329
-
330
- {/* Timestamp */}
331
- <span className="text-[9px] font-extrabold text-primary/40 uppercase tracking-widest mt-1.5 px-2">
332
- {msg.sender === 'user' ? 'Ви' : 'Стратег'}
333
- </span>
334
- </div>
335
- ))}
336
-
337
- {/* Loading state showing pencil sketching & steps */}
338
- {aiLoading && (
339
- <div className="flex flex-col items-start animate-pulse">
340
- <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">
341
- <div className="flex items-center gap-3">
342
- {/* Pencil writing micro-animation */}
343
- <motion.div
344
- animate={{
345
- x: [0, 8, -8, 6, 0],
346
- y: [0, -5, 8, -4, 0],
347
- rotate: [0, 15, -15, 10, 0]
348
- }}
349
- transition={{
350
- duration: 2,
351
- repeat: Infinity,
352
- ease: "easeInOut"
353
- }}
354
- className="w-8 h-8 rounded-lg bg-[#faf7f2] border border-primary flex items-center justify-center shadow-sm"
355
- >
356
- <Pencil className="text-amber-500" size={16} />
357
- </motion.div>
358
-
359
- <div className="flex flex-col">
360
- <span className="text-xs font-bold text-primary">Стратег планує...</span>
361
- <span className="text-[10px] font-extrabold text-primary/40 uppercase tracking-wider">Генерація графів</span>
362
- </div>
363
- </div>
364
-
365
- <div className="flex items-center gap-2 bg-[#f4ebd0]/30 border border-primary/10 px-3 py-2 rounded-xl">
366
- <Loader2 className="animate-spin text-amber-600" size={14} />
367
- <span className="text-xs font-body italic text-primary/75">{loadingSteps[loadingStepIndex]}</span>
368
- </div>
369
- </div>
370
- </div>
371
- )}
372
- <div ref={messagesEndRef} />
373
- </div>
374
-
375
- {/* Suggestions chips (only visible if not loading) */}
376
- {!aiLoading && chatMessages.length === 1 && (
377
- <div className="flex flex-col gap-2 mb-4 bg-primary/5 p-3 rounded-2xl border-2 border-dashed border-primary/10">
378
- <span className="text-[10px] font-extrabold uppercase text-primary/60 tracking-wider flex items-center gap-1.5">
379
- <Sparkles size={12} className="text-amber-500" />
380
- <span>Підказки для старту</span>
381
- </span>
382
- <div className="flex flex-wrap gap-2">
383
- {suggestions.map((sug, idx) => (
384
- <button
385
- key={idx}
386
- onClick={() => setPrompt(sug.text)}
387
- 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]"
388
- >
389
- {sug.icon}
390
- <span>{sug.tag}</span>
391
- </button>
392
- ))}
393
- </div>
394
- </div>
395
- )}
396
-
397
- {/* Chat Input Form */}
398
- <form onSubmit={handleSubmit} className="mt-auto">
399
- <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">
400
- <textarea
401
- rows={1}
402
- value={prompt}
403
- onChange={(e) => setPrompt(e.target.value)}
404
- onKeyDown={handleKeyDown}
405
- disabled={aiLoading}
406
- placeholder={t('canvas.ask_ai_placeholder', 'Спроси стратега...')}
407
- 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"
408
- />
409
-
410
- <button
411
- type="submit"
412
- disabled={!prompt.trim() || aiLoading}
413
- 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"
414
- >
415
- <Send size={14} />
416
- </button>
417
- </div>
418
- </form>
419
-
420
- </div>
421
- </motion.div>
422
- </>
423
- )}
424
- </AnimatePresence>
425
- );
426
- };
427
-
428
- export default AIHintOverlay;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/features/canvas/components/CanvasToolbar.jsx CHANGED
@@ -2,10 +2,8 @@ import React from 'react';
2
  import { motion } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
  import {
5
- Sparkles,
6
  Target,
7
  GitFork,
8
- Timer,
9
  Copy,
10
  Scissors,
11
  Clipboard,
@@ -17,7 +15,9 @@ import {
17
  Pencil,
18
  Type,
19
  Download,
20
- MousePointer2
 
 
21
  } from 'lucide-react';
22
 
23
  const TooltipButton = ({ children, tooltip, onClick, disabled = false, className = "", active = false }) => {
@@ -50,8 +50,6 @@ const TooltipButton = ({ children, tooltip, onClick, disabled = false, className
50
  };
51
 
52
  const CanvasToolbar = ({
53
- handleAIRequest,
54
- isAIActive,
55
  addNewNodeAt,
56
  handleCopy,
57
  handleCut,
@@ -65,7 +63,10 @@ const CanvasToolbar = ({
65
  canUndo,
66
  canRedo,
67
  drawingMode,
68
- setDrawingMode
 
 
 
69
  }) => {
70
  const { t } = useTranslation();
71
  const fileInputRef = React.useRef(null);
@@ -85,28 +86,6 @@ const CanvasToolbar = ({
85
  <div
86
  className="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"
87
  >
88
- {/* AI Assistant Section */}
89
- <div className="relative group">
90
- <motion.button
91
- whileHover={{ scale: isAIActive ? 1 : 1.05 }}
92
- whileTap={{ scale: isAIActive ? 1 : 0.95 }}
93
- onClick={handleAIRequest}
94
- className={`p-1.5 rounded-xl font-bold transition-all flex items-center justify-center relative border-2 ${
95
- isAIActive
96
- ? 'bg-secondary text-primary border-primary shadow-[2px_2px_0px_0px_var(--color-primary)] animate-pulse'
97
- : 'bg-primary text-on-primary border-transparent hover:border-primary hover:bg-primary/95 hover:shadow-[2px_2px_0px_0px_var(--color-primary)]'
98
- }`}
99
- >
100
- <Sparkles size={16} />
101
- </motion.button>
102
- <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">
103
- {isAIActive ? t('canvas.ai_thinking', 'AI Thinking...') : t('canvas.ai_assistant', 'AI Assistant')}
104
- <div className="absolute right-full top-1/2 -translate-y-1/2 border-8 border-transparent border-r-primary"></div>
105
- </div>
106
- </div>
107
-
108
- <div className="w-full h-[1px] bg-primary/10 my-0.5"></div>
109
-
110
  {/* Main Tools: Selection vs Brush */}
111
  <div className="flex flex-col gap-1">
112
  <TooltipButton
@@ -146,14 +125,6 @@ const CanvasToolbar = ({
146
  <GitFork size={16} />
147
  </TooltipButton>
148
 
149
- <TooltipButton
150
- tooltip={t('canvas.toolbar.add_habit', 'Додати звичку')}
151
- onClick={() => addNewNodeAt(undefined, undefined, 'habit')}
152
- disabled={drawingMode}
153
- >
154
- <Timer size={16} />
155
- </TooltipButton>
156
-
157
  <TooltipButton
158
  tooltip={t('canvas.toolbar.add_comment', 'Додати стікер')}
159
  onClick={() => addNewNodeAt(undefined, undefined, 'comment')}
@@ -188,6 +159,27 @@ const CanvasToolbar = ({
188
 
189
  <div className="w-full h-[1px] bg-primary/10 my-0.5"></div>
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  {/* Clipboard Actions */}
192
  <div className="flex flex-col gap-1">
193
  <TooltipButton
 
2
  import { motion } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
  import {
 
5
  Target,
6
  GitFork,
 
7
  Copy,
8
  Scissors,
9
  Clipboard,
 
15
  Pencil,
16
  Type,
17
  Download,
18
+ MousePointer2,
19
+ Network,
20
+ LayoutTemplate
21
  } from 'lucide-react';
22
 
23
  const TooltipButton = ({ children, tooltip, onClick, disabled = false, className = "", active = false }) => {
 
50
  };
51
 
52
  const CanvasToolbar = ({
 
 
53
  addNewNodeAt,
54
  handleCopy,
55
  handleCut,
 
63
  canUndo,
64
  canRedo,
65
  drawingMode,
66
+ setDrawingMode,
67
+ onAutoLayout,
68
+ onOpenTemplates,
69
+ canAutoLayout
70
  }) => {
71
  const { t } = useTranslation();
72
  const fileInputRef = React.useRef(null);
 
86
  <div
87
  className="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"
88
  >
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  {/* Main Tools: Selection vs Brush */}
90
  <div className="flex flex-col gap-1">
91
  <TooltipButton
 
125
  <GitFork size={16} />
126
  </TooltipButton>
127
 
 
 
 
 
 
 
 
 
128
  <TooltipButton
129
  tooltip={t('canvas.toolbar.add_comment', 'Додати стікер')}
130
  onClick={() => addNewNodeAt(undefined, undefined, 'comment')}
 
159
 
160
  <div className="w-full h-[1px] bg-primary/10 my-0.5"></div>
161
 
162
+ {/* Layout & Templates */}
163
+ <div className="flex flex-col gap-1">
164
+ <TooltipButton
165
+ tooltip={t('canvas.toolbar.auto_layout', 'Авто-розкладка (Shift+L)')}
166
+ onClick={onAutoLayout}
167
+ disabled={!canAutoLayout || drawingMode}
168
+ >
169
+ <Network size={16} />
170
+ </TooltipButton>
171
+
172
+ <TooltipButton
173
+ tooltip={t('canvas.toolbar.templates', 'Шаблони')}
174
+ onClick={onOpenTemplates}
175
+ disabled={drawingMode}
176
+ >
177
+ <LayoutTemplate size={16} />
178
+ </TooltipButton>
179
+ </div>
180
+
181
+ <div className="w-full h-[1px] bg-primary/10 my-0.5"></div>
182
+
183
  {/* Clipboard Actions */}
184
  <div className="flex flex-col gap-1">
185
  <TooltipButton
src/features/canvas/components/PaywallModal.jsx CHANGED
@@ -1,8 +1,9 @@
1
- import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
  import { useNavigate } from 'react-router-dom';
5
  import { Lock } from 'lucide-react';
 
6
 
7
  const PaywallModal = ({ showPaywall, setShowPaywall }) => {
8
  const { t } = useTranslation();
@@ -23,14 +24,14 @@ const PaywallModal = ({ showPaywall, setShowPaywall }) => {
23
  >
24
  <Lock size={48} className="mx-auto mb-4 text-primary" />
25
  <h2 className="text-4xl font-display-lg mb-4 text-primary">
26
- {t('pricing.premium_feature', 'Premium Feature')}
27
  </h2>
28
  <p className="text-xl mb-6 text-on-surface-variant font-medium">
29
- {t('pricing.paywall_desc', 'AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.')}
30
  </p>
31
  <div className="flex flex-col gap-3">
32
  <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">
33
- {t('pricing.upgrade_premium', 'Upgrade to Premium')}
34
  </button>
35
  <button onClick={() => setShowPaywall(false)} className="w-full py-4 font-bold text-on-surface-variant border-2 border-primary/10 rounded-xl cursor-pointer">
36
  {t('pricing.maybe_later', 'Maybe Later')}
 
1
+ import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
  import { useNavigate } from 'react-router-dom';
5
  import { Lock } from 'lucide-react';
6
+ import { FREE_LIMITS } from '../../../config/plans';
7
 
8
  const PaywallModal = ({ showPaywall, setShowPaywall }) => {
9
  const { t } = useTranslation();
 
24
  >
25
  <Lock size={48} className="mx-auto mb-4 text-primary" />
26
  <h2 className="text-4xl font-display-lg mb-4 text-primary">
27
+ {t('plans.limit_title', 'Free plan limit')}
28
  </h2>
29
  <p className="text-xl mb-6 text-on-surface-variant font-medium">
30
+ {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.` })}
31
  </p>
32
  <div className="flex flex-col gap-3">
33
  <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">
34
+ {t('plans.see_plus', 'See Plus')}
35
  </button>
36
  <button onClick={() => setShowPaywall(false)} className="w-full py-4 font-bold text-on-surface-variant border-2 border-primary/10 rounded-xl cursor-pointer">
37
  {t('pricing.maybe_later', 'Maybe Later')}
src/features/canvas/components/nodes/SketchNode.jsx CHANGED
@@ -1,6 +1,6 @@
1
  import React, { useState, useRef, useEffect } from 'react';
2
  import { Handle, Position, useReactFlow, useUpdateNodeInternals } from '@xyflow/react';
3
- import { CheckCircle2, Circle, X, ArrowRight, Sparkles, AlertCircle, CheckSquare, Settings } from 'lucide-react';
4
  import { useTranslation } from 'react-i18next';
5
  import { useTheme } from '../../../../context/ThemeContext';
6
  import { isDefaultLabel } from '../../utils';
@@ -252,7 +252,7 @@ const SketchNode = ({ id, data, selected }) => {
252
  {data.status}
253
  </span>
254
  <div className="flex items-center gap-2">
255
- {data.ai && <Sparkles size={12} className="text-secondary animate-pulse" />}
256
  {assignees.length > 0 && (
257
  <div
258
  title={tooltipText}
 
1
  import React, { useState, useRef, useEffect } from 'react';
2
  import { Handle, Position, useReactFlow, useUpdateNodeInternals } from '@xyflow/react';
3
+ import { CheckCircle2, Circle, X, ArrowRight, AlertCircle, CheckSquare, Settings } from 'lucide-react';
4
  import { useTranslation } from 'react-i18next';
5
  import { useTheme } from '../../../../context/ThemeContext';
6
  import { isDefaultLabel } from '../../utils';
 
252
  {data.status}
253
  </span>
254
  <div className="flex items-center gap-2">
255
+
256
  {assignees.length > 0 && (
257
  <div
258
  title={tooltipText}
src/features/canvas/hooks/useCanvasLogic.js CHANGED
@@ -13,6 +13,8 @@ import {
13
  useReactFlow,
14
  } from '@xyflow/react';
15
  import { useSignalR } from './useSignalR';
 
 
16
 
17
  export const getConditionSourceHandle = (sourceNode, condition) => {
18
  if (!sourceNode) return null;
@@ -149,126 +151,6 @@ export const useCanvasLogic = (projectId, user) => {
149
 
150
  const [cursors, setCursors] = useState({});
151
  const [clipboardVersion, setClipboardVersion] = useState(0);
152
- const [isAIActive, setIsAIActive] = useState(false);
153
- const [aiLoading, setAiLoading] = useState(false);
154
-
155
- const defaultThread = {
156
- id: 'default',
157
- title: 'Основний чат',
158
- messages: [
159
- {
160
- id: 'welcome',
161
- sender: 'agent',
162
- text: 'Привіт! Я твій ШІ-стратег. Опиши, що ти хочеш додати на доску або як хочеш змінити поточний план. Я можу будувати підзадачі, умови та звички, позначаючи всі зв\'язки.'
163
- }
164
- ]
165
- };
166
-
167
- const [chatThreads, setChatThreads] = useState(() => {
168
- if (!projectId) return [defaultThread];
169
- const saved = localStorage.getItem(`flow_chats_${projectId}`);
170
- if (saved) {
171
- try {
172
- return JSON.parse(saved);
173
- } catch (e) {
174
- console.error(e);
175
- }
176
- }
177
- return [defaultThread];
178
- });
179
-
180
- const [activeThreadId, setActiveThreadId] = useState(() => {
181
- if (!projectId) return 'default';
182
- const savedActive = localStorage.getItem(`flow_chats_active_${projectId}`);
183
- return savedActive || 'default';
184
- });
185
-
186
- useEffect(() => {
187
- if (!projectId) return;
188
- const saved = localStorage.getItem(`flow_chats_${projectId}`);
189
- let loadedThreads = [];
190
- if (saved) {
191
- try {
192
- loadedThreads = JSON.parse(saved);
193
- } catch (e) {
194
- console.error(e);
195
- }
196
- }
197
- if (!loadedThreads || loadedThreads.length === 0) {
198
- loadedThreads = [defaultThread];
199
- }
200
- setChatThreads(loadedThreads);
201
-
202
- const savedActive = localStorage.getItem(`flow_chats_active_${projectId}`);
203
- if (savedActive && loadedThreads.some(t => t.id === savedActive)) {
204
- setActiveThreadId(savedActive);
205
- } else {
206
- setActiveThreadId(loadedThreads[0].id);
207
- }
208
- }, [projectId]);
209
-
210
- useEffect(() => {
211
- if (!projectId || chatThreads.length === 0) return;
212
- localStorage.setItem(`flow_chats_${projectId}`, JSON.stringify(chatThreads));
213
- }, [chatThreads, projectId]);
214
-
215
- useEffect(() => {
216
- if (!projectId) return;
217
- localStorage.setItem(`flow_chats_active_${projectId}`, activeThreadId);
218
- }, [activeThreadId, projectId]);
219
-
220
- const activeThread = chatThreads.find(t => t.id === activeThreadId) || chatThreads[0] || defaultThread;
221
- const chatMessages = activeThread.messages || [];
222
-
223
- const setChatMessages = (updater) => {
224
- setChatThreads(prevThreads => {
225
- return prevThreads.map(thread => {
226
- if (thread.id === activeThreadId) {
227
- const newMessages = typeof updater === 'function' ? updater(thread.messages) : updater;
228
- return { ...thread, messages: newMessages };
229
- }
230
- return thread;
231
- });
232
- });
233
- };
234
-
235
- const createNewThread = (title = '') => {
236
- const newId = crypto.randomUUID();
237
- const newThread = {
238
- id: newId,
239
- title: title.trim() || `Чат ${chatThreads.length + 1}`,
240
- messages: [
241
- {
242
- id: 'welcome',
243
- sender: 'agent',
244
- text: 'Привіт! Я твій ШІ-стратег. Опиши, що ти хочеш додати на доску або як хочеш змінити поточний план. Я можу будувати підзадачі, умови та звички, позначаючи всі зв\'язки.'
245
- }
246
- ],
247
- createdAt: new Date().toISOString()
248
- };
249
- setChatThreads(prev => [...prev, newThread]);
250
- setActiveThreadId(newId);
251
- return newId;
252
- };
253
-
254
- const deleteThread = (threadId) => {
255
- const remaining = chatThreads.filter(t => t.id !== threadId);
256
- if (remaining.length === 0) {
257
- setChatThreads([defaultThread]);
258
- setActiveThreadId('default');
259
- return;
260
- }
261
- setChatThreads(remaining);
262
- if (activeThreadId === threadId) {
263
- setActiveThreadId(remaining[0].id);
264
- }
265
- };
266
-
267
- const renameThread = (threadId, newTitle) => {
268
- if (!newTitle.trim()) return;
269
- setChatThreads(prev => prev.map(t => t.id === threadId ? { ...t, title: newTitle.trim() } : t));
270
- };
271
-
272
  const [showPaywall, setShowPaywall] = useState(false);
273
  const [isSaving, setIsSaving] = useState(false);
274
  const [isManualSaving, setIsManualSaving] = useState(false);
@@ -877,6 +759,9 @@ export const useCanvasLogic = (projectId, user) => {
877
  type: n.type || 'sketch',
878
  position: { x: n.posX, y: n.posY },
879
  draggable: !isPinned,
 
 
 
880
  width: width,
881
  height: height,
882
  style: (width && height) ? { width, height } : undefined,
@@ -1407,6 +1292,10 @@ export const useCanvasLogic = (projectId, user) => {
1407
  );
1408
 
1409
  const addNewNodeAt = useCallback((x, y, type = 'sketch', initialData = {}) => {
 
 
 
 
1410
  takeHistorySnapshot();
1411
 
1412
  let position;
@@ -1481,7 +1370,7 @@ export const useCanvasLogic = (projectId, user) => {
1481
  });
1482
  }
1483
  return id;
1484
- }, [setNodes, screenToFlowPosition, updateNodeDataCallback, takeHistorySnapshot]);
1485
 
1486
  const handleCopy = useCallback(() => {
1487
  const selectedNodes = nodes.filter((n) => n.selected);
@@ -1657,169 +1546,197 @@ export const useCanvasLogic = (projectId, user) => {
1657
  }));
1658
  }, [setNodes, setEdges, screenToFlowPosition, updateNodeDataCallback, projectData, takeHistorySnapshot]);
1659
 
1660
- const submitAICanvasPrompt = async (promptText) => {
1661
- if (!promptText || !projectId) return false;
 
 
 
 
 
 
 
 
 
 
1662
 
1663
- const historyPayload = chatMessages
1664
- .filter(msg => msg.id !== 'welcome' && !msg.isError)
1665
- .map(msg => ({
1666
- role: msg.sender === 'user' ? 'user' : 'model',
1667
- text: msg.text
 
 
 
 
1668
  }));
1669
 
1670
- // Append user message
1671
- const userMsg = {
1672
- id: crypto.randomUUID(),
1673
- sender: 'user',
1674
- text: promptText,
1675
- timestamp: new Date()
 
 
1676
  };
1677
- setChatMessages(prev => [...prev, userMsg]);
 
1678
 
1679
- setAiLoading(true);
1680
- try {
1681
- const res = await axios.post(`${API_URL}/AI/assist`, {
1682
- graphId: projectId,
1683
- userPrompt: promptText,
1684
- history: historyPayload
1685
- });
1686
-
1687
- const { newNodes, newEdges, explanation } = res.data;
1688
-
1689
- if (newNodes && newNodes.length > 0) {
1690
- const mappedNewNodes = newNodes.map((n) => {
1691
- let options = [];
1692
- let selectedOptions = [];
1693
- let multiSelect = false;
1694
- let resetRule = { type: 'daily', time: '00:00' };
1695
- let lastResetTime = undefined;
1696
- let createdAt = undefined;
1697
- let description = n.description || '';
1698
- let decision = n.decision || (n.type === 'condition' ? 'True' : 'bottom');
1699
-
1700
- if (n.type === 'condition') {
1701
- if (n.decision && n.decision.startsWith('{')) {
1702
- try {
1703
- const parsed = JSON.parse(n.decision);
1704
- options = parsed.options || [];
1705
- selectedOptions = parsed.selected || [];
1706
- multiSelect = !!parsed.multiSelect;
1707
- decision = undefined;
1708
- } catch (e) {
1709
- console.error('Failed to parse dynamic options JSON in AI response', e);
1710
- options = [
1711
- { id: 'opt-yes', label: 'Так' },
1712
- { id: 'opt-no', label: 'Ні' }
1713
- ];
1714
- selectedOptions = n.decision === 'True' ? ['opt-yes'] : (n.decision === 'False' ? ['opt-no'] : []);
1715
- }
1716
- } else {
1717
- options = [
1718
- { id: 'opt-yes', label: 'Так' },
1719
- { id: 'opt-no', label: 'Ні' }
1720
- ];
1721
- selectedOptions = n.decision === 'True' ? ['opt-yes'] : (n.decision === 'False' ? ['opt-no'] : []);
1722
- }
1723
- } else if (n.type === 'habit') {
1724
- resetRule = { type: 'daily', time: '00:00' };
1725
- createdAt = new Date().toISOString();
1726
- lastResetTime = new Date().toISOString();
1727
- }
1728
 
1729
- return {
1730
- id: n.id,
1731
- type: n.type || 'sketch',
1732
- position: { x: n.posX, y: n.posY },
1733
- data: {
1734
- label: n.label,
1735
- status: n.state === 1 ? 'Done' : 'Todo',
1736
- tags: [],
1737
- decision,
1738
- options,
1739
- selectedOptions,
1740
- multiSelect,
1741
- resetRule,
1742
- lastResetTime,
1743
- createdAt,
1744
- description: description || '',
1745
- updateNodeData: updateNodeDataCallback
1746
- }
1747
- };
1748
- });
 
 
 
 
 
 
 
 
1749
 
1750
- const mappedNewEdges = newEdges.map((e) => {
1751
- const sourceNode = [...nodes, ...mappedNewNodes].find(nodeItem => nodeItem.id.toLowerCase() === e.fromNodeId.toLowerCase());
1752
- const targetNode = [...nodes, ...mappedNewNodes].find(nodeItem => nodeItem.id.toLowerCase() === e.toNodeId.toLowerCase());
1753
-
1754
- let sourceHandle = getConditionSourceHandle(sourceNode, e.condition);
1755
- let targetHandle = undefined;
1756
-
1757
- if (sourceNode && sourceNode.type === 'sketch') {
1758
- if (
1759
- e.condition === 'SubgoalLeft' ||
1760
- e.condition === 'subgoals-source-left' ||
1761
- e.condition === 'SubgoalRight' ||
1762
- e.condition === 'subgoals-source-right'
1763
- ) {
1764
- sourceHandle = (e.condition === 'SubgoalLeft' || e.condition === 'subgoals-source-left')
1765
- ? 'subgoals-source-left'
1766
- : 'subgoals-source-right';
1767
- targetHandle = 'main-target';
1768
- } else {
1769
- sourceHandle = 'main-source';
1770
- targetHandle = (targetNode && ['sketch', 'habit', 'condition'].includes(targetNode.type))
1771
- ? 'main-target'
1772
- : null;
1773
- }
1774
- } else if (sourceNode && (sourceNode.type === 'habit' || sourceNode.type === 'condition')) {
1775
- targetHandle = (targetNode && ['sketch', 'habit', 'condition'].includes(targetNode.type))
1776
- ? 'main-target'
1777
- : null;
1778
- }
1779
 
1780
- return {
1781
- id: e.id,
1782
- source: e.fromNodeId,
1783
- target: e.toNodeId,
1784
- sourceHandle: sourceHandle,
1785
- targetHandle: targetHandle,
1786
- animated: false
1787
- };
1788
- });
1789
 
1790
- setNodes((nds) => nds.concat(mappedNewNodes));
1791
- setEdges((eds) => eds.concat(mappedNewEdges));
1792
- }
 
 
 
 
 
 
 
 
 
1793
 
1794
- // Append agent message
1795
- const agentMsg = {
1796
- id: crypto.randomUUID(),
1797
- sender: 'agent',
1798
- text: explanation || 'Я оновив твою доску та додав необхідні елементи.',
1799
- timestamp: new Date()
1800
- };
1801
- setChatMessages(prev => [...prev, agentMsg]);
1802
- return true;
1803
- } catch (err) {
1804
- console.error('AI assistant error:', err);
1805
- const errorMsg = {
1806
- id: crypto.randomUUID(),
1807
- sender: 'agent',
1808
- text: 'Помилка: ' + (err.response?.data?.message || 'Не вдалося зв\'язатися з ШІ-стратегом.'),
1809
- isError: true,
1810
- timestamp: new Date()
 
 
 
 
 
 
 
 
 
 
 
1811
  };
1812
- setChatMessages(prev => [...prev, errorMsg]);
1813
- return false;
1814
- } finally {
1815
- setAiLoading(false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1816
  }
1817
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1818
 
1819
- const handleAIRequest = () => {
1820
- // Open access for regular users for now
1821
- setIsAIActive(true);
1822
- };
1823
 
1824
  const handleMouseDown = (event) => {
1825
  if (event.button !== 0 || !event.target.classList.contains('react-flow__pane')) return;
@@ -1931,6 +1848,9 @@ export const useCanvasLogic = (projectId, user) => {
1931
  }, [nodes, resetDownstreamNodes, setNodes, triggerNotification, t]);
1932
 
1933
  return {
 
 
 
1934
  setNodes,
1935
  nodes,
1936
  edges,
@@ -1960,15 +1880,8 @@ export const useCanvasLogic = (projectId, user) => {
1960
  }
1961
  },
1962
  updateNodeData: updateNodeDataCallback,
1963
- isAIActive,
1964
- setIsAIActive,
1965
- aiLoading,
1966
- submitAICanvasPrompt,
1967
- chatMessages,
1968
- setChatMessages,
1969
  showPaywall,
1970
  setShowPaywall,
1971
- handleAIRequest,
1972
  addNewNodeAt,
1973
  handleCopy,
1974
  handleCut,
@@ -1997,12 +1910,6 @@ export const useCanvasLogic = (projectId, user) => {
1997
  canRedo: futureRef.current.length > 0,
1998
  takeHistorySnapshot,
1999
  updateProjectMetadata,
2000
- chatThreads,
2001
- activeThreadId,
2002
- setActiveThreadId,
2003
- createNewThread,
2004
- deleteThread,
2005
- renameThread,
2006
  isLoading
2007
  };
2008
  };
 
13
  useReactFlow,
14
  } from '@xyflow/react';
15
  import { useSignalR } from './useSignalR';
16
+ import { computeAutoLayout, layoutFresh, getNodeSize, easeInOutCubic } from '../layout';
17
+ import { FREE_LIMITS, isPlus } from '../../../config/plans';
18
 
19
  export const getConditionSourceHandle = (sourceNode, condition) => {
20
  if (!sourceNode) return null;
 
151
 
152
  const [cursors, setCursors] = useState({});
153
  const [clipboardVersion, setClipboardVersion] = useState(0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  const [showPaywall, setShowPaywall] = useState(false);
155
  const [isSaving, setIsSaving] = useState(false);
156
  const [isManualSaving, setIsManualSaving] = useState(false);
 
759
  type: n.type || 'sketch',
760
  position: { x: n.posX, y: n.posY },
761
  draggable: !isPinned,
762
+ // Habits are hidden on the canvas until they get their own space (ROADMAP.md).
763
+ // The nodes stay in state so saving the board does not delete them.
764
+ hidden: n.type === 'habit',
765
  width: width,
766
  height: height,
767
  style: (width && height) ? { width, height } : undefined,
 
1292
  );
1293
 
1294
  const addNewNodeAt = useCallback((x, y, type = 'sketch', initialData = {}) => {
1295
+ if (!isPlus(user) && nodesRef.current.length >= FREE_LIMITS.nodesPerBoard) {
1296
+ setShowPaywall(true);
1297
+ return null;
1298
+ }
1299
  takeHistorySnapshot();
1300
 
1301
  let position;
 
1370
  });
1371
  }
1372
  return id;
1373
+ }, [setNodes, screenToFlowPosition, updateNodeDataCallback, takeHistorySnapshot, user]);
1374
 
1375
  const handleCopy = useCallback(() => {
1376
  const selectedNodes = nodes.filter((n) => n.selected);
 
1546
  }));
1547
  }, [setNodes, setEdges, screenToFlowPosition, updateNodeDataCallback, projectData, takeHistorySnapshot]);
1548
 
1549
+ // --- Auto-layout ---
1550
+ const layoutAnimationRef = useRef(null);
1551
+
1552
+ const animateToPositions = useCallback((targets, duration = 550) => {
1553
+ const ids = Object.keys(targets);
1554
+ if (ids.length === 0) return;
1555
+
1556
+ if (layoutAnimationRef.current) cancelAnimationFrame(layoutAnimationRef.current);
1557
+ const starts = {};
1558
+ nodesRef.current.forEach((n) => {
1559
+ if (targets[n.id]) starts[n.id] = { ...n.position };
1560
+ });
1561
 
1562
+ const startTime = performance.now();
1563
+ const step = (now) => {
1564
+ const t = Math.min(1, (now - startTime) / duration);
1565
+ const k = easeInOutCubic(t);
1566
+ setNodes((nds) => nds.map((n) => {
1567
+ const from = starts[n.id];
1568
+ const to = targets[n.id];
1569
+ if (!from || !to) return n;
1570
+ return { ...n, position: { x: from.x + (to.x - from.x) * k, y: from.y + (to.y - from.y) * k } };
1571
  }));
1572
 
1573
+ if (t < 1) {
1574
+ layoutAnimationRef.current = requestAnimationFrame(step);
1575
+ } else {
1576
+ layoutAnimationRef.current = null;
1577
+ if (broadcastMessageRef.current) {
1578
+ ids.forEach((id) => broadcastMessageRef.current({ type: 'NODE_MOVE', payload: { id, position: targets[id] } }));
1579
+ }
1580
+ }
1581
  };
1582
+ layoutAnimationRef.current = requestAnimationFrame(step);
1583
+ }, [setNodes]);
1584
 
1585
+ useEffect(() => () => {
1586
+ if (layoutAnimationRef.current) cancelAnimationFrame(layoutAnimationRef.current);
1587
+ }, []);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1588
 
1589
+ // Arranges the selection (2+ nodes) or the whole board. Returns the number of moved nodes.
1590
+ const autoLayout = useCallback(() => {
1591
+ if (projectData?.permission === 'Read') return 0;
1592
+ const current = nodesRef.current;
1593
+ const selectedIds = current.filter((n) => n.selected).map((n) => n.id);
1594
+ const targets = computeAutoLayout(current, edgesRef.current, {
1595
+ onlyIds: selectedIds.length >= 2 ? selectedIds : null
1596
+ });
1597
+ const moved = Object.keys(targets).length;
1598
+ if (moved === 0) return 0;
1599
+ takeHistorySnapshot();
1600
+ animateToPositions(targets);
1601
+ return moved;
1602
+ }, [projectData, takeHistorySnapshot, animateToPositions]);
1603
+
1604
+ // --- Templates ---
1605
+ const buildTemplateEdge = (edge, typeOf) => {
1606
+ const isStickerType = (type) => ['comment', 'image', 'text', 'path'].includes(type);
1607
+ const isSticker = isStickerType(typeOf(edge.source)) || isStickerType(typeOf(edge.target));
1608
+ return {
1609
+ ...edge,
1610
+ sourceHandle: isSticker ? null : (edge.sourceHandle ?? 'main-source'),
1611
+ targetHandle: isSticker ? null : (edge.targetHandle ?? 'main-target'),
1612
+ type: isSticker ? 'sticker' : undefined,
1613
+ animated: !isSticker,
1614
+ markerEnd: isSticker ? null : { type: MarkerType.ArrowClosed, color: '#31363F' }
1615
+ };
1616
+ };
1617
 
1618
+ /**
1619
+ * Inserts template content ({ nodes, edges } in React Flow format) into the board.
1620
+ * Nodes without positions are auto-laid-out. The block is centered on `screenPoint`
1621
+ * (defaults to the middle of the window). Returns the new node ids, or null when blocked.
1622
+ */
1623
+ const insertTemplate = useCallback((content, { screenPoint } = {}) => {
1624
+ if (projectData?.permission === 'Read') return null;
1625
+ const tplNodes = (content?.nodes || []).filter((n) => n && n.type !== 'habit');
1626
+ const tplEdges = content?.edges || [];
1627
+ if (tplNodes.length === 0) return null;
1628
+
1629
+ if (!isPlus(user) && nodesRef.current.length + tplNodes.length > FREE_LIMITS.nodesPerBoard) {
1630
+ setShowPaywall(true);
1631
+ return null;
1632
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1633
 
1634
+ const needsLayout = tplNodes.some((n) => !n.position);
1635
+ const positioned = needsLayout ? layoutFresh(tplNodes, tplEdges) : tplNodes;
 
 
 
 
 
 
 
1636
 
1637
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
1638
+ positioned.forEach((n) => {
1639
+ const { width, height } = getNodeSize(n);
1640
+ minX = Math.min(minX, n.position.x);
1641
+ minY = Math.min(minY, n.position.y);
1642
+ maxX = Math.max(maxX, n.position.x + width);
1643
+ maxY = Math.max(maxY, n.position.y + height);
1644
+ });
1645
+ const point = screenPoint || { x: window.innerWidth / 2, y: window.innerHeight / 2 };
1646
+ const center = screenToFlowPosition(point);
1647
+ const dx = center.x - (minX + maxX) / 2;
1648
+ const dy = center.y - (minY + maxY) / 2;
1649
 
1650
+ takeHistorySnapshot();
1651
+
1652
+ const idMap = {};
1653
+ const newNodes = positioned.map((n) => {
1654
+ const id = crypto.randomUUID();
1655
+ idMap[n.id] = id;
1656
+ return {
1657
+ id,
1658
+ type: n.type || 'sketch',
1659
+ position: { x: Math.round(n.position.x + dx), y: Math.round(n.position.y + dy) },
1660
+ width: n.width,
1661
+ height: n.height,
1662
+ style: n.width && n.height ? { width: n.width, height: n.height } : undefined,
1663
+ selected: true,
1664
+ data: {
1665
+ label: '',
1666
+ status: 'Todo',
1667
+ description: '',
1668
+ tags: [],
1669
+ assignees: [],
1670
+ ...(n.type === 'condition' ? {
1671
+ options: [{ id: 'opt-yes', label: 'Так' }, { id: 'opt-no', label: 'Ні' }],
1672
+ selectedOptions: [],
1673
+ multiSelect: false
1674
+ } : { decision: 'bottom' }),
1675
+ ...n.data,
1676
+ updateNodeData: updateNodeDataCallback
1677
+ }
1678
  };
1679
+ });
1680
+ const typeOfNew = (id) => newNodes.find((n) => n.id === id)?.type;
1681
+ const newEdges = tplEdges
1682
+ .filter((e) => idMap[e.source] && idMap[e.target])
1683
+ .map((e) => buildTemplateEdge({
1684
+ id: `edge-${crypto.randomUUID()}`,
1685
+ source: idMap[e.source],
1686
+ target: idMap[e.target],
1687
+ sourceHandle: e.sourceHandle,
1688
+ targetHandle: e.targetHandle
1689
+ }, typeOfNew));
1690
+
1691
+ setNodes((nds) => nds.map((n) => (n.selected ? { ...n, selected: false } : n)).concat(newNodes));
1692
+ setEdges((eds) => eds.concat(newEdges));
1693
+
1694
+ if (broadcastMessageRef.current) {
1695
+ newNodes.forEach((n) => broadcastMessageRef.current({ type: 'NODE_ADD', payload: n }));
1696
+ newEdges.forEach((e) => broadcastMessageRef.current({ type: 'EDGE_ADD', payload: e }));
1697
  }
1698
+ return newNodes.map((n) => n.id);
1699
+ }, [projectData, user, screenToFlowPosition, takeHistorySnapshot, setNodes, setEdges, updateNodeDataCallback]);
1700
+
1701
+ /**
1702
+ * Serializes the selection (or the whole board) into template content.
1703
+ * Progress, statuses, assignees and heavy images are stripped so the template is a clean starting point.
1704
+ */
1705
+ const serializeTemplate = useCallback((selectedOnly = false) => {
1706
+ const source = nodesRef.current.filter((n) => !n.hidden && n.type !== 'habit' && n.type !== 'path');
1707
+ const picked = selectedOnly ? source.filter((n) => n.selected) : source;
1708
+ const usable = picked.filter((n) => n.type !== 'image' || (n.data?.url && n.data.url.length < 400000));
1709
+ const ids = new Set(usable.map((n) => n.id));
1710
+
1711
+ const nodesOut = usable.map((n) => {
1712
+ const d = n.data || {};
1713
+ const data = {
1714
+ label: d.label || '',
1715
+ description: d.description || '',
1716
+ tags: d.tags || [],
1717
+ color: d.color
1718
+ };
1719
+ if (n.type === 'condition') {
1720
+ data.options = d.options || [];
1721
+ data.multiSelect = !!d.multiSelect;
1722
+ } else if (n.type === 'sketch') {
1723
+ data.decision = d.decision || 'bottom';
1724
+ data.showProgress = !!d.showProgress;
1725
+ } else if (n.type === 'text') {
1726
+ data.fontSize = d.fontSize;
1727
+ data.textAlign = d.textAlign;
1728
+ } else if (n.type === 'image') {
1729
+ data.url = d.url;
1730
+ }
1731
+ const size = n.type === 'comment' || n.type === 'image' ? getNodeSize(n) : {};
1732
+ return { id: n.id, type: n.type, position: { x: Math.round(n.position.x), y: Math.round(n.position.y) }, ...size, data };
1733
+ });
1734
+ const edgesOut = edgesRef.current
1735
+ .filter((e) => ids.has(e.source) && ids.has(e.target))
1736
+ .map((e) => ({ id: e.id, source: e.source, target: e.target, sourceHandle: e.sourceHandle, targetHandle: e.targetHandle }));
1737
 
1738
+ return { version: 2, nodes: nodesOut, edges: edgesOut };
1739
+ }, []);
 
 
1740
 
1741
  const handleMouseDown = (event) => {
1742
  if (event.button !== 0 || !event.target.classList.contains('react-flow__pane')) return;
 
1848
  }, [nodes, resetDownstreamNodes, setNodes, triggerNotification, t]);
1849
 
1850
  return {
1851
+ autoLayout,
1852
+ insertTemplate,
1853
+ serializeTemplate,
1854
  setNodes,
1855
  nodes,
1856
  edges,
 
1880
  }
1881
  },
1882
  updateNodeData: updateNodeDataCallback,
 
 
 
 
 
 
1883
  showPaywall,
1884
  setShowPaywall,
 
1885
  addNewNodeAt,
1886
  handleCopy,
1887
  handleCut,
 
1910
  canRedo: futureRef.current.length > 0,
1911
  takeHistorySnapshot,
1912
  updateProjectMetadata,
 
 
 
 
 
 
1913
  isLoading
1914
  };
1915
  };
src/features/canvas/layout.js ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dagre from '@dagrejs/dagre';
2
+
3
+ // Node types that form the plan itself; they are arranged as a layered graph.
4
+ const FLOW_TYPES = new Set(['sketch', 'condition']);
5
+ // Annotation-like nodes; they follow the flow node they are attached to.
6
+ const STICKER_TYPES = new Set(['comment', 'image', 'text']);
7
+
8
+ const DEFAULT_SIZES = {
9
+ sketch: { width: 230, height: 115 },
10
+ condition: { width: 170, height: 150 },
11
+ comment: { width: 200, height: 150 },
12
+ image: { width: 300, height: 200 },
13
+ text: { width: 200, height: 60 },
14
+ };
15
+
16
+ const toNumber = (value) => {
17
+ if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
18
+ if (typeof value === 'string') {
19
+ const parsed = parseFloat(value);
20
+ return Number.isFinite(parsed) ? parsed : undefined;
21
+ }
22
+ return undefined;
23
+ };
24
+
25
+ export const getNodeSize = (node) => {
26
+ const fallback = DEFAULT_SIZES[node.type] || DEFAULT_SIZES.sketch;
27
+ return {
28
+ width: toNumber(node.measured?.width) ?? toNumber(node.width) ?? toNumber(node.style?.width) ?? fallback.width,
29
+ height: toNumber(node.measured?.height) ?? toNumber(node.height) ?? toNumber(node.style?.height) ?? fallback.height,
30
+ };
31
+ };
32
+
33
+ const boundsOf = (nodes, positionOf) => {
34
+ let minX = Infinity;
35
+ let minY = Infinity;
36
+ nodes.forEach((n) => {
37
+ const p = positionOf(n);
38
+ minX = Math.min(minX, p.x);
39
+ minY = Math.min(minY, p.y);
40
+ });
41
+ return { x: minX, y: minY };
42
+ };
43
+
44
+ /**
45
+ * Computes tidy positions for the plan nodes.
46
+ *
47
+ * - Goals and conditions are laid out top-to-bottom with dagre, following the edges.
48
+ * - Stickers, texts and images connected to a moved node keep their offset to it.
49
+ * - Pinned, hidden and free-floating annotation nodes are left where they are.
50
+ * - When `onlyIds` is given (e.g. the current selection), only those nodes are arranged.
51
+ * - The arranged block keeps its top-left corner, so the board does not jump.
52
+ *
53
+ * Returns a map { [nodeId]: { x, y } } with the new positions of the nodes that move.
54
+ */
55
+ export const computeAutoLayout = (nodes, edges, { direction = 'TB', onlyIds = null } = {}) => {
56
+ const scope = onlyIds ? new Set(onlyIds) : null;
57
+ const movable = nodes.filter(
58
+ (n) => FLOW_TYPES.has(n.type) && !n.hidden && !n.data?.isPinned && (!scope || scope.has(n.id))
59
+ );
60
+ if (movable.length < 2) return {};
61
+
62
+ const movableIds = new Set(movable.map((n) => n.id));
63
+ const g = new dagre.graphlib.Graph({ multigraph: true });
64
+ g.setGraph({ rankdir: direction, nodesep: 70, ranksep: 110, edgesep: 30, marginx: 0, marginy: 0 });
65
+ g.setDefaultEdgeLabel(() => ({}));
66
+
67
+ movable.forEach((n) => g.setNode(n.id, getNodeSize(n)));
68
+ edges.forEach((e) => {
69
+ if (movableIds.has(e.source) && movableIds.has(e.target) && e.source !== e.target) {
70
+ g.setEdge(e.source, e.target, {}, e.id);
71
+ }
72
+ });
73
+
74
+ dagre.layout(g);
75
+
76
+ // dagre returns centers; React Flow positions are top-left corners
77
+ const laidOut = {};
78
+ movable.forEach((n) => {
79
+ const { x, y } = g.node(n.id);
80
+ const { width, height } = getNodeSize(n);
81
+ laidOut[n.id] = { x: x - width / 2, y: y - height / 2 };
82
+ });
83
+
84
+ // Keep the block anchored where it was
85
+ const before = boundsOf(movable, (n) => n.position);
86
+ const after = boundsOf(movable, (n) => laidOut[n.id]);
87
+ const dx = before.x - after.x;
88
+ const dy = before.y - after.y;
89
+
90
+ const result = {};
91
+ movable.forEach((n) => {
92
+ result[n.id] = { x: Math.round(laidOut[n.id].x + dx), y: Math.round(laidOut[n.id].y + dy) };
93
+ });
94
+
95
+ // Attached annotations move together with their anchor node
96
+ const nodeById = new Map(nodes.map((n) => [n.id, n]));
97
+ nodes
98
+ .filter((n) => STICKER_TYPES.has(n.type) && !n.hidden && !n.data?.isPinned && !result[n.id])
99
+ .forEach((sticker) => {
100
+ const link = edges.find(
101
+ (e) =>
102
+ (e.source === sticker.id && result[e.target]) ||
103
+ (e.target === sticker.id && result[e.source])
104
+ );
105
+ if (!link) return;
106
+ const anchorId = link.source === sticker.id ? link.target : link.source;
107
+ const anchor = nodeById.get(anchorId);
108
+ result[sticker.id] = {
109
+ x: Math.round(sticker.position.x + (result[anchorId].x - anchor.position.x)),
110
+ y: Math.round(sticker.position.y + (result[anchorId].y - anchor.position.y)),
111
+ };
112
+ });
113
+
114
+ return result;
115
+ };
116
+
117
+ /**
118
+ * Lays out a node list that has no meaningful positions yet (e.g. a built-in template).
119
+ * Mutates nothing; returns a new node array.
120
+ */
121
+ export const layoutFresh = (nodes, edges, options) => {
122
+ const seeded = nodes.map((n, i) => ({ ...n, position: n.position || { x: 0, y: i } }));
123
+ const flowOnly = seeded.filter((n) => FLOW_TYPES.has(n.type));
124
+ const positions = computeAutoLayout(flowOnly, edges, options);
125
+ const placed = seeded.map((n) => (positions[n.id] ? { ...n, position: positions[n.id] } : n));
126
+ const byId = new Map(placed.map((n) => [n.id, n]));
127
+
128
+ // Annotations without a position go to the right of the node they are linked to
129
+ let looseY = 0;
130
+ return placed.map((n) => {
131
+ if (FLOW_TYPES.has(n.type) || n.position.x !== 0 || nodes.find((o) => o.id === n.id)?.position) return n;
132
+ const link = edges.find((e) => (e.source === n.id && positions[e.target]) || (e.target === n.id && positions[e.source]));
133
+ if (link) {
134
+ const anchor = byId.get(link.source === n.id ? link.target : link.source);
135
+ return { ...n, position: { x: anchor.position.x + getNodeSize(anchor).width + 80, y: anchor.position.y } };
136
+ }
137
+ const position = { x: -getNodeSize(n).width - 80, y: looseY };
138
+ looseY += getNodeSize(n).height + 40;
139
+ return { ...n, position };
140
+ });
141
+ };
142
+
143
+ export const easeInOutCubic = (t) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);
src/features/dashboard/hooks/useDashboardLogic.js CHANGED
@@ -1,13 +1,14 @@
1
  import { useState, useEffect } from 'react';
2
  import axios from 'axios';
3
  import { useNavigate } from 'react-router-dom';
 
4
 
5
  export const useDashboardLogic = (user) => {
6
  const navigate = useNavigate();
7
  const [projects, setProjects] = useState([]);
8
  const [allProjects, setAllProjects] = useState([]);
9
  const [loading, setLoading] = useState(true);
10
- const [aiGenerating, setAiGenerating] = useState(false);
11
  const [searchTerm, setSearchTerm] = useState('');
12
  const API_URL = import.meta.env.VITE_API_URL;
13
 
@@ -33,55 +34,31 @@ export const useDashboardLogic = (user) => {
33
  }
34
  };
35
 
36
- const handleCreateProject = async (title, templateKey = null) => {
 
37
  if (!title || !user) return;
38
-
39
  try {
40
  const res = await axios.post(`${API_URL}/graphs`, {
41
- userId: user.id,
42
  title,
43
- description: 'New strategy path...',
44
- templateKey
45
  });
 
 
 
46
  navigate(`/canvas/${res.data.id}`);
 
47
  } catch (err) {
48
  const msg = err.response?.data?.message;
49
  if (err.response?.status === 400 && msg) {
50
  alert(msg);
51
- if (msg.toLowerCase().includes('canvas') || msg.toLowerCase().includes('limit')) {
52
- navigate('/subscription');
53
- }
54
  } else {
55
  console.error('Error creating project', err);
56
  }
57
- }
58
- };
59
-
60
- const handleCreateProjectWithAI = async (goal) => {
61
- if (!goal || !user) return;
62
- setAiGenerating(true);
63
- try {
64
- const res = await axios.post(`${API_URL}/AI/generate-goal`, {
65
- userId: user.id,
66
- goal
67
- });
68
- navigate(`/canvas/${res.data.id}`);
69
- return res.data;
70
- } catch (err) {
71
- const msg = err.response?.data?.message;
72
- if (msg) {
73
- alert(msg);
74
- if (err.response?.status === 403 && msg.toLowerCase().includes('daily')) {
75
- navigate('/subscription');
76
- } else if ((err.response?.status === 400) && (msg.toLowerCase().includes('canvas') || msg.toLowerCase().includes('limit'))) {
77
- navigate('/subscription');
78
- }
79
- } else {
80
- console.error('Error creating project with AI', err);
81
- }
82
- throw err;
83
  } finally {
84
- setAiGenerating(false);
85
  }
86
  };
87
 
@@ -105,11 +82,10 @@ export const useDashboardLogic = (user) => {
105
  return {
106
  projects: filteredProjects,
107
  loading,
108
- aiGenerating,
109
  searchTerm,
110
  setSearchTerm,
111
  handleCreateProject,
112
- handleCreateProjectWithAI,
113
  handleDeleteProject,
114
  ownedCount
115
  };
 
1
  import { useState, useEffect } from 'react';
2
  import axios from 'axios';
3
  import { useNavigate } from 'react-router-dom';
4
+ import { setPendingTemplate } from '../../templates/templatesApi';
5
 
6
  export const useDashboardLogic = (user) => {
7
  const navigate = useNavigate();
8
  const [projects, setProjects] = useState([]);
9
  const [allProjects, setAllProjects] = useState([]);
10
  const [loading, setLoading] = useState(true);
11
+ const [creating, setCreating] = useState(false);
12
  const [searchTerm, setSearchTerm] = useState('');
13
  const API_URL = import.meta.env.VITE_API_URL;
14
 
 
34
  }
35
  };
36
 
37
+ // Creates a board; when a template is given, the canvas inserts it right after opening
38
+ const handleCreateProject = async (title, template = null) => {
39
  if (!title || !user) return;
40
+ setCreating(true);
41
  try {
42
  const res = await axios.post(`${API_URL}/graphs`, {
 
43
  title,
44
+ description: template ? template.title : ''
 
45
  });
46
+ if (template?.content?.nodes?.length) {
47
+ setPendingTemplate(res.data.id, template.content);
48
+ }
49
  navigate(`/canvas/${res.data.id}`);
50
+ return true;
51
  } catch (err) {
52
  const msg = err.response?.data?.message;
53
  if (err.response?.status === 400 && msg) {
54
  alert(msg);
55
+ if (/plan|limit/i.test(msg)) navigate('/subscription');
 
 
56
  } else {
57
  console.error('Error creating project', err);
58
  }
59
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  } finally {
61
+ setCreating(false);
62
  }
63
  };
64
 
 
82
  return {
83
  projects: filteredProjects,
84
  loading,
85
+ creating,
86
  searchTerm,
87
  setSearchTerm,
88
  handleCreateProject,
 
89
  handleDeleteProject,
90
  ownedCount
91
  };
src/features/landing/HeroBoardDemo.jsx ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useEffect, useState } from 'react';
2
+ import { motion, useReducedMotion } from 'framer-motion';
3
+ import { Check, Network, MousePointer2, ArrowRight, GitFork } from 'lucide-react';
4
+
5
+ // A scripted, looping mini-board that shows real TaskFlow behaviour:
6
+ // messy nodes -> auto-layout -> steps ticked off -> a fork picks a branch -> next step highlighted.
7
+ // Coordinates are in a 100 x 70 box (node centers).
8
+
9
+ const SIZE = {
10
+ card: { w: 23, h: 8.5 },
11
+ condition: { w: 22, h: 9.5 },
12
+ sticker: { w: 18, h: 8 },
13
+ };
14
+
15
+ const NODES = [
16
+ { id: 'goal', kind: 'card', color: '#dbeafe', messy: [32, 40], tidy: [50, 9] },
17
+ { id: 'design', kind: 'card', messy: [76, 13], tidy: [27, 27] },
18
+ { id: 'copy', kind: 'card', messy: [18, 15], tidy: [73, 27] },
19
+ { id: 'check', kind: 'condition', messy: [63, 56], tidy: [50, 45] },
20
+ { id: 'publish', kind: 'card', color: '#dcfce7', messy: [15, 60], tidy: [28, 62] },
21
+ { id: 'fix', kind: 'card', color: '#fce7f3', messy: [85, 41], tidy: [72, 62] },
22
+ { id: 'sticker', kind: 'sticker', messy: [50, 23], tidy: [86, 9] },
23
+ ];
24
+
25
+ const EDGES = [
26
+ { id: 'e1', from: 'goal', to: 'design' },
27
+ { id: 'e2', from: 'goal', to: 'copy' },
28
+ { id: 'e3', from: 'design', to: 'check' },
29
+ { id: 'e4', from: 'copy', to: 'check' },
30
+ { id: 'e5', from: 'check', to: 'publish', branch: 'yes' },
31
+ { id: 'e6', from: 'check', to: 'fix', branch: 'no' },
32
+ { id: 'e7', from: 'sticker', to: 'goal', sticker: true },
33
+ ];
34
+
35
+ // phase: 0 messy, 1 cursor to button, 2 layout, 3 steps done, 4 branch chosen
36
+ const TIMINGS = [1900, 1300, 1500, 1900, 2800];
37
+
38
+ const nodeCenter = (node, phase) => (phase >= 2 ? node.tidy : node.messy);
39
+
40
+ const edgePath = (from, to, phase, sticker) => {
41
+ const [fx, fy] = nodeCenter(from, phase);
42
+ const [tx, ty] = nodeCenter(to, phase);
43
+ if (sticker) {
44
+ return `M ${fx - SIZE.sticker.w / 2} ${fy} C ${fx - 10} ${fy}, ${tx + 18} ${ty}, ${tx + SIZE.card.w / 2} ${ty}`;
45
+ }
46
+ const sy = fy + SIZE[from.kind].h / 2;
47
+ const ty2 = ty - SIZE[to.kind].h / 2;
48
+ const my = (sy + ty2) / 2;
49
+ return `M ${fx} ${sy} C ${fx} ${my}, ${tx} ${my}, ${tx} ${ty2}`;
50
+ };
51
+
52
+ const HeroBoardDemo = ({ copy }) => {
53
+ const reduceMotion = useReducedMotion();
54
+ const [phase, setPhase] = useState(reduceMotion ? 4 : 0);
55
+ const [cycle, setCycle] = useState(0);
56
+
57
+ useEffect(() => {
58
+ if (reduceMotion) return undefined;
59
+ const timer = setTimeout(() => {
60
+ if (phase < TIMINGS.length - 1) {
61
+ setPhase(phase + 1);
62
+ } else {
63
+ setPhase(0);
64
+ setCycle((c) => c + 1);
65
+ }
66
+ }, TIMINGS[phase]);
67
+ return () => clearTimeout(timer);
68
+ }, [phase, reduceMotion]);
69
+
70
+ const labels = {
71
+ goal: copy.goal,
72
+ design: copy.design,
73
+ copy: copy.copy,
74
+ check: copy.check,
75
+ publish: copy.publish,
76
+ fix: copy.fix,
77
+ sticker: copy.sticker,
78
+ };
79
+ const done = (id) => phase >= 3 && (id === 'design' || id === 'copy' || id === 'goal');
80
+ const nextStep = phase === 3 ? 'check' : phase >= 4 ? 'publish' : null;
81
+ const byId = Object.fromEntries(NODES.map((n) => [n.id, n]));
82
+ const spring = { type: 'spring', stiffness: 90, damping: 16, mass: 0.9 };
83
+
84
+ return (
85
+ <div className="relative w-full rough-border rough-shadow bg-surface-container-lowest overflow-hidden select-none" aria-hidden="true">
86
+ {/* Mock toolbar */}
87
+ <div className="flex items-center justify-between px-4 py-2.5 border-b-2 border-primary/10 bg-surface-container-low">
88
+ <div className="flex gap-1.5">
89
+ <span className="w-3 h-3 rounded-full bg-red-400/70" />
90
+ <span className="w-3 h-3 rounded-full bg-yellow-400/70" />
91
+ <span className="w-3 h-3 rounded-full bg-green-400/70" />
92
+ </div>
93
+ <motion.div
94
+ animate={phase === 1 ? { scale: [1, 1, 0.9, 1.05, 1] } : { scale: 1 }}
95
+ transition={{ duration: 1.2, times: [0, 0.6, 0.75, 0.9, 1] }}
96
+ className={`flex items-center gap-1.5 px-3 py-1 rounded-lg border-2 text-xs font-bold transition-colors ${
97
+ phase === 2 ? 'bg-primary text-on-primary border-primary' : 'border-primary/30 text-primary'
98
+ }`}
99
+ >
100
+ <Network size={13} />
101
+ <span>{copy.autoLayout}</span>
102
+ <span className="opacity-50 font-mono">⇧L</span>
103
+ </motion.div>
104
+ </div>
105
+
106
+ <div className="relative w-full graph-paper-bg" style={{ aspectRatio: '100 / 72' }}>
107
+ {/* Edges */}
108
+ <svg viewBox="0 0 100 72" preserveAspectRatio="none" className="absolute inset-0 w-full h-full">
109
+ {EDGES.map((e, i) => {
110
+ const active = e.branch === 'yes' && phase >= 4;
111
+ const dimmed = e.branch === 'no' && phase >= 4;
112
+ return (
113
+ <motion.path
114
+ key={`${cycle}-${e.id}`}
115
+ initial={{ pathLength: 0, opacity: 0, d: edgePath(byId[e.from], byId[e.to], 0, e.sticker) }}
116
+ animate={{
117
+ pathLength: 1,
118
+ opacity: dimmed ? 0.18 : 1,
119
+ d: edgePath(byId[e.from], byId[e.to], phase, e.sticker),
120
+ }}
121
+ transition={{
122
+ pathLength: { duration: 0.7, delay: 0.5 + i * 0.12 },
123
+ opacity: { duration: 0.4, delay: phase === 0 ? 0.5 + i * 0.12 : 0 },
124
+ d: spring,
125
+ }}
126
+ fill="none"
127
+ stroke={active ? '#22c55e' : 'currentColor'}
128
+ className="text-primary"
129
+ strokeOpacity={e.sticker ? 0.35 : 0.7}
130
+ strokeWidth={active ? 0.9 : 0.5}
131
+ strokeDasharray={e.sticker ? '1.4 1.2' : undefined}
132
+ vectorEffect="non-scaling-stroke"
133
+ style={{ strokeWidth: active ? 3.5 : 2 }}
134
+ />
135
+ );
136
+ })}
137
+ </svg>
138
+
139
+ {/* Nodes */}
140
+ {NODES.map((n, i) => {
141
+ const [cx, cy] = nodeCenter(n, phase);
142
+ const size = SIZE[n.kind];
143
+ const isDone = done(n.id);
144
+ const isNext = nextStep === n.id;
145
+ const isDimmed = phase >= 4 && n.id === 'fix';
146
+ return (
147
+ <motion.div
148
+ key={`${cycle}-${n.id}`}
149
+ initial={{ opacity: 0, scale: 0.4, rotate: -6 }}
150
+ animate={{
151
+ opacity: isDimmed ? 0.35 : 1,
152
+ scale: 1,
153
+ rotate: phase >= 2 ? 0 : (i % 2 ? 3 : -3),
154
+ left: `${cx - size.w / 2}%`,
155
+ top: `${((cy - size.h / 2) / 72) * 100}%`,
156
+ }}
157
+ transition={{
158
+ opacity: { duration: 0.3, delay: phase === 0 ? i * 0.1 : 0 },
159
+ scale: { type: 'spring', stiffness: 300, damping: 18, delay: i * 0.1 },
160
+ left: spring,
161
+ top: spring,
162
+ rotate: spring,
163
+ }}
164
+ className="absolute"
165
+ style={{ width: `${size.w}%`, height: `${(size.h / 72) * 100}%` }}
166
+ >
167
+ {n.kind === 'condition' ? (
168
+ <div
169
+ 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 ${
170
+ isNext ? 'border-green-500 shadow-[0_0_0_4px_rgba(34,197,94,0.25)]' : 'border-primary'
171
+ } bg-surface-container-lowest`}
172
+ >
173
+ <GitFork size={12} className="shrink-0 text-primary hidden sm:block" />
174
+ <span className="text-[8px] sm:text-[11px] font-bold text-primary leading-tight">{labels[n.id]}</span>
175
+ {phase >= 4 && (
176
+ <motion.span
177
+ initial={{ scale: 0 }}
178
+ animate={{ scale: 1 }}
179
+ 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"
180
+ >
181
+ {copy.yes}
182
+ </motion.span>
183
+ )}
184
+ </div>
185
+ ) : n.kind === 'sticker' ? (
186
+ <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">
187
+ <span className="font-accent-note text-[11px] sm:text-[17px] text-yellow-900 leading-none">{labels[n.id]}</span>
188
+ </div>
189
+ ) : (
190
+ <div
191
+ className={`relative w-full h-full rounded-xl border-2 px-2 flex items-center gap-1.5 transition-shadow duration-300 ${
192
+ isNext ? 'border-green-500 shadow-[0_0_0_4px_rgba(34,197,94,0.25)]' : 'border-primary'
193
+ }`}
194
+ style={{ backgroundColor: n.color || 'var(--color-surface-container-lowest)' }}
195
+ >
196
+ <motion.span
197
+ animate={isDone ? { scale: [1, 1.35, 1] } : { scale: 1 }}
198
+ transition={{ duration: 0.4, delay: n.id === 'copy' ? 0.35 : n.id === 'goal' ? 0.7 : 0 }}
199
+ className={`shrink-0 w-3 h-3 sm:w-4 sm:h-4 rounded-full border-2 flex items-center justify-center ${
200
+ isDone ? 'bg-green-500 border-green-500 text-white' : 'border-primary/50'
201
+ }`}
202
+ >
203
+ {isDone && <Check size={9} strokeWidth={4} />}
204
+ </motion.span>
205
+ <span className={`text-[8px] sm:text-[11px] font-bold leading-tight text-[#181919] ${isDone ? 'line-through opacity-60' : ''}`}>
206
+ {labels[n.id]}
207
+ </span>
208
+ {isNext && (
209
+ <motion.span
210
+ initial={{ opacity: 0, y: 4 }}
211
+ animate={{ opacity: 1, y: 0 }}
212
+ 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"
213
+ >
214
+ {copy.nextStep} <ArrowRight size={9} />
215
+ </motion.span>
216
+ )}
217
+ </div>
218
+ )}
219
+ </motion.div>
220
+ );
221
+ })}
222
+
223
+ {/* Fake cursor heading to the auto-layout button */}
224
+ {!reduceMotion && (
225
+ <motion.div
226
+ className="absolute z-10 text-primary drop-shadow"
227
+ initial={false}
228
+ animate={
229
+ phase === 0 ? { left: '55%', top: '70%', opacity: 0 }
230
+ : phase === 1 ? { left: '74%', top: '-7%', opacity: 1 }
231
+ : { left: '78%', top: '20%', opacity: 0 }
232
+ }
233
+ transition={{ duration: phase === 1 ? 0.8 : 0.5, ease: 'easeInOut' }}
234
+ >
235
+ <MousePointer2 size={22} className="fill-surface-container-lowest" />
236
+ </motion.div>
237
+ )}
238
+ </div>
239
+ </div>
240
+ );
241
+ };
242
+
243
+ export default HeroBoardDemo;
src/features/landing/components/AIFeatureSection.jsx DELETED
@@ -1,76 +0,0 @@
1
- import React from 'react';
2
- import { motion } from 'framer-motion';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- const AIFeatureSection = () => {
6
- const { t } = useTranslation();
7
- return (
8
- <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">
9
- <motion.div
10
- initial={{ opacity: 0, x: -50 }}
11
- whileInView={{ opacity: 1, x: 0 }}
12
- viewport={{ once: true }}
13
- className="flex flex-col gap-8"
14
- >
15
- <div className="flex items-center gap-4 text-secondary">
16
- <span className="material-symbols-outlined text-4xl">neurology</span>
17
- <span className="text-xl font-bold uppercase tracking-widest">{t('landing.adhd_edge', 'The ADHD Edge')}</span>
18
- </div>
19
- <h2 className="text-6xl font-display-lg text-primary">{t('landing.ai_find_path', 'Let AI find the path when you get stuck.')}</h2>
20
- <p className="text-2xl text-on-surface-variant leading-relaxed">
21
- {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.")}
22
- </p>
23
- <motion.div
24
- whileHover={{ rotate: 0 }}
25
- className="mt-4 bg-surface-container-lowest p-8 rough-border rough-shadow inline-block transform rotate-1 max-w-md"
26
- >
27
- <div className="flex items-center gap-4 border-b-2 border-primary/20 pb-4 mb-6">
28
- <span className="material-symbols-outlined text-4xl text-primary">robot_2</span>
29
- <span className="text-sm font-bold text-on-surface-variant uppercase tracking-[0.2em]">{t('canvas.ai_assistant', 'AI Assistant')}</span>
30
- </div>
31
- <p className="font-accent-note text-3xl text-primary">
32
- "{t('landing.ai_example_input', "I'm blocked on user growth. What now?")}"
33
- </p>
34
- <div className="flex justify-end mt-6">
35
- <button className="bg-primary text-on-primary font-bold py-2 px-6 rough-border shadow-sm">
36
- {t('landing.ai_adapt_plan', 'Adapt Plan')}
37
- </button>
38
- </div>
39
- </motion.div>
40
- </motion.div>
41
- <motion.div
42
- initial={{ opacity: 0, scale: 0.95 }}
43
- whileInView={{ opacity: 1, scale: 1 }}
44
- viewport={{ once: true }}
45
- 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"
46
- >
47
- <div className="absolute inset-0 graph-paper-bg opacity-30 pointer-events-none"></div>
48
- <svg viewBox="0 0 1000 600" className="w-full h-full max-w-[950px] z-10 overflow-visible">
49
- <motion.circle
50
- cx="150" cy="300" r="40"
51
- fill="none" stroke="var(--color-secondary)" strokeWidth="1" strokeDasharray="4 4"
52
- animate={{ r: [40, 60, 40], opacity: [0.5, 0, 0.5] }}
53
- transition={{ repeat: Infinity, duration: 2, ease: "easeInOut" }}
54
- />
55
- <motion.path
56
- initial={{ pathLength: 0 }}
57
- whileInView={{ pathLength: 1 }}
58
- viewport={{ once: true }}
59
- transition={{ delay: 0.8, duration: 2, ease: "easeInOut" }}
60
- 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"
61
- fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round"
62
- className="opacity-70"
63
- />
64
- {/* Nodes simplified for extraction */}
65
- <foreignObject x="20" y="240" width="260" height="120">
66
- <div className="bg-secondary-container/20 p-5 rough-border text-center font-bold text-2xl h-full flex items-center justify-center">
67
- {t('landing.ai_early_users', 'Acquire Early Users')}
68
- </div>
69
- </foreignObject>
70
- </svg>
71
- </motion.div>
72
- </section>
73
- );
74
- };
75
-
76
- export default AIFeatureSection;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/features/landing/components/HeroSection.jsx DELETED
@@ -1,130 +0,0 @@
1
- import React from 'react';
2
- import { motion } from 'framer-motion';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- const HeroSection = () => {
6
- const { t } = useTranslation();
7
- return (
8
- <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">
9
- <div className="max-w-4xl flex flex-col gap-6">
10
- <motion.h1
11
- initial={{ opacity: 0, y: 20 }}
12
- animate={{ opacity: 1, y: 0 }}
13
- transition={{ duration: 0.6 }}
14
- className="text-5xl md:text-8xl font-display-lg text-primary leading-tight"
15
- >
16
- {t('landing.hero_title_p1', 'Plans break.')} <br />
17
- <span className="highlighter-bg px-4">{t('landing.hero_title_p2', 'TaskFlow adapts.')}</span>
18
- </motion.h1>
19
- <motion.p
20
- initial={{ opacity: 0, y: 20 }}
21
- animate={{ opacity: 1, y: 0 }}
22
- transition={{ duration: 0.6, delay: 0.2 }}
23
- className="text-2xl md:text-3xl text-on-surface-variant max-w-3xl mx-auto leading-relaxed"
24
- >
25
- {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.")}
26
- </motion.p>
27
- <motion.div
28
- initial={{ opacity: 0, y: 20 }}
29
- animate={{ opacity: 1, y: 0 }}
30
- transition={{ duration: 0.6, delay: 0.4 }}
31
- className="mt-6 font-accent-note text-3xl text-secondary flex items-center justify-center gap-3"
32
- >
33
- <span className="material-symbols-outlined text-4xl" style={{ fontVariationSettings: '"FILL" 1' }}>psychology</span>
34
- {t('landing.hero_badge', 'ADHD-friendly. Resilience-driven.')}
35
- </motion.div>
36
- </div>
37
-
38
- {/* Hero Visual: Mockup */}
39
- <motion.div
40
- initial={{ opacity: 0, scale: 0.95 }}
41
- whileInView={{ opacity: 1, scale: 1 }}
42
- viewport={{ once: true }}
43
- transition={{ duration: 1, ease: "easeOut" }}
44
- 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"
45
- >
46
- {/* SVG Connections */}
47
- <svg className="absolute inset-0 w-full h-full pointer-events-none overflow-visible" style={{ zIndex: 0 }}>
48
- <defs>
49
- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto">
50
- <polygon points="0 0, 10 3.5, 0 7" fill="#181919" />
51
- </marker>
52
- </defs>
53
- <motion.path
54
- initial={{ pathLength: 0 }}
55
- whileInView={{ pathLength: 1 }}
56
- viewport={{ once: true }}
57
- transition={{ duration: 1.5, ease: "easeInOut" }}
58
- d="M 180 250 Q 260 220 340 250"
59
- fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round" strokeDasharray="8 6"
60
- />
61
- <motion.path
62
- initial={{ pathLength: 0 }}
63
- whileInView={{ pathLength: 1 }}
64
- viewport={{ once: true }}
65
- transition={{ duration: 1.2, delay: 0.5 }}
66
- d="M 460 250 Q 530 250 580 250"
67
- fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round"
68
- />
69
- <motion.path
70
- initial={{ pathLength: 0 }}
71
- whileInView={{ pathLength: 1 }}
72
- viewport={{ once: true }}
73
- transition={{ duration: 1.2, delay: 1.5 }}
74
- d="M 720 250 Q 780 160 850 160"
75
- fill="none" stroke="#45a84a" strokeWidth="4" strokeLinecap="round"
76
- />
77
- <motion.path
78
- initial={{ pathLength: 0 }}
79
- whileInView={{ pathLength: 1 }}
80
- viewport={{ once: true }}
81
- transition={{ duration: 1.2, delay: 1.7 }}
82
- d="M 720 250 Q 780 340 850 340"
83
- fill="none" stroke="#ba1a1a" strokeWidth="4" strokeLinecap="round"
84
- />
85
- </svg>
86
-
87
- {/* Nodes */}
88
- {[
89
- { label: t('landing.node_a', 'Task A'), pos: 'left-12 top-[210px]', rot: -2, delay: 0.2 },
90
- { label: t('landing.node_b', 'Task B'), pos: 'left-[340px] top-[210px]', rot: 1, delay: 0.4 },
91
- { label: t('landing.node_failed', 'Failed?'), pos: 'left-[580px] top-[180px]', rot: 45, diamond: true, delay: 0.6 },
92
- { label: t('landing.node_c', 'Task C'), pos: 'right-12 top-[120px]', rot: 2, delay: 0.8, color: '#45a84a' },
93
- { label: t('landing.node_d', 'Task D'), pos: 'right-12 top-[300px]', rot: -1, delay: 1.0, color: '#ba1a1a' }
94
- ].map((node, i) => (
95
- <motion.div
96
- key={i}
97
- initial={{ opacity: 0, scale: 0 }}
98
- whileInView={{ opacity: 1, scale: 1 }}
99
- animate={{
100
- y: [0, i % 2 === 0 ? -8 : 8, 0],
101
- rotate: node.diamond ? [45, 47, 43, 45] : [node.rot, node.rot + 1, node.rot - 1, node.rot]
102
- }}
103
- transition={{
104
- initial: { delay: node.delay, type: "spring", stiffness: 200 },
105
- animate: { repeat: Infinity, duration: 5 + i, ease: "easeInOut" }
106
- }}
107
- viewport={{ once: true }}
108
- className={`absolute ${node.pos} z-10 flex items-center justify-center p-2 group overflow-visible`}
109
- >
110
- {node.diamond ? (
111
- <div className="w-36 h-36 flex items-center justify-center relative">
112
- <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" />
113
- <span className="relative font-display-lg text-2xl text-primary font-bold">{node.label}</span>
114
- </div>
115
- ) : (
116
- <div
117
- style={{ borderColor: node.color || 'var(--color-primary)' }}
118
- 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`}
119
- >
120
- <span className="text-2xl font-bold">{node.label}</span>
121
- </div>
122
- )}
123
- </motion.div>
124
- ))}
125
- </motion.div>
126
- </section>
127
- );
128
- };
129
-
130
- export default HeroSection;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/features/landing/components/PricingSection.jsx DELETED
@@ -1,105 +0,0 @@
1
- import React from 'react';
2
- import { motion } from 'framer-motion';
3
- import { useTranslation } from 'react-i18next';
4
-
5
- const PricingSection = () => {
6
- const { t } = useTranslation();
7
- return (
8
- <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">
9
- <div className="text-center">
10
- <h2 className="text-7xl font-display-lg text-primary">{t('pricing.title', 'Simple Pricing')}</h2>
11
- <p className="font-accent-note text-4xl text-on-surface-variant mt-4 transform -rotate-2">
12
- {t('pricing.subtitle', 'No hidden fees, just plain ink.')}
13
- </p>
14
- </div>
15
- <div className="grid grid-cols-1 md:grid-cols-3 gap-12 w-full max-w-6xl items-start">
16
- {/* Free Tier */}
17
- <motion.div
18
- initial={{ opacity: 0, x: -20 }}
19
- whileInView={{ opacity: 1, x: 0 }}
20
- viewport={{ once: true }}
21
- className="bg-surface-container-lowest p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1"
22
- >
23
- <div>
24
- <h3 className="text-4xl font-display-lg text-primary">{t('pricing.free', 'Free')}</h3>
25
- <div className="font-accent-note text-3xl mt-2 text-secondary">$0 / {t('pricing.month', 'month')}</div>
26
- </div>
27
- <ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow">
28
- {[
29
- t('pricing.free_feat1', '3 Infinite Canvases'),
30
- t('pricing.free_feat2', 'Basic shapes & logic'),
31
- t('pricing.free_feat3', 'Community templates')
32
- ].map(item => (
33
- <li key={item} className="flex items-center gap-3">
34
- <span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item}
35
- </li>
36
- ))}
37
- </ul>
38
- <button className="w-full py-3 rough-border text-primary font-bold text-lg hover:bg-surface-variant transition-colors">
39
- {t('pricing.start_free', 'Start Free')}
40
- </button>
41
- </motion.div>
42
-
43
- {/* Pro Tier */}
44
- <motion.div
45
- initial={{ opacity: 0, scale: 0.9 }}
46
- whileInView={{ opacity: 1, scale: 1.05 }}
47
- viewport={{ once: true }}
48
- 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)]"
49
- >
50
- <div>
51
- <h3 className="text-5xl font-display-lg text-primary">
52
- <span className="highlighter-bg px-2">{t('pricing.pro', 'Pro')}</span>
53
- </h3>
54
- <div className="font-accent-note text-4xl mt-3 text-secondary">$10 / {t('pricing.month', 'month')}</div>
55
- </div>
56
- <ul className="flex flex-col gap-5 text-xl text-on-surface-variant flex-grow font-medium">
57
- {[
58
- t('pricing.pro_feat1', 'Unlimited Canvases'),
59
- t('pricing.pro_feat2', 'AI Path Generation'),
60
- t('pricing.pro_feat3', 'Advanced Habit Tracking'),
61
- t('pricing.pro_feat4', 'Priority Support')
62
- ].map(item => (
63
- <li key={item} className="flex items-center gap-3">
64
- <span className="material-symbols-outlined text-secondary font-bold text-3xl">done</span> {item}
65
- </li>
66
- ))}
67
- </ul>
68
- <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">
69
- {t('pricing.go_pro', 'Go Pro')}
70
- </button>
71
- </motion.div>
72
-
73
- {/* Team Tier */}
74
- <motion.div
75
- initial={{ opacity: 0, x: 20 }}
76
- whileInView={{ opacity: 1, x: 0 }}
77
- viewport={{ once: true }}
78
- className="bg-surface-container-lowest p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1"
79
- >
80
- <div>
81
- <h3 className="text-4xl font-display-lg text-primary">{t('pricing.team', 'Team')}</h3>
82
- <div className="font-accent-note text-3xl mt-2 text-secondary">$25 / {t('pricing.user', 'user')}</div>
83
- </div>
84
- <ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow">
85
- {[
86
- t('pricing.team_feat1', 'Everything in Pro'),
87
- t('pricing.team_feat2', 'Real-time Collaboration'),
88
- t('pricing.team_feat3', 'Team Workspaces'),
89
- t('pricing.team_feat4', 'Admin Tools')
90
- ].map(item => (
91
- <li key={item} className="flex items-center gap-3">
92
- <span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item}
93
- </li>
94
- ))}
95
- </ul>
96
- <button className="w-full py-3 rough-border text-primary font-bold text-lg hover:bg-surface-variant transition-colors">
97
- {t('pricing.contact_us', 'Contact Us')}
98
- </button>
99
- </motion.div>
100
- </div>
101
- </section>
102
- );
103
- };
104
-
105
- export default PricingSection;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/features/landing/landingCopy.js ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Landing page copy. Everything here describes what the product does today;
2
+ // planned work is listed separately under `roadmap`.
3
+ import { FREE_LIMITS, PLUS_PRICE_USD } from '../../config/plans';
4
+
5
+ const en = {
6
+ nav: { product: 'Product', how: 'How it works', templates: 'Templates', pricing: 'Pricing', login: 'Log in', start: 'Start free', workspace: 'Open workspace' },
7
+ hero: {
8
+ badge: 'Visual planner · free to start',
9
+ title1: 'Plans break.',
10
+ title2: 'Your map adapts.',
11
+ 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.',
12
+ ctaPrimary: 'Start free',
13
+ ctaSecondary: 'See how it works',
14
+ note: `Free plan: ${FREE_LIMITS.boards} boards, no card required.`,
15
+ },
16
+ demo: {
17
+ goal: 'Launch the website',
18
+ design: 'Design',
19
+ copy: 'Write copy',
20
+ check: 'Ready for review?',
21
+ yes: 'Yes',
22
+ no: 'No',
23
+ publish: 'Publish',
24
+ fix: 'Fix feedback',
25
+ sticker: 'Ask Anna for the logo',
26
+ autoLayout: 'Auto-layout',
27
+ nextStep: 'Next step',
28
+ },
29
+ facts: ['Infinite canvas', 'If/then forks', 'One-click auto-layout', 'Live collaboration', 'English & Ukrainian', 'Dark mode'],
30
+ product: {
31
+ kicker: 'What you get',
32
+ title: 'Everything on one board',
33
+ subtitle: 'No lists hiding the big picture. Your goal, its steps and the decisions in between stay visible.',
34
+ features: [
35
+ { 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.' },
36
+ { 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.' },
37
+ { 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.' },
38
+ { 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.' },
39
+ { 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.' },
40
+ { icon: 'Users', title: 'Real-time collaboration', text: 'Invite people by email with view or edit access. See their cursors and changes live.' },
41
+ { 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.' },
42
+ { 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.' },
43
+ ],
44
+ },
45
+ how: {
46
+ kicker: 'How it works',
47
+ title: 'From goal to next step in three moves',
48
+ steps: [
49
+ { 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.' },
50
+ { 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.' },
51
+ { title: 'Tick things off', text: 'Mark steps as done and choose answers at forks. The board keeps pointing at what to do next.' },
52
+ ],
53
+ },
54
+ templates: {
55
+ kicker: 'Templates',
56
+ title: 'Start with a shape, not a blank page',
57
+ 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.',
58
+ },
59
+ pricing: {
60
+ kicker: 'Pricing',
61
+ title: 'Two plans. No fine print.',
62
+ perMonth: '/ month',
63
+ free: {
64
+ name: 'Free',
65
+ desc: 'For planning on your own.',
66
+ features: [
67
+ `Up to ${FREE_LIMITS.boards} boards`,
68
+ `Up to ${FREE_LIMITS.nodesPerBoard} nodes per board`,
69
+ `Up to ${FREE_LIMITS.guestsPerBoard} guests per board`,
70
+ `${FREE_LIMITS.templates} saved templates`,
71
+ 'All node types, auto-layout, export',
72
+ ],
73
+ cta: 'Start free',
74
+ },
75
+ plus: {
76
+ name: 'Plus',
77
+ desc: 'For big plans and teams.',
78
+ features: ['Unlimited boards', 'Unlimited nodes', 'Unlimited collaborators', 'Unlimited saved templates', 'Everything in Free'],
79
+ cta: 'Get Plus',
80
+ badge: 'No limits',
81
+ },
82
+ price: PLUS_PRICE_USD,
83
+ paymentsNote: 'Online payment for Plus is being connected right now.',
84
+ },
85
+ roadmap: {
86
+ kicker: 'In the works',
87
+ title: 'What we are building next',
88
+ subtitle: 'Not available yet — we would rather say so than pretend.',
89
+ items: [
90
+ { 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.' },
91
+ { icon: 'TerminalSquare', title: 'Terminal agents', text: 'Connect your own AI agents from the terminal to read and update your boards.' },
92
+ { icon: 'CreditCard', title: 'Online payment for Plus', text: 'Card payment for the Plus plan.' },
93
+ ],
94
+ },
95
+ cta: {
96
+ title: 'Draw your next plan',
97
+ subtitle: 'It takes a minute to start. Free plan, no card.',
98
+ button: 'Start free',
99
+ },
100
+ };
101
+
102
+ const uk = {
103
+ nav: { product: 'Продукт', how: 'Як це працює', templates: 'Шаблони', pricing: 'Ціни', login: 'Увійти', start: 'Почати безкоштовно', workspace: 'Відкрити простір' },
104
+ hero: {
105
+ badge: 'Візуальний планер · старт безкоштовно',
106
+ title1: 'Плани ламаються.',
107
+ title2: 'Ваша карта підлаштовується.',
108
+ subtitle: 'TaskFlow перетворює ціль на карту: кроки, розвилки «якщо/то» і нотатки на одній нескінченній дошці. Позначте крок виконаним — і дошка покаже, що далі.',
109
+ ctaPrimary: 'Почати безкоштовно',
110
+ ctaSecondary: 'Як це працює',
111
+ note: `Тариф Free: ${FREE_LIMITS.boards} дошок, без картки.`,
112
+ },
113
+ demo: {
114
+ goal: 'Запустити сайт',
115
+ design: 'Дизайн',
116
+ copy: 'Написати тексти',
117
+ check: 'Готово до перевірки?',
118
+ yes: 'Так',
119
+ no: 'Ні',
120
+ publish: 'Опублікувати',
121
+ fix: 'Виправити зауваження',
122
+ sticker: 'Попросити в Анни логотип',
123
+ autoLayout: 'Авто-розкладка',
124
+ nextStep: 'Наступний крок',
125
+ },
126
+ facts: ['Нескінченний холст', 'Розвилки «якщо/то»', 'Авто-розкладка в один клік', 'Спільна робота наживо', 'Українська та англійська', 'Темна тема'],
127
+ product: {
128
+ kicker: 'Що ви отримуєте',
129
+ title: 'Усе на одній дошці',
130
+ subtitle: 'Жодних списків, за якими не видно картини. Ціль, кроки і рішення між ними завжди перед очима.',
131
+ features: [
132
+ { icon: 'Target', title: 'Цілі у вигляді графа', text: 'Кожен крок — картка зі статусом, прогресом, тегами, виконавцями і одним із восьми кольорів. З’єднуйте картки, щоб показати залежності.' },
133
+ { icon: 'GitFork', title: 'Розвилки «якщо/то»', text: 'Вузли-умови ділять план на гілки: «Так / Ні» або будь-які варіанти. Оберіть відповідь — і відповідна гілка підсвітиться.' },
134
+ { icon: 'Footprints', title: 'Завжди видно наступний крок', text: 'Коли крок виконано, дошка підсвічує наступний на шляху — не треба перечитувати весь план.' },
135
+ { icon: 'Network', title: 'Авто-розкладка', text: 'Один клік (або Shift+L) впорядковує всю дошку чи лише виділене в акуратний потік згори донизу. Нотатки рухаються разом із картками.' },
136
+ { icon: 'ListTodo', title: 'Карта і список задач', text: 'Перемкніть ту саму дошку на список із пошуком і фільтрами за тегом чи людиною. Ті самі дані — два види.' },
137
+ { icon: 'Users', title: 'Спільна робота наживо', text: 'Запрошуйте людей за email з правом перегляду чи редагування. Бачите їхні курсори та зміни в реальному часі.' },
138
+ { icon: 'StickyNote', title: 'Нотатки, текст, зображення, пензель', text: 'Чіпляйте стікери до карток, вставляйте скриншоти, пишіть заголовки або малюйте пензлем прямо на холсті.' },
139
+ { icon: 'Download', title: 'Ваші дані — ваші', text: 'Експорт дошки в PNG або JSON. Скасування/повтор, копіювання між дошками працюють як звично.' },
140
+ ],
141
+ },
142
+ how: {
143
+ kicker: 'Як це працює',
144
+ title: 'Від цілі до наступного кроку за три дії',
145
+ steps: [
146
+ { title: 'Почніть із шаблону або порожньої дошки', text: 'Шість стартових шаблонів: проєкти, рішення, запуск продукту, навчання, спринти, пошук роботи. Або збережіть власну дошку як шабло��.' },
147
+ { title: 'Накидайте кроки й розвилки', text: 'Додайте картки, з’єднайте їх, поставте умову там, де план може піти двома шляхами. Стало безладно — Shift+L.' },
148
+ { title: 'Позначайте виконане', text: 'Відмічайте кроки й обирайте відповіді на розвилках. Дошка весь час показує, що робити далі.' },
149
+ ],
150
+ },
151
+ templates: {
152
+ kicker: 'Шаблони',
153
+ title: 'Почніть з форми, а не з порожнього аркуша',
154
+ subtitle: 'Вбудовані шаблони розкладаються автоматично. Збережіть будь-яку дошку чи виділений фрагмент як свій шаблон і вставляйте його в інші дошки.',
155
+ },
156
+ pricing: {
157
+ kicker: 'Ціни',
158
+ title: 'Два тарифи. Без дрібного шрифту.',
159
+ perMonth: '/ міс',
160
+ free: {
161
+ name: 'Free',
162
+ desc: 'Для власних планів.',
163
+ features: [
164
+ `До ${FREE_LIMITS.boards} дошок`,
165
+ `До ${FREE_LIMITS.nodesPerBoard} вузлів на дошці`,
166
+ `До ${FREE_LIMITS.guestsPerBoard} гостей на дошці`,
167
+ `${FREE_LIMITS.templates} збережені шаблони`,
168
+ 'Усі типи вузлів, авто-розкладка, експорт',
169
+ ],
170
+ cta: 'Почати безкоштовно',
171
+ },
172
+ plus: {
173
+ name: 'Plus',
174
+ desc: 'Для великих планів і команд.',
175
+ features: ['Безліміт дошок', 'Безліміт вузлів', 'Безліміт учасників', 'Безліміт шаблонів', 'Усе з Free'],
176
+ cta: 'Отримати Plus',
177
+ badge: 'Без лімітів',
178
+ },
179
+ price: PLUS_PRICE_USD,
180
+ paymentsNote: 'Онлайн-оплату Plus зараз підключаємо.',
181
+ },
182
+ roadmap: {
183
+ kicker: 'У розробці',
184
+ title: 'Що ми робимо далі',
185
+ subtitle: 'Цього ще немає — краще сказати чесно.',
186
+ items: [
187
+ { icon: 'Repeat', title: 'Окремий простір для звичок', text: 'Звички переїжджають з дошки цілей у власний розділ із серіями та календарем.' },
188
+ { icon: 'TerminalSquare', title: 'Термінальні агенти', text: 'Підключайте власних ШІ-агентів з терміналу, щоб вони читали й оновлювали ваші дошки.' },
189
+ { icon: 'CreditCard', title: 'Онлайн-оплата Plus', text: 'Оплата тарифу Plus карткою.' },
190
+ ],
191
+ },
192
+ cta: {
193
+ title: 'Намалюйте свій наступний план',
194
+ subtitle: 'Старт займає хвилину. Тариф Free, без картки.',
195
+ button: 'Почати безкоштовно',
196
+ },
197
+ };
198
+
199
+ export const getLandingCopy = (lang) => (lang?.startsWith('uk') ? uk : en);
src/features/templates/SaveTemplateModal.jsx ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState } from 'react';
2
+ import { motion, AnimatePresence } from 'framer-motion';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useNavigate } from 'react-router-dom';
5
+ import { X, BookOpen, Check, Loader2 } from 'lucide-react';
6
+ import TemplatePreview from './TemplatePreview';
7
+ import { createTemplate } from './templatesApi';
8
+
9
+ /**
10
+ * Saves the board — or only the selected nodes — as a personal template.
11
+ * `serialize(selectedOnly)` returns the template content from the canvas.
12
+ */
13
+ const SaveTemplateModal = ({ open, onClose, serialize, selectedCount, initialTitle, initialDesc }) => {
14
+ const { t } = useTranslation();
15
+ const navigate = useNavigate();
16
+ const [title, setTitle] = useState(initialTitle || '');
17
+ const [desc, setDesc] = useState(initialDesc || '');
18
+ const [category, setCategory] = useState('');
19
+ const [selectedOnly, setSelectedOnly] = useState(selectedCount >= 2);
20
+ const [saving, setSaving] = useState(false);
21
+ const [error, setError] = useState('');
22
+ const [limitHit, setLimitHit] = useState(false);
23
+ const [done, setDone] = useState(false);
24
+
25
+ const content = open ? serialize(selectedOnly) : null;
26
+
27
+ const handleSubmit = async (e) => {
28
+ e.preventDefault();
29
+ if (!title.trim() || !content?.nodes.length) return;
30
+ setSaving(true);
31
+ setError('');
32
+ setLimitHit(false);
33
+ try {
34
+ await createTemplate({
35
+ title: title.trim(),
36
+ description: desc.trim(),
37
+ category: category.trim() || t('templates.my_category', 'My templates'),
38
+ icon: 'BookOpen',
39
+ content,
40
+ });
41
+ setDone(true);
42
+ setTimeout(onClose, 1100);
43
+ } catch (err) {
44
+ const msg = err.response?.data?.message || t('templates.save_failed', 'Could not save the template.');
45
+ setError(msg);
46
+ setLimitHit(/plan|limit/i.test(msg));
47
+ } finally {
48
+ setSaving(false);
49
+ }
50
+ };
51
+
52
+ return (
53
+ <AnimatePresence>
54
+ {open && (
55
+ <div className="fixed inset-0 z-[70] flex items-center justify-center p-4">
56
+ <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} onClick={onClose} className="absolute inset-0 bg-primary/25 backdrop-blur-sm" />
57
+ <motion.div
58
+ initial={{ opacity: 0, y: 24, rotate: -1 }}
59
+ animate={{ opacity: 1, y: 0, rotate: 0 }}
60
+ exit={{ opacity: 0, y: 24 }}
61
+ transition={{ type: 'spring', stiffness: 260, damping: 24 }}
62
+ 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"
63
+ >
64
+ <button type="button" onClick={onClose} className="absolute top-4 right-4 text-on-surface-variant hover:text-primary cursor-pointer">
65
+ <X size={24} />
66
+ </button>
67
+ <h3 className="text-3xl font-display-lg text-primary flex items-center gap-2">
68
+ <BookOpen size={24} />
69
+ <span>{t('templates.save_title', 'Save as template')}</span>
70
+ </h3>
71
+
72
+ {done ? (
73
+ <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">
74
+ <div className="w-16 h-16 rounded-full bg-secondary flex items-center justify-center border-4 border-primary"><Check size={32} /></div>
75
+ <span className="font-bold text-lg">{t('templates.saved', 'Template saved')}</span>
76
+ </motion.div>
77
+ ) : (
78
+ <form onSubmit={handleSubmit} className="flex flex-col gap-5">
79
+ <div className="rounded-xl border-2 border-primary/10 graph-paper-bg px-3 pt-3">
80
+ <TemplatePreview content={content} height={150} />
81
+ </div>
82
+
83
+ {selectedCount >= 2 && (
84
+ <div className="flex bg-secondary/5 border-2 border-primary rounded-xl p-1">
85
+ {[false, true].map((only) => (
86
+ <button
87
+ key={String(only)}
88
+ type="button"
89
+ onClick={() => setSelectedOnly(only)}
90
+ 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'}`}
91
+ >
92
+ {only
93
+ ? t('templates.only_selected', { count: selectedCount, defaultValue: `Selected (${selectedCount})` })
94
+ : t('templates.whole_board', 'Whole board')}
95
+ </button>
96
+ ))}
97
+ </div>
98
+ )}
99
+
100
+ <label className="flex flex-col gap-1">
101
+ <span className="text-xs font-bold text-primary uppercase tracking-wider">{t('templates.field_title', 'Title')}</span>
102
+ <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" />
103
+ </label>
104
+ <label className="flex flex-col gap-1">
105
+ <span className="text-xs font-bold text-primary uppercase tracking-wider">{t('templates.field_desc', 'Description')}</span>
106
+ <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" />
107
+ </label>
108
+ <label className="flex flex-col gap-1">
109
+ <span className="text-xs font-bold text-primary uppercase tracking-wider">{t('templates.field_category', 'Category')}</span>
110
+ <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" />
111
+ </label>
112
+
113
+ <p className="text-[11px] text-on-surface-variant">
114
+ {t('templates.save_hint', 'Statuses, progress and assignees are not saved — the template is a clean starting point.')}
115
+ </p>
116
+
117
+ {error && (
118
+ <div className="bg-error/10 text-error p-3 rough-border text-sm font-bold flex flex-col gap-2">
119
+ <span>{error}</span>
120
+ {limitHit && (
121
+ <button type="button" onClick={() => navigate('/subscription')} className="self-start underline cursor-pointer">
122
+ {t('templates.go_plus', 'Plus removes the limit')}
123
+ </button>
124
+ )}
125
+ </div>
126
+ )}
127
+
128
+ <div className="flex gap-3">
129
+ <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">
130
+ {t('common.cancel', 'Cancel')}
131
+ </button>
132
+ <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">
133
+ {saving && <Loader2 size={16} className="animate-spin" />}
134
+ {t('templates.save_btn', 'Save template')}
135
+ </button>
136
+ </div>
137
+ </form>
138
+ )}
139
+ </motion.div>
140
+ </div>
141
+ )}
142
+ </AnimatePresence>
143
+ );
144
+ };
145
+
146
+ export default SaveTemplateModal;
src/features/templates/TemplateGallery.jsx ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { motion, AnimatePresence } from 'framer-motion';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useNavigate } from 'react-router-dom';
5
+ import {
6
+ X, Search, Plus, Trash2, Loader2, LayoutTemplate, Milestone, GitFork, Rocket, GraduationCap,
7
+ CalendarRange, Briefcase, BookOpen, FilePlus2,
8
+ } from 'lucide-react';
9
+ import TemplatePreview from './TemplatePreview';
10
+ import { getBuiltinTemplates } from './builtinTemplates';
11
+ import { fetchMyTemplates, deleteTemplate } from './templatesApi';
12
+ import { useAuth } from '../../context/AuthContext';
13
+ import { FREE_LIMITS, isPlus } from '../../config/plans';
14
+
15
+ const ICONS = { LayoutTemplate, Milestone, GitFork, Rocket, GraduationCap, CalendarRange, Briefcase, BookOpen };
16
+
17
+ const BLANK = { id: 'blank', blank: true, content: { nodes: [], edges: [] } };
18
+
19
+ /**
20
+ * Template picker.
21
+ * mode="create": first card is a blank board, the footer asks for the board name; onUse(template | null, title).
22
+ * mode="insert": picks a template to drop onto the current board; onUse(template).
23
+ */
24
+ const TemplateGallery = ({ open, onClose, mode = 'create', onUse, busy = false }) => {
25
+ const { t, i18n } = useTranslation();
26
+ const { user } = useAuth();
27
+ const navigate = useNavigate();
28
+
29
+ const [tab, setTab] = useState('all'); // all | builtin | mine
30
+ const [category, setCategory] = useState('all');
31
+ const [query, setQuery] = useState('');
32
+ const [mine, setMine] = useState([]);
33
+ const [mineLoading, setMineLoading] = useState(false);
34
+ const [selected, setSelected] = useState(null);
35
+ const [boardTitle, setBoardTitle] = useState('');
36
+ const [confirmDeleteId, setConfirmDeleteId] = useState(null);
37
+
38
+ const builtin = useMemo(() => getBuiltinTemplates(i18n.language), [i18n.language]);
39
+
40
+ useEffect(() => {
41
+ if (!open) return;
42
+ setSelected(mode === 'create' ? BLANK : null);
43
+ setBoardTitle('');
44
+ setQuery('');
45
+ setCategory('all');
46
+ setConfirmDeleteId(null);
47
+ setMineLoading(true);
48
+ fetchMyTemplates()
49
+ .then(setMine)
50
+ .catch((err) => console.error('[Templates] Failed to load user templates', err))
51
+ .finally(() => setMineLoading(false));
52
+ }, [open, mode]);
53
+
54
+ const source = tab === 'builtin' ? builtin : tab === 'mine' ? mine : [...mine, ...builtin];
55
+ const categories = useMemo(() => [...new Set(source.map((tpl) => tpl.category).filter(Boolean))], [source]);
56
+ const q = query.trim().toLowerCase();
57
+ const visible = source.filter((tpl) =>
58
+ (category === 'all' || tpl.category === category) &&
59
+ (!q || tpl.title.toLowerCase().includes(q) || (tpl.description || '').toLowerCase().includes(q))
60
+ );
61
+
62
+ const handleSelect = (tpl) => {
63
+ setSelected(tpl);
64
+ if (mode === 'create' && !tpl.blank && (!boardTitle || builtin.some((b) => b.title === boardTitle) || mine.some((m) => m.title === boardTitle))) {
65
+ setBoardTitle(tpl.title);
66
+ }
67
+ };
68
+
69
+ const handleDelete = async (tpl) => {
70
+ try {
71
+ await deleteTemplate(tpl.id);
72
+ setMine((list) => list.filter((m) => m.id !== tpl.id));
73
+ if (selected?.id === tpl.id) setSelected(mode === 'create' ? BLANK : null);
74
+ } catch (err) {
75
+ console.error('[Templates] Delete failed', err);
76
+ } finally {
77
+ setConfirmDeleteId(null);
78
+ }
79
+ };
80
+
81
+ const submit = (e) => {
82
+ e?.preventDefault();
83
+ if (!selected || busy) return;
84
+ if (mode === 'create') {
85
+ const title = boardTitle.trim() || (selected.blank ? t('templates.untitled', 'Untitled board') : selected.title);
86
+ onUse(selected.blank ? null : selected, title);
87
+ } else {
88
+ onUse(selected);
89
+ }
90
+ };
91
+
92
+ const userIsPlus = isPlus(user);
93
+ const tabs = [
94
+ { key: 'all', label: t('templates.tab_all', 'All') },
95
+ { key: 'builtin', label: t('templates.tab_builtin', 'Starters') },
96
+ { key: 'mine', label: t('templates.tab_mine', 'My templates') },
97
+ ];
98
+
99
+ const renderCard = (tpl, index) => {
100
+ const isSelected = selected?.id === tpl.id;
101
+ const Icon = tpl.blank ? FilePlus2 : ICONS[tpl.icon] || LayoutTemplate;
102
+ const nodeCount = tpl.content?.nodes?.length || 0;
103
+ return (
104
+ <motion.div
105
+ layout
106
+ key={tpl.id}
107
+ initial={{ opacity: 0, y: 16 }}
108
+ animate={{ opacity: 1, y: 0 }}
109
+ exit={{ opacity: 0, scale: 0.95 }}
110
+ transition={{ delay: Math.min(index, 8) * 0.03 }}
111
+ onClick={() => handleSelect(tpl)}
112
+ onDoubleClick={() => { handleSelect(tpl); if (mode === 'insert') onUse(tpl); }}
113
+ className={`group relative flex flex-col rounded-2xl border-2 cursor-pointer overflow-hidden transition-all ${
114
+ isSelected
115
+ ? 'border-primary bg-primary/5 shadow-[4px_4px_0px_0px_var(--color-primary)] -translate-y-0.5'
116
+ : 'border-primary/15 bg-surface-container-low hover:border-primary/40 hover:-translate-y-0.5'
117
+ }`}
118
+ >
119
+ <div className="relative bg-surface-container-lowest border-b-2 border-primary/10 graph-paper-bg px-3 pt-3">
120
+ {tpl.blank ? (
121
+ <div className="h-[170px] flex items-center justify-center">
122
+ <Plus size={44} className="text-primary/30 group-hover:text-primary/60 group-hover:rotate-90 transition-all duration-300" />
123
+ </div>
124
+ ) : (
125
+ <TemplatePreview content={tpl.content} height={170} />
126
+ )}
127
+ {!tpl.builtIn && !tpl.blank && (
128
+ <div className="absolute top-2 right-2" onClick={(e) => e.stopPropagation()}>
129
+ {confirmDeleteId === tpl.id ? (
130
+ <div className="flex items-center gap-1 bg-surface-container-lowest border-2 border-primary rounded-lg p-1">
131
+ <button onClick={() => handleDelete(tpl)} className="px-2 py-0.5 text-[10px] font-bold uppercase text-white bg-red-500 rounded cursor-pointer">
132
+ {t('templates.delete_confirm', 'Delete')}
133
+ </button>
134
+ <button onClick={() => setConfirmDeleteId(null)} className="px-2 py-0.5 text-[10px] font-bold uppercase text-primary cursor-pointer">
135
+ {t('common.cancel', 'Cancel')}
136
+ </button>
137
+ </div>
138
+ ) : (
139
+ <button
140
+ onClick={() => setConfirmDeleteId(tpl.id)}
141
+ title={t('templates.delete', 'Delete template')}
142
+ 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"
143
+ >
144
+ <Trash2 size={14} />
145
+ </button>
146
+ )}
147
+ </div>
148
+ )}
149
+ </div>
150
+ <div className="p-4 flex gap-3">
151
+ <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'}`}>
152
+ <Icon size={20} />
153
+ </div>
154
+ <div className="min-w-0 flex flex-col gap-1">
155
+ <span className="font-bold text-primary leading-tight">
156
+ {tpl.blank ? t('templates.blank', 'Blank board') : tpl.title}
157
+ </span>
158
+ <div className="flex items-center gap-2 flex-wrap">
159
+ {!tpl.blank && tpl.category && (
160
+ <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>
161
+ )}
162
+ {!tpl.blank && (
163
+ <span className="text-[10px] font-bold text-on-surface-variant/60">
164
+ {t('templates.node_count', { count: nodeCount, defaultValue: `${nodeCount} nodes` })}
165
+ </span>
166
+ )}
167
+ </div>
168
+ <p className="text-xs text-on-surface-variant/80 line-clamp-2">
169
+ {tpl.blank ? t('templates.blank_desc', 'Start from an empty canvas.') : tpl.description}
170
+ </p>
171
+ </div>
172
+ </div>
173
+ </motion.div>
174
+ );
175
+ };
176
+
177
+ return (
178
+ <AnimatePresence>
179
+ {open && (
180
+ <div className="fixed inset-0 z-[70] flex items-center justify-center p-4 sm:p-6">
181
+ <motion.div
182
+ initial={{ opacity: 0 }}
183
+ animate={{ opacity: 1 }}
184
+ exit={{ opacity: 0 }}
185
+ onClick={onClose}
186
+ className="absolute inset-0 bg-primary/25 backdrop-blur-sm"
187
+ />
188
+ <motion.div
189
+ initial={{ opacity: 0, y: 30, scale: 0.97 }}
190
+ animate={{ opacity: 1, y: 0, scale: 1 }}
191
+ exit={{ opacity: 0, y: 30, scale: 0.97 }}
192
+ transition={{ type: 'spring', stiffness: 260, damping: 26 }}
193
+ className="relative z-10 w-full max-w-5xl max-h-[92vh] flex flex-col bg-surface-container-lowest rough-border rough-shadow"
194
+ >
195
+ {/* Header */}
196
+ <div className="p-6 pb-4 flex flex-col gap-4 border-b-2 border-primary/10">
197
+ <div className="flex items-start justify-between gap-4">
198
+ <div>
199
+ <h3 className="text-3xl font-display-lg text-primary flex items-center gap-2">
200
+ <LayoutTemplate size={26} />
201
+ <span>{mode === 'create' ? t('templates.create_title', 'New board') : t('templates.insert_title', 'Insert a template')}</span>
202
+ </h3>
203
+ <p className="text-sm text-on-surface-variant mt-1">
204
+ {mode === 'create'
205
+ ? t('templates.create_desc', 'Start empty or from a template. Templates are laid out automatically.')
206
+ : t('templates.insert_desc', 'The template is added to the center of the screen and stays selected so you can move it.')}
207
+ </p>
208
+ </div>
209
+ <button onClick={onClose} className="p-1 text-on-surface-variant hover:text-primary transition-colors cursor-pointer">
210
+ <X size={24} />
211
+ </button>
212
+ </div>
213
+
214
+ <div className="flex flex-col md:flex-row gap-3 md:items-center">
215
+ <div className="flex bg-secondary/5 border-2 border-primary rounded-xl p-1 shrink-0">
216
+ {tabs.map((tb) => (
217
+ <button
218
+ key={tb.key}
219
+ onClick={() => { setTab(tb.key); setCategory('all'); }}
220
+ 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'}`}
221
+ >
222
+ {tab === tb.key && (
223
+ <motion.span layoutId="tpl-tab" className="absolute inset-0 bg-primary rounded-lg" transition={{ type: 'spring', stiffness: 400, damping: 32 }} />
224
+ )}
225
+ <span className="relative">{tb.label}{tb.key === 'mine' && mine.length > 0 ? ` · ${mine.length}` : ''}</span>
226
+ </button>
227
+ ))}
228
+ </div>
229
+ <div className="relative flex-grow">
230
+ <Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-on-surface-variant" />
231
+ <input
232
+ value={query}
233
+ onChange={(e) => setQuery(e.target.value)}
234
+ placeholder={t('templates.search', 'Search templates...')}
235
+ 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"
236
+ />
237
+ </div>
238
+ </div>
239
+
240
+ {categories.length > 1 && (
241
+ <div className="flex gap-2 flex-wrap">
242
+ {['all', ...categories].map((c) => (
243
+ <button
244
+ key={c}
245
+ onClick={() => setCategory(c)}
246
+ className={`px-3 py-1 rounded-full text-[11px] font-bold border-2 cursor-pointer transition-all ${
247
+ category === c ? 'bg-secondary text-primary border-primary' : 'border-primary/15 text-primary/70 hover:border-primary/40'
248
+ }`}
249
+ >
250
+ {c === 'all' ? t('templates.all_categories', 'All categories') : c}
251
+ </button>
252
+ ))}
253
+ </div>
254
+ )}
255
+ </div>
256
+
257
+ {/* Grid */}
258
+ <div className="flex-grow overflow-y-auto p-6 custom-scrollbar">
259
+ {tab === 'mine' && mineLoading ? (
260
+ <div className="flex justify-center py-16"><Loader2 className="animate-spin text-primary" size={28} /></div>
261
+ ) : (
262
+ <motion.div layout className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-5">
263
+ <AnimatePresence mode="popLayout">
264
+ {mode === 'create' && tab !== 'mine' && !q && category === 'all' && renderCard(BLANK, 0)}
265
+ {visible.map((tpl, i) => renderCard(tpl, i + 1))}
266
+ </AnimatePresence>
267
+ </motion.div>
268
+ )}
269
+ {!mineLoading && visible.length === 0 && (
270
+ <div className="text-center py-12 flex flex-col items-center gap-2">
271
+ <span className="font-accent-note text-2xl text-secondary">
272
+ {tab === 'mine' && !q ? t('templates.empty_mine', 'No saved templates yet') : t('templates.nothing_found', 'Nothing found')}
273
+ </span>
274
+ {tab === 'mine' && !q && (
275
+ <p className="text-sm text-on-surface-variant max-w-sm">
276
+ {t('templates.empty_mine_hint', 'Open any board and press "Save as template" — the whole board or just the selected nodes.')}
277
+ </p>
278
+ )}
279
+ </div>
280
+ )}
281
+ </div>
282
+
283
+ {/* Footer */}
284
+ <form onSubmit={submit} className="p-5 border-t-2 border-primary/10 flex flex-col sm:flex-row gap-3 sm:items-center">
285
+ <div className="flex-grow text-xs text-on-surface-variant">
286
+ {!userIsPlus && (
287
+ <span>
288
+ {t('templates.free_note', { used: mine.length, max: FREE_LIMITS.templates, defaultValue: `Free plan: ${mine.length}/${FREE_LIMITS.templates} saved templates.` })}{' '}
289
+ <button type="button" onClick={() => navigate('/subscription')} className="font-bold text-secondary underline cursor-pointer">
290
+ {t('templates.go_plus', 'Plus removes the limit')}
291
+ </button>
292
+ </span>
293
+ )}
294
+ </div>
295
+ {mode === 'create' && (
296
+ <input
297
+ autoFocus
298
+ value={boardTitle}
299
+ onChange={(e) => setBoardTitle(e.target.value)}
300
+ placeholder={t('dashboard.project_name_placeholder', 'Board name')}
301
+ 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"
302
+ />
303
+ )}
304
+ <motion.button
305
+ whileHover={{ scale: selected ? 1.04 : 1 }}
306
+ whileTap={{ scale: selected ? 0.97 : 1 }}
307
+ type="submit"
308
+ disabled={!selected || busy}
309
+ 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"
310
+ >
311
+ {busy ? <Loader2 size={18} className="animate-spin" /> : <Plus size={18} />}
312
+ <span>{mode === 'create' ? t('templates.create_btn', 'Create board') : t('templates.insert_btn', 'Insert')}</span>
313
+ </motion.button>
314
+ </form>
315
+ </motion.div>
316
+ </div>
317
+ )}
318
+ </AnimatePresence>
319
+ );
320
+ };
321
+
322
+ export default TemplateGallery;
src/features/templates/TemplatePreview.jsx ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useMemo } from 'react';
2
+ import { motion } from 'framer-motion';
3
+ import { layoutFresh, getNodeSize } from '../canvas/layout';
4
+
5
+ const NODE_FILL = {
6
+ blue: '#dbeafe', green: '#dcfce7', pink: '#fce7f3', purple: '#f3e8ff', orange: '#ffedd5', yellow: '#fef9c3',
7
+ };
8
+
9
+ // Miniature, non-interactive drawing of a template's graph.
10
+ const TemplatePreview = ({ content, height = 140 }) => {
11
+ const layout = useMemo(() => {
12
+ const nodes = content?.nodes || [];
13
+ const edges = content?.edges || [];
14
+ if (nodes.length === 0) return null;
15
+ const placed = nodes.some((n) => !n.position) ? layoutFresh(nodes, edges) : nodes;
16
+
17
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
18
+ const boxes = placed.map((n) => {
19
+ const { width, height: h } = getNodeSize(n);
20
+ minX = Math.min(minX, n.position.x);
21
+ minY = Math.min(minY, n.position.y);
22
+ maxX = Math.max(maxX, n.position.x + width);
23
+ maxY = Math.max(maxY, n.position.y + h);
24
+ return { id: n.id, type: n.type, color: n.data?.color, x: n.position.x, y: n.position.y, w: width, h };
25
+ });
26
+ const byId = new Map(boxes.map((b) => [b.id, b]));
27
+ const lines = edges
28
+ .map((e) => [byId.get(e.source), byId.get(e.target)])
29
+ .filter(([a, b]) => a && b)
30
+ .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' }));
31
+ const pad = 40;
32
+ // Keep strokes legible whatever the size of the graph
33
+ const stroke = Math.max(6, Math.max(maxX - minX, maxY - minY) / 70);
34
+ return { boxes, lines, stroke, viewBox: `${minX - pad} ${minY - pad} ${maxX - minX + pad * 2} ${maxY - minY + pad * 2}` };
35
+ }, [content]);
36
+
37
+ if (!layout) {
38
+ return (
39
+ <div style={{ height }} className="w-full flex items-center justify-center text-primary/30 font-accent-note text-2xl">
40
+ ∅
41
+ </div>
42
+ );
43
+ }
44
+
45
+ return (
46
+ <svg viewBox={layout.viewBox} preserveAspectRatio="xMidYMid meet" style={{ height }} className="w-full" aria-hidden="true">
47
+ {layout.lines.map((l, i) => (
48
+ <motion.path
49
+ key={l.key}
50
+ 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}`}
51
+ fill="none"
52
+ stroke="currentColor"
53
+ strokeOpacity={l.sticker ? 0.25 : 0.55}
54
+ strokeWidth={layout.stroke}
55
+ strokeDasharray={l.sticker ? '18 14' : undefined}
56
+ className="text-primary"
57
+ initial={{ pathLength: 0 }}
58
+ animate={{ pathLength: 1 }}
59
+ transition={{ duration: 0.6, delay: 0.05 * i, ease: 'easeOut' }}
60
+ />
61
+ ))}
62
+ {layout.boxes.map((b, i) => {
63
+ const fill = NODE_FILL[b.color] || (b.type === 'comment' ? NODE_FILL.yellow : 'var(--color-surface-container-lowest, #fff)');
64
+ const common = {
65
+ initial: { opacity: 0, scale: 0.6 },
66
+ animate: { opacity: 1, scale: 1 },
67
+ transition: { delay: 0.04 * i, type: 'spring', stiffness: 260, damping: 20 },
68
+ style: { transformOrigin: `${b.x + b.w / 2}px ${b.y + b.h / 2}px`, transformBox: 'view-box' },
69
+ };
70
+ if (b.type === 'condition') {
71
+ const cx = b.x + b.w / 2;
72
+ const cy = b.y + b.h / 2;
73
+ return (
74
+ <motion.polygon
75
+ key={b.id}
76
+ {...common}
77
+ points={`${cx},${b.y} ${b.x + b.w},${cy} ${cx},${b.y + b.h} ${b.x},${cy}`}
78
+ fill={fill}
79
+ stroke="currentColor"
80
+ strokeWidth={layout.stroke}
81
+ className="text-primary"
82
+ />
83
+ );
84
+ }
85
+ return (
86
+ <motion.rect
87
+ key={b.id}
88
+ {...common}
89
+ x={b.x}
90
+ y={b.y}
91
+ width={b.w}
92
+ height={b.h}
93
+ rx={b.type === 'comment' ? 6 : 28}
94
+ fill={fill}
95
+ stroke="currentColor"
96
+ strokeWidth={layout.stroke}
97
+ className="text-primary"
98
+ />
99
+ );
100
+ })}
101
+ </svg>
102
+ );
103
+ };
104
+
105
+ export default TemplatePreview;
src/features/templates/builtinTemplates.js ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Built-in starter templates. Nodes have no positions: they are arranged by the
2
+ // auto-layout when inserted, so every template stays tidy whatever the label lengths.
3
+ // Text is given as [en, uk].
4
+
5
+ const L = (lang, pair) => (lang?.startsWith('uk') ? pair[1] : pair[0]);
6
+
7
+ const goal = (id, label, description, extra = {}) => ({ id, type: 'sketch', label, description, ...extra });
8
+ const choice = (id, label, yes, no) => ({ id, type: 'condition', label, yes, no });
9
+ const note = (id, label, color = 'yellow') => ({ id, type: 'comment', label, color });
10
+
11
+ // Compact definitions; `edges` are [from, to, branch?] where branch is 'yes' | 'no' for conditions.
12
+ const DEFINITIONS = [
13
+ {
14
+ key: 'project-phases',
15
+ icon: 'Milestone',
16
+ category: ['Projects', 'Проєкти'],
17
+ title: ['Project in phases', 'Проєкт по етапах'],
18
+ description: ['Goal, three phases, launch and a retrospective.', 'Ціль, три етапи, запуск і ретроспектива.'],
19
+ nodes: [
20
+ goal('goal', ['Project goal', 'Ціль проєкту'], ['What does "done" look like?', 'Як виглядає «готово»?'], { color: 'blue' }),
21
+ goal('plan', ['Plan & scope', 'План і обсяг'], ['List the deliverables and the deadline.', 'Перелік результатів і дедлайн.']),
22
+ goal('p1', ['Phase 1', 'Етап 1'], ['First milestone', 'Перша віха']),
23
+ goal('p2', ['Phase 2', 'Етап 2'], ['Second milestone', 'Друга віха']),
24
+ goal('p3', ['Phase 3', 'Етап 3'], ['Final milestone', 'Фінальна віха']),
25
+ goal('launch', ['Launch', 'Запуск'], ['Ship it and announce.', 'Випустити й оголосити.'], { color: 'green' }),
26
+ goal('retro', ['Retrospective', 'Ретроспектива'], ['What worked, what to change next time.', 'Що спрацювало, що змінити наступного разу.']),
27
+ note('n1', ['Tip: select nodes and press Shift+L to tidy them up.', 'Порада: виділіть ноди й натисніть Shift+L, щоб упорядкувати їх.']),
28
+ ],
29
+ edges: [['goal', 'plan'], ['plan', 'p1'], ['p1', 'p2'], ['p2', 'p3'], ['p3', 'launch'], ['launch', 'retro'], ['n1', 'plan']],
30
+ },
31
+ {
32
+ key: 'decision',
33
+ icon: 'GitFork',
34
+ category: ['Decisions', 'Рішення'],
35
+ title: ['Decision with a fork', 'Рішення з розвилкою'],
36
+ description: ['A yes/no checkpoint with a plan for each outcome.', 'Контрольна точка «так/ні» з планом для кожного результату.'],
37
+ nodes: [
38
+ goal('problem', ['Problem', 'Проблема'], ['Describe what needs a decision.', 'Опишіть, що потребує рішення.'], { color: 'orange' }),
39
+ goal('research', ['Gather facts', 'Зібрати факти'], ['Data, opinions, constraints.', 'Дані, думки, обмеження.']),
40
+ choice('check', ['Is option A viable?', 'Варіант A реальний?'], ['Yes', 'Так'], ['No', 'Ні']),
41
+ goal('a', ['Go with A', 'Обрати A'], ['Next concrete step for A.', 'Наступний конкретний крок для A.'], { color: 'green' }),
42
+ goal('b', ['Plan B', 'План Б'], ['Fallback path.', 'Запасний шлях.'], { color: 'pink' }),
43
+ goal('review', ['Review in 2 weeks', 'Переглянути через 2 тижні'], ['Did the choice pay off?', 'Чи виправдав себе вибір?']),
44
+ ],
45
+ edges: [['problem', 'research'], ['research', 'check'], ['check', 'a', 'yes'], ['check', 'b', 'no'], ['a', 'review'], ['b', 'review']],
46
+ },
47
+ {
48
+ key: 'product-launch',
49
+ icon: 'Rocket',
50
+ category: ['Projects', 'Проєкти'],
51
+ title: ['Product launch', 'Запуск продукту'],
52
+ description: ['From idea to launch, with a demand check before building.', 'Від ідеї до запуску з перевіркою попиту до розробки.'],
53
+ nodes: [
54
+ goal('idea', ['Idea', 'Ідея'], ['One sentence: who is it for and why?', 'Одне речення: для кого і навіщо?'], { color: 'purple' }),
55
+ goal('interviews', ['Talk to 10 users', 'Поговорити з 10 користувачами'], ['Validate the problem.', 'Перевірити проблему.']),
56
+ choice('demand', ['Is there demand?', 'Є попит?'], ['Yes', 'Так'], ['No', 'Ні']),
57
+ goal('mvp', ['Build MVP', 'Зробити MVP'], ['Smallest version that solves the problem.', 'Найменша версія, що вирішує проблему.']),
58
+ goal('pivot', ['Pivot the idea', 'Змінити ідею'], ['Adjust the audience or the problem.', 'Змінити аудиторію або проблему.'], { color: 'pink' }),
59
+ goal('beta', ['Closed beta', 'Закрита бета'], ['5–20 real users.', '5–20 реальних користувачів.']),
60
+ goal('launch', ['Public launch', 'Публічний запуск'], ['Landing page, announcement, feedback loop.', 'Лендинг, анонс, збір відгуків.'], { color: 'green' }),
61
+ ],
62
+ edges: [['idea', 'interviews'], ['interviews', 'demand'], ['demand', 'mvp', 'yes'], ['demand', 'pivot', 'no'], ['mvp', 'beta'], ['beta', 'launch']],
63
+ },
64
+ {
65
+ key: 'learning',
66
+ icon: 'GraduationCap',
67
+ category: ['Learning', 'Навчання'],
68
+ title: ['Learning roadmap', 'План навчання'],
69
+ description: ['Basics, practice, deeper topics and a portfolio piece.', 'Основи, практика, поглиблення і проєкт у портфоліо.'],
70
+ nodes: [
71
+ goal('skill', ['Skill to learn', 'Навичка'], ['Why do you need it?', 'Навіщо вона вам?'], { color: 'blue' }),
72
+ goal('basics', ['Basics', 'Основи'], ['Course or book, 1–2 weeks.', 'Курс або книга, 1–2 тижні.']),
73
+ goal('practice', ['Small practice project', 'Невеликий практичний проєкт'], ['Apply the basics right away.', 'Одразу застосувати основи.']),
74
+ goal('advanced', ['Advanced topics', 'Поглиблені теми'], ['Pick 2–3 topics that matter for you.', 'Оберіть 2–3 важливі для вас теми.']),
75
+ goal('portfolio', ['Portfolio piece', 'Проєкт у портфоліо'], ['Something you can show.', 'Те, що можна показати.'], { color: 'green' }),
76
+ note('res', ['Resources: add links here.', 'Ресурси: додайте посилання сюди.']),
77
+ ],
78
+ edges: [['skill', 'basics'], ['basics', 'practice'], ['practice', 'advanced'], ['advanced', 'portfolio'], ['res', 'basics']],
79
+ },
80
+ {
81
+ key: 'sprint',
82
+ icon: 'CalendarRange',
83
+ category: ['Teams', 'Команди'],
84
+ title: ['Two-week sprint', 'Двотижневий спринт'],
85
+ description: ['Sprint goal, parallel tasks, review and demo.', 'Ціль спринту, паралельні задачі, рев’ю і демо.'],
86
+ nodes: [
87
+ goal('goal', ['Sprint goal', 'Ціль спринту'], ['One outcome the team commits to.', 'Один результат, який команда обіцяє.'], { color: 'blue' }),
88
+ goal('t1', ['Task A', 'Задача A'], ['Owner, estimate.', 'Відповідальний, оцінка.']),
89
+ goal('t2', ['Task B', 'Задача B'], ['Owner, estimate.', 'Відповідальний, оцінка.']),
90
+ goal('t3', ['Task C', 'Задача C'], ['Owner, estimate.', 'Відповідальний, оцінка.']),
91
+ goal('review', ['Code / work review', 'Рев’ю роботи'], ['Check quality before the demo.', 'Перевірити якість до демо.']),
92
+ goal('demo', ['Demo & retro', 'Демо і ретро'], ['Show results, agree on improvements.', 'Показати результат, домовитися про покращення.'], { color: 'green' }),
93
+ ],
94
+ edges: [['goal', 't1'], ['goal', 't2'], ['goal', 't3'], ['t1', 'review'], ['t2', 'review'], ['t3', 'review'], ['review', 'demo']],
95
+ },
96
+ {
97
+ key: 'job-search',
98
+ icon: 'Briefcase',
99
+ category: ['Career', 'Кар’єра'],
100
+ title: ['Job search', 'Пошук роботи'],
101
+ description: ['CV, applications and what to do after each answer.', 'Резюме, відгуки і що робити після кожної відповіді.'],
102
+ nodes: [
103
+ goal('target', ['Target role', 'Бажана посада'], ['Role, level, location, salary range.', 'Посада, рівень, локація, зарплата.'], { color: 'blue' }),
104
+ goal('cv', ['Update CV & profile', 'Оновити резюме і профіль'], ['Tailor to the target role.', 'Під цільову посаду.']),
105
+ goal('apply', ['Send 20 applications', 'Надіслати 20 відгуків'], ['Track them in a list.', 'Ведіть їх у списку.']),
106
+ choice('invite', ['Got interviews?', 'Є запрошення?'], ['Yes', 'Так'], ['No', 'Ні']),
107
+ goal('prepare', ['Prepare for interviews', 'Підготуватися до співбесід'], ['Stories, questions, test tasks.', 'Історії, питання, тестові.']),
108
+ goal('improve', ['Improve CV, ask for feedback', 'Покращити резюме, попросити фідбек'], ['Change one thing at a time.', 'Змінюйте по одному.'], { color: 'pink' }),
109
+ goal('offer', ['Offer', 'Офер'], ['Compare and negotiate.', 'Порівняти й домовитися.'], { color: 'green' }),
110
+ ],
111
+ edges: [['target', 'cv'], ['cv', 'apply'], ['apply', 'invite'], ['invite', 'prepare', 'yes'], ['invite', 'improve', 'no'], ['prepare', 'offer']],
112
+ },
113
+ ];
114
+
115
+ const toContent = (def, lang) => {
116
+ const nodes = def.nodes.map((n) => {
117
+ if (n.type === 'condition') {
118
+ return {
119
+ id: n.id,
120
+ type: 'condition',
121
+ data: {
122
+ label: L(lang, n.label),
123
+ options: [
124
+ { id: 'opt-yes', label: L(lang, n.yes) },
125
+ { id: 'opt-no', label: L(lang, n.no) },
126
+ ],
127
+ selectedOptions: [],
128
+ multiSelect: false,
129
+ },
130
+ };
131
+ }
132
+ if (n.type === 'comment') {
133
+ return {
134
+ id: n.id,
135
+ type: 'comment',
136
+ width: 220,
137
+ height: 150,
138
+ data: { label: L(lang, ['Note', 'Нотатка']), description: L(lang, n.label), color: n.color },
139
+ };
140
+ }
141
+ return {
142
+ id: n.id,
143
+ type: 'sketch',
144
+ data: { label: L(lang, n.label), description: L(lang, n.description), color: n.color, decision: 'bottom' },
145
+ };
146
+ });
147
+
148
+ const typeOf = (id) => def.nodes.find((n) => n.id === id)?.type;
149
+ const edges = def.edges.map(([from, to, branch], i) => {
150
+ if (typeOf(from) === 'comment' || typeOf(to) === 'comment') {
151
+ return { id: `e${i}`, source: from, target: to, sourceHandle: null, targetHandle: null };
152
+ }
153
+ return {
154
+ id: `e${i}`,
155
+ source: from,
156
+ target: to,
157
+ sourceHandle: typeOf(from) === 'condition' ? (branch === 'no' ? 'opt-no' : 'opt-yes') : 'main-source',
158
+ targetHandle: 'main-target',
159
+ };
160
+ });
161
+
162
+ return { version: 2, nodes, edges };
163
+ };
164
+
165
+ export const getBuiltinTemplates = (lang) =>
166
+ DEFINITIONS.map((def) => ({
167
+ id: `builtin:${def.key}`,
168
+ builtIn: true,
169
+ icon: def.icon,
170
+ category: L(lang, def.category),
171
+ title: L(lang, def.title),
172
+ description: L(lang, def.description),
173
+ content: toContent(def, lang),
174
+ }));
src/features/templates/templatesApi.js ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import axios from 'axios';
2
+
3
+ const API_URL = import.meta.env.VITE_API_URL;
4
+
5
+ // Templates saved before the v2 format stored backend node DTOs ({ Nodes: [{ Label, PosX, ... }] }).
6
+ const convertLegacy = (legacy) => {
7
+ const nodes = (legacy.Nodes || legacy.nodes || []).map((n) => {
8
+ const type = n.Type || n.type || 'sketch';
9
+ let extra = {};
10
+ const decision = n.Decision ?? n.decision;
11
+ if (typeof decision === 'string' && decision.startsWith('{')) {
12
+ try {
13
+ const parsed = JSON.parse(decision);
14
+ extra = type === 'condition'
15
+ ? { options: parsed.options || [], multiSelect: !!parsed.multiSelect }
16
+ : { description: parsed.description, tags: parsed.tags || [], color: parsed.color };
17
+ } catch {
18
+ // keep defaults
19
+ }
20
+ }
21
+ return {
22
+ id: String(n.Id || n.id),
23
+ type,
24
+ position: { x: n.PosX ?? n.posX ?? 0, y: n.PosY ?? n.posY ?? 0 },
25
+ data: {
26
+ label: n.Label || n.label || '',
27
+ description: n.Description || n.description || '',
28
+ color: n.Color || n.color || undefined,
29
+ ...extra,
30
+ },
31
+ };
32
+ }).filter((n) => n.type !== 'habit' && n.type !== 'path');
33
+
34
+ const ids = new Set(nodes.map((n) => n.id));
35
+ const typeOf = (id) => nodes.find((n) => n.id === id)?.type;
36
+ const edges = (legacy.Edges || legacy.edges || [])
37
+ .map((e, i) => {
38
+ const source = String(e.FromNodeId || e.fromNodeId);
39
+ const target = String(e.ToNodeId || e.toNodeId);
40
+ const condition = e.Condition || e.condition;
41
+ return {
42
+ id: `legacy-${i}`,
43
+ source,
44
+ target,
45
+ sourceHandle: typeOf(source) === 'condition' ? (condition === 'False' ? 'opt-no' : 'opt-yes') : 'main-source',
46
+ targetHandle: 'main-target',
47
+ };
48
+ })
49
+ .filter((e) => ids.has(e.source) && ids.has(e.target));
50
+
51
+ return { version: 2, nodes, edges };
52
+ };
53
+
54
+ export const parseTemplateContent = (raw) => {
55
+ try {
56
+ const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
57
+ if (parsed?.version === 2) return parsed;
58
+ return convertLegacy(parsed || {});
59
+ } catch {
60
+ return { version: 2, nodes: [], edges: [] };
61
+ }
62
+ };
63
+
64
+ const fromDto = (dto) => ({
65
+ id: dto.id,
66
+ builtIn: false,
67
+ icon: dto.icon,
68
+ category: dto.category,
69
+ title: dto.title,
70
+ description: dto.description,
71
+ createdAt: dto.createdAt,
72
+ content: parseTemplateContent(dto.content),
73
+ });
74
+
75
+ export const fetchMyTemplates = async () => {
76
+ const res = await axios.get(`${API_URL}/templates`);
77
+ return (res.data || []).map(fromDto);
78
+ };
79
+
80
+ export const createTemplate = async ({ title, description, category, icon, content }) => {
81
+ const res = await axios.post(`${API_URL}/templates`, {
82
+ title,
83
+ description,
84
+ category,
85
+ icon,
86
+ content: JSON.stringify(content),
87
+ });
88
+ return fromDto(res.data);
89
+ };
90
+
91
+ export const updateTemplate = async (id, patch) => {
92
+ const res = await axios.put(`${API_URL}/templates/${id}`, patch);
93
+ return fromDto(res.data);
94
+ };
95
+
96
+ export const deleteTemplate = async (id) => {
97
+ await axios.delete(`${API_URL}/templates/${id}`);
98
+ };
99
+
100
+ // A board created from a template on the dashboard receives its content through
101
+ // sessionStorage; the canvas inserts it right after the (empty) board loads.
102
+ const pendingKey = (boardId) => `tf_pending_template_${boardId}`;
103
+
104
+ export const setPendingTemplate = (boardId, content) => {
105
+ try {
106
+ sessionStorage.setItem(pendingKey(boardId), JSON.stringify(content));
107
+ } catch {
108
+ // storage full or unavailable: the board just starts empty
109
+ }
110
+ };
111
+
112
+ export const takePendingTemplate = (boardId) => {
113
+ try {
114
+ const raw = sessionStorage.getItem(pendingKey(boardId));
115
+ if (!raw) return null;
116
+ sessionStorage.removeItem(pendingKey(boardId));
117
+ return JSON.parse(raw);
118
+ } catch {
119
+ return null;
120
+ }
121
+ };
src/layouts/Layout.jsx CHANGED
@@ -1,8 +1,10 @@
1
- import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { Link, useLocation } from 'react-router-dom';
4
  import { useAuth } from '../context/AuthContext';
5
  import logo from '../assets/logo.png';
 
 
6
 
7
  const Layout = ({ children }) => {
8
  const { user } = useAuth();
@@ -11,14 +13,23 @@ const Layout = ({ children }) => {
11
 
12
  const [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false);
13
 
 
 
 
 
 
 
 
 
 
14
  const navItems = [
15
- { name: 'Product', href: '#ai-agent' },
16
- { name: 'How it Flows', href: '#how-it-works' },
17
- { name: 'Templates', href: '#templates' },
18
- { name: 'Pricing', href: '#pricing' }
19
  ];
20
 
21
- const [activeSection, setActiveSection] = React.useState('#ai-agent');
22
 
23
  React.useEffect(() => {
24
  if (!isLanding) return;
@@ -34,7 +45,7 @@ const Layout = ({ children }) => {
34
  entries.forEach(entry => {
35
  if (entry.isIntersecting) {
36
  if (entry.target.id === 'hero') {
37
- setActiveSection('#ai-agent');
38
  } else {
39
  setActiveSection(`#${entry.target.id}`);
40
  }
@@ -42,7 +53,7 @@ const Layout = ({ children }) => {
42
  });
43
  }, observerOptions);
44
 
45
- const sectionsToObserve = ['hero', 'ai-agent', 'how-it-works', 'templates', 'pricing'];
46
  sectionsToObserve.forEach(id => {
47
  const el = document.getElementById(id);
48
  if (el) observer.observe(el);
@@ -93,6 +104,13 @@ const Layout = ({ children }) => {
93
  </div>
94
 
95
  <div className="flex gap-6 items-center">
 
 
 
 
 
 
 
96
  <div className="hidden sm:flex gap-6 items-center">
97
  {user ? (
98
  <Link to="/dashboard">
@@ -101,13 +119,13 @@ const Layout = ({ children }) => {
101
  whileTap={{ scale: 0.95 }}
102
  className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all text-xl"
103
  >
104
- Go to Workspace
105
- </motion.button>
106
  </Link>
107
  ) : (
108
  <>
109
  <Link to="/auth">
110
- <button className="text-xl font-medium text-on-surface-variant hover:text-primary transition-colors">Log In</button>
111
  </Link>
112
  <Link to="/auth">
113
  <motion.button
@@ -115,8 +133,8 @@ const Layout = ({ children }) => {
115
  whileTap={{ scale: 0.95 }}
116
  className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all"
117
  >
118
- Start Sketching
119
- </motion.button>
120
  </Link>
121
  </>
122
  )}
@@ -162,15 +180,15 @@ const Layout = ({ children }) => {
162
  <div className="flex flex-col gap-4 pt-6 border-t border-dashed border-primary/20">
163
  {user ? (
164
  <Link to="/dashboard" onClick={() => setIsMobileMenuOpen(false)}>
165
- <button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">Go to Workspace</button>
166
  </Link>
167
  ) : (
168
  <>
169
  <Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}>
170
- <button className="w-full py-4 text-2xl font-bold text-primary rough-border">Log In</button>
171
  </Link>
172
  <Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}>
173
- <button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">Start Sketching</button>
174
  </Link>
175
  </>
176
  )}
@@ -195,12 +213,12 @@ const Layout = ({ children }) => {
195
  <span>TaskFlow</span>
196
  </div>
197
  <div className="text-xl text-on-surface-variant">
198
- © 2026 TaskFlow. Designed for focus, built for resilience.
199
  </div>
200
  </div>
201
  <div className="flex flex-wrap gap-10 items-center md:justify-end">
202
- {['Privacy', 'Terms', 'Twitter', 'Changelog'].map(item => (
203
- <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>
204
  ))}
205
  </div>
206
  </div>
 
1
+ import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { Link, useLocation } from 'react-router-dom';
4
  import { useAuth } from '../context/AuthContext';
5
  import logo from '../assets/logo.png';
6
+ import { useTranslation } from 'react-i18next';
7
+ import { getLandingCopy } from '../features/landing/landingCopy';
8
 
9
  const Layout = ({ children }) => {
10
  const { user } = useAuth();
 
13
 
14
  const [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false);
15
 
16
+ const { i18n } = useTranslation();
17
+ const copy = getLandingCopy(i18n.language).nav;
18
+ const isUk = i18n.language?.startsWith('uk');
19
+ const toggleLanguage = () => {
20
+ const next = isUk ? 'en' : 'uk';
21
+ i18n.changeLanguage(next);
22
+ try { localStorage.setItem('language', next); } catch { /* ignore */ }
23
+ };
24
+
25
  const navItems = [
26
+ { name: copy.product, href: '#product' },
27
+ { name: copy.how, href: '#how-it-works' },
28
+ { name: copy.templates, href: '#templates' },
29
+ { name: copy.pricing, href: '#pricing' }
30
  ];
31
 
32
+ const [activeSection, setActiveSection] = React.useState('#product');
33
 
34
  React.useEffect(() => {
35
  if (!isLanding) return;
 
45
  entries.forEach(entry => {
46
  if (entry.isIntersecting) {
47
  if (entry.target.id === 'hero') {
48
+ setActiveSection('#product');
49
  } else {
50
  setActiveSection(`#${entry.target.id}`);
51
  }
 
53
  });
54
  }, observerOptions);
55
 
56
+ const sectionsToObserve = ['hero', 'product', 'how-it-works', 'templates', 'pricing'];
57
  sectionsToObserve.forEach(id => {
58
  const el = document.getElementById(id);
59
  if (el) observer.observe(el);
 
104
  </div>
105
 
106
  <div className="flex gap-6 items-center">
107
+ <button
108
+ onClick={toggleLanguage}
109
+ 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"
110
+ title={isUk ? 'English' : 'Українська'}
111
+ >
112
+ {isUk ? 'EN' : 'UA'}
113
+ </button>
114
  <div className="hidden sm:flex gap-6 items-center">
115
  {user ? (
116
  <Link to="/dashboard">
 
119
  whileTap={{ scale: 0.95 }}
120
  className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all text-xl"
121
  >
122
+ {copy.workspace}
123
+ </motion.button>
124
  </Link>
125
  ) : (
126
  <>
127
  <Link to="/auth">
128
+ <button className="text-xl font-medium text-on-surface-variant hover:text-primary transition-colors">{copy.login}</button>
129
  </Link>
130
  <Link to="/auth">
131
  <motion.button
 
133
  whileTap={{ scale: 0.95 }}
134
  className="bg-primary text-on-primary font-bold py-3 px-6 rough-border rough-shadow-hover transition-all"
135
  >
136
+ {copy.start}
137
+ </motion.button>
138
  </Link>
139
  </>
140
  )}
 
180
  <div className="flex flex-col gap-4 pt-6 border-t border-dashed border-primary/20">
181
  {user ? (
182
  <Link to="/dashboard" onClick={() => setIsMobileMenuOpen(false)}>
183
+ <button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">{copy.workspace}</button>
184
  </Link>
185
  ) : (
186
  <>
187
  <Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}>
188
+ <button className="w-full py-4 text-2xl font-bold text-primary rough-border">{copy.login}</button>
189
  </Link>
190
  <Link to="/auth" onClick={() => setIsMobileMenuOpen(false)}>
191
+ <button className="w-full py-4 text-2xl font-bold bg-primary text-on-primary rough-border rough-shadow">{copy.start}</button>
192
  </Link>
193
  </>
194
  )}
 
213
  <span>TaskFlow</span>
214
  </div>
215
  <div className="text-xl text-on-surface-variant">
216
+ © 2026 TaskFlow
217
  </div>
218
  </div>
219
  <div className="flex flex-wrap gap-10 items-center md:justify-end">
220
+ {navItems.map(item => (
221
+ <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>
222
  ))}
223
  </div>
224
  </div>
src/locales/en.json CHANGED
@@ -1,466 +1,541 @@
1
- {
2
- "common": {
3
- "back": "Back",
4
- "yes": "Yes",
5
- "no": "No",
6
- "hours_short": "h",
7
- "minutes_short": "m",
8
- "seconds_short": "s",
9
- "add": "Add",
10
- "apply": "Apply",
11
- "cancel": "Cancel",
12
- "delete": "Delete",
13
- "days_short": {
14
- "sun": "Sun",
15
- "mon": "Mon",
16
- "tue": "Tue",
17
- "wed": "Wed",
18
- "thu": "Thu",
19
- "fri": "Fri",
20
- "sat": "Sat"
21
- },
22
- "days": {
23
- "sun": "Sunday",
24
- "mon": "Monday",
25
- "tue": "Tuesday",
26
- "wed": "Wednesday",
27
- "thu": "Thursday",
28
- "fri": "Friday",
29
- "sat": "Saturday"
30
- }
31
- },
32
- "sidebar": {
33
- "projects": "Projects",
34
- "canvas": "Canvas",
35
- "habits": "Habits",
36
- "profile": "Profile",
37
- "settings": "Settings",
38
- "free_plan": "Free Plan",
39
- "upgrade_now": "Upgrade Now",
40
- "logout": "Log Out",
41
- "free_active": "AI: {{count}}/3 daily",
42
- "pro_active": "AI: {{count}}/200 daily",
43
- "ultra_active": "All Limits Unlocked",
44
- "go_ultra": "Go Ultra"
45
- },
46
- "landing": {
47
- "slogan": "TaskFlow in your pocket. Always in sync",
48
- "title": "TaskFlow",
49
- "description": "Unleash your potential, track goals, and build habits.",
50
- "get_started": "Get Started",
51
- "login": "Log In",
52
- "features": "Features",
53
- "visual_goals": "Visual Goals",
54
- "ai_generation": "AI Generation",
55
- "habit_streaks": "Habit Streaks",
56
- "hero_title_p1": "Plans break.",
57
- "hero_title_p2": "TaskFlow adapts.",
58
- "hero_desc": "The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life\u0027s \"If/Then\" moments.",
59
- "hero_badge": "ADHD-friendly. Resilience-driven.",
60
- "node_a": "Task A",
61
- "node_b": "Task B",
62
- "node_failed": "Failed?",
63
- "node_c": "Task C",
64
- "node_d": "Task D",
65
- "adhd_edge": "The ADHD Edge",
66
- "ai_find_path": "Let AI find the path when you get stuck.",
67
- "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.",
68
- "ai_example_input": "I\u0027m blocked on user growth. What now?",
69
- "ai_adapt_plan": "Adapt Plan",
70
- "ai_early_users": "Acquire Early Users",
71
- "cross_platform": "Cross-Platform",
72
- "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.",
73
- "cta_title_p1": "Stop fighting your brain.",
74
- "cta_title_p2": "Start sketching paths."
75
- },
76
- "pricing": {
77
- "title": "Simple Pricing",
78
- "subtitle": "No hidden fees, just plain ink.",
79
- "free": "Free",
80
- "pro": "Pro",
81
- "team": "Team",
82
- "month": "month",
83
- "user": "user",
84
- "start_free": "Start Free",
85
- "go_pro": "Go Pro",
86
- "contact_us": "Contact Us",
87
- "free_feat1": "3 Infinite Canvases",
88
- "free_feat2": "Basic shapes \u0026 logic",
89
- "free_feat3": "Community templates",
90
- "pro_feat1": "Unlimited Canvases",
91
- "pro_feat2": "AI Path Generation",
92
- "pro_feat3": "Advanced Habit Tracking",
93
- "pro_feat4": "Priority Support",
94
- "team_feat1": "Everything in Pro",
95
- "team_feat2": "Real-time Collaboration",
96
- "team_feat3": "Team Workspaces",
97
- "team_feat4": "Admin Tools",
98
- "premium_feature": "Premium Feature",
99
- "paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.",
100
- "upgrade_premium": "Upgrade to Premium",
101
- "maybe_later": "Maybe Later"
102
- },
103
- "auth": {
104
- "welcome_back": "Welcome Back!",
105
- "create_account": "Create Account",
106
- "sign_in_desc": "Sign in to continue your journey",
107
- "sign_up_desc": "Join TaskFlow to achieve your goals",
108
- "email": "Email Address",
109
- "password": "Password",
110
- "name": "Full Name",
111
- "sign_in": "Sign In",
112
- "sign_up": "Sign Up",
113
- "no_account": "Don\u0027t have an account? Sign up",
114
- "has_account": "Already have an account? Sign in",
115
- "passwords_do_not_match": "Passwords do not match",
116
- "start_flow": "Start Your Flow",
117
- "plans_waiting": "Your plans are waiting for you.",
118
- "join_revolution": "Join the visual revolution.",
119
- "full_name": "Full Name",
120
- "enter_name": "Enter your name",
121
- "forgot": "Forgot?",
122
- "confirm_password": "Confirm Password",
123
- "processing": "Processing...",
124
- "enter_workspace": "Enter Workspace",
125
- "or_continue": "Or continue with",
126
- "google_failed": "Google Login Failed",
127
- "dont_have_account": "Don\u0027t have an account? Sign Up",
128
- "already_member": "Already a member? Log In"
129
- },
130
- "onboarding": {
131
- "title": "Welcome to TaskFlow",
132
- "subtitle": "Let\u0027s set up your goal strategist",
133
- "step1_title": "Visual Goal Nodes",
134
- "step1_desc": "Map your dreams as interconnected nodes on a gorgeous canvas. Break down large goals into small steps.",
135
- "step2_title": "Dynamic Logic \u0026 Streaks",
136
- "step2_desc": "Add condition checks (Yes/No choices) to model alternative paths. Hook up habits and watch your streaks thrive.",
137
- "step3_title": "AI Goal Adaptation",
138
- "step3_desc": "Ask our AI strategist to adapt your plan when blocks happen. TaskFlow automatically drafts new paths.",
139
- "next": "Next",
140
- "back": "Back",
141
- "lets_go": "Let\u0027s Go!",
142
- "step_0": {
143
- "title": "The Canvas of Goals",
144
- "description": "Forget linear lists. TaskFlow is a digital sketchbook where your ideas live in a visual graph. Pan, zoom, and expand your thoughts infinitely.",
145
- "note": "Your brain isn\u0027t a list, so why should your tasks be?"
146
- },
147
- "step_1": {
148
- "title": "Logic \u0026 Connections",
149
- "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.",
150
- "note": "If A happens, then B. If not, try C."
151
- },
152
- "step_2": {
153
- "title": "AI Adaptation",
154
- "description": "Hit a wall? Mark a node as \u0027Blocked\u0027 and let the AI Assistant sketch out alternative routes to your goal instantly.",
155
- "note": "AI handles the cognitive load when you\u0027re stuck."
156
- },
157
- "step_3": {
158
- "title": "Dopamine \u0026 Focus",
159
- "description": "Earn points for completing branches and maintain daily streaks. TaskFlow is designed to keep you motivated and focused on the big picture.",
160
- "note": "Turn the grind into a game you enjoy."
161
- },
162
- "visual": {
163
- "goal": "Goal",
164
- "success": "Success",
165
- "blocked": "Blocked",
166
- "ai_generating": "AI generating...",
167
- "streak_text": "14 Day Streak!"
168
- },
169
- "step_indicator": "Step {{current}} of {{total}}",
170
- "begin": "Let\u0027s Begin!",
171
- "next_chapter": "Next Chapter"
172
- },
173
- "dashboard": {
174
- "your_projects": "Your Projects",
175
- "search_placeholder": "Search projects...",
176
- "new_blank_canvas": "New Blank Canvas",
177
- "project": "Project",
178
- "active_steps": "active steps",
179
- "loading_projects": "Loading projects...",
180
- "no_projects": "No projects yet. Create a blank canvas to begin!",
181
- "create_project_title": "Create New Project",
182
- "project_name": "Project Name",
183
- "project_desc": "Project Description",
184
- "cancel": "Cancel",
185
- "create": "Create",
186
- "delete_title": "Delete Project",
187
- "delete_confirm": "Are you sure you want to delete this project? This action cannot be undone.",
188
- "delete": "Delete"
189
- },
190
- "habits": {
191
- "habit_tracker": "Habit Tracker",
192
- "consistency_score": "Consistency Score",
193
- "consistency_desc": "You\u0027re in the top 5% of strategists this week!",
194
- "active_streak": "Active Streak",
195
- "days": "days",
196
- "today_check_in": "Today\u0027s Habit Checklist",
197
- "weekly_streak": "Weekly Streak Calendar",
198
- "streak": "streak",
199
- "no_habits": "No habits currently tracked. Add custom habits to your goal canvas to see them here!",
200
- "complete": "Complete",
201
- "pending": "Pending",
202
- "loading": "Loading habit canvases...",
203
- "no_habits_title": "No Habit Canvases Yet",
204
- "reward_desc": "Complete habits on your strategy maps to level up quicker.",
205
- "track_for_date": "Track for {{date}}",
206
- "complete_notification_title": "Habit Completed! 🔥",
207
- "complete_notification_desc_custom": "Recorded check-in for {{date}}",
208
- "complete_notification_desc": "Dynamic streak increased! +50 XP awarded!",
209
- "recharge_notification_title": "Habit Recharged! ⚡",
210
- "recharge_notification_desc": "Habit \"{{name}}\" is ready to be performed again!",
211
- "recharge_notification_header": "HABIT READY"
212
- },
213
- "profile": {
214
- "profile": "Profile",
215
- "user_level": "User Level",
216
- "experience": "Experience",
217
- "stats": "Statistics",
218
- "completed_goals": "Completed Goals",
219
- "active_habits": "Active Habits",
220
- "experience_points": "Experience Points",
221
- "level_progress": "Level Progress",
222
- "achievements": "Achievements Notebook",
223
- "unlocked": "Unlocked",
224
- "locked": "Locked",
225
- "total_points": "Total Points"
226
- },
227
- "settings": {
228
- "settings": "Settings",
229
- "general": "General",
230
- "canvas": "Canvas Settings",
231
- "account_billing": "Account \u0026 Billing",
232
- "theme": "App Preferences",
233
- "preferred_language": "Preferred Language",
234
- "theme_label": "Visual Theme",
235
- "dark_mode": "Dark Theme",
236
- "light_mode": "Light Theme",
237
- "security": "Security",
238
- "update_password": "Update Password",
239
- "delete_account": "Delete Account",
240
- "subscription": "Subscription Plan",
241
- "upgrade_pro": "Upgrade to TaskFlow Pro",
242
- "cancel_sub": "Cancel Subscription",
243
- "saved_success": "Settings updated successfully!",
244
- "slogan": "Tune your workspace to perfection.",
245
- "general_preferences": "General Preferences",
246
- "theme_desc": "Switch between light and dark themes.",
247
- "notifications_title": "Desktop Notifications",
248
- "notifications_desc": "Receive alerts for task deadlines and habit reminders.",
249
- "language_desc": "Select your primary interface language.",
250
- "canvas_behavior": "Canvas Behavior",
251
- "ai_guidance_title": "AI Active Guidance",
252
- "ai_guidance_desc": "Let AI proactively suggest alternative paths when you mark a node as blocked.",
253
- "snap_to_grid_title": "Snap to Grid",
254
- "snap_to_grid_desc": "Automatically align nodes to the graph paper lines for a cleaner look.",
255
- "default_node_color": "Default Node Color",
256
- "data_management": "Data Management",
257
- "export_json": "Export as JSON",
258
- "import_vault": "Import Vault",
259
- "danger_zone": "Danger Zone",
260
- "delete_desc": "This action is irreversible. All your maps and habits will be wiped.",
261
- "delete_forever": "Delete Forever"
262
- },
263
- "canvas": {
264
- "new_goal": "New Goal",
265
- "new_habit": "New Habit",
266
- "new_condition": "New Condition?",
267
- "ai_assistant": "AI Assistant",
268
- "ai_thinking": "AI Thinking...",
269
- "premium_feature": "Premium Feature",
270
- "paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.",
271
- "upgrade_premium": "Upgrade to Premium",
272
- "maybe_later": "Maybe Later",
273
- "roadmap_strategist": "Roadmap Strategist",
274
- "drafting_roadmap": "Drafting your Roadmap...",
275
- "strategist_desc": "\" The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas... \"",
276
- "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. \"",
277
- "quick_suggestions": "Quick Suggestions",
278
- "suggestion_detail": "Detail current step into subtasks",
279
- "suggestion_route": "Suggest alternative route in case of failure",
280
- "suggestion_habits": "Create daily habits to reinforce this goal",
281
- "input_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...",
282
- "tag_detail": "Detailing",
283
- "tag_route": "Route",
284
- "tag_habits": "Habits",
285
- "condition_yes": "Yes",
286
- "condition_no": "No",
287
- "condition_node_label": "Condition",
288
- "ai_suggest_details": "Break down the current step into subtasks",
289
- "ai_suggest_details_tag": "Breakdown",
290
- "ai_suggest_route": "Suggest an alternative route in case of failure",
291
- "ai_suggest_route_tag": "Alternative",
292
- "canvas.ai_suggest_habits": "Create daily habits to reinforce this goal",
293
- "ai_suggest_habits_tag": "Habits",
294
- "ai_roadmap_strategist": "Roadmap Strategist",
295
- "ai_maintenance_title": "AI Under Maintenance",
296
- "ai_maintenance_desc": "We are upgrading our AI strategist to deliver even faster, more accurate, and flexible plan generation. Thank you for your patience!",
297
- "ai_maintenance_btn": "Got it",
298
- "ai_drafting": "Drafting your Roadmap...",
299
- "ai_drafting_desc": "The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas...",
300
- "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.",
301
- "ai_quick_suggestions": "Quick Suggestions",
302
- "ai_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...",
303
- "condition": "Condition",
304
- "strategic_goal_map": "Strategic Goal Map",
305
- "save_strategy": "Save Strategy",
306
- "saving": "Saving...",
307
- "export_empty_error": "The map is empty! Add nodes before exporting.",
308
- "subgoal_warning": "Cannot complete: please finish all sub-goals first!",
309
- "subgoals_progress": "Sub-goals: {{done}}/{{total}} Done",
310
- "export_error": "Error exporting to PNG:",
311
- "habit": "Habit",
312
- "habit_status": "Status",
313
- "habit_status_done": "Done",
314
- "habit_status_pending": "Pending",
315
- "habit_action_done": "Done!",
316
- "habit_action_todo": "Complete",
317
- "habit_reset_rule": "Reset Rule",
318
- "habit_countdown_label": "Reset in",
319
- "habit_resetting": "Resetting...",
320
- "habit_signal_active": "SENDING SIGNAL ⚡",
321
- "habit_signal_inactive": "SIGNAL OFF 💤",
322
- "habit_test_reset": "Test Reset",
323
- "habit_test_reset_tooltip": "Reset habit and all downstream goals in the chain now",
324
- "habit_rule_daily": "Daily at {{time}}",
325
- "habit_rule_weekly": "Weekly ({{day}}) at {{time}}",
326
- "habit_rule_hourly": "Every {{hours}}h",
327
- "habit_rule_minutely": "Every {{minutes}}m",
328
- "habit_rule_days": "Every {{days}}d",
329
- "habit_rule_mixed": "Every {{hours}}h {{minutes}}m",
330
- "habit_reset_hours_label": "Hours",
331
- "habit_reset_minutes_label": "Minutes",
332
- "condition_min_options_error": "A condition must have at least one option (pin)!",
333
- "condition_settings_title": "Condition Settings",
334
- "condition_text_label": "Condition Text",
335
- "condition_text_placeholder": "e.g. Payment successful?",
336
- "condition_options_label": "Options (Output Pins)",
337
- "condition_multiselect_label": "Multi-choice Options",
338
- "condition_multiselect_desc": "Allow multiple outputs to activate simultaneously",
339
- "habit_settings_title": "Habit Settings",
340
- "habit_name_label": "Habit Name",
341
- "habit_name_placeholder": "e.g. Learning English",
342
- "habit_description_label": "Description / Note",
343
- "habit_description_placeholder": "Details or motivation...",
344
- "habit_reset_mode_label": "Reset Mode",
345
- "habit_reset_daily": "Every day (Daily)",
346
- "habit_reset_weekly": "Every week (Weekly)",
347
- "habit_reset_interval": "Custom Interval",
348
- "habit_reset_time_label": "Reset Time (default 00:00)",
349
- "habit_reset_time_label_short": "Reset Time",
350
- "habit_reset_day_label": "Day of the week",
351
- "habit_reset_interval_value": "Reset every",
352
- "habit_interval_minutes": "minutes",
353
- "habit_interval_hours": "hours",
354
- "habit_interval_days": "days",
355
- "context_menu": {
356
- "create_node": "Create Node",
357
- "goal_node": "Goal (Sketch Node)",
358
- "subgoal_node": "Sub-goal",
359
- "condition_node": "Condition",
360
- "habit_node": "Habit",
361
- "export_png": "Export to PNG",
362
- "delete": "Delete"
363
- }
364
- },
365
- "achievements": {
366
- "unlocked_header": "Achievement Unlocked!",
367
- "notification_header": "Notification",
368
- "blank_canvas": {
369
- "title": "Blank Canvas",
370
- "description": "Create your first project (Graph)."
371
- },
372
- "connecting_the_dots": {
373
- "title": "Connecting the Dots",
374
- "description": "Create 10 connections (Edges) between tasks."
375
- },
376
- "sketch_master": {
377
- "title": "Sketch Master",
378
- "description": "Create 100 task nodes overall."
379
- },
380
- "daily_doodler": {
381
- "title": "Daily Doodler",
382
- "description": "Track habits 7 times."
383
- },
384
- "decision_maker": {
385
- "title": "Decision Maker",
386
- "description": "Complete 50 tasks."
387
- },
388
- "clear_desk": {
389
- "title": "Clear Desk",
390
- "description": "Delete 5 projects."
391
- },
392
- "first_milestone": {
393
- "title": "First Milestone",
394
- "description": "Complete your first task."
395
- },
396
- "self_portrait": {
397
- "title": "Self Portrait",
398
- "description": "Upload your profile avatar."
399
- }
400
- },
401
- "subscription": {
402
- "title": "Unlock the Pro Tools of TaskFlow",
403
- "title_p1": "Unlock the ",
404
- "title_highlight": "Pro Tools",
405
- "title_p2": " of TaskFlow",
406
- "subtitle": "Stop guessing. Start mapping with AI guidance and unlimited creative freedom.",
407
- "most_recommended": "Most Recommended",
408
- "per_month": "/ month",
409
- "social_proof": "Trusted by 10,000+ Visionary Strategists worldwide",
410
- "features": {
411
- "ai_genius": "AI Genius",
412
- "ai_genius_desc": "GPT-4 powered path generation",
413
- "infinite": "Infinite",
414
- "infinite_desc": "No limits on nodes or connections",
415
- "secure": "Secure",
416
- "secure_desc": "Bank-level AES-256 encryption",
417
- "custom": "Custom",
418
- "custom_desc": "Full palette of sketchbook themes"
419
- },
420
- "plans": {
421
- "free": {
422
- "title": "Free Starter",
423
- "desc": "Perfect for testing and simple goal mapping.",
424
- "btn": "Stay on Free",
425
- "feat1": "3 AI generations per day",
426
- "feat2": "Maximum 3 canvases",
427
- "feat3": "Maximum 200 nodes per canvas",
428
- "feat4": "Maximum 3 habits",
429
- "feat5": "Maximum 2 people on board"
430
- },
431
- "pro": {
432
- "title": "Sketchbook Pro",
433
- "desc": "Unlock unlimited strategies with 200 daily AI construct operations.",
434
- "btn": "Upgrade to Pro",
435
- "feat1": "200 AI generations per day",
436
- "feat2": "Unlimited canvases \u0026 nodes",
437
- "feat3": "Unlimited habits",
438
- "feat4": "Maximum 10 people on board",
439
- "feat5": "Advanced Strategy analytics"
440
- },
441
- "ultra": {
442
- "title": "Sketchbook Ultra",
443
- "desc": "The ultimate strategy sandbox. Fully unlimited everything + templates.",
444
- "btn": "Upgrade to Ultra",
445
- "feat1": "Unlimited AI generations",
446
- "feat2": "Unlimited canvases \u0026 nodes",
447
- "feat3": "Unlimited habits",
448
- "feat4": "Unlimited people on board",
449
- "feat5": "Create custom templates",
450
- "feat6": "Priority support \u0026 VIP strategy tools"
451
- }
452
- },
453
- "upgrade_success": "Plan switched to {{tier}} successfully!",
454
- "upgrading": "Upgrading...",
455
- "current_plan": "Current Plan",
456
- "compare": {
457
- "feature": "Feature",
458
- "ai_gens": "AI Generations / day",
459
- "canvases": "Canvases",
460
- "nodes": "Nodes per canvas",
461
- "habits": "Habits",
462
- "board_members": "Board members",
463
- "custom_templates": "Custom Templates"
464
- }
465
- }
466
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "common": {
3
+ "back": "Back",
4
+ "yes": "Yes",
5
+ "no": "No",
6
+ "hours_short": "h",
7
+ "minutes_short": "m",
8
+ "seconds_short": "s",
9
+ "add": "Add",
10
+ "apply": "Apply",
11
+ "cancel": "Cancel",
12
+ "delete": "Delete",
13
+ "days_short": {
14
+ "sun": "Sun",
15
+ "mon": "Mon",
16
+ "tue": "Tue",
17
+ "wed": "Wed",
18
+ "thu": "Thu",
19
+ "fri": "Fri",
20
+ "sat": "Sat"
21
+ },
22
+ "days": {
23
+ "sun": "Sunday",
24
+ "mon": "Monday",
25
+ "tue": "Tuesday",
26
+ "wed": "Wednesday",
27
+ "thu": "Thursday",
28
+ "fri": "Friday",
29
+ "sat": "Saturday"
30
+ }
31
+ },
32
+ "sidebar": {
33
+ "projects": "Projects",
34
+ "canvas": "Canvas",
35
+ "habits": "Habits",
36
+ "profile": "Profile",
37
+ "settings": "Settings",
38
+ "free_plan": "Free Plan",
39
+ "upgrade_now": "Upgrade Now",
40
+ "logout": "Log Out",
41
+ "free_active": "AI: {{count}}/3 daily",
42
+ "pro_active": "AI: {{count}}/200 daily",
43
+ "ultra_active": "All Limits Unlocked",
44
+ "go_ultra": "Go Ultra",
45
+ "boards_used": "{{used}}/{{max}} boards",
46
+ "plus_active": "No limits",
47
+ "free_limits": "Up to {{nodes}} nodes per board",
48
+ "get_plus": "Get Plus"
49
+ },
50
+ "landing": {
51
+ "slogan": "TaskFlow in your pocket. Always in sync",
52
+ "title": "TaskFlow",
53
+ "description": "Unleash your potential, track goals, and build habits.",
54
+ "get_started": "Get Started",
55
+ "login": "Log In",
56
+ "features": "Features",
57
+ "visual_goals": "Visual Goals",
58
+ "ai_generation": "AI Generation",
59
+ "habit_streaks": "Habit Streaks",
60
+ "hero_title_p1": "Plans break.",
61
+ "hero_title_p2": "TaskFlow adapts.",
62
+ "hero_desc": "The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life's \"If/Then\" moments.",
63
+ "hero_badge": "ADHD-friendly. Resilience-driven.",
64
+ "node_a": "Task A",
65
+ "node_b": "Task B",
66
+ "node_failed": "Failed?",
67
+ "node_c": "Task C",
68
+ "node_d": "Task D",
69
+ "adhd_edge": "The ADHD Edge",
70
+ "ai_find_path": "Let AI find the path when you get stuck.",
71
+ "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.",
72
+ "ai_example_input": "I'm blocked on user growth. What now?",
73
+ "ai_adapt_plan": "Adapt Plan",
74
+ "ai_early_users": "Acquire Early Users",
75
+ "cross_platform": "Cross-Platform",
76
+ "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.",
77
+ "cta_title_p1": "Stop fighting your brain.",
78
+ "cta_title_p2": "Start sketching paths."
79
+ },
80
+ "pricing": {
81
+ "title": "Simple Pricing",
82
+ "subtitle": "No hidden fees, just plain ink.",
83
+ "free": "Free",
84
+ "pro": "Pro",
85
+ "team": "Team",
86
+ "month": "month",
87
+ "user": "user",
88
+ "start_free": "Start Free",
89
+ "go_pro": "Go Pro",
90
+ "contact_us": "Contact Us",
91
+ "free_feat1": "3 Infinite Canvases",
92
+ "free_feat2": "Basic shapes & logic",
93
+ "free_feat3": "Community templates",
94
+ "pro_feat1": "Unlimited Canvases",
95
+ "pro_feat2": "AI Path Generation",
96
+ "pro_feat3": "Advanced Habit Tracking",
97
+ "pro_feat4": "Priority Support",
98
+ "team_feat1": "Everything in Pro",
99
+ "team_feat2": "Real-time Collaboration",
100
+ "team_feat3": "Team Workspaces",
101
+ "team_feat4": "Admin Tools",
102
+ "premium_feature": "Premium Feature",
103
+ "paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.",
104
+ "upgrade_premium": "Upgrade to Premium",
105
+ "maybe_later": "Maybe Later"
106
+ },
107
+ "auth": {
108
+ "welcome_back": "Welcome Back!",
109
+ "create_account": "Create Account",
110
+ "sign_in_desc": "Sign in to continue your journey",
111
+ "sign_up_desc": "Join TaskFlow to achieve your goals",
112
+ "email": "Email Address",
113
+ "password": "Password",
114
+ "name": "Full Name",
115
+ "sign_in": "Sign In",
116
+ "sign_up": "Sign Up",
117
+ "no_account": "Don't have an account? Sign up",
118
+ "has_account": "Already have an account? Sign in",
119
+ "passwords_do_not_match": "Passwords do not match",
120
+ "start_flow": "Start Your Flow",
121
+ "plans_waiting": "Your plans are waiting for you.",
122
+ "join_revolution": "Join the visual revolution.",
123
+ "full_name": "Full Name",
124
+ "enter_name": "Enter your name",
125
+ "forgot": "Forgot?",
126
+ "confirm_password": "Confirm Password",
127
+ "processing": "Processing...",
128
+ "enter_workspace": "Enter Workspace",
129
+ "or_continue": "Or continue with",
130
+ "google_failed": "Google Login Failed",
131
+ "dont_have_account": "Don't have an account? Sign Up",
132
+ "already_member": "Already a member? Log In"
133
+ },
134
+ "onboarding": {
135
+ "title": "Welcome to TaskFlow",
136
+ "subtitle": "Let's set up your goal map",
137
+ "step1_title": "Visual Goal Nodes",
138
+ "step1_desc": "Map your dreams as interconnected nodes on a gorgeous canvas. Break down large goals into small steps.",
139
+ "step2_title": "Dynamic logic",
140
+ "step2_desc": "Add condition checks (Yes/No choices) to model alternative paths.",
141
+ "step3_title": "Auto-layout & templates",
142
+ "step3_desc": "Start from a template and keep the board tidy with one click.",
143
+ "next": "Next",
144
+ "back": "Back",
145
+ "lets_go": "Let's Go!",
146
+ "step_0": {
147
+ "title": "The Canvas of Goals",
148
+ "description": "Forget linear lists. TaskFlow is a digital sketchbook where your ideas live in a visual graph. Pan, zoom, and expand your thoughts infinitely.",
149
+ "note": "Your brain isn't a list, so why should your tasks be?"
150
+ },
151
+ "step_1": {
152
+ "title": "Logic & Connections",
153
+ "description": "Connect nodes with 'If/Then' logic. Define what happens if a task succeeds or fails. Build a resilient plan that handles every contingency.",
154
+ "note": "If A happens, then B. If not, try C."
155
+ },
156
+ "step_2": {
157
+ "title": "Auto-layout & templates",
158
+ "description": "Start from a template, and when the board gets messy press Shift+L — TaskFlow arranges every step into a tidy flow.",
159
+ "note": "Less time dragging boxes, more time doing."
160
+ },
161
+ "step_3": {
162
+ "title": "Dopamine & Focus",
163
+ "description": "Earn points for completed steps and unlock achievements. TaskFlow keeps you motivated and focused on the big picture.",
164
+ "note": "Turn the grind into a game you enjoy."
165
+ },
166
+ "visual": {
167
+ "goal": "Goal",
168
+ "success": "Success",
169
+ "blocked": "Messy board",
170
+ "ai_generating": "Shift+L",
171
+ "streak_text": "Achievement unlocked!"
172
+ },
173
+ "step_indicator": "Step {{current}} of {{total}}",
174
+ "begin": "Let's Begin!",
175
+ "next_chapter": "Next Chapter"
176
+ },
177
+ "dashboard": {
178
+ "your_projects": "Your Projects",
179
+ "search_placeholder": "Search projects...",
180
+ "new_blank_canvas": "New Blank Canvas",
181
+ "project": "Project",
182
+ "active_steps": "active steps",
183
+ "loading_projects": "Loading projects...",
184
+ "no_projects": "No projects yet. Create a blank canvas to begin!",
185
+ "create_project_title": "Create New Project",
186
+ "project_name": "Project Name",
187
+ "project_desc": "Project Description",
188
+ "cancel": "Cancel",
189
+ "create": "Create",
190
+ "delete_title": "Delete Project",
191
+ "delete_confirm": "Are you sure you want to delete this project? This action cannot be undone.",
192
+ "delete": "Delete"
193
+ },
194
+ "habits": {
195
+ "habit_tracker": "Habit Tracker",
196
+ "consistency_score": "Consistency Score",
197
+ "consistency_desc": "You're in the top 5% of strategists this week!",
198
+ "active_streak": "Active Streak",
199
+ "days": "days",
200
+ "today_check_in": "Today's Habit Checklist",
201
+ "weekly_streak": "Weekly Streak Calendar",
202
+ "streak": "streak",
203
+ "no_habits": "No habits currently tracked. Add custom habits to your goal canvas to see them here!",
204
+ "complete": "Complete",
205
+ "pending": "Pending",
206
+ "loading": "Loading habit canvases...",
207
+ "no_habits_title": "No Habit Canvases Yet",
208
+ "reward_desc": "Complete habits on your strategy maps to level up quicker.",
209
+ "track_for_date": "Track for {{date}}",
210
+ "complete_notification_title": "Habit Completed! 🔥",
211
+ "complete_notification_desc_custom": "Recorded check-in for {{date}}",
212
+ "complete_notification_desc": "Dynamic streak increased! +50 XP awarded!",
213
+ "recharge_notification_title": "Habit Recharged! ⚡",
214
+ "recharge_notification_desc": "Habit \"{{name}}\" is ready to be performed again!",
215
+ "recharge_notification_header": "HABIT READY"
216
+ },
217
+ "profile": {
218
+ "profile": "Profile",
219
+ "user_level": "User Level",
220
+ "experience": "Experience",
221
+ "stats": "Statistics",
222
+ "completed_goals": "Completed Goals",
223
+ "active_habits": "Active Habits",
224
+ "experience_points": "Experience Points",
225
+ "level_progress": "Level Progress",
226
+ "achievements": "Achievements Notebook",
227
+ "unlocked": "Unlocked",
228
+ "locked": "Locked",
229
+ "total_points": "Total Points"
230
+ },
231
+ "settings": {
232
+ "settings": "Settings",
233
+ "general": "General",
234
+ "canvas": "Canvas Settings",
235
+ "account_billing": "Account & Billing",
236
+ "theme": "App Preferences",
237
+ "preferred_language": "Preferred Language",
238
+ "theme_label": "Visual Theme",
239
+ "dark_mode": "Dark Theme",
240
+ "light_mode": "Light Theme",
241
+ "security": "Security",
242
+ "update_password": "Update Password",
243
+ "delete_account": "Delete Account",
244
+ "subscription": "Subscription Plan",
245
+ "upgrade_pro": "Upgrade to TaskFlow Pro",
246
+ "cancel_sub": "Cancel Subscription",
247
+ "saved_success": "Settings updated successfully!",
248
+ "slogan": "Tune your workspace to perfection.",
249
+ "general_preferences": "General Preferences",
250
+ "theme_desc": "Switch between light and dark themes.",
251
+ "notifications_title": "Desktop Notifications",
252
+ "notifications_desc": "Receive alerts for task deadlines and habit reminders.",
253
+ "language_desc": "Select your primary interface language.",
254
+ "canvas_behavior": "Canvas Behavior",
255
+ "ai_guidance_title": "AI Active Guidance",
256
+ "ai_guidance_desc": "Let AI proactively suggest alternative paths when you mark a node as blocked.",
257
+ "snap_to_grid_title": "Snap to Grid",
258
+ "snap_to_grid_desc": "Automatically align nodes to the graph paper lines for a cleaner look.",
259
+ "default_node_color": "Default Node Color",
260
+ "data_management": "Data Management",
261
+ "export_json": "Export as JSON",
262
+ "import_vault": "Import Vault",
263
+ "danger_zone": "Danger Zone",
264
+ "delete_desc": "This action is irreversible. All your maps and habits will be wiped.",
265
+ "delete_forever": "Delete Forever"
266
+ },
267
+ "canvas": {
268
+ "new_goal": "New Goal",
269
+ "new_habit": "New Habit",
270
+ "new_condition": "New Condition?",
271
+ "ai_assistant": "AI Assistant",
272
+ "ai_thinking": "AI Thinking...",
273
+ "premium_feature": "Premium Feature",
274
+ "paywall_desc": "AI Goal Adaptation is a Premium feature. Upgrade to TaskFlow Pro to generate alternative paths and unlock advanced logic.",
275
+ "upgrade_premium": "Upgrade to Premium",
276
+ "maybe_later": "Maybe Later",
277
+ "roadmap_strategist": "Roadmap Strategist",
278
+ "drafting_roadmap": "Drafting your Roadmap...",
279
+ "strategist_desc": "\" The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas... \"",
280
+ "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. \"",
281
+ "quick_suggestions": "Quick Suggestions",
282
+ "suggestion_detail": "Detail current step into subtasks",
283
+ "suggestion_route": "Suggest alternative route in case of failure",
284
+ "suggestion_habits": "Create daily habits to reinforce this goal",
285
+ "input_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...",
286
+ "tag_detail": "Detailing",
287
+ "tag_route": "Route",
288
+ "tag_habits": "Habits",
289
+ "condition_yes": "Yes",
290
+ "condition_no": "No",
291
+ "condition_node_label": "Condition",
292
+ "ai_suggest_details": "Break down the current step into subtasks",
293
+ "ai_suggest_details_tag": "Breakdown",
294
+ "ai_suggest_route": "Suggest an alternative route in case of failure",
295
+ "ai_suggest_route_tag": "Alternative",
296
+ "canvas.ai_suggest_habits": "Create daily habits to reinforce this goal",
297
+ "ai_suggest_habits_tag": "Habits",
298
+ "ai_roadmap_strategist": "Roadmap Strategist",
299
+ "ai_maintenance_title": "AI Under Maintenance",
300
+ "ai_maintenance_desc": "We are upgrading our AI strategist to deliver even faster, more accurate, and flexible plan generation. Thank you for your patience!",
301
+ "ai_maintenance_btn": "Got it",
302
+ "ai_drafting": "Drafting your Roadmap...",
303
+ "ai_drafting_desc": "The strategist is sketching optimal path connections, sub-goals and checkpoints on your sketchbook canvas...",
304
+ "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.",
305
+ "ai_quick_suggestions": "Quick Suggestions",
306
+ "ai_placeholder": "e.g. Sketch a 5-step plan to learn ASP.NET Core with dynamic conditional paths...",
307
+ "condition": "Condition",
308
+ "strategic_goal_map": "Strategic Goal Map",
309
+ "save_strategy": "Save Strategy",
310
+ "saving": "Saving...",
311
+ "export_empty_error": "The map is empty! Add nodes before exporting.",
312
+ "subgoal_warning": "Cannot complete: please finish all sub-goals first!",
313
+ "subgoals_progress": "Sub-goals: {{done}}/{{total}} Done",
314
+ "export_error": "Error exporting to PNG:",
315
+ "habit": "Habit",
316
+ "habit_status": "Status",
317
+ "habit_status_done": "Done",
318
+ "habit_status_pending": "Pending",
319
+ "habit_action_done": "Done!",
320
+ "habit_action_todo": "Complete",
321
+ "habit_reset_rule": "Reset Rule",
322
+ "habit_countdown_label": "Reset in",
323
+ "habit_resetting": "Resetting...",
324
+ "habit_signal_active": "SENDING SIGNAL ⚡",
325
+ "habit_signal_inactive": "SIGNAL OFF 💤",
326
+ "habit_test_reset": "Test Reset",
327
+ "habit_test_reset_tooltip": "Reset habit and all downstream goals in the chain now",
328
+ "habit_rule_daily": "Daily at {{time}}",
329
+ "habit_rule_weekly": "Weekly ({{day}}) at {{time}}",
330
+ "habit_rule_hourly": "Every {{hours}}h",
331
+ "habit_rule_minutely": "Every {{minutes}}m",
332
+ "habit_rule_days": "Every {{days}}d",
333
+ "habit_rule_mixed": "Every {{hours}}h {{minutes}}m",
334
+ "habit_reset_hours_label": "Hours",
335
+ "habit_reset_minutes_label": "Minutes",
336
+ "condition_min_options_error": "A condition must have at least one option (pin)!",
337
+ "condition_settings_title": "Condition Settings",
338
+ "condition_text_label": "Condition Text",
339
+ "condition_text_placeholder": "e.g. Payment successful?",
340
+ "condition_options_label": "Options (Output Pins)",
341
+ "condition_multiselect_label": "Multi-choice Options",
342
+ "condition_multiselect_desc": "Allow multiple outputs to activate simultaneously",
343
+ "habit_settings_title": "Habit Settings",
344
+ "habit_name_label": "Habit Name",
345
+ "habit_name_placeholder": "e.g. Learning English",
346
+ "habit_description_label": "Description / Note",
347
+ "habit_description_placeholder": "Details or motivation...",
348
+ "habit_reset_mode_label": "Reset Mode",
349
+ "habit_reset_daily": "Every day (Daily)",
350
+ "habit_reset_weekly": "Every week (Weekly)",
351
+ "habit_reset_interval": "Custom Interval",
352
+ "habit_reset_time_label": "Reset Time (default 00:00)",
353
+ "habit_reset_time_label_short": "Reset Time",
354
+ "habit_reset_day_label": "Day of the week",
355
+ "habit_reset_interval_value": "Reset every",
356
+ "habit_interval_minutes": "minutes",
357
+ "habit_interval_hours": "hours",
358
+ "habit_interval_days": "days",
359
+ "context_menu": {
360
+ "create_node": "Create Node",
361
+ "goal_node": "Goal (Sketch Node)",
362
+ "subgoal_node": "Sub-goal",
363
+ "condition_node": "Condition",
364
+ "habit_node": "Habit",
365
+ "export_png": "Export to PNG",
366
+ "delete": "Delete",
367
+ "insert_template": "Insert template",
368
+ "auto_layout": "Auto-layout"
369
+ },
370
+ "toolbar": {
371
+ "auto_layout": "Auto-layout (Shift+L)",
372
+ "templates": "Templates"
373
+ }
374
+ },
375
+ "achievements": {
376
+ "unlocked_header": "Achievement Unlocked!",
377
+ "notification_header": "Notification",
378
+ "blank_canvas": {
379
+ "title": "Blank Canvas",
380
+ "description": "Create your first project (Graph)."
381
+ },
382
+ "connecting_the_dots": {
383
+ "title": "Connecting the Dots",
384
+ "description": "Create 10 connections (Edges) between tasks."
385
+ },
386
+ "sketch_master": {
387
+ "title": "Sketch Master",
388
+ "description": "Create 100 task nodes overall."
389
+ },
390
+ "daily_doodler": {
391
+ "title": "Daily Doodler",
392
+ "description": "Track habits 7 times."
393
+ },
394
+ "decision_maker": {
395
+ "title": "Decision Maker",
396
+ "description": "Complete 50 tasks."
397
+ },
398
+ "clear_desk": {
399
+ "title": "Clear Desk",
400
+ "description": "Delete 5 projects."
401
+ },
402
+ "first_milestone": {
403
+ "title": "First Milestone",
404
+ "description": "Complete your first task."
405
+ },
406
+ "self_portrait": {
407
+ "title": "Self Portrait",
408
+ "description": "Upload your profile avatar."
409
+ }
410
+ },
411
+ "subscription": {
412
+ "title": "Unlock the Pro Tools of TaskFlow",
413
+ "title_p1": "Unlock the ",
414
+ "title_highlight": "Pro Tools",
415
+ "title_p2": " of TaskFlow",
416
+ "subtitle": "Stop guessing. Start mapping with AI guidance and unlimited creative freedom.",
417
+ "most_recommended": "Most Recommended",
418
+ "per_month": "/ month",
419
+ "social_proof": "Trusted by 10,000+ Visionary Strategists worldwide",
420
+ "features": {
421
+ "ai_genius": "AI Genius",
422
+ "ai_genius_desc": "GPT-4 powered path generation",
423
+ "infinite": "Infinite",
424
+ "infinite_desc": "No limits on nodes or connections",
425
+ "secure": "Secure",
426
+ "secure_desc": "Bank-level AES-256 encryption",
427
+ "custom": "Custom",
428
+ "custom_desc": "Full palette of sketchbook themes"
429
+ },
430
+ "plans": {
431
+ "free": {
432
+ "title": "Free Starter",
433
+ "desc": "Perfect for testing and simple goal mapping.",
434
+ "btn": "Stay on Free",
435
+ "feat1": "3 AI generations per day",
436
+ "feat2": "Maximum 3 canvases",
437
+ "feat3": "Maximum 200 nodes per canvas",
438
+ "feat4": "Maximum 3 habits",
439
+ "feat5": "Maximum 2 people on board"
440
+ },
441
+ "pro": {
442
+ "title": "Sketchbook Pro",
443
+ "desc": "Unlock unlimited strategies with 200 daily AI construct operations.",
444
+ "btn": "Upgrade to Pro",
445
+ "feat1": "200 AI generations per day",
446
+ "feat2": "Unlimited canvases & nodes",
447
+ "feat3": "Unlimited habits",
448
+ "feat4": "Maximum 10 people on board",
449
+ "feat5": "Advanced Strategy analytics"
450
+ },
451
+ "ultra": {
452
+ "title": "Sketchbook Ultra",
453
+ "desc": "The ultimate strategy sandbox. Fully unlimited everything + templates.",
454
+ "btn": "Upgrade to Ultra",
455
+ "feat1": "Unlimited AI generations",
456
+ "feat2": "Unlimited canvases & nodes",
457
+ "feat3": "Unlimited habits",
458
+ "feat4": "Unlimited people on board",
459
+ "feat5": "Create custom templates",
460
+ "feat6": "Priority support & VIP strategy tools"
461
+ }
462
+ },
463
+ "upgrade_success": "Plan switched to {{tier}} successfully!",
464
+ "upgrading": "Upgrading...",
465
+ "current_plan": "Current Plan",
466
+ "compare": {
467
+ "feature": "Feature",
468
+ "ai_gens": "AI Generations / day",
469
+ "canvases": "Canvases",
470
+ "nodes": "Nodes per canvas",
471
+ "habits": "Habits",
472
+ "board_members": "Board members",
473
+ "custom_templates": "Custom Templates"
474
+ }
475
+ },
476
+ "plans": {
477
+ "no_limits": "No limits",
478
+ "switched": "Your plan is now {{plan}}.",
479
+ "payments_soon": "Online payments are not connected yet. Plus will be available soon.",
480
+ "switch_failed": "Could not change the plan. Please try again.",
481
+ "free_desc": "Everything you need to plan on your own.",
482
+ "free_btn": "Switch to Free",
483
+ "plus_desc": "For big plans and teams. No caps on anything.",
484
+ "plus_btn": "Get Plus",
485
+ "feat_boards": "Up to {{count}} boards",
486
+ "feat_nodes": "Up to {{count}} nodes per board",
487
+ "feat_guests": "Up to {{count}} guests per board",
488
+ "feat_templates": "{{count}} saved templates",
489
+ "feat_core": "All node types, auto-layout, PNG/JSON export",
490
+ "feat_unlimited_boards": "Unlimited boards",
491
+ "feat_unlimited_nodes": "Unlimited nodes",
492
+ "feat_unlimited_guests": "Unlimited collaborators",
493
+ "feat_unlimited_templates": "Unlimited saved templates",
494
+ "feat_everything_free": "Everything in Free",
495
+ "row_boards": "Boards",
496
+ "row_nodes": "Nodes per board",
497
+ "row_guests": "Guests per board",
498
+ "row_templates": "Saved templates",
499
+ "title_p1": "Two plans. ",
500
+ "title_highlight": "No fine print.",
501
+ "subtitle": "Free has small creation limits. Plus has none.",
502
+ "limit_title": "Free plan limit",
503
+ "limit_nodes_desc": "A board on the Free plan can hold up to {{count}} nodes. Plus has no limits.",
504
+ "see_plus": "See Plus"
505
+ },
506
+ "templates": {
507
+ "untitled": "Untitled board",
508
+ "tab_all": "All",
509
+ "tab_builtin": "Starters",
510
+ "tab_mine": "My templates",
511
+ "delete_confirm": "Delete",
512
+ "delete": "Delete template",
513
+ "blank": "Blank board",
514
+ "blank_desc": "Start from an empty canvas.",
515
+ "node_count": "{{count}} nodes",
516
+ "create_title": "New board",
517
+ "insert_title": "Insert a template",
518
+ "create_desc": "Start empty or from a template. Templates are laid out automatically.",
519
+ "insert_desc": "The template is added to the center of the screen and stays selected so you can move it.",
520
+ "search": "Search templates...",
521
+ "all_categories": "All categories",
522
+ "empty_mine": "No saved templates yet",
523
+ "nothing_found": "Nothing found",
524
+ "empty_mine_hint": "Open any board and press \"Save as template\" — the whole board or just the selected nodes.",
525
+ "free_note": "Free plan: {{used}}/{{max}} saved templates.",
526
+ "go_plus": "Plus removes the limit",
527
+ "create_btn": "Create board",
528
+ "insert_btn": "Insert",
529
+ "my_category": "My templates",
530
+ "save_failed": "Could not save the template.",
531
+ "save_title": "Save as template",
532
+ "saved": "Template saved",
533
+ "only_selected": "Selected ({{count}})",
534
+ "whole_board": "Whole board",
535
+ "field_title": "Title",
536
+ "field_desc": "Description",
537
+ "field_category": "Category",
538
+ "save_hint": "Statuses, progress and assignees are not saved — the template is a clean starting point.",
539
+ "save_btn": "Save template"
540
+ }
541
+ }
src/locales/uk.json CHANGED
@@ -1,466 +1,541 @@
1
- {
2
- "common": {
3
- "back": "Назад",
4
- "yes": "Так",
5
- "no": "Ні",
6
- "hours_short": "год",
7
- "minutes_short": "хв",
8
- "seconds_short": "с",
9
- "add": "Додати",
10
- "apply": "Застосувати",
11
- "cancel": "Скасувати",
12
- "delete": "Видалити",
13
- "days_short": {
14
- "sun": "Нд",
15
- "mon": "Пн",
16
- "tue": "Вт",
17
- "wed": "Ср",
18
- "thu": "Чт",
19
- "fri": "Пт",
20
- "sat": "Сб"
21
- },
22
- "days": {
23
- "sun": "Неділя",
24
- "mon": "Понеділок",
25
- "tue": "Вівторок",
26
- "wed": "Середа",
27
- "thu": "Четвер",
28
- "fri": "П\u0027ятниця",
29
- "sat": "Субота"
30
- }
31
- },
32
- "sidebar": {
33
- "projects": "Проекти",
34
- "canvas": "Полотно",
35
- "habits": "Звички",
36
- "profile": "Профіль",
37
- "settings": "Налаштування",
38
- "free_plan": "Безкоштовний тариф",
39
- "upgrade_now": "Оновити зараз",
40
- "logout": "Вийти",
41
- "free_active": "ШІ: {{count}}/3 на день",
42
- "pro_active": "ШІ: {{count}}/200 на день",
43
- "ultra_active": "Усі ліміти знято",
44
- "go_ultra": "Перейти на Ultra"
45
- },
46
- "landing": {
47
- "slogan": "TaskFlow у вашій кишені. Завжди синхронізовано",
48
- "title": "TaskFlow",
49
- "description": "Розкрийте свій потенціал, відстежуйте цілі та створюйте корисні звички.",
50
- "get_started": "Почати",
51
- "login": "Увійти",
52
- "features": "Функції",
53
- "visual_goals": "Візуальні цілі",
54
- "ai_generation": "ШІ-генерація",
55
- "habit_streaks": "Серії звичок",
56
- "hero_title_p1": "Плани руйнуються.",
57
- "hero_title_p2": "TaskFlow адаптується.",
58
- "hero_desc": "Перший візуальний конструктор цілей, створений для фокусу. Переходьте від лінійних списків до адаптивних графів, які впораються з життєвими моментами «Якщо/То».",
59
- "hero_badge": "Підходить для людей з РДУГ. Створено для стійкості.",
60
- "node_a": "Завдання А",
61
- "node_b": "Завдання Б",
62
- "node_failed": "Невдача?",
63
- "node_c": "Завдання В",
64
- "node_d": "Завдання Г",
65
- "adhd_edge": "РДУГ-перевага",
66
- "ai_find_path": "Дозвольте ШІ знайти шлях, коли ви застрягли.",
67
- "ai_desc": "TaskFlow бере на себе когнітивне навантаження. Коли план заходить у глухий кут, наш ШІ-агент малює повне дерево стратегії, знаходячи альтернативи, щоб вам не доводилося робити це вручну.",
68
- "ai_example_input": "Я застряг на залученні користувачів. Що робити?",
69
- "ai_adapt_plan": "Адаптувати план",
70
- "ai_early_users": "Залучити перших користувачів",
71
- "cross_platform": "Кросплатформність",
72
- "cross_platform_desc": "Не втрачайте свій потік у дорозі. TaskFlow працює за принципом offline-first, безперешкодно синхронізуючи ваші графи цілей між усіма пристроями, щойно ви знову з\u0027явитеся в мережі.",
73
- "cta_title_p1": "Припиніть боротися зі своїм мозком.",
74
- "cta_title_p2": "Почніть малювати шляхи."
75
- },
76
- "pricing": {
77
- "title": "Прості тарифи",
78
- "subtitle": "Жодних прихованих комісій, лише чисте чорнило.",
79
- "free": "Безкоштовно",
80
- "pro": "Pro",
81
- "team": "Team",
82
- "month": "місяць",
83
- "user": "користувач",
84
- "start_free": "Почати безкоштовно",
85
- "go_pro": "Спробувати Pro",
86
- "contact_us": "Зв\u0027язатися з нами",
87
- "free_feat1": "3 нескінченних полотна",
88
- "free_feat2": "Базові форми та логіка",
89
- "free_feat3": "Шаблони спільноти",
90
- "pro_feat1": "Необмежена кількість полотен",
91
- "pro_feat2": "ШІ-генерація шляхів",
92
- "pro_feat3": "Розширене відстеження звичок",
93
- "pro_feat4": "Пріоритетна підтримка",
94
- "team_feat1": "Усе з тарифу Pro",
95
- "team_feat2": "Спільна робота в реальному часі",
96
- "team_feat3": "Командні робочі простори",
97
- "team_feat4": "Адміністративні інструменти",
98
- "premium_feature": "Преміум функція",
99
- "paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.",
100
- "upgrade_premium": "Оновити до Преміум",
101
- "maybe_later": "Можливо пізніше"
102
- },
103
- "auth": {
104
- "welcome_back": "З поверненням!",
105
- "create_account": "Створити акаунт",
106
- "sign_in_desc": "Увійдіть, щоб продовжити свою подорож",
107
- "sign_up_desc": "Приєднуйтесь до TaskFlow, щоб досягати своїх цілей",
108
- "email": "Електронна адреса",
109
- "password": "Пароль",
110
- "name": "Повне ім\u0027я",
111
- "sign_in": "Увійти",
112
- "sign_up": "Зареєструватися",
113
- "no_account": "Немає акаунту? Зареєструватися",
114
- "has_account": "Вже маєте акаунт? Увійти",
115
- "passwords_do_not_match": "Паролі не збігаються",
116
- "start_flow": "Почніть свій потік",
117
- "plans_waiting": "Ваші плани чекають на вас.",
118
- "join_revolution": "Приєднуйтесь до візуальної революції.",
119
- "full_name": "Повне ім\u0027я",
120
- "enter_name": "Введіть ваше ім\u0027я",
121
- "forgot": "Забули?",
122
- "confirm_password": "Підтвердьте пароль",
123
- "processing": "Обробка...",
124
- "enter_workspace": "Увійти в робочий простір",
125
- "or_continue": "Або продовжити за допомогою",
126
- "google_failed": "Помилка входу через Google",
127
- "dont_have_account": "Немає акаунту? Зареєструватися",
128
- "already_member": "Вже є учасником? Увійти"
129
- },
130
- "onboarding": {
131
- "title": "Ласкаво просимо до TaskFlow",
132
- "subtitle": "Давайте налаштуємо вашого стратега цілей",
133
- "step1_title": "Візуальні вузли цілей",
134
- "step1_desc": "Зобразіть свої мрії у вигляді взаємопов\u0027язаних вузлів на чудовому полотні. Розбивайте великі цілі на дрібні кроки.",
135
- "step2_title": "Динамічна логіка та серії",
136
- "step2_desc": "Додавайте перевірки умов (вибір Так/Ні), щоб моделювати альтернативні шляхи. Підключайте звички та спостерігайте за вашими серіями.",
137
- "step3_title": "ШІ-адаптація цілей",
138
- "step3_desc": "Попросіть нашого ШІ-стратега адаптувати ваш план, коли виникають труднощі. TaskFlow автоматично створить нові шляхи.",
139
- "next": "Далі",
140
- "back": "Назад",
141
- "lets_go": "Поїхали!",
142
- "step_0": {
143
- "title": "Полотно цілей",
144
- "description": "Забудьте про лінійні списки. TaskFlow — це цифровий альбом для малювання, де ваші ідеї живуть у візуальному графі. Вільно масштабуйте, панорамуйте та розширюйте свої думки до нескінченності.",
145
- "note": "Ваш мозок не працює як список, то чому ваші завдання мають бути такими?"
146
- },
147
- "step_1": {
148
- "title": "Логіка та зв\u0027язки",
149
- "description": "З\u0027єднуйте вузли за допомогою логіки «Якщо/То». Визначайте, що відбувається у разі успіху або невдачі завдання. Будуйте стійкий план на будь-який випадок.",
150
- "note": "Якщо відбувається А, то робимо Б. Якщо ні, спробуйте В."
151
- },
152
- "step_2": {
153
- "title": "ШІ-адаптація",
154
- "description": "Зіткнулися з перешкодою? Позначте вузол як «Заблоковано» і дозвольте ШІ-помічнику миттєво розробити альтернативні маршрути до вашої цілі.",
155
- "note": "ШІ бере на себе когнітивне навантаження, коли ви застрягли."
156
- },
157
- "step_3": {
158
- "title": "Дофамін та фокус",
159
- "description": "Заробляйте очки за завершення гілок та підтримуйте щоденні серії. TaskFlow розроблено, щоб тримати вас у тонусі та мотивувати бачити повну картину.",
160
- "note": "Перетворіть рутину на гру, яка вам подобається."
161
- },
162
- "visual": {
163
- "goal": "Ціль",
164
- "success": "Успіх",
165
- "blocked": "Заблоковано",
166
- "ai_generating": "ШІ генерує...",
167
- "streak_text": "14 днів серії!"
168
- },
169
- "step_indicator": "Крок {{current}} з {{total}}",
170
- "begin": "Почнемо!",
171
- "next_chapter": "Наступний розділ"
172
- },
173
- "dashboard": {
174
- "your_projects": "Ваші проекти",
175
- "search_placeholder": "Пошук проектів...",
176
- "new_blank_canvas": "Нове чисте полотно",
177
- "project": "Проект",
178
- "active_steps": "активних кроків",
179
- "loading_projects": "Завантаження проектів...",
180
- "no_projects": "Проектів ще немає. Створіть чисте полотно, щоб почати!",
181
- "create_project_title": "Створити новий проект",
182
- "project_name": "Назва проекту",
183
- "project_desc": "Опис проекту",
184
- "cancel": "Скасувати",
185
- "create": "Створити",
186
- "delete_title": "Видалити проект",
187
- "delete_confirm": "Ви впевнені, що хочете видалити цей проект? Цю дію не можна скасувати.",
188
- "delete": "Видалити"
189
- },
190
- "habits": {
191
- "habit_tracker": "Трекер звичок",
192
- "consistency_score": "Показник стабільності",
193
- "consistency_desc": "Цього тижня ви входите до 5% найкращих стратегів!",
194
- "active_streak": "Активна серія",
195
- "days": "днів",
196
- "today_check_in": "Сьогоднішній чеклист звичок",
197
- "weekly_streak": "Календар тижневої серії",
198
- "streak": "серія",
199
- "no_habits": "Звички поки що не відстежуються. Додайте власні звички на ваше полотно цілей, щоб побачити їх тут!",
200
- "complete": "Виконано",
201
- "pending": "Очікується",
202
- "loading": "Завантаження полотен зі звичками...",
203
- "no_habits_title": "Поки що немає полотен зі звичками",
204
- "reward_desc": "Виконуйте звички на ваших картах стратегій, щоб швидше підвищувати рівень.",
205
- "track_for_date": "Відстежити для {{date}}",
206
- "complete_notification_title": "Звичку виконано! 🔥",
207
- "complete_notification_desc_custom": "Зафіксовано виконання для {{date}}",
208
- "complete_notification_desc": "Активну серію збільшено! Нараховано +50 XP!",
209
- "recharge_notification_title": "Звичку перезаряджено! ⚡",
210
- "recharge_notification_desc": "Звичка \"{{name}}\" знову готова до виконання!",
211
- "recharge_notification_header": "ЗВИЧКА ГОТОВА"
212
- },
213
- "profile": {
214
- "profile": "Профіль",
215
- "user_level": "Рівень користувача",
216
- "experience": "Досвід",
217
- "stats": "Статистика",
218
- "completed_goals": "Виконані цілі",
219
- "active_habits": "Активні звички",
220
- "experience_points": "Очки досвіду",
221
- "level_progress": "Прогрес рівня",
222
- "achievements": "Блокнот досягнень",
223
- "unlocked": "Розблоковано",
224
- "locked": "Заблоковано",
225
- "total_points": "Всього очок"
226
- },
227
- "settings": {
228
- "settings": "Налаштування",
229
- "general": "Загальні",
230
- "canvas": "Налаштування полотна",
231
- "account_billing": "Обліковий запис та оплата",
232
- "theme": "Налаштування додатка",
233
- "preferred_language": "Бажана мова",
234
- "theme_label": "Візуальна тема",
235
- "dark_mode": "Темна тема",
236
- "light_mode": "Світла тема",
237
- "security": "Безпека",
238
- "update_password": "Оновити пароль",
239
- "delete_account": "Видалити акаунт",
240
- "subscription": "Тарифний план",
241
- "upgrade_pro": "Оновити до TaskFlow Pro",
242
- "cancel_sub": "Скасувати підписку",
243
- "saved_success": "Налаштування успішно оновлено!",
244
- "slogan": "Налаштуйте свій робочий простір до ідеалу.",
245
- "general_preferences": "Загальні налаштування",
246
- "theme_desc": "Перемикання між світлою та темною темами.",
247
- "notifications_title": "Сповіщення на робочому столі",
248
- "notifications_desc": "Отримуйте сповіщення про терміни виконання завдань та нагадування про звички.",
249
- "language_desc": "Виберіть основну мову інтерфейсу.",
250
- "canvas_behavior": "Поведінка полотна",
251
- "ai_guidance_title": "Активне керівництво ШІ",
252
- "ai_guidance_desc": "Дозволити ШІ проактивно пропонувати альтернативні шляхи, коли ви відз��ачаєте вузол як заблокований.",
253
- "snap_to_grid_title": "Прив\u0027язка до сітки",
254
- "snap_to_grid_desc": "Автоматично вирівнювати вузли по лініях сітки для охайнішого вигляду.",
255
- "default_node_color": "Колір вузла за замовчуванням",
256
- "data_management": "Управління даними",
257
- "export_json": "Експорт у JSON",
258
- "import_vault": "Імпорт сховища",
259
- "danger_zone": "Небезпечна зона",
260
- "delete_desc": "Ця дія є незворотною. Всі ваші карти та звички будуть стерті.",
261
- "delete_forever": "Видалити назавжди"
262
- },
263
- "canvas": {
264
- "new_goal": "Нова ціль",
265
- "new_habit": "Нова звичка",
266
- "new_condition": "Нова умова?",
267
- "ai_assistant": "ШІ-помічник",
268
- "ai_thinking": "ШІ думає...",
269
- "premium_feature": "Преміум функція",
270
- "paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.",
271
- "upgrade_premium": "Оновити до Преміум",
272
- "maybe_later": "Можливо пізніше",
273
- "roadmap_strategist": "Стратег дорожньої карти",
274
- "drafting_roadmap": "Створення вашої дорожньої карти...",
275
- "strategist_desc": "\" Стратег малює оптимальні з\u0027єднання шляхів, підцілі та контрольні точки на вашому полотні... \"",
276
- "bubble_text": "\" Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні. \"",
277
- "quick_suggestions": "Швидкі пропозиції",
278
- "suggestion_detail": "Розбити поточний крок на підзавдання",
279
- "suggestion_route": "Запропонувати альтернативний шлях у разі невдачі",
280
- "suggestion_habits": "Створити щоденні звички для зміцнення цієї цілі",
281
- "input_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...",
282
- "tag_detail": "Деталізація",
283
- "tag_route": "Маршрут",
284
- "tag_habits": "Звички",
285
- "condition_yes": "Так",
286
- "condition_no": "Ні",
287
- "condition_node_label": "Умова",
288
- "ai_suggest_details": "Розбити поточний крок на підзавдання",
289
- "ai_suggest_details_tag": "Деталізація",
290
- "ai_suggest_route": "Запропонувати альтернативний шлях у разі невдачі",
291
- "ai_suggest_route_tag": "Альтернатива",
292
- "canvas.ai_suggest_habits": "Створити щоденні звички для зміцнення цієї цілі",
293
- "ai_suggest_habits_tag": "Звички",
294
- "ai_roadmap_strategist": "Стратег дорожньої карти",
295
- "ai_maintenance_title": "ШІ на обслуговуванні",
296
- "ai_maintenance_desc": "Ми оновлюємо нашого ШІ-стратега для забезпечення ще швидшої, точнішої та гнучкішої генерації планів. Дякуємо за ваше терпіння!",
297
- "ai_maintenance_btn": "Зрозуміло",
298
- "ai_drafting": "Створення вашої дорожньої карти...",
299
- "ai_drafting_desc": "Стратег малює оптимальні з\u0027єднання шляхів, підцілі та контрольні точки на вашому полотні...",
300
- "ai_bubble_desc": "Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні.",
301
- "ai_quick_suggestions": "Швидкі пропозиції",
302
- "ai_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...",
303
- "condition": "Умова",
304
- "strategic_goal_map": "Візуальна карта цілей",
305
- "save_strategy": "Зберегти стратегію",
306
- "saving": "Збереження...",
307
- "export_empty_error": "Карта порожня! Додайте вузли перед експортом.",
308
- "subgoal_warning": "Неможливо виконати: спочатку завершіть всі суб-цілі!",
309
- "subgoals_progress": "Суб-цілі: {{done}} з {{total}} виконано",
310
- "export_error": "Помилка при експорті в PNG:",
311
- "habit": "Звичка",
312
- "habit_status": "Status",
313
- "habit_status_done": "Виконано",
314
- "habit_status_pending": "Очікує",
315
- "habit_action_done": "Зроблено!",
316
- "habit_action_todo": "Виконати",
317
- "habit_reset_rule": "Правило скидання",
318
- "habit_countdown_label": "До скидання",
319
- "habit_resetting": "Скидання...",
320
- "habit_signal_active": "ДАЄ СИГНАЛ ⚡",
321
- "habit_signal_inactive": "СИГНАЛ ВИМК. 💤",
322
- "habit_test_reset": "Тест-скидання",
323
- "habit_test_reset_tooltip": "Скинути звичку та всі пов\u0027язані з нею наступні цілі прямо зараз",
324
- "habit_rule_daily": "Щодня о {{time}}",
325
- "habit_rule_weekly": "Щотижня ({{day}}) о {{time}}",
326
- "habit_rule_hourly": "Кожні {{hours}} год",
327
- "habit_rule_minutely": "Кожні {{minutes}} хв",
328
- "habit_rule_days": "Кожні {{days}} дн",
329
- "habit_rule_mixed": "Кожні {{hours}} год {{minutes}} хв",
330
- "habit_reset_hours_label": "Годин",
331
- "habit_reset_minutes_label": "Хвилин",
332
- "condition_min_options_error": "Умова повинна мати принаймні один варіант (пін)!",
333
- "condition_settings_title": "Налаштування умови",
334
- "condition_text_label": "Текст умови",
335
- "condition_text_placeholder": "наприклад, Оплата пройшла успешно?",
336
- "condition_options_label": "Варіанти (Вихідні піни)",
337
- "condition_multiselect_label": "Кілька варіантів вибору",
338
- "condition_multiselect_desc": "Дозволити одночасну активацію кількох виходів",
339
- "habit_settings_title": "Налаштування звички",
340
- "habit_name_label": "Назва звички",
341
- "habit_name_placeholder": "наприклад, Вивчення англійської",
342
- "habit_description_label": "Опис / Примітка",
343
- "habit_description_placeholder": "Деталі або мотивація...",
344
- "habit_reset_mode_label": "Режим скидання",
345
- "habit_reset_daily": "Щодня (Daily)",
346
- "habit_reset_weekly": "Щотижня (Weekly)",
347
- "habit_reset_interval": "Свій інтервал",
348
- "habit_reset_time_label": "Час скидання (типово 00:00)",
349
- "habit_reset_time_label_short": "Час скидання",
350
- "habit_reset_day_label": "День тижня",
351
- "habit_reset_interval_value": "Скидати кожні",
352
- "habit_interval_minutes": "хвилин",
353
- "habit_interval_hours": "годин",
354
- "habit_interval_days": "днів",
355
- "context_menu": {
356
- "create_node": "СТВОРИТИ НОДУ",
357
- "goal_node": "Ціль (Sketch Node)",
358
- "subgoal_node": "Суб-ціль (Sub-goal)",
359
- "condition_node": "Умова (Condition)",
360
- "habit_node": "Звичка (Habit)",
361
- "export_png": "Експорт в PNG",
362
- "delete": "Видалити"
363
- }
364
- },
365
- "achievements": {
366
- "unlocked_header": "Досягнення розблоковано!",
367
- "notification_header": "Сповіщення",
368
- "blank_canvas": {
369
- "title": "Чисте полотно",
370
- "description": "Створіть свій перший проект (граф)."
371
- },
372
- "connecting_the_dots": {
373
- "title": "З\u0027єднання точок",
374
- "description": "Створіть 10 зв\u0027язків між завданнями."
375
- },
376
- "sketch_master": {
377
- "title": "Майстер ескізів",
378
- "description": "Створіть загалом 100 вузлів завдань."
379
- },
380
- "daily_doodler": {
381
- "title": "Щоденний рисувальник",
382
- "description": "Відстежте звички 7 разів."
383
- },
384
- "decision_maker": {
385
- "title": "Рішучий діяч",
386
- "description": "Виконайте 50 завдань."
387
- },
388
- "clear_desk": {
389
- "title": "Чистий стіл",
390
- "description": "Видаліть 5 проектів."
391
- },
392
- "first_milestone": {
393
- "title": "Перша віха",
394
- "description": "Виконайте своє перше завдання."
395
- },
396
- "self_portrait": {
397
- "title": "Автопортрет",
398
- "description": "Завантажте свій аватар профілю."
399
- }
400
- },
401
- "subscription": {
402
- "title": "Розблокуйте професійні інструменти TaskFlow",
403
- "title_p1": "Розблокуйте ",
404
- "title_highlight": "професійні інструменти",
405
- "title_p2": " TaskFlow",
406
- "subtitle": "Припиніть гадати. Почніть проектувати за допомогою ШІ та отримайте повну творчу свободу.",
407
- "most_recommended": "Найбільш рекомендовано",
408
- "per_month": "/ міс",
409
- "social_proof": "Нам довіряють понад 10 000 стратегів у всьому світі",
410
- "features": {
411
- "ai_genius": "ШІ-Геній",
412
- "ai_genius_desc": "Генерація шляхів на базі GPT-4",
413
- "infinite": "Нескінченність",
414
- "infinite_desc": "Без обмежень на вузли чи зв\u0027язки",
415
- "secure": "Безпека",
416
- "secure_desc": "Шифрування банківського рівня AES-256",
417
- "custom": "Персоналізація",
418
- "custom_desc": "Повна палітра тем для вашого полотна"
419
- },
420
- "plans": {
421
- "free": {
422
- "title": "Безкоштовний старт",
423
- "desc": "Ідеально підходить для швидких особистих ескізів і простого проектування цілей.",
424
- "btn": "Залишитися на Безкоштовному",
425
- "feat1": "3 ШІ-генерації на день",
426
- "feat2": "Максимум 3 полотна",
427
- "feat3": "Максимум 200 вузлів на полотні",
428
- "feat4": "Максимум 3 звички",
429
- "feat5": "Максимум 2 особи на дошці"
430
- },
431
- "pro": {
432
- "title": "Альбом Pro",
433
- "desc": "Розкрийте весь потенціал стратегії під керівництвом ШІ та отримайте безмежні можливості створення карт.",
434
- "btn": "Оновити до Pro",
435
- "feat1": "200 ШІ-генерацій на день",
436
- "feat2": "Необмежено полотен та вузлів",
437
- "feat3": "Необмежено звичок",
438
- "feat4": "Максимум 10 осіб на дошці",
439
- "feat5": "Розширена аналітика стратегій"
440
- },
441
- "ultra": {
442
- "title": "Альбом Ultra",
443
- "desc": "Ідеальний інструмент для повної свободи творчості та власних шаблонів.",
444
- "btn": "Оновити до Ultra",
445
- "feat1": "Необмежено ШІ-генерацій",
446
- "feat2": "Необмежено полотен та вузлів",
447
- "feat3": "Необмежено звичок",
448
- "feat4": "Необмежено осіб на дошці",
449
- "feat5": "Створення власних шаблонів",
450
- "feat6": "Пріоритетна підтримка та VIP інструменти"
451
- }
452
- },
453
- "upgrade_success": "Тарифний план успішно змінено на {{tier}}!",
454
- "upgrading": "Оновлення...",
455
- "current_plan": "Поточний тариф",
456
- "compare": {
457
- "feature": "Функція",
458
- "ai_gens": "Генерацій ШІ / день",
459
- "canvases": "Канваси",
460
- "nodes": "Нод на канвас",
461
- "habits": "Звички",
462
- "board_members": "Учасники дошки",
463
- "custom_templates": "Власні шаблони"
464
- }
465
- }
466
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "common": {
3
+ "back": "Назад",
4
+ "yes": "Так",
5
+ "no": "Ні",
6
+ "hours_short": "год",
7
+ "minutes_short": "хв",
8
+ "seconds_short": "с",
9
+ "add": "Додати",
10
+ "apply": "Застосувати",
11
+ "cancel": "Скасувати",
12
+ "delete": "Видалити",
13
+ "days_short": {
14
+ "sun": "Нд",
15
+ "mon": "Пн",
16
+ "tue": "Вт",
17
+ "wed": "Ср",
18
+ "thu": "Чт",
19
+ "fri": "Пт",
20
+ "sat": "Сб"
21
+ },
22
+ "days": {
23
+ "sun": "Неділя",
24
+ "mon": "Понеділок",
25
+ "tue": "Вівторок",
26
+ "wed": "Середа",
27
+ "thu": "Четвер",
28
+ "fri": "П'ятниця",
29
+ "sat": "Субота"
30
+ }
31
+ },
32
+ "sidebar": {
33
+ "projects": "Проекти",
34
+ "canvas": "Полотно",
35
+ "habits": "Звички",
36
+ "profile": "Профіль",
37
+ "settings": "Налаштування",
38
+ "free_plan": "Безкоштовний тариф",
39
+ "upgrade_now": "Оновити зараз",
40
+ "logout": "Вийти",
41
+ "free_active": "ШІ: {{count}}/3 на день",
42
+ "pro_active": "ШІ: {{count}}/200 на день",
43
+ "ultra_active": "Усі ліміти знято",
44
+ "go_ultra": "Перейти на Ultra",
45
+ "boards_used": "{{used}}/{{max}} дошок",
46
+ "plus_active": "Без лімітів",
47
+ "free_limits": "Д�� {{nodes}} вузлів на дошці",
48
+ "get_plus": "Отримати Plus"
49
+ },
50
+ "landing": {
51
+ "slogan": "TaskFlow у вашій кишені. Завжди синхронізовано",
52
+ "title": "TaskFlow",
53
+ "description": "Розкрийте свій потенціал, відстежуйте цілі та створюйте корисні звички.",
54
+ "get_started": "Почати",
55
+ "login": "Увійти",
56
+ "features": "Функції",
57
+ "visual_goals": "Візуальні цілі",
58
+ "ai_generation": "ШІ-генерація",
59
+ "habit_streaks": "Серії звичок",
60
+ "hero_title_p1": "Плани руйнуються.",
61
+ "hero_title_p2": "TaskFlow адаптується.",
62
+ "hero_desc": "Перший візуальний конструктор цілей, створений для фокусу. Переходьте від лінійних списків до адаптивних графів, які впораються з життєвими моментами «Якщо/То».",
63
+ "hero_badge": "Підходить для людей з РДУГ. Створено для стійкості.",
64
+ "node_a": "Завдання А",
65
+ "node_b": "Завдання Б",
66
+ "node_failed": "Невдача?",
67
+ "node_c": "Завдання В",
68
+ "node_d": "Завдання Г",
69
+ "adhd_edge": "РДУГ-перевага",
70
+ "ai_find_path": "Дозвольте ШІ знайти шлях, коли ви застрягли.",
71
+ "ai_desc": "TaskFlow бере на себе когнітивне навантаження. Коли план заходить у глухий кут, наш ШІ-агент малює повне дерево стратегії, знаходячи альтернативи, щоб вам не доводилося робити це вручну.",
72
+ "ai_example_input": "Я застряг на залученні користувачів. Що робити?",
73
+ "ai_adapt_plan": "Адаптувати план",
74
+ "ai_early_users": "Залучити перших користувачів",
75
+ "cross_platform": "Кросплатформність",
76
+ "cross_platform_desc": "Не втрачайте свій потік у дорозі. TaskFlow працює за принципом offline-first, безперешкодно синхронізуючи ваші графи цілей між усіма пристроями, щойно ви знову з'явитеся в мережі.",
77
+ "cta_title_p1": "Припиніть боротися зі своїм мозком.",
78
+ "cta_title_p2": "Почніть малювати шляхи."
79
+ },
80
+ "pricing": {
81
+ "title": "Прості тарифи",
82
+ "subtitle": "Жодних прихованих комісій, лише чисте чорнило.",
83
+ "free": "Безкоштовно",
84
+ "pro": "Pro",
85
+ "team": "Team",
86
+ "month": "місяць",
87
+ "user": "користувач",
88
+ "start_free": "Почати безкоштовно",
89
+ "go_pro": "Спробувати Pro",
90
+ "contact_us": "Зв'язатися з нами",
91
+ "free_feat1": "3 нескінченних полотна",
92
+ "free_feat2": "Базові форми та логіка",
93
+ "free_feat3": "Шаблони спільноти",
94
+ "pro_feat1": "Необмежена кількість полотен",
95
+ "pro_feat2": "ШІ-генерація шляхів",
96
+ "pro_feat3": "Розширене відстеження звичок",
97
+ "pro_feat4": "Пріоритетна підтримка",
98
+ "team_feat1": "Усе з тарифу Pro",
99
+ "team_feat2": "Спільна робота в реальному часі",
100
+ "team_feat3": "Командні робочі простори",
101
+ "team_feat4": "Адміністративні інструменти",
102
+ "premium_feature": "Преміум функція",
103
+ "paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.",
104
+ "upgrade_premium": "Оновити до Преміум",
105
+ "maybe_later": "Можливо пізніше"
106
+ },
107
+ "auth": {
108
+ "welcome_back": "З поверненням!",
109
+ "create_account": "Створити акаунт",
110
+ "sign_in_desc": "Увійдіть, щоб продовжити свою подорож",
111
+ "sign_up_desc": "Приєднуйтесь до TaskFlow, щоб досягати своїх цілей",
112
+ "email": "Електронна адреса",
113
+ "password": "Пароль",
114
+ "name": "Повне ім'я",
115
+ "sign_in": "Увійти",
116
+ "sign_up": "Зареєструватися",
117
+ "no_account": "Немає акаунту? Зареєструватися",
118
+ "has_account": "Вже маєте акаунт? Увійти",
119
+ "passwords_do_not_match": "Паролі не збігаються",
120
+ "start_flow": "Почніть свій потік",
121
+ "plans_waiting": "Ваші плани чекають на вас.",
122
+ "join_revolution": "Приєднуйтесь до візуальної революції.",
123
+ "full_name": "Повне ім'я",
124
+ "enter_name": "Введіть ваше ім'я",
125
+ "forgot": "Забули?",
126
+ "confirm_password": "Підтвердьте пароль",
127
+ "processing": "Обробка...",
128
+ "enter_workspace": "Увійти в робочий простір",
129
+ "or_continue": "Або продовжити за допомогою",
130
+ "google_failed": "Помилка входу через Google",
131
+ "dont_have_account": "Немає акаунту? Зареєструватися",
132
+ "already_member": "Вже є учасником? Увійти"
133
+ },
134
+ "onboarding": {
135
+ "title": "Ласкаво просимо до TaskFlow",
136
+ "subtitle": "Давайте налаштуємо вашу карту цілей",
137
+ "step1_title": "Візуальні вузли цілей",
138
+ "step1_desc": "Зобразіть свої мрії у вигляді взаємопов'язаних вузлів на чудовому полотні. Розбивайте великі цілі на дрібні кроки.",
139
+ "step2_title": "Динамічна логіка",
140
+ "step2_desc": "Додавайте перевірки умов (вибір Так/Ні), щоб моделювати альтернативні шляхи.",
141
+ "step3_title": "Авто-розкладка і шаблони",
142
+ "step3_desc": "Почніть із шаблону й тримайте дошку в порядку одним кліком.",
143
+ "next": "Далі",
144
+ "back": "Назад",
145
+ "lets_go": "Поїхали!",
146
+ "step_0": {
147
+ "title": "Полотно цілей",
148
+ "description": "Забудьте про лінійні списки. TaskFlow — це цифровий альбом для малювання, де ваші ідеї живуть у візуальному графі. Вільно масштабуйте, панорамуйте та розширюйте свої думки до нескінченності.",
149
+ "note": "Ваш мозок не працює як список, то чому ваші завдання мають бути такими?"
150
+ },
151
+ "step_1": {
152
+ "title": "Логіка та зв'язки",
153
+ "description": "З'єднуйте вузли за допомогою логіки «Якщо/То». Визначайте, що відбувається у разі успіху або невдачі завдання. Будуйте стійкий план на будь-який випадок.",
154
+ "note": "Якщо відбувається А, то робимо Б. Якщо ні, спробуйте В."
155
+ },
156
+ "step_2": {
157
+ "title": "Авто-розкладка і шаблони",
158
+ "description": "Почніть із шаблону, а коли на дошці стане безладно, натисніть Shift+L — TaskFlow вишикує кроки в акуратний потік.",
159
+ "note": "Менше перетягування блоків — більше справ."
160
+ },
161
+ "step_3": {
162
+ "title": "Дофамін та фокус",
163
+ "description": "Отримуйте бали за виконані кроки й відкривайте досягнення. TaskFlow тримає мотивацію і фокус на головному.",
164
+ "note": "Перетворіть рутину на гру, яка вам подобається."
165
+ },
166
+ "visual": {
167
+ "goal": "Ціль",
168
+ "success": "Успіх",
169
+ "blocked": "Безлад на дошці",
170
+ "ai_generating": "Shift+L",
171
+ "streak_text": "Досягнення відкрито!"
172
+ },
173
+ "step_indicator": "Крок {{current}} з {{total}}",
174
+ "begin": "Почнемо!",
175
+ "next_chapter": "Наступний розділ"
176
+ },
177
+ "dashboard": {
178
+ "your_projects": "Ваші проекти",
179
+ "search_placeholder": "Пошук проектів...",
180
+ "new_blank_canvas": "Нове чисте полотно",
181
+ "project": "Проект",
182
+ "active_steps": "активних кроків",
183
+ "loading_projects": "Завантаження проектів...",
184
+ "no_projects": "Проектів ще немає. Створіть чисте полотно, щоб почати!",
185
+ "create_project_title": "Створити новий проект",
186
+ "project_name": "Назва проекту",
187
+ "project_desc": "Опис проекту",
188
+ "cancel": "Скасувати",
189
+ "create": "Створити",
190
+ "delete_title": "Видалити проект",
191
+ "delete_confirm": "Ви впевнені, що хочете видалити цей проект? Цю дію не можна скасувати.",
192
+ "delete": "Видалити"
193
+ },
194
+ "habits": {
195
+ "habit_tracker": "Трекер звичок",
196
+ "consistency_score": "Показник стабільнос��і",
197
+ "consistency_desc": "Цього тижня ви входите до 5% найкращих стратегів!",
198
+ "active_streak": "Активна серія",
199
+ "days": "днів",
200
+ "today_check_in": "Сьогоднішній чеклист звичок",
201
+ "weekly_streak": "Календар тижневої серії",
202
+ "streak": "серія",
203
+ "no_habits": "Звички поки що не відстежуються. Додайте власні звички на ваше полотно цілей, щоб побачити їх тут!",
204
+ "complete": "Виконано",
205
+ "pending": "Очікується",
206
+ "loading": "Завантаження полотен зі звичками...",
207
+ "no_habits_title": "Поки що немає полотен зі звичками",
208
+ "reward_desc": "Виконуйте звички на ваших картах стратегій, щоб швидше підвищувати рівень.",
209
+ "track_for_date": "Відстежити для {{date}}",
210
+ "complete_notification_title": "Звичку виконано! 🔥",
211
+ "complete_notification_desc_custom": "Зафіксовано виконання для {{date}}",
212
+ "complete_notification_desc": "Активну серію збільшено! Нараховано +50 XP!",
213
+ "recharge_notification_title": "Звичку перезаряджено! ⚡",
214
+ "recharge_notification_desc": "Звичка \"{{name}}\" знову готова до виконання!",
215
+ "recharge_notification_header": "ЗВИЧКА ГОТОВА"
216
+ },
217
+ "profile": {
218
+ "profile": "Профіль",
219
+ "user_level": "Рівень користувача",
220
+ "experience": "Досвід",
221
+ "stats": "Статистика",
222
+ "completed_goals": "Виконані цілі",
223
+ "active_habits": "Активні звички",
224
+ "experience_points": "Очки досвіду",
225
+ "level_progress": "Прогрес рівня",
226
+ "achievements": "Блокнот досягнень",
227
+ "unlocked": "Розблоковано",
228
+ "locked": "Заблоковано",
229
+ "total_points": "Всього очок"
230
+ },
231
+ "settings": {
232
+ "settings": "Налаштування",
233
+ "general": "Загальні",
234
+ "canvas": "Налаштування полотна",
235
+ "account_billing": "Обліковий запис та оплата",
236
+ "theme": "Налаштування додатка",
237
+ "preferred_language": "Бажана мова",
238
+ "theme_label": "Візуальна тема",
239
+ "dark_mode": "Темна тема",
240
+ "light_mode": "Світла тема",
241
+ "security": "Безпека",
242
+ "update_password": "Оновити пароль",
243
+ "delete_account": "Видалити акаунт",
244
+ "subscription": "Тарифний план",
245
+ "upgrade_pro": "Оновити до TaskFlow Pro",
246
+ "cancel_sub": "Скасувати підписку",
247
+ "saved_success": "Налаштування успішно оновлено!",
248
+ "slogan": "Налаштуйте свій робочий простір до ідеалу.",
249
+ "general_preferences": "Загальні налаштування",
250
+ "theme_desc": "Перемикання між світлою та темною темами.",
251
+ "notifications_title": "Сповіщення на робочому столі",
252
+ "notifications_desc": "Отримуйте сповіщення про терміни виконання завдань та нагадування про звички.",
253
+ "language_desc": "Виберіть основну мову інтерфейсу.",
254
+ "canvas_behavior": "Поведінка полотна",
255
+ "ai_guidance_title": "Активне керівництво ШІ",
256
+ "ai_guidance_desc": "Дозволити ШІ проактивно пропонувати альтернативні шляхи, коли ви відзначаєте вузол як заблокований.",
257
+ "snap_to_grid_title": "Прив'язка до сітки",
258
+ "snap_to_grid_desc": "Автоматично вирівнювати вузли по лініях сітки для охайнішого вигляду.",
259
+ "default_node_color": "Колір вузла за замовчуванням",
260
+ "data_management": "Управління даними",
261
+ "export_json": "Експорт у JSON",
262
+ "import_vault": "Імпорт сховища",
263
+ "danger_zone": "Небезпечна зона",
264
+ "delete_desc": "Ця дія є незворотною. Всі ваші карти та звички будуть стерті.",
265
+ "delete_forever": "Видалити назавжди"
266
+ },
267
+ "canvas": {
268
+ "new_goal": "Нова ціль",
269
+ "new_habit": "Нова звичка",
270
+ "new_condition": "Нова умова?",
271
+ "ai_assistant": "ШІ-помічник",
272
+ "ai_thinking": "ШІ думає...",
273
+ "premium_feature": "Преміум функція",
274
+ "paywall_desc": "ШІ-адаптація цілей — це преміум-функція. Оновіть до TaskFlow Pro, щоб генерувати альтернативні шляхи та розблокувати розширену логіку.",
275
+ "upgrade_premium": "Оновити до Преміум",
276
+ "maybe_later": "Можливо пізніше",
277
+ "roadmap_strategist": "Стратег дорожньої карти",
278
+ "drafting_roadmap": "Створення вашої дорожньої карти...",
279
+ "strategist_desc": "\" Стратег малює оптимальні з'єднання шляхів, підцілі та контрольні точки на вашому полотні... \"",
280
+ "bubble_text": "\" Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні. \"",
281
+ "quick_suggestions": "Швидкі пропозиції",
282
+ "suggestion_detail": "Розбити поточний крок на підзавдання",
283
+ "suggestion_route": "Запропонувати альтернативний шлях у разі невдачі",
284
+ "suggestion_habits": "Створити щоденні звички для зміцнення цієї цілі",
285
+ "input_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...",
286
+ "tag_detail": "Деталізація",
287
+ "tag_route": "Маршрут",
288
+ "tag_habits": "Звички",
289
+ "condition_yes": "Так",
290
+ "condition_no": "Ні",
291
+ "condition_node_label": "Умова",
292
+ "ai_suggest_details": "Розбити поточний крок на підзавдання",
293
+ "ai_suggest_details_tag": "Деталізація",
294
+ "ai_suggest_route": "Запропонувати альтернативний шлях у разі невдачі",
295
+ "ai_suggest_route_tag": "Альтернатива",
296
+ "canvas.ai_suggest_habits": "Створити щоденні звички для зміцнення цієї цілі",
297
+ "ai_suggest_habits_tag": "Звички",
298
+ "ai_roadmap_strategist": "Стратег дорожньої карти",
299
+ "ai_maintenance_title": "ШІ на обслуговуванні",
300
+ "ai_maintenance_desc": "Ми оновлюємо нашого ШІ-стратега для забезпечення ще швидшої, точнішої та гнучкішої генерації планів. Дякуємо за ваше терпіння!",
301
+ "ai_maintenance_btn": "Зрозуміло",
302
+ "ai_drafting": "Створення вашої дорожньої карти...",
303
+ "ai_drafting_desc": "Стратег малює оптимальні з'єднання шляхів, підцілі та контрольні точки на вашому полотні...",
304
+ "ai_bubble_desc": "Розкажіть мені, чого ви хочете досягти або де ви застрягли. Я процедурно намалюю завдання, альтернативи та умови прямо на вашому цифровому полотні.",
305
+ "ai_quick_suggestions": "Швидкі пропозиції",
306
+ "ai_placeholder": "наприклад, Намалюй план із 5 кроків для вивчення ASP.NET Core з динамічними умовами...",
307
+ "condition": "Умова",
308
+ "strategic_goal_map": "Візуальна карта цілей",
309
+ "save_strategy": "Зберегти стратегію",
310
+ "saving": "Збереження...",
311
+ "export_empty_error": "Карта порожня! Додайте вузли перед експортом.",
312
+ "subgoal_warning": "Неможливо виконати: спочатку завершіть всі суб-цілі!",
313
+ "subgoals_progress": "Суб-цілі: {{done}} з {{total}} виконано",
314
+ "export_error": "Помилка при експорті в PNG:",
315
+ "habit": "Звичка",
316
+ "habit_status": "Status",
317
+ "habit_status_done": "Виконано",
318
+ "habit_status_pending": "Очікує",
319
+ "habit_action_done": "Зроблено!",
320
+ "habit_action_todo": "Виконати",
321
+ "habit_reset_rule": "Правило скидання",
322
+ "habit_countdown_label": "До скидання",
323
+ "habit_resetting": "Скидання...",
324
+ "habit_signal_active": "ДАЄ СИГНАЛ ⚡",
325
+ "habit_signal_inactive": "СИГНАЛ ВИМК. 💤",
326
+ "habit_test_reset": "Тест-скидання",
327
+ "habit_test_reset_tooltip": "Скинути звичку та всі пов'язані з нею наступні цілі прямо зараз",
328
+ "habit_rule_daily": "Щодня о {{time}}",
329
+ "habit_rule_weekly": "Щотижня ({{day}}) о {{time}}",
330
+ "habit_rule_hourly": "Кожні {{hours}} год",
331
+ "habit_rule_minutely": "Кожні {{minutes}} хв",
332
+ "habit_rule_days": "К��жні {{days}} дн",
333
+ "habit_rule_mixed": "Кожні {{hours}} год {{minutes}} хв",
334
+ "habit_reset_hours_label": "Годин",
335
+ "habit_reset_minutes_label": "Хвилин",
336
+ "condition_min_options_error": "Умова повинна мати принаймні один варіант (пін)!",
337
+ "condition_settings_title": "Налаштування умови",
338
+ "condition_text_label": "Текст умови",
339
+ "condition_text_placeholder": "наприклад, Оплата пройшла успешно?",
340
+ "condition_options_label": "Варіанти (Вихідні піни)",
341
+ "condition_multiselect_label": "Кілька варіантів вибору",
342
+ "condition_multiselect_desc": "Дозволити одночасну активацію кількох виходів",
343
+ "habit_settings_title": "Налаштування звички",
344
+ "habit_name_label": "Назва звички",
345
+ "habit_name_placeholder": "наприклад, Вивчення англійської",
346
+ "habit_description_label": "Опис / Примітка",
347
+ "habit_description_placeholder": "Деталі або мотивація...",
348
+ "habit_reset_mode_label": "Режим скидання",
349
+ "habit_reset_daily": "Щодня (Daily)",
350
+ "habit_reset_weekly": "Щотижня (Weekly)",
351
+ "habit_reset_interval": "Свій інтервал",
352
+ "habit_reset_time_label": "Час скидання (типово 00:00)",
353
+ "habit_reset_time_label_short": "Час скидання",
354
+ "habit_reset_day_label": "День тижня",
355
+ "habit_reset_interval_value": "Скидати кожні",
356
+ "habit_interval_minutes": "хвилин",
357
+ "habit_interval_hours": "годин",
358
+ "habit_interval_days": "днів",
359
+ "context_menu": {
360
+ "create_node": "СТВОРИТИ НОДУ",
361
+ "goal_node": "Ціль (Sketch Node)",
362
+ "subgoal_node": "Суб-ціль (Sub-goal)",
363
+ "condition_node": "Умова (Condition)",
364
+ "habit_node": "Звичка (Habit)",
365
+ "export_png": "Експорт в PNG",
366
+ "delete": "Видалити",
367
+ "insert_template": "Вставити шаблон",
368
+ "auto_layout": "Авто-розкладка"
369
+ },
370
+ "toolbar": {
371
+ "auto_layout": "Авто-розкладка (Shift+L)",
372
+ "templates": "Шаблони"
373
+ }
374
+ },
375
+ "achievements": {
376
+ "unlocked_header": "Досягнення розблоковано!",
377
+ "notification_header": "Сповіщення",
378
+ "blank_canvas": {
379
+ "title": "Чисте полотно",
380
+ "description": "Створіть свій перший проект (граф)."
381
+ },
382
+ "connecting_the_dots": {
383
+ "title": "З'єднання точок",
384
+ "description": "Створіть 10 зв'язків між завданнями."
385
+ },
386
+ "sketch_master": {
387
+ "title": "Майстер ескізів",
388
+ "description": "Створіть загалом 100 вузлів завдань."
389
+ },
390
+ "daily_doodler": {
391
+ "title": "Щоденний рисувальник",
392
+ "description": "Відстежте звички 7 разів."
393
+ },
394
+ "decision_maker": {
395
+ "title": "Рішучий діяч",
396
+ "description": "Виконайте 50 завдань."
397
+ },
398
+ "clear_desk": {
399
+ "title": "Чистий стіл",
400
+ "description": "Видаліть 5 проектів."
401
+ },
402
+ "first_milestone": {
403
+ "title": "Перша віха",
404
+ "description": "Виконайте своє перше завдання."
405
+ },
406
+ "self_portrait": {
407
+ "title": "Автопортрет",
408
+ "description": "Завантажте свій аватар профілю."
409
+ }
410
+ },
411
+ "subscription": {
412
+ "title": "Розблокуйте професійні інструменти TaskFlow",
413
+ "title_p1": "Розблокуйте ",
414
+ "title_highlight": "професійні інструменти",
415
+ "title_p2": " TaskFlow",
416
+ "subtitle": "Припиніть гадати. Почніть проектувати за допомогою ШІ та отримайте повну творчу свободу.",
417
+ "most_recommended": "Найбільш рекомендовано",
418
+ "per_month": "/ міс",
419
+ "social_proof": "Нам довіряють понад 10 000 стратегів у всьому світі",
420
+ "features": {
421
+ "ai_genius": "ШІ-Геній",
422
+ "ai_genius_desc": "Генерація шляхів на базі GPT-4",
423
+ "infinite": "Нескінченність",
424
+ "infinite_desc": "Без обмежень на вузли чи зв'язки",
425
+ "secure": "Безпека",
426
+ "secure_desc": "Шифрування банківського рівня AES-256",
427
+ "custom": "Персоналізація",
428
+ "custom_desc": "Повна палітра тем для вашого полотна"
429
+ },
430
+ "plans": {
431
+ "free": {
432
+ "title": "Безкоштовний старт",
433
+ "desc": "Ідеально підходить для швидких особистих ескізів і простого проектування цілей.",
434
+ "btn": "Залишитися на Безкоштовному",
435
+ "feat1": "3 ШІ-генерації на день",
436
+ "feat2": "Максимум 3 полотна",
437
+ "feat3": "Максимум 200 вузлів на полотні",
438
+ "feat4": "Максимум 3 звички",
439
+ "feat5": "Максимум 2 особи на дошці"
440
+ },
441
+ "pro": {
442
+ "title": "Альбом Pro",
443
+ "desc": "Розкрийте весь потенціал стратегії під керівництвом ШІ та отримайте безмежні можливості створення карт.",
444
+ "btn": "Оновити до Pro",
445
+ "feat1": "200 ШІ-генерацій на день",
446
+ "feat2": "Необмежено полотен та вузлів",
447
+ "feat3": "Необмежено звичок",
448
+ "feat4": "Максимум 10 осіб на дошці",
449
+ "feat5": "Розширена аналітика стратегій"
450
+ },
451
+ "ultra": {
452
+ "title": "Альбом Ultra",
453
+ "desc": "Ідеальний інструмент для повної свободи творчості та власних шаблонів.",
454
+ "btn": "Оновити до Ultra",
455
+ "feat1": "Необмежено ШІ-генерацій",
456
+ "feat2": "Необмежено полотен та вузлів",
457
+ "feat3": "Необмежено звичок",
458
+ "feat4": "Необмежено осіб на дошці",
459
+ "feat5": "Створення власних шаблонів",
460
+ "feat6": "Пріоритетна підтримка та VIP інструменти"
461
+ }
462
+ },
463
+ "upgrade_success": "Тарифний план успішно змінено на {{tier}}!",
464
+ "upgrading": "Оновлення...",
465
+ "current_plan": "Поточний тариф",
466
+ "compare": {
467
+ "feature": "Функція",
468
+ "ai_gens": "Генерацій ШІ / день",
469
+ "canvases": "Канваси",
470
+ "nodes": "Нод на канвас",
471
+ "habits": "Звички",
472
+ "board_members": "Учасники дошки",
473
+ "custom_templates": "Власні шаблони"
474
+ }
475
+ },
476
+ "plans": {
477
+ "no_limits": "Без лімітів",
478
+ "switched": "Ваш тариф тепер {{plan}}.",
479
+ "payments_soon": "Онлайн-оплату ще не підключено. Plus скоро стане доступним.",
480
+ "switch_failed": "Не вдалося змінити тариф. Спробуйте ще раз.",
481
+ "free_desc": "Усе, що потрібно для власних планів.",
482
+ "free_btn": "Перейти на Free",
483
+ "plus_desc": "Для великих планів і команд. Жодних обмежень.",
484
+ "plus_btn": "Отримати Plus",
485
+ "feat_boards": "До {{count}} дошок",
486
+ "feat_nodes": "До {{count}} вузлів на дошці",
487
+ "feat_guests": "До {{count}} гостей на дошці",
488
+ "feat_templates": "Збережених шаблонів: {{count}}",
489
+ "feat_core": "Усі типи вузлів, авто-розкладка, експорт PNG/JSON",
490
+ "feat_unlimited_boards": "Безліміт дошок",
491
+ "feat_unlimited_nodes": "Безліміт вузлів",
492
+ "feat_unlimited_guests": "Безліміт учасників",
493
+ "feat_unlimited_templates": "Безліміт шаблонів",
494
+ "feat_everything_free": "Усе з Free",
495
+ "row_boards": "Дошки",
496
+ "row_nodes": "Вузлів на дошці",
497
+ "row_guests": "Гостей на дошці",
498
+ "row_templates": "Збережені шаблони",
499
+ "title_p1": "Два тарифи. ",
500
+ "title_highlight": "Без дрібного шрифту.",
501
+ "subtitle": "У Free невеликі ліміти на створення. У Plus їх немає.",
502
+ "limit_title": "Ліміт тарифу Free",
503
+ "limit_nodes_desc": "На тарифі Free дошка вміщує до {{count}} вузлів. У Plus лімітів немає.",
504
+ "see_plus": "Детальніше про Plus"
505
+ },
506
+ "templates": {
507
+ "untitled": "Дошка без назви",
508
+ "tab_all": "Усі",
509
+ "tab_builtin": "Стартові",
510
+ "tab_mine": "Мої шаблони",
511
+ "delete_confirm": "Видалити",
512
+ "delete": "Видалити шаблон",
513
+ "blank": "Порожня дошка",
514
+ "blank_desc": "Почати з чистого холста.",
515
+ "node_count": "Вузлів: {{count}}",
516
+ "create_title": "Нова дошка",
517
+ "insert_title": "Вставити шаблон",
518
+ "create_desc": "Почніть з порожньої дошки або з шаблону. Шаблони розкладаються автоматично.",
519
+ "insert_desc": "Шабл��н додається в центр екрана й лишається виділеним, щоб його можна було перемістити.",
520
+ "search": "Пошук шаблонів...",
521
+ "all_categories": "Усі категорії",
522
+ "empty_mine": "Збережених шаблонів ще немає",
523
+ "nothing_found": "Нічого не знайдено",
524
+ "empty_mine_hint": "Відкрийте будь-яку дошку й натисніть «Зберегти як шаблон» — усю дошку або лише виділені вузли.",
525
+ "free_note": "Тариф Free: {{used}}/{{max}} збережених шаблонів.",
526
+ "go_plus": "У Plus ліміту немає",
527
+ "create_btn": "Створити дошку",
528
+ "insert_btn": "Вставити",
529
+ "my_category": "Мої шаблони",
530
+ "save_failed": "Не вдалося зберегти шаблон.",
531
+ "save_title": "Зберегти як шаблон",
532
+ "saved": "Шаблон збережено",
533
+ "only_selected": "Виділене ({{count}})",
534
+ "whole_board": "Уся дошка",
535
+ "field_title": "Назва",
536
+ "field_desc": "Опис",
537
+ "field_category": "Категорія",
538
+ "save_hint": "Статуси, прогрес і виконавці не зберігаються — шаблон стає чистою відправною точкою.",
539
+ "save_btn": "Зберегти шаблон"
540
+ }
541
+ }
src/pages/CanvasPage.jsx CHANGED
@@ -83,7 +83,7 @@ const getTransformForBoundsCustom = (bounds, width, height, minZoom, maxZoom, pa
83
  import Sidebar from '../components/Sidebar';
84
  import { useAuth } from '../context/AuthContext';
85
  import { useTheme } from '../context/ThemeContext';
86
- 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';
87
 
88
  // Feature components
89
  import SketchNode from '../features/canvas/components/nodes/SketchNode';
@@ -96,10 +96,12 @@ import DrawNode from '../features/canvas/components/nodes/DrawNode';
96
  import PathNode from '../features/canvas/components/nodes/PathNode';
97
  import StickerEdge from '../features/canvas/components/StickerEdge';
98
  import CanvasToolbar from '../features/canvas/components/CanvasToolbar';
99
- import AIHintOverlay from '../features/canvas/components/AIHintOverlay';
100
  import PaywallModal from '../features/canvas/components/PaywallModal';
101
  import { useCanvasLogic } from '../features/canvas/hooks/useCanvasLogic';
102
  import { isDefaultLabel } from '../features/canvas/utils';
 
 
 
103
 
104
  // Premium digital sketchbook style settings modal for condition nodes
105
  const ConditionSettingsModal = ({ node, onClose, onSave }) => {
@@ -1225,103 +1227,6 @@ const CollaborativeCursors = ({ cursors }) => {
1225
  );
1226
  };
1227
 
1228
- const SaveTemplateModal = ({ projectId, initialTitle, initialDesc, onClose }) => {
1229
- const { t } = useTranslation();
1230
- const [title, setTitle] = useState(initialTitle || '');
1231
- const [desc, setDesc] = useState(initialDesc || '');
1232
- const [loading, setLoading] = useState(false);
1233
- const [error, setError] = useState('');
1234
- const [success, setSuccess] = useState(false);
1235
-
1236
- const handleSubmit = async (e) => {
1237
- e.preventDefault();
1238
- if (!title.trim()) return;
1239
- setLoading(true);
1240
- setError('');
1241
- try {
1242
- const API_URL = import.meta.env.VITE_API_URL;
1243
- await axios.post(`${API_URL}/graphs/${projectId}/save-as-template`, {
1244
- title,
1245
- description: desc
1246
- });
1247
- setSuccess(true);
1248
- setTimeout(() => {
1249
- onClose();
1250
- }, 1500);
1251
- } catch (err) {
1252
- console.error('[SaveTemplate] Failed to save template:', err);
1253
- setError(err.response?.data?.message || 'Не вдалося зберегти шаблон. Перевірте підключення.');
1254
- } finally {
1255
- setLoading(false);
1256
- }
1257
- };
1258
-
1259
- return (
1260
- <div className="fixed inset-0 z-[60] flex items-center justify-center p-4">
1261
- <div onClick={onClose} className="absolute inset-0 bg-primary/20 backdrop-blur-sm z-[60]" />
1262
- <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]">
1263
- <button type="button" onClick={onClose} className="absolute top-4 right-4 text-on-surface-variant hover:text-primary transition-colors cursor-pointer">
1264
- <X size={24} />
1265
- </button>
1266
- <h3 className="text-3xl font-display-lg text-primary flex items-center gap-2">
1267
- <BookOpen size={24} />
1268
- <span>Зберегти як шаблон</span>
1269
- </h3>
1270
- {success ? (
1271
- <div className="py-6 text-center text-green-600 font-bold text-xl">
1272
- Шаблон успішно збережено!
1273
- </div>
1274
- ) : (
1275
- <form onSubmit={handleSubmit} className="space-y-6">
1276
- {error && (
1277
- <div className="bg-error/10 text-error p-3 rough-border text-sm font-bold">
1278
- {error}
1279
- </div>
1280
- )}
1281
- <div className="relative group">
1282
- <label className="text-xs font-bold text-primary uppercase tracking-wider block mb-1">Назва шаблону</label>
1283
- <input
1284
- type="text"
1285
- value={title}
1286
- onChange={(e) => setTitle(e.target.value)}
1287
- placeholder="Введіть назву..."
1288
- 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"
1289
- required
1290
- />
1291
- </div>
1292
- <div className="relative group">
1293
- <label className="text-xs font-bold text-primary uppercase tracking-wider block mb-1">Опис шаблону</label>
1294
- <textarea
1295
- rows={3}
1296
- value={desc}
1297
- onChange={(e) => setDesc(e.target.value)}
1298
- placeholder="Введіть короткий опис..."
1299
- 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"
1300
- />
1301
- </div>
1302
- <div className="flex gap-4">
1303
- <button
1304
- type="button"
1305
- onClick={onClose}
1306
- className="flex-1 py-3 text-sm font-bold border-2 border-primary/10 rounded-xl hover:bg-primary/5 cursor-pointer"
1307
- >
1308
- Скасувати
1309
- </button>
1310
- <button
1311
- type="submit"
1312
- disabled={loading || !title.trim()}
1313
- 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"
1314
- >
1315
- {loading ? 'Збереження...' : 'Зберегти'}
1316
- </button>
1317
- </div>
1318
- </form>
1319
- )}
1320
- </div>
1321
- </div>
1322
- );
1323
- };
1324
-
1325
  const ShareModal = ({ projectId, onClose }) => {
1326
  const { t } = useTranslation();
1327
  const [email, setEmail] = useState('');
@@ -1558,7 +1463,7 @@ const TaskListView = ({
1558
 
1559
  const getSubtasks = useCallback((parentId) => {
1560
  const list = nodes
1561
- .filter(n => n.type === 'sketch' || n.type === 'habit')
1562
  .filter(n => findParentId(n.id) === parentId);
1563
 
1564
  return [...list].sort((a, b) => (a.position?.y || 0) - (b.position?.y || 0));
@@ -1619,7 +1524,7 @@ const TaskListView = ({
1619
 
1620
  const orderedRootTasks = useMemo(() => {
1621
  const rootTasks = nodes
1622
- .filter(n => n.type === 'sketch' || n.type === 'habit')
1623
  .filter(n => findParentId(n.id) === null);
1624
 
1625
  return [...rootTasks]
@@ -2061,7 +1966,7 @@ const TaskListView = ({
2061
  </div>
2062
  <h4 className="text-lg font-display-md text-primary mb-2">Немає завдань</h4>
2063
  <p className="text-xs font-bold uppercase tracking-widest text-primary/50 max-w-md mx-auto leading-relaxed">
2064
- Створіть цілі або звички на холсті або змініть налаштування фільтрації у верхній панелі!
2065
  </p>
2066
  </div>
2067
  ) : (
@@ -2081,7 +1986,10 @@ const CanvasInner = () => {
2081
  const { screenToFlowPosition, getNodes, fitView } = useReactFlow();
2082
  const mousePosRef = useRef({ x: window.innerWidth / 2, y: window.innerHeight / 2 });
2083
 
2084
- const {
 
 
 
2085
  setNodes,
2086
  nodes,
2087
  edges,
@@ -2089,15 +1997,8 @@ const CanvasInner = () => {
2089
  onEdgesChange,
2090
  onConnect,
2091
  onEdgesDelete,
2092
- isAIActive,
2093
- setIsAIActive,
2094
- aiLoading,
2095
- submitAICanvasPrompt,
2096
- chatMessages,
2097
- setChatMessages,
2098
  showPaywall,
2099
  setShowPaywall,
2100
- handleAIRequest,
2101
  addNewNodeAt,
2102
  handleCopy,
2103
  handleCut,
@@ -2129,12 +2030,6 @@ const CanvasInner = () => {
2129
  canRedo,
2130
  takeHistorySnapshot,
2131
  updateProjectMetadata,
2132
- chatThreads,
2133
- activeThreadId,
2134
- setActiveThreadId,
2135
- createNewThread,
2136
- deleteThread,
2137
- renameThread,
2138
  isLoading
2139
  } = useCanvasLogic(id, user);
2140
 
@@ -2253,14 +2148,44 @@ const CanvasInner = () => {
2253
  const [isShareModalOpen, setIsShareModalOpen] = useState(false);
2254
  const [isEditingMetadata, setIsEditingMetadata] = useState(false);
2255
  const [isSaveTemplateOpen, setIsSaveTemplateOpen] = useState(false);
2256
- const [saveTemplateTitle, setSaveTemplateTitle] = useState('');
2257
- const [saveTemplateDesc, setSaveTemplateDesc] = useState('');
2258
 
2259
- const handleSaveTemplateClick = () => {
2260
- setSaveTemplateTitle(projectTitle || '');
2261
- setSaveTemplateDesc(projectData?.description || '');
2262
- setIsSaveTemplateOpen(true);
2263
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2264
 
2265
  // Global Brush Mode States
2266
  const [drawingMode, setDrawingMode] = useState(false);
@@ -2606,6 +2531,14 @@ const CanvasInner = () => {
2606
  return;
2607
  }
2608
 
 
 
 
 
 
 
 
 
2609
  if (event.key === 'Delete' || event.key === 'Backspace') {
2610
  if (permission === 'Read') return; // Read-only restriction!
2611
 
@@ -2623,7 +2556,7 @@ const CanvasInner = () => {
2623
 
2624
  window.addEventListener('keydown', handleKeyDown, { capture: true });
2625
  return () => window.removeEventListener('keydown', handleKeyDown, { capture: true });
2626
- }, [nodes, edges, deleteNode, deleteEdge, permission, handleCopy, handleCut, handlePaste, undo, redo, requestDeletion, processClipboardData]);
2627
 
2628
  const handleNodeContextMenu = useCallback(
2629
  (event, node) => {
@@ -2911,9 +2844,9 @@ const CanvasInner = () => {
2911
  </button>
2912
  )}
2913
 
2914
- {permission === 'Owner' && user?.subscriptionTier === 'Ultra' && (
2915
- <button
2916
- onClick={handleSaveTemplateClick}
2917
  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"
2918
  >
2919
  <BookOpen size={20} />
@@ -2947,8 +2880,6 @@ const CanvasInner = () => {
2947
  >
2948
  {permission !== 'Read' && (
2949
  <CanvasToolbar
2950
- handleAIRequest={handleAIRequest}
2951
- isAIActive={isAIActive}
2952
  user={user}
2953
  addNewNodeAt={addNewNodeAt}
2954
  handleCopy={handleCopy}
@@ -2968,6 +2899,9 @@ const CanvasInner = () => {
2968
  canRedo={canRedo}
2969
  drawingMode={drawingMode}
2970
  setDrawingMode={setDrawingMode}
 
 
 
2971
  />
2972
  )}
2973
 
@@ -3038,20 +2972,6 @@ const CanvasInner = () => {
3038
  </svg>
3039
  )}
3040
 
3041
- <AIHintOverlay
3042
- isAIActive={isAIActive}
3043
- setIsAIActive={setIsAIActive}
3044
- aiLoading={aiLoading}
3045
- submitAICanvasPrompt={submitAICanvasPrompt}
3046
- chatMessages={chatMessages}
3047
- setChatMessages={setChatMessages}
3048
- chatThreads={chatThreads}
3049
- activeThreadId={activeThreadId}
3050
- setActiveThreadId={setActiveThreadId}
3051
- createNewThread={createNewThread}
3052
- deleteThread={deleteThread}
3053
- renameThread={renameThread}
3054
- />
3055
  <PaywallModal showPaywall={showPaywall} setShowPaywall={setShowPaywall} />
3056
 
3057
  {contextMenu && contextMenu.type === 'node' && (
@@ -3208,17 +3128,31 @@ const CanvasInner = () => {
3208
  <GitFork size={15} className="text-primary" />
3209
  <span>{t('canvas.context_menu.condition_node')}</span>
3210
  </button>
 
3211
  <button
3212
  onClick={(e) => {
3213
  e.stopPropagation();
3214
- addNewNodeAt(contextMenu.clientX, contextMenu.clientY, 'habit');
3215
  setContextMenu(null);
3216
  }}
3217
  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"
3218
  >
3219
- <Timer size={15} className="text-secondary" />
3220
- <span>{t('canvas.context_menu.habit_node')}</span>
3221
  </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
3222
 
3223
  {window.__flowClipboard && window.__flowClipboard.nodes && window.__flowClipboard.nodes.length > 0 && (
3224
  <>
@@ -3318,27 +3252,6 @@ const CanvasInner = () => {
3318
  <GitFork size={15} className="text-primary" />
3319
  <span>{t('canvas.context_menu.condition_node')}</span>
3320
  </button>
3321
- <button
3322
- onClick={(e) => {
3323
- e.stopPropagation();
3324
- const newNodeId = addNewNodeAt(contextMenu.clientX, contextMenu.clientY, 'habit');
3325
- if (contextMenu.connectionSource && newNodeId) {
3326
- const { nodeId, handleId, handleType } = contextMenu.connectionSource;
3327
- const isSource = handleType === 'source';
3328
- onConnect({
3329
- source: isSource ? nodeId : newNodeId,
3330
- target: isSource ? newNodeId : nodeId,
3331
- sourceHandle: isSource ? handleId : null,
3332
- targetHandle: isSource ? null : handleId
3333
- });
3334
- }
3335
- setContextMenu(null);
3336
- }}
3337
- 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"
3338
- >
3339
- <Timer size={15} className="text-secondary" />
3340
- <span>{t('canvas.context_menu.habit_node')}</span>
3341
- </button>
3342
  </div>
3343
  )}
3344
  </div>
@@ -3418,13 +3331,22 @@ const CanvasInner = () => {
3418
  )}
3419
 
3420
  {isSaveTemplateOpen && (
3421
- <SaveTemplateModal
3422
- projectId={id}
3423
- initialTitle={saveTemplateTitle}
3424
- initialDesc={saveTemplateDesc}
 
 
3425
  onClose={() => setIsSaveTemplateOpen(false)}
3426
  />
3427
  )}
 
 
 
 
 
 
 
3428
  </main>
3429
  </div>
3430
  );
 
83
  import Sidebar from '../components/Sidebar';
84
  import { useAuth } from '../context/AuthContext';
85
  import { useTheme } from '../context/ThemeContext';
86
+ 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';
87
 
88
  // Feature components
89
  import SketchNode from '../features/canvas/components/nodes/SketchNode';
 
96
  import PathNode from '../features/canvas/components/nodes/PathNode';
97
  import StickerEdge from '../features/canvas/components/StickerEdge';
98
  import CanvasToolbar from '../features/canvas/components/CanvasToolbar';
 
99
  import PaywallModal from '../features/canvas/components/PaywallModal';
100
  import { useCanvasLogic } from '../features/canvas/hooks/useCanvasLogic';
101
  import { isDefaultLabel } from '../features/canvas/utils';
102
+ import TemplateGallery from '../features/templates/TemplateGallery';
103
+ import SaveTemplateModal from '../features/templates/SaveTemplateModal';
104
+ import { takePendingTemplate } from '../features/templates/templatesApi';
105
 
106
  // Premium digital sketchbook style settings modal for condition nodes
107
  const ConditionSettingsModal = ({ node, onClose, onSave }) => {
 
1227
  );
1228
  };
1229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1230
  const ShareModal = ({ projectId, onClose }) => {
1231
  const { t } = useTranslation();
1232
  const [email, setEmail] = useState('');
 
1463
 
1464
  const getSubtasks = useCallback((parentId) => {
1465
  const list = nodes
1466
+ .filter(n => n.type === 'sketch')
1467
  .filter(n => findParentId(n.id) === parentId);
1468
 
1469
  return [...list].sort((a, b) => (a.position?.y || 0) - (b.position?.y || 0));
 
1524
 
1525
  const orderedRootTasks = useMemo(() => {
1526
  const rootTasks = nodes
1527
+ .filter(n => n.type === 'sketch')
1528
  .filter(n => findParentId(n.id) === null);
1529
 
1530
  return [...rootTasks]
 
1966
  </div>
1967
  <h4 className="text-lg font-display-md text-primary mb-2">Немає завдань</h4>
1968
  <p className="text-xs font-bold uppercase tracking-widest text-primary/50 max-w-md mx-auto leading-relaxed">
1969
+ Створіть цілі на холсті або змініть налаштування фільтрації у верхній панелі!
1970
  </p>
1971
  </div>
1972
  ) : (
 
1986
  const { screenToFlowPosition, getNodes, fitView } = useReactFlow();
1987
  const mousePosRef = useRef({ x: window.innerWidth / 2, y: window.innerHeight / 2 });
1988
 
1989
+ const {
1990
+ autoLayout,
1991
+ insertTemplate,
1992
+ serializeTemplate,
1993
  setNodes,
1994
  nodes,
1995
  edges,
 
1997
  onEdgesChange,
1998
  onConnect,
1999
  onEdgesDelete,
 
 
 
 
 
 
2000
  showPaywall,
2001
  setShowPaywall,
 
2002
  addNewNodeAt,
2003
  handleCopy,
2004
  handleCut,
 
2030
  canRedo,
2031
  takeHistorySnapshot,
2032
  updateProjectMetadata,
 
 
 
 
 
 
2033
  isLoading
2034
  } = useCanvasLogic(id, user);
2035
 
 
2148
  const [isShareModalOpen, setIsShareModalOpen] = useState(false);
2149
  const [isEditingMetadata, setIsEditingMetadata] = useState(false);
2150
  const [isSaveTemplateOpen, setIsSaveTemplateOpen] = useState(false);
2151
+ const [isTemplateGalleryOpen, setIsTemplateGalleryOpen] = useState(false);
2152
+ const [templateDropPoint, setTemplateDropPoint] = useState(null);
2153
 
2154
+ const flowNodeCount = nodes.filter(n => !n.hidden && (n.type === 'sketch' || n.type === 'condition')).length;
2155
+
2156
+ const handleAutoLayout = useCallback(() => {
2157
+ const moved = autoLayout();
2158
+ if (moved > 0 && !nodes.some(n => n.selected)) {
2159
+ setTimeout(() => fitView({ duration: 600, padding: 0.15, maxZoom: 1 }), 600);
2160
+ }
2161
+ }, [autoLayout, fitView, nodes]);
2162
+
2163
+ const openTemplateGallery = useCallback((point = null) => {
2164
+ setTemplateDropPoint(point);
2165
+ setIsTemplateGalleryOpen(true);
2166
+ }, []);
2167
+
2168
+ const handleInsertTemplate = useCallback((template) => {
2169
+ const ids = insertTemplate(template.content, { screenPoint: templateDropPoint || undefined });
2170
+ setIsTemplateGalleryOpen(false);
2171
+ if (ids && ids.length) {
2172
+ setTimeout(() => fitView({ nodes: ids.map(id => ({ id })), duration: 600, padding: 0.3, maxZoom: 1 }), 80);
2173
+ }
2174
+ }, [insertTemplate, templateDropPoint, fitView]);
2175
+
2176
+ // A board created from a template on the dashboard: insert it once the empty board has loaded
2177
+ useEffect(() => {
2178
+ if (!id || isLoading || !isVisualizing) return;
2179
+ const pending = takePendingTemplate(id);
2180
+ if (!pending) return;
2181
+ const ids = insertTemplate(pending);
2182
+ if (ids && ids.length) {
2183
+ setTimeout(() => {
2184
+ setNodes(nds => nds.map(n => (n.selected ? { ...n, selected: false } : n)));
2185
+ fitView({ duration: 700, padding: 0.2, maxZoom: 1 });
2186
+ }, 80);
2187
+ }
2188
+ }, [id, isLoading, isVisualizing, insertTemplate, fitView, setNodes]);
2189
 
2190
  // Global Brush Mode States
2191
  const [drawingMode, setDrawingMode] = useState(false);
 
2531
  return;
2532
  }
2533
 
2534
+ // Shift+L: auto-layout (selection or whole board)
2535
+ if (event.shiftKey && !event.ctrlKey && !event.metaKey && (event.code === 'KeyL')) {
2536
+ if (permission === 'Read') return;
2537
+ event.preventDefault();
2538
+ handleAutoLayout();
2539
+ return;
2540
+ }
2541
+
2542
  if (event.key === 'Delete' || event.key === 'Backspace') {
2543
  if (permission === 'Read') return; // Read-only restriction!
2544
 
 
2556
 
2557
  window.addEventListener('keydown', handleKeyDown, { capture: true });
2558
  return () => window.removeEventListener('keydown', handleKeyDown, { capture: true });
2559
+ }, [nodes, edges, deleteNode, deleteEdge, permission, handleCopy, handleCut, handlePaste, undo, redo, requestDeletion, processClipboardData, handleAutoLayout]);
2560
 
2561
  const handleNodeContextMenu = useCallback(
2562
  (event, node) => {
 
2844
  </button>
2845
  )}
2846
 
2847
+ {permission !== 'Read' && (
2848
+ <button
2849
+ onClick={() => setIsSaveTemplateOpen(true)}
2850
  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"
2851
  >
2852
  <BookOpen size={20} />
 
2880
  >
2881
  {permission !== 'Read' && (
2882
  <CanvasToolbar
 
 
2883
  user={user}
2884
  addNewNodeAt={addNewNodeAt}
2885
  handleCopy={handleCopy}
 
2899
  canRedo={canRedo}
2900
  drawingMode={drawingMode}
2901
  setDrawingMode={setDrawingMode}
2902
+ onAutoLayout={handleAutoLayout}
2903
+ onOpenTemplates={() => openTemplateGallery()}
2904
+ canAutoLayout={flowNodeCount >= 2}
2905
  />
2906
  )}
2907
 
 
2972
  </svg>
2973
  )}
2974
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2975
  <PaywallModal showPaywall={showPaywall} setShowPaywall={setShowPaywall} />
2976
 
2977
  {contextMenu && contextMenu.type === 'node' && (
 
3128
  <GitFork size={15} className="text-primary" />
3129
  <span>{t('canvas.context_menu.condition_node')}</span>
3130
  </button>
3131
+
3132
  <button
3133
  onClick={(e) => {
3134
  e.stopPropagation();
3135
+ openTemplateGallery({ x: contextMenu.clientX, y: contextMenu.clientY });
3136
  setContextMenu(null);
3137
  }}
3138
  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"
3139
  >
3140
+ <LayoutTemplate size={15} className="text-primary" />
3141
+ <span>{t('canvas.context_menu.insert_template', 'Вставити шаблон')}</span>
3142
  </button>
3143
+ {flowNodeCount >= 2 && (
3144
+ <button
3145
+ onClick={(e) => {
3146
+ e.stopPropagation();
3147
+ handleAutoLayout();
3148
+ setContextMenu(null);
3149
+ }}
3150
+ 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"
3151
+ >
3152
+ <Network size={15} className="text-primary" />
3153
+ <span>{t('canvas.context_menu.auto_layout', 'Авто-розкладка')}</span>
3154
+ </button>
3155
+ )}
3156
 
3157
  {window.__flowClipboard && window.__flowClipboard.nodes && window.__flowClipboard.nodes.length > 0 && (
3158
  <>
 
3252
  <GitFork size={15} className="text-primary" />
3253
  <span>{t('canvas.context_menu.condition_node')}</span>
3254
  </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3255
  </div>
3256
  )}
3257
  </div>
 
3331
  )}
3332
 
3333
  {isSaveTemplateOpen && (
3334
+ <SaveTemplateModal
3335
+ open
3336
+ serialize={serializeTemplate}
3337
+ selectedCount={nodes.filter(n => n.selected && !n.hidden).length}
3338
+ initialTitle={projectTitle || ''}
3339
+ initialDesc={projectData?.description || ''}
3340
  onClose={() => setIsSaveTemplateOpen(false)}
3341
  />
3342
  )}
3343
+
3344
+ <TemplateGallery
3345
+ open={isTemplateGalleryOpen}
3346
+ mode="insert"
3347
+ onClose={() => setIsTemplateGalleryOpen(false)}
3348
+ onUse={handleInsertTemplate}
3349
+ />
3350
  </main>
3351
  </div>
3352
  );
src/pages/DashboardPage.jsx CHANGED
@@ -1,24 +1,15 @@
1
  import React, { useState, useEffect } from 'react';
2
- import axios from 'axios';
3
- import { motion, AnimatePresence } from 'framer-motion';
4
  import { useNavigate } from 'react-router-dom';
5
  import { useTranslation } from 'react-i18next';
6
- import { Search, Plus, X, Sparkles, BookOpen, Pencil, Rocket, Code, Languages, Activity, Gamepad, DollarSign } from 'lucide-react';
7
-
8
- const ICON_MAP = {
9
- Rocket,
10
- Code,
11
- Languages,
12
- Activity,
13
- Gamepad,
14
- DollarSign,
15
- BookOpen
16
- };
17
  import Sidebar from '../components/Sidebar';
18
  import { useAuth } from '../context/AuthContext';
19
  import ProjectCard from '../features/dashboard/components/ProjectCard';
20
  import { useDashboardLogic } from '../features/dashboard/hooks/useDashboardLogic';
21
  import Modal from '../components/shared/Modal';
 
 
22
 
23
  const DashboardPage = () => {
24
  const { user } = useAuth();
@@ -34,18 +25,15 @@ const DashboardPage = () => {
34
  const {
35
  projects,
36
  loading,
37
- aiGenerating,
38
  searchTerm,
39
  setSearchTerm,
40
  handleCreateProject,
41
- handleCreateProjectWithAI,
42
  handleDeleteProject,
43
  ownedCount
44
  } = useDashboardLogic(user);
45
 
46
- const isFree = !user?.subscriptionTier || user?.subscriptionTier === 'Free';
47
- const canvasLimit = isFree ? 3 : Infinity;
48
- const isAtCanvasLimit = isFree && ownedCount >= canvasLimit;
49
 
50
  const handleOpenCreate = () => {
51
  if (isAtCanvasLimit) {
@@ -59,96 +47,14 @@ const DashboardPage = () => {
59
  const [isDeleteOpen, setIsDeleteOpen] = useState(false);
60
  const [projectToDelete, setProjectToDelete] = useState(null);
61
 
62
- // Custom Creation Modal states
63
- const [scratchTitle, setScratchTitle] = useState('');
64
- const [createMode, setCreateMode] = useState('ai'); // 'ai' | 'manual'
65
- const [aiGoal, setAiGoal] = useState('');
66
-
67
- // Templates selection states
68
- const [templates, setTemplates] = useState([]);
69
- const [templatesLoading, setTemplatesLoading] = useState(true);
70
- const [selectedTemplate, setSelectedTemplate] = useState(null);
71
- const [templateProjectName, setTemplateProjectName] = useState('');
72
-
73
- useEffect(() => {
74
- if (!isCreateOpen) {
75
- setScratchTitle('');
76
- setAiGoal('');
77
- setCreateMode('manual');
78
- setSelectedTemplate(null);
79
- setTemplateProjectName('');
80
- }
81
- }, [isCreateOpen]);
82
-
83
- useEffect(() => {
84
- const fetchTemplates = async () => {
85
- try {
86
- const API_URL = import.meta.env.VITE_API_URL;
87
- const res = await axios.get(`${API_URL}/graphs/templates`);
88
- setTemplates(res.data || []);
89
- } catch (err) {
90
- console.error('[Templates] Failed to fetch templates:', err);
91
- } finally {
92
- setTemplatesLoading(false);
93
- }
94
- };
95
- fetchTemplates();
96
- }, []);
97
-
98
- const selectTemplate = (template) => {
99
- setSelectedTemplate(template);
100
- setTemplateProjectName(template.title);
101
- };
102
-
103
- const handleTemplateSubmit = (e) => {
104
- e.preventDefault();
105
- if (!selectedTemplate) return;
106
- const title = templateProjectName.trim() || selectedTemplate.title;
107
- handleCreateProject(title, selectedTemplate.key);
108
- setIsCreateOpen(false);
109
- };
110
-
111
- // Sketchbook Loader states
112
- const [loadingStepIndex, setLoadingStepIndex] = useState(0);
113
-
114
- const loadingSteps = [
115
- t('canvas.loading_step1', "Sharpening graphite pencils..."),
116
- t('canvas.loading_step2', "Opening clean parchment..."),
117
- t('canvas.loading_step3', "Calibrating creative compass..."),
118
- t('canvas.loading_step4', "Consulting the digital oracle..."),
119
- t('canvas.loading_step5', "Sketching outline nodes..."),
120
- t('canvas.loading_step6', "Inking critical paths..."),
121
- t('canvas.loading_step7', "Blowing dry the ink...")
122
- ];
123
-
124
- useEffect(() => {
125
- let interval;
126
- if (aiGenerating) {
127
- setLoadingStepIndex(0);
128
- interval = setInterval(() => {
129
- setLoadingStepIndex((prev) => (prev + 1) % loadingSteps.length);
130
- }, 3500);
131
- }
132
- return () => clearInterval(interval);
133
- }, [aiGenerating]);
134
-
135
  const openDeleteModal = (id) => {
136
  setProjectToDelete(id);
137
  setIsDeleteOpen(true);
138
  };
139
 
140
- const handleScratchSubmit = (e) => {
141
- e.preventDefault();
142
- if (!scratchTitle.trim()) return;
143
- handleCreateProject(scratchTitle);
144
- setIsCreateOpen(false);
145
- };
146
-
147
- const handleAISubmit = (e) => {
148
- e.preventDefault();
149
- if (!aiGoal.trim()) return;
150
- handleCreateProjectWithAI(aiGoal);
151
- setIsCreateOpen(false);
152
  };
153
 
154
  return (
@@ -238,330 +144,13 @@ const DashboardPage = () => {
238
  </div>
239
  </section>
240
 
241
- {/* Tabbed Creation Modal */}
242
- <AnimatePresence>
243
- {isCreateOpen && (
244
- <div className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6">
245
- {/* Backdrop */}
246
- <motion.div
247
- initial={{ opacity: 0 }}
248
- animate={{ opacity: 1 }}
249
- exit={{ opacity: 0 }}
250
- onClick={() => setIsCreateOpen(false)}
251
- className="absolute inset-0 bg-primary/20 backdrop-blur-sm animate-fade-in"
252
- />
253
-
254
- {/* Modal Card */}
255
- <motion.div
256
- initial={{ scale: 0.9, opacity: 0, y: 20, rotate: -1 }}
257
- animate={{ scale: 1, opacity: 1, y: 0, rotate: 0 }}
258
- exit={{ scale: 0.9, opacity: 0, y: 20, rotate: 1 }}
259
- className={`relative bg-surface-container-lowest w-full ${
260
- createMode === 'template' ? 'max-w-3xl' : 'max-w-lg'
261
- } p-8 rough-border rough-shadow flex flex-col gap-6 z-10 transition-all duration-300`}
262
- >
263
- {/* Close Button */}
264
- <button
265
- onClick={() => setIsCreateOpen(false)}
266
- className="absolute top-4 right-4 text-on-surface-variant hover:text-primary transition-colors"
267
- >
268
- <X size={24} />
269
- </button>
270
-
271
- <div className="flex flex-col gap-2 mt-2">
272
- <h3 className="text-3xl font-display-lg text-primary flex items-center gap-2">
273
- <BookOpen size={24} />
274
- <span>{t('dashboard.create_project_title')}</span>
275
- </h3>
276
- <p className="font-body-md text-on-surface-variant">
277
- {createMode === 'ai'
278
- ? 'Дозвольте ШІ розробити для вас детальну дорожню карту цілі.'
279
- : t('dashboard.create_project_desc', 'Create an empty roadmap and shape your connections manually.')}
280
- </p>
281
- </div>
282
-
283
- {/* Tab Switcher */}
284
- <div className="flex border-b-2 border-primary/10 gap-2 pb-1">
285
- <button
286
- type="button"
287
- onClick={() => setCreateMode('ai')}
288
- className={`flex-grow py-2 text-sm font-bold uppercase transition-all flex items-center justify-center gap-1.5 border-2 ${
289
- createMode === 'ai'
290
- ? 'bg-primary text-white border-primary shadow-[2px_2px_0px_0px_var(--color-primary)]'
291
- : 'border-transparent text-primary/75 hover:bg-secondary/5 hover:border-primary/20'
292
- } rounded-xl cursor-pointer`}
293
- >
294
- <Sparkles size={16} />
295
- <span>AI Стратег</span>
296
- </button>
297
- <button
298
- type="button"
299
- onClick={() => setCreateMode('template')}
300
- className={`flex-grow py-2 text-sm font-bold uppercase transition-all flex items-center justify-center gap-1.5 border-2 ${
301
- createMode === 'template'
302
- ? 'bg-primary text-white border-primary shadow-[2px_2px_0px_0px_var(--color-primary)]'
303
- : 'border-transparent text-primary/75 hover:bg-secondary/5 hover:border-primary/20'
304
- } rounded-xl cursor-pointer`}
305
- >
306
- <BookOpen size={16} />
307
- <span>Шаблони</span>
308
- </button>
309
- <button
310
- type="button"
311
- onClick={() => setCreateMode('manual')}
312
- className={`flex-grow py-2 text-sm font-bold uppercase transition-all flex items-center justify-center gap-1.5 border-2 ${
313
- createMode === 'manual'
314
- ? 'bg-primary text-white border-primary shadow-[2px_2px_0px_0px_var(--color-primary)]'
315
- : 'border-transparent text-primary/75 hover:bg-secondary/5 hover:border-primary/20'
316
- } rounded-xl cursor-pointer`}
317
- >
318
- <Pencil size={16} />
319
- <span>Ручний ескіз</span>
320
- </button>
321
- </div>
322
-
323
- {createMode === 'ai' ? (
324
- <form onSubmit={handleAISubmit} className="flex flex-col gap-6 mt-2">
325
- <div className="relative group">
326
- <label className="text-sm font-bold text-primary uppercase tracking-wider block mb-1">
327
- Опишіть вашу мету
328
- </label>
329
- <textarea
330
- autoFocus
331
- rows={3}
332
- value={aiGoal}
333
- onChange={(e) => setAiGoal(e.target.value)}
334
- placeholder="Наприклад: Вивчити основи React та побудувати портф��ліо за 4 тижні"
335
- 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"
336
- />
337
- <p className="text-[10px] font-extrabold uppercase text-amber-600 mt-1">
338
- * Наш ШІ розіб'є вашу мету на кроки, додасть звички та розрахує позиції!
339
- </p>
340
- </div>
341
-
342
- <div className="flex items-center justify-end gap-4 mt-2">
343
- <button
344
- type="button"
345
- onClick={() => setIsCreateOpen(false)}
346
- className="px-6 py-2 font-bold text-lg text-on-surface-variant hover:text-primary transition-all"
347
- >
348
- {t('dashboard.cancel')}
349
- </button>
350
- <motion.button
351
- whileHover={{ scale: 1.05, rotate: -1 }}
352
- whileTap={{ scale: 0.95 }}
353
- type="submit"
354
- disabled={!aiGoal.trim()}
355
- 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"
356
- >
357
- <Sparkles size={20} />
358
- <span>Генерувати</span>
359
- </motion.button>
360
- </div>
361
- </form>
362
- ) : createMode === 'template' ? (
363
- <div className="flex flex-col gap-6 mt-2">
364
- {templatesLoading ? (
365
- <div className="flex justify-center py-12">
366
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
367
- </div>
368
- ) : (
369
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4 max-h-[320px] overflow-y-auto pr-2 custom-scrollbar">
370
- {templates.map((tpl) => {
371
- const IconComp = ICON_MAP[tpl.icon] || BookOpen;
372
- const isSelected = selectedTemplate?.key === tpl.key;
373
- return (
374
- <div
375
- key={tpl.key}
376
- onClick={() => selectTemplate(tpl)}
377
- className={`border-2 rounded-xl p-4 transition-all duration-200 cursor-pointer flex gap-4 relative overflow-hidden group ${
378
- isSelected
379
- ? 'bg-primary/5 border-primary shadow-[3px_3px_0px_0px_var(--color-primary)]'
380
- : 'border-primary/10 hover:border-primary/30 bg-surface-container-low hover:bg-surface-container-high'
381
- }`}
382
- >
383
- <div className={`w-12 h-12 rounded-xl flex items-center justify-center shrink-0 transition-transform group-hover:scale-105 ${
384
- isSelected ? 'bg-primary text-white' : 'bg-primary/10 text-primary'
385
- }`}>
386
- <IconComp size={24} />
387
- </div>
388
- <div className="flex flex-col flex-grow min-w-0">
389
- <div className="flex justify-between items-start gap-2">
390
- <span className="font-display-lg text-lg text-primary font-bold leading-tight break-words">
391
- {tpl.title}
392
- </span>
393
- </div>
394
- <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">
395
- {tpl.category}
396
- </span>
397
- <p className="font-body-sm text-xs text-on-surface-variant/80 mt-2 line-clamp-2">
398
- {tpl.description}
399
- </p>
400
- </div>
401
- </div>
402
- );
403
- })}
404
- </div>
405
- )}
406
-
407
- {selectedTemplate && (
408
- <form onSubmit={handleTemplateSubmit} className="flex flex-col gap-4 border-t-2 border-primary/5 pt-4 animate-fade-in">
409
- <div className="relative group">
410
- <label className="text-xs font-bold text-primary uppercase tracking-wider block mb-1">
411
- Назва проекту
412
- </label>
413
- <input
414
- type="text"
415
- value={templateProjectName}
416
- onChange={(e) => setTemplateProjectName(e.target.value)}
417
- placeholder={selectedTemplate.title}
418
- 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"
419
- required
420
- />
421
- </div>
422
-
423
- <div className="flex items-center justify-end gap-4 mt-2">
424
- <button
425
- type="button"
426
- onClick={() => setIsCreateOpen(false)}
427
- className="px-6 py-2 font-bold text-lg text-on-surface-variant hover:text-primary transition-all"
428
- >
429
- {t('dashboard.cancel')}
430
- </button>
431
- <motion.button
432
- whileHover={{ scale: 1.05, rotate: -1 }}
433
- whileTap={{ scale: 0.95 }}
434
- type="submit"
435
- 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"
436
- >
437
- <Plus size={20} />
438
- <span>{t('dashboard.create')}</span>
439
- </motion.button>
440
- </div>
441
- </form>
442
- )}
443
- </div>
444
- ) : (
445
- <form onSubmit={handleScratchSubmit} className="flex flex-col gap-6 mt-2">
446
- <div className="relative group">
447
- <label className="text-sm font-bold text-primary uppercase tracking-wider block mb-1">
448
- {t('dashboard.project_name')}
449
- </label>
450
- <input
451
- autoFocus
452
- type="text"
453
- value={scratchTitle}
454
- onChange={(e) => setScratchTitle(e.target.value)}
455
- placeholder={t('dashboard.project_name_placeholder', 'e.g. Master Classical Piano')}
456
- 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"
457
- />
458
- </div>
459
-
460
- <div className="flex items-center justify-end gap-4 mt-4">
461
- <button
462
- type="button"
463
- onClick={() => setIsCreateOpen(false)}
464
- className="px-6 py-2 font-bold text-lg text-on-surface-variant hover:text-primary transition-all"
465
- >
466
- {t('dashboard.cancel')}
467
- </button>
468
- <motion.button
469
- whileHover={{ scale: 1.05, rotate: -1 }}
470
- whileTap={{ scale: 0.95 }}
471
- type="submit"
472
- disabled={!scratchTitle.trim()}
473
- 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"
474
- >
475
- <Plus size={20} />
476
- <span>{t('dashboard.create')}</span>
477
- </motion.button>
478
- </div>
479
- </form>
480
- )}
481
- </motion.div>
482
- </div>
483
- )}
484
- </AnimatePresence>
485
-
486
- {/* Playful Sketchbook Loading Overlay */}
487
- <AnimatePresence>
488
- {aiGenerating && (
489
- <motion.div
490
- initial={{ opacity: 0 }}
491
- animate={{ opacity: 1 }}
492
- exit={{ opacity: 0 }}
493
- className="fixed inset-0 z-[100] flex items-center justify-center p-6 bg-background/80 backdrop-blur-md"
494
- >
495
- <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">
496
- {/* Animated Sketching Pencil and Notebook */}
497
- <div className="relative w-32 h-32 flex items-center justify-center border-4 border-dashed border-primary/20 rounded-full">
498
- <motion.div
499
- animate={{
500
- x: [0, 15, -15, 10, -10, 0],
501
- y: [0, -10, 10, -5, 5, 0],
502
- rotate: [0, 10, -10, 5, -5, 0]
503
- }}
504
- transition={{
505
- repeat: Infinity,
506
- duration: 2.5,
507
- ease: "easeInOut"
508
- }}
509
- className="absolute z-10"
510
- >
511
- <Pencil size={56} className="text-primary" />
512
- </motion.div>
513
-
514
- <motion.div
515
- animate={{ scale: [1, 1.05, 0.95, 1] }}
516
- transition={{ repeat: Infinity, duration: 2.5 }}
517
- className="opacity-20 text-secondary"
518
- >
519
- <BookOpen size={64} />
520
- </motion.div>
521
- </div>
522
-
523
- <div className="flex flex-col gap-3">
524
- <h2 className="text-4xl font-display-lg text-primary tracking-tight">
525
- {t('canvas.drafting_roadmap')}
526
- </h2>
527
- <p className="font-accent-note text-2xl text-secondary">
528
- {t('canvas.strategist_desc')}
529
- </p>
530
- </div>
531
-
532
- {/* Rotating playful loading step */}
533
- <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">
534
- <AnimatePresence mode="wait">
535
- <motion.p
536
- key={loadingStepIndex}
537
- initial={{ opacity: 0, y: 10 }}
538
- animate={{ opacity: 1, y: 0 }}
539
- exit={{ opacity: 0, y: -10 }}
540
- transition={{ duration: 0.3 }}
541
- className="text-lg font-body-md text-on-surface-variant italic font-semibold"
542
- >
543
- {loadingSteps[loadingStepIndex]}
544
- </motion.p>
545
- </AnimatePresence>
546
- </div>
547
-
548
- {/* Sketchy loading progress bar */}
549
- <div className="w-full bg-surface-container-high h-3 rounded-full overflow-hidden border-2 border-primary/20">
550
- <motion.div
551
- animate={{
552
- width: ["0%", "30%", "65%", "85%", "95%", "95%"],
553
- }}
554
- transition={{
555
- duration: 25,
556
- ease: "easeOut"
557
- }}
558
- className="bg-primary h-full"
559
- />
560
- </div>
561
- </div>
562
- </motion.div>
563
- )}
564
- </AnimatePresence>
565
 
566
  <Modal
567
  isOpen={isDeleteOpen}
 
1
  import React, { useState, useEffect } from 'react';
2
+ import { motion } from 'framer-motion';
 
3
  import { useNavigate } from 'react-router-dom';
4
  import { useTranslation } from 'react-i18next';
5
+ import { Search, Plus } from 'lucide-react';
 
 
 
 
 
 
 
 
 
 
6
  import Sidebar from '../components/Sidebar';
7
  import { useAuth } from '../context/AuthContext';
8
  import ProjectCard from '../features/dashboard/components/ProjectCard';
9
  import { useDashboardLogic } from '../features/dashboard/hooks/useDashboardLogic';
10
  import Modal from '../components/shared/Modal';
11
+ import TemplateGallery from '../features/templates/TemplateGallery';
12
+ import { FREE_LIMITS, isPlus } from '../config/plans';
13
 
14
  const DashboardPage = () => {
15
  const { user } = useAuth();
 
25
  const {
26
  projects,
27
  loading,
28
+ creating,
29
  searchTerm,
30
  setSearchTerm,
31
  handleCreateProject,
 
32
  handleDeleteProject,
33
  ownedCount
34
  } = useDashboardLogic(user);
35
 
36
+ const isAtCanvasLimit = !isPlus(user) && ownedCount >= FREE_LIMITS.boards;
 
 
37
 
38
  const handleOpenCreate = () => {
39
  if (isAtCanvasLimit) {
 
47
  const [isDeleteOpen, setIsDeleteOpen] = useState(false);
48
  const [projectToDelete, setProjectToDelete] = useState(null);
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  const openDeleteModal = (id) => {
51
  setProjectToDelete(id);
52
  setIsDeleteOpen(true);
53
  };
54
 
55
+ const handleUseTemplate = async (template, title) => {
56
+ const ok = await handleCreateProject(title, template);
57
+ if (ok) setIsCreateOpen(false);
 
 
 
 
 
 
 
 
 
58
  };
59
 
60
  return (
 
144
  </div>
145
  </section>
146
 
147
+ <TemplateGallery
148
+ open={isCreateOpen}
149
+ mode="create"
150
+ busy={creating}
151
+ onClose={() => setIsCreateOpen(false)}
152
+ onUse={handleUseTemplate}
153
+ />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
  <Modal
156
  isOpen={isDeleteOpen}
src/pages/LandingPage.jsx CHANGED
@@ -1,674 +1,401 @@
1
- import React, { useEffect } from 'react';
2
- import { motion } from 'framer-motion';
3
  import { useNavigate } from 'react-router-dom';
 
 
 
 
 
4
  import { useAuth } from '../context/AuthContext';
 
 
 
 
5
 
6
- const fadeInUp = {
7
- initial: { opacity: 0, y: 30 },
8
- animate: { opacity: 1, y: 0 },
9
- transition: { duration: 0.8, ease: "easeOut" }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  };
11
 
12
- const staggerContainer = {
13
- animate: {
14
- transition: {
15
- staggerChildren: 0.2
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  };
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  const LandingPage = () => {
21
  const { user } = useAuth();
22
  const navigate = useNavigate();
 
 
 
 
23
 
24
  useEffect(() => {
25
- if (user) {
26
- navigate('/dashboard');
27
- }
28
  }, [user, navigate]);
29
 
30
- // Force Light Theme on Landing Page
31
  useEffect(() => {
32
  const root = document.documentElement;
33
- const wasDark = root.classList.contains('dark');
34
- if (wasDark) {
35
- root.classList.remove('dark');
36
- }
37
  return () => {
38
- const savedTheme = localStorage.getItem('theme');
39
- if (savedTheme === 'dark') {
40
- root.classList.add('dark');
41
- }
42
  };
43
  }, []);
44
 
 
 
 
 
 
 
 
 
 
 
 
45
  return (
46
- <div className="flex flex-col items-center w-full">
47
-
48
- {/* Section 1: Hero */}
49
- <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">
50
- <motion.div
51
- variants={staggerContainer}
52
- initial="initial"
53
- animate="animate"
54
- className="max-w-4xl flex flex-col gap-6"
55
- >
56
- <motion.h1
57
- variants={fadeInUp}
58
- className="text-7xl md:text-8xl font-display-lg text-primary leading-tight"
59
- >
60
- Plans break. <br />
61
- <span className="highlighter-bg px-4">TaskFlow adapts.</span>
62
- </motion.h1>
63
- <motion.p
64
- variants={fadeInUp}
65
- className="text-2xl md:text-3xl text-on-surface-variant max-w-3xl mx-auto leading-relaxed"
66
- >
67
- The first visual goal constructor designed for focus. Move from linear lists to adaptive graphs that handle life's "If/Then" moments.
68
- </motion.p>
69
- <motion.div
70
- variants={fadeInUp}
71
- className="mt-6 font-accent-note text-3xl text-secondary flex items-center justify-center gap-3"
72
- >
73
- <span className="material-symbols-outlined text-4xl" style={{ fontVariationSettings: '"FILL" 1' }}>psychology</span>
74
- ADHD-friendly. Resilience-driven.
75
- </motion.div>
76
- </motion.div>
77
 
78
- {/* Hero Visual: Mockup */}
79
- <motion.div
80
- initial={{ opacity: 0, scale: 0.95 }}
81
- whileInView={{ opacity: 1, scale: 1 }}
82
- viewport={{ once: true }}
83
- transition={{ duration: 1, ease: "easeOut" }}
84
- 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"
85
- >
86
- {/* SVG Connections - Premium Organic Curves */}
87
- <svg className="absolute inset-0 w-full h-full pointer-events-none overflow-visible" style={{ zIndex: 0 }}>
88
- <defs>
89
- <marker id="arrowhead" markerWidth="10" markerHeight="7" refX="0" refY="3.5" orient="auto">
90
- <polygon points="0 0, 10 3.5, 0 7" fill="#181919" />
91
- </marker>
92
- </defs>
93
- {/* Path A -> B */}
94
- <motion.path
95
- initial={{ pathLength: 0 }}
96
- whileInView={{ pathLength: 1 }}
97
- viewport={{ once: true }}
98
- transition={{ duration: 1.5, ease: "easeInOut" }}
99
- d="M 180 250 Q 260 220 340 250"
100
- fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round" strokeDasharray="8 6"
101
- />
102
- {/* Path B -> Decision */}
103
- <motion.path
104
- initial={{ pathLength: 0 }}
105
- whileInView={{ pathLength: 1 }}
106
- viewport={{ once: true }}
107
- transition={{ duration: 1.2, delay: 0.5 }}
108
- d="M 460 250 Q 530 250 580 250"
109
- fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round"
110
- />
111
- {/* Path Decision -> C */}
112
- <motion.path
113
- initial={{ pathLength: 0 }}
114
- whileInView={{ pathLength: 1 }}
115
- viewport={{ once: true }}
116
- transition={{ duration: 1.2, delay: 1.5 }}
117
- d="M 720 250 Q 780 160 850 160"
118
- fill="none" stroke="#45a84a" strokeWidth="4" strokeLinecap="round"
119
- />
120
- {/* Path Decision -> D */}
121
- <motion.path
122
- initial={{ pathLength: 0 }}
123
- whileInView={{ pathLength: 1 }}
124
- viewport={{ once: true }}
125
- transition={{ duration: 1.2, delay: 1.7 }}
126
- d="M 720 250 Q 780 340 850 340"
127
- fill="none" stroke="#ba1a1a" strokeWidth="4" strokeLinecap="round"
128
- />
129
- {/* Hand-drawn Annotations */}
130
- <motion.g initial={{ opacity: 0 }} whileInView={{ opacity: 1 }} transition={{ delay: 2.2 }}>
131
- <text fill="#45a84a" fontFamily="Caveat" fontSize="34" x="780" y="130" className="rotate-[-5deg]">Success!</text>
132
- <text fill="#ba1a1a" fontFamily="Caveat" fontSize="34" x="780" y="390" className="rotate-[5deg]">Try Again</text>
133
- <text fill="#181919" fontFamily="Caveat" fontSize="24" x="250" y="210">Step 1</text>
134
- </motion.g>
135
- {/* Decorative Scribble */}
136
- <motion.path
137
- initial={{ pathLength: 0, opacity: 0 }}
138
- whileInView={{ pathLength: 1, opacity: 0.15 }}
139
- transition={{ delay: 3, duration: 2 }}
140
- d="M 50 100 Q 150 50 100 150 T 200 100"
141
- fill="none" stroke="var(--color-primary)" strokeWidth="2"
142
- />
143
  </svg>
144
-
145
- {/* Nodes */}
146
- {[
147
- { label: 'Task A', pos: 'left-12 top-[210px]', rot: -2, delay: 0.2 },
148
- { label: 'Task B', pos: 'left-[340px] top-[210px]', rot: 1, delay: 0.4 },
149
- { label: 'Failed?', pos: 'left-[580px] top-[180px]', rot: 45, diamond: true, delay: 0.6 },
150
- { label: 'Task C', pos: 'right-12 top-[120px]', rot: 2, delay: 0.8, color: '#45a84a' },
151
- { label: 'Task D', pos: 'right-12 top-[300px]', rot: -1, delay: 1.0, color: '#ba1a1a' }
152
- ].map((node, i) => (
153
- <motion.div
154
- key={i}
155
- initial={{ opacity: 0, scale: 0 }}
156
- whileInView={{ opacity: 1, scale: 1 }}
157
- animate={{
158
- y: [0, i % 2 === 0 ? -8 : 8, 0],
159
- rotate: node.diamond ? [45, 47, 43, 45] : [node.rot, node.rot + 1, node.rot - 1, node.rot]
160
- }}
161
- transition={{
162
- initial: { delay: node.delay, type: "spring", stiffness: 200 },
163
- animate: { repeat: Infinity, duration: 5 + i, ease: "easeInOut" }
164
- }}
165
- viewport={{ once: true }}
166
- className={`absolute ${node.pos} z-10 flex items-center justify-center p-2 group overflow-visible`}
167
- >
168
- {node.diamond ? (
169
- <div className="w-36 h-36 flex items-center justify-center relative">
170
- <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" />
171
- <span className="relative font-display-lg text-2xl text-primary font-bold">Failed?</span>
172
- </div>
173
- ) : (
174
- <div
175
- style={{ borderColor: node.color || 'var(--color-primary)' }}
176
- 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`}
177
- >
178
- <span className="text-2xl font-bold">{node.label}</span>
179
- {node.color && (
180
- <div className="absolute -top-3 -right-3 bg-white border-2 border-inherit rounded-full p-1 shadow-sm">
181
- <span className="material-symbols-outlined text-lg">{node.color === '#45a84a' ? 'check' : 'close'}</span>
182
- </div>
183
- )}
184
- </div>
185
- )}
186
- </motion.div>
187
- ))}
188
  </motion.div>
189
- </section>
190
 
191
- {/* Section 2: AI Agent Feature */}
192
- <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">
193
- <motion.div
194
- initial={{ opacity: 0, x: -50 }}
195
- whileInView={{ opacity: 1, x: 0 }}
196
- viewport={{ once: true }}
197
- className="flex flex-col gap-8"
198
- >
199
- <div className="flex items-center gap-4 text-secondary">
200
- <span className="material-symbols-outlined text-4xl">neurology</span>
201
- <span className="text-xl font-bold uppercase tracking-widest">The ADHD Edge</span>
202
- </div>
203
- <h2 className="text-6xl font-display-lg text-primary">Let AI build and execute <br />while you orchestrate.</h2>
204
- <p className="text-2xl text-on-surface-variant leading-relaxed">
205
- 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.
206
- </p>
207
- <motion.div
208
- whileHover={{ rotate: 0 }}
209
- className="mt-4 bg-white p-8 rough-border rough-shadow inline-block transform rotate-1 max-w-md"
210
- >
211
- <div className="flex items-center gap-4 border-b-2 border-primary/20 pb-4 mb-6">
212
- <span className="material-symbols-outlined text-4xl text-primary">robot_2</span>
213
- <span className="text-sm font-bold text-on-surface-variant uppercase tracking-[0.2em]">AI Orchestrator</span>
214
- </div>
215
- <p className="font-accent-note text-3xl text-primary">
216
- "Analyze competitor landing pages and show screenshots."
217
- </p>
218
- <div className="flex justify-end mt-6">
219
- <button onClick={() => navigate('/auth')} className="bg-primary text-white font-bold py-2 px-6 rough-border shadow-sm">Review Proof</button>
220
- </div>
221
  </motion.div>
 
222
  </motion.div>
223
-
224
  <motion.div
225
- initial={{ opacity: 0, scale: 0.95 }}
226
- whileInView={{ opacity: 1, scale: 1 }}
227
- viewport={{ once: true }}
228
- className="relative min-h-[600px] w-full bg-white rough-border rough-shadow overflow-hidden rounded-2xl flex items-center justify-center p-8"
 
229
  >
230
- <div className="absolute inset-0 graph-paper-bg opacity-30 pointer-events-none"></div>
231
- {/* Visual Tree with Organic Curves and Advanced Animations */}
232
- <svg viewBox="0 0 1000 600" className="w-full h-full max-w-[950px] z-10 overflow-visible">
233
- {/* Pulsating Thinking Effect */}
234
- <motion.circle
235
- cx="150" cy="300" r="40"
236
- fill="none" stroke="var(--color-secondary)" strokeWidth="1" strokeDasharray="4 4"
237
- animate={{ r: [40, 60, 40], opacity: [0.5, 0, 0.5] }}
238
- transition={{ repeat: Infinity, duration: 2, ease: "easeInOut" }}
239
- />
240
- {/* Connection Lines - Organic Curves */}
241
- <motion.path
242
- initial={{ pathLength: 0 }}
243
- whileInView={{ pathLength: 1 }}
244
- viewport={{ once: true }}
245
- transition={{ delay: 0.8, duration: 2, ease: "easeInOut" }}
246
- 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"
247
- fill="none" stroke="#181919" strokeWidth="4" strokeLinecap="round"
248
- className="opacity-70"
249
- />
250
- {/* Root Node */}
251
- <foreignObject x="20" y="240" width="260" height="120">
252
- <motion.div
253
- initial={{ scale: 0.8, opacity: 0, rotate: -2 }}
254
- whileInView={{ scale: 1, opacity: 1, rotate: 0 }}
255
- animate={{
256
- rotate: [0, 1, -1, 0],
257
- y: [0, -4, 0]
258
- }}
259
- transition={{
260
- initial: { duration: 0.5 },
261
- animate: { repeat: Infinity, duration: 4, ease: "easeInOut" }
262
- }}
263
- 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)]"
264
- >
265
- <span className="material-symbols-outlined absolute -top-8 -left-4 text-secondary text-4xl transform -rotate-12">psychology</span>
266
- Acquire Early Users
267
- </motion.div>
268
- </foreignObject>
269
- {/* Leaf Nodes */}
270
- {[
271
- { text: 'Cold Emailing', y: 60, delay: 1.2, rot: 2 },
272
- { text: 'Content Marketing', y: 240, delay: 1.4, rot: -1 },
273
- { text: 'Community Groups', y: 420, delay: 1.6, rot: 1, highlight: true }
274
- ].map((leaf, i) => (
275
- <React.Fragment key={i}>
276
- <foreignObject x="480" y={leaf.y - 20} width="320" height="170" className="overflow-visible">
277
- <motion.div
278
- initial={{ opacity: 0, x: 50, rotate: 5 }}
279
- whileInView={{ opacity: 1, x: 0, rotate: leaf.rot }}
280
- animate={{
281
- y: [0, i % 2 === 0 ? -6 : 6, 0],
282
- rotate: [leaf.rot, leaf.rot + 0.5, leaf.rot - 0.5, leaf.rot]
283
- }}
284
- transition={{
285
- initial: { delay: leaf.delay, duration: 0.8 },
286
- animate: { repeat: Infinity, duration: 5 + i, ease: "easeInOut" }
287
- }}
288
- className="p-4 h-full w-full"
289
- >
290
- <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)]' : ''}`}>
291
- {leaf.text}
292
- </div>
293
- </motion.div>
294
- </foreignObject>
295
- {/* High Impact Annotation */}
296
- {leaf.highlight && (
297
- <foreignObject x="800" y={leaf.y - 40} width="250" height="150" className="overflow-visible">
298
- <motion.div
299
- initial={{ opacity: 0, scale: 0 }}
300
- whileInView={{ opacity: 1, scale: 1 }}
301
- transition={{ delay: 2.2 }}
302
- className="flex flex-col items-start gap-1 p-2"
303
- >
304
- <span className="font-accent-note text-4xl text-secondary transform rotate-6 whitespace-nowrap">
305
- High Impact!
306
- </span>
307
- <svg width="100" height="50" viewBox="0 0 100 50" fill="none">
308
- <motion.path
309
- initial={{ pathLength: 0 }}
310
- whileInView={{ pathLength: 1 }}
311
- transition={{ delay: 2.5, duration: 1 }}
312
- d="M 10 20 Q 50 40 90 10"
313
- stroke="var(--color-secondary)" strokeWidth="4" strokeLinecap="round"
314
- />
315
- </svg>
316
- </motion.div>
317
- </foreignObject>
318
- )}
319
- </React.Fragment>
320
- ))}
321
- {/* Hand-drawn scribble */}
322
- <motion.path
323
- initial={{ opacity: 0 }}
324
- whileInView={{ opacity: 0.2 }}
325
- transition={{ delay: 3 }}
326
- d="M 850 100 Q 950 150 850 200 T 800 300"
327
- fill="none" stroke="var(--color-primary)" strokeWidth="3"
328
- />
329
- </svg>
330
  </motion.div>
331
  </section>
332
 
333
-
334
- {/* Section 4: Habit Tracking & Gamification */}
335
- <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">
336
  <motion.div
337
- initial={{ opacity: 0, scale: 0.95 }}
338
- whileInView={{ opacity: 1, scale: 1 }}
339
- viewport={{ once: true }}
340
- className="order-2 lg:order-1 relative"
341
  >
342
- {/* Sketchy Habit Tracker UI */}
343
- <div className="bg-white p-8 rough-border rough-shadow rotate-1 relative z-10">
344
- <div className="flex justify-between items-center mb-8">
345
- <h3 className="font-display-lg text-4xl text-primary">Daily Habits</h3>
346
- <div className="flex items-center gap-2 text-secondary font-bold">
347
- <span className="material-symbols-outlined">local_fire_department</span>
348
- <span className="text-2xl">14 Day Streak!</span>
349
- </div>
350
- </div>
351
- <div className="grid grid-cols-7 gap-4 mb-8">
352
- {[...Array(28)].map((_, i) => (
353
- <div key={i} className={`aspect-square rough-border flex items-center justify-center relative ${i < 14 ? 'bg-secondary/10' : 'bg-transparent'}`}>
354
- {i < 14 && (
355
- <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">
356
- <path d="M5 13l4 4L19 7" />
357
- </svg>
358
- )}
359
- <span className="text-sm font-bold text-on-surface-variant/40">{i + 1}</span>
360
- </div>
361
- ))}
362
- </div>
363
- <div className="flex gap-4">
364
- <div className="flex-1 p-4 bg-primary/5 rough-border border-dashed">
365
- <div className="text-sm font-bold uppercase text-on-surface-variant mb-1">XP Earned</div>
366
- <div className="text-3xl font-display-lg text-primary">+1,240</div>
367
- </div>
368
- <div className="flex-1 p-4 bg-secondary/5 rough-border border-dashed">
369
- <div className="text-sm font-bold uppercase text-on-surface-variant mb-1">Rank</div>
370
- <div className="text-3xl font-display-lg text-secondary">Strategist</div>
371
- </div>
372
- </div>
373
- </div>
374
- {/* Hand-drawn annotation */}
375
- <div className="absolute -bottom-8 -right-8 font-accent-note text-3xl text-secondary -rotate-6 z-20">
376
- Consistency = Progress
377
- </div>
378
  </motion.div>
 
 
 
 
 
379
  <motion.div
380
- initial={{ opacity: 0, x: 50 }}
381
- whileInView={{ opacity: 1, x: 0 }}
382
- viewport={{ once: true }}
383
- className="order-1 lg:order-2 flex flex-col gap-8"
 
384
  >
385
- <div className="flex items-center gap-4 text-secondary">
386
- <span className="material-symbols-outlined text-4xl">military_tech</span>
387
- <span className="text-xl font-bold uppercase tracking-widest">Gamified Progress</span>
388
- </div>
389
- <h2 className="text-6xl font-display-lg text-primary">Turn habits into <br />fuel for your goals.</h2>
390
- <p className="text-2xl text-on-surface-variant leading-relaxed">
391
- 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.
392
- </p>
393
- <ul className="flex flex-col gap-4 text-xl text-on-surface-variant font-medium">
394
- <li className="flex items-center gap-3">
395
- <span className="material-symbols-outlined text-secondary font-bold">check_circle</span>
396
- Sync habits directly with graph nodes
397
- </li>
398
- <li className="flex items-center gap-3">
399
- <span className="material-symbols-outlined text-secondary font-bold">check_circle</span>
400
- Point-based rewards for branch completion
401
- </li>
402
- <li className="flex items-center gap-3">
403
- <span className="material-symbols-outlined text-secondary font-bold">check_circle</span>
404
- Visual streak trackers for long-term focus
405
- </li>
406
- </ul>
407
  </motion.div>
408
  </section>
409
 
410
- {/* Section 5: Templates Showcase */}
411
- <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">
412
- <div className="flex flex-col md:flex-row justify-between items-end gap-6">
413
- <div className="flex flex-col gap-4">
414
- <div className="flex items-center gap-4 text-secondary">
415
- <span className="material-symbols-outlined text-4xl">library_books</span>
416
- <span className="text-xl font-bold uppercase tracking-widest">Goal Blueprints</span>
417
- </div>
418
- <h2 className="text-6xl font-display-lg text-primary">Start with a template, <br />finish with a success.</h2>
419
- </div>
420
- <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>
421
- </div>
422
- <div className="grid grid-cols-1 md:grid-cols-3 gap-12">
423
- {[
424
- { title: 'Launch a Startup', tags: ['Business', 'Tech'], color: 'bg-blue-50', nodes: 8 },
425
- { title: 'Master a New Language', tags: ['Learning', 'Habits'], color: 'bg-green-50', nodes: 12 },
426
- { title: 'Home Renovation', tags: ['Project', 'Home'], color: 'bg-orange-50', nodes: 15 }
427
- ].map((tpl, i) => (
428
- <motion.div
429
- key={i}
430
- whileHover={{ y: -10, rotate: i % 2 === 0 ? 1 : -1 }}
431
- onClick={() => navigate('/auth')}
432
- className={`${tpl.color} p-8 rough-border rough-shadow cursor-pointer group`}
433
- >
434
- <div className="flex justify-between items-start mb-6">
435
- <div className="flex flex-wrap gap-2">
436
- {tpl.tags.map(tag => (
437
- <span key={tag} className="text-xs font-bold uppercase tracking-widest bg-white/50 px-2 py-1 rounded-full">{tag}</span>
438
- ))}
439
- </div>
440
- <span className="text-sm font-bold opacity-40">{tpl.nodes} nodes</span>
441
- </div>
442
- <h3 className="text-4xl font-display-lg text-primary mb-8">{tpl.title}</h3>
443
- {/* Mini Sketch Preview */}
444
- <div className="h-32 border-2 border-dashed border-primary/20 rounded-lg relative overflow-hidden bg-white/30 mb-6">
445
- <svg className="absolute inset-0 w-full h-full p-4 opacity-30 group-hover:opacity-60 transition-opacity">
446
- <circle cx="20%" cy="50%" r="8" fill="currentColor" />
447
- <path d="M 25% 50% Q 40% 50% 50% 30% M 25% 50% Q 40% 50% 50% 70%" stroke="currentColor" strokeWidth="2" fill="none" />
448
- <rect x="55%" y="20%" width="30%" height="20%" stroke="currentColor" strokeWidth="2" fill="none" />
449
- <rect x="55%" y="60%" width="30%" height="20%" stroke="currentColor" strokeWidth="2" fill="none" />
450
- </svg>
451
- </div>
452
- <div className="flex items-center gap-2 text-primary font-bold">
453
- <span>Use this blueprint</span>
454
- <span className="material-symbols-outlined transition-transform group-hover:translate-x-2">arrow_forward</span>
455
- </div>
456
- </motion.div>
457
- ))}
458
- </div>
459
- </section>
460
-
461
- {/* Section 6: The ADHD Advantage */}
462
- <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">
463
- <div className="absolute top-0 right-0 w-1/3 h-full opacity-10 pointer-events-none">
464
- <svg className="w-full h-full" viewBox="0 0 100 100">
465
- <path d="M0,50 Q25,0 50,50 T100,50" fill="none" stroke="white" strokeWidth="0.5" />
466
- <path d="M0,30 Q25,80 50,30 T100,30" fill="none" stroke="white" strokeWidth="0.5" />
467
- </svg>
468
- </div>
469
- <div className="max-w-4xl flex flex-col gap-10 relative z-10">
470
- <div className="flex items-center gap-4 text-secondary-container">
471
- <span className="material-symbols-outlined text-5xl">auto_fix_high</span>
472
- <span className="text-2xl font-bold uppercase tracking-widest">Built for the ADHD Mind</span>
473
- </div>
474
- <h2 className="text-7xl font-display-lg leading-tight">Why TaskFlow works when <br />other planners fail.</h2>
475
- <div className="grid grid-cols-1 md:grid-cols-2 gap-12 mt-4">
476
- <div className="flex flex-col gap-4">
477
- <h4 className="text-3xl font-bold text-secondary-container">Lower Cognitive Load</h4>
478
- <p className="text-xl opacity-80 leading-relaxed">
479
- Lists are overwhelming. TaskFlow uses visual hierarchy to show you exactly what matters now, hiding the noise of future steps until you're ready.
480
- </p>
481
- </div>
482
- <div className="flex flex-col gap-4">
483
- <h4 className="text-3xl font-bold text-secondary-container">Visual Dependencies</h4>
484
- <p className="text-xl opacity-80 leading-relaxed">
485
- See the "Why" behind the "How". Connecting tasks visually helps your brain understand the impact of every action on the big picture.
486
- </p>
487
- </div>
488
- <div className="flex flex-col gap-4">
489
- <h4 className="text-3xl font-bold text-secondary-container">Adaptive Resilience</h4>
490
- <p className="text-xl opacity-80 leading-relaxed">
491
- Traditional plans are brittle. TaskFlow embraces changes. When a node fails, the graph adapts, preventing the "all-or-nothing" burnout.
492
- </p>
493
- </div>
494
- <div className="flex flex-col gap-4">
495
- <h4 className="text-3xl font-bold text-secondary-container">Dopamine Rewards</h4>
496
- <p className="text-xl opacity-80 leading-relaxed">
497
- Our XP and streak systems provide the immediate feedback non-linear brains crave, turning mundane progress into visible achievements.
498
- </p>
499
- </div>
500
- </div>
501
- </div>
502
- <div className="absolute -bottom-10 -right-10 font-accent-note text-4xl text-secondary-container -rotate-12">
503
- Designed with psychologists.
504
- </div>
505
- </section>
506
-
507
- {/* Section 7: How it Works */}
508
- <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">
509
- <motion.h2
510
- initial={{ opacity: 0 }}
511
- whileInView={{ opacity: 1 }}
512
- className="text-7xl font-display-lg text-primary text-center"
513
- >
514
- How it flows
515
- </motion.h2>
516
- <div className="grid grid-cols-1 md:grid-cols-3 gap-16 w-full max-w-6xl">
517
- {[
518
- { icon: 'draw', title: '1. Sketch', desc: "Dump your messy thoughts onto the canvas. Don't worry about structure yet.", rot: '-rotate-3' },
519
- { icon: 'account_tree', title: '2. Connect', desc: "Draw lines between ideas. Define the logic, conditions, and flow.", rot: 'rotate-2' },
520
- { icon: 'bolt', title: '3. Automate', desc: "Let the AI turn your visual logic into actionable plans or alternative paths.", rot: '-rotate-1' }
521
- ].map((step, i) => (
522
- <motion.div
523
- key={i}
524
- initial={{ opacity: 0, y: 40 }}
525
- whileInView={{ opacity: 1, y: 0 }}
526
- transition={{ delay: i * 0.2 }}
527
- viewport={{ once: true }}
528
- className="flex flex-col items-center text-center gap-6"
529
- >
530
- <div className={`w-24 h-24 bg-white rough-border rough-shadow flex items-center justify-center transform ${step.rot}`}>
531
- <span className="material-symbols-outlined text-6xl text-primary">{step.icon}</span>
532
- </div>
533
- <h3 className="text-4xl font-display-lg text-primary">{step.title}</h3>
534
- <p className="text-xl text-on-surface-variant leading-relaxed">{step.desc}</p>
535
- </motion.div>
536
- ))}
537
- </div>
538
- </section>
539
 
540
- {/* Section 8: Features Grid */}
541
- <section id="features" className="w-full py-16 flex flex-col gap-12 px-margin_edge max-w-screen-2xl mx-auto">
542
- <div className="grid grid-cols-1 md:grid-cols-3 gap-12 w-full">
543
- {[
544
- { 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' },
545
- { icon: 'group', title: 'Collaboration', desc: 'Invite your team to sketch together. See their cursors and logic built in real-time.', rot: '-rotate-2' },
546
- { icon: 'settings_accessibility', title: 'ADHD Focused', desc: 'Built for minds that think differently. Minimalist UI with high contrast and focus modes.', rot: 'rotate-1' }
547
- ].map((feat, i) => (
548
- <motion.div
549
- key={i}
550
- whileHover={{ rotate: 0, scale: 1.02 }}
551
- onClick={() => navigate('/auth')}
552
- className={`bg-white p-10 rough-border rough-shadow transform ${feat.rot} transition-transform cursor-pointer group`}
553
- >
554
- <span className="material-symbols-outlined text-secondary text-5xl mb-6 group-hover:scale-110 transition-transform block">{feat.icon}</span>
555
- <h3 className="text-4xl font-display-lg text-primary mb-4">{feat.title}</h3>
556
- <p className="text-lg text-on-surface-variant leading-relaxed">{feat.desc}</p>
557
- </motion.div>
558
- ))}
559
  </div>
 
560
  </section>
561
 
562
- {/* Section 9: Pricing */}
563
- <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">
564
- <div className="text-center">
565
- <h2 className="text-7xl font-display-lg text-primary">Simple Pricing</h2>
566
- <p className="font-accent-note text-4xl text-on-surface-variant mt-4 transform -rotate-2">No hidden fees, just plain ink.</p>
567
- </div>
568
- <div className="grid grid-cols-1 md:grid-cols-3 gap-12 w-full max-w-6xl items-start">
569
- {/* Free Tier */}
570
- <motion.div
571
- initial={{ opacity: 0, x: -20 }}
572
- whileInView={{ opacity: 1, x: 0 }}
573
- viewport={{ once: true }}
574
- className="bg-white p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1"
575
- >
576
- <div>
577
- <h3 className="text-4xl font-display-lg text-primary">Free</h3>
578
- <div className="font-accent-note text-3xl mt-2 text-secondary">$0 / month</div>
579
- </div>
580
- <ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow">
581
- {['3 Infinite Canvases', 'Basic shapes & logic', 'Community templates'].map(item => (
582
- <li key={item} className="flex items-center gap-3">
583
- <span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item}
584
- </li>
585
- ))}
586
- </ul>
587
- <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>
588
- </motion.div>
589
-
590
- {/* Pro Tier */}
591
- <motion.div
592
- initial={{ opacity: 0, scale: 0.9 }}
593
- whileInView={{ opacity: 1, scale: 1.05 }}
594
- viewport={{ once: true }}
595
- 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)]"
596
- >
597
- <div>
598
- <h3 className="text-5xl font-display-lg text-primary"><span className="highlighter-bg px-2">Pro</span></h3>
599
- <div className="font-accent-note text-4xl mt-3 text-secondary">$10 / month</div>
600
- </div>
601
- <ul className="flex flex-col gap-5 text-xl text-on-surface-variant flex-grow font-medium">
602
- {['Unlimited Canvases', 'AI Path Generation', 'Advanced Habit Tracking', 'Priority Support'].map(item => (
603
- <li key={item} className="flex items-center gap-3">
604
- <span className="material-symbols-outlined text-secondary font-bold text-3xl">done</span> {item}
605
- </li>
606
- ))}
607
- </ul>
608
- <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>
609
- </motion.div>
610
-
611
- {/* Team Tier */}
612
- <motion.div
613
- initial={{ opacity: 0, x: 20 }}
614
- whileInView={{ opacity: 1, x: 0 }}
615
- viewport={{ once: true }}
616
- className="bg-white p-10 rough-border rough-shadow flex flex-col gap-8 transform -rotate-1"
617
- >
618
- <div>
619
- <h3 className="text-4xl font-display-lg text-primary">Team</h3>
620
- <div className="font-accent-note text-3xl mt-2 text-secondary">$25 / user</div>
621
- </div>
622
- <ul className="flex flex-col gap-4 text-lg text-on-surface-variant flex-grow">
623
- {['Everything in Pro', 'Real-time Collaboration', 'Team Workspaces', 'Admin Tools'].map(item => (
624
- <li key={item} className="flex items-center gap-3">
625
- <span className="material-symbols-outlined text-secondary font-bold text-2xl">done</span> {item}
626
- </li>
627
- ))}
628
- </ul>
629
- <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>
630
- </motion.div>
631
  </div>
 
632
  </section>
633
 
634
- {/* Final CTA */}
635
- <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">
636
- <div className="absolute top-0 left-0 w-full h-full opacity-5 pointer-events-none">
637
- <div className="absolute top-10 left-10 w-64 h-64 border-4 border-primary rounded-full animate-pulse" />
638
- <div className="absolute bottom-10 right-10 w-96 h-96 border-4 border-secondary rounded-full animate-pulse delay-700" />
639
- </div>
640
  <motion.div
641
- initial={{ opacity: 0, y: 30 }}
642
- whileInView={{ opacity: 1, y: 0 }}
643
- viewport={{ once: true }}
644
- className="flex flex-col gap-6 relative z-10"
 
645
  >
646
- <h2 className="text-7xl font-display-lg text-primary">
647
- Stop fighting your brain. <br />
648
- <span className="highlighter-bg px-4">Start sketching paths.</span>
649
- </h2>
650
- <p className="text-2xl text-on-surface-variant max-w-2xl mx-auto">
651
- Join thousands of strategists who use TaskFlow to turn overwhelming goals into manageable, adaptive paths.
652
- </p>
 
 
 
 
 
 
653
  </motion.div>
 
 
 
 
654
  <motion.div
655
- initial={{ opacity: 0, scale: 0.9 }}
656
  whileInView={{ opacity: 1, scale: 1 }}
657
- viewport={{ once: true }}
658
- className="flex flex-col md:flex-row gap-6 relative z-10"
 
659
  >
660
- <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">
661
- Get Started for Free
662
- </button>
663
- <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">
664
- View Templates
665
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
666
  </motion.div>
667
- <div className="mt-8 font-accent-note text-3xl text-secondary -rotate-2">
668
- No credit card required. Free forever for individuals.
669
- </div>
670
  </section>
671
-
672
  </div>
673
  );
674
  };
 
1
+ import React, { useEffect, useMemo, useRef } from 'react';
2
+ import { motion, useScroll, useSpring, useTransform, useReducedMotion } from 'framer-motion';
3
  import { useNavigate } from 'react-router-dom';
4
+ import { useTranslation } from 'react-i18next';
5
+ import {
6
+ ArrowRight, Check, Target, GitFork, Footprints, Network, ListTodo, Users, StickyNote, Download,
7
+ Repeat, TerminalSquare, CreditCard, Infinity as InfinityIcon,
8
+ } from 'lucide-react';
9
  import { useAuth } from '../context/AuthContext';
10
+ import HeroBoardDemo from '../features/landing/HeroBoardDemo';
11
+ import TemplatePreview from '../features/templates/TemplatePreview';
12
+ import { getBuiltinTemplates } from '../features/templates/builtinTemplates';
13
+ import { getLandingCopy } from '../features/landing/landingCopy';
14
 
15
+ const ICONS = { Target, GitFork, Footprints, Network, ListTodo, Users, StickyNote, Download, Repeat, TerminalSquare, CreditCard };
16
+
17
+ const reveal = {
18
+ hidden: { opacity: 0, y: 40 },
19
+ show: { opacity: 1, y: 0, transition: { type: 'spring', stiffness: 80, damping: 18 } },
20
+ };
21
+
22
+ const stagger = (delay = 0.08) => ({ hidden: {}, show: { transition: { staggerChildren: delay } } });
23
+
24
+ const SectionHeader = ({ kicker, title, subtitle, center = true }) => (
25
+ <motion.div
26
+ variants={stagger(0.1)}
27
+ initial="hidden"
28
+ whileInView="show"
29
+ viewport={{ once: true, margin: '-80px' }}
30
+ className={`flex flex-col gap-4 ${center ? 'items-center text-center' : ''} max-w-3xl ${center ? 'mx-auto' : ''}`}
31
+ >
32
+ <motion.span variants={reveal} className="font-accent-note text-3xl text-secondary -rotate-1">{kicker}</motion.span>
33
+ <motion.h2 variants={reveal} className="text-5xl md:text-7xl font-display-lg text-primary leading-[0.95]">{title}</motion.h2>
34
+ {subtitle && <motion.p variants={reveal} className="text-lg md:text-xl text-on-surface-variant">{subtitle}</motion.p>}
35
+ </motion.div>
36
+ );
37
+
38
+ // Hand-drawn underline that draws itself
39
+ const Scribble = ({ delay = 0.9 }) => (
40
+ <svg viewBox="0 0 300 20" className="absolute -bottom-3 left-0 w-full h-5 text-secondary" preserveAspectRatio="none" aria-hidden="true">
41
+ <motion.path
42
+ d="M4 14 C 60 4, 120 18, 180 9 S 270 6, 296 12"
43
+ fill="none"
44
+ stroke="currentColor"
45
+ strokeWidth="6"
46
+ strokeLinecap="round"
47
+ initial={{ pathLength: 0 }}
48
+ animate={{ pathLength: 1 }}
49
+ transition={{ duration: 0.9, delay, ease: 'easeOut' }}
50
+ />
51
+ </svg>
52
+ );
53
+
54
+ const FeatureCard = ({ feature, index }) => {
55
+ const Icon = ICONS[feature.icon] || Target;
56
+ return (
57
+ <motion.div
58
+ variants={reveal}
59
+ whileHover={{ y: -8, rotate: index % 2 ? 0.6 : -0.6 }}
60
+ transition={{ type: 'spring', stiffness: 300, damping: 20 }}
61
+ className="group relative bg-surface-container-lowest rough-border rough-shadow p-7 flex flex-col gap-4"
62
+ >
63
+ <motion.div
64
+ whileHover={{ rotate: [0, -12, 10, 0], scale: 1.1 }}
65
+ transition={{ duration: 0.5 }}
66
+ 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"
67
+ >
68
+ <Icon size={26} />
69
+ </motion.div>
70
+ <h3 className="text-3xl font-display-lg text-primary leading-none">{feature.title}</h3>
71
+ <p className="text-on-surface-variant leading-relaxed">{feature.text}</p>
72
+ </motion.div>
73
+ );
74
+ };
75
+
76
+ const HowItWorks = ({ copy }) => {
77
+ const ref = useRef(null);
78
+ const { scrollYProgress } = useScroll({ target: ref, offset: ['start 70%', 'end 60%'] });
79
+ const lineScale = useSpring(scrollYProgress, { stiffness: 120, damping: 30 });
80
+
81
+ return (
82
+ <section id="how-it-works" className="w-full py-24 px-margin_edge max-w-screen-xl mx-auto">
83
+ <SectionHeader kicker={copy.kicker} title={copy.title} />
84
+ <div ref={ref} className="relative mt-20 flex flex-col gap-16 md:gap-24">
85
+ <div className="absolute left-7 md:left-1/2 top-0 bottom-0 w-1 -translate-x-1/2 bg-primary/10 rounded-full" />
86
+ <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" />
87
+ {copy.steps.map((step, i) => (
88
+ <motion.div
89
+ key={i}
90
+ initial={{ opacity: 0, x: i % 2 ? 60 : -60 }}
91
+ whileInView={{ opacity: 1, x: 0 }}
92
+ viewport={{ once: true, margin: '-120px' }}
93
+ transition={{ type: 'spring', stiffness: 70, damping: 16 }}
94
+ 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'}`}
95
+ >
96
+ <motion.div
97
+ initial={{ scale: 0 }}
98
+ whileInView={{ scale: 1 }}
99
+ viewport={{ once: true, margin: '-120px' }}
100
+ transition={{ type: 'spring', stiffness: 260, damping: 14, delay: 0.15 }}
101
+ 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`}
102
+ >
103
+ {i + 1}
104
+ </motion.div>
105
+ <div className="bg-surface-container-lowest rough-border rough-shadow p-7 flex flex-col gap-2">
106
+ <h3 className="text-3xl font-display-lg text-primary leading-none">{step.title}</h3>
107
+ <p className="text-on-surface-variant">{step.text}</p>
108
+ </div>
109
+ </motion.div>
110
+ ))}
111
+ </div>
112
+ </section>
113
+ );
114
  };
115
 
116
+ const TemplatesMarquee = ({ templates, reduceMotion }) => {
117
+ const row = [...templates, ...templates];
118
+ return (
119
+ <div className="relative w-full overflow-hidden py-4 [mask-image:linear-gradient(90deg,transparent,black_8%,black_92%,transparent)]">
120
+ <motion.div
121
+ className="flex gap-6 w-max"
122
+ animate={reduceMotion ? undefined : { x: ['0%', '-50%'] }}
123
+ transition={{ duration: 40, ease: 'linear', repeat: Infinity }}
124
+ >
125
+ {row.map((tpl, i) => (
126
+ <motion.div
127
+ key={`${tpl.id}-${i}`}
128
+ whileHover={{ y: -6, scale: 1.02 }}
129
+ className="w-72 shrink-0 bg-surface-container-lowest rough-border rough-shadow overflow-hidden"
130
+ >
131
+ <div className="graph-paper-bg border-b-2 border-primary/10 px-3 pt-3">
132
+ <TemplatePreview content={tpl.content} height={150} />
133
+ </div>
134
+ <div className="p-4 flex flex-col gap-1">
135
+ <span className="text-[10px] uppercase font-bold tracking-wider text-secondary">{tpl.category}</span>
136
+ <span className="text-2xl font-display-lg text-primary leading-none">{tpl.title}</span>
137
+ <span className="text-sm text-on-surface-variant line-clamp-2">{tpl.description}</span>
138
+ </div>
139
+ </motion.div>
140
+ ))}
141
+ </motion.div>
142
+ </div>
143
+ );
144
  };
145
 
146
+ const PriceCard = ({ plan, price, perMonth, highlighted, onClick, delay }) => (
147
+ <motion.div
148
+ initial={{ opacity: 0, y: 50, rotate: highlighted ? 2 : -2 }}
149
+ whileInView={{ opacity: 1, y: 0, rotate: 0 }}
150
+ viewport={{ once: true, margin: '-100px' }}
151
+ transition={{ type: 'spring', stiffness: 80, damping: 15, delay }}
152
+ whileHover={{ y: -10 }}
153
+ className={`relative flex flex-col gap-7 p-10 bg-surface-container-lowest rough-border ${
154
+ highlighted ? 'shadow-[12px_12px_0px_0px_var(--color-primary)]' : 'rough-shadow'
155
+ }`}
156
+ >
157
+ {highlighted && plan.badge && (
158
+ <motion.span
159
+ initial={{ scale: 0, rotate: -20 }}
160
+ whileInView={{ scale: 1, rotate: -4 }}
161
+ viewport={{ once: true }}
162
+ transition={{ type: 'spring', stiffness: 300, damping: 12, delay: delay + 0.3 }}
163
+ 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"
164
+ >
165
+ {plan.badge}
166
+ </motion.span>
167
+ )}
168
+ <div>
169
+ <h3 className="text-5xl font-display-lg text-primary">{plan.name}</h3>
170
+ <p className="text-on-surface-variant mt-1">{plan.desc}</p>
171
+ </div>
172
+ <div className="flex items-end gap-2">
173
+ <span className="text-7xl font-display-lg text-primary leading-none">${price}</span>
174
+ <span className="text-sm font-bold uppercase tracking-widest text-on-surface-variant mb-2">{perMonth}</span>
175
+ </div>
176
+ <ul className="flex flex-col gap-3 flex-grow">
177
+ {plan.features.map((f, i) => (
178
+ <motion.li
179
+ key={i}
180
+ initial={{ opacity: 0, x: -10 }}
181
+ whileInView={{ opacity: 1, x: 0 }}
182
+ viewport={{ once: true }}
183
+ transition={{ delay: delay + 0.2 + i * 0.06 }}
184
+ className="flex items-start gap-3"
185
+ >
186
+ {highlighted ? <InfinityIcon size={18} className="text-secondary mt-1 shrink-0" /> : <Check size={18} className="text-secondary mt-1 shrink-0" />}
187
+ <span className="font-bold text-primary">{f}</span>
188
+ </motion.li>
189
+ ))}
190
+ </ul>
191
+ <motion.button
192
+ whileHover={{ scale: 1.03 }}
193
+ whileTap={{ scale: 0.97 }}
194
+ onClick={onClick}
195
+ className={`w-full py-4 text-xl font-bold rough-border flex items-center justify-center gap-2 cursor-pointer ${
196
+ highlighted ? 'bg-primary text-on-primary' : 'bg-surface-container-lowest text-primary hover:bg-primary/5'
197
+ }`}
198
+ >
199
+ {plan.cta} <ArrowRight size={20} />
200
+ </motion.button>
201
+ </motion.div>
202
+ );
203
+
204
  const LandingPage = () => {
205
  const { user } = useAuth();
206
  const navigate = useNavigate();
207
+ const { i18n } = useTranslation();
208
+ const reduceMotion = useReducedMotion();
209
+ const copy = getLandingCopy(i18n.language);
210
+ const templates = useMemo(() => getBuiltinTemplates(i18n.language), [i18n.language]);
211
 
212
  useEffect(() => {
213
+ if (user) navigate('/dashboard');
 
 
214
  }, [user, navigate]);
215
 
216
+ // The landing page is designed for the light theme
217
  useEffect(() => {
218
  const root = document.documentElement;
219
+ root.classList.remove('dark');
 
 
 
220
  return () => {
221
+ if (localStorage.getItem('theme') === 'dark') root.classList.add('dark');
 
 
 
222
  };
223
  }, []);
224
 
225
+ const heroRef = useRef(null);
226
+ const { scrollYProgress: heroProgress } = useScroll({ target: heroRef, offset: ['start start', 'end start'] });
227
+ const demoY = useTransform(heroProgress, [0, 1], [0, reduceMotion ? 0 : 120]);
228
+ const demoRotate = useTransform(heroProgress, [0, 1], [0, reduceMotion ? 0 : -4]);
229
+ const doodleY = useTransform(heroProgress, [0, 1], [0, reduceMotion ? 0 : -160]);
230
+
231
+ const { scrollYProgress } = useScroll();
232
+ const progressX = useSpring(scrollYProgress, { stiffness: 140, damping: 30 });
233
+
234
+ const goAuth = () => navigate('/auth');
235
+
236
  return (
237
+ <div className="flex flex-col items-center w-full overflow-x-clip">
238
+ {/* Reading progress */}
239
+ <motion.div style={{ scaleX: progressX }} className="fixed top-0 left-0 right-0 h-1.5 bg-secondary origin-left z-[60]" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
 
241
+ {/* Hero */}
242
+ <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">
243
+ <motion.div style={{ y: doodleY }} className="pointer-events-none absolute -top-6 right-[8%] text-secondary/30 hidden lg:block" aria-hidden="true">
244
+ <svg width="160" height="160" viewBox="0 0 160 160">
245
+ <motion.circle cx="80" cy="80" r="64" fill="none" stroke="currentColor" strokeWidth="6" strokeDasharray="14 12"
246
+ animate={reduceMotion ? undefined : { rotate: 360 }} transition={{ duration: 40, repeat: Infinity, ease: 'linear' }} style={{ originX: '80px', originY: '80px' }} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  </svg>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  </motion.div>
 
249
 
250
+ <motion.div variants={stagger(0.12)} initial="hidden" animate="show" className="flex flex-col gap-8 relative z-10">
251
+ <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">
252
+ {copy.hero.badge}
253
+ </motion.span>
254
+ <h1 className="text-6xl sm:text-7xl xl:text-8xl font-display-lg text-primary leading-[0.9]">
255
+ <motion.span variants={reveal} className="block">{copy.hero.title1}</motion.span>
256
+ <motion.span variants={reveal} className="relative inline-block mt-2">
257
+ {copy.hero.title2}
258
+ <Scribble />
259
+ </motion.span>
260
+ </h1>
261
+ <motion.p variants={reveal} className="text-xl text-on-surface-variant max-w-xl leading-relaxed">
262
+ {copy.hero.subtitle}
263
+ </motion.p>
264
+ <motion.div variants={reveal} className="flex flex-wrap gap-4 items-center">
265
+ <motion.button
266
+ whileHover={{ scale: 1.05, rotate: -1 }}
267
+ whileTap={{ scale: 0.96 }}
268
+ onClick={goAuth}
269
+ 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"
270
+ >
271
+ {copy.hero.ctaPrimary}
272
+ <ArrowRight className="group-hover:translate-x-1.5 transition-transform" />
273
+ </motion.button>
274
+ <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">
275
+ {copy.hero.ctaSecondary}
276
+ </a>
 
 
 
277
  </motion.div>
278
+ <motion.p variants={reveal} className="text-sm font-bold text-on-surface-variant/70">{copy.hero.note}</motion.p>
279
  </motion.div>
280
+
281
  <motion.div
282
+ initial={{ opacity: 0, y: 60, rotate: 3 }}
283
+ animate={{ opacity: 1, y: 0, rotate: 0 }}
284
+ transition={{ type: 'spring', stiffness: 60, damping: 16, delay: 0.3 }}
285
+ style={{ y: demoY, rotate: demoRotate }}
286
+ className="relative z-10"
287
  >
288
+ <HeroBoardDemo copy={copy.demo} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  </motion.div>
290
  </section>
291
 
292
+ {/* Facts strip */}
293
+ <section className="w-full border-y-2 border-primary bg-primary text-on-primary overflow-hidden py-5">
 
294
  <motion.div
295
+ className="flex gap-12 w-max"
296
+ animate={reduceMotion ? undefined : { x: ['0%', '-50%'] }}
297
+ transition={{ duration: 28, ease: 'linear', repeat: Infinity }}
 
298
  >
299
+ {[...copy.facts, ...copy.facts, ...copy.facts, ...copy.facts].map((fact, i) => (
300
+ <span key={i} className="flex items-center gap-12 text-3xl font-display-lg whitespace-nowrap">
301
+ {fact}
302
+ <span className="text-secondary-container">✦</span>
303
+ </span>
304
+ ))}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  </motion.div>
306
+ </section>
307
+
308
+ {/* Product */}
309
+ <section id="product" className="w-full py-28 px-margin_edge max-w-screen-2xl mx-auto flex flex-col gap-16">
310
+ <SectionHeader kicker={copy.product.kicker} title={copy.product.title} subtitle={copy.product.subtitle} />
311
  <motion.div
312
+ variants={stagger(0.07)}
313
+ initial="hidden"
314
+ whileInView="show"
315
+ viewport={{ once: true, margin: '-60px' }}
316
+ className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-8"
317
  >
318
+ {copy.product.features.map((f, i) => <FeatureCard key={f.title} feature={f} index={i} />)}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
  </motion.div>
320
  </section>
321
 
322
+ <HowItWorks copy={copy.how} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
 
324
+ {/* Templates */}
325
+ <section id="templates" className="w-full py-24 flex flex-col gap-12 bg-surface-container-low border-y-2 border-primary/10">
326
+ <div className="px-margin_edge">
327
+ <SectionHeader kicker={copy.templates.kicker} title={copy.templates.title} subtitle={copy.templates.subtitle} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  </div>
329
+ <TemplatesMarquee templates={templates} reduceMotion={reduceMotion} />
330
  </section>
331
 
332
+ {/* Pricing */}
333
+ <section id="pricing" className="w-full py-28 px-margin_edge max-w-5xl mx-auto flex flex-col gap-16">
334
+ <SectionHeader kicker={copy.pricing.kicker} title={copy.pricing.title} />
335
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-10">
336
+ <PriceCard plan={copy.pricing.free} price={0} perMonth={copy.pricing.perMonth} onClick={goAuth} delay={0} />
337
+ <PriceCard plan={copy.pricing.plus} price={copy.pricing.price} perMonth={copy.pricing.perMonth} onClick={goAuth} highlighted delay={0.12} />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  </div>
339
+ <p className="text-center text-sm font-bold text-on-surface-variant/70">{copy.pricing.paymentsNote}</p>
340
  </section>
341
 
342
+ {/* Roadmap */}
343
+ <section id="roadmap" className="w-full py-24 px-margin_edge max-w-screen-xl mx-auto flex flex-col gap-14">
344
+ <SectionHeader kicker={copy.roadmap.kicker} title={copy.roadmap.title} subtitle={copy.roadmap.subtitle} />
 
 
 
345
  <motion.div
346
+ variants={stagger(0.1)}
347
+ initial="hidden"
348
+ whileInView="show"
349
+ viewport={{ once: true, margin: '-60px' }}
350
+ className="grid grid-cols-1 md:grid-cols-3 gap-8"
351
  >
352
+ {copy.roadmap.items.map((item) => {
353
+ const Icon = ICONS[item.icon] || Target;
354
+ return (
355
+ <motion.div key={item.title} variants={reveal} className="p-7 rounded-2xl border-2 border-dashed border-primary/30 flex flex-col gap-3">
356
+ <div className="flex items-center gap-3">
357
+ <Icon size={22} className="text-secondary" />
358
+ <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>
359
+ </div>
360
+ <h3 className="text-3xl font-display-lg text-primary leading-none">{item.title}</h3>
361
+ <p className="text-on-surface-variant">{item.text}</p>
362
+ </motion.div>
363
+ );
364
+ })}
365
  </motion.div>
366
+ </section>
367
+
368
+ {/* Final CTA */}
369
+ <section className="w-full px-margin_edge pb-10 max-w-screen-xl mx-auto">
370
  <motion.div
371
+ initial={{ opacity: 0, scale: 0.92 }}
372
  whileInView={{ opacity: 1, scale: 1 }}
373
+ viewport={{ once: true, margin: '-80px' }}
374
+ transition={{ type: 'spring', stiffness: 70, damping: 16 }}
375
+ 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"
376
  >
377
+ {!reduceMotion && [0, 1, 2, 3, 4].map((i) => (
378
+ <motion.span
379
+ key={i}
380
+ className="absolute w-24 h-14 rounded-xl border-2 border-on-primary/20"
381
+ style={{ left: `${8 + i * 20}%`, top: i % 2 ? '12%' : '70%' }}
382
+ animate={{ y: [0, -14, 0], rotate: [0, i % 2 ? 6 : -6, 0] }}
383
+ transition={{ duration: 4 + i, repeat: Infinity, ease: 'easeInOut' }}
384
+ aria-hidden="true"
385
+ />
386
+ ))}
387
+ <h2 className="relative text-6xl md:text-8xl font-display-lg leading-none">{copy.cta.title}</h2>
388
+ <p className="relative text-xl opacity-80">{copy.cta.subtitle}</p>
389
+ <motion.button
390
+ whileHover={{ scale: 1.06, rotate: 1 }}
391
+ whileTap={{ scale: 0.95 }}
392
+ onClick={goAuth}
393
+ className="relative bg-secondary-container text-primary text-2xl font-bold px-10 py-4 rough-border flex items-center gap-3 cursor-pointer"
394
+ >
395
+ {copy.cta.button} <ArrowRight />
396
+ </motion.button>
397
  </motion.div>
 
 
 
398
  </section>
 
399
  </div>
400
  );
401
  };
src/pages/OnboardingPage.jsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
 
@@ -44,30 +44,30 @@ const OnboardingPage = () => {
44
  )
45
  },
46
  {
47
- title: t('onboarding.step_2.title', 'AI Adaptation'),
48
- 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."),
49
  icon: "psychology",
50
  accent: "bg-yellow-50/10 dark:bg-yellow-950/20",
51
- note: t('onboarding.step_2.note', "AI handles the cognitive load when you're stuck."),
52
  visual: (
53
  <div className="relative w-full h-48 flex items-center justify-center">
54
  <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">
55
- <span className="material-symbols-outlined text-red-500">block</span>
56
- {t('onboarding.visual.blocked', 'Blocked')}
57
  </div>
58
  <motion.div
59
  animate={{ x: [0, 50, 0], opacity: [0, 1, 1] }}
60
  transition={{ repeat: Infinity, duration: 2 }}
61
  className="absolute right-12 bottom-12 font-accent-note text-secondary text-2xl"
62
  >
63
- {t('onboarding.visual.ai_generating', 'AI generating...')}
64
  </motion.div>
65
  </div>
66
  )
67
  },
68
  {
69
  title: t('onboarding.step_3.title', 'Dopamine & Focus'),
70
- 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."),
71
  icon: "local_fire_department",
72
  accent: "bg-orange-50/10 dark:bg-orange-950/20",
73
  note: t('onboarding.step_3.note', "Turn the grind into a game you enjoy."),
 
1
+ import React, { useState } from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
 
 
44
  )
45
  },
46
  {
47
+ title: t('onboarding.step_2.title', 'Auto-layout & templates'),
48
+ 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."),
49
  icon: "psychology",
50
  accent: "bg-yellow-50/10 dark:bg-yellow-950/20",
51
+ note: t('onboarding.step_2.note', "Less time dragging boxes, more time doing."),
52
  visual: (
53
  <div className="relative w-full h-48 flex items-center justify-center">
54
  <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">
55
+ <span className="material-symbols-outlined">account_tree</span>
56
+ {t('onboarding.visual.blocked', 'Messy board')}
57
  </div>
58
  <motion.div
59
  animate={{ x: [0, 50, 0], opacity: [0, 1, 1] }}
60
  transition={{ repeat: Infinity, duration: 2 }}
61
  className="absolute right-12 bottom-12 font-accent-note text-secondary text-2xl"
62
  >
63
+ {t('onboarding.visual.ai_generating', 'Shift+L')}
64
  </motion.div>
65
  </div>
66
  )
67
  },
68
  {
69
  title: t('onboarding.step_3.title', 'Dopamine & Focus'),
70
+ description: t('onboarding.step_3.description', "Earn points for completed steps and unlock achievements. TaskFlow keeps you motivated and focused on the big picture."),
71
  icon: "local_fire_department",
72
  accent: "bg-orange-50/10 dark:bg-orange-950/20",
73
  note: t('onboarding.step_3.note', "Turn the grind into a game you enjoy."),
src/pages/SettingsPage.jsx CHANGED
@@ -221,12 +221,6 @@ const SettingsPage = () => {
221
  </h2>
222
 
223
  <div className="flex flex-col">
224
- <SettingToggle
225
- label={t('settings.ai_guidance_title', 'AI Active Guidance')}
226
- desc={t('settings.ai_guidance_desc', 'Let AI proactively suggest alternative paths when you mark a node as blocked.')}
227
- active={settings.aiGuidance}
228
- onToggle={() => toggleSetting('aiGuidance')}
229
- />
230
  <SettingToggle
231
  label={t('settings.snap_to_grid_title', 'Snap to Grid')}
232
  desc={t('settings.snap_to_grid_desc', 'Automatically align nodes to the graph paper lines for a cleaner look.')}
 
221
  </h2>
222
 
223
  <div className="flex flex-col">
 
 
 
 
 
 
224
  <SettingToggle
225
  label={t('settings.snap_to_grid_title', 'Snap to Grid')}
226
  desc={t('settings.snap_to_grid_desc', 'Automatically align nodes to the graph paper lines for a cleaner look.')}
src/pages/SubscriptionPage.jsx CHANGED
@@ -1,43 +1,36 @@
1
  import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
 
 
4
  import Sidebar from '../components/Sidebar';
5
  import { useAuth } from '../context/AuthContext';
6
- import axios from 'axios';
7
- import {
8
- Sparkles,
9
- Check,
10
- X,
11
- Zap,
12
- ArrowRight,
13
- Bot,
14
- Layout,
15
- Heart,
16
- Users,
17
- BookTemplate
18
- } from 'lucide-react';
19
 
20
- const PricingCard = ({ type, price, description, features, popular, color, buttonText, isCurrentPlan, onClick, loading }) => {
21
  const { t } = useTranslation();
22
  return (
23
  <motion.div
24
- whileHover={isCurrentPlan ? {} : { y: -10 }}
 
 
 
25
  className={`relative bg-surface-container-lowest p-10 rough-border flex flex-col gap-8 h-full ${
26
- 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'
27
  }`}
28
  >
29
- {popular && (
30
- <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">
31
- {t("subscription.most_recommended")}
32
  </div>
33
  )}
34
 
35
  <div className="text-center border-b-2 border-primary/10 pb-8">
36
- <h3 className={`text-5xl font-display-lg text-primary mb-2`}>{type}</h3>
37
  <div className="flex items-center justify-center gap-1">
38
  <span className="text-2xl font-display-lg text-secondary">$</span>
39
  <span className="text-6xl font-display-lg text-primary">{price}</span>
40
- <span className="text-sm font-bold text-on-surface-variant uppercase tracking-widest mt-4">{t("subscription.per_month")}</span>
41
  </div>
42
  <p className="mt-4 text-sm text-on-surface-variant font-medium">{description}</p>
43
  </div>
@@ -45,14 +38,8 @@ const PricingCard = ({ type, price, description, features, popular, color, butto
45
  <ul className="flex flex-col gap-4 flex-grow">
46
  {features.map((f, i) => (
47
  <li key={i} className="flex items-start gap-3">
48
- {f.included ? (
49
- <Check size={18} className="text-secondary mt-1 flex-shrink-0" />
50
- ) : (
51
- <X size={18} className="text-on-surface-variant/30 mt-1 flex-shrink-0" />
52
- )}
53
- <span className={`text-sm font-bold ${f.included ? 'text-primary' : 'text-on-surface-variant/40'}`}>
54
- {f.text}
55
- </span>
56
  </li>
57
  ))}
58
  </ul>
@@ -63,14 +50,14 @@ const PricingCard = ({ type, price, description, features, popular, color, butto
63
  onClick={isCurrentPlan ? undefined : onClick}
64
  disabled={isCurrentPlan || loading}
65
  className={`w-full py-4 text-xl font-bold flex items-center justify-center gap-2 rough-border transition-all ${
66
- isCurrentPlan
67
  ? 'bg-surface-container-high text-on-surface-variant/50 border-primary/20 cursor-default'
68
- : popular
69
- ? 'bg-primary text-white hover:bg-primary/95 cursor-pointer'
70
  : 'bg-surface-container-lowest text-primary border-primary hover:bg-primary/5 cursor-pointer'
71
  }`}
72
  >
73
- <span>{isCurrentPlan ? t("subscription.current_plan", "Current Plan") : loading ? t("subscription.upgrading", "Upgrading...") : buttonText}</span>
74
  {!isCurrentPlan && !loading && <ArrowRight size={20} />}
75
  </motion.button>
76
  </motion.div>
@@ -80,95 +67,86 @@ const PricingCard = ({ type, price, description, features, popular, color, butto
80
  const SubscriptionPage = () => {
81
  const { t } = useTranslation();
82
  const { user, updateUser } = useAuth();
83
- const [loadingTier, setLoadingTier] = React.useState(null);
84
  const [notification, setNotification] = React.useState(null);
85
 
86
- const handleUpgrade = async (tierName) => {
 
 
 
 
 
87
  if (!user) return;
88
- setLoadingTier(tierName);
89
  try {
90
  const API_URL = import.meta.env.VITE_API_URL;
91
- const res = await axios.post(`${API_URL}/payments/change-tier/${user.id}`, { tier: tierName });
92
  updateUser(res.data);
93
- setNotification({
94
- type: 'success',
95
- message: t('subscription.upgrade_success', { tier: tierName }) || `Plan switched to ${tierName} successfully!`
96
- });
97
- setTimeout(() => setNotification(null), 4000);
98
  } catch (err) {
99
- console.error('[Subscription] Upgrade failed:', err);
100
- setNotification({
101
- type: 'error',
102
- message: err.response?.data?.message || 'Upgrade failed. Please try again.'
103
- });
104
- setTimeout(() => setNotification(null), 4000);
105
  } finally {
106
- setLoadingTier(null);
107
  }
108
  };
109
 
 
 
110
  const plans = [
111
  {
112
- key: "Free",
113
- type: t("subscription.plans.free.title"),
114
- price: "0",
115
- description: t("subscription.plans.free.desc"),
116
- buttonText: t("subscription.plans.free.btn"),
117
  features: [
118
- { text: t("subscription.plans.free.feat1"), included: true },
119
- { text: t("subscription.plans.free.feat2"), included: true },
120
- { text: t("subscription.plans.free.feat3"), included: true },
121
- { text: t("subscription.plans.free.feat4"), included: true },
122
- { text: t("subscription.plans.free.feat5"), included: true },
123
- ]
124
  },
125
  {
126
- key: "Pro",
127
- type: t("subscription.plans.pro.title"),
128
- price: "10",
129
- popular: true,
130
- description: t("subscription.plans.pro.desc"),
131
- buttonText: t("subscription.plans.pro.btn"),
132
  features: [
133
- { text: t("subscription.plans.pro.feat1"), included: true },
134
- { text: t("subscription.plans.pro.feat2"), included: true },
135
- { text: t("subscription.plans.pro.feat3"), included: true },
136
- { text: t("subscription.plans.pro.feat4"), included: true },
137
- { text: t("subscription.plans.pro.feat5"), included: true },
138
- ]
139
  },
140
- {
141
- key: "Ultra",
142
- type: t("subscription.plans.ultra.title"),
143
- price: "25",
144
- description: t("subscription.plans.ultra.desc"),
145
- buttonText: t("subscription.plans.ultra.btn"),
146
- features: [
147
- { text: t("subscription.plans.ultra.feat1"), included: true },
148
- { text: t("subscription.plans.ultra.feat2"), included: true },
149
- { text: t("subscription.plans.ultra.feat3"), included: true },
150
- { text: t("subscription.plans.ultra.feat4"), included: true },
151
- { text: t("subscription.plans.ultra.feat5"), included: true },
152
- { text: t("subscription.plans.ultra.feat6"), included: true },
153
- ]
154
- }
155
  ];
156
 
157
- const currentUserTier = user?.subscriptionTier || "Free";
 
 
 
 
 
158
 
159
  return (
160
  <div className="flex h-screen bg-background overflow-hidden">
161
  <Sidebar />
162
 
163
  <main className="flex-grow flex flex-col relative overflow-y-auto graph-paper-bg scrollbar-hide">
164
- {/* Notification Banner */}
165
  <AnimatePresence>
166
  {notification && (
167
  <motion.div
168
  initial={{ opacity: 0, y: -50 }}
169
  animate={{ opacity: 1, y: 0 }}
170
  exit={{ opacity: 0, y: -50 }}
171
- 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 ${
172
  notification.type === 'success' ? 'bg-primary' : 'bg-error'
173
  }`}
174
  >
@@ -177,38 +155,34 @@ const SubscriptionPage = () => {
177
  )}
178
  </AnimatePresence>
179
 
180
- {/* Background Elements */}
181
- <div className="absolute top-0 right-0 p-20 opacity-10 pointer-events-none">
182
- <Sparkles size={400} className="text-secondary" />
183
- </div>
184
-
185
- <section className="p-8 md:p-16 flex flex-col gap-10 max-w-7xl mx-auto w-full relative z-10 pb-16">
186
  <div className="text-center flex flex-col items-center gap-6">
187
  <motion.div
188
- initial={{ scale: 0 }}
189
- animate={{ scale: 1 }}
 
190
  className="w-24 h-24 bg-secondary rounded-full flex items-center justify-center border-4 border-primary shadow-xl"
191
  >
192
  <Zap size={48} className="text-primary" />
193
  </motion.div>
194
- <h1 className="text-7xl font-display-lg text-primary leading-tight max-w-3xl">
195
- {t("subscription.title_p1", "Unlock the ")}
196
- <span className="highlighter-bg">{t("subscription.title_highlight", "Pro Tools")}</span>
197
- {t("subscription.title_p2", " of TaskFlow")}
198
  </h1>
199
  <p className="font-accent-note text-3xl text-secondary -rotate-1 max-w-xl">
200
- {t("subscription.subtitle")}
201
  </p>
202
  </div>
203
 
204
- <div className="grid grid-cols-1 lg:grid-cols-3 gap-10 items-stretch">
205
  {plans.map((plan, i) => (
206
- <PricingCard
207
- key={i}
208
- {...plan}
209
- isCurrentPlan={currentUserTier.toLowerCase() === plan.key.toLowerCase()}
210
- onClick={() => handleUpgrade(plan.key)}
211
- loading={loadingTier === plan.key}
 
212
  />
213
  ))}
214
  </div>
@@ -218,36 +192,21 @@ const SubscriptionPage = () => {
218
  <thead>
219
  <tr className="border-b-2 border-primary/15">
220
  <th className="text-left p-4 font-bold text-on-surface-variant uppercase tracking-widest text-xs">{t('subscription.compare.feature', 'Feature')}</th>
221
- <th className="p-4 font-bold text-primary text-center">{t('subscription.plans.free.title', 'Free')}</th>
222
- <th className="p-4 font-bold text-secondary text-center bg-secondary/5">{t('subscription.plans.pro.title', 'Pro')}</th>
223
- <th className="p-4 font-bold text-primary text-center">{t('subscription.plans.ultra.title', 'Ultra')}</th>
224
  </tr>
225
  </thead>
226
  <tbody>
227
- {[
228
- { icon: Bot, label: t('subscription.compare.ai_gens', 'AI Generations / day'), free: '3', pro: '200', ultra: '∞' },
229
- { icon: Layout, label: t('subscription.compare.canvases', 'Canvases'), free: '3', pro: '∞', ultra: '∞' },
230
- { icon: Sparkles, label: t('subscription.compare.nodes', 'Nodes per canvas'), free: '200', pro: '∞', ultra: '∞' },
231
- { icon: Heart, label: t('subscription.compare.habits', 'Habits'), free: '3', pro: '∞', ultra: '∞' },
232
- { icon: Users, label: t('subscription.compare.board_members', 'Board members'), free: '2', pro: '10', ultra: '∞' },
233
- { icon: BookTemplate, label: t('subscription.compare.custom_templates', 'Custom Templates'), free: false, pro: false, ultra: true },
234
- ].map((row, i) => (
235
- <tr key={i} className={`border-b border-primary/10 ${i % 2 === 0 ? '' : 'bg-primary/2'}`}>
236
  <td className="p-4 font-semibold text-on-surface-variant flex items-center gap-2">
237
  <row.icon size={16} className="text-secondary flex-shrink-0" />
238
  {row.label}
239
  </td>
240
- {[row.free, row.pro, row.ultra].map((val, j) => (
241
- <td key={j} className={`p-4 text-center font-bold ${j === 1 ? 'bg-secondary/5' : ''}`}>
242
- {val === true ? (
243
- <Check size={18} className="text-secondary mx-auto" />
244
- ) : val === false ? (
245
- <X size={18} className="text-on-surface-variant/30 mx-auto" />
246
- ) : (
247
- <span className={val === '∞' ? 'text-secondary text-lg' : 'text-primary'}>{val}</span>
248
- )}
249
- </td>
250
- ))}
251
  </tr>
252
  ))}
253
  </tbody>
@@ -260,4 +219,3 @@ const SubscriptionPage = () => {
260
  };
261
 
262
  export default SubscriptionPage;
263
-
 
1
  import React from 'react';
2
  import { motion, AnimatePresence } from 'framer-motion';
3
  import { useTranslation } from 'react-i18next';
4
+ import axios from 'axios';
5
+ import { Check, Zap, ArrowRight, Layout, Network, Users, LayoutTemplate, Infinity as InfinityIcon } from 'lucide-react';
6
  import Sidebar from '../components/Sidebar';
7
  import { useAuth } from '../context/AuthContext';
8
+ import { FREE_LIMITS, PLAN_FREE, PLAN_PLUS, PLUS_PRICE_USD, normalizePlan } from '../config/plans';
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
+ const PlanCard = ({ title, price, description, features, highlighted, buttonText, isCurrentPlan, onClick, loading, delay }) => {
11
  const { t } = useTranslation();
12
  return (
13
  <motion.div
14
+ initial={{ opacity: 0, y: 30 }}
15
+ animate={{ opacity: 1, y: 0 }}
16
+ transition={{ delay, type: 'spring', stiffness: 120, damping: 18 }}
17
+ whileHover={isCurrentPlan ? {} : { y: -8 }}
18
  className={`relative bg-surface-container-lowest p-10 rough-border flex flex-col gap-8 h-full ${
19
+ highlighted ? 'shadow-[12px_12px_0px_0px_var(--color-primary)] border-secondary' : 'rough-shadow'
20
  }`}
21
  >
22
+ {highlighted && (
23
+ <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">
24
+ {t('plans.no_limits', 'No limits')}
25
  </div>
26
  )}
27
 
28
  <div className="text-center border-b-2 border-primary/10 pb-8">
29
+ <h3 className="text-5xl font-display-lg text-primary mb-2">{title}</h3>
30
  <div className="flex items-center justify-center gap-1">
31
  <span className="text-2xl font-display-lg text-secondary">$</span>
32
  <span className="text-6xl font-display-lg text-primary">{price}</span>
33
+ <span className="text-sm font-bold text-on-surface-variant uppercase tracking-widest mt-4">{t('subscription.per_month')}</span>
34
  </div>
35
  <p className="mt-4 text-sm text-on-surface-variant font-medium">{description}</p>
36
  </div>
 
38
  <ul className="flex flex-col gap-4 flex-grow">
39
  {features.map((f, i) => (
40
  <li key={i} className="flex items-start gap-3">
41
+ <Check size={18} className="text-secondary mt-1 flex-shrink-0" />
42
+ <span className="text-sm font-bold text-primary">{f}</span>
 
 
 
 
 
 
43
  </li>
44
  ))}
45
  </ul>
 
50
  onClick={isCurrentPlan ? undefined : onClick}
51
  disabled={isCurrentPlan || loading}
52
  className={`w-full py-4 text-xl font-bold flex items-center justify-center gap-2 rough-border transition-all ${
53
+ isCurrentPlan
54
  ? 'bg-surface-container-high text-on-surface-variant/50 border-primary/20 cursor-default'
55
+ : highlighted
56
+ ? 'bg-primary text-on-primary hover:bg-primary/95 cursor-pointer'
57
  : 'bg-surface-container-lowest text-primary border-primary hover:bg-primary/5 cursor-pointer'
58
  }`}
59
  >
60
+ <span>{isCurrentPlan ? t('subscription.current_plan', 'Current plan') : loading ? t('subscription.upgrading', 'Switching...') : buttonText}</span>
61
  {!isCurrentPlan && !loading && <ArrowRight size={20} />}
62
  </motion.button>
63
  </motion.div>
 
67
  const SubscriptionPage = () => {
68
  const { t } = useTranslation();
69
  const { user, updateUser } = useAuth();
70
+ const [loadingPlan, setLoadingPlan] = React.useState(null);
71
  const [notification, setNotification] = React.useState(null);
72
 
73
+ const notify = (type, message) => {
74
+ setNotification({ type, message });
75
+ setTimeout(() => setNotification(null), 4500);
76
+ };
77
+
78
+ const handleChangePlan = async (plan) => {
79
  if (!user) return;
80
+ setLoadingPlan(plan);
81
  try {
82
  const API_URL = import.meta.env.VITE_API_URL;
83
+ const res = await axios.post(`${API_URL}/payments/change-tier`, { tier: plan });
84
  updateUser(res.data);
85
+ notify('success', t('plans.switched', { plan, defaultValue: `Your plan is now ${plan}.` }));
 
 
 
 
86
  } catch (err) {
87
+ if (err.response?.status === 402) {
88
+ notify('error', t('plans.payments_soon', 'Online payments are not connected yet. Plus will be available soon.'));
89
+ } else {
90
+ notify('error', err.response?.data?.message || t('plans.switch_failed', 'Could not change the plan. Please try again.'));
91
+ }
 
92
  } finally {
93
+ setLoadingPlan(null);
94
  }
95
  };
96
 
97
+ const currentPlan = normalizePlan(user?.subscriptionTier);
98
+
99
  const plans = [
100
  {
101
+ key: PLAN_FREE,
102
+ title: 'Free',
103
+ price: '0',
104
+ description: t('plans.free_desc', 'Everything you need to plan on your own.'),
105
+ buttonText: t('plans.free_btn', 'Switch to Free'),
106
  features: [
107
+ t('plans.feat_boards', { count: FREE_LIMITS.boards, defaultValue: `Up to ${FREE_LIMITS.boards} boards` }),
108
+ t('plans.feat_nodes', { count: FREE_LIMITS.nodesPerBoard, defaultValue: `Up to ${FREE_LIMITS.nodesPerBoard} nodes per board` }),
109
+ t('plans.feat_guests', { count: FREE_LIMITS.guestsPerBoard, defaultValue: `Up to ${FREE_LIMITS.guestsPerBoard} guests per board` }),
110
+ t('plans.feat_templates', { count: FREE_LIMITS.templates, defaultValue: `${FREE_LIMITS.templates} saved templates` }),
111
+ t('plans.feat_core', 'All node types, auto-layout, PNG/JSON export'),
112
+ ],
113
  },
114
  {
115
+ key: PLAN_PLUS,
116
+ title: 'Plus',
117
+ price: String(PLUS_PRICE_USD),
118
+ highlighted: true,
119
+ description: t('plans.plus_desc', 'For big plans and teams. No caps on anything.'),
120
+ buttonText: t('plans.plus_btn', 'Get Plus'),
121
  features: [
122
+ t('plans.feat_unlimited_boards', 'Unlimited boards'),
123
+ t('plans.feat_unlimited_nodes', 'Unlimited nodes'),
124
+ t('plans.feat_unlimited_guests', 'Unlimited collaborators'),
125
+ t('plans.feat_unlimited_templates', 'Unlimited saved templates'),
126
+ t('plans.feat_everything_free', 'Everything in Free'),
127
+ ],
128
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  ];
130
 
131
+ const rows = [
132
+ { icon: Layout, label: t('plans.row_boards', 'Boards'), free: FREE_LIMITS.boards },
133
+ { icon: Network, label: t('plans.row_nodes', 'Nodes per board'), free: FREE_LIMITS.nodesPerBoard },
134
+ { icon: Users, label: t('plans.row_guests', 'Guests per board'), free: FREE_LIMITS.guestsPerBoard },
135
+ { icon: LayoutTemplate, label: t('plans.row_templates', 'Saved templates'), free: FREE_LIMITS.templates },
136
+ ];
137
 
138
  return (
139
  <div className="flex h-screen bg-background overflow-hidden">
140
  <Sidebar />
141
 
142
  <main className="flex-grow flex flex-col relative overflow-y-auto graph-paper-bg scrollbar-hide">
 
143
  <AnimatePresence>
144
  {notification && (
145
  <motion.div
146
  initial={{ opacity: 0, y: -50 }}
147
  animate={{ opacity: 1, y: 0 }}
148
  exit={{ opacity: 0, y: -50 }}
149
+ 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 ${
150
  notification.type === 'success' ? 'bg-primary' : 'bg-error'
151
  }`}
152
  >
 
155
  )}
156
  </AnimatePresence>
157
 
158
+ <section className="p-8 md:p-16 flex flex-col gap-12 max-w-5xl mx-auto w-full relative z-10 pb-16">
 
 
 
 
 
159
  <div className="text-center flex flex-col items-center gap-6">
160
  <motion.div
161
+ initial={{ scale: 0, rotate: -30 }}
162
+ animate={{ scale: 1, rotate: 0 }}
163
+ transition={{ type: 'spring', stiffness: 200, damping: 12 }}
164
  className="w-24 h-24 bg-secondary rounded-full flex items-center justify-center border-4 border-primary shadow-xl"
165
  >
166
  <Zap size={48} className="text-primary" />
167
  </motion.div>
168
+ <h1 className="text-6xl md:text-7xl font-display-lg text-primary leading-tight max-w-3xl">
169
+ {t('plans.title_p1', 'Two plans. ')}
170
+ <span className="highlighter-bg">{t('plans.title_highlight', 'No fine print.')}</span>
 
171
  </h1>
172
  <p className="font-accent-note text-3xl text-secondary -rotate-1 max-w-xl">
173
+ {t('plans.subtitle', 'Free has small creation limits. Plus has none.')}
174
  </p>
175
  </div>
176
 
177
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-10 items-stretch">
178
  {plans.map((plan, i) => (
179
+ <PlanCard
180
+ key={plan.key}
181
+ {...plan}
182
+ delay={0.1 + i * 0.1}
183
+ isCurrentPlan={currentPlan === plan.key}
184
+ onClick={() => handleChangePlan(plan.key)}
185
+ loading={loadingPlan === plan.key}
186
  />
187
  ))}
188
  </div>
 
192
  <thead>
193
  <tr className="border-b-2 border-primary/15">
194
  <th className="text-left p-4 font-bold text-on-surface-variant uppercase tracking-widest text-xs">{t('subscription.compare.feature', 'Feature')}</th>
195
+ <th className="p-4 font-bold text-primary text-center">Free</th>
196
+ <th className="p-4 font-bold text-secondary text-center bg-secondary/5">Plus</th>
 
197
  </tr>
198
  </thead>
199
  <tbody>
200
+ {rows.map((row, i) => (
201
+ <tr key={i} className="border-b border-primary/10">
 
 
 
 
 
 
 
202
  <td className="p-4 font-semibold text-on-surface-variant flex items-center gap-2">
203
  <row.icon size={16} className="text-secondary flex-shrink-0" />
204
  {row.label}
205
  </td>
206
+ <td className="p-4 text-center font-bold text-primary">{row.free}</td>
207
+ <td className="p-4 text-center font-bold bg-secondary/5">
208
+ <InfinityIcon size={20} className="text-secondary mx-auto" />
209
+ </td>
 
 
 
 
 
 
 
210
  </tr>
211
  ))}
212
  </tbody>
 
219
  };
220
 
221
  export default SubscriptionPage;