mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-27 01:20:41 +00:00
Account: Show nav bar title for main, followers, following
This commit is contained in:
parent
8ee5da319c
commit
f0061b36ca
3 changed files with 33 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue