Skip to content

Commit

Permalink
SeasonDetailsView now works on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
MadeiraAlexandre committed Apr 12, 2024
1 parent 00b4f09 commit 0a9ef62
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 18 deletions.
File renamed without changes.
14 changes: 11 additions & 3 deletions Shared/View/Review/ReviewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct ReviewView: View {
}
} else {
if let item {
Section {
Section {
VStack {
HStack(alignment: .center) {
LazyImage(url: item.itemPosterImageMedium) { state in
Expand Down Expand Up @@ -75,21 +75,23 @@ struct ReviewView: View {
Section("Notes") {
TextEditor(text: $note)
.frame(minHeight: 150, maxHeight: 800)

}
#endif
} else {
ProgressView()
}
}
}
#if os(iOS)
#if !os(tvOS)
.scrollContentBackground(settings.disableTranslucent ? .visible : .hidden)
.background {
if let item {
TranslucentBackground(image: item.itemPosterImageMedium, useLighterMaterial: true)
}
}
.scrollContentBackground(settings.disableTranslucent ? .visible : .hidden)
#elseif !os(tvOS) && !os(macOS)
.navigationBarTitleDisplayMode(.inline)
#endif
.navigationTitle("Review")
Expand Down Expand Up @@ -148,14 +150,20 @@ struct ReviewView: View {

@ViewBuilder
private var doneButton: some View {
#if os(macOS)
Button("Done", action: dismiss)
#else
RoundedCloseButton(action: dismiss)
#endif
}

private var saveButton: some View {
Button("Save") { save() }
.disabled(!canSave)
#if !os(macOS)
.buttonBorderShape(.capsule)
.buttonStyle(.borderedProminent)
#endif
}

private func save(dismiss: Bool = true) {
Expand Down
8 changes: 8 additions & 0 deletions Shared/View/Season/SeasonDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ struct SeasonDetailView: View {
Text(overview)
.font(.callout)
.padding(.vertical)
#if os(macOS)
.padding(.horizontal)
#endif
}
}
}
Expand All @@ -82,6 +85,8 @@ struct SeasonDetailView: View {
}
#if !os(tvOS) && !os(macOS)
.navigationBarTitleDisplayMode(.inline)
#endif
#if !os(tvOS)
.scrollContentBackground(settings.disableTranslucent ? .visible : .hidden)
.background {
TranslucentBackground(image: item.seasonPosterUrl, useLighterMaterial: true)
Expand Down Expand Up @@ -128,5 +133,8 @@ struct SeasonDetailView: View {
.presentationDetents([.medium, .large])
.presentationDragIndicator(.visible)
.presentationCornerRadius(32)
#if os(macOS)
.frame(width: 600, height: 400)
#endif
}
}
6 changes: 5 additions & 1 deletion Shared/View/Season/SeasonListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct SeasonListView: View {
#endif
#endif
Spacer()
#if os(iOS) || os(tvOS)
#if !os(watchOS)
Menu {
Button("Show Season Details") {
selectedSeasonDetails = season
Expand All @@ -228,6 +228,10 @@ struct SeasonListView: View {
Label("More", systemImage: "ellipsis.circle")
.labelStyle(.iconOnly)
}
#if os(macOS)
.menuStyle(.borderlessButton)
.frame(width: 40)
#endif
#if os(tvOS)
.padding(.horizontal, 60)
#else
Expand Down
29 changes: 16 additions & 13 deletions Shared/View/TMDB/AttributionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ import SwiftUI

struct AttributionView: View {
var body: some View {
VStack(alignment: .center) {
Image("PrimaryCompact")
.resizable()
.scaledToFit()
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight,
alignment: .center)
.accessibility(hidden: true)
Text("This product uses the TMDb API but is not endorsed or certified by TMDb.")
.frame(alignment: .center)
.font(.caption)
.foregroundColor(.secondary)
.padding([.horizontal, .bottom])
HStack(alignment: .center) {
VStack(alignment: .center) {
Image("PrimaryCompact")
.resizable()
.scaledToFit()
.frame(width: DrawingConstants.imageWidth,
height: DrawingConstants.imageHeight,
alignment: .center)
.accessibility(hidden: true)
Text("This product uses the TMDb API but is not endorsed or certified by TMDb.")
.frame(alignment: .center)
.font(.caption)
.foregroundColor(.secondary)
.padding([.horizontal, .bottom])
}
}
.frame(maxWidth: .infinity)
.accessibilityElement(children: .combine)
.unredacted()
}
Expand Down
2 changes: 1 addition & 1 deletion Story.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@
B81941D22A0867E50057DA04 /* Up Next */,
B8FB2A7A29522D22006DAC8E /* WatchlistItem */,
B824E4472A05A85B00E385CE /* WatchProviders */,
B8F253B42BC86497003F27E8 /* RoundedCloseButton.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -1371,6 +1370,7 @@
B8EC463E27D84C62009389FC /* Components */ = {
isa = PBXGroup;
children = (
B8F253B42BC86497003F27E8 /* RoundedCloseButton.swift */,
B86670B52B5FF63400CBA595 /* CronicaLoadingPopupView.swift */,
B8CBBF1B2A4B7C3E0052A59B /* DetailedReleaseDateView.swift */,
B890C57827FC999F006BE5E1 /* HeroImage.swift */,
Expand Down

0 comments on commit 0a9ef62

Please sign in to comment.