@@ -726,7 +729,7 @@ export function GenerateRoadmap(props: GenerateRoadmapProps) {
Sign up to View the full roadmap
-
+
You must be logged in to view the complete roadmap
diff --git a/src/components/RoadmapAIChat/ChatRoadmapRenderer.tsx b/src/components/RoadmapAIChat/ChatRoadmapRenderer.tsx
index 7b21ecc88..29863fddb 100644
--- a/src/components/RoadmapAIChat/ChatRoadmapRenderer.tsx
+++ b/src/components/RoadmapAIChat/ChatRoadmapRenderer.tsx
@@ -2,22 +2,18 @@ import './ChatRoadmapRenderer.css';
import { lazy, useCallback, useEffect, useRef, useState } from 'react';
import {
- renderResourceProgress,
updateResourceProgress,
type ResourceProgressType,
renderTopicProgress,
- refreshProgressCounters,
} from '../../lib/resource-progress';
import { pageProgressMessage } from '../../stores/page';
import { useToast } from '../../hooks/use-toast';
import type { Edge, Node } from '@roadmapsh/editor';
-import { slugify } from '../../lib/slugger';
import { isLoggedIn } from '../../lib/jwt';
import { showLoginPopup } from '../../lib/popup';
import { queryClient } from '../../stores/query-client';
import { userResourceProgressOptions } from '../../queries/resource-progress';
import { useQuery } from '@tanstack/react-query';
-import { TopicResourcesModal } from './TopicResourcesModal';
const Renderer = lazy(() =>
import('@roadmapsh/editor').then((mod) => ({
diff --git a/src/components/RoadmapAIChat/RoadmapAIChat.tsx b/src/components/RoadmapAIChat/RoadmapAIChat.tsx
index 4be567090..11a3c7559 100644
--- a/src/components/RoadmapAIChat/RoadmapAIChat.tsx
+++ b/src/components/RoadmapAIChat/RoadmapAIChat.tsx
@@ -136,7 +136,7 @@ export function RoadmapAIChat(props: RoadmapAIChatProps) {
}, [roadmapDetail]);
useEffect(() => {
- if (!roadmapDetail || !roadmapContainerRef.current) {
+ if (!roadmapDetail || !roadmapContainerRef.current || !roadmapDetail.svg) {
return;
}
diff --git a/src/components/TeamProgress/MemberProgressModal.tsx b/src/components/TeamProgress/MemberProgressModal.tsx
index 5f312e7c9..777ddad9f 100644
--- a/src/components/TeamProgress/MemberProgressModal.tsx
+++ b/src/components/TeamProgress/MemberProgressModal.tsx
@@ -108,12 +108,17 @@ export function MemberProgressModal(props: ProgressMapProps) {
const json = await res.json();
const svg =
renderer === 'editor'
- ? await renderFlowJSON(json)
+ ? renderFlowJSON(json)
: await wireframeJSONToSVG(json, {
fontURL: '/fonts/balsamiq.woff2',
});
- replaceChildren(containerEl.current!, svg);
+ const container = containerEl.current;
+ if (!svg || !container) {
+ return;
+ }
+
+ replaceChildren(container, svg);
}
useKeydown('Escape', () => {
diff --git a/src/components/UserProgress/UserProgressModal.tsx b/src/components/UserProgress/UserProgressModal.tsx
index e53d98657..c7fe5bdaf 100644
--- a/src/components/UserProgress/UserProgressModal.tsx
+++ b/src/components/UserProgress/UserProgressModal.tsx
@@ -101,7 +101,7 @@ export function UserProgressModal(props: ProgressMapProps) {
}
return renderer === 'editor'
- ? await renderFlowJSON(roadmapJson as any)
+ ? (renderFlowJSON(roadmapJson as any) as SVGElement)
: await wireframeJSONToSVG(roadmapJson, {
fontURL: '/fonts/balsamiq.woff2',
});
@@ -210,7 +210,7 @@ export function UserProgressModal(props: ProgressMapProps) {
return (
diff --git a/src/queries/ai-roadmap.ts b/src/queries/ai-roadmap.ts
index 4ac28937a..32788aa0f 100644
--- a/src/queries/ai-roadmap.ts
+++ b/src/queries/ai-roadmap.ts
@@ -40,7 +40,11 @@ export function aiRoadmapOptions(roadmapSlug?: string) {
const result = generateAICourseRoadmapStructure(res.data);
const { nodes, edges } = generateAIRoadmapFromText(result);
- const svg = await renderFlowJSON({ nodes, edges });
+ const svg = renderFlowJSON({ nodes, edges });
+ if (!svg) {
+ return res;
+ }
+
const svgHtml = svg.outerHTML;
return {
@@ -153,7 +157,11 @@ export async function generateAIRoadmap(options: GenerateAIRoadmapOptions) {
onMessage: async (message) => {
const result = generateAICourseRoadmapStructure(message);
const { nodes, edges } = generateAIRoadmapFromText(result);
- const svg = await renderFlowJSON({ nodes, edges });
+ const svg = renderFlowJSON({ nodes, edges });
+ if (!svg) {
+ return;
+ }
+
onRoadmapSvgChange?.(svg);
},
onMessageEnd: async () => {
diff --git a/src/queries/roadmap.ts b/src/queries/roadmap.ts
index 3ac8c7f1a..7822d7950 100644
--- a/src/queries/roadmap.ts
+++ b/src/queries/roadmap.ts
@@ -23,7 +23,13 @@ export function roadmapJSONOptions(roadmapId: string) {
`${baseUrl}/${roadmapId}.json`,
);
- const svg = await renderFlowJSON(roadmapJSON);
+ const svg = renderFlowJSON(roadmapJSON);
+ if (!svg) {
+ return {
+ json: roadmapJSON,
+ svg: null,
+ };
+ }
return {
json: roadmapJSON,
diff --git a/src/styles/global.css b/src/styles/global.css
index 50b13447c..a4de6fd0b 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -5,7 +5,7 @@
@plugin 'tailwind-scrollbar';
@font-face {
- font-family: 'Balsamiq Sans';
+ font-family: 'balsamiq';
src: url('/fonts/balsamiq.woff2') format('woff2');
font-weight: 400;
font-style: normal;
@@ -13,7 +13,7 @@
}
@theme {
- --font-balsamiq: 'Balsamiq Sans', sans-serif;
+ --font-balsamiq: 'balsamiq', sans-serif;
}
/*