Skip to content
Snippets Groups Projects
Commit ead8f202 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore: adjust loading messages

parent c6261e02
No related branches found
No related tags found
1 merge request!12413.1 Release
......@@ -184,7 +184,6 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => {
async function loadData() {
const initializationService = new InitializationService(
client,
setInitStep,
setInitStepErrors
)
const customPopupService = new CustomPopupService(client)
......@@ -195,6 +194,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => {
try {
console.group('Initialization logs')
// Run init steps in parallel
setInitStep(InitSteps.PROFILE)
const [
termsStatus,
,
......@@ -212,6 +212,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => {
])
if (subscribed) dispatch(updateTermsStatus(termsStatus))
setInitStep(InitSteps.MIGRATION)
const migrationsResult = await ms.runMigrations(migrations)
// Init last release notes when they exist
dispatch(
......@@ -223,6 +224,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => {
)
if (subscribed && profile) {
setValidExploration(UserExplorationID.EXPLORATION007)
setInitStep(InitSteps.CHALLENGES)
const [
duelHash,
quizHash,
......
......@@ -8,8 +8,10 @@ import './splashScreen.scss'
const SplashScreen = ({ initStep }: { initStep: InitSteps }) => {
const { t } = useI18n()
const getProgress = () => {
const total = Object.values(InitSteps).length / 2
const progress = initStep === 0 ? 10 : Math.round((initStep / total) * 100)
const currentIndex = Object.values(InitSteps).indexOf(initStep)
const progress = Math.round(
(currentIndex / Object.values(InitSteps).length) * 100
)
return progress - 90 /* hack to make the progress bar start way left */
}
return (
......
......@@ -27,7 +27,7 @@ exports[`SplashRoot component should be rendered correctly 1`] = `
>
<div
class="splash-progress-bar-content"
style="left: -40%;"
style="left: -90%;"
/>
</div>
</div>
......@@ -35,7 +35,7 @@ exports[`SplashRoot component should be rendered correctly 1`] = `
<div
class="step-label text-18-normal"
>
splashscreen.step.3
splashscreen.step.profile
</div>
<div
class="splash-logos-container"
......
......@@ -23,7 +23,7 @@ exports[`SplashScreen component should be rendered correctly 1`] = `
>
<div
class="splash-progress-bar-content"
style="left: -80%;"
style="left: -123%;"
/>
</div>
</div>
......@@ -31,7 +31,7 @@ exports[`SplashScreen component should be rendered correctly 1`] = `
<div
class="step-label text-18-normal"
>
splashscreen.step.0
splashscreen.step.undefined
</div>
<div
class="splash-logos-container"
......
......@@ -1273,12 +1273,9 @@
"unknown_error": "Veuillez vérifier votre connexion internet",
"network_error": "Erreur de réseau",
"step": {
"0": "Mise à jour de l'application",
"1": "Vérification de vos consentements pour partager vos données avec Ecolyo",
"2": "Chargement de votre profil",
"3": "Actualisation de votre progression dans les défis",
"4": "Mise à jour des prix",
"5": "Connexion à vos données de consommation"
"migration": "Mise à jour de l'application",
"profile": "Chargement de votre profil",
"challenges": "Actualisation de votre progression dans les défis"
}
},
"timestep": {
......
export enum InitSteps {
CONSENT,
PRICES,
PROFILE,
CONSOS,
MIGRATION,
CHALLENGES,
PROFILE = 'profile',
MIGRATION = 'migration',
CHALLENGES = 'challenges',
}
export enum InitStepsErrors {
MIGRATION_ERROR = 'migration_error',
......
......@@ -21,7 +21,6 @@ import { migrations } from 'migrations/migration.data'
import {
Dataload,
FluidStatus,
InitSteps,
InitStepsErrors,
Profile,
ProfileEcogesture,
......@@ -50,20 +49,17 @@ const logStack = logger.namespace('initializationService')
export default class InitializationService {
private readonly _client: Client
private readonly _setInitStep: React.Dispatch<React.SetStateAction<InitSteps>>
private readonly _setInitStepError: React.Dispatch<
React.SetStateAction<InitStepsErrors | null>
>
constructor(
_client: Client,
_setInitStep: React.Dispatch<React.SetStateAction<InitSteps>>,
_setInitStepError: React.Dispatch<
React.SetStateAction<InitStepsErrors | null>
>
) {
this._client = _client
this._setInitStep = _setInitStep
this._setInitStepError = _setInitStepError
}
......@@ -77,7 +73,6 @@ export default class InitializationService {
const startTime = performance.now()
const profileService = new ProfileService(this._client)
try {
this._setInitStep(InitSteps.PROFILE)
const loadedProfile = await profileService.getProfile()
if (!loadedProfile) {
// Population with the data
......@@ -160,7 +155,6 @@ export default class InitializationService {
public async initFluidPrices(): Promise<void> {
const startTime = performance.now()
this._setInitStep(InitSteps.PRICES)
logDuration('[Initialization] Launching fluidPrices service', startTime)
const triggerQuery: QueryDefinition = Q(TRIGGERS_DOCTYPE).where({
'message.name': 'fluidsPrices',
......@@ -186,7 +180,6 @@ export default class InitializationService {
public async initChallengeEntity(hash: string): Promise<string> {
const startTime = performance.now()
this._setInitStep(InitSteps.CHALLENGES)
const challengeHash = hashFile(challengeEntityData)
const challengeService = new ChallengeService(this._client)
// Populate data if none challengeEntity exists
......@@ -554,7 +547,6 @@ export default class InitializationService {
const startTime = performance.now()
const fs = new FluidService(this._client)
try {
this._setInitStep(InitSteps.CONSOS)
const fluidStatus = await fs.getFluidStatus()
if (fluidStatus) {
logDuration('[Initialization] Fluid Status loaded', startTime)
......@@ -636,7 +628,6 @@ export default class InitializationService {
public async initConsent(): Promise<TermsStatus> {
const startTime = performance.now()
try {
this._setInitStep(InitSteps.CONSENT)
const termService = new TermsService(this._client)
const isUpToDate = await termService.isConsentVersionUpToDate()
const lastTerm = await termService.getLastTerm()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment