Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

refactor(ios): split roster row types and empty state

leepokai24b4eae23dc8
diff --git a/apps/ios/Views/BotListView.swift b/apps/ios/Views/BotListView.swift
index e8485d5b..4c50b238 100644
--- a/apps/ios/Views/BotListView.swift
+++ b/apps/ios/Views/BotListView.swift
@@ -386,90 +386,3 @@ struct BotListView: View {
}
}
-/// The item a lifted row carries (nothing): the system lets go of it when the drag or the
-/// menu ends.
-private final class LiftItem: NSItemProvider {
- private let ended: @Sendable () -> Void
-
- init(ended: @escaping @Sendable () -> Void) {
- self.ended = ended
- super.init()
- }
-
- deinit { ended() }
-}
-
-/// One row in the roster: a computer's heading or a bot, which the user can drag, or a section's
-/// heading or the "Bots" label on a computer (its id carried along: `id` can't read the main-actor store).
-private enum RosterLine: Identifiable {
- case computer(ComputerID, BotStore)
- case section(RosterSection, ComputerID, BotStore)
- case label(ComputerID)
- case bot(RosterItem, BotStore)
-
- var id: String {
- switch self {
- case let .computer(id, _): "computer:\(id)"
- case let .section(section, computerId, _): "section:\(computerId):\(section.name)"
- case let .label(computerId): "label:\(computerId)"
- case let .bot(item, _): "bot:\(item.ref.computerId):\(item.bot.id)"
- }
- }
-
- /// The computer a heading stands for.
- var computerId: ComputerID? {
- if case let .computer(id, _) = self { id } else { nil }
- }
-
- func botId(on computerId: ComputerID) -> String? {
- if case let .bot(item, _) = self, item.ref.computerId == computerId { item.bot.id } else { nil }
- }
-}
-
-private struct NewTarget: Identifiable {
- enum Kind { case bot, group }
- let id = UUID()
- let kind: Kind
- let computerId: ComputerID
-}
-
-private struct GroupTarget: Identifiable {
- let id = UUID()
- let computerId: ComputerID
- let group: Bot
-}
-
-private struct EditTarget: Identifiable {
- let id = UUID()
- let computerId: ComputerID
- let draft: BotDraft
-}
-
-private struct EmptyRoster: View {
- let canCreate: Bool
- let hasComputer: Bool
- let create: () -> Void
- let showComputers: () -> Void
-
- var body: some View {
- VStack(spacing: 14) {
- CharacterAvatar(shape: "cloud", color: "green", size: 72)
- Text(L10n.tr("No bots yet")).font(.title3.weight(.semibold)).foregroundStyle(Palette.text)
- Text(L10n.tr(hasComputer
- ? "Create a bot for each kind of work — a reviewer, a fixer, a docs writer — and point it at a project."
- : "Ask one of your account's computers for access, or pair one with its code."))
- .font(.subheadline)
- .foregroundStyle(Palette.secondary)
- .multilineTextAlignment(.center)
- if canCreate {
- Button(L10n.tr("Create your first bot"), action: create)
- .buttonStyle(.primary)
- } else if !hasComputer {
- Button(L10n.tr("Computers"), action: showComputers)
- .buttonStyle(.primary)
- }
- }
- .frame(maxWidth: .infinity)
- .padding(.vertical, 40)
- }
-}
diff --git a/apps/ios/Views/BotRosterLine.swift b/apps/ios/Views/BotRosterLine.swift
new file mode 100644
index 00000000..ff0512ea
--- /dev/null
+++ b/apps/ios/Views/BotRosterLine.swift
@@ -0,0 +1,63 @@
+import CodyncKit
+import CodyncUI
+import SwiftUI
+
+/// The item a lifted row carries (nothing): the system lets go of it when the drag or the
+/// menu ends.
+final class LiftItem: NSItemProvider {
+ private let ended: @Sendable () -> Void
+
+ init(ended: @escaping @Sendable () -> Void) {
+ self.ended = ended
+ super.init()
+ }
+
+ deinit { ended() }
+}
+
+/// One row in the roster: a computer's heading or a bot, which the user can drag, or a section's
+/// heading or the "Bots" label on a computer (its id carried along: `id` can't read the main-actor store).
+enum RosterLine: Identifiable {
+ case computer(ComputerID, BotStore)
+ case section(RosterSection, ComputerID, BotStore)
+ case label(ComputerID)
+ case bot(RosterItem, BotStore)
+
+ var id: String {
+ switch self {
+ case let .computer(id, _): "computer:\(id)"
+ case let .section(section, computerId, _): "section:\(computerId):\(section.name)"
+ case let .label(computerId): "label:\(computerId)"
+ case let .bot(item, _): "bot:\(item.ref.computerId):\(item.bot.id)"
+ }
+ }
+
+ /// The computer a heading stands for.
+ var computerId: ComputerID? {
+ if case let .computer(id, _) = self { id } else { nil }
+ }
+
+ func botId(on computerId: ComputerID) -> String? {
+ if case let .bot(item, _) = self, item.ref.computerId == computerId { item.bot.id } else { nil }
+ }
+}
+
+struct NewTarget: Identifiable {
+ enum Kind { case bot, group }
+ let id = UUID()
+ let kind: Kind
+ let computerId: ComputerID
+}
+
+struct GroupTarget: Identifiable {
+ let id = UUID()
+ let computerId: ComputerID
+ let group: Bot
+}
+
+struct EditTarget: Identifiable {
+ let id = UUID()
+ let computerId: ComputerID
+ let draft: BotDraft
+}
+
diff --git a/apps/ios/Views/EmptyRoster.swift b/apps/ios/Views/EmptyRoster.swift
new file mode 100644
index 00000000..a6405fc7
--- /dev/null
+++ b/apps/ios/Views/EmptyRoster.swift
@@ -0,0 +1,32 @@
+import CodyncKit
+import CodyncUI
+import SwiftUI
+
+struct EmptyRoster: View {
+ let canCreate: Bool
+ let hasComputer: Bool
+ let create: () -> Void
+ let showComputers: () -> Void
+
+ var body: some View {
+ VStack(spacing: 14) {
+ CharacterAvatar(shape: "cloud", color: "green", size: 72)
+ Text(L10n.tr("No bots yet")).font(.title3.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(L10n.tr(hasComputer
+ ? "Create a bot for each kind of work — a reviewer, a fixer, a docs writer — and point it at a project."
+ : "Ask one of your account's computers for access, or pair one with its code."))
+ .font(.subheadline)
+ .foregroundStyle(Palette.secondary)
+ .multilineTextAlignment(.center)
+ if canCreate {
+ Button(L10n.tr("Create your first bot"), action: create)
+ .buttonStyle(.primary)
+ } else if !hasComputer {
+ Button(L10n.tr("Computers"), action: showComputers)
+ .buttonStyle(.primary)
+ }
+ }
+ .frame(maxWidth: .infinity)
+ .padding(.vertical, 40)
+ }
+}