feat(announcements): add a discord icon key for chat-sourced announcements - #27
Merged
Conversation
…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).
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.
An announcement imported from a Discord channel had nothing that said so at a glance — it rendered under whatever glyph its
typedefaults to, indistinguishable from one an admin typed into the composer.What changed
discordkey inANNOUNCEMENT_ICON_KEYS, mapped inANNOUNCEMENT_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,currentColorby default. Call sites keep readingANNOUNCEMENT_ICONSand 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:
iconForAnnouncementalready 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 writingicon: 'discord'before this release reaches the portals.Follow-up for consumers (compile-time gated, not silent)
sphere-backoffice'sICON_LABELSis typedRecord<AnnouncementIconKey, string>, so bumping this package there will fail typecheck until adiscord: '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 gainsdiscord, 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 --noEmitclean.Pairs with sphere-api
fix/discord-announcement-format-and-hero.