import { useParams, Link, useNavigate } from 'react-router-dom'; import { WidePageLayout } from '../components/WidePageLayout'; import RichTextContent from '../components/RichTextContent'; import useWikiDetail from '../hooks/useWikiDetail'; import Edit2Icon from '../components/icons/Edit2Icon'; import Trash2Icon from '../components/icons/Trash2Icon'; import ChevronRightIcon from '../components/icons/ChevronRightIcon'; export function WikiDetail() { const { id: boardId, wikiId } = useParams<{ id: string; wikiId: string }>(); const navigate = useNavigate(); const { wiki, deleteWiki } = useWikiDetail(wikiId || '0'); const handleDelete = async () => { if (!wiki) return; if (confirm(`Are you sure you want to delete wiki "${wiki.name}"?`)) { try { await deleteWiki(); navigate(`/boards/${boardId}/wikis`); } catch { // Error is already handled by hook with toast } } }; if (!wiki) { return (
Loading wiki...
); } return (
{/* Header */}
← Back to Wikis

{wiki.name}

{wiki.slug && /{wiki.slug}}
Edit
{/* Content */}
{/* Summary */} {wiki.summary && (

Summary

{wiki.summary}

)} {/* Rich Text Content */} {wiki.content && Array.isArray(wiki.content) && wiki.content.length > 0 && (

Content

)} {/* Tags */} {wiki.tags && wiki.tags.length > 0 && (

Tags

{wiki.tags.map((tag, index) => ( {tag} ))}
)} {/* Metadata */}

Metadata

{wiki.category && (
Category: {wiki.category}
)} {wiki.created_by && (
Created By: User #{wiki.created_by}
)} {wiki.updated_by && (
Updated By: User #{wiki.updated_by}
)}
Created: {wiki.created_at ? new Date(wiki.created_at).toLocaleString() : 'N/A'}
Updated: {wiki.updated_at ? new Date(wiki.updated_at).toLocaleString() : 'N/A'}
{/* Linked Entities Section */}

Linked Entities

{/* Linked Cards */} {wiki.linked_cards && wiki.linked_cards.length > 0 && (

Linked Cards

{wiki.linked_cards.map((card) => (

{card.name}

{card.description && (

{card.description}

)}
))}
)} {/* Linked Epics */} {wiki.linked_epics && wiki.linked_epics.length > 0 && (

Linked Epics

{wiki.linked_epics.map((epic) => (
{epic.color && (
)}

{epic.name}

{epic.description && (

{epic.description}

)}
{epic.metrics && (
{epic.metrics.card_count !== undefined && ( {epic.metrics.card_count} cards )}
)}
))}
)} {/* No linked entities */} {(!wiki.linked_cards || wiki.linked_cards.length === 0) && (!wiki.linked_epics || wiki.linked_epics.length === 0) && (
🔗

This wiki has no linked entities yet

)}
); } export default WikiDetail;