From d895542abbb70321822a4cc3e9b6bf094a34052b Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:24:08 +0200 Subject: [PATCH] don't show sugg button front if voting has started --- app/plus/components/PlusHomePage.tsx | 25 ++++++++++++++++--------- app/plus/components/Suggestion.tsx | 3 ++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/plus/components/PlusHomePage.tsx b/app/plus/components/PlusHomePage.tsx index c303ffa05..0b897346c 100644 --- a/app/plus/components/PlusHomePage.tsx +++ b/app/plus/components/PlusHomePage.tsx @@ -12,6 +12,7 @@ import MyHead from "components/common/MyHead"; import SubText from "components/common/SubText"; import { useUser } from "hooks/common"; import { Fragment } from "react"; +import { getVotingRange } from "utils/plus"; import { getFullUsername } from "utils/strings"; import Suggestion from "./Suggestion"; import SuggestionModal from "./SuggestionModal"; @@ -35,16 +36,22 @@ const PlusHomePage = () => { - {plusStatusData && plusStatusData.membershipTier && !ownSuggestion && ( - + {!getVotingRange().isHappening && ( + <> + {plusStatusData && + plusStatusData.membershipTier && + !ownSuggestion && ( + + )} + {plusStatusData && + plusStatusData.canVouchFor && + !plusStatusData.canVouchAgainAfter && ( + + )} + )} - {plusStatusData && - plusStatusData.canVouchFor && - !plusStatusData.canVouchAgainAfter && ( - - )} {plusStatusData && (plusStatusData.canVouchAgainAfter || plusStatusData.voucher || diff --git a/app/plus/components/Suggestion.tsx b/app/plus/components/Suggestion.tsx index 315bf878f..cf817cb6b 100644 --- a/app/plus/components/Suggestion.tsx +++ b/app/plus/components/Suggestion.tsx @@ -18,6 +18,7 @@ import { useMyTheme } from "hooks/common"; import { useState } from "react"; import { useForm } from "react-hook-form"; import { getToastOptions } from "utils/getToastOptions"; +import { getVotingRange } from "utils/plus"; import { getFullUsername } from "utils/strings"; import { trpc } from "utils/trpc"; import { Unpacked } from "utils/types"; @@ -95,7 +96,7 @@ const Suggestion = ({ ); })} - {canSuggest && !showTextarea && ( + {canSuggest && !showTextarea && !getVotingRange().isHappening && (