Skip to content

Commit

Permalink
fix: address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanStepanok committed Jul 17, 2024
1 parent 0bd4f6d commit bc7a304
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions Profile/Profile/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion Profile/Profile/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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.";
3 changes: 3 additions & 0 deletions Profile/Profile/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@
"CALENDAR.COURSE_DATES" = "%@ Дати курсу";

"DROP_DOWN_PICKER.SELECT" = "Оберіть";

"SYNC.NO_SYNCED" = "Немає синхронізованих курсів";
"SYNC.NO_SYNCED_DESCRIPTION" = "Жоден курс зараз не синхронізується з вашим календарем.";

0 comments on commit bc7a304

Please sign in to comment.