From c699c32c9554b66c5422adfad0b9351a321260cd Mon Sep 17 00:00:00 2001 From: dvelo <52332868+DeveloLongScript@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:38:36 -0600 Subject: [PATCH] feat: add new server icons --- src/components/AfterServerView.tsx | 53 +++++++++++++++++++++++++----- src/config/version.tsx | 14 ++++++++ src/lib/types/server-icon.ts | 9 +++++ 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/components/AfterServerView.tsx b/src/components/AfterServerView.tsx index 0b1b7b5..d64f057 100644 --- a/src/components/AfterServerView.tsx +++ b/src/components/AfterServerView.tsx @@ -32,13 +32,19 @@ import { getCommunityServerFavorites, getCustomization } from "@/lib/api"; import { MHSF } from "@/lib/mhsf"; import { ServerResponse } from "@/lib/types/mh-server"; -import { MinehutIcon, getMinehutIcons } from "@/lib/types/server-icon"; +import { + MinehutIcon, + getIndexFromRarity, + getMinehutIcons, + rarityIndex, +} from "@/lib/types/server-icon"; import { Copy, Info } from "lucide-react"; import { useTheme } from "next-themes"; import { useEffect, useState } from "react"; import FadeIn from "react-fade-in/lib/FadeIn"; import toast, { CheckmarkIcon } from "react-hot-toast"; import Markdown from "react-markdown"; +import IconDisplay from "./IconDisplay"; import AchievementList from "./feat/AchievementList"; import { Button } from "./ui/button"; import { @@ -74,13 +80,13 @@ export default function AfterServerView({ server }: { server: string }) { getCommunityServerFavorites(server).then((c) => { mhsf.setFavorites(c); }); - getMinehutIcons().then((i) => { - setIcons(i); - }); } fetch("https://api.minehut.com/server/" + server + "?byName=true").then( (c) => c.json().then((n) => setServerObject(n.server)), ); + getMinehutIcons().then((i) => { + setIcons(i); + }); setLoading(false); }); }, []); @@ -411,16 +417,47 @@ export default function AfterServerView({ server }: { server: string }) { )} {view == "icons" && ( -
Purchased Icons are icons that are under the server's ownership, they may or may not available at that certain moment either.
{serverObject?.purchased_icons.map((icon) => ( -