From 61873c70175ced5cb7fb276e099d952c12be4ab0 Mon Sep 17 00:00:00 2001 From: Ethan Pippin Date: Tue, 11 Jan 2022 16:33:44 -0700 Subject: [PATCH] Update EpisodesRowView.swift --- .../EpisodesRowView/EpisodesRowView.swift | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/Swiftfin/Components/EpisodesRowView/EpisodesRowView.swift b/Swiftfin/Components/EpisodesRowView/EpisodesRowView.swift index e6528406..68414789 100644 --- a/Swiftfin/Components/EpisodesRowView/EpisodesRowView.swift +++ b/Swiftfin/Components/EpisodesRowView/EpisodesRowView.swift @@ -21,26 +21,33 @@ struct EpisodesRowView: View where RowManager: EpisodesRowManager { VStack(alignment: .leading, spacing: 0) { HStack { - Menu { - ForEach(Array(viewModel.seasonsEpisodes.keys).sorted(by: { $0.name ?? "" < $1.name ?? "" }), id: \.self) { season in - Button { - viewModel.selectedSeason = season - } label: { - if season.id == viewModel.selectedSeason?.id { - Label(season.name ?? L10n.season, systemImage: "checkmark") - } else { - Text(season.name ?? L10n.season) - } - } - } - } label: { - HStack(spacing: 5) { - Text(viewModel.selectedSeason?.name ?? L10n.unknown) - .fontWeight(.semibold) - .fixedSize() - Image(systemName: "chevron.down") - } - } + + if onlyCurrentSeason { + if let currentSeason = Array(viewModel.seasonsEpisodes.keys).first(where: { $0.id == viewModel.item.id }) { + Text(currentSeason.name ?? L10n.noTitle) + } + } else { + Menu { + ForEach(Array(viewModel.seasonsEpisodes.keys).sorted(by: { $0.name ?? "" < $1.name ?? "" }), id: \.self) { season in + Button { + viewModel.select(season: season) + } label: { + if season.id == viewModel.selectedSeason?.id { + Label(season.name ?? L10n.season, systemImage: "checkmark") + } else { + Text(season.name ?? L10n.season) + } + } + } + } label: { + HStack(spacing: 5) { + Text(viewModel.selectedSeason?.name ?? L10n.unknown) + .fontWeight(.semibold) + .fixedSize() + Image(systemName: "chevron.down") + } + } + } Spacer() }