a tool for shared writing and social publishing

add toggle to see results for creator

+21 -7
+21 -7
app/lish/[did]/[publication]/[rkey]/PublishedPollBlock.tsx
··· 71 71 (v) => v.voter_did === identity?.atp_did, 72 72 ) || 73 73 !!optimisticVote); 74 + let isCreator = 75 + identity?.atp_did && props.pollData.uri.includes(identity?.atp_did); 74 76 const displayResults = showResults || hasVoted; 75 77 76 78 return ( ··· 82 84 }} 83 85 > 84 86 {displayResults ? ( 85 - <PollResults 86 - pollData={props.pollData} 87 - hasVoted={hasVoted} 88 - setShowResults={setShowResults} 89 - optimisticVote={optimisticVote} 90 - /> 87 + <> 88 + <PollResults 89 + pollData={props.pollData} 90 + hasVoted={hasVoted} 91 + setShowResults={setShowResults} 92 + optimisticVote={optimisticVote} 93 + /> 94 + {isCreator && !hasVoted && ( 95 + <div className="flex justify-start"> 96 + <button 97 + className="w-fit flex gap-2 items-center justify-start text-sm text-accent-contrast" 98 + onClick={() => setShowResults(false)} 99 + > 100 + Back to Voting 101 + </button> 102 + </div> 103 + )} 104 + </> 91 105 ) : ( 92 106 <> 93 107 {pollRecord.options.map((option, index) => ( ··· 102 116 ))} 103 117 <div className="flex justify-between items-center"> 104 118 <div className="flex justify-end gap-2"> 105 - {identity?.atp_did && ( 119 + {isCreator && ( 106 120 <button 107 121 className="w-fit flex gap-2 items-center justify-start text-sm text-accent-contrast" 108 122 onClick={() => setShowResults(!showResults)}