diff --git a/src/app/components/MapMenuBar/index.tsx b/src/app/components/MapMenuBar/index.tsx index eceea65..ec8603d 100644 --- a/src/app/components/MapMenuBar/index.tsx +++ b/src/app/components/MapMenuBar/index.tsx @@ -429,8 +429,13 @@ export function MapMenuBar(props: MapMenuBar) { } }, [foundLayers]); - const labelFor = async (itm: string) => { - const configs = await api.getConfigurationParams(); + const labelFor = (itm: string) => { + api.getConfigurationParams().then(x => console.log(x)); + const confs = localStorage.getItem('configs'); + let configs = []; + if (confs) { + configs = JSON.parse(confs); + } const labelsf = configs.map((config: any) => config.allowed_values.map(x => [ x.name, diff --git a/src/app/pages/MapPage/index.tsx b/src/app/pages/MapPage/index.tsx index bf237f2..8f36a87 100644 --- a/src/app/pages/MapPage/index.tsx +++ b/src/app/pages/MapPage/index.tsx @@ -372,8 +372,8 @@ export function MapPage(props: MapPageProps) { setInProgress(true); const caption = `${isMobile - ? currentMap.climatological_variable - : labelFor(currentMap.climatological_variable) + ? currentMap.climatological_variable + : labelFor(currentMap.climatological_variable) } - ${joinNames([ labelFor(currentMap.climatological_model), @@ -383,23 +383,27 @@ export function MapPage(props: MapPageProps) { labelFor(currentMap.aggregation_period), labelFor(currentMap.measure), ])} - ${currentMap.time_window ? labelFor(currentMap.time_window) : ''} + ${currentMap.time_window && currentMap.aggregation_period === '30yr' + ? labelFor(currentMap.time_window) + : '' + } - ${labelFor(currentMap.year_period)} ${year ? ` - Anno ${year}` : ''} © ARPAV - Arpa FVG`; // string or function, added caption to bottom of screen - const filename = `Screenshot ${labelFor(currentMap.climatological_variable) - } + const filename = `Screenshot ${labelFor(currentMap.climatological_variable)} - ${joinNames([ - labelFor(currentMap.climatological_model), - labelFor(currentMap.scenario), - ])} + labelFor(currentMap.climatological_model), + labelFor(currentMap.scenario), + ])} - ${joinNames([ - labelFor(currentMap.aggregation_period), - labelFor(currentMap.measure), - ])} - ${currentMap.time_window ? labelFor(currentMap.time_window) : ''} + labelFor(currentMap.aggregation_period), + labelFor(currentMap.measure), + ])} + ${currentMap.time_window && currentMap.aggregation_period === '30yr' + ? labelFor(currentMap.time_window) + : '' + } - ${labelFor(currentMap.year_period)} - ${year ? ` - Anno ${year}` : '' - }.png`; + ${year ? ` - Anno ${year}` : ''}.png`; mapScreen .takeScreen(format, { captionFontSize: isMobile ? 10 : 12,