Skip to content

SessionView Component

Jeremy Jung edited this page Mar 14, 2021 · 5 revisions

SessionView Component

SessionView is the container for any office hour or review session. It is the container for any information about the session, including the time of the session, how many people are ahead, and any questions that have been added to the queue.

Props and State

As a container for the session, many of the props passed down to SessionView are there to pass down to descendants of SessionView, such as SessionQuestionsContainer, the container for all of the questions. However, one important prop that is used in SessionView is questions, which is the array of all the questions for the session and is used several times within the component's code.

Notable states that are kept track of include prevQuestSet, which keeps track of the set of previous questions. This is used as a comparison to execute code whenever new questions are added to the queue. showNotifBanner is a boolean, which, if set to true and the user does not have notifications enabled, allows for a view to be shown that asks the user to enable notifications to know when their question is up.

Component structure (just notable containers, views for better understanding)

[StudentSessionView]: The wrapper for the session

  • [SessionNotification]: View that displays only when user does not have notifications enabled and asks for user to enable notifications
  • [SessionInformationHeader]: Component that displays information about the session. This includes the time in which the session is held, the number of people ahead, and the zoom link (if applicable).
  • [SessionQuestionsContainer]: Component that contains all of the questions for a session.

Functions

updateSessionProfile

  • Parameters: virtualLocation: string
  • Runtime: O(n)
  • Returns: none

Sets any questions that are assigned to have its answerer location property as the virtual location of the person who answers the question (e.g. a TA).

isOpen

  • Parameters: s: FireSession, interval: number
  • Runtime: O(1)
  • Returns: boolean

Checks if the current session is open. The interval gives a period of time before TAs and professors start answering questions in which users can add questions, so users who come early can put their questions in the queue before the session starts. It checks if the current time is between the start time, adjusted by the interval, and the end time.