import React from "react" import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" import { ChevronDown, ExternalLink, Edit } from 'lucide-react' import { MarkCardI, MarkLinkI, getBasePath } from '@/lib/markcard/card' interface CardProps { card: MarkCardI canEdit: boolean // userId?: string baseUrl: string onEdit?: (id: string, origin: MarkCardI) => void } export default function MarkCard({ card, canEdit, baseUrl, onEdit }: CardProps) { const { id, title, shortDescription, detailedDescription, links, publicUrl } = card // const baseUrl = await getBasePath(userId) const realLinks = links.map(link => { if (link.url.startsWith('$')) { return { ...link, url: `${baseUrl}/${link.url.substring(1)}` } } return link }) const getALink = (link: MarkLinkI) => { return ( {link.title} ) } return ( {title} {shortDescription} {detailedDescription &&

{detailedDescription}

} {publicUrl && (
Public URL: {`${baseUrl}/${publicUrl}`}
)}
{ realLinks.length > 0 && ( )} {realLinks.length > 1 && ( {realLinks.slice(1).map((link, index) => ( {getALink(link)} ))} )}
{canEdit && onEdit && ( )}
) }