Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dates Screen Stylistic Changes #253

Conversation

shafqat-muneer
Copy link
Contributor

@shafqat-muneer shafqat-muneer commented Jan 23, 2024

Jira Tickets:

  • LEARNER-9735: iOS - Dates Screen Stylistic Changes
  • LEARNER-9739: iOS - Icons beside course date links on the dates screen

Github Issues:

Light Mode

Simulator.Screen.Recording.-.iPhone.15.-.2024-01-23.at.11.21.07.mp4

Dark Mode

Simulator.Screen.Recording.-.iPhone.15.-.2024-01-23.at.11.21.47.mp4

Comment on lines 1 to 6
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming the Date to CourseDates for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
}

private func applyDateFormatterForShortWeekdayMonthDayYear(dateFormatter: DateFormatter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming it to applyShortWeekdayMonthDayYear as dateFormatter is a parameter so I guess there isn't any need to mention it in the name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

case -6...(-2):
return dateFormatterString
case 2...6:
return self.timeAgoDisplay()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

return dateFormatterString
} else {
// It means, date is in hours past due or upcoming
return self.timeAgoDisplay()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

}

func isCurrentYear() -> Bool {
let years = Calendar.current.dateComponents([.year], from: self, to: Date())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming years to datecomponents or to components?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it to components as it seems more appropriate.


let calendar = Calendar.current
let todayComponents = calendar.dateComponents([.year, .month, .day], from: .today)
var sortedStatusToDateToCourseDateBlockDict: [CompletionStatus: [Date: [CourseDateBlock]]] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about giving it a simpler name like statusDatesBlocks or sortedStatusDatesBlocks thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names now simplified

Comment on lines 18 to 19
var statusToDateToCourseDateBlockDict: [CompletionStatus: [Date: [CourseDateBlock]]] = [:]
var statusToCourseDateBlockDict: [CompletionStatus: [CourseDateBlock]] = [:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are local variables so simpler names will be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names now simplified


if dateComponents == todayComponents {
hasToday = true
switch true {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to have switch on true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just an alternate approach to prevent having a lengthy series of if-else blocks. Each case independently assesses its own condition to build a completion status dictionary.

Comment on lines 8 to 10
"blue" : "0.984",
"green" : "0.980",
"red" : "0.976"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to change the CardViewBackground color?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We offer expandable/collapsible sections labeled as "Completed." These sections come with their own background and border stroke colors for both dark and light modes. The designer provided these colors in Figma designs, which closely resemble our existing color palette. Instead of introducing a new set of colors, I made slight adjustments to the existing palette to ensure its versatility.

For instance, in light mode, the background color of the "Completed" section is now CCD4E0, whereas it was previously FFFFFF (white). This change was made to address the issue of indistinguishability between the screen background and the section background, using the specified Figma color for clarity.

Light Mode Dark Mode
Simulator Screenshot - iPhone 15 - 2024-01-24 at 20 42 17 Simulator Screenshot - iPhone 15 - 2024-01-24 at 20 47 55

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For safer side, I introduced separate colors for calendar completed section background and stroke colors in light and dark mode.

@@ -23,7 +23,7 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.435",
"blue" : "0.439",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to change this color?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason is same as described here.

saeedbashir
saeedbashir previously approved these changes Jan 26, 2024
Copy link
Contributor

@saeedbashir saeedbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Contributor

@rnr rnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! just small comments in code

ForEach(Array(viewModel.sortedStatuses), id: \.self) { status in
let courseDateBlockDict = courseDates.statusDatesBlocks[status]!
if status == .completed {
CompletedBlocks(isExpanded: $isExpanded,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please change this to 'each parameter on own line' style?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Text(block.formattedDate)
.font(Theme.Fonts.labelMedium)
.foregroundStyle(Theme.Colors.textPrimary)
BlockStatusView(viewModel: viewModel,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Image(systemName: "chevron.right")
.resizable()
.scaledToFit()
.frame(width: 6.55, height: 11.15)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, how do you calculate that kind of accuracy? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this precision from figma designs 😄
Screenshot 2024-01-29 at 1 07 08 PM

func blocks(for date: Date) -> [CourseDateBlock] {
courseDates?.sortedDateToCourseDateBlockDict[date] ?? []
var sortedStatuses: [CompletionStatus] {
let desiredSequence = [CompletionStatus.completed,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'each parameter on own line' style please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -230,7 +230,7 @@ class CourseRepositoryMock: CourseRepositoryProtocol {

func getCourseDates(courseID: String) async throws -> CourseDates {
do {
let courseDates = try courseDatesJSON.data(using: .utf8)!.mapResponse(DataLayer.CourseDates.self)
let courseDates = try CourseRepository.courseDatesJSON.data(using: .utf8)!.mapResponse(DataLayer.CourseDates.self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need // swiftlint:disable all above if you moved json string out this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out. Just removed and refactored some warnings.

@rnr
Copy link
Contributor

rnr commented Jan 26, 2024

I think this should say '1 item' instead of 'items'
Screenshot 2024-01-26 at 18 28 16

@rnr
Copy link
Contributor

rnr commented Jan 26, 2024

This text looks too small and it's grey also - hard to read this.
Screenshot 2024-01-26 at 17 58 15
@moiz994 what do you think?

@rnr
Copy link
Contributor

rnr commented Jan 26, 2024

@shafqat-muneer @moiz994
Perhaps we need to follow a uniform arrows animation style for expandable areas (we have one in coursework already)?
Thank you

Screen.Recording.2024-01-26.at.17.56.49.mov
Screen.Recording.2024-01-26.at.17.57.09.mov

@shafqat-muneer
Copy link
Contributor Author

This text looks too small and it's grey also - hard to read this. Screenshot 2024-01-26 at 17 58 15 @moiz994 what do you think?

In the Figma designs, the font size is set to 11px, but our application doesn't support this specific size. Our options are either 10 or 12. I opted for Theme.Fonts.labelSmall, which has a size of 10. If we want to increase it to 12, we can choose Theme.Fonts.labelMedium. By selecting Theme.Fonts.labelMedium, it will resemble the screenshot provided.

On the matter of the color grey, I utilized the same color as in Figma for the light mode, as there is no specified dark mode color for the description text. Therefore, the light mode color was exactly same as of ThisWeekTimeline bar color. For the dark mode, I used the ThisWeekTimeline bar dark mode provided color.
Simulator Screenshot - iPhone 15 - 2024-01-29 at 15 33 38

@rnr
Copy link
Contributor

rnr commented Jan 29, 2024

This text looks too small and it's grey also - hard to read this. Screenshot 2024-01-26 at 17 58 15 @moiz994 what do you think?

In the Figma designs, the font size is set to 11px, but our application doesn't support this specific size. Our options are either 10 or 12. I opted for Theme.Fonts.labelSmall, which has a size of 10. If we want to increase it to 12, we can choose Theme.Fonts.labelMedium. By selecting Theme.Fonts.labelMedium, it will resemble the screenshot provided.

On the matter of the color grey, I utilized the same color as in Figma for the light mode, as there is no specified dark mode color for the description text. Therefore, the light mode color was exactly same as of ThisWeekTimeline bar color. For the dark mode, I used the ThisWeekTimeline bar dark mode provided color. Simulator Screenshot - iPhone 15 - 2024-01-29 at 15 33 38

@shafqat-muneer
I think you can create another font in the theme if needed for design purposes (I believe we shouldn't be limited 10 and 12 only)
For example, the font labelMediumSmall its size 11.
Thank you

@shafqat-muneer
Copy link
Contributor Author

@shafqat-muneer @moiz994 Perhaps we need to follow a uniform arrows animation style for expandable areas (we have one in coursework already)? Thank you

Screen.Recording.2024-01-26.at.17.56.49.mov

Screen.Recording.2024-01-26.at.17.57.09.mov

Done. It will now look like this:
https://github.com/openedx/openedx-app-ios/assets/11990137/f0112edd-8c81-4e37-bd7b-930983cd88a0

@shafqat-muneer
Copy link
Contributor Author

This text looks too small and it's grey also - hard to read this. Screenshot 2024-01-26 at 17 58 15 @moiz994 what do you think?

In the Figma designs, the font size is set to 11px, but our application doesn't support this specific size. Our options are either 10 or 12. I opted for Theme.Fonts.labelSmall, which has a size of 10. If we want to increase it to 12, we can choose Theme.Fonts.labelMedium. By selecting Theme.Fonts.labelMedium, it will resemble the screenshot provided.
On the matter of the color grey, I utilized the same color as in Figma for the light mode, as there is no specified dark mode color for the description text. Therefore, the light mode color was exactly same as of ThisWeekTimeline bar color. For the dark mode, I used the ThisWeekTimeline bar dark mode provided color. Simulator Screenshot - iPhone 15 - 2024-01-29 at 15 33 38

@shafqat-muneer I think you can create another font in the theme if needed for design purposes (I believe we shouldn't be limited 10 and 12 only) For example, the font labelMediumSmall its size 11. Thank you

@rnr We don't need to introduce a new size. I verified this with Sam here, and he recommended using the labelMedium style (font size 12). Therefore, I adjusted it from 10 to 12.

@shafqat-muneer
Copy link
Contributor Author

@rnr All feedback has been addressed. Kindly review. Thank you.

@shafqat-muneer shafqat-muneer merged commit f4a19e0 into openedx:develop Jan 30, 2024
3 checks passed
@shafqat-muneer shafqat-muneer deleted the Shafqat/LEARNER-9735-DateScreenChanges branch January 30, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Icon beside course content on the dates screen [iOS] Dates Tab Stylistic Changes
4 participants