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,25 +222,27 @@ struct ControlsBar: View {
.foregroundColor(model.currentVideo.isNil ? .secondary : .accentColor) .foregroundColor(model.currentVideo.isNil ? .secondary : .accentColor)
.lineLimit(1) .lineLimit(1)
HStack(spacing: 2) { if let video = model.currentVideo {
Text(model.currentVideo?.author ?? "") HStack(spacing: 2) {
.font(.system(size: 12)) Text(video.author)
.font(.system(size: 12))
if !presentingControls, if !presentingControls,
let channel = model.currentVideo?.channel, let channel = model.currentVideo?.channel,
let subsriptions = channel.subscriptionsString let subsriptions = channel.subscriptionsString
{ {
HStack(spacing: 2) { HStack(spacing: 2) {
Image(systemName: "person.2.fill") Image(systemName: "person.2.fill")
Text(subsriptions) Text(subsriptions)
}
.padding(.leading, 4)
.font(.system(size: 9))
} }
.padding(.leading, 4)
.font(.system(size: 9))
} }
.lineLimit(1)
.foregroundColor(.secondary)
} }
.lineLimit(1)
.foregroundColor(.secondary)
} }
} }
.buttonStyle(.plain) .buttonStyle(.plain)