|
|
|
@ -3,6 +3,8 @@ import { DashboardCustomProgressCard } from './DashboardCustomProgressCard'; |
|
|
|
|
import { DashboardCardLink } from './DashboardCardLink'; |
|
|
|
|
import { useState } from 'react'; |
|
|
|
|
import { CreateRoadmapModal } from '../CustomRoadmap/CreateRoadmap/CreateRoadmapModal'; |
|
|
|
|
import { Simulate } from 'react-dom/test-utils'; |
|
|
|
|
import {Bot, BrainCircuit, Map, PencilRuler} from 'lucide-react'; |
|
|
|
|
|
|
|
|
|
type ListDashboardCustomProgressProps = { |
|
|
|
|
progresses: UserProgress[]; |
|
|
|
@ -22,24 +24,6 @@ export function ListDashboardCustomProgress( |
|
|
|
|
const [isCreateCustomRoadmapModalOpen, setIsCreateCustomRoadmapModalOpen] = |
|
|
|
|
useState(false); |
|
|
|
|
|
|
|
|
|
if (!isLoading && progresses.length === 0) { |
|
|
|
|
return isAIGeneratedRoadmaps ? ( |
|
|
|
|
<DashboardCardLink |
|
|
|
|
className="mt-8" |
|
|
|
|
href="/ai" |
|
|
|
|
title="Generate Roadmaps with AI" |
|
|
|
|
description="You can generate your own roadmap with AI" |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<DashboardCardLink |
|
|
|
|
className="mt-8" |
|
|
|
|
href="https://draw.roadmap.sh" |
|
|
|
|
title="Use our Editor to Draw Roadmaps" |
|
|
|
|
description="You can make roadmaps that look like ours" |
|
|
|
|
/> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const customRoadmapModal = isCreateCustomRoadmapModalOpen ? ( |
|
|
|
|
<CreateRoadmapModal |
|
|
|
|
onClose={() => setIsCreateCustomRoadmapModalOpen(false)} |
|
|
|
@ -52,24 +36,44 @@ export function ListDashboardCustomProgress( |
|
|
|
|
/> |
|
|
|
|
) : null; |
|
|
|
|
|
|
|
|
|
const Slot = isAIGeneratedRoadmaps ? 'a' : 'button'; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
{customRoadmapModal} |
|
|
|
|
|
|
|
|
|
<h2 className="mb-3 mt-8 text-xs uppercase text-gray-400"> |
|
|
|
|
<h2 className="mb-2 mt-6 text-xs uppercase text-gray-400"> |
|
|
|
|
{isAIGeneratedRoadmaps ? 'AI Generated Roadmaps' : 'Custom Roadmaps'} |
|
|
|
|
</h2> |
|
|
|
|
|
|
|
|
|
{!isLoading && progresses.length === 0 && isAIGeneratedRoadmaps && ( |
|
|
|
|
<DashboardCardLink |
|
|
|
|
className="mt-0" |
|
|
|
|
icon={BrainCircuit} |
|
|
|
|
href="/ai" |
|
|
|
|
title="Generate Roadmaps with AI" |
|
|
|
|
description="You can generate your own roadmap with AI" |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{!isLoading && progresses.length === 0 && !isAIGeneratedRoadmaps && ( |
|
|
|
|
<DashboardCardLink |
|
|
|
|
className="mt-0" |
|
|
|
|
icon={PencilRuler} |
|
|
|
|
href="https://draw.roadmap.sh" |
|
|
|
|
title="Draw your own Roadmap" |
|
|
|
|
description="Use our editor to draw your own roadmap" |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2 md:grid-cols-4"> |
|
|
|
|
{isLoading ? ( |
|
|
|
|
{isLoading && ( |
|
|
|
|
<> |
|
|
|
|
{Array.from({ length: 8 }).map((_, index) => ( |
|
|
|
|
<CustomProgressCardSkeleton key={index} /> |
|
|
|
|
))} |
|
|
|
|
</> |
|
|
|
|
) : ( |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
{!isLoading && progresses.length > 0 && ( |
|
|
|
|
<> |
|
|
|
|
{progresses.map((progress) => ( |
|
|
|
|
<DashboardCustomProgressCard |
|
|
|
@ -78,18 +82,18 @@ export function ListDashboardCustomProgress( |
|
|
|
|
/> |
|
|
|
|
))} |
|
|
|
|
|
|
|
|
|
<Slot |
|
|
|
|
<a |
|
|
|
|
className="flex min-h-[80px] items-center justify-center rounded-lg border border-dashed border-gray-300 bg-white p-4 text-sm font-medium text-gray-500 hover:bg-gray-50 hover:text-gray-600" |
|
|
|
|
{...(isAIGeneratedRoadmaps |
|
|
|
|
? { href: '/ai' } |
|
|
|
|
: { |
|
|
|
|
onClick: () => { |
|
|
|
|
setIsCreateCustomRoadmapModalOpen(true); |
|
|
|
|
}, |
|
|
|
|
})} |
|
|
|
|
href={'/ai'} |
|
|
|
|
onClick={(e) => { |
|
|
|
|
if (!isAIGeneratedRoadmaps) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
setIsCreateCustomRoadmapModalOpen(true); |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{isAIGeneratedRoadmaps ? '+ Generate New' : '+ Create New'} |
|
|
|
|
</Slot> |
|
|
|
|
</a> |
|
|
|
|
</> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|