Add SponsorBlock categories details

This commit is contained in:
Arkadiusz Fal
2022-01-07 19:46:47 +01:00
parent 3630cd404d
commit d1ed896166
3 changed files with 55 additions and 3 deletions

View File

@@ -183,7 +183,7 @@ struct SettingsView: View {
case .history:
return 480
case .sponsorBlock:
return 290
return 660
case .updates:
return 200
case .help:

View File

@@ -39,7 +39,7 @@ struct SponsorBlockSettings: View {
#endif
}
Section(header: SettingsHeader(text: "Categories to Skip")) {
Section(header: SettingsHeader(text: "Categories to Skip"), footer: categoriesDetails) {
#if os(macOS)
let list = ForEach(SponsorBlockAPI.categories, id: \.self) { category in
SponsorBlockCategorySelectionRow(
@@ -74,6 +74,24 @@ struct SponsorBlockSettings: View {
}
}
private var categoriesDetails: some View {
VStack(alignment: .leading) {
ForEach(SponsorBlockAPI.categories, id: \.self) { category in
Text(SponsorBlockAPI.categoryDescription(category) ?? "Category")
.fontWeight(.bold)
#if os(tvOS)
.focusable()
#endif
Text(SponsorBlockAPI.categoryDetails(category) ?? "Details")
.padding(.bottom, 3)
.fixedSize(horizontal: false, vertical: true)
}
}
.foregroundColor(.secondary)
.padding(.top, 3)
}
func toggleCategory(_ category: String, value: Bool) {
if let index = sponsorBlockCategories.firstIndex(where: { $0 == category }), !value {
sponsorBlockCategories.remove(at: index)
@@ -123,7 +141,7 @@ struct SponsorBlockSettings: View {
}
}
struct ServicesSettings_Previews: PreviewProvider {
struct SponsorBlockSettings_Previews: PreviewProvider {
static var previews: some View {
VStack {
SponsorBlockSettings()