Minor controls bar improvements

This commit is contained in:
Arkadiusz Fal 2022-07-02 00:52:27 +02:00
parent 19bb380c32
commit 8e8165b262

View File

@ -78,16 +78,6 @@ struct ControlsBar: View {
var controls: some View { var controls: some View {
HStack(spacing: 4) { HStack(spacing: 4) {
Group { Group {
Button {
model.closeCurrentItem()
model.closePiP()
} label: {
Label("Close Video", systemImage: "xmark")
.padding(.vertical, 10)
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
}
if playerControls.isPlaying { if playerControls.isPlaying {
Button(action: { Button(action: {
model.pause() model.pause()
@ -117,7 +107,19 @@ struct ControlsBar: View {
.contentShape(Rectangle()) .contentShape(Rectangle())
} }
.disabled(model.queue.isEmpty) .disabled(model.queue.isEmpty)
Button {
model.closeCurrentItem()
model.closePiP()
} label: {
Label("Close Video", systemImage: "xmark")
.padding(.vertical, 10)
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
} }
.disabled(model.currentItem.isNil)
}
.imageScale(.small)
.font(.system(size: 24)) .font(.system(size: 24))
} }
@ -220,8 +222,9 @@ struct ControlsBar: View {
.foregroundColor(model.currentVideo.isNil ? .secondary : .accentColor) .foregroundColor(model.currentVideo.isNil ? .secondary : .accentColor)
.lineLimit(1) .lineLimit(1)
if let video = model.currentVideo {
HStack(spacing: 2) { HStack(spacing: 2) {
Text(model.currentVideo?.author ?? "") Text(video.author)
.font(.system(size: 12)) .font(.system(size: 12))
if !presentingControls, if !presentingControls,
@ -241,6 +244,7 @@ struct ControlsBar: View {
.foregroundColor(.secondary) .foregroundColor(.secondary)
} }
} }
}
.buttonStyle(.plain) .buttonStyle(.plain)
.padding(.vertical) .padding(.vertical)