+
+
+
- )}
-
-
-
-
-
-
-
-
-
-
-
-
- Server
-
-
-
- {params.server}
-
-
-
-
-
-
-
-
-
);
diff --git a/src/components/Chart.tsx b/src/components/Chart.tsx
new file mode 100644
index 0000000..abffcbd
--- /dev/null
+++ b/src/components/Chart.tsx
@@ -0,0 +1,104 @@
+"use client";
+import { TrendingUp } from "lucide-react";
+import { CartesianGrid, Line, LineChart, XAxis, YAxis } from "recharts";
+
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
+import {
+ ChartConfig,
+ ChartContainer,
+ ChartTooltip,
+ ChartTooltipContent,
+} from "@/components/ui/chart";
+import { useState } from "react";
+import { useEffectOnce } from "@/lib/useEffectOnce";
+
+const chartConfig = {
+ player_count: {
+ label: "Player Count ",
+ color: "hsl(var(--chart-1))",
+ },
+ favorites: {
+ label: "Favorites",
+ color: "hsl(var(--chart-2))",
+ },
+} satisfies ChartConfig;
+
+export function ChartComponent({
+ chart,
+ server,
+}: {
+ chart: string;
+ server: string;
+}) {
+ const [data, setData] = useState([]);
+
+ useEffectOnce(() => {
+ fetch("/api/history/getShortTermData", {
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ scopes: ["player_count", "favorites", "time"],
+ server: server,
+ }),
+ method: "POST",
+ }).then((c) =>
+ c.json().then((b) => {
+ setData(b.data.slice(-30));
+ })
+ );
+ });
+
+ return (
+
+
+
+ {chart == "player_count" ? "Joins" : "Favorites"} for {server}
+
+ Information from the last day
+
+
+
+
+
+ {
+ const date = new Date(value);
+ return date.toLocaleTimeString("en-US", {
+ timeStyle: "short",
+ });
+ }}
+ />
+ } />
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/components/FavoritesView.tsx b/src/components/FavoritesView.tsx
index 8e14535..e948399 100644
--- a/src/components/FavoritesView.tsx
+++ b/src/components/FavoritesView.tsx
@@ -5,7 +5,7 @@ import { Card, CardHeader, CardTitle } from "./ui/card";
import { ServerResponse } from "./ServerView";
import { useEffectOnce } from "@/lib/useEffectOnce";
import { Button } from "./ui/button";
-import { Copy, Layers } from "lucide-react";
+import { Copy, Layers, X, XIcon } from "lucide-react";
import toast from "react-hot-toast";
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
@@ -31,6 +31,7 @@ export default function FavoritesView() {
}),
);
});
+ if (d.result.length == 0) setLoading(false);
});
});
});
@@ -46,6 +47,12 @@ export default function FavoritesView() {
return (
<>
+ {apiFavorites.length == 0 && (
+
+
+ Your favorites are empty. Maybe favorite a server!
+
+ )}
{apiFavorites.map((server: ServerResponse) => (
diff --git a/src/components/HistoricalView.tsx b/src/components/HistoricalView.tsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/components/ServerList.tsx b/src/components/ServerList.tsx
index 0df6315..b192118 100644
--- a/src/components/ServerList.tsx
+++ b/src/components/ServerList.tsx
@@ -629,14 +629,14 @@ export default function ServerList() {
- {randomData.name}.minehut.gg{" "}
+ {randomData.name}.mshf.minehut.gg{" "}