From 20d0d60f89017b44e921fb8d5d7d0bece16eea7e Mon Sep 17 00:00:00 2001
From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com>
Date: Tue, 3 Aug 2021 01:17:50 +0300
Subject: [PATCH] Closes #619 badge container new style
---
components/u/BadgeContainer.tsx | 131 +++++++++++++++------------
components/u/Badges.tsx | 26 ++----
components/u/ProfileOwnersButton.tsx | 16 ++--
pages/faq.tsx | 1 +
4 files changed, 92 insertions(+), 82 deletions(-)
diff --git a/components/u/BadgeContainer.tsx b/components/u/BadgeContainer.tsx
index 065a38f3e..9b9b096e4 100644
--- a/components/u/BadgeContainer.tsx
+++ b/components/u/BadgeContainer.tsx
@@ -1,14 +1,14 @@
import { Image as ChakraImage } from "@chakra-ui/image";
-import { Flex, Text } from "@chakra-ui/react";
+import { Box, Flex, Text } from "@chakra-ui/react";
+import { useState } from "react";
import { CSSVariables } from "utils/CSSVariables";
-import { Fragment } from "react";
const BadgeContainer = ({
showInfo,
showBadges,
badges,
}: {
- showInfo: boolean;
+ showInfo?: boolean;
showBadges: boolean;
badges: {
src: string;
@@ -16,62 +16,81 @@ const BadgeContainer = ({
count: number;
}[];
}) => {
+ const [badgeInfoShown, setBadgeInfoShown] = useState("");
return (
-
- {showBadges &&
- badges.flatMap((badge, i) => {
- const isLast = i === badges.length - 1;
- if (showInfo)
- return (
-
-
- {" "}
- {badge.description}
+ <>
+
+ {showBadges &&
+ badges.flatMap((badge) => {
+ if (showInfo)
+ return (
+
+
+
+ {" "}
+
+ {badge.description}
+
-
- );
- return (
-
-
- setBadgeInfoShown(`${badge.description}`)}
+ onClick={() => setBadgeInfoShown(`${badge.description}`)}
>
- {`x${badge.count}`}
-
-
- );
- })}
-
+
+
+ {`x${badge.count}`}
+
+
+ );
+ })}
+
+
+ {badgeInfoShown || "Placeholder"}
+
+ >
);
};
diff --git a/components/u/Badges.tsx b/components/u/Badges.tsx
index b1317327c..2995ccd60 100644
--- a/components/u/Badges.tsx
+++ b/components/u/Badges.tsx
@@ -1,4 +1,3 @@
-import { Button } from "@chakra-ui/button";
import { useEffect, useMemo, useState } from "react";
import { wonITZCount } from "utils/constants";
import BadgeContainer from "./BadgeContainer";
@@ -227,14 +226,15 @@ const Badges = ({
patreonTier,
peakXP,
presentationMode = false,
+ showInfo,
}: {
userId: number;
userDiscordId: string;
patreonTier: number | null;
peakXP?: number;
presentationMode?: boolean;
+ showInfo?: boolean;
}) => {
- const [showInfo, setShowInfo] = useState(false);
const [imgsLoaded, setImgsLoaded] = useState(false);
const badges = useMemo(
@@ -267,23 +267,11 @@ const Badges = ({
if (badges.length === 0) return null;
return (
- <>
-
-
- >
+
);
};
diff --git a/components/u/ProfileOwnersButton.tsx b/components/u/ProfileOwnersButton.tsx
index bbf6c883f..dca748289 100644
--- a/components/u/ProfileOwnersButton.tsx
+++ b/components/u/ProfileOwnersButton.tsx
@@ -52,13 +52,15 @@ const ProfileOwnersButtons = ({
) : null}
-
- Editing profile colors is available for{" "}
-
- patrons
- {" "}
- of tier "Supporter" ($5 dollar tier)
-
+ {!isColorEditorsButtonClickable ? (
+
+ Editing profile colors is available for{" "}
+
+ patrons
+ {" "}
+ of tier "Supporter" ($5 dollar tier)
+
+ ) : null}
>
);
};
diff --git a/pages/faq.tsx b/pages/faq.tsx
index 4dfe56e0b..cd736c790 100644
--- a/pages/faq.tsx
+++ b/pages/faq.tsx
@@ -47,6 +47,7 @@ const questionsAndAnswers = [
userDiscordId="-1"
patreonTier={-1}
presentationMode
+ showInfo
/>
>
),