import type { Poast } from "@/types/trill"; import Modal from "../modals/Modal"; import { useState } from "react"; import Post from "./Post"; import RP from "./RP"; import Avatar from "../Avatar"; import { stringToReact } from "./Reactions"; function StatsModal({ poast, close }: { close: any; poast: Poast }) { const [tab, setTab] = useState("replies"); const replies = poast.children || []; const quotes = poast.engagement.quoted; const reposts = poast.engagement.shared; const reacts = poast.engagement.reacts; function set(e: React.MouseEvent, s: string) { e.stopPropagation(); setTab(s); } // TODO revise the global thingy here return (
{}} />
set(e, "replies")} >

Replies

set(e, "quotes")} >

Quotes

set(e, "reposts")} >

Reposts

set(e, "reacts")} >

Reacts

{tab === "replies" ? (
{replies.map((p) => (
))}
) : tab === "quotes" ? (
{quotes.map((p) => (
))}
) : tab === "reposts" ? (
{reposts.map((p) => (
))}
) : tab === "reacts" ? (
{Object.keys(reacts).map((p) => (
{stringToReact(reacts[p])}
))}
) : null}
); } export default StatsModal;