Add beginner friendly git and github roadmap

pull/6520/head^2
Kamran Ahmed 4 months ago
parent 047b359df9
commit beabbff77f
  1. 25
      src/components/EditorRoadmap/EditorRoadmapRenderer.tsx
  2. 1637
      src/data/roadmaps/git-github/git-github-beginner.json

@ -38,6 +38,7 @@ function getNodeDetails(svgElement: SVGElement): RoadmapNodeDetails | null {
const nodeId = targetGroup?.dataset?.nodeId; const nodeId = targetGroup?.dataset?.nodeId;
const nodeType = targetGroup?.dataset?.type; const nodeType = targetGroup?.dataset?.type;
const title = targetGroup?.dataset?.title; const title = targetGroup?.dataset?.title;
if (!nodeId || !nodeType) { if (!nodeId || !nodeType) {
return null; return null;
} }
@ -53,6 +54,7 @@ const allowedNodeTypes = [
'resourceButton', 'resourceButton',
'todo', 'todo',
'todo-checkbox', 'todo-checkbox',
'checklist-item',
]; ];
export function EditorRoadmapRenderer(props: RoadmapRendererProps) { export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
@ -94,8 +96,6 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
const { nodeId, nodeType, targetGroup, title } = const { nodeId, nodeType, targetGroup, title } =
getNodeDetails(target) || {}; getNodeDetails(target) || {};
console.log(nodeId);
if (!nodeId || !nodeType || !allowedNodeTypes.includes(nodeType)) { if (!nodeId || !nodeType || !allowedNodeTypes.includes(nodeType)) {
return; return;
} }
@ -155,9 +155,30 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
return; return;
} }
// for the click on rect of checklist-item
if (nodeType === 'checklist-item' && target.tagName === 'rect') {
e.preventDefault();
if (!isLoggedIn()) {
showLoginPopup();
return;
}
const newStatus = targetGroup?.classList.contains('done')
? 'pending'
: 'done';
updateTopicStatus(nodeId, newStatus);
return;
}
// we don't have the topic popup for checklist-item
if (nodeType === 'checklist-item') {
return;
}
if (!title) { if (!title) {
return; return;
} }
const detailsPattern = `${slugify(title)}@${nodeId}`; const detailsPattern = `${slugify(title)}@${nodeId}`;
window.dispatchEvent( window.dispatchEvent(
new CustomEvent('roadmap.node.click', { new CustomEvent('roadmap.node.click', {

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save