Skip to content

feat(announcements): page timeline in announcements component#459

Open
anabaarbosa wants to merge 5 commits into
mainfrom
announcements-timelinepage
Open

feat(announcements): page timeline in announcements component#459
anabaarbosa wants to merge 5 commits into
mainfrom
announcements-timelinepage

Conversation

@anabaarbosa
Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

Update to the Announcements homepage: now displays a single list with filters and search, grouped by year, with a changelog-style layout, month and day on the left, vertical line only in each year's block, expandable lines for synopsis. New AnnouncementExpandableRow and announcementTypeTags utility (EN/PT/ES) centering marker colors and type on the timeline.

Screenshots or example usage

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

@anabaarbosa anabaarbosa self-assigned this May 15, 2026
@anabaarbosa anabaarbosa added release-no No release bump effort-high We estimate the effort to solve this issue is high. ui Portal interface issues. labels May 15, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for leafy-mooncake-7c2e5e ready!

Name Link
🔨 Latest commit 611c824
🔍 Latest deploy log https://app.netlify.com/projects/leafy-mooncake-7c2e5e/deploys/6a0782f99bff03000809365d
😎 Deploy Preview https://deploy-preview-459--leafy-mooncake-7c2e5e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@PedroAntunesCosta
Copy link
Copy Markdown
Contributor

A few additions in this PR don't appear to be referenced anywhere — they'll become dead code on main if we merge as-is. Could you delete or double-check whether they're needed?

  • src/utils/capitalizeMonthHeading.ts — never imported (grepped the whole repo, no hits outside this file).
  • src/utils/getAnnouncementTypeKey.ts — never imported either. As a side effect, typeTagsByLocale was promoted to export in constants.ts only to feed this helper, so that change can also be reverted.
  • announcement_timeline.default_type in src/messages/{en,es,pt}.json — no intl.formatMessage({ id: 'announcement_timeline.default_type' }) anywhere.
  • On AnnouncementTimelineCard, the new optional props showLandingHeader, forceTimelineVisible, highlightFirstItem, createdAt, updatedAt, synopsis aren't passed by any caller (the only consumer is AnnouncementSection, which still passes just { title, date, articleLink }). That means the entire useCardLikeChrome branch in AnnouncementTimelineItem is unreachable. If the plan was to use AnnouncementTimelineCard on pages/announcements/index.tsx and AnnouncementExpandableRow is the replacement, those props (and the new cardContainerPage, synopsis, footerDate styles) can come out.

The two unrelated fixes inside AnnouncementTimelineCard (the key={announcement.articleLink} change and the <= currentDate upper bound on isNew) are nice on their own — happy to keep those.

Comment on lines +8 to +26
/** Mesmas chaves que na main: strings literais dos tags no frontmatter (EN/ES/PT). */
export const announcementTypeTagColorMap: Record<string, AnnouncementTagColor> =
{
'New feature': 'Fixed',
Improvement: 'Closed',
'Breaking change': 'Scheduled',
Deprecation: 'Gray',
Discontinuation: 'Gray',
'Security update': 'Backlog',
'Nueva funcionalidad': 'Fixed',
Mejora: 'Closed',
'Cambio disruptivo': 'Scheduled',
Descontinuación: 'Gray',
'Actualización de seguridad': 'Backlog',
'Nova funcionalidade': 'Fixed',
Melhoria: 'Closed',
Descontinuação: 'Gray',
/** Grafia alternativa comum em conteúdo legado */
Discontinuação: 'Gray',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things on this map:

  1. Silent color change on existing content. On main, the inline map inside AnnouncementCard had Deprecation, Descontinuación, and Descontinuação all mapping to the 'Deprecation' pill color (pink). Here they're remapped to 'Gray'. Is this intentional? It's the same color as Security update, I think it'd be best to have different colors. Maybe keep pink, unless it's already being used by some other badge.

  2. Verify the alt-spelling entries are needed. Standard Portuguese is Descontinuação (with e); Discontinuação (with i) is a misspelling. Same idea on the EN side — the canonical EN type label in typeTagsByLocale is Deprecation, not Discontinuation. The comment says the alt spelling exists in legacy content, but I couldn't find any announcement using these strings as a tag value — the only hits are inside announcement titles (e.g. "Discontinuation of …"), which aren't what this map keys off. Could you double-check against current frontmatter tags in help-center-content? If nothing uses them, dropping the Discontinuation and Discontinuação entries keeps the map honest.

Comment on lines +50 to +72
}

