Files
jitsi-meet/css/_time_timer.scss
David Szabo 8f37e82d1f feat(time-timer): meeting pace timer in the conference info bar (#17468)
* feat(time-timer): add optional meeting-pace timer in the info bar

Adds an optional meeting-pace timer to the conference info bar: a pill
showing the meeting name, scheduled duration, elapsed time, and a countdown
disk that fills as the meeting progresses, changing colour to signal where
you are relative to the scheduled end. Off by default
(config.timeTimer.enabled), so existing deployments are unaffected.

Source-agnostic by design:
The timer core renders from two numbers — duration and elapsed (seconds
since the scheduled start) — and knows nothing about where they come from.
Deployers supply them through existing per-meeting channels:
  * configOverwrite.timeTimer — for iframe-API embedders (verified path).
  * native calendar-sync — opening a meeting from Jitsi's Google/Microsoft
    calendar list feeds the event's duration + start into the same core,
    with no embedder.
elapsed (not remaining) is the single source of truth, so a participant who
joins after the scheduled end lands directly in the correct over-schedule
state instead of the timer disabling itself.

Visual states:
  * running  — blue disk filling, blue digits
  * warning  — final 5 min: amber disk + digits; the bar briefly auto-expands
    to draw attention, then auto-hides
  * expired  — past the scheduled end: red disk + pink digits; bar
    auto-expands once; a "Timer ended" sticky notification with a live
    over-schedule counter; red inset border on the conference grid
  * overrun lap 2+ — solid red disk with a continuous CSS conic sweep
    (base red -> deep wine at the leading edge) conveying ongoing motion
  * collapsed — when the toolbar hides, the pill morphs into a 36x28
    disk-only chip

Implementation:
  * New react/features/time-timer/ feature (actionTypes / actions / reducer /
    middleware / functions / constants + components/web/{TimeTimerPill,disk}),
    registered via the standard Reducer/Middleware registries.
  * Replaces the default subject + conference-timer info-bar widgets only
    when enabled; otherwise the standard bar is unchanged.
  * Disk is SVG; the lap-2 overrun sweep uses a CSS conic-gradient overlay.
  * Two i18n keys added (timeTimer.endedTitle, timeTimer.endedOver).

Known limitations (deliberately scoped out):
  * The timer is per-participant — keyed to the calendar event that
    participant joined through, not a shared room clock. Two events reusing
    one link show each group their own slot's timer (correct by design);
    ad-hoc joiners see the standard bar.
  * A participant who stays across two back-to-back events on the same link
    keeps the timer of the event they originally joined through (no
    time-based rollover). They still get the "Timer ended" notification and
    can rejoin via the next event's entry. Rollover is a possible future
    enhancement.

* feat(time-timer): control via iframe API; don't start without a duration

Addresses review feedback:

- Require a real duration. On CONFERENCE_JOINED the timer no longer
  falls back to an arbitrary default when timeTimer.enabled is set but
  no duration is known. `enabled` alone is not enough — it starts only
  when a duration comes from a calendar event or the embedder-provided
  `defaultDuration`, so we never show a meaningless countdown.

- Add an iframe API `setMeetingTimer` command so embedded / JaaS
  deployments (which don't use calendar sync) can push duration and
  elapsed at runtime. A positive duration starts/updates the timer; a
  missing/non-positive duration clears it. Calendar sync remains as an
  additional, optional source feeding the same source-agnostic core.

* refactor(time-timer): enable by default, drop config duration options

Per review:

- Enabled by default. The timer renders nothing until a duration is
  known, so defaulting it on lets calendar/iframe-API deployments see it
  with no extra config. `timeTimer: { enabled: false }` opts out.

- Drop `defaultDuration` and `defaultElapsed`. They don't make sense in
  the majority of cases — duration comes from a calendar event or the
  `setMeetingTimer` iframe API command, both of which also carry the
  elapsed/start information. `enabled` is now the only config key.

* refactor(time-timer): centralize enabled/expired checks in feature utils

Addresses review comments:

- Add `isTimeTimerEnabled(state)` (enabled by default — only an explicit
  `enabled === false` turns it off) as the single source of truth for the
  enabled rule. Use it in the middleware, the pill, and the conference
  info bar instead of three separate inline reads.

- Fix the enabled check in the pill and the info bar: they used a truthy
  read of `timeTimer.enabled`, which hid the timer when the value was
  undefined — i.e. the on-by-default case. They now follow the same rule
  via the utility.

- Add `isTimeTimerExpiredUnacknowledged(state)` and use it in place of the
  inline `expired && !acknowledged` read in Conference.tsx.

- Add `time-timer` to the documented `conferenceInfo.alwaysVisible`
  default in config.js to match the in-code default.

* fix(time-timer): address review — regression, stale state, drift, conventions

Critical:
- The info-bar gate hid the meeting subject + conference timer on every
  default deployment: it keyed on isTimeTimerEnabled() (true by default)
  while the pill renders nothing until a timer runs, so the replaced
  labels vanished with nothing in their place. Gate on enabled AND
  running instead.

Bugs:
- Reset timer state on CONFERENCE_LEFT (via stopTimeTimer) so a rejoin no
  longer inherits a frozen / expired pill from the previous meeting.
- STOP_TIME_TIMER now clears expired/acknowledged and hides the ended
  notification, so the red border + notification don't outlive the timer.
- setMeetingTimer ignores commands when the feature is disabled, so an
  embedder can't drive a timeTimer:{enabled:false} deployment into the
  running / expired state.
- Tick is now timestamp-based: state stores the scheduled end and the
  reducer recomputes remaining/over from Date.now() each tick, so a
  throttled background tab can't accumulate drift.
- Calendar duration is keyed to the room and only applied when the joined
  room matches, so a duration from a meeting opened-but-not-joined can't
  leak into a different meeting. Also parse the ISO date strings correctly
  (the previous `as any[]` masked a string-vs-number bug).

Conventions / perf:
- Register the reducer in reducers.web.ts (not a middleware side-effect).
- Rename middleware.ts -> middleware.web.ts and disk.tsx -> Disk.tsx.
- Rename SET_CALENDAR_DURATION -> SET_TIME_TIMER_CALENDAR_DURATION and add
  JSDoc to the action types.
- Reuse getLocalizedDurationFormatter for the overrun time so the
  notification and pill agree (1:15:03, not 75:03).
- Drop the dead DEFAULT_DURATION_SECONDS; seed state with 0.
- Add logger.ts.
- Draw the overrun conic-gradient via an inline style instead of
  makeStyles, so it no longer generates a new CSS class every second.

* refactor(time-timer): connected notification description + e2e spec

Two follow-ups from review:

- The timer-ended notification's live overrun counter no longer re-fires
  showNotification every second. The description is now a small connected
  component (TimeTimerEndedDescription) that subscribes to overSeconds, so
  only that text node re-renders; the notification is posted exactly once
  per timer via a _notifyExpiredOnce guard. This keeps the middleware free
  of React-element construction. The guard fires for both the live
  end-crossing and a timer that starts already expired (late joiner /
  embedder pushing an overrun timer).

- Add an e2e spec for the setMeetingTimer iframe API command covering: no
  pill until a duration is pushed, pill appears on push, expired state
  (red border + ended notification), clear, and the command being a no-op
  when timeTimer.enabled is false. Adds a data-testid to the pill for the
  spec to target.

* fix(time-timer): match calendar room name case-insensitively

Room names are normalised to lowercase, but a calendar URL may preserve
the original casing; comparing them as-is could silently drop the
duration for a legitimate calendar meeting. Lower-case both sides.
2026-06-08 10:19:23 -05:00

23 lines
803 B
SCSS

/**
* When the meeting time-timer has reached / passed the scheduled end, draw a
* red inset frame around the whole conference video area. Implemented via an
* `::after` pseudo-element so the frame paints on top of LargeVideo / the
* filmstrip (those children fill #videospace and would otherwise cover any
* shadow / border drawn on the parent itself). The pseudo-element is
* non-interactive so it doesn't intercept clicks.
*/
// #videospace already has `position: absolute` so it acts as the
// containing block for our absolutely-positioned ::after.
#videospace.timer-expired::after {
border: 3px solid #F24D5F;
box-sizing: border-box;
content: '';
height: 100%;
left: 0;
pointer-events: none;
position: absolute;
top: 0;
width: 100%;
z-index: 1000;
}