Marking progress on roadmap

This commit is contained in:
Kamran Ahmed
2021-12-09 16:39:09 +01:00
parent 985da9ae30
commit 9a22a457f5
6 changed files with 97 additions and 21 deletions

View File

@@ -12,6 +12,7 @@ import { RoadmapPageHeader } from '../../components/roadmap/roadmap-page-header'
import { ContentDrawer } from '../../components/roadmap/content-drawer';
import { RoadmapError } from '../../components/roadmap/roadmap-error';
import { RoadmapLoader } from '../../components/roadmap/roadmap-loader';
import { removeSortingInfo } from '../../lib/renderer/utils';
type RoadmapProps = {
roadmap: RoadmapType;
@@ -19,10 +20,6 @@ type RoadmapProps = {
export function InteractiveRoadmapRenderer(props: RoadmapProps) {
const { roadmap } = props;
if (!roadmap.jsonUrl) {
return null;
}
const { loading: isLoading, error: hasErrorLoading, get } = useFetch();
const roadmapRef = useRef(null);
@@ -33,6 +30,10 @@ export function InteractiveRoadmapRenderer(props: RoadmapProps) {
const [hasErrorRendering, setHasErrorRendering] = useState(false);
useEffect(() => {
if (!roadmap.jsonUrl) {
return;
}
get(roadmap.jsonUrl)
.then((roadmapJson) => {
setRoadmapJson(roadmapJson);
@@ -65,7 +66,7 @@ export function InteractiveRoadmapRenderer(props: RoadmapProps) {
// e.g. 100-internet:how-does-the-internet-work
// will be translated to `internet:how-does-the-internet-work`
setGroupId(groupId.replace(/^\d+-/, ''));
setGroupId(removeSortingInfo(groupId));
}
window.addEventListener('keydown', keydownListener);
@@ -104,8 +105,12 @@ export function InteractiveRoadmapRenderer(props: RoadmapProps) {
});
}, [roadmapJson]);
if (!roadmap.jsonUrl) {
return null;
}
if (hasErrorLoading || hasErrorRendering) {
return <RoadmapError roadmap={roadmap} />
return <RoadmapError roadmap={roadmap} />;
}
return (

View File

@@ -43,6 +43,11 @@ const GlobalStyles = css`
&:hover > [fill="rgb(153,153,153)"] { fill: #646464; }
&:hover > [fill="rgb(255,255,255)"] { fill: #d7d7d7; }
}
svg .done {
& rect { fill: #cbcbcb; }
& text { text-decoration: line-through; }
}
`;