Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sirmmo committed Nov 22, 2024
1 parent 74a56cf commit 268b197
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
9 changes: 7 additions & 2 deletions src/app/components/MapMenuBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 18 additions & 14 deletions src/app/pages/MapPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down

0 comments on commit 268b197

Please sign in to comment.