diff --git a/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift b/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift index 9d81ff70b..54e0341fa 100644 --- a/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift +++ b/Profile/Profile/Presentation/DatesAndCalendar/CoursesToSyncView.swift @@ -84,43 +84,65 @@ public struct CoursesToSyncView: View { private var coursesList: some View { VStack(alignment: .leading, spacing: 24) { - ForEach( - Array( - viewModel.coursesForSync.filter({ course in - course.synced == viewModel.synced && (!viewModel.hideInactiveCourses || course.active) - }) - .sorted { $0.active && !$1.active } - .enumerated() - ), - id: \.offset - ) { _, course in - HStack { - CheckBoxView( - checked: Binding( - get: { course.synced }, - set: { _ in viewModel.toggleSync(for: course) } - ), - text: course.name, - color: Theme.Colors.textPrimary.opacity(course.active ? 1 : 0.8) - ) - - if !course.active { - Text(ProfileLocalization.CoursesToSync.inactive) - .font(Theme.Fonts.labelSmall) - .foregroundStyle(Theme.Colors.textPrimary.opacity(0.8)) + if viewModel.coursesForSync.allSatisfy({ !$0.synced }) && viewModel.synced { + noSyncedCourses + } else { + ForEach( + Array( + viewModel.coursesForSync.filter({ course in + course.synced == viewModel.synced && (!viewModel.hideInactiveCourses || course.active) + }) + .sorted { $0.active && !$1.active } + .enumerated() + ), + id: \.offset + ) { _, course in + HStack { + CheckBoxView( + checked: Binding( + get: { course.synced }, + set: { _ in viewModel.toggleSync(for: course) } + ), + text: course.name, + color: Theme.Colors.textPrimary.opacity(course.active ? 1 : 0.8) + ) + + if !course.active { + Text(ProfileLocalization.CoursesToSync.inactive) + .font(Theme.Fonts.labelSmall) + .foregroundStyle(Theme.Colors.textPrimary.opacity(0.8)) + } } + .frame( + minWidth: 0, + maxWidth: .infinity, + alignment: .leading + ) } - .frame( - minWidth: 0, - maxWidth: .infinity, - alignment: .leading - ) } Spacer(minLength: 100) } .padding(.horizontal, 24) .padding(.vertical, 16) } + + private var noSyncedCourses: some View { + VStack(spacing: 8) { + Spacer() + CoreAssets.learnEmpty.swiftUIImage + .resizable() + .frame(width: 96, height: 96) + .foregroundStyle(Theme.Colors.textSecondaryLight) + Text(ProfileLocalization.Sync.noSynced) + .foregroundStyle(Theme.Colors.textPrimary) + .font(Theme.Fonts.titleMedium) + Text(ProfileLocalization.Sync.noSyncedDescription) + .multilineTextAlignment(.center) + .foregroundStyle(Theme.Colors.textPrimary) + .font(Theme.Fonts.labelMedium) + .frame(width: 245) + } + } } #if DEBUG diff --git a/Profile/Profile/SwiftGen/Strings.swift b/Profile/Profile/SwiftGen/Strings.swift index 4b22b06f0..d83527f97 100644 --- a/Profile/Profile/SwiftGen/Strings.swift +++ b/Profile/Profile/SwiftGen/Strings.swift @@ -281,11 +281,17 @@ public enum ProfileLocalization { /// Wi-fi only download public static let wifiTitle = ProfileLocalization.tr("Localizable", "SETTINGS.WIFI_TITLE", fallback: "Wi-fi only download") } + public enum Sync { + /// No Synced Courses + public static let noSynced = ProfileLocalization.tr("Localizable", "SYNC.NO_SYNCED", fallback: "No Synced Courses") + /// No courses are currently being synced to your calendar. + public static let noSyncedDescription = ProfileLocalization.tr("Localizable", "SYNC.NO_SYNCED_DESCRIPTION", fallback: "No courses are currently being synced to your calendar.") + } public enum SyncSelector { /// Not Synced public static let notSynced = ProfileLocalization.tr("Localizable", "SYNC_SELECTOR.NOT_SYNCED", fallback: "Not Synced") - /// Synced - public static let synced = ProfileLocalization.tr("Localizable", "SYNC_SELECTOR.SYNCED", fallback: "Synced") + /// To Sync + public static let synced = ProfileLocalization.tr("Localizable", "SYNC_SELECTOR.SYNCED", fallback: "To Sync") } public enum UnsavedDataAlert { /// Changes you have made will be discarded. diff --git a/Profile/Profile/en.lproj/Localizable.strings b/Profile/Profile/en.lproj/Localizable.strings index 22d0ad920..d94e1152c 100644 --- a/Profile/Profile/en.lproj/Localizable.strings +++ b/Profile/Profile/en.lproj/Localizable.strings @@ -146,5 +146,8 @@ "DROP_DOWN_PICKER.SELECT" = "Select"; -"SYNC_SELECTOR.SYNCED" = "Synced"; +"SYNC_SELECTOR.SYNCED" = "To Sync"; "SYNC_SELECTOR.NOT_SYNCED" = "Not Synced"; + +"SYNC.NO_SYNCED" = "No Synced Courses"; +"SYNC.NO_SYNCED_DESCRIPTION" = "No courses are currently being synced to your calendar."; diff --git a/Profile/Profile/uk.lproj/Localizable.strings b/Profile/Profile/uk.lproj/Localizable.strings index 3132616c7..da932c17e 100644 --- a/Profile/Profile/uk.lproj/Localizable.strings +++ b/Profile/Profile/uk.lproj/Localizable.strings @@ -143,3 +143,6 @@ "CALENDAR.COURSE_DATES" = "%@ Дати курсу"; "DROP_DOWN_PICKER.SELECT" = "Оберіть"; + +"SYNC.NO_SYNCED" = "Немає синхронізованих курсів"; +"SYNC.NO_SYNCED_DESCRIPTION" = "Жоден курс зараз не синхронізується з вашим календарем.";