Skip to content

Commit f202a90

Browse files
committed
feat(cli): optimize login modal sheen animation and layout
- Fixed disappearing logo bug by running animation once then stopping - Optimized animation to advance by 2 positions per frame (50% fewer renders) - Added all box-drawing shadow characters to sheen effect - Moved shadow character set to module-level constant for efficiency - Improved useEffect cleanup with calculated animation duration - Made logo more compact to fit 80-width terminals - Widened modal box from 90% to 95% of terminal width - Sheen now creates permanent fill effect on shadow characters
1 parent 09e64fd commit f202a90

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

cli/src/components/login-modal-utils.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,34 @@ export function generateFingerprintId(): string {
6060

6161
/**
6262
* Determines the color for a character based on its position relative to the sheen
63-
* Creates a "fill" effect where characters behind the sheen are filled in
63+
* Creates a "fill" effect where shadow characters permanently change to solid green as sheen passes
6464
*/
6565
export function getSheenColor(
6666
char: string,
6767
charIndex: number,
6868
sheenPosition: number,
6969
logoColor: string,
70+
shadowChars: Set<string>,
7071
): string {
71-
// Shadow characters that should have the sheen effect
72-
const shadowChars = ['╚', '═', '╝']
73-
74-
if (!shadowChars.includes(char)) {
72+
// Only apply sheen to shadow/border characters
73+
if (!shadowChars.has(char)) {
7574
return logoColor
7675
}
7776

7877
const sheenWidth = 5
7978
const distance = charIndex - sheenPosition
8079

81-
// Characters behind the sheen (already filled)
82-
if (distance < -sheenWidth) {
83-
return '#00cc00' // Filled green
80+
// Characters at the sheen (bright, solid green - the active sheen)
81+
if (distance >= -sheenWidth && distance <= 0) {
82+
return '#00ff00' // Bright solid green at the sheen
8483
}
8584

86-
// Characters at the leading edge (bright sheen)
87-
if (distance >= -sheenWidth && distance <= 0) {
88-
return '#00ff00' // Bright green at the sheen edge
85+
// Characters behind the sheen stay solid green (permanent fill effect)
86+
if (distance < -sheenWidth) {
87+
return '#00cc00' // Solid green - stays filled permanently
8988
}
9089

91-
// Characters ahead of the sheen (not yet filled)
90+
// Characters ahead of the sheen remain original color (unfilled shadow)
9291
return logoColor
9392
}
9493

cli/src/components/login-modal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const COPY_SUCCESS_COLOR = '#22c55e'
4646
const COPY_ERROR_COLOR = '#ef4444'
4747
const WARNING_COLOR = '#ef4444'
4848

49+
const SHEEN_SHADOW_CHARS = new Set(['╔', '╗', '╚', '╝', '═', '║'])
50+
4951
export const LoginModal = ({
5052
onLoginSuccess,
5153
theme,
@@ -355,7 +357,7 @@ export const LoginModal = ({
355357
return <span key={charIndex}>{char}</span>
356358
}
357359

358-
const color = getSheenColor(char, charIndex, sheenPosition, logoColor)
360+
const color = getSheenColor(char, charIndex, sheenPosition, logoColor, SHEEN_SHADOW_CHARS)
359361

360362
return (
361363
<span key={charIndex} fg={color}>

0 commit comments

Comments
 (0)