terry-staging #16

Merged
terry merged 96 commits from terry-staging into main 2026-06-05 16:33:12 +00:00
2 changed files with 15 additions and 8 deletions
Showing only changes of commit e73e25077e - Show all commits

View File

@@ -23,9 +23,13 @@ const FIGMA_CATEGORY_ORDER = [
"official-assets", "official-assets",
"media-coverage", "media-coverage",
"academy-video", "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 { function figmaCategoryRank(category: Category): number {
const index = FIGMA_CATEGORY_ORDER.indexOf(category.slug); const index = FIGMA_CATEGORY_ORDER.indexOf(category.slug);
return index === -1 ? FIGMA_CATEGORY_ORDER.length : index; return index === -1 ? FIGMA_CATEGORY_ORDER.length : index;
@@ -45,9 +49,9 @@ export function CategoriesPage() {
)}`; )}`;
const applyCategories = (items: Category[]) => const applyCategories = (items: Category[]) =>
setCats( setCats(
itemsOrEmpty(items).sort( itemsOrEmpty(items)
(a, b) => figmaCategoryRank(a) - figmaCategoryRank(b), .filter((cat) => !HIDDEN_CATEGORY_SLUGS.has(cat.slug))
), .sort((a, b) => figmaCategoryRank(a) - figmaCategoryRank(b)),
); );
setErr(null); setErr(null);

View File

@@ -34,9 +34,12 @@ const FIGMA_CATEGORY_ORDER = [
"official-assets", "official-assets",
"media-coverage", "media-coverage",
"academy-video", "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 { function figmaCategoryRank(category: Category): number {
const index = FIGMA_CATEGORY_ORDER.indexOf(category.slug); const index = FIGMA_CATEGORY_ORDER.indexOf(category.slug);
return index === -1 ? FIGMA_CATEGORY_ORDER.length : index; return index === -1 ? FIGMA_CATEGORY_ORDER.length : index;
@@ -214,9 +217,9 @@ export function Home() {
}; };
}, [lang]); }, [lang]);
const figmaOrderedCategories = [...cats].sort( const figmaOrderedCategories = cats
(a, b) => figmaCategoryRank(a) - figmaCategoryRank(b), .filter((cat) => !HIDDEN_CATEGORY_SLUGS.has(cat.slug))
); .sort((a, b) => figmaCategoryRank(a) - figmaCategoryRank(b));
const categoryPages: Category[][] = []; const categoryPages: Category[][] = [];
for (let index = 0; index < figmaOrderedCategories.length; index += 9) { for (let index = 0; index < figmaOrderedCategories.length; index += 9) {