setting up dark/white mode. fixed some other small things
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
/**
|
||||
* PartsBrowseClient
|
||||
* -----------------------------------------------------------------------------
|
||||
@@ -88,6 +90,7 @@ export default function PartsBrowseClient(props: {
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const pathname = usePathname();
|
||||
|
||||
const effectivePlatform =
|
||||
props.platform ?? searchParams.get("platform") ?? "AR-15";
|
||||
@@ -169,6 +172,11 @@ export default function PartsBrowseClient(props: {
|
||||
inStockOnly,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
// Reset scroll position whenever we land on or change parts routes
|
||||
window.scrollTo({ top: 0, left: 0, behavior: "auto" });
|
||||
}, [pathname]);
|
||||
|
||||
const availableBrands = useMemo(
|
||||
() =>
|
||||
Array.from(new Set(parts.map((p) => p.brand)))
|
||||
|
||||
Reference in New Issue
Block a user