Skip to content

Commit

Permalink
feat: hidden poll when no profile applied
Browse files Browse the repository at this point in the history
  • Loading branch information
dudu0506 committed Jul 9, 2024
1 parent 0b73fc9 commit 743f326
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/PollCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function PollCard({ poll, theme, locale, profileId }: PollCardProps) {
}}
>
{choice_detail.map((choice, index) =>
is_end || choice_detail.some((choice) => choice.is_select) ? (
(!!profileId && is_end) || choice_detail.some((choice) => choice.is_select) ? (
<VoteResult key={index} choice={choice} theme={themeConfig} />
) : (
<VoteButton key={index} theme={themeConfig} text={`${indexToLetter(index)}. ${choice.name}`} />
Expand All @@ -154,7 +154,7 @@ export function PollCard({ poll, theme, locale, profileId }: PollCardProps) {
}}
>
<span>
{profileId || is_end ? (
{profileId ? (
<span>
{t`${vote_count} vote${vote_count !== 1 ? 's' : ''}`} · {getPollTimeLeft(poll, locale)}
</span>
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/getPollFrameButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export const getPollFrameButtons = ({ poll, queryData }: Parameters) => {
</Button>
);

if (poll.is_end) {
return [getFireflyLinkButton()];
}

if (!queryData.profileId) {
return [getCheckButton(t`Vote Now`), getFireflyLinkButton()];
}

if (poll.is_end) {
return [getFireflyLinkButton()];
}

if (votedList.length >= maxVoteCount) {
return [getCheckButton(t`Refresh`), getFireflyLinkButton()];
}
Expand Down

0 comments on commit 743f326

Please sign in to comment.