Skip to content
Draft
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
24 changes: 24 additions & 0 deletions src/pages/experiences/usa.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
import { execSync } from "child_process"
import MainLayout from "../../layouts/MainLayout.astro"
import Subheading from "../../components/Subheading.astro"
// import USAMap from "../../components/maps/USAMap.jsx"
Expand Down Expand Up @@ -50,6 +51,24 @@ const visitedStates = getUniqueStates(visitedPlaces)
const allYears = getUniqueYears(visitedPlaces)
const nationalParks = countNationalParks(visitedPlaces)

// Format last updated date
const DATA_FILE = "src/data/usa-travel-data.js"
let lastUpdatedFormatted: string | null = null
try {
const gitDate = execSync(`git log -1 --format=%cI -- ${DATA_FILE}`, {
encoding: "utf8",
}).trim()
if (gitDate) {
lastUpdatedFormatted = new Date(gitDate).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
timeZone: "UTC",
})
}
} catch {
// git unavailable at build time — omit the date
}

// Group places by category for better organization
// const placesByCategory = groupPlacesByCategory(visitedPlaces)
---
Expand Down Expand Up @@ -135,6 +154,11 @@ const nationalParks = countNationalParks(visitedPlaces)
<p class="text-sm text-gray-400 mb-6">
Click on any of the places to see more details.
</p>
{lastUpdatedFormatted && (
<p class="text-xs text-gray-500 mb-4">
<i class="fas fa-clock mr-1" aria-hidden="true"></i>Map data last updated: {lastUpdatedFormatted}
</p>
)}
<div class="bg-rich-black border border-vivid-blue rounded-lg p-4 mb-8">
<USAMapWithErrorBoundary places={visitedPlaces} client:load />
</div>
Expand Down