The actions to manipulate the store state
- Source
Methods
(static) add_class(teacher_email, class_id, class_name, class_period) → {Promise}
Add a class to the active user's document, and show a toast saying that the class was added
Name | Type | Description |
---|---|---|
teacher_email | String | The email of the teacher whose class it is |
class_id | String | The id of the class to add |
class_name | String | The name of the class being added |
class_period | Number | The period of the class being added |
- Source
- See
- classes
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) archive_task(task_ref) → {Promise}
Archive an instance of a task from a class (for teachers). Intended to be preformed from the ViewTask Modal
Name | Type | Description |
---|---|---|
task_ref | String | the "email/class_id" String representation of the task ref in firebase |
- Source
- See
- create_task
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) class_from_ref(ref) → {Promise}
Get the class object from a class reference
Name | Type | Description |
---|---|---|
ref | String | The class reference to get the class object from |
- Source
A promise that resolves to the class object or rejects with an error
- Type:
- Promise
(static) class_text(class_obj) → {String}
get the smart text associated with a given class
Name | Type | Description |
---|---|---|
class_obj | String |
- Source
text - the formatted name text associated with the class data
- Type:
- String
(static) clear()
Reset the store state and local storage, and redirect to home if page requires auth
- Source
(static) code_from_ref(ref)
Create a proxy code from a ref (email/uid)
Name | Type | Description |
---|---|---|
ref | String | ref in email/uid format |
- Source
- See
- hash
(static) create_class(class_obj) → {Promise}
Create a class with the given object, and add it to the active user's document. (for teachers)
Name | Type | Description |
---|---|---|
class_obj | Object | The class object to with the class data, document will be created in /classes under the teacher's email with these contents |
- Source
- See
- is_teacher
- teacher
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) create_doc()
Create the user's document in the remote database, create a teacher document if the user is a teacher, and create a personal account if the user is using a personal account. Also preforms onboarding for non-teacher
- Source
- See
- create_teacher_doc
- update_remote
- get_remote
(static) create_task(task_obj, task_classes) → {Promise}
Create a task with the given object, and add it to the classes specified in the object. (for teachers)
Name | Type | Description |
---|---|---|
task_obj | Object | The task object to with the task data, data will be added to /classes docs |
task_classes | Array | The classes to add the task to |
- Source
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) create_teacher_doc()
Create the teacher document for the user, and redirect to the create class page
- Source
- See
- create_doc
- is_teacher
(static) doc_from_uid(uid) → {Promise}
Get a user document from a uid
Name | Type | Description |
---|---|---|
uid | String | The uid of the user to get the document for |
- Source
- See
- getDoc
- link_account_uid
A promise that resolves to the {Object} user document or rejects with an {String} error
- Type:
- Promise
(static) fetch_classes() → {Array}
Fetch all classes from the user's document and combine them into an array, while checking for duplicates and invalid classes
- Source
- See
- classes
- fetch_classes_by_email
- remove_invalid
- remove_class
- remove_class_id_helper
Array of all (unique) classes from the user's document
- Type:
- Array
(static) fetch_classes_by_email(email)
Fetch all classes for a given email, and set the loaded classes to the result
Name | Type | Description |
---|---|---|
email | String | The email to fetch classes for |
- Source
- See
- loaded_classes
- loaded_email
- fetch_classes
(static) finish_tutorial() → {Promise}
Set the user's tutorial status to finished
- Source
- See
- done_tutorial
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) get_cached_surveys(dates) → {Promise}
Get the survey data for the given dates for this user, using the cached data in the active doc. If the data does not include the given dates, get the data from the server and save it to use as the cashe
Name | Type | Description |
---|---|---|
dates | Array | Array of dates to get the survey data for |
- Source
- See
- save_daily_survey
- done_daily_survey
Promise resolving to survey data for the given dates, with date objects added to each object
- Type:
- Promise
(static) get_remote()
Get the user's document from the remote database, and create it if it doesn't exist. Preforms additional checks for personal accounts, and removes the linked account if it doesn't exist
- Source
- See
- create_doc
- update_remote
- active_doc
(static) get_surveys(dates) → {Array}
Get the survey data for the given dates for this user
Name | Type | Description |
---|---|---|
dates | Array | Array of dates to get the survey data for |
- Source
- See
- save_daily_survey
- done_daily_survey
The survey data for the given dates, with date objects added to each object
- Type:
- Array
(static) get_tasks() → {Promise}
Get all tasks from all classes
- Default Value
- []
- Source
- See
- fetch_classes
Promise that resolves to Array of all tasks from all classes, with class name and color added
- Type:
- Promise
(static) hash(ref) → {String}
Name | Type | Description |
---|---|---|
ref | String | ref in email/uid format |
- Source
- See
- code_from_ref
6-character code from ref
- Type:
- String
(static) hide_timeout()
Hide the popup saying that the session has timed out
- Source
- See
- show_timeout
- refresh_timeout
(static) invite_linked(email) → {Promise}
Invite a user account to link to another user's account (for personal accounts only,) including sending them an email with the code to join
Name | Type | Description |
---|---|---|
email | String | The email of the user to invite (and send an invite email to) |
- Source
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) link_account_uid(uid) → {Promise}
Link a user account to another user's account by uid (for personal accounts only)
Name | Type | Description |
---|---|---|
uid | String | The uid of the user to link to |
- Source
- See
- invite_linked
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) login() → {Promise}
Log the user in with Google OAuth (using the appropriate prompt type based on window support), and set the user object.
- Source
- See
- user
- logout
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) login_personal() → {Promise}
Most things that login() does, but for personal accounts (does not preform org account check, enforce sign-in domain, or redirect)
- Source
- See
- personal_account
- user
- login
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) login_promise() → {Promise}
A wrapper for the store.user state, to wait for the user to be set
- Source
- See
- user
- login
A promise that resolves to the user object
- Type:
- Promise
(static) logout()
Log the user out and clear the store state
- Source
- See
- clear
(static) note_for(ref) → {String}
Get the note for the given ref
Name | Type | Description |
---|---|---|
ref | String | The ref of the task to get the note for |
- Source
- See
- set_note
- notes
The note for the given ref
- Type:
- String
(static) path_to_ref(path) → {String}
Convert a path to a ref (email~class_id?~task_id)
Name | Type | Description |
---|---|---|
path | String | The path to convert |
- Default Value
- null
- Source
The ref (email~class_id?~task_id)
- Type:
- String
(static) ref_from_code(code) → {Promise}
Get the ref (email/uid) from a code
Name | Type | Description |
---|---|---|
code | String | The code to get the ref for |
- Source
A promise that resolves to the ref (email/uid) or rejects with an error
- Type:
- Promise
(static) ref_to_path(path) → {String}
Convert a ref to a path (email/class_id?/task_id)
Name | Type | Description |
---|---|---|
path | String | The path to convert |
- Default Value
- null
- Source
The ref (email/class_id?/task_id)
- Type:
- String
(static) refresh_timeout(delay)
A proxy for the refreshTimeout function in firebase.ts (to reduce unnecessary onSnapshot calls)
Name | Type | Description |
---|---|---|
delay | Number | The delay in milliseconds to refresh the timeout for (default 1000 set in firebase.ts) |
- Source
- See
- refreshTimeout
(static) remove_class()
Remove a class from the active user's document, and show a toast saying that the class was removed manually
- Source
- See
- remove_class_id_helper
(static) remove_class_id_helper()
Helper function to remove a class from the active user's document and save changes to remote
- Source
- See
- remove_class
- remove_invalid
- fetch_classes
(static) remove_invalid()
Remove a class from the active user's document, and show a toast saying that the class was removed because it was invalid
- Source
- See
- remove_class_id_helper
(static) report_logs() → {Promise}
save logs to server for debugging later, with some session data attached
- Source
- Type:
- Promise
(static) save_daily_survey(responses) → {Promise}
Save the responses from the daily survey to the active user's document
Name | Type | Description |
---|---|---|
responses | Object | The responses from the daily survey to save |
- Source
- See
- done_daily_survey
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) save_join_form(responses) → {Promise}
Save the responses from the join form to the active user's document
Name | Type | Description |
---|---|---|
responses | Object | The responses from the join form to save |
- Source
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) set_account_pref(pref, value) → {Promise}
Set a preference in the account doc
Name | Type | Description |
---|---|---|
pref | String | The preference to set |
value | String | The value to set the preference to |
- Source
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) set_active(data)
Set the active document (the signed-in account's doc, or the linked account's if it exists) to the provided document
Name | Type | Description |
---|---|---|
data | Object | The document data to replace the active document (account_doc or linked_doc) with |
- Source
(static) set_finished(finished, ref) → {Promise}
set a task with the given ref to finished in the finished array of the active doc (remove if finished is false, add path if finished is true)
Name | Type | Description |
---|---|---|
finished | Boolean | The finished status to set |
ref | String | The ref of the task to check |
- Source
- See
- is_finished
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) set_note(note, ref) → {Promise}
set a task with the given path to have a note in the keyed "notes" property of the active doc (remove if value is falsey, add note if truthy)
Name | Type | Description |
---|---|---|
note | String | The note to set |
ref | String | The ref of the task to set the note for |
- Source
- See
- note_for
- notes
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) set_user()
Set the user object and load the user's document, with some additional checks and error handling. Also set the user's document if it exists, or create it if it doesn't, and logs them out if the account is deemed invalid
- Source
- See
- user
- authChangeAction
- account_doc
- linked_account_doc
- personal_account
(static) show_timeout()
Show a popup saying that the session has timed out
- Source
- See
- hide_timeout
- refresh_timeout
(static) task_from_ref(ref) → {Promise}
Get the task object from a task reference
Name | Type | Description |
---|---|---|
ref | String | The task reference to get the task object from |
- Source
A promise that resolves to the task object or rejects with an {String} error
- Type:
- Promise
(static) toggle_simplified()
Toggle the simplified display view
- Source
- See
- account_doc
(static) toggle_teacher() → {Promise}
Toggle teacher mode (for testing)
- Source
- See
- is_teacher
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) toggle_theme()
Toggle the theme between light and dark, and save to local storage and user account doc
- Source
- See
- get_theme
- theme
(static) uninvite_linked() → {Promise}
Unlink a user account from another user's account (for personal accounts only)
- Source
- See
- invite_linked
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) upcoming_from_ref(ref, class_obj)
Get the next 4 upcoming task objects for a given class reference
Name | Type | Description |
---|---|---|
ref | String | |
class_obj | Object |
- Source
(static) update_class(class_ref, class_obj) → {Promise}
Update an instance of a class (for teachers). Intended to be preformed from the EditClass Modal
Name | Type | Description |
---|---|---|
class_ref | String | the "email/class_id" String representation of the class ref in firebase |
class_obj | Object | The updated class object |
- Source
A promise that resolves to nothing or rejects with an error
- Type:
- Promise
(static) update_remote()
Update the active user's document in the remote database
- Source
- See
- get_remote
- active_doc
- active_ref
(static) update_task(task_ref, task_obj) → {Promise}
Update an instance of a task from a class (for teachers). Intended to be preformed from the EditTask Modal
Name | Type | Description |
---|---|---|
task_ref | String | the "email/class_id/task_id" String representation of the task ref in firebase |
task_obj | Object | The updated task object |
- Source
A promise that resolves to nothing or rejects with an {String} error
- Type:
- Promise
(static) update_wrapper_acc_doc()
Update the authenticated user's document in the remote database (for personal accounts only)
- Source
- See
- update_remote
- personal_account
(static) update_wrapper_acc_doc()
Update the authenticated user's document in the remote database with the data given (for personal accounts only)
- Source
- See
- update_remote
- personal_account
- update_wrapper_acc_doc