Skip to content

Commit

Permalink
chore: theme improvements and no handouts handling (#294)
Browse files Browse the repository at this point in the history
* chore: theme improvements and no handouts navigation fix

* fix: removing extra items

* refactor: address review feedback
  • Loading branch information
saeedbashir authored Feb 28, 2024
1 parent 739ec5c commit 2b68d2e
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public struct SignInView: View {
VStack(alignment: .center) {
ThemeAssets.appLogoLight.swiftUIImage
.resizable()
.frame(maxWidth: 189, maxHeight: 54)
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 189, maxHeight: 89)
.padding(.top, isHorizontal ? 20 : 40)
.padding(.bottom, isHorizontal ? 10 : 40)
.accessibilityIdentifier("logo_image")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public struct StartupView: View {
VStack(alignment: .leading) {
ThemeAssets.appLogo.swiftUIImage
.resizable()
.frame(maxWidth: 189, maxHeight: 54)
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 189, maxHeight: 89)
.padding(.top, isHorizontal ? 20 : 40)
.padding(.bottom, isHorizontal ? 0 : 20)
.padding(.horizontal, isHorizontal ? 10 : 24)
Expand Down
4 changes: 2 additions & 2 deletions Core/Core/View/Base/CourseButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct CourseButton: View {
if isCompleted {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
} else {
image
.foregroundColor(Theme.Colors.textPrimary)
Expand All @@ -41,7 +41,7 @@ public struct CourseButton: View {
Spacer()
Image(systemName: "chevron.right")
.padding(.vertical, 8)
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
}
.padding(.horizontal, 36)
.padding(.vertical, 14)
Expand Down
1 change: 1 addition & 0 deletions Core/Core/View/Base/SnackBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public struct SnackBarView: View {
HStack {
Text(message)
.font(Theme.Fonts.titleSmall)
.foregroundColor(Theme.Colors.snackbarTextColor)
Spacer()

if let action = action {
Expand Down
3 changes: 1 addition & 2 deletions Core/Core/View/Base/VideoDownloadQualityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public struct VideoDownloadQualityView: View {
Spacer()
CoreAssets.checkmark.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
.opacity(quality == viewModel.selectedDownloadQuality ? 1 : 0)
.accessibilityIdentifier("checkmark_image")

Expand Down Expand Up @@ -163,4 +163,3 @@ public extension DownloadQuality {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ public struct HandoutsUpdatesDetailView: View {
router: CourseRouter,
cssInjector: CSSInjector
) {
if handouts != nil {
let noHandouts = handouts == nil && announcements == nil

if announcements == nil {
self.title = CourseLocalization.HandoutsCellHandouts.title
} else {
self.title = CourseLocalization.HandoutsCellAnnouncements.title
}
self.handouts = handouts

self.handouts = noHandouts ? CourseLocalization.Error.noHandouts : handouts
self.announcements = announcements
self.router = router
self.cssInjector = cssInjector
Expand Down
3 changes: 1 addition & 2 deletions Course/Course/Presentation/Handouts/HandoutsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ struct HandoutsView: View {
} else {
VStack(alignment: .leading) {
HandoutsItemCell(type: .handouts, onTapAction: {
guard let handouts = viewModel.handouts else { return }
viewModel.router.showHandoutsUpdatesView(
handouts: handouts,
handouts: viewModel.handouts,
announcements: nil,
router: viewModel.router,
cssInjector: viewModel.cssInjector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct CourseStructureNestedListView: View {
if sequential.completion == 1 {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
} else {
sequential.type.image
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct CourseStructureView: View {
if child.completion == 1 {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
} else {
child.type.image
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct CourseUnitDropDownCell: View {
if vertical.completion == 1 {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
}
}
.frame(width: 25)
Expand Down
2 changes: 2 additions & 0 deletions Course/Course/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public enum CourseLocalization {
public enum Error {
/// Course component not found, please reload
public static let componentNotFount = CourseLocalization.tr("Localizable", "ERROR.COMPONENT_NOT_FOUNT", fallback: "Course component not found, please reload")
/// There are currently no handouts for this course
public static let noHandouts = CourseLocalization.tr("Localizable", "ERROR.NO_HANDOUTS", fallback: "There are currently no handouts for this course")
/// You are not connected to the Internet. Please check your Internet connection.
public static let noInternet = CourseLocalization.tr("Localizable", "ERROR.NO_INTERNET", fallback: "You are not connected to the Internet. Please check your Internet connection.")
/// Reload
Expand Down
1 change: 1 addition & 0 deletions Course/Course/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"ERROR.NO_INTERNET" = "You are not connected to the Internet. Please check your Internet connection.";
"ERROR.RELOAD" = "Reload";
"ERROR.COMPONENT_NOT_FOUNT" = "Course component not found, please reload";
"ERROR.NO_HANDOUTS" = "There are currently no handouts for this course";

"ALERT.ROTATE_DEVICE" = "Rotate your device to view this video in full screen.";
"ALERT.ACCEPT" = "Accept";
Expand Down
1 change: 1 addition & 0 deletions Course/Course/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"ERROR.NO_INTERNET" = "Ви не підключені до Інтернету. Перевірте підключення до Інтернету і спробуйте ще.";
"ERROR.RELOAD" = "Перезавантажити";
"ERROR.COMPONENT_NOT_FOUNT" = "Course component not found, please reload";
"ERROR.NO_HANDOUTS" = "There are currently no handouts for this course";

"ALERT.ROTATE_DEVICE" = "Поверніть пристрій, щоб переглянути це відео на весь екран.";
"ALERT.ACCEPT" = "Accept";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct DeleteAccountView: View {
ZStack {
CoreAssets.bgDelete.swiftUIImage
CoreAssets.deleteChar.swiftUIImage
.foregroundColor(.accentColor)
.foregroundColor(Theme.Colors.accentXColor)
.offset(y: -31)
CoreAssets.deleteEyes.swiftUIImage
.offset(x: -7, y: -27)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ struct ProfileSupportInfoView: View {
HStack {
CoreAssets.checkmark.swiftUIImage
.renderingMode(.template)
.foregroundColor(.green)
.foregroundColor(Theme.Colors.success)
Text(ProfileLocalization.Settings.upToDate)
.font(Theme.Fonts.labelMedium)
.foregroundStyle(Theme.Colors.textSecondary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.408",
"red" : "0.235"
"blue" : "1.0",
"green" : "1.0",
"red" : "1.0"
}
},
"idiom" : "universal"
Expand All @@ -20,12 +20,12 @@
}
],
"color" : {
"color-space" : "display-p3",
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.482",
"red" : "0.565"
"blue" : "1.0",
"green" : "1.0",
"red" : "1.0"
}
},
"idiom" : "universal"
Expand Down
38 changes: 38 additions & 0 deletions Theme/Theme/Assets.xcassets/Colors/Success.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x71",
"green" : "0xA1",
"red" : "0x30"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x4D",
"green" : "0x7D",
"red" : "0x0D"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
7 changes: 4 additions & 3 deletions Theme/Theme/SwiftGen/ThemeAssets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public enum ThemeAssets {
public static let commentCellBackground = ColorAsset(name: "CommentCellBackground")
public static let loginBackground = ColorAsset(name: "LoginBackground")
public static let loginNavigationText = ColorAsset(name: "LoginNavigationText")
public static let secondaryButtonBorderColor = ColorAsset(name: "SecondaryButtonBorderColor")
public static let secondaryButtonTextColor = ColorAsset(name: "SecondaryButtonTextColor")
public static let shadowColor = ColorAsset(name: "ShadowColor")
public static let snackbarErrorColor = ColorAsset(name: "SnackbarErrorColor")
public static let snackbarInfoAlert = ColorAsset(name: "SnackbarInfoAlert")
public static let snackbarInfoColor = ColorAsset(name: "SnackbarInfoColor")
public static let snackbarTextColor = ColorAsset(name: "SnackbarTextColor")
public static let snackbarWarningColor = ColorAsset(name: "SnackbarWarningColor")
public static let splashBackground = ColorAsset(name: "SplashBackground")
public static let styledButtonBackground = ColorAsset(name: "StyledButtonBackground")
public static let styledButtonText = ColorAsset(name: "StyledButtonText")
public static let success = ColorAsset(name: "Success")
public static let textPrimary = ColorAsset(name: "TextPrimary")
public static let textSecondary = ColorAsset(name: "TextSecondary")
public static let textSecondaryLight = ColorAsset(name: "TextSecondaryLight")
Expand All @@ -55,6 +55,7 @@ public enum ThemeAssets {
public static let textInputUnfocusedBackground = ColorAsset(name: "TextInputUnfocusedBackground")
public static let textInputUnfocusedStroke = ColorAsset(name: "TextInputUnfocusedStroke")
public static let navigationBarTintColor = ColorAsset(name: "navigationBarTintColor")
public static let secondaryButtonBorderColor = ColorAsset(name: "secondaryButtonBorderColor")
public static let warning = ColorAsset(name: "warning")
public static let white = ColorAsset(name: "white")
public static let datesSectionBackground = ColorAsset(name: "DatesSectionBackground")
Expand Down
14 changes: 10 additions & 4 deletions Theme/Theme/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public struct Theme {
public private(set) static var shadowColor = ThemeAssets.shadowColor.swiftUIColor
public private(set) static var snackbarErrorColor = ThemeAssets.snackbarErrorColor.swiftUIColor
public private(set) static var snackbarWarningColor = ThemeAssets.snackbarWarningColor.swiftUIColor
public private(set) static var snackbarInfoAlert = ThemeAssets.snackbarInfoAlert.swiftUIColor
public private(set) static var snackbarInfoColor = ThemeAssets.snackbarInfoColor.swiftUIColor
public private(set) static var snackbarTextColor = ThemeAssets.snackbarTextColor.swiftUIColor
public private(set) static var styledButtonText = ThemeAssets.styledButtonText.swiftUIColor
public private(set) static var textPrimary = ThemeAssets.textPrimary.swiftUIColor
public private(set) static var textSecondary = ThemeAssets.textSecondary.swiftUIColor
Expand All @@ -54,6 +55,7 @@ public struct Theme {
public private(set) static var navigationBarTintColor = ThemeAssets.navigationBarTintColor.swiftUIColor
public private(set) static var secondaryButtonBorderColor = ThemeAssets.secondaryButtonBorderColor.swiftUIColor
public private(set) static var secondaryButtonTextColor = ThemeAssets.secondaryButtonTextColor.swiftUIColor
public private(set) static var success = ThemeAssets.success.swiftUIColor

public static func update(
accentColor: Color = ThemeAssets.accentColor.swiftUIColor,
Expand All @@ -73,7 +75,8 @@ public struct Theme {
upcomingTimelineColor: Color = ThemeAssets.upcomingTimelineColor.swiftUIColor,
shadowColor: Color = ThemeAssets.shadowColor.swiftUIColor,
snackbarErrorColor: Color = ThemeAssets.snackbarErrorColor.swiftUIColor,
snackbarInfoAlert: Color = ThemeAssets.snackbarInfoAlert.swiftUIColor,
snackbarInfoColor: Color = ThemeAssets.snackbarInfoColor.swiftUIColor,
snackbarTextColor: Color = ThemeAssets.snackbarTextColor.swiftUIColor,
styledButtonText: Color = ThemeAssets.styledButtonText.swiftUIColor,
textPrimary: Color = ThemeAssets.textPrimary.swiftUIColor,
textSecondary: Color = ThemeAssets.textSecondary.swiftUIColor,
Expand All @@ -91,7 +94,8 @@ public struct Theme {
datesSectionStroke: Color = ThemeAssets.datesSectionStroke.swiftUIColor,
navigationBarTintColor: Color = ThemeAssets.navigationBarTintColor.swiftUIColor,
secondaryButtonBorderColor: Color = ThemeAssets.secondaryButtonBorderColor.swiftUIColor,
secondaryButtonTextColor: Color = ThemeAssets.secondaryButtonTextColor.swiftUIColor
secondaryButtonTextColor: Color = ThemeAssets.secondaryButtonTextColor.swiftUIColor,
success: Color = ThemeAssets.success.swiftUIColor
) {
self.accentColor = accentColor
self.accentXColor = accentXColor
Expand All @@ -110,7 +114,8 @@ public struct Theme {
self.upcomingTimelineColor = upcomingTimelineColor
self.shadowColor = shadowColor
self.snackbarErrorColor = snackbarErrorColor
self.snackbarInfoAlert = snackbarInfoAlert
self.snackbarInfoColor = snackbarInfoColor
self.snackbarTextColor = snackbarTextColor
self.styledButtonText = styledButtonText
self.textPrimary = textPrimary
self.textSecondary = textSecondary
Expand All @@ -129,6 +134,7 @@ public struct Theme {
self.navigationBarTintColor = navigationBarTintColor
self.secondaryButtonBorderColor = secondaryButtonBorderColor
self.secondaryButtonTextColor = secondaryButtonTextColor
self.success = success
}
}

Expand Down

0 comments on commit 2b68d2e

Please sign in to comment.