mirror of
https://github.com/yattee/yattee.git
synced 2026-08-05 23:01:28 +00:00
List/grid layout toggle with row size and grid columns options, persisted per-view. PlaylistRowView now scales with VideoRowStyle; new LocalPlaylistCardView provides the grid card with edit/delete context menu.
52 lines
1.5 KiB
Swift
52 lines
1.5 KiB
Swift
//
|
|
// PlaylistRowView.swift
|
|
// Yattee
|
|
//
|
|
// Row view for displaying a playlist in lists.
|
|
//
|
|
|
|
import SwiftUI
|
|
import NukeUI
|
|
|
|
struct PlaylistRowView: View {
|
|
let playlist: LocalPlaylist
|
|
var style: VideoRowStyle = .regular
|
|
|
|
private var titleFont: Font {
|
|
style == .compact ? .subheadline : .headline
|
|
}
|
|
|
|
var body: some View {
|
|
HStack(spacing: 12) {
|
|
// Thumbnail
|
|
LazyImage(url: playlist.thumbnailURL) { state in
|
|
if let image = state.image {
|
|
image
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fill)
|
|
} else {
|
|
Rectangle()
|
|
.fill(.quaternary)
|
|
.overlay {
|
|
Image(systemName: "music.note.list")
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
}
|
|
.frame(width: style.thumbnailWidth, height: style.thumbnailHeight)
|
|
.clipShape(RoundedRectangle(cornerRadius: 6))
|
|
|
|
// Info
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text(playlist.title)
|
|
.font(titleFont)
|
|
.lineLimit(style == .large ? 2 : 1)
|
|
|
|
Text("playlist.videoCountDuration \(playlist.videoCount) \(playlist.formattedTotalDuration)")
|
|
.font(.caption.monospacedDigit())
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
}
|
|
}
|