mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-07-31 14:30:13 +02:00
fix: show login popup for logged out user (#5764)
This commit is contained in:
@@ -12,6 +12,8 @@ import { useToast } from '../../hooks/use-toast';
|
|||||||
import type { Edge, Node } from 'reactflow';
|
import type { Edge, Node } from 'reactflow';
|
||||||
import { Renderer } from '../../../editor/renderer';
|
import { Renderer } from '../../../editor/renderer';
|
||||||
import { slugify } from '../../lib/slugger';
|
import { slugify } from '../../lib/slugger';
|
||||||
|
import { isLoggedIn } from '../../lib/jwt';
|
||||||
|
import { showLoginPopup } from '../../lib/popup';
|
||||||
|
|
||||||
export type RoadmapRendererProps = {
|
export type RoadmapRendererProps = {
|
||||||
resourceId: string;
|
resourceId: string;
|
||||||
@@ -104,6 +106,11 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
|
|||||||
|
|
||||||
if (e.shiftKey) {
|
if (e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
showLoginPopup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
updateTopicStatus(
|
updateTopicStatus(
|
||||||
nodeId,
|
nodeId,
|
||||||
isCurrentStatusLearning ? 'pending' : 'learning',
|
isCurrentStatusLearning ? 'pending' : 'learning',
|
||||||
@@ -111,6 +118,11 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
|
|||||||
return;
|
return;
|
||||||
} else if (e.altKey) {
|
} else if (e.altKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
showLoginPopup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
updateTopicStatus(nodeId, isCurrentStatusSkipped ? 'pending' : 'skipped');
|
updateTopicStatus(nodeId, isCurrentStatusSkipped ? 'pending' : 'skipped');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -143,6 +155,10 @@ export function EditorRoadmapRenderer(props: RoadmapRendererProps) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
showLoginPopup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
const isCurrentStatusDone = targetGroup?.classList.contains('done');
|
const isCurrentStatusDone = targetGroup?.classList.contains('done');
|
||||||
updateTopicStatus(nodeId, isCurrentStatusDone ? 'pending' : 'done');
|
updateTopicStatus(nodeId, isCurrentStatusDone ? 'pending' : 'done');
|
||||||
}, []);
|
}, []);
|
||||||
|
Reference in New Issue
Block a user