diff --git a/src/components/monitorDayAverage.js b/src/components/monitorDayAverage.js index 88904406e..c1bdb9af6 100644 --- a/src/components/monitorDayAverage.js +++ b/src/components/monitorDayAverage.js @@ -1,9 +1,4 @@ -const locations = { - WAW: 'Warsaw', - SCL: 'Santiago de Chile', - MEL: 'Melbourne', - SIN: 'Singapore', -} +import { locations } from '../functions/helpers' export default function MonitorDayAverage({ location, avg }) { return ( diff --git a/src/components/monitorStatusHeader.js b/src/components/monitorStatusHeader.js index 63cd940ce..38bddac59 100644 --- a/src/components/monitorStatusHeader.js +++ b/src/components/monitorStatusHeader.js @@ -1,4 +1,5 @@ import config from '../../config.yaml' +import { locations } from '../functions/helpers' const classes = { green: @@ -24,7 +25,8 @@ export default function MonitorStatusHeader({ kvMonitorsLastUpdate }) {
checked{' '} {Math.round((Date.now() - kvMonitorsLastUpdate.time) / 1000)} sec - ago (from {kvMonitorsLastUpdate.loc}) + ago (from{' '} + {locations[kvMonitorsLastUpdate.loc] || kvMonitorsLastUpdate.loc})
)} diff --git a/src/functions/helpers.js b/src/functions/helpers.js index d4e80c4d8..2fa5a490c 100644 --- a/src/functions/helpers.js +++ b/src/functions/helpers.js @@ -3,6 +3,13 @@ import { useEffect, useState } from 'react' const kvDataKey = 'monitors_data_v1_1' +export const locations = { + WAW: 'Warsaw', + SCL: 'Santiago de Chile', + MEL: 'Melbourne', + SIN: 'Singapore', +} + export async function getKVMonitors() { // trying both to see performance difference return KV_STATUS_PAGE.get(kvDataKey, 'json')