import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Row } from "antd";
import { bySumScore, sumScore } from "../Post";
import { useVotingStreamMood } from "../../../Pages/Post/Post";
export const Tags = ({ isEyeOpened, isEyeOpenedResponzive, visionTags, nonVisionTags, setHilightTag, children }) => {
    const nextInStream = useVotingStreamMood();
    const { currPost } = nextInStream;
    return ((isEyeOpened || isEyeOpenedResponzive) && currPost.tags?.length === undefined ? (_jsx("p", { className: "paragraph-2b", children: "no tags found." })) : (isEyeOpened || isEyeOpenedResponzive)) && currPost.tags?.length ? (_jsx(Row, { className: "nl-post-info-column__tags-wrapper", children: [
            ...visionTags?.sort(bySumScore),
            ...nonVisionTags
                // 	?.sort(bySumScore)
                .slice(0, Math.max(0, 20 - visionTags.length)),
        ]
            // ?.slice(0, 10)
            ?.map((t) => {
            const tag = t.value;
            const score = (sumScore(t["_rel"]) * 100).toFixed(0);
            return (_jsx(_Fragment, { children: _jsxs(Row, { onMouseOver: () => setHilightTag(visionTags.filter((s) => s.value === t.value)), onMouseOut: () => setHilightTag([]), className: "paragraph-3b nl-post-info-column__infobox-wrapper__col__tag", style: {
                        backgroundColor: t.polygons?.length ? "#c9fd50" : "#fcfcf3",
                        alignItems: "baseline",
                        flexWrap: "nowrap",
                    }, children: [_jsxs("p", { className: "u-margin-right-xs paragraph-3b", children: [score, "%"] }), _jsx("p", { className: "paragraph-3b", children: tag })] }) }));
        }) })) : (_jsx(_Fragment, { children: children }));
};
//# sourceMappingURL=Tags.js.map