Skip to content

Commit 877e5da

Browse files
authored
Merge pull request #1435 from topcoder-platform/leave-tracker
Update for firstname / last name instead of handle on team leave cale…
2 parents 2b03599 + 9ac8763 commit 877e5da

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/apps/calendar/src/lib/components/Calendar/Calendar.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { isWeekend } from 'date-fns'
12
import { MouseEvent, useMemo } from 'react'
23
import classNames from 'classnames'
34

45
import { LoadingSpinner } from '~/libs/ui'
56

6-
import { LeaveDate } from '../../models'
7+
import { LeaveDate, LeaveStatus } from '../../models'
78
import {
89
getDateKey,
910
getMonthDates,
@@ -86,9 +87,14 @@ export const Calendar = (props: CalendarProps): JSX.Element => {
8687
}
8788

8889
const dateKey = getDateKey(date)
90+
const isWeekendDate = isWeekend(date)
8991
const status = getStatusForDate(date, leaveDates)
92+
const displayStatus = isWeekendDate && status === LeaveStatus.AVAILABLE
93+
? LeaveStatus.WEEKEND
94+
: status
9095
const isSelected = selectedDates.has(dateKey)
91-
const statusClass = styles[getStatusColor(status)]
96+
const statusClass = styles[getStatusColor(displayStatus)]
97+
const isDisabled = isLoading || isWeekendDate
9298

9399
return (
94100
<button
@@ -104,7 +110,7 @@ export const Calendar = (props: CalendarProps): JSX.Element => {
104110
)}
105111
data-date-key={dateKey}
106112
onClick={handleDateClick}
107-
disabled={isLoading}
113+
disabled={isDisabled}
108114
>
109115
<span className={styles.dateNumber}>{date.getDate()}</span>
110116
</button>

src/apps/calendar/src/lib/components/TeamCalendar/TeamCalendar.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ const getUserDisplayName = (user: TeamLeaveUser): string => {
1919
.filter(Boolean)
2020
.join(' ')
2121

22-
return fullName || user.handle || user.userId
22+
if (fullName) {
23+
return fullName
24+
}
25+
26+
if (user.status === LeaveStatus.WIPRO_HOLIDAY || user.userId === 'wipro-holiday') {
27+
return user.handle || user.userId
28+
}
29+
30+
return user.userId
2331
}
2432

2533
const compareUsersByName = (userA: TeamLeaveUser, userB: TeamLeaveUser): number => {

0 commit comments

Comments
 (0)