fix: show login popup for logged out user (#5764)

pull/5767/head
Arik Chakma 6 months ago committed by GitHub
parent bb6d34407d
commit bab4a1581d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      src/components/EditorRoadmap/EditorRoadmapRenderer.tsx

@ -12,6 +12,8 @@ import { useToast } from '../../hooks/use-toast';
import type { Edge, Node } from 'reactflow';
import { Renderer } from '../../../editor/renderer';
import { slugify } from '../../lib/slugger';
import { isLoggedIn } from '../../lib/jwt';
import { showLoginPopup } from '../../lib/popup';
export type RoadmapRendererProps = {
resourceId: string;
@ -104,6 +106,11 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
if (e.shiftKey) {
e.preventDefault();
if (!isLoggedIn()) {
showLoginPopup();
return;
}
updateTopicStatus(
nodeId,
isCurrentStatusLearning ? 'pending' : 'learning',
@ -111,6 +118,11 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
return;
} else if (e.altKey) {
e.preventDefault();
if (!isLoggedIn()) {
showLoginPopup();
return;
}
updateTopicStatus(nodeId, isCurrentStatusSkipped ? 'pending' : 'skipped');
return;
}
@ -143,6 +155,10 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
return;
}
if (!isLoggedIn()) {
showLoginPopup();
return;
}
const isCurrentStatusDone = targetGroup?.classList.contains('done');
updateTopicStatus(nodeId, isCurrentStatusDone ? 'pending' : 'done');
}, []);

Loading…
Cancel
Save