Skip to content

Commit

Permalink
fix: do not hide the ongoing session
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Mar 12, 2022
1 parent ad7ec7a commit d9bf4d6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@ export const Schedule = ({
</thead>
<tbody>
{Object.entries(sessions)
.filter(
([time]) =>
!hidePastSessions ||
startsInMinutes(userTime(time as unknown as number)) > 0,
)
.map(([time, name], i, sessions) => {
.map((session, i, sessions) => {
const time = session[0] as unknown as number

const nextIsOngoing =
sessions[i + 1] !== undefined
? startsInMinutes(
Expand All @@ -125,9 +122,12 @@ export const Schedule = ({
: false

const isOngoing =
startsInMinutes(userTime(time as unknown as number)) < 0 &&
!nextIsOngoing

startsInMinutes(userTime(time)) < 0 && !nextIsOngoing
const isPast = startsInMinutes(userTime(time)) < 0 && !isOngoing
return { session, isPast, isOngoing }
})
.filter(({ isPast }) => (hidePastSessions ? !isPast : true))
.map(({ session: [time, name], isOngoing }) => {
return (
<tr key={time} className={isOngoing ? 'ongoing' : ''}>
<td className={'time'}>
Expand Down

0 comments on commit d9bf4d6

Please sign in to comment.