diff --git a/.astro/settings.json b/.astro/settings.json index 3205569d2..359cd594c 100644 --- a/.astro/settings.json +++ b/.astro/settings.json @@ -3,6 +3,6 @@ "enabled": false }, "_variables": { - "lastUpdateCheck": 1719080230711 + "lastUpdateCheck": 1720119515249 } } \ No newline at end of file diff --git a/src/components/EditorRoadmap/EditorRoadmapRenderer.css b/src/components/EditorRoadmap/EditorRoadmapRenderer.css index c5ae89fba..750596693 100644 --- a/src/components/EditorRoadmap/EditorRoadmapRenderer.css +++ b/src/components/EditorRoadmap/EditorRoadmapRenderer.css @@ -7,21 +7,24 @@ svg text tspan { svg > g[data-type='topic'], svg > g[data-type='subtopic'], svg g[data-type='link-item'], -svg > g[data-type='button'] { +svg > g[data-type='button'], +svg > g[data-type='resourceButton'], +svg > g[data-type='todo-checkbox'], +svg > g[data-type='todo'] { cursor: pointer; } svg > g[data-type='topic']:hover > rect { - fill: #d6d700; + fill: var(--hover-color); } svg > g[data-type='subtopic']:hover > rect { - fill: #f3c950; + fill: var(--hover-color); } -svg > g[data-type='button']:hover { - opacity: 0.8; -} -svg g[data-type='link-item']:hover { +svg g[data-type='button']:hover, +svg g[data-type='link-item']:hover, +svg g[data-type='resourceButton']:hover, +svg g[data-type='todo-checkbox']:hover { opacity: 0.8; } diff --git a/src/components/EditorRoadmap/EditorRoadmapRenderer.tsx b/src/components/EditorRoadmap/EditorRoadmapRenderer.tsx index c2e83d64c..c9be80905 100644 --- a/src/components/EditorRoadmap/EditorRoadmapRenderer.tsx +++ b/src/components/EditorRoadmap/EditorRoadmapRenderer.tsx @@ -45,7 +45,15 @@ function getNodeDetails(svgElement: SVGElement): RoadmapNodeDetails | null { return { nodeId, nodeType, targetGroup, title }; } -const allowedNodeTypes = ['topic', 'subtopic', 'button', 'link-item']; +const allowedNodeTypes = [ + 'topic', + 'subtopic', + 'button', + 'link-item', + 'resourceButton', + 'todo', + 'todo-checkbox', +]; export function EditorRoadmapRenderer(props: RoadmapRendererProps) { const { resourceId, nodes = [], edges = [] } = props; @@ -90,7 +98,11 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) { return; } - if (nodeType === 'button' || nodeType === 'link-item') { + if ( + nodeType === 'button' || + nodeType === 'link-item' || + nodeType === 'resourceButton' + ) { const link = targetGroup?.dataset?.link || ''; const isExternalLink = link.startsWith('http'); if (isExternalLink) { @@ -104,6 +116,20 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) { const isCurrentStatusLearning = targetGroup?.classList.contains('learning'); const isCurrentStatusSkipped = targetGroup?.classList.contains('skipped'); + if (nodeType === 'todo-checkbox') { + e.preventDefault(); + if (!isLoggedIn()) { + showLoginPopup(); + return; + } + + const newStatus = targetGroup?.classList.contains('done') + ? 'pending' + : 'done'; + updateTopicStatus(nodeId, newStatus); + return; + } + if (e.shiftKey) { e.preventDefault(); if (!isLoggedIn()) {