-
Notifications
You must be signed in to change notification settings - Fork 0
TA Announcements
TA Announcements is a feature that the TA / Professors can use to share announcements to a particular session. A TA / Professor should be able to post a new announcement, delete an announcement, and view other announcements. A student should be able to view all current announcements.
The component requires a user
prop with type FireUser
and a session
prop with type FireSession
. Since the two information are stored in the redux store, the current TA Announcements component receive from the redux store.
This state is a boolean controlling whether the body of the TA announcements section shows or not. The body can show either the current announcement list or a text box for adding a new announcement -- [true] for visible, [false] for not rendered.
This state is a boolean controlling whether the list of announcements is shown or not -- [true] for visible, [false] for not rendered.
This state is a boolean controlling whether the new announcement text box is shown or not -- [true] for visible, [false] for not rendered.
This state is a string controlling the content of the new announcement
This state is a type of TaAnnouncement[]
which stores the list of current announcements for the session
- Parameters: None
- Runtime: O(1)
- Returns: void
- This function is triggered when the circle plus icon is clicked. It sets the body to show by setting
showBody
totrue
and setsshowNewAnnouncements
totrue
andshowAnnouncements
tofalse
so that the list of announcements are shown first.
- Parameters: None
- Runtime: O(1)
- Returns: void
- This function is triggered when the chevron button is clicked. It may either collapse the body or not, so it sets
showBody
tofalse
if it was set totrue
, and sets it totrue
if it was set tofalse
.
- Parameters:
e
, which corresponds to theReact.ChangeEvent<HTMLInputElement>
type - Runtime: O(1)
- Returns: void
- This function is triggered whenever a TA / professor edits the current announcement. It sets the input text as the
announcementContent
value.
- Parameters: None
- Runtime: O(1)
- Returns: void
- This function is triggered when the cancel button is clicked while a TA / professor was inputting a new announcement. It sets the
announcementContent
back to an empty string and collapses the entire body.
- Parameters: None
- Runtime: O(n) where n is the number of current announcements
- Returns: void
- This function is triggered when a TA / professor clicks on the post button for posting a new announcement. It triggers the backend function
addTaAnnouncement
and successfully adds a new announcement.
- Parameters:
announcement
of typestring
,uploadTime
of typeFireTimeStamp
- Runtime: O(n) where n is the number of current announcements
- Returns: void
- This function is triggered when a TA / professor deletes an announcement. It triggers the backend function
deleteTaAnnouncement
and successfully deletes the announcement.
- Parameters:
announcement
of typeTaAnnouncement
- Runtime: O(1)
- Returns: number
- This function returns the time difference between the current time and when the announcement was posted.
- The useEffect sets the
taAnnouncements