Fix ipad toolbar items, resize toasts on ipad

This commit is contained in:
Jackson Harper
2023-12-21 13:44:11 +08:00
parent fbb39bcd91
commit 8acc78db7b
4 changed files with 44 additions and 56 deletions

View File

@ -163,59 +163,9 @@ struct AnimatingCellHeight: AnimatableModifier {
.navigationBarTitleDisplayMode(.inline)
}
var trailingItems: some ToolbarContent {
Group {
ToolbarItem(placement: .barTrailing) {
if prefersListLayout {
Button(
action: { isEditMode = isEditMode == .active ? .inactive : .active },
label: {
Image.selectMultiple
.foregroundColor(Color.appGrayTextContrast)
}
)
}
}
ToolbarItem(placement: UIDevice.isIPhone ? .barLeading : .barTrailing) {
if enableGrid {
Button(
action: { prefersListLayout.toggle() },
label: {
Label("Toggle Feed Layout", systemImage: prefersListLayout ? "square.grid.2x2" : "list.bullet")
}
)
}
}
ToolbarItem(placement: .barTrailing) {
Button(
action: {
if viewModel.folder == "inbox" {
showAddLinkView = true
} else if viewModel.folder == "following" {
showAddFeedView = true
}
},
label: {
Image.addLink
.foregroundColor(Color.appGrayTextContrast)
}
)
}
ToolbarItem(placement: .barTrailing) {
Button(
action: { searchPresented = true },
label: {
Image.magnifyingGlass
.foregroundColor(Color.appGrayTextContrast)
}
)
}
}
}
var toolbarItems: some ToolbarContent {
Group {
ToolbarItem(placement: .barLeading) {
ToolbarItemGroup(placement: .barLeading) {
if UIDevice.isIPhone || horizontalSizeClass != .compact {
VStack(alignment: .leading) {
let showDate = isListScrolled && !listTitle.isEmpty
@ -233,7 +183,45 @@ struct AnimatingCellHeight: AnimatableModifier {
}
}
trailingItems
ToolbarItemGroup(placement: .barTrailing) {
if prefersListLayout {
Button(
action: { isEditMode = isEditMode == .active ? .inactive : .active },
label: {
Image.selectMultiple
.foregroundColor(Color.appGrayTextContrast)
}
)
}
if enableGrid {
Button(
action: { prefersListLayout.toggle() },
label: {
Label("Toggle Feed Layout", systemImage: prefersListLayout ? "square.grid.2x2" : "list.bullet")
}
)
}
Button(
action: {
if viewModel.folder == "inbox" {
showAddLinkView = true
} else if viewModel.folder == "following" {
showAddFeedView = true
}
},
label: {
Image.addLink
.foregroundColor(Color.appGrayTextContrast)
}
)
Button(
action: { searchPresented = true },
label: {
Image.magnifyingGlass
.foregroundColor(Color.appGrayTextContrast)
}
)
}
ToolbarItemGroup(placement: .bottomBar) {
if isEditMode == .active {

View File

@ -194,7 +194,7 @@ struct MessageToast: View {
}
.padding(10)
.frame(minHeight: 50)
.frame(maxWidth: .infinity)
.frame(maxWidth: 380)
.background(Color(hex: "2A2A2A"))
.cornerRadius(4.0)
.tint(Color.green)
@ -228,7 +228,7 @@ struct NewsletterOperationToast: View {
}
.padding(10)
.frame(minHeight: 50)
.frame(maxWidth: .infinity)
.frame(maxWidth: 380)
.background(Color(hex: "2A2A2A"))
.cornerRadius(4.0)
.tint(Color.green)

View File

@ -175,7 +175,7 @@ struct OperationToast: View {
}
.padding(10)
.frame(minHeight: 50)
.frame(maxWidth: .infinity)
.frame(maxWidth: 380)
.background(Color(hex: "2A2A2A"))
.cornerRadius(4.0)
.tint(Color.green)

View File

@ -721,7 +721,7 @@ struct ReaderOperationToast: View {
}
.padding(10)
.frame(minHeight: 50)
.frame(maxWidth: .infinity)
.frame(maxWidth: 380)
.background(Color(hex: "2A2A2A"))
.cornerRadius(4.0)
.tint(Color.green)