import { formatRelative } from "date-fns"; import * as React from "react"; import { Trans, useTranslation } from "next-i18next"; import Button from "../button"; import { usePoll } from "../use-poll"; import Popover from "../popover"; import { useMutation } from "react-query"; import axios from "axios"; export interface PollSubheaderProps {} const PollSubheader: React.VoidFunctionComponent = () => { const poll = usePoll(); const { t } = useTranslation("app"); const { mutate: sendVerificationEmail, isLoading: isSendingVerificationEmail, isSuccess: didSendVerificationEmail, } = useMutation(async () => { await axios.post(`/api/poll/${poll.urlId}/verify`); }); return (
, }} />   {poll.role === "admin" ? ( poll.verified ? ( Verified ) : ( Unverified } >
), }} />
{didSendVerificationEmail ? (
Verification email sent.
) : ( )}
) ) : null}
 •  {formatRelative(new Date(poll.createdAt), new Date())}
); }; export default PollSubheader;