chore(gitops): remove misplaced frontend sources [skip ci]
This commit is contained in:
@@ -1,39 +0,0 @@
|
|||||||
import { Suspense } from "react";
|
|
||||||
import CatalogRouteBoundary from "@/components/catalog/CatalogRouteBoundary";
|
|
||||||
|
|
||||||
// Conserva aquí los imports actuales de tu página:
|
|
||||||
// import CatalogClient from "...";
|
|
||||||
// import { getProducts } from "...";
|
|
||||||
|
|
||||||
type CatalogPageProps = {
|
|
||||||
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default async function CatalogPage({
|
|
||||||
searchParams,
|
|
||||||
}: CatalogPageProps) {
|
|
||||||
const params = await searchParams;
|
|
||||||
|
|
||||||
// Conserva aquí la carga de datos actual de tu proyecto.
|
|
||||||
// const products = await getProducts();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Suspense fallback={null}>
|
|
||||||
<CatalogRouteBoundary>
|
|
||||||
{/*
|
|
||||||
Sustituye este comentario por el contenido actual del catálogo.
|
|
||||||
|
|
||||||
Ejemplo:
|
|
||||||
<CatalogClient
|
|
||||||
products={products}
|
|
||||||
initialCategory={String(params.category ?? "")}
|
|
||||||
initialCollection={String(params.collection ?? "")}
|
|
||||||
/>
|
|
||||||
*/}
|
|
||||||
<pre style={{ display: "none" }}>
|
|
||||||
{JSON.stringify(params)}
|
|
||||||
</pre>
|
|
||||||
</CatalogRouteBoundary>
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import type { ReactNode } from "react";
|
|
||||||
import { usePathname, useSearchParams } from "next/navigation";
|
|
||||||
|
|
||||||
type CatalogRouteBoundaryProps = {
|
|
||||||
children: ReactNode;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fuerza el remontaje del árbol del catálogo cuando cambia:
|
|
||||||
* - pathname
|
|
||||||
* - category
|
|
||||||
* - collection
|
|
||||||
* - section
|
|
||||||
* - búsqueda, orden u otros parámetros
|
|
||||||
*
|
|
||||||
* Esto evita que useState/useMemo conserven filtros de una navegación anterior.
|
|
||||||
*/
|
|
||||||
export default function CatalogRouteBoundary({
|
|
||||||
children,
|
|
||||||
}: CatalogRouteBoundaryProps) {
|
|
||||||
const pathname = usePathname();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const navigationKey = `${pathname}?${searchParams.toString()}`;
|
|
||||||
|
|
||||||
return <div key={navigationKey}>{children}</div>;
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { usePathname, useSearchParams } from "next/navigation";
|
|
||||||
import styles from "./CategoryMenu.module.css";
|
|
||||||
|
|
||||||
type MenuItem = {
|
|
||||||
label: string;
|
|
||||||
href: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Menú principal ARI Shopping.
|
|
||||||
*
|
|
||||||
* Hotfix de estabilidad:
|
|
||||||
* Se utilizan enlaces HTML nativos para que cada cambio de categoría
|
|
||||||
* realice una navegación completa. Esto evita conservar estados obsoletos
|
|
||||||
* del catálogo cuando únicamente cambia el query string.
|
|
||||||
*/
|
|
||||||
const MENU_ITEMS: readonly MenuItem[] = [
|
|
||||||
{
|
|
||||||
label: "Juguetes para bebés",
|
|
||||||
href: "/catalog?category=Figuras",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Educativos",
|
|
||||||
href: "/catalog?category=Figuras§ion=educativos",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Muñecas y peluches",
|
|
||||||
href: "/catalog?category=Peluches",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Acción y aventura",
|
|
||||||
href: "/catalog?collection=Marvel",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Mochilas",
|
|
||||||
href: "/catalog?category=Mochilas",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Variedades",
|
|
||||||
href: "/catalog",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
function normalizeUrl(pathname: string, query: string): string {
|
|
||||||
return query ? `${pathname}?${query}` : pathname;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function CategoryMenu() {
|
|
||||||
const pathname = usePathname();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
const currentUrl = normalizeUrl(pathname, searchParams.toString());
|
|
||||||
|
|
||||||
return (
|
|
||||||
<nav className={styles.navigation} aria-label="Categorías principales">
|
|
||||||
<a
|
|
||||||
className={styles.menuButton}
|
|
||||||
href="/catalog"
|
|
||||||
aria-label="Abrir catálogo"
|
|
||||||
title="Abrir catálogo"
|
|
||||||
>
|
|
||||||
<span aria-hidden="true" />
|
|
||||||
<span aria-hidden="true" />
|
|
||||||
<span aria-hidden="true" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<div className={styles.links}>
|
|
||||||
{MENU_ITEMS.map((item) => {
|
|
||||||
const active = currentUrl === item.href;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<a
|
|
||||||
key={`${item.label}:${item.href}`}
|
|
||||||
href={item.href}
|
|
||||||
className={`${styles.link}${active ? ` ${styles.active}` : ""}`}
|
|
||||||
aria-current={active ? "page" : undefined}
|
|
||||||
data-navigation-mode="document"
|
|
||||||
>
|
|
||||||
{item.label}
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { usePathname, useSearchParams } from "next/navigation";
|
|
||||||
import styles from "./CategoryMenu.module.css";
|
|
||||||
|
|
||||||
type MenuItem = {
|
|
||||||
label: string;
|
|
||||||
href: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Menú principal ARI Shopping.
|
|
||||||
*
|
|
||||||
* Hotfix de estabilidad:
|
|
||||||
* Se utilizan enlaces HTML nativos para que cada cambio de categoría
|
|
||||||
* realice una navegación completa. Esto evita conservar estados obsoletos
|
|
||||||
* del catálogo cuando únicamente cambia el query string.
|
|
||||||
*/
|
|
||||||
const MENU_ITEMS: readonly MenuItem[] = [
|
|
||||||
{
|
|
||||||
label: "Juguetes para bebés",
|
|
||||||
href: "/catalog?category=Figuras",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Educativos",
|
|
||||||
href: "/catalog?category=Figuras§ion=educativos",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Muñecas y peluches",
|
|
||||||
href: "/catalog?category=Peluches",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Acción y aventura",
|
|
||||||
href: "/catalog?collection=Marvel",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Mochilas",
|
|
||||||
href: "/catalog?category=Mochilas",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Variedades",
|
|
||||||
href: "/catalog",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
function normalizeUrl(pathname: string, query: string): string {
|
|
||||||
return query ? `${pathname}?${query}` : pathname;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function CategoryMenu() {
|
|
||||||
const pathname = usePathname();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
const currentUrl = normalizeUrl(pathname, searchParams.toString());
|
|
||||||
|
|
||||||
return (
|
|
||||||
<nav className={styles.navigation} aria-label="Categorías principales">
|
|
||||||
<a
|
|
||||||
className={styles.menuButton}
|
|
||||||
href="/catalog"
|
|
||||||
aria-label="Abrir catálogo"
|
|
||||||
title="Abrir catálogo"
|
|
||||||
>
|
|
||||||
<span aria-hidden="true" />
|
|
||||||
<span aria-hidden="true" />
|
|
||||||
<span aria-hidden="true" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<div className={styles.links}>
|
|
||||||
{MENU_ITEMS.map((item) => {
|
|
||||||
const active = currentUrl === item.href;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<a
|
|
||||||
key={`${item.label}:${item.href}`}
|
|
||||||
href={item.href}
|
|
||||||
className={`${styles.link}${active ? ` ${styles.active}` : ""}`}
|
|
||||||
aria-current={active ? "page" : undefined}
|
|
||||||
data-navigation-mode="document"
|
|
||||||
>
|
|
||||||
{item.label}
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user