Spaces:
Running
Running
Commit ·
433b3b5
1
Parent(s): 208a8d6
feat: redesign visual branches connections in TaskListView to match custom tree layout
Browse files- src/pages/CanvasPage.jsx +34 -28
src/pages/CanvasPage.jsx
CHANGED
|
@@ -1822,7 +1822,7 @@ const TaskListView = ({
|
|
| 1822 |
</div>
|
| 1823 |
|
| 1824 |
{hasSubtasks && isExpanded && (
|
| 1825 |
-
<div className="pl-
|
| 1826 |
{(() => {
|
| 1827 |
const directSubgoals = subgoalEdges
|
| 1828 |
.filter(e => e.source === node.id)
|
|
@@ -1835,38 +1835,44 @@ const TaskListView = ({
|
|
| 1835 |
if (branchNodes.length === 0) return null;
|
| 1836 |
|
| 1837 |
const isBranchCollapsed = collapsedBranches.has(subgoal.id);
|
|
|
|
|
|
|
| 1838 |
|
| 1839 |
return (
|
| 1840 |
-
<div key={subgoal.id} className="space-y-4">
|
| 1841 |
-
{/*
|
| 1842 |
-
<
|
| 1843 |
-
|
| 1844 |
-
|
| 1845 |
-
|
| 1846 |
-
|
| 1847 |
-
|
| 1848 |
-
|
| 1849 |
-
|
| 1850 |
-
|
| 1851 |
-
|
| 1852 |
-
|
| 1853 |
-
|
| 1854 |
-
|
| 1855 |
-
|
| 1856 |
-
|
| 1857 |
-
|
| 1858 |
-
|
| 1859 |
-
|
| 1860 |
-
|
| 1861 |
-
</div>
|
| 1862 |
|
| 1863 |
{/* Branch contents */}
|
| 1864 |
{!isBranchCollapsed && (
|
| 1865 |
-
<div className="
|
| 1866 |
-
{
|
| 1867 |
-
|
| 1868 |
-
|
| 1869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1870 |
</div>
|
| 1871 |
)}
|
| 1872 |
</div>
|
|
|
|
| 1822 |
</div>
|
| 1823 |
|
| 1824 |
{hasSubtasks && isExpanded && (
|
| 1825 |
+
<div className="relative ml-8 pl-6 border-l-2 border-dashed border-yellow-500/50 dark:border-yellow-500/30 space-y-6 pt-2 pb-2">
|
| 1826 |
{(() => {
|
| 1827 |
const directSubgoals = subgoalEdges
|
| 1828 |
.filter(e => e.source === node.id)
|
|
|
|
| 1835 |
if (branchNodes.length === 0) return null;
|
| 1836 |
|
| 1837 |
const isBranchCollapsed = collapsedBranches.has(subgoal.id);
|
| 1838 |
+
const headNode = branchNodes[0];
|
| 1839 |
+
const continuationNodes = branchNodes.slice(1);
|
| 1840 |
|
| 1841 |
return (
|
| 1842 |
+
<div key={subgoal.id} className="relative space-y-4">
|
| 1843 |
+
{/* Collapse button centered on the yellow dashed line */}
|
| 1844 |
+
<button
|
| 1845 |
+
onClick={() => {
|
| 1846 |
+
const newSet = new Set(collapsedBranches);
|
| 1847 |
+
if (newSet.has(subgoal.id)) {
|
| 1848 |
+
newSet.delete(subgoal.id);
|
| 1849 |
+
} else {
|
| 1850 |
+
newSet.add(subgoal.id);
|
| 1851 |
+
}
|
| 1852 |
+
setCollapsedBranches(newSet);
|
| 1853 |
+
}}
|
| 1854 |
+
className={`absolute -left-[36px] top-3.5 w-6 h-6 rounded-full border-2 border-primary flex items-center justify-center cursor-pointer shadow-[2px_2px_0px_0px_var(--color-primary)] hover:scale-105 active:translate-y-0.5 transition-all font-mono text-sm font-extrabold z-10 ${
|
| 1855 |
+
isBranchCollapsed
|
| 1856 |
+
? 'bg-amber-400 text-black border-primary'
|
| 1857 |
+
: 'bg-surface-container-lowest text-primary border-primary'
|
| 1858 |
+
}`}
|
| 1859 |
+
title={isBranchCollapsed ? 'Розгорнути гілку' : 'Згорнути гілку'}
|
| 1860 |
+
>
|
| 1861 |
+
{isBranchCollapsed ? '+' : '−'}
|
| 1862 |
+
</button>
|
|
|
|
| 1863 |
|
| 1864 |
{/* Branch contents */}
|
| 1865 |
{!isBranchCollapsed && (
|
| 1866 |
+
<div className="space-y-4">
|
| 1867 |
+
{/* Branch Head (Yellow dashed left border) */}
|
| 1868 |
+
{renderTaskCard(headNode, depth + 1, true, false)}
|
| 1869 |
+
|
| 1870 |
+
{/* Continuations (Green solid vertical connecting line) */}
|
| 1871 |
+
{continuationNodes.length > 0 && (
|
| 1872 |
+
<div className="pl-6 border-l-2 border-solid border-emerald-500 dark:border-emerald-600/60 ml-8 space-y-4 pt-1 pb-1">
|
| 1873 |
+
{continuationNodes.map((cNode) => renderTaskCard(cNode, depth + 1, false, true))}
|
| 1874 |
+
</div>
|
| 1875 |
+
)}
|
| 1876 |
</div>
|
| 1877 |
)}
|
| 1878 |
</div>
|