Skip to content

refactor: decouple icon rendering from hardcoded component imports#7897

Closed
jeffa-block wants to merge 1 commit into
aaif-goose:mainfrom
jeffa-block:feat/glyph-packs
Closed

refactor: decouple icon rendering from hardcoded component imports#7897
jeffa-block wants to merge 1 commit into
aaif-goose:mainfrom
jeffa-block:feat/glyph-packs

Conversation

@jeffa-block
Copy link
Copy Markdown
Contributor

@jeffa-block jeffa-block commented Mar 15, 2026

Summary

FlyingBird, GooseLogo, and WelcomeGooseLogo all hardcode their icon imports directly (Bird1Bird6, Goose). This makes the rendering pipeline rigid — every consumer independently imports and manages the same set of icon components.

This PR extracts icon resolution behind a React context so consumers read from a single source of truth instead of scattering identical imports across the tree.

Changes

New files:

  • packs/types.ts — interface for an icon pack (static glyph + optional animation frames)
  • packs/goose.ts — wraps existing Goose + Bird1Bird6 components (no changes to originals)
  • packs/registry.ts — pack lookup by id
  • contexts/GlyphContext.tsx — React context + useGlyphPack() hook

Refactored consumers:

  • FlyingBird — reads animation frames from context instead of hardcoded Bird1Bird6 imports
  • GooseLogo — renders via context instead of direct Goose import
  • WelcomeGooseLogo — same
  • App.tsx — wraps tree with provider

What this is not

  • No visual changes — default pack wraps the existing icons identically
  • No new dependencies
  • No settings UI

Checklist

  • Zero visual diff — default rendering unchanged
  • All icon components untouched (Goose.tsx, Bird1–6.tsx)
  • Ready for review

@jeffa-block jeffa-block changed the title feat: add glyph packs — customisable mascot system refactor: extract mascot rendering into GlyphPack system Mar 16, 2026
@jeffa-block jeffa-block changed the title refactor: extract mascot rendering into GlyphPack system refactor: decouple icon rendering from hardcoded component imports Mar 16, 2026
FlyingBird, GooseLogo, and WelcomeGooseLogo all hardcode their icon
imports directly (Bird1-Bird6, Goose). This extracts icon resolution
behind a React context so consumers read from a single provider instead
of scattering identical imports across the tree.

New files:
- packs/types.ts: icon pack interface (static glyph + animation frames)
- packs/goose.ts: wraps existing Goose + Bird1-6 (no changes to originals)
- packs/registry.ts: pack lookup by id
- contexts/GlyphContext.tsx: React context + useGlyphPack hook

Refactored consumers:
- FlyingBird: reads animation frames from context
- GooseLogo: renders via context instead of direct Goose import
- WelcomeGooseLogo: same
- App: wraps tree with provider
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had recent activity for 23 days.

What happens next?

  • If no further activity occurs, this PR will be automatically closed in 7 days
  • To keep this PR active, simply add a comment, push new commits, or add the keep-open label
  • If you believe this PR was marked as stale in error, please comment and we'll review it

Thank you for your contribution! 🚀

@github-actions github-actions Bot added the stale label Apr 25, 2026
@lifeizhou-ap
Copy link
Copy Markdown
Collaborator

Hey @jeffa-block 👋 Closing this draft as part of some housekeeping on stale PRs. Feel free to reopen anytime if you pick this back up!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants