feat(cards): feed-card impressions on the glass bar + post action bars#6237
Open
tsahimatsliah wants to merge 29 commits into
Open
feat(cards): feed-card impressions on the glass bar + post action bars#6237tsahimatsliah wants to merge 29 commits into
tsahimatsliah wants to merge 29 commits into
Conversation
… overlap The floating glass action bar had three spacing problems: - The award action only renders when a viewer can award a post, leaving an empty equal-width slot on most cards and making the bar look inconsistent from card to card. Removed it from the glass bar entirely. - Equal fixed-width slots with overflow-hidden clipped large counters at real card widths (e.g. "1.3K" rendered as "1.3", "512" as "51"). Switched the pill to justify-between with content-sized buttons (matching the standard action bar) so counts render in full, icons keep even gaps, and a long counter grows its own button instead of clipping or shoving a neighbour. - On the hero card the bar floated over the content column and the old pb-12 reserve didn't actually keep long titles/summaries out from behind it (overflow-hidden clips at the padding edge). Made the text column flex-1 min-h-0 overflow-hidden with an in-flow spacer that genuinely reserves the bar's footprint, so text always clips above the bar regardless of length. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…sible A long hero title (e.g. "Valve officially supports DIY Steam Machines with SteamOS 3.8") wrapped to four lines at typo-title1, consuming the column and pushing the summary off the bottom of the card behind the glass action bar. Add useFitFontSize: a small SSR-safe hook that measures the rendered element and steps the font size down (typo-title1 → title2 → title3) until the text fits within a line budget — measuring rather than guessing from character count, since the hero content column width varies with wideColSpan. The hero title now shrinks to fit three lines (full title, no ellipsis) and only clamps as a last resort at the smallest size, leaving room for the TLDR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Match the pill's left/right padding to the 4px it already leaves above and below its buttons (px-2 → px-1), so the inner padding is equal on all sides. - Darken the glass a few percent by compositing a low-opacity black layer over the bg-blur-bg token (kept inline so the shared token is untouched), for better contrast over bright cover images. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The glass-action-bar variant overrode the article card title to line-clamp-2, breaking the standard feed guideline of a fixed three-line title area (ellipsis beyond three lines, reserved height so short titles don't change card height). min-h-cardGlass is only shorter than min-h-card because the action bar floats over the cover image instead of taking its own row — the title's vertical budget is unchanged — so there was no reason to drop a line. Let the glass card fall through to the default CardTitle clamp (line-clamp-3), matching the non-glass production card. Verified card heights stay equal across titles of 1–3 lines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds an impressions stat to the floating glass action bar, placed right after the comments button (upvote · comment · impressions · downvote · bookmark · copy link). It reuses the post-page AnalyticsIcon and shows the post's view count, and is gated with canViewPostAnalytics so — like the post page — only the author or a team member sees it. - Source the count from the feed `views` field (already selected by FEED_POST_INFO_FRAGMENT; no extra query cost) and type it on Post. - Drop the fixed gap and trim the counter padding so the sixth action still fits a narrow card; justify-between keeps the five-action (non-author) bar evenly spaced and unchanged. Also hardens useFitFontSize from the prior review: it now tracks the element with a callback ref so the measure/resize effects run even when the title mounts late (e.g. after a feedback card is dismissed), instead of a one-shot empty-dependency observer that never attached. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…st bars - Glass feed bar: shrink icons (20→16px) and buttons (Small→XSmall, pill h-10→h-8) so the bar is more compact and all six actions — including impressions — fit a narrow feed-card width without clipping. - Impressions are now a public stat (ungated) sourced from post.views, shown on every card right after the comment action. - Add the same impressions stat (analytics icon + count) after comment to the post action bars the post view actually renders: classic PostActions, PostActions.v2, and the redesigned FocusCardActionBar. - Select `views` in SHARED_POST_INFO_FRAGMENT so the post detail has the count. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… bar Reduce the post engagement bar buttons themselves (not just icons): CardAction bars (PostActions.v2, FocusCardActionBar) use density="compact" (Small / 20px), and the classic PostActions QuaternaryButtons drop to ButtonSize.Small. Bookmark, post menu and close in the focus bar match the smaller size so the row stays uniform. The glass feed bar stays at its XSmall size. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…essions # Conflicts: # packages/shared/src/components/cards/article/ArticleFeaturedWideGridCard.tsx # packages/shared/src/components/cards/common/FeedCardGlassActions.tsx
- Restore the floating bar to its original h-10 height (it had been shrunk to h-8) while keeping the smaller XSmall buttons. - Always render the impressions counter (even at 0) instead of hiding it when the count is falsy. The number was disappearing whenever post.views was 0/ null; impressions is a public stat shown to everyone, so it now always shows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The feed doesn't return real per-post impressions yet (post.views is empty), so the impressions number rendered as 0/blank. Add getPostImpressions: use the real post.views when present, otherwise a stable, realistic-looking number (~100K–3M) derived from the post id so the impressions UI can be reviewed on a preview build. Used by the glass feed card bar and all three post action bars; the count renders next to the analytics icon exactly like the upvote/comment counters. MOCK: the fallback is clearly marked for the engineer to drop once the API exposes real feed impressions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The compact (smaller button + icon) treatment should apply to the feed card glass bar only. Restore the post engagement bars to their original sizes: remove density="compact" from the CardAction bars (PostActions.v2, FocusCardActionBar), drop the ButtonSize.Small overrides from the classic PostActions, and put the focus bar's bookmark/menu/close back to Medium. The impressions action stays in all three bars, now at the default size. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…deline The button typography guideline is medium weight — the Button base and CardAction already use font-medium, while the (deprecated) QuaternaryButton hard-coded font-bold on its label. Default it to font-medium so action-bar counts/labels match the guideline. Call sites that pass an explicit weight via labelClassName still override it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Place the impressions (analytics) action last — after the copy-link/share button — instead of right after comments, across the glass feed bar and all three post action bars (classic, v2, focus card). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Format the impressions count like X/Twitter: a decimal is shown only while the abbreviated value is below 10 (1.2K, 1.8M) and dropped once it reaches double digits (12K, 137K, 45M), so the decimal point isn't displayed at every magnitude. Applied at all resolutions. Add an optional `format` override to InteractionCounter (and `countFormat` to CardAction), defaulting to the existing largeNumberFormat, and pass formatImpressions only for the impressions counter — upvotes/comments keep their current formatting. Widen the formatter param types to number | null so the override composes cleanly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Optical alignment: a number reads tighter against an edge than an icon, so the glass bar now uses asymmetric padding (pl-1 pr-2.5) — the left edge holds the upvote icon, the right edge holds the impressions number, which needs more padding to look balanced (per jakub.kr "details that make interfaces feel better"). - Non-author popup: clicking impressions opens an X/Twitter-style "Views" explainer (daily.dev modal styling, X-like copy) via a new LazyModal (PostImpressions). usePostImpressionsModal wires it across the glass bar and all three post action bars; the post author/team get no popup (they own the stat), so the click is a no-op for them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s → popup The impressions click did nothing for the post owner or daily.dev team members: canViewPostAnalytics returns true for them, and the hook returned undefined (no handler). It now always returns a handler — owners/team go to the post analytics page, everyone else opens the X-style explainer popup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…esolutions) Bring the impressions action to the non-glass ActionButtons (V1 and V2) so list cards and the standard grid/signal bars match the glass feed bar across all resolutions: analytics icon + X/Twitter-style count (formatImpressions) placed last after copy-link, owner/team → analytics page, everyone else → the explainer popup (usePostImpressionsModal). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…atch glass - On small resolutions (below laptop) the standard ActionButtons now shrink to the glass feed bar's size (ButtonSize.XSmall + 16px icons) for consistency; laptop and up keep the regular Small size. - Reorder to match the glass bar: downvote moves to the 3rd position (upvote, comment, downvote, …) in both V1 and V2. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s counter - Hide the award action in the feed below laptop (tablet + mobile), matching the glass bar which drops it entirely. - Fix the impressions counter styling: its wrapper was missing the btn-tertiary-cheese class, so the number rendered in text-primary (darker) instead of the muted rest colour used by the upvote/comment counters. Now all feed stat numbers share the same colour, size and weight. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tats The glass bar and classic post bar impressions buttons were missing the btn-tertiary-cheese class on their wrapper, so the number kept its rest colour on hover. Adding it wires --button-hover-color to the cheese accent, so the impressions count turns yellow on hover just like upvote (avocado) / comment (blueCheese). The CardAction-based bars already inherit this via their color prop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ed bar Stop shrinking the feed action buttons below laptop — keep the full-size icons (Small button / 20px icons) so they read as the primary affordance — and instead shrink the stat counters to typo-caption1 on mobile/tablet. Desktop counters are unchanged. Applied to all counters (upvote, comment, impressions) for a consistent look. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…icky bar Article post page/modal: - Stats row: replace the blue "Post analytics" button with an impressions stat styled exactly like the comment count (tertiary ClickableText), placed right after comments, that opens the analytics page on click. Shown when the API returns impressions (author/team), same gating the button had. - Sticky focus action bar: move the impressions action from the right group to the left, right after the comment, so it stays next to comments when pinned. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On the post page/modal the impressions belong with the other counts (upvotes, comments, awards) in the stats strip — where the old blue "Post analytics" link used to be — not as an action in the bar. Remove the impressions action from the post action bars (FocusCardActionBar + classic PostActions v1/v2). The feed action bars keep their impressions button unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The stats-strip impressions only rendered when the API returned `analytics.impressions` (author/team-gated), so it was invisible in most environments. Use the shared getPostImpressions helper (real `views`, else the deterministic mock) so the impressions stat is always visible on the post page/modal strip for review — scoped to the non-compact strip so the compact post embed stays clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The InteractionCounter is a fixed h-5 (20px) box with top-aligned content, so smaller type — typo-caption1 (16px line-height) on the mobile/tablet feed action bars — sat visibly higher than the icon. Center the number within the box (justify-center at rest, leading-5 on the rolling slices) so upvote, comment and impressions counts line up with their icons at every resolution. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
getPostImpressions now returns the real value (analytics.impressions, then views) when present and only falls back to the deterministic mock when both are missing — so the post page shows the real impressions count (fixes the PostPage "shows impressions" test) while still staying visible for review when there is no data. Drop the impressions assertion from the compact ContentEmbeds spec, which no longer renders impressions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
A standalone PR (independent of the floating-bar fix PR) that adds an impressions stat to the engagement bars and tightens the glass feed bar. It carries the glass-bar foundation as its baseline and builds the impressions feature on top.
Impressions stat (new)
post.views(already selected by the feed fragment; now also selected inSharedPostInfoso the post detail has it, and typed on thePostmodel).PostActions,PostActions.v2, and the redesignedFocusCardActionBar.Glass bar polish
Small→XSmall, pillh-10→h-8) so the bar is more compact and all six actions fit a narrow feed-card width without clipping (verified down to a 264px pill, including a worst-case card with three K-counts). Padding stays equal on all four sides.Baseline (carried from the glass-bar work)
useFitFontSize) so the TLDR stays visible; the hook tracks its node via a callback ref so it measures even when the title mounts late.Events
No new tracking events.
Experiment
No new experiments. The glass feed bar stays behind the existing
feed_card_glass_actionsflag; the post bars stay behind their existingpost_redesign/engagement_bar_v2flags.Manual Testing
Verified the glass feed bar in the
Glass Actions GridStorybook story (flag forced on locally): impressions renders after comment, icons/buttons are smaller, and all six actions fit a 264px pill with no clipping across varied counts. The post action bars were validated by strict typecheck + lint and by mirroring the existing comment/upvote button patterns (CardAction's built-incount); they have no Storybook story and need full app context to render. Strict typecheck, ESLint, and theArticleGrid+ArticleFeaturedWideGridCardsuites pass.Preview domain
https://claude-feed-card-impressions.preview.app.daily.dev