Development: Frontend: Stores - zhaw-timetable/zhawo GitHub Wiki
-
GlobalStore
- Values
- globalStore.handleActions(action)
- globalStore.initializeStore()
- globalStore.setTheme(value)
- globalStore.getUserFromDB()
- globalStore.getThemeFromDB()
- globalStore.setThemeInDB()
- globalStore.setCurrentUser()
- globalStore.removeCurrentUser()
- globalStore.setViewStateInDB()
- globalStore.getViewStateFromDB()
- globalStore.removeViewStateFromDB()
- MensaStore
-
RoomSearchStore
- Values
- roomSearchStore.handleActions(action)
- roomSearchStore.fetchFreeRoomData() ⇒
Promise.<Array.<Floor>> - roomSearchStore.getCurrentFreeRooms(startTime, endTime, currentFreeRooms)
- roomSearchStore.getCommonElements(array1, array2) ⇒
Array.<string> - roomSearchStore.getTimeSlotsBetweenTimes(startTime, endTime) ⇒
Array.<number> - roomSearchStore.getBuildingFloors(selectedFloor) ⇒
Array.<JSX.Element> - roomSearchStore.handleError(err)
- ScheduleStore
- VszhawStore
Global Flux Store
Kind: global class
| Name | Inital Value |
|---|---|
| theme | 'lightTheme' |
| currentUser | '' |
| currentUserType | '' |
| possibleNames | [] |
| possibleLoginNames | [] |
| drawerOpen | false |
| isDayView | true |
| viewState | 0 |
Function that is called after action is dispatched Uses switch to filter actions
Kind: instance method of GlobalStore
| Param | Type |
|---|---|
| action | FluxAction |
Function that calls functions that initialize store with info found in idb
Kind: instance method of GlobalStore
Function that sets theme in both store and calls for it to be set in idb
Kind: instance method of GlobalStore
| Param | Type |
|---|---|
| value | * |
Function that uses idbAdapter get user that is saved in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter get theme that is saved in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter set theme in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter set user in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter remove user in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter set ViewState in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter get ViewState that is saved in idb
Kind: instance method of GlobalStore
Function that uses idbAdapter remove ViewState in idb
Kind: instance method of GlobalStore
Flux Store MensaStore
Kind: global class
| Name | Inital Value |
|---|---|
| allMensas | [] |
| selectedMensaId | '' |
| selectedMensaName | '' |
| currentMenuPlan | null |
| currentMenuDay | null |
| currentDate | new Date() |
| displayDay | this.currentDate |
| displayStartOfWeek | startOfWeek(this.displayDay) |
| displayWeek | this.createDisplayWeek(this.displayDay) |
| emptyMenuMessage | '' |
Function that is called after action is dispatched Uses switch to filter actions
Kind: instance method of MensaStore
| Param | Type |
|---|---|
| action | FluxAction |
Creates array with dates for all days of week of displayDay
Kind: instance method of MensaStore
Returns: Array.<Date> - weekArray
| Param | Type |
|---|---|
| date | Date |
Checks if passed date is a Sunday and converts it to a Monday if true
Kind: instance method of MensaStore
Returns: Date - date
| Param | Type |
|---|---|
| date | Date |
Sets currentMenuPlan to menu plan of displayDay
Kind: instance method of MensaStore
| Param | Type |
|---|---|
| isNewFacility | boolean |
Finds and returns menu offered on displayDay
Kind: instance method of MensaStore
Returns: Object - currentMenuDay
Performs swipe left by subtracting days from displayDay and updating displayWeek
Kind: instance method of MensaStore
Performs swipe right by adding days from displayDay and updating displayWeek
Kind: instance method of MensaStore
Handles errors
Kind: instance method of MensaStore
| Param | Type |
|---|---|
| err | Error |
Flux Store RoomSearchStore
Kind: global class
| Name | Inital Value |
|---|---|
| allRooms | [] |
| currentFreeRooms | [] |
| currentBuildingFloors | [] |
| currentFloor | 'SOE' |
| allFloors | {SOE: SOE,TB2: TB2,TB3: TB3,TB4: TB4,TB5: TB5,TB6: TB6,TE2: TE2,TE3: TE3,TE4: TE4,TE5: TE5,TE6: TE6,TH2: TH2,TH3: TH3,TH4: TH4,TH5: TH5,TL2: TL2,TL3: TL3,TL4: TL4,TP2: TP2,TP4: TP4} |
Function that is called after action is dispatched Uses switch to filter actions
Kind: instance method of RoomSearchStore
| Param | Type |
|---|---|
| action | FluxAction |
Fetches all available rooms from backend api
Kind: instance method of RoomSearchStore
Returns: Promise.<Array.<Floor>> - allRooms
Kind: instance method of RoomSearchStore
| Param | Type |
|---|---|
| startTime | string |
| endTime | string |
| currentFreeRooms | Array.<string> |
Takes two arrays of strings and returns new array with elements that are in both arrays
Kind: instance method of RoomSearchStore
Returns: Array.<string> - filteredArray
| Param | Type |
|---|---|
| array1 | Array.<string> |
| array2 | Array.<string> |
Returns all indices of timeslot array that are between startTime and endTime
Kind: instance method of RoomSearchStore
Returns: Array.<number> - slotIndices
| Param | Type |
|---|---|
| startTime | string |
| endTime | string |
Returns all floors that match the building identifier of the selected floor
Kind: instance method of RoomSearchStore
Returns: Array.<JSX.Element> - currentBuildingFloors
| Param | Type |
|---|---|
| selectedFloor | string |
Handles errors
Kind: instance method of RoomSearchStore
| Param | Type |
|---|---|
| err | Error |
Schedule Flux Store
Kind: global class
| Name | Inital Value |
|---|---|
| currentAction | '' |
| currentDate | this.getCurrentDate() |
| slots | defaultSlots |
| displayDay | this.currentDate |
| displayWeek | this.createDisplayWeek(this.displayDay) |
| displayMonth | this.createDisplayMonth(this.displayDay) |
| currentSearch | '' |
| schedule | null |
| scheduleForCurrentUser | null |
| scheduleForSearchUser | null |
Functions sets default values for variables
Kind: instance method of ScheduleStore
Functions resets all variables in store
Kind: instance method of ScheduleStore
Function that creates array for the week of the given date
Kind: instance method of ScheduleStore
| Param | Type |
|---|---|
| date | * |
Function that creates array for the month of the given date
Kind: instance method of ScheduleStore
| Param | Type |
|---|---|
| date | * |
Function that return the current day unless its a sunday (by using convertSunday)
Kind: instance method of ScheduleStore
Function that returns current day unless is Sunday, then return Monday after
Kind: instance method of ScheduleStore
| Param | Type |
|---|---|
| date | Date |
Function that is called after action is dispatched Uses switch to filter actions
Kind: instance method of ScheduleStore
| Param | Type |
|---|---|
| action | FluxAction |
Vszhaw Flux Store
Kind: global class
| Name | Inital Value |
|---|---|
| feed | '' |
| events | [] |
Function that is called after action is dispatched Uses switch to filter actions
Kind: instance method of VszhawStore
| Param | Type |
|---|---|
| action | FluxAction |