ui: home carousel height lock + bubble polish

- Home: lock category carousel height to the tallest page so the
  Official Recommendations section below does not jump up when
  swiping to a page with fewer categories.
- CollapsibleText: raise default threshold to 25 lines and tighten
  the spacing between the expand-all button and the timestamp
  (drop the fixed h-8 and use mt-1 instead of mt-1.5).
- formatTime: always render dates as yyyy/m/d HH:mm regardless of
  locale, matching the requested timestamp format.
This commit is contained in:
TerryM
2026-05-30 00:43:54 +08:00
parent c0068e957e
commit d7e2e56cde
4 changed files with 19 additions and 33 deletions

View File

@@ -137,10 +137,15 @@ export function Home() {
for (let index = 0; index < figmaOrderedCategories.length; index += 9) {
categoryPages.push(figmaOrderedCategories.slice(index, index + 9));
}
const activeCategoryCount = categoryPages[activeCategoryPage]?.length ?? 0;
const activeCategoryRows = Math.ceil(activeCategoryCount / 3);
// Use the tallest page so the carousel height doesn't shrink between
// pages — otherwise the section below jumps up when swiping to a page
// with fewer categories.
const maxCategoryRows = categoryPages.reduce(
(max, page) => Math.max(max, Math.ceil(page.length / 3)),
0,
);
const mobileCategoryHeight =
activeCategoryRows * 88 + Math.max(0, activeCategoryRows - 1) * 8;
maxCategoryRows * 88 + Math.max(0, maxCategoryRows - 1) * 8;
useEffect(() => {
const row = categoryRowRef.current;