"use client"
import { AppLink } from "../app-link"
import { ThemesStatusMapping } from "../project/project-filters-bar"
import { Card } from "./card"
import { LABELS } from "@/app/labels"
import { ProjectInterface, ProjectSectionLabelMapping } from "@/lib/types"
import { cn, removeProtocol } from "@/lib/utils"
import Image from "next/image"
import { ReactNode } from "react"
interface WikiDetailProps {
label: string
value?: ReactNode
}
interface WikiCardProps {
project: ProjectInterface
className?: string
}
interface WikiLinkProps {
href: string
external?: boolean
children: ReactNode
}
const WikiDetail = ({ label, value }: WikiDetailProps) => {
if (!value) return null
return (
{label}
{typeof value === "string" ? (
{value}
) : (
{value}
)}
)
}
const WikiLink = ({ href, external, children }: WikiLinkProps) => {
return (
{children}
)
}
export const WikiCard = ({ project, className = "" }: WikiCardProps) => {
const statusItem = ThemesStatusMapping
const { website } = project.links ?? {}
const projectFunding = ProjectSectionLabelMapping[project?.section]
const { label: projectStatus } = statusItem?.[project?.projectStatus] ?? {}
const builtWithKeys: string[] = project?.tags?.builtWith ?? []
const previousBrandImage = project?.previousBrandImage ?? ""
return (
{!project?.image && (
{project?.imageAlt || project?.name}
)}
{builtWithKeys?.length > 0 && (
{builtWithKeys.map((key) => (
{key}
))}
}
/>
)}
{website && (
{removeProtocol(website)}
}
/>
)}
{(previousBrandImage ?? "")?.length > 0 && (
{!project?.image && (
{project?.imageAlt || project?.name}
)}
{LABELS.COMMON.PREV_BRAND_IMAGE}
)}
)
}