How fks-benri-app/benriapp works
BenriApp is a React PWA for receiving and browsing Google Classroom announcements. The student flow links a school account through GAS, signs into Firebase, enables push notifications, then views announcements and their details; GAS detects new posts and sends notifications. Other documented capabilities include per-class notification preferences, an editable home gadget layout, offline announcement caching, and experimental timetable OCR. The graph includes these domain stages and supporting storage/theme layers. Some subsystem implementations were not excerpted, so their internal connections are omitted; README-described external flows are cited there.
Main entry points: App.jsx App routes · announcements.js Announcement access and cache · LinkPage.jsx Link and permissions · Class.jsx Announcement list and detail
Components 28
Account and app shell
- App routes
src/App.jsx - Identity session
src/auth/identity.jsx - Firebase Auth
src/lib/firebase.js - Account settings
src/pages/Settings.jsx - Device storage
src/lib/storage.js - Link and permissions
src/pages/LinkPage.jsx
Announcements
- Announcement list and detail
src/pages/Class.jsx - Announcement access and cache
src/lib/announcements.js - Lazy Firestore access
src/lib/firestoreLazy.js - Live user data
src/lib/liveStore.js - Announcement filters
src/lib/filters.js
Push notifications
- Class notification preferences
src/pages/NotifySettings.jsx - Preference access
src/lib/notifyPrefs.js - Push health and repair
src/lib/pushStatus.js - OneSignal subscription
src/lib/onesignal.js - FCM messaging
src/lib/fcm.js - Push services
Home gadgets
- Home layout editor
src/pages/Home.jsx - Gadget registry
src/gadgets/index.js - Announcement gadget
src/gadgets/ClassNoticesGadget.jsx - Next class gadget
src/gadgets/NextClassGadget.jsx - Layout persistence
src/lib/homeLayout.js
Timetable OCR
- Timetable test screen
src/pages/OcrTest.jsx - PaddleOCR runtime
src/lib/paddleOcr.js - Timetable grid builder
src/lib/timetableGrid.js - Course matching
src/lib/timetableMatch.js
Other components
- Student
- GAS login and notifier
Connections 34
- Student → Link and permissions: starts linking
- Link and permissions → GAS login and notifier: requests school login
- GAS login and notifier → Identity session: returns login token
- Identity session → Firebase Auth: signs in
src/auth/identity.jsx - Identity session → Device storage: persists identity
src/auth/identity.jsx - App routes → Identity session: checks session
src/App.jsx - Link and permissions → OneSignal subscription: initializes and subscribes
src/pages/LinkPage.jsx - Link and permissions → Push health and repair: checks push key
src/pages/LinkPage.jsx - GAS login and notifier → Push services: sends notifications
- Push services → Student: delivers push
- App routes → FCM messaging: starts foreground listener
src/App.jsx - FCM messaging → OneSignal subscription: uses subscription integration
src/lib/fcm.js - App routes → Announcement list and detail: routes to announcements
src/App.jsx - Announcement list and detail → Announcement access and cache: loads and marks read
src/pages/Class.jsx - Announcement access and cache → Lazy Firestore access: reads and updates
src/lib/announcements.js - Announcement access and cache → Live user data: watches live data
src/lib/announcements.js - Announcement access and cache → Device storage: caches announcements
src/lib/announcements.js - Announcement list and detail → Announcement filters: filters announcements
src/pages/Class.jsx - Announcement list and detail → Push health and repair: checks repair state
src/pages/Class.jsx - Class notification preferences → Preference access: manages class preferences
src/pages/NotifySettings.jsx - Class notification preferences → OneSignal subscription: reads device subscription
src/pages/NotifySettings.jsx - Account settings → Preference access: uses preferences
src/pages/Settings.jsx - App routes → Home layout editor: routes home
src/App.jsx - Home layout editor → Gadget registry: loads gadget definitions
src/pages/Home.jsx - Home layout editor → Layout persistence: loads and saves layout
src/pages/Home.jsx - Layout persistence → Device storage: persists layout
src/lib/homeLayout.js - Gadget registry → Announcement gadget: registers component
src/gadgets/index.js - Gadget registry → Next class gadget: registers component
src/gadgets/index.js - Announcement gadget → Announcement access and cache: reads announcements
src/gadgets/ClassNoticesGadget.jsx - App routes → Timetable test screen: routes test screen
src/App.jsx - Timetable test screen → PaddleOCR runtime: runs OCR
src/pages/OcrTest.jsx - Timetable test screen → Timetable grid builder: builds timetable
src/pages/OcrTest.jsx - Timetable test screen → Course matching: matches course names
src/pages/OcrTest.jsx - Timetable grid builder → Course matching: uses matching
src/lib/timetableGrid.js