Skip to content

Commit

Permalink
Merge branch 'nova_os_revival' of github.com:Aut-Protocol/aut-dashboa…
Browse files Browse the repository at this point in the history
…rd into nova_os_revival
  • Loading branch information
mrtmeeseeks committed Oct 28, 2024
2 parents 10fa664 + f798dc8 commit 4b3eecf
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<AutIDProperties>[] }) => {
const dispatch = useDispatch();
const autIDData = useSelector(AutIDData);
Expand All @@ -145,6 +159,16 @@ const Dashboard = ({ members }: { members: HubOSAutID<AutIDProperties>[] }) => {
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(
Expand Down Expand Up @@ -225,7 +249,7 @@ const Dashboard = ({ members }: { members: HubOSAutID<AutIDProperties>[] }) => {
width: "unset",
height: "100%",
borderRadius: "0",
background: "transparent",
background: "transparent"
}}
aria-label="avatar"
src={ipfsCIDToHttpUrl(hubData?.image as string)}
Expand Down Expand Up @@ -347,10 +371,10 @@ const Dashboard = ({ members }: { members: HubOSAutID<AutIDProperties>[] }) => {
variant="subtitle1"
sx={{
mb: "0px",
color: "#FFF"
color: getScoreColor(prestige)
}}
>
{/* {hub?.properties.prestige} */}
{prestige}
</Typography>
<Typography
fontWeight="bold"
Expand Down Expand Up @@ -623,7 +647,7 @@ const Dashboard = ({ members }: { members: HubOSAutID<AutIDProperties>[] }) => {
color: "#FFF"
}}
>
#1
{`#${period}`}
</Typography>
<Typography
fontWeight="bold"
Expand Down

0 comments on commit 4b3eecf

Please sign in to comment.