diff --git a/src/pages/Categories/index.tsx b/src/pages/Categories/index.tsx index 2edbe83..a1ac617 100644 --- a/src/pages/Categories/index.tsx +++ b/src/pages/Categories/index.tsx @@ -23,9 +23,13 @@ const FIGMA_CATEGORY_ORDER = [ "official-assets", "media-coverage", "academy-video", - "general", ]; +// Categories the design no longer surfaces on this page. The backend still +// returns them (and posts may still resolve their category names via the full +// list) but they should never appear in the visible grid. +const HIDDEN_CATEGORY_SLUGS = new Set(["general"]); + function figmaCategoryRank(category: Category): number { const index = FIGMA_CATEGORY_ORDER.indexOf(category.slug); return index === -1 ? FIGMA_CATEGORY_ORDER.length : index; @@ -45,9 +49,9 @@ export function CategoriesPage() { )}`; const applyCategories = (items: Category[]) => setCats( - itemsOrEmpty(items).sort( - (a, b) => figmaCategoryRank(a) - figmaCategoryRank(b), - ), + itemsOrEmpty(items) + .filter((cat) => !HIDDEN_CATEGORY_SLUGS.has(cat.slug)) + .sort((a, b) => figmaCategoryRank(a) - figmaCategoryRank(b)), ); setErr(null); diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 0189991..0178e29 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -34,9 +34,12 @@ const FIGMA_CATEGORY_ORDER = [ "official-assets", "media-coverage", "academy-video", - "general", ]; +// Hidden from the home categories carousel but still kept in the lookup map +// so posts in these categories can still resolve their category label. +const HIDDEN_CATEGORY_SLUGS = new Set(["general"]); + function figmaCategoryRank(category: Category): number { const index = FIGMA_CATEGORY_ORDER.indexOf(category.slug); return index === -1 ? FIGMA_CATEGORY_ORDER.length : index; @@ -214,9 +217,9 @@ export function Home() { }; }, [lang]); - const figmaOrderedCategories = [...cats].sort( - (a, b) => figmaCategoryRank(a) - figmaCategoryRank(b), - ); + const figmaOrderedCategories = cats + .filter((cat) => !HIDDEN_CATEGORY_SLUGS.has(cat.slug)) + .sort((a, b) => figmaCategoryRank(a) - figmaCategoryRank(b)); const categoryPages: Category[][] = []; for (let index = 0; index < figmaOrderedCategories.length; index += 9) {