Spaces:
Sleeping
Sleeping
fix: optimize for mobile
Browse files- src/app/layout.tsx +1 -0
- src/components/WebsocketDemo.tsx +6 -7
- src/components/ui/input.tsx +1 -1
src/app/layout.tsx
CHANGED
|
@@ -18,6 +18,7 @@ export default function RootLayout({
|
|
| 18 |
}) {
|
| 19 |
return (
|
| 20 |
<html lang="en">
|
|
|
|
| 21 |
<body className={inter.className}>{children}</body>
|
| 22 |
</html>
|
| 23 |
)
|
|
|
|
| 18 |
}) {
|
| 19 |
return (
|
| 20 |
<html lang="en">
|
| 21 |
+
{/* <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"></meta> */}
|
| 22 |
<body className={inter.className}>{children}</body>
|
| 23 |
</html>
|
| 24 |
)
|
src/components/WebsocketDemo.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export function WebsocketDemo() {
|
|
| 25 |
const canvasRef = useRef<HTMLCanvasElement>(null); // Reference to the canvas element
|
| 26 |
|
| 27 |
const sendInput = useCallback(() => {
|
| 28 |
-
if (status == "reconnecting")
|
| 29 |
return
|
| 30 |
|
| 31 |
if (ws?.readyState == ws?.CLOSED) {
|
|
@@ -60,6 +60,7 @@ export function WebsocketDemo() {
|
|
| 60 |
}, [debouncedPrompt])
|
| 61 |
|
| 62 |
const connectWS = useCallback((data: NonNullable<Awaited<ReturnType<typeof getWebsocketUrl>>>) => {
|
|
|
|
| 63 |
const websocket = new WebSocket(data.ws_connection_url);
|
| 64 |
websocket.binaryType = "arraybuffer";
|
| 65 |
websocket.onopen = () => {
|
|
@@ -155,20 +156,18 @@ export function WebsocketDemo() {
|
|
| 155 |
}, [connectWS, reconnectCounter])
|
| 156 |
|
| 157 |
return (
|
| 158 |
-
<div className='flex flex-col gap-2'>
|
| 159 |
<div className='flex gap-2'>
|
| 160 |
<Badge variant={'outline'} className='w-fit'>Status: {status}</Badge>
|
| 161 |
-
<Badge variant={'outline'} className='w-fit'>
|
| 162 |
{currentLog}
|
| 163 |
{status == "connected" && !currentLog && "stating comfy ui"}
|
| 164 |
{status == "ready" && !currentLog && " running"}
|
| 165 |
-
</Badge>
|
| 166 |
</div>
|
| 167 |
-
<canvas ref={canvasRef} className='rounded-lg' width="1024" height="1024"></canvas>
|
| 168 |
-
|
| 169 |
|
| 170 |
<Input
|
| 171 |
-
id="picture"
|
| 172 |
type="text"
|
| 173 |
value={prompt}
|
| 174 |
onChange={(e) => setPrompt(e.target.value)}
|
|
|
|
| 25 |
const canvasRef = useRef<HTMLCanvasElement>(null); // Reference to the canvas element
|
| 26 |
|
| 27 |
const sendInput = useCallback(() => {
|
| 28 |
+
if (status == "reconnecting" || status == "connecting")
|
| 29 |
return
|
| 30 |
|
| 31 |
if (ws?.readyState == ws?.CLOSED) {
|
|
|
|
| 60 |
}, [debouncedPrompt])
|
| 61 |
|
| 62 |
const connectWS = useCallback((data: NonNullable<Awaited<ReturnType<typeof getWebsocketUrl>>>) => {
|
| 63 |
+
setStatus("connecting");
|
| 64 |
const websocket = new WebSocket(data.ws_connection_url);
|
| 65 |
websocket.binaryType = "arraybuffer";
|
| 66 |
websocket.onopen = () => {
|
|
|
|
| 156 |
}, [connectWS, reconnectCounter])
|
| 157 |
|
| 158 |
return (
|
| 159 |
+
<div className='flex md:flex-col gap-2 px-2 flex-col-reverse'>
|
| 160 |
<div className='flex gap-2'>
|
| 161 |
<Badge variant={'outline'} className='w-fit'>Status: {status}</Badge>
|
| 162 |
+
{(currentLog || status == "connected" || status == "ready") && <Badge variant={'outline'} className='w-fit'>
|
| 163 |
{currentLog}
|
| 164 |
{status == "connected" && !currentLog && "stating comfy ui"}
|
| 165 |
{status == "ready" && !currentLog && " running"}
|
| 166 |
+
</Badge>}
|
| 167 |
</div>
|
| 168 |
+
<canvas ref={canvasRef} className='rounded-lg ring-1 ring-black/10' width="1024" height="1024"></canvas>
|
|
|
|
| 169 |
|
| 170 |
<Input
|
|
|
|
| 171 |
type="text"
|
| 172 |
value={prompt}
|
| 173 |
onChange={(e) => setPrompt(e.target.value)}
|
src/components/ui/input.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
| 11 |
<input
|
| 12 |
type={type}
|
| 13 |
className={cn(
|
| 14 |
-
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-
|
| 15 |
className
|
| 16 |
)}
|
| 17 |
ref={ref}
|
|
|
|
| 11 |
<input
|
| 12 |
type={type}
|
| 13 |
className={cn(
|
| 14 |
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-md ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
| 15 |
className
|
| 16 |
)}
|
| 17 |
ref={ref}
|