---
import type { CollectionEntry } from "astro:content";

import { getPostUrl } from "@utils/url";
import { postConfig } from "@/config";
import Twikoo from "./twikoo.astro";


interface Props {
    post: CollectionEntry<"posts">;
}

const { post } = Astro.props;

const path = getPostUrl(post);

let commentService = "";
if (postConfig.comment?.enable && postConfig.comment?.twikoo) {
    commentService = "twikoo";
}
---

{postConfig.comment?.enable && (
    <div class="card-base p-6 mb-4">
        {commentService === 'twikoo' && <Twikoo path={path} />}
        {commentService === '' && null}
    </div>
)}