main
This commit is contained in:
@@ -35,7 +35,7 @@ export function AppHeader() {
|
||||
}, [pathname]);
|
||||
const activeCategorySlug = React.useMemo(() => {
|
||||
if (activeBoardId) {
|
||||
const found = categories.find((c) => c.boards.some((b) => b.id === activeBoardId));
|
||||
const found = categories.find((c) => c.boards.some((b) => b.slug === activeBoardId));
|
||||
return found?.slug ?? null;
|
||||
}
|
||||
if (pathname === "/boards") {
|
||||
@@ -337,7 +337,7 @@ export function AppHeader() {
|
||||
style={idx === categories.length - 1 ? { minWidth: 120 } : undefined}
|
||||
>
|
||||
<Link
|
||||
href={cat.boards?.[0]?.id ? `/boards/${cat.boards[0].id}` : `/boards?category=${cat.slug}`}
|
||||
href={cat.boards?.[0]?.slug ? `/boards/${cat.boards[0].slug}` : `/boards?category=${cat.slug}`}
|
||||
className={`block w-full px-2 py-2 text-sm font-medium transition-colors duration-200 hover:text-neutral-900 whitespace-nowrap ${
|
||||
activeCategorySlug === cat.slug ? "text-neutral-900" : "text-neutral-700"
|
||||
}`}
|
||||
@@ -381,11 +381,11 @@ export function AppHeader() {
|
||||
{cat.boards.map((b) => (
|
||||
<Link
|
||||
key={b.id}
|
||||
href={`/boards/${b.id}`}
|
||||
href={`/boards/${b.slug}`}
|
||||
className={`rounded px-2 py-1 text-sm transition-colors duration-150 hover:bg-neutral-100 hover:text-neutral-900 text-center whitespace-nowrap ${
|
||||
activeBoardId === b.id ? "bg-neutral-100 text-neutral-900 font-medium" : "text-neutral-700"
|
||||
activeBoardId === b.slug ? "bg-neutral-100 text-neutral-900 font-medium" : "text-neutral-700"
|
||||
}`}
|
||||
aria-current={activeBoardId === b.id ? "page" : undefined}
|
||||
aria-current={activeBoardId === b.slug ? "page" : undefined}
|
||||
>
|
||||
{b.name}
|
||||
</Link>
|
||||
@@ -416,7 +416,7 @@ export function AppHeader() {
|
||||
<div className="mb-2 font-semibold text-neutral-800">{cat.name}</div>
|
||||
<div className="flex flex-col gap-1">
|
||||
{cat.boards.map((b) => (
|
||||
<Link key={b.id} href={`/boards/${b.id}`} onClick={() => setMobileOpen(false)} className="rounded px-2 py-1 text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900">
|
||||
<Link key={b.id} href={`/boards/${b.slug}`} onClick={() => setMobileOpen(false)} className="rounded px-2 py-1 text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900">
|
||||
{b.name}
|
||||
</Link>
|
||||
))}
|
||||
|
||||
@@ -7,7 +7,7 @@ type ApiCategory = {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
boards: { id: string; name: string; slug: string; requiresApproval: boolean }[];
|
||||
boards: { id: string; name: string; slug: string }[];
|
||||
};
|
||||
|
||||
type PostItem = {
|
||||
@@ -101,7 +101,7 @@ export default function CategoryBoardBrowser({ categoryName, categorySlug }: Pro
|
||||
className="shrink-0 text-lg md:text-xl font-bold text-neutral-800 truncate"
|
||||
onClick={() => {
|
||||
const first = selectedCategory?.boards?.[0];
|
||||
if (first?.id) router.push(`/boards/${first.id}`);
|
||||
if (first?.slug) router.push(`/boards/${first.slug}`);
|
||||
}}
|
||||
title={(selectedCategory?.name ?? categoryName ?? "").toString()}
|
||||
>
|
||||
@@ -113,7 +113,7 @@ export default function CategoryBoardBrowser({ categoryName, categorySlug }: Pro
|
||||
className="shrink-0 w-6 h-6 rounded-full border border-neutral-300 text-neutral-500 hover:bg-neutral-50 flex items-center justify-center"
|
||||
onClick={() => {
|
||||
const first = selectedCategory?.boards?.[0];
|
||||
if (first?.id) router.push(`/boards/${first.id}`);
|
||||
if (first?.slug) router.push(`/boards/${first.slug}`);
|
||||
}}
|
||||
>
|
||||
<svg width="12" height="12" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||
|
||||
Reference in New Issue
Block a user