Fix cart-badge false pulse, blog hero-card misattribution, legal breadcrumb color

- Cart badge pulsed on every page load/reload, not just real cart
  changes — useCartCount's SSR snapshot is always 0, so hydration alone
  satisfied the "count increased" check. Skip the very first effect run.
- WishlistButton: touch-device smaller/subtler sizing now applies
  regardless of revealOnHover (e.g. the homepage spotlight heart), not
  just the shop grid's hover-reveal mode.
- /blog: the big featured-style hero card was applied to whatever post
  sorted first post-filter, even when that post isn't actually the
  `featured` one (a category filter can exclude the real featured post
  entirely). Now gated on the post's own `featured` flag.
- Legal pages' "Startseite" breadcrumb link now matches the same
  text-brand/hover:underline treatment already used elsewhere on these
  pages (e.g. Impressum's Anbieter email link), instead of staying muted
  until hover.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018unaXmuzVA8ct1b6WoyP1U
This commit is contained in:
Marco
2026-07-31 22:46:24 +00:00
parent bf6c5d079a
commit 7c26bf7b7c
7 changed files with 32 additions and 10 deletions
+11
View File
@@ -177,6 +177,12 @@ function CartLink() {
const anchorRef = useRef<HTMLAnchorElement>(null);
const [pulse, setPulse] = useState(false);
const prevVisibleRef = useRef(0);
// useCartCount's getServerSnapshot is always 0 (see cart.ts) so hydration
// always transitions 0 -> the real count on first render — without this
// guard that transition alone satisfied "visibleCount > prevVisibleRef"
// and pulsed the badge on every single page load/reload, not just an
// actual in-session cart change.
const hasMountedRef = useRef(false);
const pathname = usePathname();
// Held back by pendingCount while a ball is mid-flight, so the badge only
@@ -191,6 +197,11 @@ function CartLink() {
}, [registerCartIcon]);
useEffect(() => {
if (!hasMountedRef.current) {
hasMountedRef.current = true;
prevVisibleRef.current = visibleCount;
return;
}
if (visibleCount > prevVisibleRef.current) {
setPulse(true);
const t = setTimeout(() => setPulse(false), 350);