Skip to content

Commit d9bf4d6

Browse files
committed
fix: do not hide the ongoing session
1 parent ad7ec7a commit d9bf4d6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Schedule.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,9 @@ export const Schedule = ({
111111
</thead>
112112
<tbody>
113113
{Object.entries(sessions)
114-
.filter(
115-
([time]) =>
116-
!hidePastSessions ||
117-
startsInMinutes(userTime(time as unknown as number)) > 0,
118-
)
119-
.map(([time, name], i, sessions) => {
114+
.map((session, i, sessions) => {
115+
const time = session[0] as unknown as number
116+
120117
const nextIsOngoing =
121118
sessions[i + 1] !== undefined
122119
? startsInMinutes(
@@ -125,9 +122,12 @@ export const Schedule = ({
125122
: false
126123

127124
const isOngoing =
128-
startsInMinutes(userTime(time as unknown as number)) < 0 &&
129-
!nextIsOngoing
130-
125+
startsInMinutes(userTime(time)) < 0 && !nextIsOngoing
126+
const isPast = startsInMinutes(userTime(time)) < 0 && !isOngoing
127+
return { session, isPast, isOngoing }
128+
})
129+
.filter(({ isPast }) => (hidePastSessions ? !isPast : true))
130+
.map(({ session: [time, name], isOngoing }) => {
131131
return (
132132
<tr key={time} className={isOngoing ? 'ongoing' : ''}>
133133
<td className={'time'}>

0 commit comments

Comments
 (0)