Skip to content

👥 Design of account sync feature

Joseph Azevedo edited this page Oct 24, 2021 · 19 revisions

Major components

  • Account login via Firebase Authentication
  • Document storage via Firebase Cloud Firestore
  • Separation of state into schedule data (list of schedule terms, schedule versions) and view state (current schedule term, current schedule version, light/dark mode)

Separation of state & schedule data v2

  • Separate state into:
  • Add schedule data v2:
    // Version 2 schedule data (2021-10-23)
    // ===================================
    //  - addition of unique keys for schedule versions
    //  - addition of createdAt fields for schedule versions
    //    to provide natural, reconcilable, sort order
    //  - removal of all `currentIndex` and `currentTerm` fields
    //    (instead to be stored in separate ui state)
    

Account login: ✔️ (for the most part)

  • Using Firebase UI Web for React: https://github.com/firebase/firebaseui-web-react
  • Goal: local state, upon first login it gets uploaded to Firebase
    • If logged out, local state remains
    • (need to add some sort of reconciliation functionality)
  • Add AccountContext to app that contains state of login, and is loaded under the AppDataLoader
  • Add UI to top right with auth state, and shift around items in the header to make room
  • Make the UI usable on mobile displays
  • Clean up app skeletons to not need each variant and instead change based on props
  • Add dark mode theming to email flow
  • (future) Fix the tooltip upon copying CRNs to use a sane approach

Image: logged out

logged out

Image: logged in

logged in

Image: log in modal

log in modal

Document storage

  • Use a single document-per-user's account data with the full JSON stored
  • Upon initial login, upload this
  • Any updates cause a write, transparently to the rest of the stack
  • Fix Firestore console warning
  • (future) add production Firebase app, security
  • (future) TODO disable firebase integration when running locally without credentials

Image: account sync working between browsers

account sync working between browsers