Cocurricular transcript styling adjustments#1783
Open
sofistonehouse wants to merge 8 commits intodevelopfrom
Open
Cocurricular transcript styling adjustments#1783sofistonehouse wants to merge 8 commits intodevelopfrom
sofistonehouse wants to merge 8 commits intodevelopfrom
Conversation
Contributor
Author
|
Not styled correctly on mobile but I will continue to work on that |
bennettforkner
requested changes
May 3, 2023
Comment on lines
+31
to
+36
| <div className={styles.organization_role}>Leader ({formatDuration(leaderSessions)})</div> | ||
| </div> | ||
| )} | ||
| {memberSessions.length > 0 && ( | ||
| <div className={styles.participation_line}> | ||
| <div className={styles.organization_role}>Member ({formatDuration(memberSessions)})</div> |
Contributor
There was a problem hiding this comment.
For consistency and readability, it's probably best to format these the same as Advisor above.
Suggested change
| <div className={styles.organization_role}>Leader ({formatDuration(leaderSessions)})</div> | |
| </div> | |
| )} | |
| {memberSessions.length > 0 && ( | |
| <div className={styles.participation_line}> | |
| <div className={styles.organization_role}>Member ({formatDuration(memberSessions)})</div> | |
| <div className={styles.organization_role}> | |
| Leader ({formatDuration(leaderSessions)}) | |
| </div> | |
| </div> | |
| )} | |
| {memberSessions.length > 0 && ( | |
| <div className={styles.participation_line}> | |
| <div className={styles.organization_role}> | |
| Member ({formatDuration(memberSessions)}) | |
| </div> |
Comment on lines
+84
to
+103
| const formatFinalDuration = (sessionRecords: MembershipHistorySession[]) => { | ||
| const sessions = sessionRecords | ||
| .map((s) => sessionService.parseSessionCode(s.SessionCode)) | ||
| .sort(compareAsc); | ||
|
|
||
| const intervalDescriptions: string[] = []; | ||
| let interval: MembershipInterval | undefined; | ||
|
|
||
| sessions.forEach((session) => { | ||
| if (interval === undefined) { | ||
| // If this is the first session, initialize interval. | ||
| interval = new MembershipInterval(session); | ||
| } else { | ||
| // Extend the interval. | ||
| interval.extendTo(session); | ||
| } | ||
| }); | ||
|
|
||
| return interval?.toString(); | ||
| }; |
Contributor
There was a problem hiding this comment.
This is a lot of repeated code for doing something only slightly different from formatDuration(sessions).
Perhaps you could eliminate formatFinalDuration(...) and update the formatDuration(sessions) function to the following:
const formatDuration = (sessionRecords: MembershipHistorySession[], summarizeDates: bool = false) => {
...
} else if (interval.consecutiveWith(session) || summarizeDates) {
...
return intervalDescriptions.join(', ');
};
Then you could just call formatDuration(sessions, true) instead of formatFinalDuration(...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before:

After:

Mobile View:
