Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions pages/heatmap/+Page.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
MapView,
buildInspectorStyle
} from "@macrostrat/map-interface";
import { mapboxAccessToken, matomoToken, matomoApiURL, tileserverDomain } from "~/settings";
import { mapboxAccessToken, postgrestPrefix, tileserverDomain } from "~/settings";
import { Footer } from "~/components";
import { Divider, Spinner, Tabs, Tab } from "@blueprintjs/core";
import { useEffect, useState } from "react";
Expand All @@ -24,12 +24,22 @@ export function Page() {
}

function PageHeader() {
const stats = useAPIResult(`${postgrestPrefix}/rockd_stats`)?.[0];
if (stats == null) return null;
const { rows_last_24_hours, total_rows } = stats;

return h('div.page-header', [
h('h1', 'Heatmap'),
h(Divider),
h('p', 'This is a heatmap of all the locations where Rockd has been accessed.'),
h('p', 'The blue markers indicate today\'s accesses, while the grey markers indicate accesses from other days.'),
]);
h('p', [
"The blue markers indicate today's ",
h('strong', rows_last_24_hours.toLocaleString()),
" accesses, while the grey markers indicate the total ",
h('strong', total_rows.toLocaleString()),
" accesses from all days."
])
]);
}

function todayStyle() {
Expand Down
5 changes: 5 additions & 0 deletions src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export const matomoApiURL = getRuntimeConfig("MATOMO_API_URL");

export const matomoToken = getRuntimeConfig("MATOMO_API_TOKEN");

export const postgrestPrefix = getRuntimeConfig(
"MACROSTRAT_POSTGREST_PREFIX",
apiDomain + "/api/pg"
);

/** Legacy settings object */
export const SETTINGS = {
rockdApiURL,
Expand Down