-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cocurricular transcript styling adjustments #1783
base: develop
Are you sure you want to change the base?
Conversation
Not styled correctly on mobile but I will continue to work on that |
<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> |
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 consistency and readability, it's probably best to format these the same as Advisor
above.
<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> |
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(); | ||
}; |
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.
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(...)
Before:
![image](https://user-images.githubusercontent.com/115327891/234392853-f7c3b871-6a9e-4207-9c85-55c69fe74596.png)
After:
![image](https://user-images.githubusercontent.com/115327891/235964667-3bca9b18-7b9b-4552-afe7-c0473607827e.png)
Mobile View:
![image](https://user-images.githubusercontent.com/115327891/235964816-e4b1ee0a-8d38-4eb7-98fb-76e3fbd4bfbd.png)