feat: transform tooltip into celebration when step completed
- Remove separate success notification components entirely - Transform existing tooltip into celebration state when isStepCompleted - Change background from blue to green gradient with enhanced shadow - Replace instructional content with "🎉 Excellent work!" message - Add celebrationPulse animation and scale(1.05) transform - Update tooltip arrow color to match celebration theme - Maintains same positioning rules and collision detection - Perfect "in your face" feedback without blocking interaction 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -436,20 +436,26 @@ function TutorialPlayerContent({
|
||||
align="center"
|
||||
sideOffset={20}
|
||||
style={{
|
||||
background: '#1e40af',
|
||||
background: isStepCompleted
|
||||
? 'linear-gradient(135deg, rgba(34, 197, 94, 0.95) 0%, rgba(21, 128, 61, 0.95) 100%)'
|
||||
: '#1e40af',
|
||||
color: 'white',
|
||||
padding: '12px 16px',
|
||||
borderRadius: '8px',
|
||||
fontSize: '14px',
|
||||
fontWeight: '700',
|
||||
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
||||
boxShadow: isStepCompleted
|
||||
? '0 8px 25px rgba(34, 197, 94, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.2)'
|
||||
: '0 4px 12px rgba(0,0,0,0.3)',
|
||||
whiteSpace: 'normal',
|
||||
maxWidth: '200px',
|
||||
minWidth: '150px',
|
||||
wordBreak: 'break-word',
|
||||
zIndex: 1000,
|
||||
opacity: 0.85,
|
||||
transition: 'opacity 0.2s ease'
|
||||
opacity: 0.95,
|
||||
transition: 'all 0.3s ease',
|
||||
transform: isStepCompleted ? 'scale(1.05)' : 'scale(1)',
|
||||
animation: isStepCompleted ? 'celebrationPulse 0.6s ease-out' : 'none'
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
e.currentTarget.style.opacity = '1'
|
||||
@@ -459,16 +465,31 @@ function TutorialPlayerContent({
|
||||
}}
|
||||
>
|
||||
<div style={{ fontSize: '12px', opacity: 0.9 }}>
|
||||
<PedagogicalDecompositionDisplay
|
||||
variant="tooltip"
|
||||
showLabel={true}
|
||||
decomposition={renderHighlightedDecomposition()}
|
||||
/>
|
||||
<span style={{ fontSize: '18px' }}>💡</span> {currentStepSummary}
|
||||
{isStepCompleted ? (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
fontSize: '14px',
|
||||
fontWeight: 'bold'
|
||||
}}>
|
||||
<span style={{ fontSize: '18px' }}>🎉</span>
|
||||
<span>Excellent work!</span>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<PedagogicalDecompositionDisplay
|
||||
variant="tooltip"
|
||||
showLabel={true}
|
||||
decomposition={renderHighlightedDecomposition()}
|
||||
/>
|
||||
<span style={{ fontSize: '18px' }}>💡</span> {currentStepSummary}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Tooltip.Arrow
|
||||
style={{
|
||||
fill: '#1e40af'
|
||||
fill: isStepCompleted ? '#15803d' : '#1e40af'
|
||||
}}
|
||||
/>
|
||||
</Tooltip.Content>
|
||||
@@ -1286,66 +1307,19 @@ function TutorialPlayerContent({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Success notification - positioned directly above the abacus */}
|
||||
{isStepCompleted && !isSuccessPopupDismissed && (
|
||||
<div
|
||||
className={css({
|
||||
position: 'absolute',
|
||||
top: '-60px',
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
zIndex: 50,
|
||||
pointerEvents: 'none',
|
||||
animation: 'bounceIn 0.4s ease-out, fadeOut 0.3s ease-in 2.2s forwards'
|
||||
})}
|
||||
>
|
||||
<div className={css({
|
||||
background: 'linear-gradient(135deg, rgba(34, 197, 94, 0.95) 0%, rgba(21, 128, 61, 0.95) 100%)',
|
||||
borderRadius: 'xl',
|
||||
px: 6,
|
||||
py: 3,
|
||||
color: 'white',
|
||||
fontSize: 'lg',
|
||||
fontWeight: 'bold',
|
||||
boxShadow: '0 8px 25px rgba(34, 197, 94, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.2)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 3,
|
||||
textShadow: '0 1px 2px rgba(0, 0, 0, 0.2)',
|
||||
whiteSpace: 'nowrap'
|
||||
})}>
|
||||
<span className={css({ fontSize: 'xl' })}>🎉</span>
|
||||
<span>Excellent!</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Add CSS animations */}
|
||||
<style jsx>{`
|
||||
@keyframes bounceIn {
|
||||
@keyframes celebrationPulse {
|
||||
0% {
|
||||
transform: translateX(-50%) scale(0.3);
|
||||
opacity: 0;
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: translateX(-50%) scale(1.05);
|
||||
}
|
||||
70% {
|
||||
transform: translateX(-50%) scale(0.95);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(-50%) scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
}
|
||||
`}</style>
|
||||
|
||||
Reference in New Issue
Block a user