Skip to content

Commit 12490a0

Browse files
authored
Improve list add flow (#2393)
1 parent d3d2a06 commit 12490a0

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Packages/Lists/Sources/Lists/AddAccounts/ListAddAccountView.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public struct ListAddAccountView: View {
1010
@Environment(MastodonClient.self) private var client
1111
@Environment(Theme.self) private var theme
1212
@Environment(CurrentAccount.self) private var currentAccount
13-
@Environment(RouterPath.self) private var routerPath
1413
@State private var viewModel: ListAddAccountViewModel
14+
@State private var isPresentingCreateList = false
1515

1616
public init(account: Account) {
1717
_viewModel = .init(initialValue: .init(account: account))
@@ -20,6 +20,15 @@ public struct ListAddAccountView: View {
2020
public var body: some View {
2121
NavigationStack {
2222
List {
23+
Section {
24+
Button {
25+
isPresentingCreateList = true
26+
} label: {
27+
Label("account.list.create", systemImage: "plus")
28+
}
29+
}
30+
.listRowBackground(theme.primaryBackgroundColor)
31+
2332
ForEach(currentAccount.sortedLists) { list in
2433
HStack {
2534
Toggle(
@@ -49,20 +58,16 @@ public struct ListAddAccountView: View {
4958
.navigationTitle("lists.add-remove-\(viewModel.account.safeDisplayName)")
5059
.navigationBarTitleDisplayMode(.inline)
5160
.toolbar {
52-
ToolbarItem(placement: .navigationBarLeading) {
53-
Button {
54-
routerPath.presentedSheet = .listCreate
55-
} label: {
56-
Label("account.list.create", systemImage: "plus")
57-
}
58-
}
5961
ToolbarItem(placement: .navigationBarTrailing) {
6062
Button("action.done") {
6163
dismiss()
6264
}
6365
}
6466
}
6567
}
68+
.sheet(isPresented: $isPresentingCreateList) {
69+
ListCreateView()
70+
}
6671
.task {
6772
viewModel.client = client
6873
await viewModel.fetchInfo()

0 commit comments

Comments
 (0)