"use client";
import useSWR from "swr";
import Image from "next/image";
import Link from "next/link";
import BottomFooter from "@components/BottomFooter";
import { createPoster } from "@utils/axiosHelpers";
// formats the date
function getRelativeDate(dateString: string): string {
const date = new Date(dateString);
const now = new Date();
const diffMs = now.getTime() - date.getTime();
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
if (diffDays === 0) return "today";
if (diffDays === 1) return "yesterday";
return date.toLocaleDateString();
}
export default function Home() {
const { data, error, isLoading } = useSWR("/api/earthquakes", createPoster({ rangeDaysPrev: 6 }));
// Take 5 most recent
const recents = (data?.earthquakes ?? [])
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
.slice(0, 5);
return (
Earthquakes
Log new earthquakes with their required details or search past seismic events
Observatories
Find recently active observatories, and newly opened/closed sites
Artefacts
View or purchase recently discovered artefacts from seismic events
Welcome to Tremor Tracker
TremorTracker is a non-profit website and research company, that aims to provide true, reliable data. Our mission
is seismic education and preparation for all
What is an earthquake?
Earthquakes are a shaking of the earth's surface caused by a sudden release of energy underground. They can range
in size, from tiny trembles to large quakes, which can cause destruction and even tsunamis. Hundreds of
earthquakes happen every day—but most are too small to feel.
How do we log earthquakes?
What information are we interested in?
info
What are observatories?
What is their role?
info
Recent Earthquake Events
Learn about the most recent earthquake events from around the world:
{error && (
Failed to load earthquakes.
)}
{isLoading && (
Loading...
)}
{!isLoading && recents.length === 0 && (
No earthquakes found.
)}
{recents.map((eq) => (
Earthquake in {eq.location || (eq.code && eq.code.split("-")[2])}