diff --git a/front/src/applications/stdcm/components/StdcmResults/SimulationReportSheet.tsx b/front/src/applications/stdcm/components/StdcmResults/SimulationReportSheet.tsx index 8ba8d2e690d..8dbd044138c 100644 --- a/front/src/applications/stdcm/components/StdcmResults/SimulationReportSheet.tsx +++ b/front/src/applications/stdcm/components/StdcmResults/SimulationReportSheet.tsx @@ -16,7 +16,6 @@ import type { SimulationReportSheetProps } from '../../types'; import { getStopDurationTime } from '../../utils/formatSimulationReportSheet'; const getSecondaryCode = ({ location }: StdcmPathStep) => location!.secondary_code; -const lmrLogoPath = '../../overrides/Logotype_LastMinuteRequest_light@2x.png'; const getStopType = (step: StdcmPathStep, t: TFunction) => { if (!step.isVia) { @@ -37,7 +36,7 @@ const getArrivalTime = (step: StdcmPathStep, t: TFunction) => { const LogoSTDCM = ({ logo, t }: { logo: string | undefined; t: TFunction }) => { if (logo) { - return ; + return ; } return ( <> diff --git a/front/src/common/BootstrapSNCF/NavBarSNCF.tsx b/front/src/common/BootstrapSNCF/NavBarSNCF.tsx index 149989543af..5a4661dcee5 100644 --- a/front/src/common/BootstrapSNCF/NavBarSNCF.tsx +++ b/front/src/common/BootstrapSNCF/NavBarSNCF.tsx @@ -27,7 +27,7 @@ type Props = { const LegacyNavBarSNCF = ({ appName, logo }: Props) => { const { openModal } = useModal(); - const { digitalTwin, isIntenalProd } = useLogo(); + const { digitalTwin, customizedDeployment } = useLogo(); const safeWord = useSelector(getUserSafeWord); const { t } = useTranslation('home/navbar'); const { logout, username } = useAuth(); @@ -38,7 +38,7 @@ const LegacyNavBarSNCF = ({ appName, logo }: Props) => {
diff --git a/front/src/utils/hooks/useLogo.ts b/front/src/utils/hooks/useLogo.ts index 0a28806e98e..6dac21ae8c5 100644 --- a/front/src/utils/hooks/useLogo.ts +++ b/front/src/utils/hooks/useLogo.ts @@ -12,28 +12,23 @@ const MONTH_VALUES = { DECEMBER: 11, }; -const lmrLogoPath = '../../overrides/Logotype_LastMinuteRequest_light.svg'; -const horizonFullLogoPath = '../../overrides/Logotype_Horizon_dark.svg'; -const horizonLogoPath = '../../overrides/Logo_Horizon.svg'; -const lmrPngLogoPath = '../../overrides/Logotype_LastMinuteRequest_light@2x.png'; - const useLogo = () => { const [digitalTwin, setDigitalTwin] = useState<{ logo: string; digitalTwinLogo: string }>({ logo: defaultLogo, digitalTwinLogo: defaultOsrdLogo, }); - const [stdcm, setStdcm] = useState<{ stdcmLogo?: string; stdcmPngLogo: string }>({ + const [stdcm, setStdcm] = useState<{ stdcmLogo?: string; stdcmPngLogo?: string }>({ stdcmLogo: undefined, - stdcmPngLogo: defaultLogo, + stdcmPngLogo: undefined, }); - const [isIntenalProd, setIsIntenalProd] = useState(false); + const [customizedDeployment, setCustomizedDeployment] = useState(false); useEffect(() => { const fetchInternalProd = async () => { try { const response = await fetch('/overrides/overrides.json'); if (!response.ok || response.headers.get('Content-Type') !== 'application/json') { - setIsIntenalProd(false); + setCustomizedDeployment(false); if (new Date().getMonth() === MONTH_VALUES.JUNE) { setDigitalTwin({ logo: proudLogo, digitalTwinLogo: proudOsrdLogo }); } @@ -41,18 +36,26 @@ const useLogo = () => { setDigitalTwin({ logo: xmasLogo, digitalTwinLogo: xmasOsrdLogo }); } } else { - setIsIntenalProd(true); + const overridesData = await response.json(); + const { icons } = overridesData; + + const lmrLogoPath = `/overrides/${icons.stdcm.light}.svg`; + const lmrPngLogoPath = `/overrides/${icons.stdcm.light}@2x.png`; + const horizonFullLogoPath = `/overrides/${icons.digital_twin.dark}.svg`; + const horizonLogoPath = `/overrides/${icons.digital_twin.dark}_logo.svg`; + + setCustomizedDeployment(true); setStdcm({ stdcmLogo: lmrLogoPath, stdcmPngLogo: lmrPngLogoPath }); setDigitalTwin({ logo: horizonLogoPath, digitalTwinLogo: horizonFullLogoPath }); } } catch { - setIsIntenalProd(false); + setCustomizedDeployment(false); } }; fetchInternalProd(); }, []); - return { digitalTwin, stdcm, isIntenalProd }; + return { digitalTwin, stdcm, customizedDeployment }; }; export default useLogo;