|
|
@ -11,6 +11,7 @@ import type { |
|
|
|
} from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; |
|
|
|
} from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; |
|
|
|
import { CreateRoadmapModal } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; |
|
|
|
import { CreateRoadmapModal } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; |
|
|
|
import { useToast } from '../../hooks/use-toast'; |
|
|
|
import { useToast } from '../../hooks/use-toast'; |
|
|
|
|
|
|
|
import { ContentConfirmationModal } from './ContentConfirmationModal'; |
|
|
|
|
|
|
|
|
|
|
|
export type TeamResourceConfig = { |
|
|
|
export type TeamResourceConfig = { |
|
|
|
isCustomResource: boolean; |
|
|
|
isCustomResource: boolean; |
|
|
@ -44,6 +45,7 @@ export function RoadmapSelector(props: RoadmapSelectorProps) { |
|
|
|
const [isCreatingRoadmap, setIsCreatingRoadmap] = useState<boolean>(false); |
|
|
|
const [isCreatingRoadmap, setIsCreatingRoadmap] = useState<boolean>(false); |
|
|
|
|
|
|
|
|
|
|
|
const [error, setError] = useState<string>(''); |
|
|
|
const [error, setError] = useState<string>(''); |
|
|
|
|
|
|
|
const [confirmationContentId, setConfirmationContentId] = useState<string>(); |
|
|
|
|
|
|
|
|
|
|
|
async function loadAllRoadmaps() { |
|
|
|
async function loadAllRoadmaps() { |
|
|
|
const { error, response } = await httpGet<PageType[]>(`/pages.json`); |
|
|
|
const { error, response } = await httpGet<PageType[]>(`/pages.json`); |
|
|
@ -101,7 +103,7 @@ export function RoadmapSelector(props: RoadmapSelectorProps) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function addTeamResource(roadmapId: string) { |
|
|
|
async function addTeamResource(roadmapId: string, shouldCopyContent = false) { |
|
|
|
if (!teamId) { |
|
|
|
if (!teamId) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -118,6 +120,7 @@ export function RoadmapSelector(props: RoadmapSelectorProps) { |
|
|
|
resourceType: 'roadmap', |
|
|
|
resourceType: 'roadmap', |
|
|
|
removed: [], |
|
|
|
removed: [], |
|
|
|
renderer: renderer || 'balsamiq', |
|
|
|
renderer: renderer || 'balsamiq', |
|
|
|
|
|
|
|
shouldCopyContent, |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -148,8 +151,24 @@ export function RoadmapSelector(props: RoadmapSelectorProps) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const confirmationContentIdModal = confirmationContentId && ( |
|
|
|
|
|
|
|
<ContentConfirmationModal |
|
|
|
|
|
|
|
onClose={() => { |
|
|
|
|
|
|
|
setConfirmationContentId(''); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
onClick={(shouldCopy) => { |
|
|
|
|
|
|
|
addTeamResource(confirmationContentId, shouldCopy).finally(() => { |
|
|
|
|
|
|
|
pageProgressMessage.set(''); |
|
|
|
|
|
|
|
setConfirmationContentId(''); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
|
|
|
|
{confirmationContentIdModal} |
|
|
|
|
|
|
|
|
|
|
|
{changingRoadmapId && ( |
|
|
|
{changingRoadmapId && ( |
|
|
|
<UpdateTeamResourceModal |
|
|
|
<UpdateTeamResourceModal |
|
|
|
onClose={() => setChangingRoadmapId('')} |
|
|
|
onClose={() => setChangingRoadmapId('')} |
|
|
@ -170,9 +189,20 @@ export function RoadmapSelector(props: RoadmapSelectorProps) { |
|
|
|
allRoadmaps={allRoadmaps.filter((r) => r.renderer === 'editor')} |
|
|
|
allRoadmaps={allRoadmaps.filter((r) => r.renderer === 'editor')} |
|
|
|
teamId={teamId} |
|
|
|
teamId={teamId} |
|
|
|
onRoadmapAdd={(roadmapId) => { |
|
|
|
onRoadmapAdd={(roadmapId) => { |
|
|
|
addTeamResource(roadmapId).finally(() => { |
|
|
|
const isEditorRoadmap = allRoadmaps.find( |
|
|
|
pageProgressMessage.set(''); |
|
|
|
(r) => r.id === roadmapId && r.renderer === 'editor', |
|
|
|
}); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isEditorRoadmap) { |
|
|
|
|
|
|
|
addTeamResource(roadmapId).finally(() => { |
|
|
|
|
|
|
|
pageProgressMessage.set(''); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setShowSelectRoadmapModal(false); |
|
|
|
|
|
|
|
setConfirmationContentId(roadmapId); |
|
|
|
}} |
|
|
|
}} |
|
|
|
onRoadmapRemove={(roadmapId) => { |
|
|
|
onRoadmapRemove={(roadmapId) => { |
|
|
|
onRemove(roadmapId).finally(() => {}); |
|
|
|
onRemove(roadmapId).finally(() => {}); |
|
|
|