Files
yattee/Yattee/Views/Player/Panels/CommentsPanelPage.swift
Arkadiusz Fal c289e7576e Add per-page element customization and panel settings polish
Phase 5 of the player panels redesign:
- Per-page element toggles now rendered and editable for every page:
  comments (author avatars), related (thumbnails), chapters (thumbnails),
  queue (previously played section), tracks (video/audio/subtitles/speed
  sections)
- Page bar labels toggle (icons-only bar shows the selected page's name)
- Layout mode schematic diagram in the details panel settings
- NEW badge machinery for future page types (versionAdded on PanelPageType)
- Typed per-page settings accessors on PanelPageConfiguration and VM update
  helpers for each page kind
- Unit tests for per-page settings round-trip and accessor fallbacks

The standalone quality selector sheet is unaffected: section gating defaults
to everything visible and only the embedded tracks page passes preset
settings through.
2026-09-22 09:37:10 +02:00

41 lines
1.3 KiB
Swift

//
// CommentsPanelPage.swift
// Yattee
//
// Details panel page with the inline comments list.
//
import SwiftUI
#if os(iOS) || os(macOS)
struct CommentsPanelPage: View {
let context: PanelPageContext
var settings: CommentsPageSettings = CommentsPageSettings()
var scrollConfig: PanelScrollConfig = PanelScrollConfig()
private var appEnvironment: AppEnvironment? { context.appEnvironment }
private var playerState: PlayerState? { appEnvironment?.playerService.state }
var body: some View {
PanelPageScrollView(config: scrollConfig) {
CommentsListContent(
videoID: context.video.id.videoID,
showAvatars: settings.effectiveShowAvatars
)
.padding(.horizontal)
}
.task(id: context.video.id) {
// Opening the page is an explicit request; load even when the
// buffer-ready preload hasn't fired yet.
guard let playerState,
playerState.commentsState == .idle,
let contentService = appEnvironment?.contentService,
let instancesManager = appEnvironment?.instancesManager else { return }
await playerState.loadComments(contentService: contentService, instancesManager: instancesManager)
}
}
}
#endif