feat(assistant): show the user's mascot on the "Talk to Tiny" chip
Summary
The face-mode toggle in the top-right of the assistant page is the door to the mascot panel β clicking it reveals the user's live mascot. Yet it advertised a generic π emoji, disconnected from the mascot it opens.
This swaps that emoji for the user's actual mascot:
- Custom GIF set β small circular avatar of their GIF
- Otherwise β a palette-tinted
GhostySVG (their mascot colour, incl. custom primary)
The chip is static at rest (zero rAF cost) and the mascot wakes up with a playful wiggle on hover/focus β making the button an attraction rather than a utility label. Chip stays the same size in both states; only the text/active styling toggles, as before.
Why it's cheap
A corner avatar must not spin up a second WebGL animation runtime. New MascotChipAvatar composes the GIF or the lightweight Ghosty SVG β never the heavy RiveMascot. Ghosty gained an opt-out animated prop (default true, fully backward-compatible) so the chip can render a frozen, zero-rAF pose.
Changes
MascotChipAvatar.tsx(new) β reusable compact mascot avatar (GIF or static Ghosty)Ghosty.tsxβ newanimated?: booleanprop threaded touseMascotClock(active)Accounts.tsxβ face-mode chip now renders the avatar +group-hover:animate-wiggletailwind.config.jsβ newwigglekeyframe/animation- Tests for
MascotChipAvatar(GIF vs SVG variant, palette/custom tint, sizing)
No new i18n keys (reuses existing assistant.faceMode.on/off; avatar is aria-hidden, button keeps its label).
Test plan
- [x]
pnpm typecheckpasses - [x]
pnpm lintpasses (0 errors; my files add 0 warnings) - [x]
pnpm format:checkpasses - [x]
pnpm buildpasses - [x] Vitest:
MascotChipAvatar+ existingGhosty/CustomGifMascotsuites green (19 tests)
Summary by CodeRabbit
-
New Features
- Face-mode toggle now shows your mascot avatar with GIF support and custom primary color; new compact Mascot avatar component introduced
- Added selectable "flat" visual variant for mascot artwork
-
Style
- Hover/focus "wiggle" animation added to mascot avatars
-
Tests
- Added tests covering avatar rendering, GIF fallback, color tinting, and flat-variant appearance
No actionable comments were generated in the recent review. π
βΉοΈ Recent review info
βοΈ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 642000d5-8072-4cea-84dd-6674cecfc230
π₯ Commits
Reviewing files that changed from the base of the PR and between 2725f5a8e891b1a7d9e30c55ff28d10aa251004d and f546fe7fc86717bde6647d97c87d3c97e532ffbf.
π Files selected for processing (1)
app/src/features/human/Mascot/Defs.tsx
π§ Files skipped from review as they are similar to previous changes (1)
- app/src/features/human/Mascot/Defs.tsx
π Walkthrough
Walkthrough
Extends Ghosty with a "flat" visual variant and optional animation control, adds a reusable MascotChipAvatar (GIF or flat Ghosty SVG), introduces shadeHex for color shading with tests, adds a Tailwind wiggle animation, and uses the avatar in the Accounts face-mode toggle.
Changes
Mascot Avatar Feature
| Layer / File(s) | Summary |
|---|---|
Color shading utility foundation app/src/features/human/Mascot/mascotPalette.ts, app/src/features/human/Mascot/mascotPalette.test.ts |
New shadeHex(hex, amount) lightens or darkens #rrggbb hex colors by a fraction in [-1, 1]. Tests verify positive/negative shading, hex normalization without #, and malformed input fallback. |
Ghosty variant and animation control app/src/features/human/Mascot/Defs.tsx, app/src/features/human/Mascot/Ghosty.tsx |
GhostyDefs and Ghosty accept variant (`'shaded' |
MascotChipAvatar component with tests app/src/features/human/Mascot/MascotChipAvatar.tsx, app/src/features/human/Mascot/MascotChipAvatar.test.tsx, app/src/features/human/Mascot/index.ts |
New MascotChipAvatar derives bodyColor from theme or customPrimary, conditionally renders a GIF <img> or a flat Ghosty SVG (animated={false}, variant="flat"), applies size styling, and is exported from the Mascot index. Tests validate GIF/SVG rendering, custom/palette color usage, flat-mode gradient stops, and size styles. |
Wiggle animation keyframes app/tailwind.config.js |
Adds Tailwind animation wiggle (0.5s ease-in-out) and wiggle keyframes (rotation at 0%/100%, 25%, 75%) used for avatar hover/focus. |
Face toggle UI with animated avatar app/src/pages/Accounts.tsx, app/src/pages/__tests__/Accounts.faceToggle.test.tsx |
Replaces the static emoji in the face-mode toggle with MascotChipAvatar, passes selectors for mascot color/GIF, wraps the avatar to animate on hover/focus, and updates the test mock to stub MascotChipAvatar. |
Estimated code review effort
π― 3 (Moderate) | β±οΈ ~22 minutes
Suggested labels
feature
Suggested reviewers
- sanil-23
Poem
A rabbit paints a ghost in light and flat, With tiny shades and edges sharp and sat, It wiggles in the toggle, neat and spry, A cheerful face that colors up the sky, Hooray β the mascot waves a glowy hat! πβ¨
π₯ Pre-merge checks | β 4 | β 1
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
β Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title accurately and clearly describes the main change: adding the user's mascot to the 'Talk to Tiny' chip, which is the primary objective and focus of this PR. |
| Linked Issues check | β Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | β Passed | Check skipped because no linked issues were found for this pull request. |
βοΈ Tip: You can configure your own custom pre-merge checks in the settings.
Comment @coderabbitai help to get the list of available commands and usage tips.
@coderabbitai review
Review finished. Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.β
Action performed