import { FC, FormEvent } from "react"; import styled from "styled-components"; import usePinMessage from "../../../common/hook/usePinMessage"; import IconSurprise from "../../../assets/icons/emoji.surprise.svg"; import IconClose from "../../../assets/icons/close.svg"; import { useTranslation } from "react-i18next"; import PinnedMessage from "../../../common/component/PinnedMessage"; const Styled = styled.div` .preview { background: none; .down img { width: 100% !important; height: auto !important; } } `; type Props = { id: number; }; const PinList: FC = ({ id }: Props) => { const { t } = useTranslation("chat"); const { pins, unpinMessage, canPin } = usePinMessage(id); const handleUnpin = (evt: FormEvent) => { const { mid } = evt.currentTarget.dataset; if (!mid) return; unpinMessage(+mid); }; const noPins = pins.length == 0; return (

{t("pinned_msg")}({pins.length})

{noPins ? (
{t("pin_empty_tip")}
) : (
    {pins.map((data) => { return (
  • {canPin && ( )}
  • ); })}
)}
); }; export default PinList;