import clsx from "clsx";
import { Suspense } from "react";
import { Await } from "react-router";
import MicroModal from "micromodal";
import { ICONS_PREPEND } from "#env/env-vars";
import { Image } from "#components/images";
import { KemonoLink, LocalLink } from "#components/links";
import { Timestamp } from "#components/dates";
import { Preformatted } from "#components/formatting";
import { IComment } from "#entities/posts";
import * as styles from "./overview.module.scss";
import { IPostOverviewProps } from "./types";
interface IPostFooterProps extends Pick {
service: string;
profileID: string;
profileName?: string;
}
export function PostFooter({
comments,
service,
profileID,
profileName,
}: IPostFooterProps) {
return (
}>
>}>
{(comments: IComment[]) => (
{!comments ? (
No comments found for this post.
) : (
comments.map((comment) => (
))
)}
)}
);
}
interface IPostCommentProps {
comment: IComment;
postProfileID: string;
postProfileName?: string;
service: string;
}
function PostComment({
comment,
postProfileID,
postProfileName,
service,
}: IPostCommentProps) {
const {
id,
commenter,
commenter_name,
revisions,
parent_id,
content,
published,
} = comment;
const isProfileComment = commenter === postProfileID;
const modalID = `comment-revisions-${id}`;
return (
{!isProfileComment ? (
{commenter_name ?? "Anonymous"}
) : (
<>
{/* TODO: a proper local link */}
{postProfileName ?? "Post's profile"}
>
)}
{revisions && revisions.length !== 0 && (
<>
MicroModal.show(modalID)}
>
(
edited
)
>
)}
{parent_id && (
)}
{service !== "boosty" ? (
content
) : (
)}
);
}