# Cool Team - New UI Project
## Useful Links
- https://create-react-app.dev/docs/making-a-progressive-web-app/
- https://developers.google.com/web/tools/workbox/
## Activation Sequence
```mermaid
sequenceDiagram
autonumber
participant ScreenUI
participant Activator.js
participant Server
participant Backend
ScreenUI ->>Activator.js: start()
Server ->> Activator.js: GET: /code as $code
Activator.js ->>ScreenUI: Prompt $code on screen
Backend ->>Server: Activate $code with Account
Server->>Activator.js: GET: /$code/activate as $response
note over Server,Activator.js: Runs in loop waiting for code to be activated
Activator.js ->> ScreenUI: $response.token
note over Activator.js,ScreenUI: Store token on LocalStorage
```
1. Run `start()`
2. Get generated `$code` from Server
3. Show `$code` on screen
4. Activate `$code` on backend for some Account
5. Request activation status for `$code` as `$response`
6. Store `$response.token` in LocalStorage if code is activated. Else request again in a loop
* If there's already an AccessToken we try to get settings using that.
* If there's also a WebViewName make sure alse that it's the same as in the settings
* If it fails clean local state and reactivate
* If it doesn't return the access token
* If there's a WebViewName, try to autoactivate without the need of an admin going to the backend
* For some reason there's data getting stored on Redis, I have no idea why the code around that doesn't make sense