openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

feat(assistant): show the user's mascot on the "Talk to Tiny" chip

Open graycyrus opened this issue 5 months ago β€’ 3 comments

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 Ghosty SVG (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 β€” new animated?: boolean prop threaded to useMascotClock(active)
  • Accounts.tsx β€” face-mode chip now renders the avatar + group-hover:animate-wiggle
  • tailwind.config.js β€” new wiggle keyframe/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 typecheck passes
  • [x] pnpm lint passes (0 errors; my files add 0 warnings)
  • [x] pnpm format:check passes
  • [x] pnpm build passes
  • [x] Vitest: MascotChipAvatar + existing Ghosty/CustomGifMascot suites 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

graycyrus avatar Jun 10 '26 12:06 graycyrus

Review Change Stack

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[bot] avatar Jun 10 '26 12:06 coderabbitai[bot]

@coderabbitai review

graycyrus avatar Jun 10 '26 13:06 graycyrus

βœ… Action performed

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.

coderabbitai[bot] avatar Jun 10 '26 13:06 coderabbitai[bot]