Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cli/src/components/chat-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IS_FREEBUFF } from '../utils/constants'
import { openFileAtPath } from '../utils/open-file'
import { formatCwd } from '../utils/path-helpers'
import { getLogoAccentColor, getLogoBlockColor } from '../utils/theme-system'
import { shouldAnimateChatHeader } from '../utils/chat-header-animation'
import { TerminalLink } from './terminal-link'

export const ChatHeader = memo(function ChatHeader({
Expand All @@ -23,7 +24,7 @@ export const ChatHeader = memo(function ChatHeader({
const blockColor = getLogoBlockColor(theme.name)
const accentColor = getLogoAccentColor(theme.name)
const { applySheenToChar } = useSheenAnimation({
enabled: animationEnabled,
enabled: shouldAnimateChatHeader(animationEnabled, IS_FREEBUFF),
logoColor: theme.foreground,
accentColor,
blockColor,
Expand Down
18 changes: 18 additions & 0 deletions cli/src/utils/__tests__/chat-header-animation.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'bun:test'

import { shouldAnimateChatHeader } from '../chat-header-animation'

describe('shouldAnimateChatHeader', () => {
it('disables the sheen for the Freebuff chat header', () => {
expect(shouldAnimateChatHeader(true, true)).toBe(false)
})

it('keeps the Codebuff sheen when the header is active', () => {
expect(shouldAnimateChatHeader(true, false)).toBe(true)
})

it('does not animate an inactive header for either product', () => {
expect(shouldAnimateChatHeader(false, true)).toBe(false)
expect(shouldAnimateChatHeader(false, false)).toBe(false)
})
})
10 changes: 10 additions & 0 deletions cli/src/utils/chat-header-animation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Freebuff's chat logo sheen can make the focused input appear to flicker.
* Keep the animation for Codebuff while leaving the Freebuff chat header static.
*/
export function shouldAnimateChatHeader(
animationEnabled: boolean,
isFreebuff: boolean,
): boolean {
return animationEnabled && !isFreebuff
}
Loading