From 076de5d60c0610f8b0a34a9935c3700c06b84e6d Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Tue, 13 Oct 2026 15:23:31 -0400 Subject: [PATCH] feat(journals): animate the XP hint --- src/app/(frontend)/styles.css | 45 +++++++++++++++++++ .../frontend/journals/JournalFormDialog.tsx | 6 ++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/app/(frontend)/styles.css b/src/app/(frontend)/styles.css index cbabe194..0f62d2a3 100644 --- a/src/app/(frontend)/styles.css +++ b/src/app/(frontend)/styles.css @@ -312,6 +312,51 @@ } } +/* Journal "this will earn XP" hint: the sparkles pop in, then the copy wipes in + from the left half a beat later. The motion is skipped when the user asks for + reduced motion; the hint itself still shows, just without animating. */ +@keyframes journal-xp-icon-in { + from { + opacity: 0; + transform: scale(0.7); + } + to { + opacity: 1; + transform: scale(1); + } +} + +@keyframes journal-xp-text-in { + from { + opacity: 0; + clip-path: inset(0 100% 0 0); + } + 60% { + opacity: 1; + } + to { + opacity: 1; + clip-path: inset(0 0 0 0); + } +} + +.journal-xp-hint-icon { + animation: journal-xp-icon-in 0.35s ease-out both; +} + +.journal-xp-hint-text { + animation: journal-xp-text-in 0.45s ease-out 0.5s both; +} + +@media (prefers-reduced-motion: reduce) { + .journal-xp-hint-icon, + .journal-xp-hint-text { + animation: none; + opacity: 1; + clip-path: none; + } +} + .locker-search-highlight { animation: locker-search-pulse 1.1s ease-in-out infinite; box-shadow: 0 0 0 3px rgb(251 191 36 / 0.9); diff --git a/src/components/frontend/journals/JournalFormDialog.tsx b/src/components/frontend/journals/JournalFormDialog.tsx index a4097131..9799b33f 100644 --- a/src/components/frontend/journals/JournalFormDialog.tsx +++ b/src/components/frontend/journals/JournalFormDialog.tsx @@ -252,8 +252,10 @@ export function JournalFormDialog({ /> {bodyLength >= JOURNAL_XP_MIN_CHARS && (

- - {`Nice - you'll earn ${JOURNAL_XP_POINTS} XP from this journal entry!`} + + + {`Nice - you'll earn ${JOURNAL_XP_POINTS} XP from this journal entry!`} +

)}