Skip to content

feat(announcements): add a discord icon key for chat-sourced announcements - #27

Merged
KruGoL merged 1 commit into
mainfrom
feat/announcement-discord-icon
Aug 5, 2026
Merged

feat(announcements): add a discord icon key for chat-sourced announcements#27
KruGoL merged 1 commit into
mainfrom
feat/announcement-discord-icon

Conversation

@KruGoL

@KruGoL KruGoL commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

An announcement imported from a Discord channel had nothing that said so at a glance — it rendered under whatever glyph its type defaults to, indistinguishable from one an admin typed into the composer.

What changed

  • New discord key in ANNOUNCEMENT_ICON_KEYS, mapped in ANNOUNCEMENT_ICONS.
  • DiscordIcon.tsx — lucide-react carries no brand marks (they were split out of the icon set upstream), so the glyph is drawn in this package against lucide's own component contract: same props, same ref target, currentColor by default. Call sites keep reading ANNOUNCEMENT_ICONS and know nothing about the difference. Filled rather than stroked, because a brand mark redrawn as outlines stops reading as that brand.

Compatibility

Consumers on an older build of this package are unaffected: iconForAnnouncement already falls back to the type default for a key it does not recognise, rather than rendering an empty square. That is what makes it safe for sphere-api to start writing icon: 'discord' before this release reaches the portals.

Follow-up for consumers (compile-time gated, not silent)

sphere-backoffice's ICON_LABELS is typed Record<AnnouncementIconKey, string>, so bumping this package there will fail typecheck until a discord: 'Discord' entry is added. That is the type doing its job — the bump PR carries the label.

Tests

src/components/announcements/__tests__/icons.test.ts — the pinned key list gains discord, plus a new case asserting the key resolves to the locally drawn component (so a refactor that loses it is caught here, not as an empty square in three portals). 59 tests pass across the announcements components; tsc --noEmit clean.

Pairs with sphere-api fix/discord-announcement-format-and-hero.

…ments

An announcement imported from a Discord channel had nothing that said so
at a glance — it rendered under whatever glyph its type defaults to,
indistinguishable from one an admin typed into the composer.

lucide-react carries no brand marks (they were split out of the icon set
upstream), so the glyph is drawn in this package against lucide own
component contract: same props, same ref target, currentColor by
default. Call sites keep reading ANNOUNCEMENT_ICONS and know nothing
about the difference.

Consumers on an older build of this package are unaffected: an icon key
they do not recognise already falls back to the type default rather than
rendering an empty square (iconForAnnouncement).
@KruGoL
KruGoL merged commit 1ceaa5e into main Aug 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant