FocusFlow provides a layered notification system that combines an in-app notification center, synthesised audio chimes via the Web Audio API, and native browser push notifications. Every notification originates from a call toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/piratta/gymApp/llms.txt
Use this file to discover all available pages before exploring further.
triggerNotification, which simultaneously plays a chime, attempts a native push, and returns a structured AppNotification object ready to be persisted to fit_notifications in Firestore. All audio and browser notification functions degrade gracefully — they suppress errors silently when the necessary browser APIs are unavailable.
AppNotification type
Every notification displayed in FocusFlow’s notification center conforms to this interface (defined insrc/types.ts):
Field reference
| Field | Type | Description |
|---|---|---|
id | string | Unique ID in the format "notif_<timestamp>_<random>". |
userId | string | The User.id of the recipient — either a coach or a client. |
title | string | Short notification headline shown in the notification badge. |
message | string | Full body text of the notification. |
type | "workout" | "review" | "message" | "general" | Controls the notification icon and colour in the UI. |
timestamp | string | ISO 8601 creation time, e.g. "2025-06-10T14:32:00.000Z". |
isRead | boolean | false on creation; set to true when the user opens the notification center. |
linkTab | string (optional) | Dashboard tab to navigate to when the notification is tapped. |
Notification types
linkTab navigation
When a user taps a notification, FocusFlow routes them to the tab named bylinkTab. The value maps directly to a dashboard tab identifier. Both coach and client dashboards share the same identifier space:
| linkTab value | Destination |
|---|---|
"workout" | Active workout / workout mode |
"calendar" | Training calendar |
"progress" | Progress & weight charts |
"review" | Client check-in review form |
"gallery" | Progress photo gallery |
"chat" | Coach-athlete chat |
"profile" | User profile settings |
"athletes" | Coach’s athlete roster |
"templates" | Workout template library |
"messages" | Coach messages list |
"settings" | App settings |
"reviews" | Coach review management |
"agenda" | Coaching agenda & calendar |
"billing" | Subscription & billing |
"summary" | Workout summary log |
"exercises_menu" | Exercise catalog |
linkTab renders the notification as non-navigable — tapping it simply marks it as read.
Audio notifications
All audio synthesis happens synchronously inside a try/catch block. If the Web Audio API is unavailable or blocked, a warning is logged and the function returns silently without throwing.playNotificationSound
triggerNotification for new messages and general alerts.
Browsers require a prior user gesture (click, keypress, etc.) before an
AudioContext can be created. If the athlete has not yet interacted with the page, the chime will be silently suppressed and a console warning will be emitted. The notification itself is still created and stored normally.playRestTimerEndSound
[100, 50, 100]) is triggered via navigator.vibrate.
Used exclusively by the workout mode rest timer when the countdown reaches zero.
Browser push notifications
requestNotificationPermission
Promise<boolean>:
trueif permission is"granted".falseif permission is"denied", if theNotificationAPI is unsupported, or if the request throws.
sendBrowserNotification
Notification.permission === "granted". Uses a standard athletic dumbbell icon and the tag "fit-app-alert" (duplicate tags replace the previous notification rather than stacking).
The notification headline shown in the OS notification tray.
The notification body text.
window.self !== window.top, logs an informational message, and skips the new Notification() call — the in-app slider notification handles display instead.
Clicking the native notification calls window.focus() to bring the FocusFlow tab to the foreground.
triggerNotification
AppNotification object. The caller is responsible for adding the returned object to the fit_notifications array and persisting it via saveToCloud.
The
User.id of the notification recipient.Short notification headline (also used as the native push title).
Full notification body text (also used as the native push body).
Notification category. Controls UI presentation.
Optional dashboard tab to navigate to on tap. See the linkTab navigation table above.
AppNotification with a unique id, isRead: false, and a fresh ISO timestamp.
- Calls
playNotificationSound()— synthesises the two-tone chime. - Calls
sendBrowserNotification(title, message)— fires a native OS push if permitted. - Returns the new
AppNotificationobject (does not auto-persist to Firestore).