From 02908f7021da660b1601215d81f95f087db1ba4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sat, 27 Apr 2024 23:56:22 +0200 Subject: [PATCH] Create a foundation for driver search page --- src/components/DriversList.astro | 16 +++++++++ src/layouts/BaseLayout.astro | 60 ++++++++++++++++++++++++++----- src/pages/index.astro | 62 +++++++++++++++++++++++--------- 3 files changed, 113 insertions(+), 25 deletions(-) create mode 100644 src/components/DriversList.astro diff --git a/src/components/DriversList.astro b/src/components/DriversList.astro new file mode 100644 index 0000000..af70500 --- /dev/null +++ b/src/components/DriversList.astro @@ -0,0 +1,16 @@ +--- +import { db } from '@/db'; + +const { records } = await db.executeQuery( + `MATCH (d:Driver) + RETURN + (d.forename + " " + d.surname) AS fullname + ORDER BY + toUpper(d.surname), + toUpper(d.forename)` +); +--- + + + {records.map((rec) => diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 90818f3..8c1639b 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -1,18 +1,60 @@ +--- +import '@picocss/pico/css/pico.blue.min.css'; +--- + - Astro - + Six Degrees of Formula One - - + +
+ +
+
+ +
+
+ + + diff --git a/src/pages/index.astro b/src/pages/index.astro index 1517317..6a1c6f9 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,23 +1,53 @@ --- import BaseLayout from '../layouts/BaseLayout.astro'; -import VisGraph from '../components/VisGraph.astro'; +import DriversList from '@/components/DriversList.astro'; -const nodes = [ - { id: 1, label: 'Node 1' }, - { id: 2, label: 'Node 2' }, - { id: 3, label: 'Node 3' }, - { id: 4, label: 'Node 4' }, - { id: 5, label: 'Node 5' } -]; -const edges = [ - { from: 1, to: 3 }, - { from: 1, to: 2 }, - { from: 2, to: 4 }, - { from: 2, to: 5 }, - { from: 3, to: 3 } -]; +Astro.response.headers.set('Cache-Control', 'public, max-age=604800'); --- - +
+

Six Degrees of Formula One

+

Find out which driver is the sport's Kevin Bacon

+
+

Get all the shortest paths from/to:

+
+
+ + + +
+ +
+ +