Fix admin regressions from Biome refactor: theme init, mobile nav, i18n.
Local Build and Deploy / deploy (push) Successful in 54s
Local Build and Deploy / deploy (push) Successful in 54s
Restore valid browser JS in theme-init, close mobile sidebar on navigation, and split autoDjForm title/trackTitle across locales. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
59b63d6e70
commit
bae543baf6
23 files changed
+87
-44
No files matched your search
@@ -1,7 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { Menu, X } from "lucide-react";
|
||||
import { type ReactNode, useEffect, useState } from "react";
|
||||
import {
|
||||
createContext,
|
||||
type ReactNode,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
} from "react";
|
||||
|
||||
const AdminMobileContext = createContext<{ close: () => void }>({
|
||||
close: () => {},
|
||||
});
|
||||
|
||||
export function useAdminMobile() {
|
||||
return useContext(AdminMobileContext);
|
||||
}
|
||||
|
||||
export function AdminMobileWrapper({
|
||||
sidebar,
|
||||
@@ -11,6 +27,8 @@ export function AdminMobileWrapper({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const close = useCallback(() => setOpen(false), []);
|
||||
const mobile = useMemo(() => ({ close }), [close]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -22,6 +40,7 @@ export function AdminMobileWrapper({
|
||||
}, [open]);
|
||||
|
||||
return (
|
||||
<AdminMobileContext.Provider value={mobile}>
|
||||
<div className="min-h-screen bg-[var(--admin-canvas)] flex flex-col lg:flex-row">
|
||||
{/* Mobile header */}
|
||||
<div
|
||||
@@ -72,5 +91,6 @@ export function AdminMobileWrapper({
|
||||
{/* Content */}
|
||||
<div className="flex flex-col flex-1 min-w-0">{children}</div>
|
||||
</div>
|
||||
</AdminMobileContext.Provider>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import type { ReactNode } from "react";
|
||||
import { useAdminMobile } from "@/components/admin/admin-mobile-wrapper";
|
||||
|
||||
/**
|
||||
* Sidebar link that highlights when its route is active. "/admin" matches
|
||||
@@ -19,6 +20,7 @@ export function AdminNavLink({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const pathname = usePathname() ?? "";
|
||||
const { close } = useAdminMobile();
|
||||
const active =
|
||||
href === "/admin"
|
||||
? pathname === "/admin"
|
||||
@@ -27,6 +29,7 @@ export function AdminNavLink({
|
||||
return (
|
||||
<Link
|
||||
href={href}
|
||||
onClick={close}
|
||||
aria-current={active ? "page" : undefined}
|
||||
className={`group flex items-center gap-2.5 rounded-xl px-3 py-2 text-sm no-underline transition-colors duration-150
|
||||
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--admin-accent)] focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--admin-sidebar-background)] ${
|
||||
|
||||
Reference in new issue
Block a user