const headerProps = hasSynopsis
? {
role: 'button' as const,
tabIndex: 0,
'aria-expanded': open,
onClick: () => setOpen((v) => !v),
onKeyDown: handleHeaderKeyDown,
}
: {}

return (
<Flex sx={styles.row}>
<Box sx={styles.dateColumn}>{dateSideLabel}</Box>

<Flex sx={styles.trackColumn}>
<Box
sx={{
...styles.dot,
...dotColors,
}}
/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole header row is set up as an expand control, but the title inside it is also a link. That puts two clickable actions in one place — bad for screen readers and keyboard users (two tab stops per row, confusing labels).

The preview UX already feels right: caret expands, title opens the article. I think this is not a blocker, but I strongly recommend that you match the code to that behavior: make only the caret the expand control, and leave the title as a plain link.

Comment on lines 99 to +122

useEffect(() => {
setPage({
curr: 1,
total: Math.ceil(filteredResult.length / itemsPerPage),
})
}, [filteredResult])
/** Lista após filtros — agrupamento só por ano (changelog). */
const timelineAnnouncements = useMemo(
() =>
filteredResult.map((announcement) => ({
title: announcement.title,
publishedAt: new Date(announcement.createdAt),
articleLink: announcement.url,
synopsis: announcement.synopsis,
tags: announcement.tags,
})),
[filteredResult]
)

const paginatedResult = useMemo(() => {
return filteredResult.slice(
(page.curr - 1) * itemsPerPage,
page.curr * itemsPerPage
)
}, [page, filteredResult])
const timelineByYear = useMemo(() => {
type TimelineItem = {
title: string
publishedAt: Date
articleLink: string
synopsis?: string
tags?: string[]
}

const bucket = new Map<string, TimelineItem[]>()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With pagination gone, the page now mounts every PUBLISHED/CHANGED announcement into the DOM on first paint (no virtualization). Announcements are append-only content, so this list only grows over time.

I am not sure this is the UX we want and maybe this will also impact performance over time. If you choose to merge this PR without addressing this, please create a github issue in this repo to 'restore announcements page pagination'.


const trackColumn: SxStyleProp = {
width: '18px',
flexShrink: 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor/non-essential issue: A few raw hex values in this file (and in announcements-page.ts for the rail / year heading) look like they should be theme tokens: #9B9B9B (caret), #E0E0E0 (rail), #9AA3AE (year heading), #A1AAB7 (date column), #000711 (hover). You're already using muted.0 for releaseTitle and body, so the mix is inconsistent. Future theme adjustments will have to chase the literals. Where a brand-ui token exists, please use it. Where it doesn't yet, it's worth adding to the theme rather than baking the literal here.

@@ -0,0 +1,160 @@
import { SxStyleProp } from '@vtex/brand-ui'

/** Linha inteira: data | marcador | conteúdo (tronco único via rail absoluto na página). */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor/non-essential issue: The new styles files (announcement-expandable-row/styles.ts, announcement-timeline-card/styles.ts, announcements-page.ts) carry PT-only comments — e.g. /** Linha inteira: data | marcador | conteúdo (tronco único via rail absoluto na página). */, /** Trilho do ano só entre as linhas (eixo alinhado à coluna de pontos). */. The rest of the codebase uses EN for code comments, so it's worth translating these for consistency.

Copy link
Copy Markdown
Contributor

@PedroAntunesCosta PedroAntunesCosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the timeline UX work — the new layout is solid and centralizing the tag→color mapping in announcementTypeTags.ts is a nice cleanup.

Requesting changes for a few things before merge — left inline comments with details:

  • Blocking: a meaningful amount of dead code (unused new util files, an unused i18n key in each locale, and 6 new optional props on AnnouncementTimelineCard whose new render branch is unreachable). See the general comment.
  • Suggestions: silent color regression on the Deprecation tag (pink → gray on the existing landing-page card too); accessibility issue with the title <a> nested inside a role="button" row; and a heads-up that removing pagination renders the full announcements list unbounded.
  • Nits: hardcoded hex colors instead of theme tokens; PT-only code comments in the new styles files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort-high We estimate the effort to solve this issue is high. release-no No release bump ui Portal interface issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants