Add video description expanding

This commit is contained in:
Arkadiusz Fal
2023-04-22 19:22:13 +02:00
parent b19918e219
commit d52ccf2ce6
6 changed files with 86 additions and 7 deletions

View File

@@ -160,6 +160,7 @@ struct VideoDetails: View {
@State private var subscribed = false
@State private var subscriptionToggleButtonDisabled = false
@State private var page = DetailsPage.info
@State private var descriptionExpanded = false
@Environment(\.navigationStyle) private var navigationStyle
#if os(iOS)
@@ -175,6 +176,7 @@ struct VideoDetails: View {
@Default(.enableReturnYouTubeDislike) private var enableReturnYouTubeDislike
@Default(.playerSidebar) private var playerSidebar
@Default(.showInspector) private var showInspector
@Default(.expandVideoDescription) private var expandVideoDescription
var body: some View {
VStack(alignment: .leading, spacing: 0) {
@@ -281,7 +283,9 @@ struct VideoDetails: View {
}
.frame(maxWidth: .infinity)
} else if let description = video.description, !description.isEmpty {
VideoDescription(video: video, detailsSize: detailsSize)
Section(header: descriptionHeader) {
VideoDescription(video: video, detailsSize: detailsSize, expand: $descriptionExpanded)
}
} else if !video.isLocal {
Text("No description")
.font(.caption)
@@ -345,6 +349,20 @@ struct VideoDetails: View {
}
}
}
var descriptionHeader: some View {
HStack {
Text("Description".localized())
if !expandVideoDescription, !descriptionExpanded {
Spacer()
Image(systemName: "arrow.up.and.down")
.imageScale(.small)
}
}
.font(.caption)
.foregroundColor(.secondary)
}
}
struct VideoDetails_Previews: PreviewProvider {