feat : also update
This commit is contained in:
@@ -6,7 +6,6 @@ import { usePathname } from "next/navigation";
|
|||||||
import { BookOpenIcon, MenuIcon } from "lucide-react";
|
import { BookOpenIcon, MenuIcon } from "lucide-react";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { SiteInstallButton } from "@/components/site-install-button";
|
|
||||||
import {
|
import {
|
||||||
Drawer,
|
Drawer,
|
||||||
DrawerClose,
|
DrawerClose,
|
||||||
@@ -35,7 +34,6 @@ export function PublicNavigation() {
|
|||||||
{icon ? <Image src={icon} alt="" width={24} height={24} className="size-6 object-contain" /> : null}{label}
|
{icon ? <Image src={icon} alt="" width={24} height={24} className="size-6 object-contain" /> : null}{label}
|
||||||
</Button>)}
|
</Button>)}
|
||||||
</nav>
|
</nav>
|
||||||
<SiteInstallButton />
|
|
||||||
<div className="lg:hidden">
|
<div className="lg:hidden">
|
||||||
<Drawer>
|
<Drawer>
|
||||||
<DrawerTrigger render={<Button type="button" variant="outline" size="sm" aria-label="เปิดเมนูหลัก" />}>
|
<DrawerTrigger render={<Button type="button" variant="outline" size="sm" aria-label="เปิดเมนูหลัก" />}>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export function RotationHelp() {
|
|||||||
<dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-2">
|
<dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-2">
|
||||||
<dt className="font-semibold text-foreground">E / Q</dt><dd>สกิลธาตุ / ท่าไม้ตาย</dd>
|
<dt className="font-semibold text-foreground">E / Q</dt><dd>สกิลธาตุ / ท่าไม้ตาย</dd>
|
||||||
<dt className="font-semibold text-foreground">N / C / P</dt><dd>โจมตีปกติ / ชาร์จโจมตี / โจมตีพุ่งลง</dd>
|
<dt className="font-semibold text-foreground">N / C / P</dt><dd>โจมตีปกติ / ชาร์จโจมตี / โจมตีพุ่งลง</dd>
|
||||||
|
<dt className="font-semibold text-foreground">hP / lP</dt><dd>โจมตีพุ่งลงจากที่สูง (High Plunge) / โจมตีพุ่งลงจากที่ต่ำ (Low Plunge)</dd>
|
||||||
<dt className="font-semibold text-foreground">D / J</dt><dd>แดช / กระโดดเพื่อยกเลิกแอนิเมชั่น</dd>
|
<dt className="font-semibold text-foreground">D / J</dt><dd>แดช / กระโดดเพื่อยกเลิกแอนิเมชั่น</dd>
|
||||||
<dt className="font-semibold text-foreground">hE / tE</dt><dd>กดสกิลธาตุค้าง / แตะสกิลธาตุ</dd>
|
<dt className="font-semibold text-foreground">hE / tE</dt><dd>กดสกิลธาตุค้าง / แตะสกิลธาตุ</dd>
|
||||||
<dt className="font-semibold text-foreground">C0 / R1</dt><dd>กลุ่มดาวระดับ 0 / อาวุธขัดเกลาระดับ 1</dd>
|
<dt className="font-semibold text-foreground">C0 / R1</dt><dd>กลุ่มดาวระดับ 0 / อาวุธขัดเกลาระดับ 1</dd>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Image from "@/components/ui/resilient-image";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import { SearchIcon, SlidersHorizontalIcon, StarIcon, UsersIcon, XIcon } from "lucide-react";
|
import { SearchIcon, SlidersHorizontalIcon, StarIcon, UsersIcon, XIcon } from "lucide-react";
|
||||||
import { useMemo, type ReactNode } from "react";
|
import { useEffect, useMemo, type ReactNode } from "react";
|
||||||
|
|
||||||
import { ElementIcon } from "@/components/public/element-icon";
|
import { ElementIcon } from "@/components/public/element-icon";
|
||||||
|
|
||||||
@@ -84,8 +84,22 @@ const sortOptions = [
|
|||||||
{ value: "name-desc", label: "Z - A" },
|
{ value: "name-desc", label: "Z - A" },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
const SORT_STORAGE_KEY = "buzz-sheet:directory-sort";
|
||||||
|
|
||||||
export function StructuredDirectory({ guides }: { guides: GuideCard[] }) {
|
export function StructuredDirectory({ guides }: { guides: GuideCard[] }) {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
useEffect(() => {
|
||||||
|
if (searchParams.has("sort")) return;
|
||||||
|
try {
|
||||||
|
const savedSort = window.localStorage.getItem(SORT_STORAGE_KEY);
|
||||||
|
if (!savedSort || !sortOptions.some((option) => option.value === savedSort) || savedSort === "manual") return;
|
||||||
|
const next = new URLSearchParams(searchParams.toString());
|
||||||
|
next.set("sort", savedSort);
|
||||||
|
window.history.replaceState(null, "", `?${next.toString()}`);
|
||||||
|
} catch {
|
||||||
|
// Sorting still works when browser storage is unavailable.
|
||||||
|
}
|
||||||
|
}, [searchParams]);
|
||||||
const query = searchParams.get("q") ?? "";
|
const query = searchParams.get("q") ?? "";
|
||||||
const presence = useVisitorPresence(null);
|
const presence = useVisitorPresence(null);
|
||||||
const elements = useMemo(() => [...new Set(guides.flatMap((guide) => guide.element ? [guide.element] : []))].sort(), [guides]);
|
const elements = useMemo(() => [...new Set(guides.flatMap((guide) => guide.element ? [guide.element] : []))].sort(), [guides]);
|
||||||
@@ -121,8 +135,15 @@ export function StructuredDirectory({ guides }: { guides: GuideCard[] }) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
function setParam(name: string, value: string) {
|
function setParam(name: string, value: string) {
|
||||||
|
if (name === "sort") {
|
||||||
|
try {
|
||||||
|
window.localStorage.setItem(SORT_STORAGE_KEY, value);
|
||||||
|
} catch {
|
||||||
|
// Keep the selection usable when browser storage is unavailable.
|
||||||
|
}
|
||||||
|
}
|
||||||
const next = new URLSearchParams(searchParams.toString());
|
const next = new URLSearchParams(searchParams.toString());
|
||||||
if (!value || value === "all" || (name === "sort" && value === "manual")) next.delete(name);
|
if (!value || value === "all") next.delete(name);
|
||||||
else next.set(name, value);
|
else next.set(name, value);
|
||||||
const suffix = next.toString();
|
const suffix = next.toString();
|
||||||
window.history.replaceState(null, "", suffix ? `?${suffix}` : window.location.pathname);
|
window.history.replaceState(null, "", suffix ? `?${suffix}` : window.location.pathname);
|
||||||
|
|||||||
Reference in New Issue
Block a user