// // 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/CompactEnhancedHeaderContentGroup.swift // import DesignSystem import SwiftUI /// The iPhone header: the backdrop at 1.6 to 1 with the title over its foot, then the facts, the actions and the description on a /// thin material that fades in from the backdrop. Upstream reads `JellyfinAPI` items, `@StoredValue` attributes and the parallax /// header; ours takes a `DetailHeaderInfo` and the action buttons, and leaves the parallax out. struct CompactEnhancedHeaderContentGroup: View { let info: DetailHeaderInfo @ViewBuilder let actions: Actions @Environment(\.layoutClass) private var layout private let headerAspectRatio = 1.6 private var title: some View { DetailTitle(text: info.title ?? "").multilineTextAlignment(.center) } private var overlay: some View { VStack(alignment: .center, spacing: Theme.Spacing.half) { ZStack(alignment: .bottom) { Color.clear.aspectRatio(headerAspectRatio, contentMode: .fit) title } VStack(alignment: .center, spacing: Theme.Spacing.half) { if !info.metaParts.isEmpty { DetailMeta(parts: info.metaParts, rating: info.rating) } actions if let plot = info.plot, !plot.isEmpty { DetailSynopsis(text: plot, lines: 4) } if let progress = info.progress { DetailProgress(fraction: progress.fraction, text: progress.text) } } .padding(.bottom, Theme.Spacing.l) .background(alignment: .bottom) { Rectangle() .fill(Material.ultraThin) .mask(LinearGradient(stops: [.init(color: .clear, location: 0), .init(color: Theme.black.color, location: 0.2)], startPoint: .top, endPoint: .bottom)) .padding(.horizontal, -Theme.margin(for: layout)) .padding(.top, -Theme.Spacing.l) } } } var body: some View { overlay .padding(.horizontal, Theme.margin(for: layout)) .frame(maxWidth: .infinity) .background(alignment: .top) { DetailHeaderArtwork(info: info) .aspectRatio(headerAspectRatio, contentMode: .fit) .extendsBackdrop() } } }