new top / bottom bar

This commit is contained in:
Thomas Ricouard 2024-01-23 08:51:58 +01:00
parent 016e4d5d57
commit 3eec5c0eec
10 changed files with 30 additions and 13 deletions

View File

@ -89,7 +89,7 @@ struct AppView: View {
} }
.tag(tab) .tag(tab)
.badge(badgeFor(tab: tab)) .badge(badgeFor(tab: tab))
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .tabBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .tabBar)
} }
} }
.id(appAccountsManager.currentClient.id) .id(appAccountsManager.currentClient.id)

View File

@ -21,7 +21,7 @@ struct ExploreTab: View {
ExploreView(scrollToTopSignal: $scrollToTopSignal) ExploreView(scrollToTopSignal: $scrollToTopSignal)
.withAppRouter() .withAppRouter()
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet) .withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.toolbar { .toolbar {
ToolbarTab(routerPath: $routerPath) ToolbarTab(routerPath: $routerPath)
} }

View File

@ -26,7 +26,7 @@ struct MessagesTab: View {
.toolbar { .toolbar {
ToolbarTab(routerPath: $routerPath) ToolbarTab(routerPath: $routerPath)
} }
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.id(client.id) .id(client.id)
} }
.onChange(of: $popToRootTab.wrappedValue) { _, newValue in .onChange(of: $popToRootTab.wrappedValue) { _, newValue in

View File

@ -32,7 +32,7 @@ struct NavigationTab<Content: View>: View {
.toolbar { .toolbar {
ToolbarTab(routerPath: $routerPath) ToolbarTab(routerPath: $routerPath)
} }
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.onChange(of: client.id) { .onChange(of: client.id) {
routerPath.path = [] routerPath.path = []
} }

View File

@ -42,7 +42,7 @@ struct NotificationsTab: View {
} }
ToolbarTab(routerPath: $routerPath) ToolbarTab(routerPath: $routerPath)
} }
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.id(client.id) .id(client.id)
} }
.onAppear { .onAppear {

View File

@ -23,7 +23,7 @@ struct ProfileTab: View {
AccountDetailView(account: account, scrollToTopSignal: $scrollToTopSignal) AccountDetailView(account: account, scrollToTopSignal: $scrollToTopSignal)
.withAppRouter() .withAppRouter()
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet) .withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.id(account.id) .id(account.id)
} else { } else {
AccountDetailView(account: .placeholder(), scrollToTopSignal: $scrollToTopSignal) AccountDetailView(account: .placeholder(), scrollToTopSignal: $scrollToTopSignal)

View File

@ -47,7 +47,7 @@ struct SettingsTabs: View {
#endif #endif
.navigationTitle(Text("settings.title")) .navigationTitle(Text("settings.title"))
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.toolbar { .toolbar {
if isModal { if isModal {
ToolbarItem { ToolbarItem {

View File

@ -51,7 +51,7 @@ struct TimelineTab: View {
.toolbar { .toolbar {
toolbarView toolbarView
} }
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar) .toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .navigationBar)
.id(client.id) .id(client.id)
} }
.onAppear { .onAppear {

View File

@ -0,0 +1,11 @@
import SwiftUI
public extension View {
@ViewBuilder func `if`<Content: View>(_ condition: Bool, transform: (Self) -> Content) -> some View {
if condition {
transform(self)
} else {
self
}
}
}

View File

@ -82,13 +82,19 @@ public struct TimelineView: View {
} }
.safeAreaInset(edge: .top, spacing: 0) { .safeAreaInset(edge: .top, spacing: 0) {
if canFilterTimeline, !pinnedFilters.isEmpty { if canFilterTimeline, !pinnedFilters.isEmpty {
TimelineQuickAccessPills(pinnedFilters: $pinnedFilters, timeline: $timeline) VStack(spacing: 0) {
.padding(.vertical, 8) TimelineQuickAccessPills(pinnedFilters: $pinnedFilters, timeline: $timeline)
.padding(.horizontal, .layoutPadding) .padding(.vertical, 8)
.background(theme.primaryBackgroundColor.opacity(0.50)) .padding(.horizontal, .layoutPadding)
.background(Material.regular) .background(theme.primaryBackgroundColor.opacity(0.30))
.background(Material.ultraThin)
Divider()
}
} }
} }
.if(canFilterTimeline && !pinnedFilters.isEmpty) { view in
view.toolbarBackground(.hidden, for: .navigationBar)
}
.onChange(of: viewModel.scrollToIndex) { _, newValue in .onChange(of: viewModel.scrollToIndex) { _, newValue in
if let collectionView, if let collectionView,
let newValue, let newValue,