@@ -69,6 +69,22 @@ function App() {
6969  const  [ tps ,  setTps ]  =  useState ( null ) ; 
7070  const  [ numTokens ,  setNumTokens ]  =  useState ( null ) ; 
7171
72+   // Mobile detection 
73+   const  [ isMobile ,  setIsMobile ]  =  useState ( false ) ; 
74+   const  [ isIPhone ,  setIsIPhone ]  =  useState ( false ) ; 
75+ 
76+   useEffect ( ( )  =>  { 
77+     const  checkMobile  =  ( )  =>  { 
78+       const  userAgent  =  navigator . userAgent  ||  navigator . vendor  ||  window . opera ; 
79+       const  isMobileDevice  =  / a n d r o i d | w e b o s | i p h o n e | i p a d | i p o d | b l a c k b e r r y | i e m o b i l e | o p e r a   m i n i / i. test ( userAgent . toLowerCase ( ) ) ; 
80+       const  isIPhoneDevice  =  / i p h o n e / i. test ( userAgent . toLowerCase ( ) ) ; 
81+       setIsMobile ( isMobileDevice ) ; 
82+       setIsIPhone ( isIPhoneDevice ) ; 
83+     } ; 
84+ 
85+     checkMobile ( ) ; 
86+   } ,  [ ] ) ; 
87+ 
7288  function  onEnter ( message )  { 
7389    // Prevent queueing multiple messages 
7490    if  ( status  ===  "loading"  &&  queuedMessage )  { 
@@ -348,6 +364,41 @@ function App() {
348364    } 
349365  } ,  [ messages ,  isRunning ] ) ; 
350366
367+   // Show mobile warning if on mobile device 
368+   if  ( isMobile )  { 
369+     return  ( 
370+       < div  className = "flex flex-col items-center justify-center h-screen px-6 bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200" > 
371+         < div  className = "max-w-md text-center space-y-6" > 
372+           < div  className = "text-6xl mb-4" > { isIPhone  ? "📱"  : "🚫" } </ div > 
373+           < h1  className = "text-2xl font-bold" > 
374+             { isIPhone  ? "iPhone Not Supported"  : "Device Not Supported" } 
375+           </ h1 > 
376+           < p  className = "text-gray-600 dark:text-gray-400 leading-relaxed" > 
377+             { isIPhone  
378+               ? "This application requires a desktop browser. For AI chat on iPhone, we recommend using Enclave AI instead." 
379+               : "This application requires a desktop browser." 
380+             } 
381+           </ p > 
382+           { isIPhone  &&  ( 
383+             < > 
384+               < a 
385+                 href = "https://enclaveai.app/" 
386+                 target = "_blank" 
387+                 rel = "noopener noreferrer" 
388+                 className = "inline-block px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white font-medium rounded-lg transition-colors" 
389+               > 
390+                 Open Enclave AI
391+               </ a > 
392+               < p  className = "text-sm text-gray-500 dark:text-gray-500" > 
393+                 Enclave AI offers secure, private AI conversations on iPhone.
394+               </ p > 
395+             </ > 
396+           ) } 
397+         </ div > 
398+       </ div > 
399+     ) ; 
400+   } 
401+ 
351402  return  IS_WEBGPU_AVAILABLE  ? ( 
352403    < div  className = "flex flex-col h-screen mx-auto items justify-end text-gray-800 dark:text-gray-200 bg-white dark:bg-gray-900" > 
353404      { /* New Chat button and Model selector - top left */ } 
0 commit comments