diff --git a/src/app/page.tsx b/src/app/page.tsx index 2bcd8ea..c3174e4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -3,212 +3,213 @@ import Image from "next/image"; import Link from "next/link"; import { TbHexagon } from "react-icons/tb"; import useSWR from "swr"; + import BottomFooter from "@components/BottomFooter"; import { createPoster } from "@utils/axiosHelpers"; import getMagnitudeColor from "@utils/getMagnitudeColour"; // 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(); + 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(); } // copied from sidebar function MagnitudeNumber({ magnitude }: { magnitude: number }) { - const magnitudeStr = magnitude.toFixed(1); - const [whole, decimal] = magnitudeStr.split("."); - return ( -
- -
-
- {whole} - . - {decimal} -
-
-
- ); + const magnitudeStr = magnitude.toFixed(1); + const [whole, decimal] = magnitudeStr.split("."); + return ( +
+ +
+
+ {whole} + . + {decimal} +
+
+
+ ); } 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); + 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 ( -
-
-
- Background Image -
-
-
- Title Image -
-
-

-
- - Education Icon -

Earthquakes

-

- Log new earthquakes with their required details or search past seismic events -

- - - Research Icon -

Observatories

-

- Find recently active observatories, and newly opened/closed sites -

- - - Technology Icon -

Artefacts

-

- View or purchase recently discovered artefacts from seismic events -

- -
-

-
-
-
- Background Image -
-
-
-

- 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])} -
-
{getRelativeDate(eq.date)}
-
- -
- ))} -
-
-

-
-

- Find Out More! -

-

- Explore more of our website... -

-
-

-
- - Education Icon -

Contact us directly

-

- Visit our socials or leave us a message via phone or email. -

- - - Research Icon -

Our Mission

-

- Find out more about our purpose and the features we offer. -

- - - Technology Icon -

Meet the Team

-

- Learn about our team leads and their responsibilities. -

- -
-

-
-
-
- Background Image -
- -
-
-
- ); -} \ No newline at end of file + return ( +
+
+
+ Background Image +
+
+
+ Title Image +
+
+

+
+ + Education Icon +

Earthquakes

+

+ Log new earthquakes with their required details or search past seismic events +

+ + + Research Icon +

Observatories

+

+ Find recently active observatories, and newly opened/closed sites +

+ + + Aftefacts Icon +

Artefacts

+

+ View or purchase recently discovered artefacts from seismic events +

+ +
+

+
+
+
+ Background Image +
+
+
+

+ Welcome to Tremor Tracker +

+

+ TremorTracker is a non-profit website and research company, that aims to provide seismic education and aid + preparation +

+

+

What is an earthquake?

+

+ An earthquake is a sudden shaking of the Earth’s surface, triggered by a rapid release of energy deep underground. + This usually happens because the Earth’s outer shell, called the crust, is made up of large pieces known as + tectonic plates. These plates are always moving, but sometimes they get stuck at their edges; when stress builds + up and is finally released, it causes the ground to shake—an earthquake. Earthquakes can vary greatly in size—from + barely noticeable tremors to powerful quakes capable of causing widespread destruction. There are several types: + Tectonic, Volcanic and Collapse earthquakes. Understanding why and how earthquakes happen helps scientists predict + where they are most likely to occur and how to lessen their impact. +

+

+

+ How do we log earthquakes? +

+

+ What information are we interested in? +

+

+ Scientists record earthquakes using special instruments called seismometers, which detect and measure the + vibrations in the ground. When an earthquake occurs, the seismometer produces a trace known as a seismogram, + showing the strength and duration of the shaking. Information from seismometers around the world is sent to data + centers, where experts analyze it to pinpoint the earthquake’s location, type, depth, and magnitude. This process + is called “logging” or recording earthquakes, and it helps track seismic activity globally. +

+

+

+ What are observatories? +

+

+ An earthquake observatory is a specialized facility where scientists monitor and study seismic activity. These + observatories are equipped with sensitive instruments that can detect and record even the smallest tremors deep + within the Earth. Observatories collect important data about the strength, location, and timing of each earthquake + that can be shared with the general public. Scientists at the observatory use this data to better understand how + and why earthquakes occur, track earthquake patterns, and issue warnings if a major quake is detected. The + information gathered also helps in designing safer buildings and improving emergency response plans. +

+
+
+
+
+

+
+

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])}
+
{getRelativeDate(eq.date)}
+
+ +
+ ))} +
+
+

+
+

Find Out More!

+

Explore more of our website...

+
+

+
+ + Education Icon +

Contact us directly

+

+ Visit our socials or leave us a message via phone or email. +

+ + + Research Icon +

Our Mission

+

+ Find out more about our purpose and the features we offer. +

+ + + Technology Icon +

Meet the Team

+

+ Learn about our team leads and their responsibilities. +

+ +
+

+
+
+
+ Background Image +
+ +
+
+
+ ); +}