Skip to content

Commit 10e167a

Browse files
committed
feat: mobile gateway connect UX — auto-expand, larger inputs, context-aware
- Auto-expand manual connection form on mobile (no toggle needed) - Empty URL field on mobile (no localhost default) - Hide 'Retry connection' button on mobile (no local gateway) - Larger touch targets for inputs (py-3, 14px font) on mobile - Mobile-specific placeholder: wss://your-gateway.ts.net - Connection tips instead of 'run openclaw gateway start' - Disable autocapitalize/autocorrect on URL input - Wider container (320px max)
1 parent dc2720e commit 10e167a

1 file changed

Lines changed: 49 additions & 24 deletions

File tree

components/agent-panel.tsx

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ import {
7070

7171
function AgentConnectPrompt() {
7272
const { status, error, connect } = useGateway()
73-
const [showManual, setShowManual] = useState(false)
74-
const [url, setUrl] = useState('ws://localhost:18789')
73+
const isMobileDevice = typeof window !== 'undefined' && window.innerWidth <= 768
74+
const [showManual, setShowManual] = useState(isMobileDevice) // auto-expand on mobile
75+
const [url, setUrl] = useState(isMobileDevice ? '' : 'ws://localhost:18789')
7576
const [password, setPassword] = useState('')
7677

7778
const isConnecting = status === 'connecting' || status === 'authenticating'
@@ -111,19 +112,23 @@ function AgentConnectPrompt() {
111112
<h3 className="text-[16px] font-semibold text-[var(--text-primary)] mb-1.5">
112113
Gateway not found
113114
</h3>
114-
<p className="text-[13px] text-[var(--text-tertiary)] leading-relaxed mb-4 max-w-[280px]">
115-
Make sure OpenClaw is running on this machine.
115+
<p className="text-[13px] text-[var(--text-tertiary)] leading-relaxed mb-4 max-w-[320px]">
116+
{isMobileDevice
117+
? 'Enter your gateway URL and password to connect.'
118+
: 'Make sure OpenClaw is running on this machine.'}
116119
</p>
117120

118-
<div className="space-y-2.5 w-full max-w-[280px]">
119-
<button
120-
onClick={() => connect('ws://localhost:18789', '')}
121-
className="w-full flex items-center justify-center gap-2 py-2.5 rounded-lg text-[13px] font-medium transition-all cursor-pointer"
122-
style={{ backgroundColor: 'var(--brand)', color: 'var(--brand-contrast, #fff)' }}
123-
>
124-
<Icon icon="lucide:refresh-cw" width={14} height={14} />
125-
Retry connection
126-
</button>
121+
<div className="space-y-2.5 w-full max-w-[320px]">
122+
{!isMobileDevice && (
123+
<button
124+
onClick={() => connect('ws://localhost:18789', '')}
125+
className="w-full flex items-center justify-center gap-2 py-2.5 rounded-lg text-[13px] font-medium transition-all cursor-pointer"
126+
style={{ backgroundColor: 'var(--brand)', color: 'var(--brand-contrast, #fff)' }}
127+
>
128+
<Icon icon="lucide:refresh-cw" width={14} height={14} />
129+
Retry connection
130+
</button>
131+
)}
127132

128133
<button
129134
onClick={() => setShowManual((v) => !v)}
@@ -142,8 +147,11 @@ function AgentConnectPrompt() {
142147
onKeyDown={(e) => {
143148
if (e.key === 'Enter') handleConnect()
144149
}}
145-
placeholder="ws://localhost:18789"
146-
className="w-full px-3 py-2 rounded-lg bg-[var(--bg)] border border-[var(--border)] text-[12px] font-mono text-[var(--text-primary)] placeholder:text-[var(--text-disabled)] outline-none focus:border-[var(--border-focus)]"
150+
placeholder="wss://your-gateway.ts.net"
151+
className="w-full px-3 py-3 sm:py-2 rounded-lg bg-[var(--bg)] border border-[var(--border)] text-[14px] sm:text-[12px] font-mono text-[var(--text-primary)] placeholder:text-[var(--text-disabled)] outline-none focus:border-[var(--border-focus)]"
152+
autoCapitalize="off"
153+
autoCorrect="off"
154+
spellCheck={false}
147155
/>
148156
<input
149157
type="password"
@@ -153,12 +161,12 @@ function AgentConnectPrompt() {
153161
if (e.key === 'Enter') handleConnect()
154162
}}
155163
placeholder="Password (if set)"
156-
className="w-full px-3 py-2 rounded-lg bg-[var(--bg)] border border-[var(--border)] text-[12px] font-mono text-[var(--text-primary)] placeholder:text-[var(--text-disabled)] outline-none focus:border-[var(--border-focus)]"
164+
className="w-full px-3 py-3 sm:py-2 rounded-lg bg-[var(--bg)] border border-[var(--border)] text-[14px] sm:text-[12px] font-mono text-[var(--text-primary)] placeholder:text-[var(--text-disabled)] outline-none focus:border-[var(--border-focus)]"
157165
/>
158166
<button
159167
onClick={handleConnect}
160168
disabled={!url.trim()}
161-
className="w-full py-2 rounded-lg text-[12px] font-medium bg-[var(--bg-subtle)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors cursor-pointer disabled:opacity-50"
169+
className="w-full py-3 sm:py-2 rounded-lg text-[14px] sm:text-[12px] font-medium bg-[var(--bg-subtle)] text-[var(--text-secondary)] hover:bg-[var(--bg-tertiary)] transition-colors cursor-pointer disabled:opacity-50"
162170
>
163171
Connect
164172
</button>
@@ -173,13 +181,30 @@ function AgentConnectPrompt() {
173181
</div>
174182
)}
175183

176-
<p className="mt-5 text-[11px] text-[var(--text-disabled)]">
177-
Run{' '}
178-
<code className="px-1 py-0.5 bg-[var(--bg-secondary)] rounded text-[var(--brand)]">
179-
openclaw gateway start
180-
</code>{' '}
181-
to start
182-
</p>
184+
{isMobileDevice ? (
185+
<div className="mt-5 text-[11px] text-[var(--text-disabled)] text-left max-w-[320px] space-y-1">
186+
<p className="font-medium text-[var(--text-tertiary)]">Connection tips:</p>
187+
<p>• Use your Tailscale Funnel or local network URL</p>
188+
<p>
189+
• Format:{' '}
190+
<code className="px-1 py-0.5 bg-[var(--bg-secondary)] rounded text-[var(--brand)]">
191+
wss://host:port
192+
</code>{' '}
193+
or{' '}
194+
<code className="px-1 py-0.5 bg-[var(--bg-secondary)] rounded text-[var(--brand)]">
195+
ws://ip:18789
196+
</code>
197+
</p>
198+
</div>
199+
) : (
200+
<p className="mt-5 text-[11px] text-[var(--text-disabled)]">
201+
Run{' '}
202+
<code className="px-1 py-0.5 bg-[var(--bg-secondary)] rounded text-[var(--brand)]">
203+
openclaw gateway start
204+
</code>{' '}
205+
to start
206+
</p>
207+
)}
183208
</>
184209
)}
185210
</div>

0 commit comments

Comments
 (0)