always show poll results for creator

This commit is contained in:
Kieran 2023-04-10 16:29:43 +01:00
parent 8aed425a86
commit ef0c019917
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
1 changed files with 3 additions and 1 deletions

View File

@ -31,6 +31,8 @@ export default function Poll(props: PollProps) {
const [invoice, setInvoice] = useState("");
const [voting, setVoting] = useState<number>();
const didVote = props.zaps.some(a => a.sender === myPubKey);
const isMyPoll = props.ev.pubkey === myPubKey;
const showResults = didVote || isMyPoll;
const options = props.ev.tags.filter(a => a[0] === "poll_option").sort((a, b) => Number(a[1]) - Number(b[1]));
async function zapVote(ev: React.MouseEvent, opt: number) {
@ -123,7 +125,7 @@ export default function Poll(props: PollProps) {
<div className="f-grow">
{opt === voting ? <Spinner /> : <Text content={desc} tags={props.ev.tags} creator={props.ev.pubkey} />}
</div>
{didVote && (
{showResults && (
<>
<div className="flex">
<FormattedNumber value={weight * 100} maximumFractionDigits={0} />% &nbsp;