diff --git a/Packages/Account/Sources/Account/AccountDetailView.swift b/Packages/Account/Sources/Account/AccountDetailView.swift index 96685bbe..ca204b52 100644 --- a/Packages/Account/Sources/Account/AccountDetailView.swift +++ b/Packages/Account/Sources/Account/AccountDetailView.swift @@ -27,6 +27,8 @@ public struct AccountDetailView: View { @State private var isEditingAccount: Bool = false @State private var isEditingFilters: Bool = false @State private var isEditingRelationshipNote: Bool = false + + @State private var displayTitle: Bool = false @Binding var scrollToTopSignal: Int @@ -45,10 +47,12 @@ public struct AccountDetailView: View { public var body: some View { ScrollViewReader { proxy in List { + ScrollToView() + .onAppear { displayTitle = false } + .onDisappear { displayTitle = true } makeHeaderView(proxy: proxy) .applyAccountDetailsRowStyle(theme: theme) .padding(.bottom, -20) - .id(ScrollToView.Constants.scrollToTop) familiarFollowers .applyAccountDetailsRowStyle(theme: theme) featuredTagsView @@ -311,6 +315,16 @@ public struct AccountDetailView: View { @ToolbarContentBuilder private var toolbarContent: some ToolbarContent { + ToolbarItem(placement: .principal) { + if let account = viewModel.account, displayTitle { + VStack { + Text(account.displayName ?? "").font(.headline) + Text("account.detail.featured-tags-n-posts \(account.statusesCount ?? 0)") + .font(.footnote) + .foregroundStyle(.secondary) + } + } + } ToolbarItemGroup(placement: .navigationBarTrailing) { if !viewModel.isCurrentUser { Button { diff --git a/Packages/Account/Sources/Account/AccountsList/AccountsListView.swift b/Packages/Account/Sources/Account/AccountsList/AccountsListView.swift index 09b98dc5..7a9dc1e0 100644 --- a/Packages/Account/Sources/Account/AccountsList/AccountsListView.swift +++ b/Packages/Account/Sources/Account/AccountsList/AccountsListView.swift @@ -102,6 +102,19 @@ public struct AccountsListView: View { .background(theme.primaryBackgroundColor) #endif .listStyle(.plain) + .toolbar { + ToolbarItem(placement: .principal) { + VStack { + Text(viewModel.mode.title) + .font(.headline) + if let count = viewModel.totalCount { + Text(String(count)) + .font(.footnote) + .foregroundStyle(.secondary) + } + } + } + } .navigationTitle(viewModel.mode.title) .navigationBarTitleDisplayMode(.inline) .task { diff --git a/Packages/Account/Sources/Account/AccountsList/AccountsListViewModel.swift b/Packages/Account/Sources/Account/AccountsList/AccountsListViewModel.swift index 4204519e..01331a77 100644 --- a/Packages/Account/Sources/Account/AccountsList/AccountsListViewModel.swift +++ b/Packages/Account/Sources/Account/AccountsList/AccountsListViewModel.swift @@ -46,6 +46,7 @@ public enum AccountsListMode { private var relationships: [Relationship] = [] var state = State.loading + var totalCount: Int? private var nextPageId: String? @@ -60,9 +61,13 @@ public enum AccountsListMode { let link: LinkHandler? switch mode { case let .followers(accountId): + var account: Account = try await client.get(endpoint: Accounts.accounts(id: accountId)) + totalCount = account.followersCount (accounts, link) = try await client.getWithLink(endpoint: Accounts.followers(id: accountId, maxId: nil)) case let .following(accountId): + var account: Account = try await client.get(endpoint: Accounts.accounts(id: accountId)) + totalCount = account.followingCount (accounts, link) = try await client.getWithLink(endpoint: Accounts.following(id: accountId, maxId: nil)) case let .rebloggedBy(statusId):