Skip to content

Commit 73fe42c

Browse files
committed
Refine iOS connection empty states
1 parent 66e351f commit 73fe42c

3 files changed

Lines changed: 42 additions & 59 deletions

File tree

apps/ios/ADE/App/ContentView.swift

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,31 @@ private struct ProjectHomeView: View {
378378
}
379379

380380
private var emptyProjects: some View {
381+
Group {
382+
if syncService.connectionState == .disconnected || syncService.connectionState == .error {
383+
noMachineConnectedCard
384+
} else {
385+
emptyProjectsActionCard
386+
}
387+
}
388+
}
389+
390+
private var noMachineConnectedCard: some View {
391+
Text("No machine connected")
392+
.font(.system(.subheadline, design: .rounded).weight(.medium))
393+
.foregroundStyle(ADEColor.textSecondary)
394+
.multilineTextAlignment(.center)
395+
.frame(maxWidth: .infinity, alignment: .center)
396+
.padding(14)
397+
.background(ADEColor.cardBackground.opacity(0.62), in: RoundedRectangle(cornerRadius: 8, style: .continuous))
398+
.overlay(
399+
RoundedRectangle(cornerRadius: 8, style: .continuous)
400+
.stroke(ADEColor.border.opacity(0.80), lineWidth: 1)
401+
)
402+
.accessibilityLabel("No machine connected")
403+
}
404+
405+
private var emptyProjectsActionCard: some View {
381406
Button {
382407
syncService.settingsPresented = true
383408
} label: {
@@ -412,7 +437,7 @@ private struct ProjectHomeView: View {
412437
switch syncService.connectionState {
413438
case .connected, .syncing: return "No projects on machine"
414439
case .connecting: return "Connecting to machine"
415-
case .error, .disconnected: return "Connect to a machine running ADE"
440+
case .error, .disconnected: return "No projects on machine"
416441
}
417442
}
418443

@@ -423,7 +448,7 @@ private struct ProjectHomeView: View {
423448
case .connecting:
424449
return syncService.hostName ?? "Projects appear after this iPhone connects"
425450
case .error, .disconnected:
426-
return "Connect first before you can see projects"
451+
return "Open a project on your machine"
427452
}
428453
}
429454
}

apps/ios/ADE/Views/Settings/ConnectionSettingsView.swift

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ struct ConnectionSettingsView: View {
4343
)
4444
.padding(.horizontal, 16)
4545

46-
SettingsTailscaleHelpSection()
47-
.padding(.horizontal, 16)
48-
4946
SettingsNotificationsSection(
5047
onPreferencesChanged: { prefs in
5148
syncService.uploadNotificationPrefs(prefs)
@@ -275,39 +272,6 @@ private final class SettingsConnectionPresentationModel: ObservableObject {
275272
}
276273
}
277274

278-
private struct SettingsTailscaleHelpSection: View {
279-
var body: some View {
280-
VStack(alignment: .leading, spacing: 10) {
281-
HStack(alignment: .center, spacing: 10) {
282-
Image(systemName: "network")
283-
.font(.system(size: 15, weight: .semibold))
284-
.foregroundStyle(ADEColor.purpleAccent)
285-
.frame(width: 28, height: 28)
286-
.background(ADEColor.purpleAccent.opacity(0.14), in: RoundedRectangle(cornerRadius: 9, style: .continuous))
287-
VStack(alignment: .leading, spacing: 2) {
288-
Text("Away from home")
289-
.font(.subheadline.weight(.semibold))
290-
.foregroundStyle(ADEColor.textPrimary)
291-
Text("Install Tailscale on this iPhone and your ADE machine. Pair once on local Wi-Fi or enter the machine's Tailscale address, then reconnect from the saved machine when you are away.")
292-
.font(.caption)
293-
.foregroundStyle(ADEColor.textSecondary)
294-
.fixedSize(horizontal: false, vertical: true)
295-
}
296-
}
297-
}
298-
.padding(14)
299-
.frame(maxWidth: .infinity, alignment: .leading)
300-
.background(
301-
RoundedRectangle(cornerRadius: 18, style: .continuous)
302-
.fill(Color.white.opacity(0.045))
303-
)
304-
.overlay(
305-
RoundedRectangle(cornerRadius: 18, style: .continuous)
306-
.strokeBorder(Color.white.opacity(0.08), lineWidth: 0.8)
307-
)
308-
}
309-
}
310-
311275
private struct SettingsAuroraBackground: View {
312276
var body: some View {
313277
ZStack {

apps/ios/ADE/Views/Settings/SettingsConnectionHeader.swift

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct SettingsConnectionHeader: View {
3939
onDisconnect: onDisconnect,
4040
onReconnect: onReconnect
4141
)
42+
.layoutPriority(1)
4243
}
4344

4445
if health.transport.isConnected {
@@ -52,7 +53,7 @@ struct SettingsConnectionHeader: View {
5253
.foregroundStyle(ADEColor.textSecondary)
5354
.fixedSize(horizontal: false, vertical: true)
5455
} else {
55-
Text("Pair a machine to start syncing lanes, work, and files.")
56+
Text("Pair once on Wi‑Fi to remotely connect later.")
5657
.font(.subheadline)
5758
.foregroundStyle(ADEColor.textSecondary)
5859
.fixedSize(horizontal: false, vertical: true)
@@ -210,33 +211,26 @@ private struct SettingsConnectionQuickAction: View {
210211
.accessibilityLabel("Disconnect from machine")
211212

212213
case .connecting:
213-
HStack(spacing: 8) {
214+
// Status copy lives in the header's leading column — keep the trailing
215+
// control compact so it never steals width from the title stack.
216+
Button {
217+
onDisconnect()
218+
} label: {
214219
HStack(spacing: 6) {
215220
ProgressView().controlSize(.mini)
216-
Text("Connecting")
217-
.font(.caption.weight(.medium))
218-
.foregroundStyle(ADEColor.textSecondary)
219-
}
220-
.padding(.horizontal, 10)
221-
.padding(.vertical, 7)
222-
.background(ADEColor.textSecondary.opacity(0.1), in: Capsule())
223-
.glassEffect()
224-
225-
// Always offer a way out of a connect attempt — `disconnect()` cancels
226-
// the in-flight attempt so the user is never stuck watching a spinner.
227-
Button {
228-
onDisconnect()
229-
} label: {
230221
Text("Cancel")
231222
.font(.caption.weight(.semibold))
232223
.foregroundStyle(ADEColor.textSecondary)
233-
.padding(.horizontal, 10)
234-
.padding(.vertical, 7)
224+
.lineLimit(1)
235225
}
236-
.buttonStyle(.plain)
237-
.background(ADEColor.textSecondary.opacity(0.1), in: Capsule())
238-
.accessibilityLabel("Cancel connecting")
226+
.padding(.horizontal, 10)
227+
.padding(.vertical, 7)
239228
}
229+
.buttonStyle(.plain)
230+
.background(ADEColor.textSecondary.opacity(0.1), in: Capsule())
231+
.glassEffect()
232+
.fixedSize(horizontal: true, vertical: false)
233+
.accessibilityLabel("Cancel connecting")
240234

241235
case .error, .disconnected:
242236
if canReconnectToSavedHost {

0 commit comments

Comments
 (0)