Skip to content

Commit

Permalink
feat: show city also in header
Browse files Browse the repository at this point in the history
  • Loading branch information
eidam committed Jan 18, 2021
1 parent 6d08f47 commit 6952ed2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/components/monitorDayAverage.js
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
4 changes: 3 additions & 1 deletion src/components/monitorStatusHeader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import config from '../../config.yaml'
import { locations } from '../functions/helpers'

const classes = {
green:
Expand All @@ -24,7 +25,8 @@ export default function MonitorStatusHeader({ kvMonitorsLastUpdate }) {
<div className="text-xs font-light">
checked{' '}
{Math.round((Date.now() - kvMonitorsLastUpdate.time) / 1000)} sec
ago (from {kvMonitorsLastUpdate.loc})
ago (from{' '}
{locations[kvMonitorsLastUpdate.loc] || kvMonitorsLastUpdate.loc})
</div>
)}
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/functions/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 6952ed2

Please sign in to comment.