Merge branch 'main' into detail-page

This commit is contained in:
hamster1963 2024-10-19 12:56:30 +08:00
commit 3e6e1f1e8a
3 changed files with 46 additions and 32 deletions

View File

@ -6,7 +6,9 @@ import { Separator } from "@/components/ui/separator";
import getEnv from "@/lib/env-entry"; import getEnv from "@/lib/env-entry";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useLocale } from "next-intl";
import Image from "next/image"; import Image from "next/image";
import { useRouter } from "next/navigation";
import React, { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
function Header() { function Header() {
@ -15,10 +17,18 @@ function Header() {
const customTitle = getEnv("NEXT_PUBLIC_CustomTitle"); const customTitle = getEnv("NEXT_PUBLIC_CustomTitle");
const customDescription = getEnv("NEXT_PUBLIC_CustomDescription"); const customDescription = getEnv("NEXT_PUBLIC_CustomDescription");
const router = useRouter();
const locale = useLocale();
return ( return (
<div className="mx-auto w-full max-w-5xl"> <div className="mx-auto w-full max-w-5xl">
<section className="flex items-center justify-between"> <section className="flex items-center justify-between">
<section className="flex items-center text-base font-medium"> <section
onClick={() => {
router.push(`/${locale}/`);
}}
className="flex cursor-pointer items-center text-base font-medium"
>
<div className="mr-1 flex flex-row items-center justify-start"> <div className="mr-1 flex flex-row items-center justify-start">
<Image <Image
width={40} width={40}

View File

@ -36,13 +36,13 @@ export default function ServerCard({
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row" "flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row"
} }
> >
<Popover>
<PopoverTrigger asChild>
<section <section
className="grid items-center gap-2 lg:w-28 cursor-pointer" className="grid items-center gap-2 lg:w-28"
style={{ gridTemplateColumns: "auto 1fr auto" }} style={{ gridTemplateColumns: "auto auto 1fr" }}
onClick={() => {
router.push(`/${locale}/detail/${id}`);
}}
> >
<span className="h-2 w-2 shrink-0 rounded-full bg-green-500 self-center"></span>
<div <div
className={cn( className={cn(
"flex items-center justify-center", "flex items-center justify-center",
@ -59,8 +59,12 @@ export default function ServerCard({
> >
{name} {name}
</p> </p>
<span className="h-2 w-2 shrink-0 rounded-full bg-green-500 self-center"></span>
</section> </section>
</PopoverTrigger>
<PopoverContent side="top">
<ServerCardPopover status={props.status} host={props.host} />
</PopoverContent>
</Popover>
<div <div
onClick={() => { onClick={() => {
router.push(`/${locale}/network/${id}`); router.push(`/${locale}/network/${id}`);
@ -138,8 +142,9 @@ export default function ServerCard({
<PopoverTrigger asChild> <PopoverTrigger asChild>
<section <section
className="grid items-center gap-2 lg:w-28" className="grid items-center gap-2 lg:w-28"
style={{ gridTemplateColumns: "auto 1fr auto" }} style={{ gridTemplateColumns: "auto auto 1fr" }}
> >
<span className="h-2 w-2 shrink-0 rounded-full bg-red-500 self-center"></span>
<div <div
className={cn( className={cn(
"flex items-center justify-center", "flex items-center justify-center",
@ -156,7 +161,6 @@ export default function ServerCard({
> >
{name} {name}
</p> </p>
<span className="h-2 w-2 shrink-0 rounded-full bg-red-500 self-center"></span>
</section> </section>
</PopoverTrigger> </PopoverTrigger>
<PopoverContent className="w-fit p-2" side="top"> <PopoverContent className="w-fit p-2" side="top">

View File

@ -22,14 +22,14 @@
"@radix-ui/react-tooltip": "^1.1.3", "@radix-ui/react-tooltip": "^1.1.3",
"@trivago/prettier-plugin-sort-imports": "^4.3.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/luxon": "^3.4.2", "@types/luxon": "^3.4.2",
"@typescript-eslint/eslint-plugin": "^8.8.1", "@typescript-eslint/eslint-plugin": "^8.9.0",
"caniuse-lite": "^1.0.30001668", "caniuse-lite": "^1.0.30001668",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"country-flag-icons": "^1.5.13", "country-flag-icons": "^1.5.13",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-simple-import-sort": "^12.1.1",
"flag-icons": "^7.2.3", "flag-icons": "^7.2.3",
"framer-motion": "^11.11.8", "framer-motion": "^11.11.9",
"lucide-react": "^0.451.0", "lucide-react": "^0.451.0",
"luxon": "^3.5.0", "luxon": "^3.5.0",
"next": "^14.2.15", "next": "^14.2.15",
@ -44,7 +44,7 @@
"recharts": "2.12.7", "recharts": "2.12.7",
"sharp": "^0.33.5", "sharp": "^0.33.5",
"swr": "^2.2.6-beta.4", "swr": "^2.2.6-beta.4",
"tailwind-merge": "^2.5.3", "tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7" "tailwindcss-animate": "^1.0.7"
}, },
"devDependencies": { "devDependencies": {
@ -60,7 +60,7 @@
"postcss": "^8.4.47", "postcss": "^8.4.47",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8", "prettier-plugin-tailwindcss": "^0.6.8",
"tailwindcss": "^3.4.13", "tailwindcss": "^3.4.14",
"typescript": "^5.6.3" "typescript": "^5.6.3"
} }
} }