From 49f42562f7efe2019041f2151e8b6185b9a23b4f Mon Sep 17 00:00:00 2001
From: HAUTBOIS Aurelie <aurelie.hautbois@ext.soprasteria.com>
Date: Fri, 12 Mar 2021 10:15:55 +0100
Subject: [PATCH] add redux section to initialization

---
 docs/ecolyo/functionalities/initialization.md | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/docs/ecolyo/functionalities/initialization.md b/docs/ecolyo/functionalities/initialization.md
index 8c8bbb0..1747cb9 100644
--- a/docs/ecolyo/functionalities/initialization.md
+++ b/docs/ecolyo/functionalities/initialization.md
@@ -133,3 +133,27 @@ UserDuelEntity {
 ### Data managment schema
 
 ![Data Scheme](/img/challengeFlow.png)
+
+## Redux
+
+There are two main store created for this app:
+
+- Cozy: store information about cozy (konnectors, accounts, settings, db)
+- Ecolyo: store all states used for this app
+
+For a better state management, combineReducers(reducers) is used to split the reducing function into seperate functions. So, each managing independent parts of the state.
+
+### Ecolyo Store Structure
+
+| Reducer   | Type           | Description                                                                                                                                                                                                                                                                                                                                                                    |
+| --------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| global    | GlobalState    | store global states such as: notification, type device or fluid type<br><br>GlobalState enum<br>- _screenType = ScreenType_<br>- _challengeExplorationNotification = boolean_<br>- _challengeActionNotification = boolean_<br>- _challengeDuelNotification = boolean_<br>- _analysisNotification = boolean_<br>- _fluidStatus = FluidStatus[]_<br>- _fluidTypes = FluidType[]_ |
+| profile   | Profile        | store states about profile information such as: notification, connectionDate, profileType                                                                                                                                                                                                                                                                                      |
+| chart     | ChartState     | store consumption chart states such as: timeStep, graph data<br><br>ChartState enum<br>- _selectedDate = DateTime_<br>- _currentTimeStep = TimeStep_<br>- _currentIndex = number_<br>- _currentDatachart = Datachart_<br>- _currentDatachartIndex = number_<br>- _loading = boolean_                                                                                           |
+| modal     | ModalState     | store opening state of the feedback modal <br><br>ModalState enum<br>- _isFeedbacksOpen = boolean_                                                                                                                                                                                                                                                                             |
+| challenge | ChallengeState | store challenge state such as: list of user challenge, data load and current challenge <br><br>ChallengeState enum<br>- _userChallengeList = UserChallenge[]_<br>- _currentChallenge = UserChallenge_<br>- _currentDataload = Dataload[]_                                                                                                                                      |
+
+### Updating state process
+
+Redux-thunk middleware is configured. For now, it is used only for updating the profile.
+To update a state, a webservice method is called before trigger a state change inside the store.
-- 
GitLab