The notification system generates contextual alerts from recent shipment activity and surfaces them in a panel accessible from every authenticated page. Notifications are not pushed from a server — they are derived on the client from the most recently saved entries inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/raceliciouss/YUSEN-LIMO-WAREHOUSE/llms.txt
Use this file to discover all available pages before exploring further.
warehouseShipments and stored in Local Storage so that read/unread state persists across page reloads and browser sessions.
Notification Bell
The topbar on every authenticated page contains a notification button (.notification-btn) rendered as a bell icon (bi-bell-fill). When there are unread notifications, a badge element (.badge) overlays the bell and displays the unread count. The badge is hidden (display: none) when all notifications have been read.
Badge state is maintained by updateNotificationBadge(), which counts items where item.read === false in the current notificationState array and writes that count to the badge element’s textContent.
Notification Panel
Clicking the notification bell creates and appends a.notification-panel overlay element to the page if it does not already exist, then toggles its visibility. The panel slides open from the topbar and displays all current notifications.
The panel is structured as:
- Header — displays “Notifications” as the panel title alongside a Mark all as read button (
.mark-all-read, using thebi-check2-allicon). - Body — a scrollable list of
.notification-itemelements, one per notification object innotificationState. - Footer (
.notification-footer) — a View All Notifications link (.view-all-notifications).
.notification-item receives an unread or read class based on item.read, and carries a data-id attribute matching the notification’s id field. The item displays a type-specific icon, the notification title, description, meta string, and a time label.
Notification Object Structure
Each entry innotificationState conforms to this shape:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the notification, composed of a type prefix and savedAt timestamp (e.g. latest-1704067200000-inbound) |
type | string | One of inbound, outbound, status, inventory, warning, or shipment |
title | string | Short human-readable headline (e.g. "New inbound shipment") |
description | string | Full sentence describing the event (e.g. "A new inbound shipment for HAWB-001 arrived and is ready for receiving.") |
meta | string | Reference label displayed in bold under the description (e.g. "HAWB HAWB-001", "MAWB MAWB-999", or "Client ACME Corp") |
time | string | Human-readable time label (e.g. "Just now", "Recently updated", "Needs attention") |
read | boolean | false = unread (shown with unread class and “New” label); true = read |
Notification types and icons
type value | Icon class |
|---|---|
warning | bi-exclamation-triangle-fill |
inventory | bi-box-seam |
status | bi-arrow-repeat |
inbound, outbound, shipment | bi-truck |
How Notifications Are Generated
Notifications are not stored directly by the save workflow. Instead,buildNotificationState() is called by refreshNotificationState() every time warehouse:data-updated fires. It reads warehouseShipments, sorts records by savedAt descending, and derives up to five notification items from the six most recent raw shipment entries:
- Latest shipment notification (
type: inboundortype: outbound) — generated from the most recently saved record. The title reads “New inbound shipment” or “New outbound shipment” depending onentryType. Starts asread: false. - Shipment status updated (
type: status) — generated from the second most recent record, referencing the latest aggregated status value. Starts asread: false. - Inventory updated (
type: inventory) — generated from the third most recent record, noting that inventory values were refreshed. Starts asread: trueby default. - Low inventory warning (
type: warning) — generated if any of the six recent records has a quantity value of2or fewer. Starts asread: trueby default. - Shipment added (
type: shipment) — generated from the fourth most recent record as a general confirmation entry. Starts asread: trueby default.
id: 'empty-notifications' and the message “No recent shipment activity.”
The meta field for each notification is resolved in priority order: HAWB → MAWB → client → "Warehouse".
Mark as Read
Mark all as read
Clicking the.mark-all-read button in the panel header maps notificationState to set every item’s read property to true, calls saveNotificationState() to persist the change, and re-renders the panel and badge. All items switch to the read class and the badge disappears.
Mark individual as read
Clicking any.notification-item in the panel body finds the matching item by data-id, sets its read property to true, and calls saveNotificationState() followed by renderNotificationPanel() and updateNotificationBadge(). The item’s class changes from unread to read and its time label changes from “New” to “Read”.
Local Storage Persistence
Notification state is persisted under the keywarehouseNotificationState. The value is a JSON-serialised array of notification objects.
loadNotificationState() reads this key on DOMContentLoaded. If the key is absent or the stored value is not a valid JSON array, an empty array is returned and no error is thrown. saveNotificationState() writes the current notificationState array back to the key after every read or mark-all-read operation.
When refreshNotificationState() rebuilds the notification list from fresh shipment data, it preserves existing read/unread state for any id that already exists in the stored array using a Map lookup. This means that marking a notification as read survives a page navigation or browser refresh — the read: true value for that id is re-applied when the notification is regenerated on the next load.
Because
warehouseNotificationState is written to localStorage (not sessionStorage), notification read/unread state persists across page reloads, tab closures, and browser restarts for as long as the user’s browser storage for the origin is not cleared. Opening a second browser tab for the same origin will share the same notification state once either tab triggers a save and the other tab reloads.