-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Dates Screen Stylistic Changes #253
Conversation
42112fd
to
b02e13b
Compare
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self
is redundant.
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self
is redundant.
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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]]] { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names now simplified
var statusToDateToCourseDateBlockDict: [CompletionStatus: [Date: [CourseDateBlock]]] = [:] | ||
var statusToCourseDateBlockDict: [CompletionStatus: [CourseDateBlock]] = [:] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
"blue" : "0.984", | ||
"green" : "0.980", | ||
"red" : "0.976" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
---|---|
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same here
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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? :)
There was a problem hiding this comment.
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 😄
func blocks(for date: Date) -> [CourseDateBlock] { | ||
courseDates?.sortedDateToCourseDateBlockDict[date] ?? [] | ||
var sortedStatuses: [CompletionStatus] { | ||
let desiredSequence = [CompletionStatus.completed, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This text looks too small and it's grey also - hard to read this. |
@shafqat-muneer @moiz994 Screen.Recording.2024-01-26.at.17.56.49.movScreen.Recording.2024-01-26.at.17.57.09.mov |
In the Figma designs, the font size is set to 11px, but our application doesn't support this specific size. Our options are either 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. |
@shafqat-muneer |
Done. It will now look like this: |
@rnr We don't need to introduce a new size. I verified this with Sam here, and he recommended using the |
@rnr All feedback has been addressed. Kindly review. Thank you. |
Jira Tickets:
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