From 40394edd871c6238a1b6ff1ccfb57741a5635ba1 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 24 Jun 2022 15:07:50 +0300 Subject: [PATCH] Add deleting suggestion of themselves for members --- app/routes/plus/suggestions.tsx | 137 +++++++++++++++++--------------- 1 file changed, 72 insertions(+), 65 deletions(-) diff --git a/app/routes/plus/suggestions.tsx b/app/routes/plus/suggestions.tsx index 00bd658f6..f9794951e 100644 --- a/app/routes/plus/suggestions.tsx +++ b/app/routes/plus/suggestions.tsx @@ -153,67 +153,70 @@ export default function PlusSuggestionsPage() { <>
-
-
-
- {Object.entries(data.suggestions) - .sort((a, b) => Number(a[0]) - Number(b[0])) - .map(([tier, suggestions]) => { - const id = String(tier); - return ( -
- - setTierVisible(tier)} - data-cy={`plus${tier}-radio`} - /> -
- ); - })} -
- {canSuggestNewUserFE({ user, suggestions: data.suggestions }) ? ( - // TODO: resetScroll={false} https://twitter.com/ryanflorence/status/1527775882797907969 - - Suggest - - ) : null} -
+
+
- {visibleSuggestions.map((u) => { - invariant(tierVisible); - return ( - - ); - })} - {visibleSuggestions.length === 0 ? ( -
- No suggestions yet +
+
+ {Object.entries(data.suggestions) + .sort((a, b) => Number(a[0]) - Number(b[0])) + .map(([tier, suggestions]) => { + const id = String(tier); + return ( +
+ + setTierVisible(tier)} + data-cy={`plus${tier}-radio`} + /> +
+ ); + })}
- ) : null} + {canSuggestNewUserFE({ user, suggestions: data.suggestions }) ? ( + // TODO: resetScroll={false} https://twitter.com/ryanflorence/status/1527775882797907969 + + Suggest + + ) : null} +
+
+ {visibleSuggestions.map((u) => { + invariant(tierVisible); + return ( + + ); + })} + {visibleSuggestions.length === 0 ? ( +
+ No suggestions yet +
+ ) : null} +
@@ -243,7 +246,7 @@ function useSetSelectedTierForFirstSuggestEffect({ }, [data, tierVisible, setTierVisible]); } -function SuggestedForInfo() { +function SuggestedForInfo({ hideText = false }: { hideText?: boolean }) { const data = useLoaderData(); const user = useUser(); @@ -253,6 +256,8 @@ function SuggestedForInfo() { } if (data.suggestedForTiers.length === 0) { + if (hideText) return null; + return (
You are not suggested yet this month. @@ -262,11 +267,13 @@ function SuggestedForInfo() { return (
-
- You are suggested to{" "} - {data.suggestedForTiers.map((tier) => `+${tier}`).join(" and ")} this - month. -
+ {!hideText ? ( +
+ You are suggested to{" "} + {data.suggestedForTiers.map((tier) => `+${tier}`).join(" and ")} this + month. +
+ ) : null} {canDeleteSuggestionOfThemselves() ? (
{data.suggestedForTiers.map((tier) => (