@@ -9,6 +9,9 @@ import { getAsciiArtWidth } from '../utils/textUtils.js';
99import { debugState } from '../debug.js' ;
1010import { themeManager } from '../themes/theme-manager.js' ;
1111import { Holiday } from '../themes/holiday.js' ;
12+ import { useUIState } from '../contexts/UIStateContext.js' ;
13+ import { useTerminalSize } from './useTerminalSize.js' ;
14+ import { shortAsciiLogo } from '../components/AsciiArt.js' ;
1215
1316interface Snowflake {
1417 x : number ;
@@ -58,23 +61,26 @@ const addHolidayTrees = (art: string): string => {
5861 return `\n\n${ art } \n${ centeredTripleTrees } \n\n` ;
5962} ;
6063
61- export const useSnowfall = (
62- art : string ,
63- options : { enabled ?: boolean } = { } ,
64- ) : string => {
64+ export const useSnowfall = ( displayTitle : string ) : string => {
6565 const currentTheme = themeManager . getActiveTheme ( ) ;
66+ const { columns : terminalWidth } = useTerminalSize ( ) ;
67+ const { history } = useUIState ( ) ;
68+
69+ const hasStartedChat = history . some ( ( item ) => item . type === 'user' ) ;
70+ const widthOfShortLogo = getAsciiArtWidth ( shortAsciiLogo ) ;
6671
6772 const enabled =
6873 isHolidaySeason &&
6974 currentTheme . name === Holiday . name &&
70- ( options . enabled ?? true ) ;
75+ terminalWidth >= widthOfShortLogo &&
76+ ! hasStartedChat ;
7177
7278 const displayArt = useMemo ( ( ) => {
7379 if ( enabled ) {
74- return addHolidayTrees ( art ) ;
80+ return addHolidayTrees ( displayTitle ) ;
7581 }
76- return art ;
77- } , [ art , enabled ] ) ;
82+ return displayTitle ;
83+ } , [ displayTitle , enabled ] ) ;
7884
7985 const [ snowflakes , setSnowflakes ] = useState < Snowflake [ ] > ( [ ] ) ;
8086 // We don't need 'frame' state if we just use functional updates for snowflakes,
0 commit comments