From f798dc8b1b782e46889932c0fe788c6d89e8085f Mon Sep 17 00:00:00 2001 From: eulaliee <52575560+eulaliee@users.noreply.github.com> Date: Mon, 21 Oct 2024 21:19:49 +0300 Subject: [PATCH] added values for periods and prestige --- src/pages/Dashboard/Dashboard.tsx | 32 +++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/pages/Dashboard/Dashboard.tsx b/src/pages/Dashboard/Dashboard.tsx index 4a08ee3..d5f54d1 100644 --- a/src/pages/Dashboard/Dashboard.tsx +++ b/src/pages/Dashboard/Dashboard.tsx @@ -125,6 +125,20 @@ const calculateFontSize = (name: string) => { } }; +function getScoreColor(prestige: number): string { + if (prestige <= 75) { + return "#BF1A2F"; // Red - Really Bad + } else if (prestige <= 99) { + return "#88498F"; // Purple - Bad + } else if (prestige <= 120) { + return "#2E90FA"; // Blue - OK + } else if (prestige <= 149) { + return "#20A4B2"; // Blue-Green - Good + } else { + return "#12B76A"; // Green - Excellent + } +} + const Dashboard = ({ members }: { members: HubOSAutID[] }) => { const dispatch = useDispatch(); const autIDData = useSelector(AutIDData); @@ -145,6 +159,16 @@ const Dashboard = ({ members }: { members: HubOSAutID[] }) => { return states[hubData.properties.archetype.default]; }, [hubData]); + const prestige = useMemo(() => { + return (hubData?.properties as any)?.prestige ?? 100; + }, [hubData]); + + const period = useMemo(() => { + return (hubData?.properties as any)?.period ?? 1; + }, [hubData]); + + + useEffect(() => { dispatch( setTitle( @@ -225,7 +249,7 @@ const Dashboard = ({ members }: { members: HubOSAutID[] }) => { width: "unset", height: "100%", borderRadius: "0", - background: "transparent", + background: "transparent" }} aria-label="avatar" src={ipfsCIDToHttpUrl(hubData?.image as string)} @@ -347,10 +371,10 @@ const Dashboard = ({ members }: { members: HubOSAutID[] }) => { variant="subtitle1" sx={{ mb: "0px", - color: "#FFF" + color: getScoreColor(prestige) }} > - {/* {hub?.properties.prestige} */} + {prestige} [] }) => { color: "#FFF" }} > - #1 + {`#${period}`}