Skip to content

Commit

Permalink
fixup: clara comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Uriel-Sautron committed Jan 16, 2025
1 parent 979ab4a commit 0284f29
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions front/src/utils/hooks/useDeploymentSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,24 @@ const useDeploymentSettings = () => {
try {
const response = await fetch('/overrides/overrides.json');
if (!response.ok || response.headers.get('Content-Type') !== 'application/json') {
let digitalTwinLogo = defaultLogo;
let digitalTwinLogoWithName = defaultOsrdLogo;
const currentMonth = new Date().getMonth();

if (currentMonth === MONTH_VALUES.JUNE) {
digitalTwinLogo = proudLogo;
digitalTwinLogoWithName = proudOsrdLogo;
} else if (currentMonth === MONTH_VALUES.DECEMBER) {
digitalTwinLogo = xmasLogo;
digitalTwinLogoWithName = xmasOsrdLogo;
}

setCustomizedDeploymentSetting((prev) => ({
...prev,
isCustomizedDeployment: false,
digitalTwinLogo,
digitalTwinLogoWithName,
}));

if (new Date().getMonth() === MONTH_VALUES.JUNE) {
setCustomizedDeploymentSetting((prev) => ({
...prev,
digitalTwinLogo: proudLogo,
digitalTwinLogoWithName: proudOsrdLogo,
}));
}
if (new Date().getMonth() === MONTH_VALUES.DECEMBER) {
setCustomizedDeploymentSetting((prev) => ({
...prev,
digitalTwinLogo: xmasLogo,
digitalTwinLogoWithName: xmasOsrdLogo,
}));
}
} else {
const overridesData = await response.json();
const { icons, names } = overridesData;
Expand All @@ -66,16 +65,15 @@ const useDeploymentSettings = () => {
const horizonLogoWithNamePath = `/overrides/${icons.digital_twin.dark}_Grey10.svg`;
const horizonLogoPath = `/overrides/${icons.digital_twin.dark}_Logo_Grey40.svg`;

setCustomizedDeploymentSetting((prev) => ({
...prev,
setCustomizedDeploymentSetting({
digitalTwinName: names.digital_twin,
digitalTwinLogo: horizonLogoPath,
digitalTwinLogoWithName: horizonLogoWithNamePath,
stdcmName: names.stdcm,
stdcmLogo: lmrLogoPath,
stdcmSimulationSheetLogo: lmrPngLogoPath,
isCustomizedDeployment: true,
}));
});
}
} catch (error) {
console.error('Error fetching overrides.json', error);
Expand All @@ -84,7 +82,7 @@ const useDeploymentSettings = () => {
fetchInternalProd();
}, []);

return { ...customizedDeploymentSetting };
return customizedDeploymentSetting;
};

export default useDeploymentSettings;

0 comments on commit 0284f29

Please sign in to comment.