import React from "react"; import "../../css/components/menu/thread.css"; import { Box, Button } from "@mui/material"; import { Article as ArticleIcon, Comment as CommentIcon, ThumbDown as ThumbDownIcon, ThumbUp as ThumbUpIcon, } from "@mui/icons-material"; import { roundup, timeToWord } from "../../lib/common"; import { Link } from "react-router-dom"; import { useCat, useId, useMenuMode } from "../MenuProvider"; import { useCategories, useHistory } from "../ContextProvider"; import { ThreadMeta } from "@metahkg/api"; export default function MenuThread(props: { thread: ThreadMeta; onClick?: (e: React.MouseEvent) => void; }) { const [cat] = useCat(); const [id] = useId(); const [history] = useHistory(); const [menuMode] = useMenuMode(); const categories = useCategories(); const { thread, onClick } = props; const commentId = history.find((i) => i.id === thread.id)?.cid; return (

{thread.op.name}

{timeToWord(thread.lastModified)}

{thread.score >= 0 ? ( ) : ( )}

{thread.score}

{thread.c}

{String(roundup(thread.c / 25))}

{thread.title}

{(menuMode !== "category" || cat === 1) && ( )}
); }