Skip to content

Commit

Permalink
Merge pull request #221 from DAOmasons/voteDisplay
Browse files Browse the repository at this point in the history
range peeking to voting time only, change copy
  • Loading branch information
jordanlesich authored Jun 16, 2024
2 parents d16c340 + b60d5e6 commit b989488
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
12 changes: 9 additions & 3 deletions src/components/voting/VoteResultsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ export const VoteResultsPanel = ({
const theme = useMantineTheme();

const consolidated = useMemo(() => {
if (!ships || !userVotes || !contest) return [];
if (!ships || !contest) return [];

return ships.map((ship) => {
const shipChoice = contest?.choices.find((c) => c.shipId === ship.id);

const userVote = userVotes.find((v) => v.choice_id === shipChoice?.id);
const userVote = userVotes
? userVotes.find((v) => v.choice_id === shipChoice?.id)
: null;

return { ...ship, vote: userVote, choice: shipChoice };
});
Expand Down Expand Up @@ -100,7 +102,11 @@ export const VoteResultsPanel = ({
<PageTitle title="Vote" />
)}
<Text fz={32} fw={600} mt="xl">
{hasUserVoted ? 'Your vote has been submitted!' : 'Voting is Complete!'}
{hasUserVoted
? 'Your vote has been submitted!'
: isPeeking
? 'Voting Results so far'
: 'Voting is Complete!'}
</Text>
<Flex w="100%" justify="space-between" wrap="wrap" mt={40}>
{hasUserVoted && (
Expand Down
2 changes: 1 addition & 1 deletion src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const ADDR_TESTNET: Record<string, Address> = {
GM_FACTORY: '0x14e32E7893D6A1fA5f852d8B2fE8c57A2aB670ba',
GS_FACTORY: '0x8D994BEef251e30C858e44eCE3670feb998CA77a',
HATS_POSTER: '0x4F0dc1C7d91d914d921F3C9C188F4454AE260317',
VOTE_CONTEST: '0x3d06D95026696826B507D25cfBb86E4457F34eC5',
VOTE_CONTEST: '0xB60D9C91aBcA9d32a2a543BDFF958Db2d7DFb816',
} as const;

export const ADDR_PROD: Record<string, Address> = {
Expand Down
24 changes: 14 additions & 10 deletions src/pages/Vote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ const VotingOpen = ({
validateInputOnBlur: true,
});

const { votingStage } = useVoting();

const [step, setStep] = useState(0);
const [modalOpen, setModalOpen] = useState(false);

Expand Down Expand Up @@ -205,16 +207,18 @@ const VotingOpen = ({

<PageTitle title="Vote" />
<Group pos="absolute" top={0} right={0} gap={'sm'}>
<Tooltip label="See Results">
<ActionIcon
variant="light"
h={36}
w={36}
onClick={() => setSeeResults(true)}
>
<IconEye size={20} />
</ActionIcon>
</Tooltip>
{votingStage === VotingStage.Active && (
<Tooltip label="See Results">
<ActionIcon
variant="light"
h={36}
w={36}
onClick={() => setSeeResults(true)}
>
<IconEye size={20} />
</ActionIcon>
</Tooltip>
)}
<Button
variant="light"
rightSection={<IconExclamationCircle size={20} />}
Expand Down

0 comments on commit b989488

Please sign in to comment.