@@ -26,6 +26,7 @@ const TOTAL_WARNING_COUNT = 14;
2626const AFFECTED_FILE_COUNT = 18 ;
2727const ELAPSED_TIME = "2.1s" ;
2828
29+ const ANIMATION_COMPLETED_KEY = "react-doctor-animation-completed" ;
2930const COMMAND = "npx -y react-doctor@latest ." ;
3031const GITHUB_URL = "https://github.com/aidenybai/react-doctor" ;
3132const GITHUB_ICON_PATH =
@@ -277,10 +278,38 @@ const INITIAL_STATE: AnimationState = {
277278 showSummary : false ,
278279} ;
279280
281+ const COMPLETED_STATE : AnimationState = {
282+ typedCommand : COMMAND ,
283+ isTyping : false ,
284+ showHeader : true ,
285+ visibleDiagnosticCount : DIAGNOSTICS . length ,
286+ showSeparator : true ,
287+ score : TARGET_SCORE ,
288+ showSummary : true ,
289+ } ;
290+
291+ const didAnimationComplete = ( ) => {
292+ try {
293+ return localStorage . getItem ( ANIMATION_COMPLETED_KEY ) === "true" ;
294+ } catch {
295+ return false ;
296+ }
297+ } ;
298+
299+ const markAnimationCompleted = ( ) => {
300+ try {
301+ localStorage . setItem ( ANIMATION_COMPLETED_KEY , "true" ) ;
302+ } catch { }
303+ } ;
304+
280305const Terminal = ( ) => {
281- const [ state , setState ] = useState < AnimationState > ( INITIAL_STATE ) ;
306+ const [ state , setState ] = useState < AnimationState > (
307+ didAnimationComplete ( ) ? COMPLETED_STATE : INITIAL_STATE ,
308+ ) ;
282309
283310 useEffect ( ( ) => {
311+ if ( didAnimationComplete ( ) ) return ;
312+
284313 let cancelled = false ;
285314
286315 const update = ( patch : Partial < AnimationState > ) => {
@@ -324,6 +353,7 @@ const Terminal = () => {
324353 await sleep ( POST_SCORE_DELAY_MS ) ;
325354 if ( cancelled ) return ;
326355 update ( { showSummary : true } ) ;
356+ markAnimationCompleted ( ) ;
327357 } ;
328358
329359 run ( ) ;
0 commit comments