mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-27 02:31:02 +00:00
Add secondary column when screen is wide enough
This commit is contained in:
parent
243cbcbc41
commit
497c2a1fe1
5 changed files with 57 additions and 42 deletions
|
@ -94,6 +94,8 @@ struct IceCubesApp: App {
|
||||||
popToRootTab: $popToRootTab,
|
popToRootTab: $popToRootTab,
|
||||||
tabs: availableTabs,
|
tabs: availableTabs,
|
||||||
routerPath: sidebarRouterPath) {
|
routerPath: sidebarRouterPath) {
|
||||||
|
GeometryReader { proxy in
|
||||||
|
HStack(spacing: 0) {
|
||||||
ZStack {
|
ZStack {
|
||||||
if selectedTab == .profile {
|
if selectedTab == .profile {
|
||||||
ProfileTab(popToRootTab: $popToRootTab)
|
ProfileTab(popToRootTab: $popToRootTab)
|
||||||
|
@ -113,6 +115,14 @@ struct IceCubesApp: App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if proxy.frame(in: .global).width > (.maxColumnWidth + .secondaryColumnWidth),
|
||||||
|
currentAccount.account?.id != nil {
|
||||||
|
Divider().edgesIgnoringSafeArea(.all)
|
||||||
|
NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil, isSecondaryColumn: true)
|
||||||
|
.frame(maxWidth: 360)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}.onChange(of: $appAccountsManager.currentAccount.id) { _ in
|
}.onChange(of: $appAccountsManager.currentAccount.id) { _ in
|
||||||
sideBarLoadedTabs.removeAll()
|
sideBarLoadedTabs.removeAll()
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct NotificationsTab: View {
|
||||||
@Binding var popToRootTab: Tab
|
@Binding var popToRootTab: Tab
|
||||||
|
|
||||||
let lockedType: Models.Notification.NotificationType?
|
let lockedType: Models.Notification.NotificationType?
|
||||||
|
let isSecondaryColumn: Bool
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack(path: $routerPath.path) {
|
NavigationStack(path: $routerPath.path) {
|
||||||
|
@ -25,6 +26,7 @@ struct NotificationsTab: View {
|
||||||
.withAppRouter()
|
.withAppRouter()
|
||||||
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
.withSheetDestinations(sheetDestinations: $routerPath.presentedSheet)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
|
if !isSecondaryColumn {
|
||||||
statusEditorToolbarItem(routerPath: routerPath,
|
statusEditorToolbarItem(routerPath: routerPath,
|
||||||
visibility: userPreferences.postVisibility)
|
visibility: userPreferences.postVisibility)
|
||||||
if UIDevice.current.userInterfaceIdiom != .pad {
|
if UIDevice.current.userInterfaceIdiom != .pad {
|
||||||
|
@ -33,6 +35,7 @@ struct NotificationsTab: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.50), for: .navigationBar)
|
||||||
.id(appAccount.currentAccount.id)
|
.id(appAccount.currentAccount.id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ enum Tab: Int, Identifiable, Hashable {
|
||||||
case .federated:
|
case .federated:
|
||||||
TimelineTab(popToRootTab: popToRootTab, timeline: .federated)
|
TimelineTab(popToRootTab: popToRootTab, timeline: .federated)
|
||||||
case .notifications:
|
case .notifications:
|
||||||
NotificationsTab(popToRootTab: popToRootTab, lockedType: nil)
|
NotificationsTab(popToRootTab: popToRootTab, lockedType: nil, isSecondaryColumn: false)
|
||||||
case .mentions:
|
case .mentions:
|
||||||
NotificationsTab(popToRootTab: popToRootTab, lockedType: .mention)
|
NotificationsTab(popToRootTab: popToRootTab, lockedType: .mention, isSecondaryColumn: false)
|
||||||
case .explore:
|
case .explore:
|
||||||
ExploreTab(popToRootTab: popToRootTab)
|
ExploreTab(popToRootTab: popToRootTab)
|
||||||
case .messages:
|
case .messages:
|
||||||
|
|
|
@ -5,6 +5,7 @@ public extension CGFloat {
|
||||||
static let dividerPadding: CGFloat = 2
|
static let dividerPadding: CGFloat = 2
|
||||||
static let statusColumnsSpacing: CGFloat = 8
|
static let statusColumnsSpacing: CGFloat = 8
|
||||||
static let maxColumnWidth: CGFloat = 650
|
static let maxColumnWidth: CGFloat = 650
|
||||||
|
static let secondaryColumnWidth: CGFloat = 360
|
||||||
static let sidebarWidth: CGFloat = 80
|
static let sidebarWidth: CGFloat = 80
|
||||||
static let pollBarHeight: CGFloat = 30
|
static let pollBarHeight: CGFloat = 30
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,7 @@ public struct StatusRowView: View {
|
||||||
Text("status.action.translate")
|
Text("status.action.translate")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.borderless)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let translation = viewModel.translation, !viewModel.isLoadingTranslation {
|
if let translation = viewModel.translation, !viewModel.isLoadingTranslation {
|
||||||
|
|
Loading…
Reference in a new issue