---
import {siteConfig} from "../config";
import FediverseComments from "./helper/comments/Fediverse.astro";
import HatsuComments from "./helper/comments/Hatsu.astro";
import Artalk from "./helper/comments/Artalk.astro";
import Giscus from "./helper/comments/Giscus.astro";
import OomComments from "./helper/comments/OOM.astro";

const method = siteConfig.comments.type

const FediverseConfig = siteConfig.comments.fediverse

interface Props {
    mastodonLink?: string;
    bskyLink?: string;
}

const { mastodonLink, bskyLink } = Astro.props;
---
{method === 'artalk' && <Artalk />}
{method === 'giscus' && <Giscus />}
<!-- if prerender === true is set then render from client -->
{(method === 'fediverse' && !FediverseConfig.renderOnServer ) && <FediverseComments /> }
{(method === 'fediverse' && FediverseConfig.renderOnServer ) && <FediverseComments server:defer><p>Loading comments...</p></FediverseComments> }
{method === 'hatsu' && <HatsuComments /> }
{method === 'oom' && <OomComments mastodonLink={mastodonLink} bskyLink={bskyLink} />}