mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 17:35:00 -05:00
beauty: cleaning up lots of code, cleaning up changelog
This commit is contained in:
parent
88fac002fd
commit
3b869b2e8c
@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://ui.shadcn.com/schema.json",
|
||||
"style": "default",
|
||||
"style": "new-york",
|
||||
"rsc": true,
|
||||
"tsx": true,
|
||||
"tailwind": {
|
||||
@ -14,4 +14,4 @@
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
module.exports = {
|
||||
enable: true,
|
||||
mode: "simplify-seedable", // random | simplify | simplify-seedable
|
||||
refreshClassConversionJson: false, // recommended set to true if not in production
|
||||
allowExtensions: [".jsx", ".tsx", ".js", ".ts", ".html", ".rsc"],
|
||||
};
|
||||
@ -1,4 +1,5 @@
|
||||
import plugin from "@unocss/webpack";
|
||||
import MangleCssClassPlugin from "mangle-css-class-webpack-plugin";
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
images: {
|
||||
@ -9,6 +10,36 @@ const nextConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
webpack: (config, { dev }) => {
|
||||
config.resolve.modules.push(path.resolve("./"));
|
||||
|
||||
if (!dev) {
|
||||
config.plugins.push(
|
||||
new MangleCssClassPlugin({
|
||||
classNameRegExp:
|
||||
"(([a-zA-Z-:]*)[\\\\\\\\]*:)*([\\\\\\\\]*!)?tw-[a-zA-Z-]([a-zA-Z0-9-]*([\\\\\\\\]*(\\%|\\#|\\.|\\[|\\]))*)*",
|
||||
// ignorePrefixRegExp: "((hover|focus|active|disabled|visited|first|last|odd|even|group-hover|focus-within|xs|sm|md||lg|xl)(\\\\\\\\\\\\\\\\|\\\\)?:)*",
|
||||
|
||||
classGenerator: (original, opts, context) => {
|
||||
if (classNames[original]) {
|
||||
return classNames[original];
|
||||
}
|
||||
|
||||
let nextId;
|
||||
|
||||
do {
|
||||
// Class name cannot start with a number.
|
||||
nextId = `cfk-${Math.random()}`;
|
||||
} while (/^[0-9_-]/.test(nextId));
|
||||
|
||||
return (classNames[original] = nextId);
|
||||
},
|
||||
// log: true
|
||||
})
|
||||
);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@ -90,6 +90,7 @@
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.2.3",
|
||||
"jotai": "^2.9.1",
|
||||
"mangle-css-class-webpack-plugin": "^5.1.0",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { OnlineServer, ServerResponse } from "./lib/types/server";
|
||||
import { OnlineServer, ServerResponse } from "./lib/types/mh-server";
|
||||
|
||||
const serverCache: any = {};
|
||||
|
||||
|
||||
@ -1,16 +1,4 @@
|
||||
import { banner } from "@/banner";
|
||||
import TopBar from "@/components/clerk/Topbar";
|
||||
import FavoritesView from "@/components/FavoritesView";
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import { Server } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export default function Favorites() {
|
||||
return (
|
||||
|
||||
@ -1,15 +1,6 @@
|
||||
"use client";
|
||||
import { ShowInfo } from "@/components/misc/InfoClaim";
|
||||
import { TextCopyComp } from "@/components/misc/TextCopyComp";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
InputOTP,
|
||||
InputOTPGroup,
|
||||
InputOTPSeparator,
|
||||
InputOTPSlot,
|
||||
} from "@/components/ui/input-otp";
|
||||
import { useClerk, useUser } from "@clerk/nextjs";
|
||||
import { default as NextLink } from "next/link";
|
||||
import { ExternalLink, KeyRound, Link, UserPen } from "lucide-react";
|
||||
import {
|
||||
ResizableHandle,
|
||||
@ -19,7 +10,6 @@ import {
|
||||
import toast from "react-hot-toast";
|
||||
import { unlinkMCAccount } from "@/lib/api";
|
||||
import { useEffect, useState } from "react";
|
||||
import { link } from "fs";
|
||||
import { Dialog } from "@/components/ui/dialog";
|
||||
import { DialogContent, DialogTrigger } from "@/components/ui/dialog";
|
||||
import CodeDialog from "@/components/misc/LinkDialog";
|
||||
|
||||
@ -1,37 +1,24 @@
|
||||
import type { Metadata } from "next";
|
||||
import { GeistSans } from "geist/font/sans";
|
||||
import { Github, CodeXml, Server, Command } from "lucide-react";
|
||||
import { Server } from "lucide-react";
|
||||
import { SpeedInsights } from "@vercel/speed-insights/next";
|
||||
import { Analytics } from "@vercel/analytics/react";
|
||||
import "./globals.css";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { ThemeProvider } from "@/components/ThemeProvider";
|
||||
import Image from "next/image";
|
||||
import { ClerkThemeProvider } from "@/components/clerk/ClerkThemeProvider";
|
||||
import { useEffectOnce } from "@/lib/useEffectOnce";
|
||||
import NextTopLoader from "@/lib/top-loader";
|
||||
import { banner } from "@/banner";
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import Link from "next/link";
|
||||
import TopBar from "@/components/clerk/Topbar";
|
||||
import TextFromPathname from "@/components/TextFromPathname";
|
||||
import { Inter as interFont } from "next/font/google";
|
||||
import {
|
||||
CommandBar,
|
||||
CommandBarer,
|
||||
SearchCommandBar,
|
||||
SubLinkCommandBar,
|
||||
} from "@/components/CommandBar";
|
||||
import { CommandBarer } from "@/components/CommandBar";
|
||||
|
||||
const inter = interFont({ variable: "--font-inter", subsets: ["latin"] });
|
||||
export default async function RootLayout({
|
||||
|
||||
@ -1,34 +1,10 @@
|
||||
import Image from "next/image";
|
||||
import { GeistSans } from "geist/font/sans";
|
||||
import ServerList from "@/components/ServerList";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ModeToggle as ThemeSwitcher } from "@/components/ThemeSwitcher";
|
||||
import {
|
||||
SignInButton,
|
||||
SignedIn,
|
||||
SignedOut,
|
||||
UserProfile,
|
||||
useUser,
|
||||
useClerk,
|
||||
} from "@clerk/nextjs";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import { X, UserCog, Server } from "lucide-react";
|
||||
import TopBar from "@/components/clerk/Topbar";
|
||||
import { banner } from "@/banner";
|
||||
import { ResolvingMetadata, Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "the MHSF project by dvelo",
|
||||
description: `currently running in ${process.env.NEXT_PUBLIC_VERCEL_ENV} | commit (${process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA}) ${process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE} by ${process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_NAME}`,
|
||||
};
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
|
||||
@ -1,26 +1,4 @@
|
||||
import ServerView from "@/components/ServerView";
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import TopBar from "@/components/clerk/Topbar";
|
||||
import { CornerDownLeft, Server, X } from "lucide-react";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
import { IconDisplayClient } from "@/components/IconDisplay";
|
||||
import { banner } from "@/banner";
|
||||
import Link from "next/link";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import TabServer from "@/components/misc/TabServer";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { Tooltip } from "@/components/ui/tooltip";
|
||||
import ServerCustomize from "@/components/ServerCustomize";
|
||||
import { useColor } from "@/lib/use-color";
|
||||
import CustomizeRoot from "@/components/CustomizeRoot";
|
||||
|
||||
type Props = {
|
||||
|
||||
@ -1,21 +1,6 @@
|
||||
import ServerView from "@/components/ServerView";
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import TopBar from "@/components/clerk/Topbar";
|
||||
import { Server } from "lucide-react";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
import { IconDisplayClient } from "@/components/IconDisplay";
|
||||
import { banner } from "@/banner";
|
||||
import Link from "next/link";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import TabServer from "@/components/misc/TabServer";
|
||||
import { useColor } from "@/lib/use-color";
|
||||
import ColorProvider from "@/components/ColorProvider";
|
||||
import AfterServerView from "@/components/AfterServerView";
|
||||
import Banner from "@/components/Banner";
|
||||
|
||||
@ -1,21 +1,7 @@
|
||||
import ServerView from "@/components/ServerView";
|
||||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
BreadcrumbLink,
|
||||
BreadcrumbList,
|
||||
BreadcrumbPage,
|
||||
BreadcrumbSeparator,
|
||||
} from "@/components/ui/breadcrumb";
|
||||
import TopBar from "@/components/clerk/Topbar";
|
||||
import { Server } from "lucide-react";
|
||||
import type { Metadata, ResolvingMetadata } from "next";
|
||||
import { IconDisplayClient } from "@/components/IconDisplay";
|
||||
import { banner } from "@/banner";
|
||||
import Link from "next/link";
|
||||
import TabServer from "@/components/misc/TabServer";
|
||||
import { NewChart } from "@/components/NewChart";
|
||||
import { useColor } from "@/lib/use-color";
|
||||
import ColorProvider from "@/components/ColorProvider";
|
||||
import Banner from "@/components/Banner";
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import {
|
||||
Command,
|
||||
CommandDialog,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
@ -11,11 +10,10 @@ import {
|
||||
CommandShortcut,
|
||||
} from "@/components/ui/command";
|
||||
import { TagShower } from "./ServerList";
|
||||
import { useEffect, useState } from "react";
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
import { useState } from "react";
|
||||
import { OnlineServer } from "@/lib/types/mh-server";
|
||||
import events from "@/lib/commandEvent";
|
||||
import { useHotkeys } from "react-hotkeys-hook";
|
||||
import Link from "next/link";
|
||||
import {
|
||||
ArrowDown01,
|
||||
ArrowLeft,
|
||||
@ -27,14 +25,16 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useEffectOnce } from "@/lib/useEffectOnce";
|
||||
import { useClerk, useUser } from "@clerk/nextjs";
|
||||
import { useRouter } from '@/lib/useRouter'
|
||||
import { useRouter } from "@/lib/useRouter";
|
||||
import type { SVGProps } from "react";
|
||||
import { getAccountFavorites } from "@/lib/api";
|
||||
|
||||
export function SearchCommandBar() {
|
||||
const [serverList, setServerList] = useState<OnlineServer[]>([]);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [backEnabled, setBackEnabled] = useState(false);
|
||||
const [searchRes, setSearchRes] = useState<any>(undefined);
|
||||
const router = useRouter()
|
||||
const router = useRouter();
|
||||
useHotkeys("mod+shift+k", () => setOpen(true), []);
|
||||
|
||||
useEffectOnce(() => {
|
||||
@ -252,9 +252,6 @@ export function SubLinkCommandBar() {
|
||||
</CommandDialog>
|
||||
);
|
||||
}
|
||||
import * as React from "react";
|
||||
import type { SVGProps } from "react";
|
||||
import { getAccountFavorites } from "@/lib/api";
|
||||
const Github = (props: SVGProps<SVGSVGElement>) => (
|
||||
<svg
|
||||
viewBox="0 0 256 250"
|
||||
@ -274,7 +271,7 @@ export function FavoriteBar() {
|
||||
undefined
|
||||
);
|
||||
const clerk = useClerk();
|
||||
const router = useRouter()
|
||||
const router = useRouter();
|
||||
|
||||
useEffectOnce(() => {
|
||||
events.on("cmd-event-favorites", () => setOpen(true));
|
||||
@ -297,7 +294,7 @@ export function FavoriteBar() {
|
||||
Go back
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
|
||||
|
||||
<CommandGroup heading="Favorites">
|
||||
{favorites == undefined && (
|
||||
<CommandItem onSelect={() => clerk.openSignIn()}>
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
"use client";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { Spinner } from "./ui/spinner";
|
||||
import { Card, CardHeader, CardTitle } from "./ui/card";
|
||||
import { ServerResponse } from "@/lib/types/server";
|
||||
import { ServerResponse } from "@/lib/types/mh-server";
|
||||
import { useEffectOnce } from "@/lib/useEffectOnce";
|
||||
import { Button } from "./ui/button";
|
||||
import { Copy, Layers, XIcon } from "lucide-react";
|
||||
import toast from "react-hot-toast";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
||||
import { getAccountFavorites } from "@/lib/api";
|
||||
import { useRouter } from '@/lib/useRouter'
|
||||
import { useRouter } from "@/lib/useRouter";
|
||||
|
||||
export default function FavoritesView() {
|
||||
const [apiFavorites, setApiFavorites] = useState<any>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const router = useRouter()
|
||||
const router = useRouter();
|
||||
|
||||
useEffectOnce(() => {
|
||||
getAccountFavorites().then((d) => {
|
||||
|
||||
@ -17,7 +17,7 @@ import {
|
||||
ChartTooltipContent,
|
||||
} from "@/components/ui/chart";
|
||||
import { useEffectOnce } from "@/lib/useEffectOnce";
|
||||
import { ServerResponse } from "@/lib/types/server";
|
||||
import { ServerResponse } from "@/lib/types/mh-server";
|
||||
import { getCommunityServerFavorites, getShortTermData } from "@/lib/api";
|
||||
|
||||
const chartConfig = {
|
||||
|
||||
@ -15,25 +15,16 @@ import {
|
||||
} from "./ui/card";
|
||||
import IconDisplay from "./IconDisplay";
|
||||
import { TagShower } from "./ServerList";
|
||||
import {
|
||||
Copy,
|
||||
EllipsisVertical,
|
||||
Layers,
|
||||
MoveRight,
|
||||
Router,
|
||||
} from "lucide-react";
|
||||
import { Copy, EllipsisVertical, Layers } from "lucide-react";
|
||||
import { Button } from "./ui/button";
|
||||
import {
|
||||
Drawer,
|
||||
DrawerClose,
|
||||
DrawerContent,
|
||||
DrawerDescription,
|
||||
DrawerFooter,
|
||||
DrawerHeader,
|
||||
DrawerTitle,
|
||||
DrawerTrigger,
|
||||
} from "@/components/ui/drawer";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Tooltip } from "@radix-ui/react-tooltip";
|
||||
import { TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
||||
import { useRouter } from "@/lib/useRouter";
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
"use client";
|
||||
import { Label } from "./ui/label";
|
||||
import { Button } from "./ui/button";
|
||||
import { Textarea } from "./ui/textarea";
|
||||
import { CheckIcon, CornerDownLeft, X } from "lucide-react";
|
||||
import { CheckIcon, X } from "lucide-react";
|
||||
import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
||||
import {
|
||||
getCustomization,
|
||||
@ -14,9 +13,8 @@ import {
|
||||
} from "@/lib/api";
|
||||
import toast from "react-hot-toast";
|
||||
import { SignedIn, SignedOut, useUser } from "@clerk/nextjs";
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
import { OnlineServer } from "@/lib/types/mh-server";
|
||||
import Link from "next/link";
|
||||
import { useEffectOnce } from "@/lib/useEffectOnce";
|
||||
import Setting from "./ui/setting";
|
||||
import {
|
||||
FormControl,
|
||||
@ -30,7 +28,6 @@ import {
|
||||
import { z } from "zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Input } from "./ui/input";
|
||||
import "@/themes.css";
|
||||
import {
|
||||
Card,
|
||||
@ -43,7 +40,6 @@ import {
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
||||
import { themes } from "@/lib/themes";
|
||||
import { useTheme } from "next-themes";
|
||||
import { useColor } from "@/lib/use-color";
|
||||
import { DiscordPopover } from "./misc/DiscordPopover";
|
||||
import { Spinner } from "./ui/spinner";
|
||||
import { BannerPopover } from "./misc/BannerPopover";
|
||||
|
||||
@ -1,27 +1,10 @@
|
||||
"use client";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { useState } from "react";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "./ui/badge";
|
||||
import ServersList from "@/lib/list";
|
||||
import {
|
||||
CircleUser,
|
||||
Network,
|
||||
Copy,
|
||||
Sun,
|
||||
SlidersHorizontal,
|
||||
Check,
|
||||
XIcon,
|
||||
Info,
|
||||
} from "lucide-react";
|
||||
import { CircleUser, Network, Sun, Check, XIcon, Info } from "lucide-react";
|
||||
import Stat from "./Stat";
|
||||
import {
|
||||
Dialog,
|
||||
@ -31,37 +14,6 @@ import {
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import {
|
||||
ResizableHandle,
|
||||
ResizablePanel,
|
||||
ResizablePanelGroup,
|
||||
} from "@/components/ui/resizable";
|
||||
import {
|
||||
ContextMenu,
|
||||
ContextMenuCheckboxItem,
|
||||
ContextMenuContent,
|
||||
ContextMenuItem,
|
||||
ContextMenuLabel,
|
||||
ContextMenuRadioGroup,
|
||||
ContextMenuRadioItem,
|
||||
ContextMenuSeparator,
|
||||
ContextMenuShortcut,
|
||||
ContextMenuSub,
|
||||
ContextMenuSubContent,
|
||||
ContextMenuSubTrigger,
|
||||
ContextMenuTrigger,
|
||||
} from "@/components/ui/context-menu";
|
||||
import {
|
||||
Command,
|
||||
CommandDialog,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
CommandSeparator,
|
||||
CommandShortcut,
|
||||
} from "@/components/ui/command";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@ -71,23 +23,18 @@ import toast from "react-hot-toast";
|
||||
import { allTags, allCategories } from "@/allTags";
|
||||
import IconDisplay from "./IconDisplay";
|
||||
import InfiniteScroll from "react-infinite-scroll-component";
|
||||
import Markdown from "react-markdown";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Spinner } from "./ui/spinner";
|
||||
import { CommandIcon } from "lucide-react";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { OnlineServer, ServerResponse } from "@/lib/types/server";
|
||||
import { OnlineServer } from "@/lib/types/mh-server";
|
||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||
import { useEffectOnce } from "@/lib/useEffectOnce";
|
||||
import ServerCard from "./ServerCard";
|
||||
import { useHotkeys } from "react-hotkeys-hook";
|
||||
import events from "@/lib/commandEvent";
|
||||
import { BorderBeam } from "@/components/effects/border-beam";
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
import { useState, useEffect } from "react";
|
||||
import { Spinner } from "./ui/spinner";
|
||||
import IconDisplay from "./IconDisplay";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
@ -11,34 +10,18 @@ import {
|
||||
CardTitle,
|
||||
BetterHeader,
|
||||
} from "@/components/ui/card";
|
||||
import { motion, AnimatePresence } from "framer-motion";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import beautify from "json-beautify";
|
||||
import { motion } from "framer-motion";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { Badge } from "./ui/badge";
|
||||
import Editor from "@monaco-editor/react";
|
||||
import { allTags } from "@/allTags";
|
||||
import ServerSingle from "@/lib/single";
|
||||
import { parse, parseExpression } from "@babel/parser";
|
||||
import { NEXT_ROUTER_STATE_TREE } from "next/dist/client/components/app-router-headers";
|
||||
import { Button } from "./ui/button";
|
||||
import * as prettierPluginBabel from "prettier/plugins/babel";
|
||||
import toast from "react-hot-toast";
|
||||
import { SignedIn, SignedOut, SignInButton } from "@clerk/nextjs";
|
||||
import { SignedIn, SignedOut } from "@clerk/nextjs";
|
||||
import SignInPopoverButton from "./clerk/SignInPopoverButton";
|
||||
import { Sparkle, Star, X } from "lucide-react";
|
||||
import { favoriteServer, getCustomization, isFavorited } from "@/lib/api";
|
||||
import { Star, X } from "lucide-react";
|
||||
import { favoriteServer, isFavorited } from "@/lib/api";
|
||||
import { LoadingButton } from "./ui/loading-button";
|
||||
import { useTheme } from "next-themes";
|
||||
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
import { DollarSign } from "lucide-react";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Children } from "react";
|
||||
|
||||
export default function Component(props: {
|
||||
title: string | JSX.Element;
|
||||
|
||||
@ -5,23 +5,30 @@ import {
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import { Button } from "../ui/button";
|
||||
import { AtSign, LogIn, UserCog } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { SignIn, useClerk } from "@clerk/nextjs";
|
||||
import { AtSign, LogIn } from "lucide-react";
|
||||
import { useClerk } from "@clerk/nextjs";
|
||||
|
||||
export default function SignInPopoverButton({
|
||||
className,
|
||||
variant
|
||||
variant,
|
||||
}: {
|
||||
className?: string;
|
||||
variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link";
|
||||
variant?:
|
||||
| "default"
|
||||
| "destructive"
|
||||
| "secondary"
|
||||
| "outline"
|
||||
| "ghost"
|
||||
| "link";
|
||||
}) {
|
||||
const clerk = useClerk();
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button className={className} variant={variant}>Sign In</Button>
|
||||
<Button className={className} variant={variant}>
|
||||
Sign In
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-full">
|
||||
<div className=" grid w-[200px]">
|
||||
|
||||
@ -1,17 +1,14 @@
|
||||
"use client";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useClerk, useUser } from "@clerk/nextjs";
|
||||
import { SignedOut, SignedIn, SignInButton } from "@clerk/nextjs";
|
||||
import { SignedOut, SignedIn } from "@clerk/nextjs";
|
||||
import { Button } from "../ui/button";
|
||||
import { ModeToggle as ThemeSwitcher } from "../ThemeSwitcher";
|
||||
import { Popover, PopoverTrigger, PopoverContent } from "../ui/popover";
|
||||
import Image from "next/image";
|
||||
import { Circle, InfoIcon, UserCog, X } from "lucide-react";
|
||||
import { InfoIcon } from "lucide-react";
|
||||
import LoggedInPopover from "./LoggedInPopover";
|
||||
import SignInPopoverButton from "./SignInPopoverButton";
|
||||
import { version } from "@/version";
|
||||
import InfoPopover from "../misc/InfoPopover";
|
||||
import Link from "next/link";
|
||||
|
||||
export default function TopBar({ inter }: { inter: string }) {
|
||||
const clerk = useClerk();
|
||||
@ -21,7 +18,7 @@ export default function TopBar({ inter }: { inter: string }) {
|
||||
<>
|
||||
<SignedOut>
|
||||
<div className=" mt-1 gap-1 grid grid-cols-5">
|
||||
<SignInPopoverButton className="col-span-2" variant="outline"/>
|
||||
<SignInPopoverButton className="col-span-2" variant="outline" />
|
||||
<Popover>
|
||||
<PopoverTrigger>
|
||||
<Button size="icon" variant="ghost">
|
||||
|
||||
@ -61,20 +61,20 @@ const Confetti = forwardRef<ConfettiRef, Props>((props, ref) => {
|
||||
}
|
||||
}
|
||||
},
|
||||
[globalOptions],
|
||||
[globalOptions]
|
||||
);
|
||||
|
||||
// `fire` is a function that calls the instance() with `opts` merged with `options`
|
||||
const fire = useCallback(
|
||||
(opts = {}) => instanceRef.current?.({ ...options, ...opts }),
|
||||
[options],
|
||||
[options]
|
||||
);
|
||||
|
||||
const api = useMemo(
|
||||
() => ({
|
||||
fire,
|
||||
}),
|
||||
[fire],
|
||||
[fire]
|
||||
);
|
||||
|
||||
useImperativeHandle(ref, () => api, [api]);
|
||||
|
||||
@ -8,7 +8,6 @@ import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
|
||||
@ -8,7 +8,6 @@ import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
|
||||
@ -1,17 +1,9 @@
|
||||
import Link from "next/link";
|
||||
import { Button } from "../ui/button";
|
||||
import { Activity, Calendar, Star, TerminalIcon } from "lucide-react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "../ui/dialog";
|
||||
import { Calendar, Star, TerminalIcon } from "lucide-react";
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog";
|
||||
import { useState } from "react";
|
||||
import { Changelog, version } from "@/version";
|
||||
import events from "@/lib/commandEvent"
|
||||
import events from "@/lib/commandEvent";
|
||||
|
||||
export default function InfoPopover() {
|
||||
const [changeLog, setChangelog] = useState(false);
|
||||
|
||||
@ -12,12 +12,10 @@ import {
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@/components/ui/form";
|
||||
import { TextCopyComp } from "@/components/misc/TextCopyComp";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
InputOTP,
|
||||
InputOTPGroup,
|
||||
InputOTPSeparator,
|
||||
InputOTPSlot,
|
||||
} from "@/components/ui/input-otp";
|
||||
import { linkMCAccount } from "@/lib/api";
|
||||
@ -26,14 +24,11 @@ import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { SetStateAction, useEffect, useState } from "react";
|
||||
import { SetStateAction, useState } from "react";
|
||||
import Confetti from "@/components/effects/confetti";
|
||||
import { useUser } from "@clerk/nextjs";
|
||||
|
||||
const FormSchema = z.object({
|
||||
code: z.string().min(6, {
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Tabs, TabsList, TabsTrigger } from "../ui/tabs";
|
||||
import { Spinner } from "../ui/spinner";
|
||||
import { useRouter } from "@/lib/useRouter";
|
||||
import { Database, Home, Paintbrush } from "lucide-react";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { OnlineServer } from "./types/server";
|
||||
import { OnlineServer } from "./types/mh-server";
|
||||
import toast from "react-hot-toast";
|
||||
import { getMOTDFromServer } from "./api";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { OnlineServer, ServerResponse } from "./types/server";
|
||||
import { OnlineServer, ServerResponse } from "./types/mh-server";
|
||||
import toast from "react-hot-toast";
|
||||
|
||||
export default class ServerSingle {
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
import { useAtom, atom } from "jotai";
|
||||
|
||||
export function useColor() {
|
||||
return useAtom(atom("zinc"));
|
||||
}
|
||||
@ -1,12 +1,7 @@
|
||||
// inngest in mh-stats provides information periodicly. like every 30 minutes for historical data.
|
||||
// its fully automatic
|
||||
|
||||
import Favorites from "@/app/account/favorites/page";
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
import { OnlineServer } from "@/lib/types/mh-server";
|
||||
import { Inngest } from "inngest";
|
||||
import { serve } from "inngest/next";
|
||||
import { MongoClient } from "mongodb";
|
||||
import { Noto_Sans_Mahajani } from "next/font/google";
|
||||
|
||||
// Create a client to send and receive events
|
||||
export const inngest = new Inngest({ id: "my-app" });
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getAuth, clerkClient } from "@clerk/nextjs/server";
|
||||
import { MongoClient, ObjectId } from "mongodb";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { clerkClient, getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
import ServersList from "@/lib/list";
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
import { OnlineServer } from "@/lib/types/mh-server";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { clerkClient, getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
import ServersList from "@/lib/list";
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getAuth, clerkClient, clerkMiddleware } from "@clerk/nextjs/server";
|
||||
import { MongoClient, ObjectId } from "mongodb";
|
||||
import { getAuth, clerkClient } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { clerkClient, getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
import ServersList from "@/lib/list";
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import type { NextApiResponse, NextApiRequest } from "next";
|
||||
import { MongoClient, ObjectId } from "mongodb";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { NextApiResponse, NextApiRequest } from "next";
|
||||
import { MongoClient, ObjectId } from "mongodb";
|
||||
import { MongoClient } from "mongodb";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
|
||||
export default async function handler(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { NextApiResponse, NextApiRequest } from "next";
|
||||
import { MongoClient, ObjectId } from "mongodb";
|
||||
import { MongoClient } from "mongodb";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
|
||||
export default async function handler(
|
||||
|
||||
@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const client = new MongoClient(process.env.MONGO_DB as string);
|
||||
const db = client.db("mhsf").collection("mh");
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { OnlineServer } from "@/lib/types/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getAuth } from "@clerk/nextjs/server";
|
||||
import { MongoClient } from "mongodb";
|
||||
|
||||
export default async function handler(
|
||||
|
||||
@ -1,36 +1,33 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import parseToHTML from "@/lib/motdEngine";
|
||||
|
||||
let num = 0;
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
num++;
|
||||
var body: Array<{ server: string; motd: string }> = req.body.motd;
|
||||
var list: Array<{ server: string; motd: string }> = [];
|
||||
var yes = 0;
|
||||
if (body != undefined && body.forEach != undefined) {
|
||||
body.forEach((c, i) => {
|
||||
const initalList: Array<{ server: string; motd: string }> = req.body.motd;
|
||||
const resultedList: Array<{ server: string; motd: string }> = [];
|
||||
var interval = 0;
|
||||
if (initalList != undefined && initalList.forEach != undefined) {
|
||||
initalList.forEach((c, i) => {
|
||||
parseToHTML(c.motd)
|
||||
.then((m) => {
|
||||
yes++;
|
||||
list.push({ motd: m, server: c.server });
|
||||
if (yes == body.length) {
|
||||
res.send({ result: list });
|
||||
interval++;
|
||||
resultedList.push({ motd: m, server: c.server });
|
||||
if (interval == initalList.length) {
|
||||
res.send({ result: resultedList });
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
list.push({ motd: "Error to grab MOTD", server: c.server });
|
||||
if (i == body.length - 1) {
|
||||
res.send({ result: list });
|
||||
resultedList.push({ motd: "Error to grab MOTD", server: c.server });
|
||||
if (i == initalList.length - 1) {
|
||||
res.send({ result: resultedList });
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
res
|
||||
.status(400)
|
||||
.send({ mes: "Wrong structure.. you might be using the legacy MOTD." });
|
||||
res.status(400).send({
|
||||
message: "Wrong structure.. you might be using the legacy MOTD.",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
8
src/types/index.d.ts
vendored
8
src/types/index.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
declare module "json-beautify" {
|
||||
export default function beautify(
|
||||
value: any,
|
||||
replacer: Function | object | any[] | null,
|
||||
space: number | string,
|
||||
limit?: number,
|
||||
): string;
|
||||
}
|
||||
@ -8,6 +8,38 @@ const User = ({ user }: { user: string }) => (
|
||||
|
||||
export const Changelog = () => (
|
||||
<>
|
||||
<div>
|
||||
Running on commit{" "}
|
||||
<code>
|
||||
<a
|
||||
href={`https://github.com/DeveloLongScript/mhsf/commit/${process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA}`}
|
||||
>
|
||||
{(
|
||||
process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA || "unknown"
|
||||
).substring(0, 7)}
|
||||
</a>{" "}
|
||||
{process.env.NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_ID != undefined &&
|
||||
process.env.NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_ID != "" && (
|
||||
<>
|
||||
{" "}
|
||||
| on PR{" "}
|
||||
<a
|
||||
href={`https://github.com/DeveloLongScript/MHSF/pull/${process.env.NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_ID}`}
|
||||
>
|
||||
{process.env.NEXT_PUBLIC_VERCEL_GIT_PULL_REQUEST_ID}
|
||||
</a>{" "}
|
||||
by{" "}
|
||||
<a
|
||||
href={`https://github.com/${process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_NAME}`}
|
||||
>
|
||||
{process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_AUTHOR_NAME}
|
||||
</a>
|
||||
</>
|
||||
)}{" "}
|
||||
{process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE != undefined &&
|
||||
`| ${process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_MESSAGE}`}
|
||||
</code>
|
||||
</div>
|
||||
<div>
|
||||
<strong className="flex items-center">
|
||||
Version b-0.7.2 (August 7th 2024)
|
||||
|
||||
@ -4065,6 +4065,11 @@ magic-string@^0.30.10:
|
||||
dependencies:
|
||||
"@jridgewell/sourcemap-codec" "^1.4.15"
|
||||
|
||||
mangle-css-class-webpack-plugin@^5.1.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mangle-css-class-webpack-plugin/-/mangle-css-class-webpack-plugin-5.1.0.tgz#42008a8fbe0257f491968796320eb94b17a36321"
|
||||
integrity sha512-/K5ADYUFBLE8c6on3SCduDuOTJ6Wg0BrQ8JQuX8XNOvXI5Pz4SczaRNN2qv0Ocks7kSTXeGaGXIgQZe4lX2m9A==
|
||||
|
||||
map-obj@^4.1.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user