Skip to content

Commit a536f2a

Browse files
committed
warning if on mobile
1 parent ff745d5 commit a536f2a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

src/App.jsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase());
80+
const isIPhoneDevice = /iphone/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

Comments
 (0)