tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
add toggle to see results for creator
awarm.space
4 months ago
04540950
13198ba7
+21
-7
1 changed file
expand all
collapse all
unified
split
app
lish
[did]
[publication]
[rkey]
PublishedPollBlock.tsx
+21
-7
app/lish/[did]/[publication]/[rkey]/PublishedPollBlock.tsx
···
71
71
(v) => v.voter_did === identity?.atp_did,
72
72
) ||
73
73
!!optimisticVote);
74
74
+
let isCreator =
75
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
85
-
<PollResults
86
86
-
pollData={props.pollData}
87
87
-
hasVoted={hasVoted}
88
88
-
setShowResults={setShowResults}
89
89
-
optimisticVote={optimisticVote}
90
90
-
/>
87
87
+
<>
88
88
+
<PollResults
89
89
+
pollData={props.pollData}
90
90
+
hasVoted={hasVoted}
91
91
+
setShowResults={setShowResults}
92
92
+
optimisticVote={optimisticVote}
93
93
+
/>
94
94
+
{isCreator && !hasVoted && (
95
95
+
<div className="flex justify-start">
96
96
+
<button
97
97
+
className="w-fit flex gap-2 items-center justify-start text-sm text-accent-contrast"
98
98
+
onClick={() => setShowResults(false)}
99
99
+
>
100
100
+
Back to Voting
101
101
+
</button>
102
102
+
</div>
103
103
+
)}
104
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
105
-
{identity?.atp_did && (
119
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)}