From e6053162528d74456b580c07256d764473b1ff7f Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 11:43:47 -0500 Subject: [PATCH 1/8] Refactor default layout to use arrays for elements --- src/lib/layouts/default.astro | 142 +++++++++++++++++----------------- 1 file changed, 72 insertions(+), 70 deletions(-) diff --git a/src/lib/layouts/default.astro b/src/lib/layouts/default.astro index 634e814..22e5fdf 100644 --- a/src/lib/layouts/default.astro +++ b/src/lib/layouts/default.astro @@ -3,6 +3,50 @@ const { id, title, description } = Astro.props; const seoTitle = title ? `Stat 'n' Track: ${title}` : "Stat 'n' Track"; const seoDescription = description || "An iRacing planner and statistics analyzer"; +const primaryNavigationLinks = [ + { href: "/Stat-N-Track/", label: "Home" }, + { href: "/Stat-N-Track/user/300752/", label: "Jacob Collins" }, + { href: "/Stat-N-Track/user/815162/", label: "Jack Glenzinski" }, + { href: "/Stat-N-Track/shared-subsessions/", label: "Shared Subsessions" }, +]; +const userNavigationLinks = id + ? [ + { href: `/Stat-N-Track/user/${id}/scheduling/`, label: "Scheduling" }, + { + href: `/Stat-N-Track/user/${id}/scheduling/by-week/`, + label: "Scheduling By Week", + }, + { href: `/Stat-N-Track/user/${id}/subsessions/`, label: "All Sessions" }, + { + href: `/Stat-N-Track/user/${id}/subsessions/by-year/`, + label: "Sessions By Year", + }, + { + href: `/Stat-N-Track/user/${id}/subsessions/by-car-class/`, + label: "Sessions By Car Class", + }, + { + href: `/Stat-N-Track/user/${id}/subsessions/by-track/`, + label: "Sessions By Track", + }, + { + href: `/Stat-N-Track/user/${id}/standings/`, + label: "All Season Standings", + }, + { + href: `/Stat-N-Track/user/${id}/standings/full-participation/`, + label: "Fully Participated Season Standings", + }, + { + href: `/Stat-N-Track/user/${id}/standings/by-year/`, + label: "Season Standings By Year", + }, + { + href: `/Stat-N-Track/user/${id}/standings/by-car-class/`, + label: "Season Standings By Car Class", + }, + ] + : []; --- @@ -25,84 +69,42 @@ const seoDescription =
- Home - Jacob Collins - Jack Glenzinski - Shared Subsessions + { + primaryNavigationLinks.map(({ href, label }) => ( + + {label} + + )) + }
- { id ? (
-
- Scheduling -
-
- Scheduling By Week -
-
- All Sessions -
-
- Sessions By Year -
-
- Sessions By Car Class -
+ { + userNavigationLinks.slice(0, 5).map(({ href, label }) => ( +
+ + {label} + +
+ )) + }
-
- Sessions By Track -
-
- All Season Standings -
-
- Fully Participated Season Standings -
-
- Season Standings By Year -
-
- Season Standings By Car Class -
-
) : <> } + { + userNavigationLinks.slice(5, 10).map(({ href, label }) => ( +
+ + {label} + +
+ )) + } + ) : (<>) } From 41accd18ddee9ca7b4892f679beec17e4b18475b Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 12:31:52 -0500 Subject: [PATCH 2/8] Remove no longer necessary shell script for seeding database --- seed-remote-database.sh | 7 ------- 1 file changed, 7 deletions(-) delete mode 100755 seed-remote-database.sh diff --git a/seed-remote-database.sh b/seed-remote-database.sh deleted file mode 100755 index b45ac8f..0000000 --- a/seed-remote-database.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -a -source .env -set +a - -npx astro db execute ./db/seed.ts --remote From e522e79e9d9f8c5e859d9bfbfdb6b23d551119c2 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 13:11:20 -0500 Subject: [PATCH 3/8] Prevent subsession_id from showing up twice in Relevant IDs --- src/lib/components/subsession/relevantIds.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/subsession/relevantIds.astro b/src/lib/components/subsession/relevantIds.astro index ac07d37..6463e73 100644 --- a/src/lib/components/subsession/relevantIds.astro +++ b/src/lib/components/subsession/relevantIds.astro @@ -12,7 +12,7 @@ const relevantIds = Object.keys(subsession) (key) => `${key}: ${JSON.stringify(subsession[key as keyof Subsession])}` ); const relevantIdMap: Record> = {}; -const excludeKeys = new Set(["_id", "cust_id", "reason_out_id"]); +const excludeKeys = new Set(["_id", "cust_id", "reason_out_id", "subsession_id"]); sessions.forEach((session: Session) => { const { results } = session; results.forEach((result) => { From 2c98cf09216172f655a65006e29999ca4eb9a3f4 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 13:28:25 -0500 Subject: [PATCH 4/8] Prevent double borders on subsession headings --- src/pages/subsession/[id].astro | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/subsession/[id].astro b/src/pages/subsession/[id].astro index 03376d3..34e24c5 100644 --- a/src/pages/subsession/[id].astro +++ b/src/pages/subsession/[id].astro @@ -107,16 +107,19 @@ const { } = subsession || {}; const title = `Subsession - ${id}`; const description = `Subsession information for subsession - ${id}`; -const notMultiClass = Array.isArray(subsession.car_classes) && subsession.car_classes.length === 1 +const notMultiClass = + Array.isArray(subsession.car_classes) && subsession.car_classes.length === 1; ---
-
+
-
+
From ad86d178d4b66b248fe2b3a83bec4b2fab2ff476 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 13:34:15 -0500 Subject: [PATCH 5/8] Update favicon to use root domain level files --- src/lib/layouts/default.astro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/layouts/default.astro b/src/lib/layouts/default.astro index 22e5fdf..958eafc 100644 --- a/src/lib/layouts/default.astro +++ b/src/lib/layouts/default.astro @@ -53,7 +53,10 @@ const userNavigationLinks = id - + + + + From 00f5728e9a599ada8dd711e0076620a48d763ab8 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 14:01:21 -0500 Subject: [PATCH 6/8] Remove no longer used SVG favicon --- public/favicon.svg | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 public/favicon.svg diff --git a/public/favicon.svg b/public/favicon.svg deleted file mode 100644 index f157bd1..0000000 --- a/public/favicon.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - From a79da4d59ffbbeb0f628ddc361f80b81631e0367 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Wed, 15 May 2024 14:06:32 -0500 Subject: [PATCH 7/8] Make an attempt at correcting typing for Share Subsessions page --- src/pages/shared-subsessions.astro | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/shared-subsessions.astro b/src/pages/shared-subsessions.astro index 1376bcf..bce8d7d 100644 --- a/src/pages/shared-subsessions.astro +++ b/src/pages/shared-subsessions.astro @@ -14,7 +14,7 @@ import userIds from "$lib/utils/user-ids"; import parseLapTime from "$lib/utils/parse-lap-time"; import fieldIdToLabelMap from "$lib/utils/field-id-to-label-map"; import { bgColorByUserDisplayName } from "$lib/utils/background-color-by-user"; -import type { Track } from "$lib/types"; +import type { License as LicenseType, Track } from "$lib/types"; const sharedRaceSessions = await db .select({ subsession_id: SubsessionRaceResults.subsession_id, @@ -93,7 +93,7 @@ const results = sharedSubsessions.map((subsession) => { headToHeadWins[display_name] = [subsession_id]; } const { group_name: License } = Array.isArray(allowed_licenses) - ? allowed_licenses.slice(0, 2).pop() + ? allowed_licenses.slice(0, 2).pop() as LicenseType : { group_name: "" }; const assertTrackAsTrackType = () => track as Track; const trackInfo = assertTrackAsTrackType(); @@ -232,7 +232,10 @@ const description = "Shared subsessions for all Stat 'n' Track users"; {Object.keys(result.subsessionInfo).map((key) => ( Date: Wed, 15 May 2024 14:07:29 -0500 Subject: [PATCH 8/8] Upgrade astro and @astrojs/db to latest versions --- package-lock.json | 16 ++++++++-------- package.json | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index cd242aa..fb5d3bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,13 +10,13 @@ "dependencies": { "@alpinejs/collapse": "^3.13.10", "@astrojs/alpinejs": "^0.4.0", - "@astrojs/db": "^0.11.1", + "@astrojs/db": "^0.11.2", "@astrojs/sitemap": "^3.1.4", "@astrojs/tailwind": "^5.1.0", "@types/alpinejs": "^3.13.10", "@types/alpinejs__collapse": "^3.13.4", "alpinejs": "^3.13.10", - "astro": "^4.8.3", + "astro": "^4.8.4", "tailwindcss": "^3.4.3" } }, @@ -63,9 +63,9 @@ "integrity": "sha512-yrpD1WRGqsJwANaDIdtHo+YVjvIOFAjC83lu5qENIgrafwZcJgSXDuwVMXOgok4tFzpeKLsFQ6c3FoUdloLWBQ==" }, "node_modules/@astrojs/db": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@astrojs/db/-/db-0.11.1.tgz", - "integrity": "sha512-3hFcSib3u7kBZyYlSzaJVCWBJBz8CKmh1RWndYFiAIi37aT69PGneSSyZ/8w3yy3ARiUOt4oJLvl9sRwwH7Tzg==", + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@astrojs/db/-/db-0.11.2.tgz", + "integrity": "sha512-zPb1XntDT7efcSaFFrnPiXZe0hEpOnsLNBJ1dhjJeYJKwTw9AllAJMMeGvHpjN5O0CMgY0IY4xPhrUKA1HS00A==", "dependencies": { "@libsql/client": "^0.6.0", "async-listen": "^3.0.1", @@ -1962,9 +1962,9 @@ } }, "node_modules/astro": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/astro/-/astro-4.8.3.tgz", - "integrity": "sha512-pgIKopkmAUXY3EJHdG7zQpudtBzYAsd94A1R7jmLpH2LFZvzHEkAdHnunmSVmgikJCNqtEo3bUCHgLnCPQaN1g==", + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-4.8.4.tgz", + "integrity": "sha512-3UExI/Pq47tvdSmYJTDkoyuygIibO+293MBkwc5iUzK5Cu/U4H7P3LwTyP8Gp/wQX+2zBEUifEb4oNO1HfUn2g==", "dependencies": { "@astrojs/compiler": "^2.8.0", "@astrojs/internal-helpers": "0.4.0", diff --git a/package.json b/package.json index 467545b..fb8cca1 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,13 @@ "dependencies": { "@alpinejs/collapse": "^3.13.10", "@astrojs/alpinejs": "^0.4.0", - "@astrojs/db": "^0.11.1", + "@astrojs/db": "^0.11.2", "@astrojs/sitemap": "^3.1.4", "@astrojs/tailwind": "^5.1.0", "@types/alpinejs": "^3.13.10", "@types/alpinejs__collapse": "^3.13.4", "alpinejs": "^3.13.10", - "astro": "^4.8.3", + "astro": "^4.8.4", "tailwindcss": "^3.4.3" } }