in breadcrumbs: filled dot as avatar
Hunter
Tuesday, July 30th, 2024 at 9:52 AM
3 <head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Advanced Task Tracker</title>
6 + <title>todo</title>
7 <style>
8 body {
9 font-family: Arial, sans-serif;
78 }
79
80 function generateBreadcrumbs(rootTask, currentPath, selectedTaskId) {
- let breadcrumbs = '● '; // Always start with the root
81 + let breadcrumbs = '';
82 let currentTask = rootTask;
83 + let currentDepth = 0;
84
- // Add filled circles for the current path
- for (let i = 1; i < currentPath.length; i++) {
- breadcrumbs += '● ';
- currentTask = currentTask.subtasks.find(t => t.id === currentPath[i].id);
85 + // Add empty circles for levels before the current one
86 + for (let i = 0; i < currentPath.length - 1; i++) {
87 + breadcrumbs += '○ ';
88 + currentTask = currentTask.subtasks.find(t => t.id === currentPath[i + 1].id);
89 }
90
91 + // Add filled circle for the current level
92 + breadcrumbs += '● ';
93 + currentDepth = currentPath.length - 1;
94 +
95 // If the selected task is not the current view's parent task, add empty circles for potential deeper levels
96 if (selectedTaskId !== currentTask.id) {
97 let selectedTask = currentTask.subtasks.find(t => t.id === selectedTaskId);
102 return Math.max(...task.subtasks.map(st => calculateMaxDepth(st, depth + 1)));
103 }
104
- let maxDepth = calculateMaxDepth(selectedTask, currentPath.length);
105 + let maxDepth = calculateMaxDepth(selectedTask, currentDepth + 1);
106
107 // Add empty circles for potential deeper levels
- for (let i = currentPath.length; i < maxDepth; i++) {
108 + for (let i = currentDepth + 1; i < maxDepth; i++) {
109 breadcrumbs += '○ ';
110 }
111 }