mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 16:54:59 -05:00
fix: making github icon theme dependent & removing sorting in favor of leaderboards
This commit is contained in:
parent
67198b4ac0
commit
07ec6cb89b
175
cron/package-lock.json
generated
175
cron/package-lock.json
generated
@ -1,175 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "cron",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "cron",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"chalk": "^5.3.0",
|
|
||||||
"dotenv": "^16.4.5",
|
|
||||||
"mongodb": "^6.8.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@mongodb-js/saslprep": {
|
|
||||||
"version": "1.1.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.8.tgz",
|
|
||||||
"integrity": "sha512-qKwC/M/nNNaKUBMQ0nuzm47b7ZYWQHN3pcXq4IIcoSBc2hOIrflAxJduIvvqmhoz3gR2TacTAs8vlsCVPkiEdQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"sparse-bitfield": "^3.0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/webidl-conversions": {
|
|
||||||
"version": "7.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
|
|
||||||
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="
|
|
||||||
},
|
|
||||||
"node_modules/@types/whatwg-url": {
|
|
||||||
"version": "11.0.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz",
|
|
||||||
"integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/webidl-conversions": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/bson": {
|
|
||||||
"version": "6.8.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/bson/-/bson-6.8.0.tgz",
|
|
||||||
"integrity": "sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.20.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/chalk": {
|
|
||||||
"version": "5.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz",
|
|
||||||
"integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==",
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/dotenv": {
|
|
||||||
"version": "16.4.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
|
|
||||||
"integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://dotenvx.com"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/memory-pager": {
|
|
||||||
"version": "1.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
|
||||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="
|
|
||||||
},
|
|
||||||
"node_modules/mongodb": {
|
|
||||||
"version": "6.8.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.8.0.tgz",
|
|
||||||
"integrity": "sha512-HGQ9NWDle5WvwMnrvUxsFYPd3JEbqD3RgABHBQRuoCEND0qzhsd0iH5ypHsf1eJ+sXmvmyKpP+FLOKY8Il7jMw==",
|
|
||||||
"dependencies": {
|
|
||||||
"@mongodb-js/saslprep": "^1.1.5",
|
|
||||||
"bson": "^6.7.0",
|
|
||||||
"mongodb-connection-string-url": "^3.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.20.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@aws-sdk/credential-providers": "^3.188.0",
|
|
||||||
"@mongodb-js/zstd": "^1.1.0",
|
|
||||||
"gcp-metadata": "^5.2.0",
|
|
||||||
"kerberos": "^2.0.1",
|
|
||||||
"mongodb-client-encryption": ">=6.0.0 <7",
|
|
||||||
"snappy": "^7.2.2",
|
|
||||||
"socks": "^2.7.1"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@aws-sdk/credential-providers": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"@mongodb-js/zstd": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"gcp-metadata": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"kerberos": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"mongodb-client-encryption": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"snappy": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"socks": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mongodb-connection-string-url": {
|
|
||||||
"version": "3.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz",
|
|
||||||
"integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg==",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/whatwg-url": "^11.0.2",
|
|
||||||
"whatwg-url": "^13.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/punycode": {
|
|
||||||
"version": "2.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
|
||||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/sparse-bitfield": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"memory-pager": "^1.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tr46": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
|
|
||||||
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
|
|
||||||
"dependencies": {
|
|
||||||
"punycode": "^2.3.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/webidl-conversions": {
|
|
||||||
"version": "7.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
|
||||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/whatwg-url": {
|
|
||||||
"version": "13.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
|
|
||||||
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==",
|
|
||||||
"dependencies": {
|
|
||||||
"tr46": "^4.1.1",
|
|
||||||
"webidl-conversions": "^7.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
import FavoriteSortView from "@/components/FavoritesSortView";
|
|
||||||
import type { Metadata } from "next";
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
|
||||||
title: "Favorites Sort | MHSF",
|
|
||||||
description: "See all of the servers on Minehut in order of favorites.",
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function FavoritesSort() {
|
|
||||||
return (
|
|
||||||
<main>
|
|
||||||
<div className="pt-[60px] p-4">
|
|
||||||
<FavoriteSortView />
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -522,15 +522,6 @@ export function CommandBar() {
|
|||||||
+Shift+K
|
+Shift+K
|
||||||
</CommandShortcut>
|
</CommandShortcut>
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
<CommandItem
|
|
||||||
onSelect={() => {
|
|
||||||
events.emit("cmd-event-sort");
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ArrowDown01 className="mr-2 h-4 w-4" />
|
|
||||||
Sort Servers
|
|
||||||
</CommandItem>
|
|
||||||
<CommandItem
|
<CommandItem
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
@ -688,49 +679,6 @@ export function RandomServerDialog() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SubSortCommandBar() {
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
useEffectOnce(() => {
|
|
||||||
events.on("cmd-event-sort", () => {
|
|
||||||
setOpen(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<CommandDialog open={open} onOpenChange={setOpen}>
|
|
||||||
<CommandInput placeholder="Type a command or search..." />
|
|
||||||
<CommandList>
|
|
||||||
<CommandEmpty>No results found.</CommandEmpty>
|
|
||||||
|
|
||||||
<CommandGroup heading="Sorts">
|
|
||||||
<CommandItem
|
|
||||||
onSelect={() => {
|
|
||||||
router.push("/sort/favorites");
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Star className="mr-2 h-4 w-4" />
|
|
||||||
<span>Favorites</span>
|
|
||||||
</CommandItem>
|
|
||||||
</CommandGroup>
|
|
||||||
<CommandGroup heading="Hierarchy">
|
|
||||||
<CommandItem
|
|
||||||
onSelect={() => {
|
|
||||||
setOpen(false);
|
|
||||||
events.emit("cmd-event");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ArrowLeft className="mr-2 h-4 w-4" />
|
|
||||||
Go back
|
|
||||||
</CommandItem>
|
|
||||||
</CommandGroup>
|
|
||||||
</CommandList>
|
|
||||||
</CommandDialog>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function SubLinkCommandBar() {
|
export function SubLinkCommandBar() {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme();
|
||||||
@ -862,7 +810,6 @@ export function CommandBarer() {
|
|||||||
<CommandBar />
|
<CommandBar />
|
||||||
<SearchCommandBar />
|
<SearchCommandBar />
|
||||||
<ServerCommandBar />
|
<ServerCommandBar />
|
||||||
<SubSortCommandBar />
|
|
||||||
<OfflineServerCB />
|
<OfflineServerCB />
|
||||||
<RandomServerDialog />
|
<RandomServerDialog />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -1,292 +0,0 @@
|
|||||||
"use client";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { Spinner } from "./ui/spinner";
|
|
||||||
import { sortedFavorites } from "@/lib/api";
|
|
||||||
import InfiniteScroll from "react-infinite-scroll-component";
|
|
||||||
import { Button } from "./ui/button";
|
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
||||||
import { RadioGroup, RadioGroupItem } from "./ui/radio-group";
|
|
||||||
import { Label } from "./ui/label";
|
|
||||||
import { useRouter } from "@/lib/useRouter";
|
|
||||||
import { OnlineServer } from "@/lib/types/mh-server";
|
|
||||||
import ServerCard from "./ServerCard";
|
|
||||||
import { CircleUser, Copy, Info, Layers, Network } from "lucide-react";
|
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
||||||
import { BorderBeam } from "./effects/border-beam";
|
|
||||||
import Stat from "./Stat";
|
|
||||||
import { Separator } from "./ui/separator";
|
|
||||||
import { Card, CardDescription, CardHeader, CardTitle } from "./ui/card";
|
|
||||||
import Link from "next/link";
|
|
||||||
import toast from "react-hot-toast";
|
|
||||||
import { Skeleton } from "./ui/skeleton";
|
|
||||||
import FadeIn from "react-fade-in/lib/FadeIn";
|
|
||||||
|
|
||||||
export default function FavoriteSortView() {
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
const [list, setList] = useState<{ server: string; favorites: number }[]>([]);
|
|
||||||
const [allItems, setAllItems] = useState<
|
|
||||||
Array<{ server: string; favorites: number }>
|
|
||||||
>([]);
|
|
||||||
const [upNumber, setUpNumber] = useState(0);
|
|
||||||
const [hasMore, setHasMore] = useState(true);
|
|
||||||
const [totalServers, setTotalServers] = useState(0);
|
|
||||||
const [totalPlayers, setTotalPlayers] = useState(0);
|
|
||||||
const [online, setOnline] = useState<any>({});
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
sortedFavorites().then((c) => {
|
|
||||||
if (typeof c !== "boolean") {
|
|
||||||
const slicedArray = c.slice(0, 20);
|
|
||||||
setAllItems(slicedArray);
|
|
||||||
setList(c);
|
|
||||||
fetch("https://api.minehut.com/servers").then((b) =>
|
|
||||||
b.json().then((c) => {
|
|
||||||
c.servers.forEach((v: OnlineServer) =>
|
|
||||||
setOnline(setManipulate(online, v.name, v))
|
|
||||||
);
|
|
||||||
setLoading(false);
|
|
||||||
setTotalPlayers(c.total_players);
|
|
||||||
setTotalServers(c.total_servers);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(list);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="grid grid-cols-2 gap-4">
|
|
||||||
<Skeleton className="h-[112px] rounded-xl" />
|
|
||||||
<Skeleton className="h-[112px] rounded-xl" />
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<Separator />
|
|
||||||
<br />
|
|
||||||
<div className="grid grid-cols-4 gap-4">
|
|
||||||
<Skeleton className="h-[450px] rounded-xl" />
|
|
||||||
<Skeleton className="h-[450px] rounded-xl" />
|
|
||||||
<Skeleton className="h-[450px] rounded-xl" />
|
|
||||||
<Skeleton className="h-[450px] rounded-xl" />
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<div className="max-lg:grid-cols-2 grid grid-cols-2 gap-4 ">
|
|
||||||
<Stat
|
|
||||||
title="Players online"
|
|
||||||
desc={totalPlayers.toString()}
|
|
||||||
icon={CircleUser}
|
|
||||||
/>
|
|
||||||
<Stat
|
|
||||||
title={
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
totalServers >= 3200
|
|
||||||
? "bg-clip-text text-transparent bg-gradient-to-r from-cyan-500 to-blue-500"
|
|
||||||
: ""
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Servers online{" "}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
className="relative z-0"
|
|
||||||
desc={
|
|
||||||
<div className="flex items-center">
|
|
||||||
<div
|
|
||||||
className={
|
|
||||||
totalServers >= 3200
|
|
||||||
? "bg-clip-text text-transparent bg-gradient-to-r from-cyan-500 to-blue-500 "
|
|
||||||
: ""
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{totalServers.toString()}
|
|
||||||
</div>
|
|
||||||
{totalServers >= 3200 && (
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger>
|
|
||||||
<Info size={16} className="ml-2" />
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent className="font-normal">
|
|
||||||
The server amount is over 3.2k, meaning that new servers
|
|
||||||
have to go into a queue before being able to be online.{" "}
|
|
||||||
<br />
|
|
||||||
(the server count isn't entirely accurate, so sometimes you
|
|
||||||
might not go into a queue even when the server count is at
|
|
||||||
3.2k)
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
icon={Network}
|
|
||||||
>
|
|
||||||
{totalServers >= 3200 && (
|
|
||||||
<BorderBeam
|
|
||||||
size={135}
|
|
||||||
duration={12}
|
|
||||||
delay={9}
|
|
||||||
colorFrom="rgb(6 182 212)"
|
|
||||||
colorTo="rgb(59 130 246)"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Stat>
|
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
<Separator />
|
|
||||||
<br />
|
|
||||||
<Popover>
|
|
||||||
<PopoverTrigger>
|
|
||||||
<Button className="ml-2" variant="secondary">
|
|
||||||
Sort
|
|
||||||
</Button>
|
|
||||||
</PopoverTrigger>
|
|
||||||
<PopoverContent>
|
|
||||||
<RadioGroup
|
|
||||||
defaultValue="option-two"
|
|
||||||
onValueChange={() => router.push("/")}
|
|
||||||
>
|
|
||||||
<div className="flex items-center space-x-2">
|
|
||||||
<RadioGroupItem value="option-one" id="option-one" />
|
|
||||||
<Label htmlFor="option-one">Online Players</Label>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center space-x-2">
|
|
||||||
<RadioGroupItem value="option-two" id="option-two" />
|
|
||||||
<Label htmlFor="option-two">Favorites</Label>
|
|
||||||
</div>
|
|
||||||
</RadioGroup>
|
|
||||||
</PopoverContent>
|
|
||||||
</Popover>
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
className="ml-2"
|
|
||||||
onClick={() => {
|
|
||||||
setLoading(true);
|
|
||||||
sortedFavorites().then((c) => {
|
|
||||||
if (typeof c !== "boolean") {
|
|
||||||
const slicedArray = c.slice(0, 20);
|
|
||||||
setAllItems(slicedArray);
|
|
||||||
setList(c);
|
|
||||||
fetch("https://api.minehut.com/servers").then((b) =>
|
|
||||||
b.json().then((c) => {
|
|
||||||
c.servers.forEach((v: OnlineServer) =>
|
|
||||||
setOnline(setManipulate(online, v.name, v))
|
|
||||||
);
|
|
||||||
setLoading(false);
|
|
||||||
setTotalPlayers(c.total_players);
|
|
||||||
setTotalServers(c.total_servers);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(list);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Refresh
|
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<InfiniteScroll
|
|
||||||
dataLength={list.length}
|
|
||||||
hasMore={hasMore}
|
|
||||||
next={() => {
|
|
||||||
const newUpNumber = upNumber + 1;
|
|
||||||
const slicedArray = list.slice(
|
|
||||||
newUpNumber * 20,
|
|
||||||
newUpNumber * 20 + 20
|
|
||||||
);
|
|
||||||
console.log(slicedArray.length);
|
|
||||||
|
|
||||||
setAllItems((prev) => [...prev, ...slicedArray]);
|
|
||||||
if (slicedArray.length !== 20) setHasMore(false);
|
|
||||||
setUpNumber(newUpNumber);
|
|
||||||
}}
|
|
||||||
loader={<br />}
|
|
||||||
endMessage={
|
|
||||||
<p style={{ textAlign: "center" }}>
|
|
||||||
<br />
|
|
||||||
<strong>You've seen it all</strong>
|
|
||||||
</p>
|
|
||||||
}
|
|
||||||
style={{ overflow: "hidden", paddingLeft: 6 }}
|
|
||||||
>
|
|
||||||
<FadeIn>
|
|
||||||
<div className="grid sm:grid-cols-4 gap-4">
|
|
||||||
{allItems.map((v) => {
|
|
||||||
if (v.favorites == 0) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (online[v.server] != undefined)
|
|
||||||
return (
|
|
||||||
<ServerCard
|
|
||||||
mini
|
|
||||||
b={online[v.server]}
|
|
||||||
favs={v.favorites}
|
|
||||||
key={v.server}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
else
|
|
||||||
return (
|
|
||||||
<Card className="h-[226px]" key={v.server}>
|
|
||||||
<CardHeader>
|
|
||||||
<CardTitle>{v.server}</CardTitle>
|
|
||||||
<CardDescription>
|
|
||||||
{v.favorites} favorited
|
|
||||||
<br />
|
|
||||||
<Button
|
|
||||||
size="icon"
|
|
||||||
variant="secondary"
|
|
||||||
className="min-w-[128px] max-w-[328px] h-[32px] mt-2 ml-2 max-md:hidden"
|
|
||||||
onClick={() => {
|
|
||||||
navigator.clipboard.writeText(
|
|
||||||
v.server + ".mshf.minehut.gg"
|
|
||||||
);
|
|
||||||
toast.success("Copied IP to clipboard");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Copy size={18} />
|
|
||||||
<code className="ml-2">{v.server}</code>
|
|
||||||
</Button>
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger>
|
|
||||||
<Link href={"/server/" + v.server}>
|
|
||||||
<Button
|
|
||||||
size="icon"
|
|
||||||
variant="secondary"
|
|
||||||
className="w-[32px] h-[32px] mt-2 ml-2 max-md:hidden"
|
|
||||||
>
|
|
||||||
<Layers size={18} />
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent>
|
|
||||||
Open up the server page to see more information
|
|
||||||
about the server
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</CardDescription>
|
|
||||||
</CardHeader>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</FadeIn>
|
|
||||||
</InfiniteScroll>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setManipulate(object: any, change: string, value: any) {
|
|
||||||
let newObject = object;
|
|
||||||
newObject[change] = value;
|
|
||||||
return newObject;
|
|
||||||
}
|
|
||||||
@ -12,7 +12,7 @@ export const formalNames: FormalNames = {
|
|||||||
title:
|
title:
|
||||||
"At one time, <b>this server had the most players on the platform!</b>",
|
"At one time, <b>this server had the most players on the platform!</b>",
|
||||||
description:
|
description:
|
||||||
"This is awarded to servers that had the number 1 permission at the time of the achievements getting resolved.",
|
"This is awarded to servers that had the most players at the time of the achievements getting resolved.",
|
||||||
color: "#9aedff",
|
color: "#9aedff",
|
||||||
icon: Medal,
|
icon: Medal,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -103,7 +103,7 @@ export const Changelog = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<span className="group-hover:underline flex items-center">
|
<span className="group-hover:underline flex items-center">
|
||||||
<Github className="mr-2" /> Star on GitHub
|
<Github className="mr-2" fill={useDepTheme()} /> Star on GitHub
|
||||||
</span>
|
</span>
|
||||||
<Marquee
|
<Marquee
|
||||||
className="hidden group-hover:flex font-normal"
|
className="hidden group-hover:flex font-normal"
|
||||||
@ -371,6 +371,7 @@ import Marquee from "@/components/effects/marquee";
|
|||||||
import { useRouter } from "@/lib/useRouter";
|
import { useRouter } from "@/lib/useRouter";
|
||||||
import { BookIcon } from "lucide-react";
|
import { BookIcon } from "lucide-react";
|
||||||
import A from "@/components/misc/Link";
|
import A from "@/components/misc/Link";
|
||||||
|
import { useDepTheme } from "@/lib/getDependentTheming";
|
||||||
const Discord = (props: SVGProps<SVGSVGElement>) => (
|
const Discord = (props: SVGProps<SVGSVGElement>) => (
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 256 199"
|
viewBox="0 0 256 199"
|
||||||
|
|||||||
7
src/lib/getDependentTheming.ts
Normal file
7
src/lib/getDependentTheming.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { useTheme } from "next-themes";
|
||||||
|
|
||||||
|
export function useDepTheme() {
|
||||||
|
const { resolvedTheme } = useTheme();
|
||||||
|
|
||||||
|
return resolvedTheme === "dark" ? "black" : "white";
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user