Skip to content

Commit bab4a15

Browse files
authored
fix: show login popup for logged out user (kamranahmedse#5764)
1 parent bb6d344 commit bab4a15

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/components/EditorRoadmap/EditorRoadmapRenderer.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { useToast } from '../../hooks/use-toast';
1212
import type { Edge, Node } from 'reactflow';
1313
import { Renderer } from '../../../editor/renderer';
1414
import { slugify } from '../../lib/slugger';
15+
import { isLoggedIn } from '../../lib/jwt';
16+
import { showLoginPopup } from '../../lib/popup';
1517

1618
export type RoadmapRendererProps = {
1719
resourceId: string;
@@ -104,13 +106,23 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
104106

105107
if (e.shiftKey) {
106108
e.preventDefault();
109+
if (!isLoggedIn()) {
110+
showLoginPopup();
111+
return;
112+
}
113+
107114
updateTopicStatus(
108115
nodeId,
109116
isCurrentStatusLearning ? 'pending' : 'learning',
110117
);
111118
return;
112119
} else if (e.altKey) {
113120
e.preventDefault();
121+
if (!isLoggedIn()) {
122+
showLoginPopup();
123+
return;
124+
}
125+
114126
updateTopicStatus(nodeId, isCurrentStatusSkipped ? 'pending' : 'skipped');
115127
return;
116128
}
@@ -143,6 +155,10 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
143155
return;
144156
}
145157

158+
if (!isLoggedIn()) {
159+
showLoginPopup();
160+
return;
161+
}
146162
const isCurrentStatusDone = targetGroup?.classList.contains('done');
147163
updateTopicStatus(nodeId, isCurrentStatusDone ? 'pending' : 'done');
148164
}, []);

0 commit comments

Comments
 (0)