// // Swiftfin is subject to the terms of the Mozilla Public // License, v2.0. If a copy of the MPL was not distributed with this // file, you can obtain one at https://mozilla.org/MPL/2.0/. // // Copyright (c) 2026 Jellyfin & Jellyfin Contributors // // Adapted for Tunavelo from Swiftfin 8a515c580e8b96eaeffcecdfeb14a1c97ef9264e Shared/Views/ItemView/Components/Headers/RegularEnhancedHeaderContentGroup.swift // import DesignSystem import SwiftUI /// The Mac, iPad and Apple TV header: the backdrop at 2 to 1 across the full width, the text on its left (title, then the actions /// beside the description and the facts). Upstream's large layout is a cinematic container and its other layout a stack for narrow /// windows; ours keeps the stack for narrow widths and the side-by-side row otherwise, and leaves the parallax out. struct RegularEnhancedHeaderContentGroup: View { let info: DetailHeaderInfo @ViewBuilder let actions: Actions @Environment(\.layoutClass) private var layout @Environment(\.dynamicTypeSize) private var typeSize private let headerAspectRatio = 2.0 private var detailsLayout: AnyLayout { typeSize.isAccessibilitySize ? AnyLayout(VStackLayout(alignment: .leading, spacing: Theme.Spacing.half)) : AnyLayout(HStackLayout(alignment: .top, spacing: Theme.margin(for: layout))) } private var overlay: some View { VStack(alignment: .leading, spacing: layout == .tv ? Theme.Spacing.xxl : Theme.Spacing.xs) { if let eyebrow = info.eyebrow { DetailEyebrow(text: eyebrow) } DetailTitle(text: info.title ?? "").frame(maxWidth: .infinity, alignment: .leading) detailsLayout { actions.fixedSize(horizontal: true, vertical: false) VStack(alignment: .leading, spacing: Theme.Spacing.half) { if let plot = info.plot, !plot.isEmpty { DetailSynopsis(text: plot, lines: 3).frame(maxWidth: 720, alignment: .leading) } if !info.metaParts.isEmpty { DetailMeta(parts: info.metaParts, rating: info.rating) } if let progress = info.progress { DetailProgress(fraction: progress.fraction, text: progress.text) } } .frame(maxWidth: .infinity, alignment: .leading) } } .padding(.bottom, Theme.Spacing.l) } var body: some View { ZStack(alignment: .bottomLeading) { Color.clear.aspectRatio(headerAspectRatio, contentMode: .fit) overlay .padding(.horizontal, Theme.margin(for: layout)) .frame(maxWidth: .infinity, alignment: .leading) } .background(alignment: .top) { DetailHeaderArtwork(info: info) .aspectRatio(headerAspectRatio, contentMode: .fit) .extendsBackdrop() } } }