diff --git a/astro.config.mjs b/astro.config.mjs index 3477551..af1fd0b 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,6 +1,7 @@ import { defineConfig } from "astro/config"; import tailwind from "@astrojs/tailwind"; import prefetch from "@astrojs/prefetch"; +import alpinejs from "@astrojs/alpinejs"; import sitemap from "@astrojs/sitemap"; import db from "@astrojs/db"; @@ -8,5 +9,11 @@ import db from "@astrojs/db"; export default defineConfig({ site: "https://shinsina.github.io", base: "/Stat-N-Track", - integrations: [tailwind(), prefetch(), sitemap(), db()], + integrations: [ + tailwind(), + prefetch(), + alpinejs({ entrypoint: "/src/lib/alpine" }), + sitemap(), + db(), + ], }); diff --git a/db/seed.ts b/db/seed.ts index c352fe0..3a8bcc5 100644 --- a/db/seed.ts +++ b/db/seed.ts @@ -22,17 +22,22 @@ async function paginatedQuery( const size = 100; const count = await collection.countDocuments({}); const batches = Math.ceil(count / size); - const results = await Promise.all(Array(batches) - .fill({}) - .map((_, index) => { - console.log(`Processing batch ${index + 1} of ${batches} for ${collection.collectionName}...`) - return collection - .find({}) - .skip(index * size) - .limit(size) - .toArray() - } - )); + const results = await Promise.all( + Array(batches) + .fill({}) + .map((_, index) => { + console.log( + `Processing batch ${index + 1} of ${batches} for ${ + collection.collectionName + }...` + ); + return collection + .find({}) + .skip(index * size) + .limit(size) + .toArray(); + }) + ); return results.flat(); } @@ -122,7 +127,9 @@ export default async function seed() { console.log("Past Seasons Seeded!"); const subsessionsCollection = mongoDb.collection("subsessions"); // @ts-ignore - const subsessions: Array = await paginatedQuery(subsessionsCollection); + const subsessions: Array = await paginatedQuery( + subsessionsCollection + ); console.log("Seeding Subsessions..."); const { allPracticeResults, @@ -130,7 +137,8 @@ export default async function seed() { allRaceResults, allSubsessions, } = subsessions.reduce( - (object, subsession) => { + // @todo Provide an accurate type for the unknown here + (object: Record>, subsession) => { const { _id, session_results, end_time, start_time, ...rest } = subsession; session_results.forEach((sessionResult) => { @@ -142,18 +150,14 @@ export default async function seed() { ...rest, }; if (rest.simsession_type_name.match("Practice")) { - // @ts-ignore object.allPracticeResults.push(resultWithSession); } else if (rest.simsession_type_name.match("Qualifying")) { - // @ts-ignore object.allQualifyingResults.push(resultWithSession); } else if (rest.simsession_type_name.match("Race")) { - // @ts-ignore object.allRaceResults.push(resultWithSession); } }); }); - // @ts-ignore object.allSubsessions.push({ ...rest, end_time: new Date(end_time), diff --git a/package-lock.json b/package-lock.json index e92c58f..cb2d12b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,16 +8,17 @@ "name": "Stat-'n'-Track", "version": "0.0.1", "dependencies": { - "@alpinejs/collapse": "^3.13.3", - "@astrojs/db": "^0.9.1", + "@alpinejs/collapse": "^3.13.8", + "@astrojs/alpinejs": "^0.4.0", + "@astrojs/db": "^0.10.4", "@astrojs/prefetch": "^0.4.1", - "@astrojs/sitemap": "^3.1.1", + "@astrojs/sitemap": "^3.1.3", "@astrojs/tailwind": "^5.1.0", - "@types/alpinejs": "^3.13.5", - "alpinejs": "^3.13.3", - "astro": "^4.5.8", - "mongodb": "^6.3.0", - "tailwindcss": "^3.3.5" + "@types/alpinejs": "^3.13.10", + "alpinejs": "^3.13.8", + "astro": "4.5.8", + "mongodb": "^6.5.0", + "tailwindcss": "^3.4.3" } }, "node_modules/@alloc/quick-lru": { @@ -32,9 +33,9 @@ } }, "node_modules/@alpinejs/collapse": { - "version": "3.13.3", - "resolved": "https://registry.npmjs.org/@alpinejs/collapse/-/collapse-3.13.3.tgz", - "integrity": "sha512-iGO6IzqBwVNxAaoS4XCCJIIg9U/mH7v4vk6wlzxXKFWMXt2yynw93TkdELyjwxQqeNTEGimZRR+2wNf9yhJn0A==" + "version": "3.13.8", + "resolved": "https://registry.npmjs.org/@alpinejs/collapse/-/collapse-3.13.8.tgz", + "integrity": "sha512-NsYiidTJ/AOFE8xUMxnXIe5LbRYcfw3UjxI6VUlDw3st4XwzaeCNyqBbZVRt9Ac7wfdrODy0qTHA+iCHSF0atQ==" }, "node_modules/@ampproject/remapping": { "version": "2.2.1", @@ -48,20 +49,29 @@ "node": ">=6.0.0" } }, + "node_modules/@astrojs/alpinejs": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@astrojs/alpinejs/-/alpinejs-0.4.0.tgz", + "integrity": "sha512-68BY1CA0XuielLW3WdX2sfh9F4sSTnFqQ//IE9AditbiYJ77HJDb4uZx07pTFDtr1jOMU7lCvH+iS9gmNafM1g==", + "peerDependencies": { + "@types/alpinejs": "^3.0.0", + "alpinejs": "^3.0.0" + } + }, "node_modules/@astrojs/compiler": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.7.0.tgz", - "integrity": "sha512-XpC8MAaWjD1ff6/IfkRq/5k1EFj6zhCNqXRd5J43SVJEBj/Bsmizkm8N0xOYscGcDFQkRgEw6/eKnI5x/1l6aA==" + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.7.1.tgz", + "integrity": "sha512-/POejAYuj8WEw7ZI0J8JBvevjfp9jQ9Wmu/Bg52RiNwGXkMV7JnYpsenVfHvvf1G7R5sXHGKlTcxlQWhoUTiGQ==" }, "node_modules/@astrojs/db": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@astrojs/db/-/db-0.9.1.tgz", - "integrity": "sha512-o8NRz420vIK6ouOAgCuhcoiLtN1l9I6G5Rs7Wsc2hpPNj2vpqPNIFNxAMtauY9mvLZdakq7F8GRMehSGBLX/+w==", + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@astrojs/db/-/db-0.10.4.tgz", + "integrity": "sha512-6A7UQPZZ4wQuA7JuhZ5N2/aqOECLj62+mjLC1iRFVkUTXpU251hKrZubAt0BqOdvNTuei8DNxSWuK+krFkngzA==", "dependencies": { "@libsql/client": "^0.5.5", "async-listen": "^3.0.1", "deep-diff": "^1.0.2", - "drizzle-orm": "^0.30.2", + "drizzle-orm": "^0.30.4", "github-slugger": "^2.0.0", "kleur": "^4.1.5", "nanoid": "^5.0.1", @@ -130,20 +140,20 @@ } }, "node_modules/@astrojs/prism": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.0.0.tgz", - "integrity": "sha512-g61lZupWq1bYbcBnYZqdjndShr/J3l/oFobBKPA3+qMat146zce3nz2kdO4giGbhYDt4gYdhmoBz0vZJ4sIurQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.1.0.tgz", + "integrity": "sha512-Z9IYjuXSArkAUx3N6xj6+Bnvx8OdUSHA8YoOgyepp3+zJmtVYJIl/I18GozdJVW1p5u/CNpl3Km7/gwTJK85cw==", "dependencies": { "prismjs": "^1.29.0" }, "engines": { - "node": ">=18.14.1" + "node": "^18.17.1 || ^20.3.0 || >=21.0.0" } }, "node_modules/@astrojs/sitemap": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@astrojs/sitemap/-/sitemap-3.1.1.tgz", - "integrity": "sha512-qPgdBIcDUaea98mTtLfi5z9oXZpzSjEn/kes70/Ex8FOZZ+DIHVKRYOLOtvy8p+FTXr/9oc7BjmIbTYmYLLJVg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@astrojs/sitemap/-/sitemap-3.1.3.tgz", + "integrity": "sha512-9WB5c071L+FNbs/0727lcqbHvS17TxnDRdfXXiAMustBRFlqkCrziHy+MsfeghxtyXp0pFTFO3NjGRfOppbFzQ==", "dependencies": { "sitemap": "^7.1.1", "zod": "^3.22.4" @@ -180,6 +190,20 @@ "node": ">=18.14.1" } }, + "node_modules/@astrojs/telemetry/node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, "node_modules/@babel/code-frame": { "version": "7.24.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", @@ -1074,9 +1098,9 @@ ] }, "node_modules/@mongodb-js/saslprep": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.1.tgz", - "integrity": "sha512-t7c5K033joZZMspnHg/gWPE4kandgc2OxE74aYOtGKfgB9VPuVJPix0H6fhmm2erj5PBJ21mqcx34lpIGtUCsQ==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.5.tgz", + "integrity": "sha512-XLNOMH66KhJzUJNwT/qlMnS4WsNDWD5ASdyaSH3EtK+F4r/CFGa3jT4GNi4mfOitGvWXtdLgQJkQjxSVrio+jA==", "dependencies": { "sparse-bitfield": "^3.0.3" } @@ -1299,14 +1323,14 @@ ] }, "node_modules/@shikijs/core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.2.0.tgz", - "integrity": "sha512-OlFvx+nyr5C8zpcMBnSGir0YPD6K11uYhouqhNmm1qLiis4GA7SsGtu07r9gKS9omks8RtQqHrJL4S+lqWK01A==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.3.0.tgz", + "integrity": "sha512-7fedsBfuILDTBmrYZNFI8B6ATTxhQAasUHllHmjvSZPnoq4bULWoTpHwmuQvZ8Aq03/tAa2IGo6RXqWtHdWaCA==" }, "node_modules/@types/alpinejs": { - "version": "3.13.5", - "resolved": "https://registry.npmjs.org/@types/alpinejs/-/alpinejs-3.13.5.tgz", - "integrity": "sha512-BSNTroRhmBkNiyd7ELK/5Boja92hnQMST6H4z1BqXKeMVzHjp9o1j5poqd5Tyhjd8oMFwxYC4I00eghfg2xrTA==" + "version": "3.13.10", + "resolved": "https://registry.npmjs.org/@types/alpinejs/-/alpinejs-3.13.10.tgz", + "integrity": "sha512-ah53tF6mWuuwerpDE7EHwbZErNDJQlsLISPqJhYj2RZ9nuTYbRknSkqebUd3igkhLIZKkPa7IiXjSn9qsU9O2w==" }, "node_modules/@types/babel__core": { "version": "7.20.5", @@ -1473,9 +1497,9 @@ } }, "node_modules/alpinejs": { - "version": "3.13.3", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.3.tgz", - "integrity": "sha512-WZ6WQjkAOl+WdW/jukzNHq9zHFDNKmkk/x6WF7WdyNDD6woinrfXCVsZXm0galjbco+pEpYmJLtwlZwcOfIVdg==", + "version": "3.13.8", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.8.tgz", + "integrity": "sha512-XolbBJryCndomtaHd/KHQjQeD/L72FJxy/YhLLFD4Lr7zzGcpcbg+UgXteMR2pYg1KhRUr6V4O3GfN1zJAmRWw==", "dependencies": { "@vue/reactivity": "~3.1.1" } @@ -1657,20 +1681,6 @@ "sharp": "^0.32.6" } }, - "node_modules/astro/node_modules/ci-info": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", - "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "engines": { - "node": ">=8" - } - }, "node_modules/astro/node_modules/emoji-regex": { "version": "10.3.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", @@ -1939,9 +1949,9 @@ } }, "node_modules/bson": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.2.0.tgz", - "integrity": "sha512-ID1cI+7bazPDyL9wYy9GaQ8gEEohWvcUl/Yf0dIdutJxnmInEEyCsb4awy/OiBfall7zBA179Pahi3vCdFze3Q==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.6.0.tgz", + "integrity": "sha512-BVINv2SgcMjL4oYbBuCQTpE3/VKOSxrOA8Cj/wQP7izSzlBGVomdm+TcUd0Pzy0ytLSSDweCKQ6X3f5veM5LQA==", "engines": { "node": ">=16.20.1" } @@ -2103,9 +2113,9 @@ "optional": true }, "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.0.0.tgz", + "integrity": "sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==", "funding": [ { "type": "github", @@ -3155,9 +3165,9 @@ } }, "node_modules/hast-util-to-text": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.0.tgz", - "integrity": "sha512-EWiE1FSArNBPUo1cKWtzqgnuRQwEeQbQtnFJRYV1hb1BWDgrAlBU0ExptvZMM/KSA82cDpm2sFGf3Dmc5Mza3w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", + "integrity": "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A==", "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", @@ -4399,9 +4409,9 @@ } }, "node_modules/micromark-util-subtokenize": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.0.tgz", - "integrity": "sha512-vc93L1t+gpR3p8jxeVdaYlbV2jTYteDje19rNSS/H5dlhxUYll5Fy6vJ2cDwP8RnsXi818yGty1ayP55y3W6fg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.1.tgz", + "integrity": "sha512-jZNtiFl/1aY73yS3UGQkutD0UbhTt68qnRpw2Pifmz5wV9h8gOVsN70v+Lq/f1rKaU/W8pxRe8y8Q9FX1AOe1Q==", "funding": [ { "type": "GitHub Sponsors", @@ -4541,12 +4551,12 @@ "optional": true }, "node_modules/mongodb": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.3.0.tgz", - "integrity": "sha512-tt0KuGjGtLUhLoU263+xvQmPHEGTw5LbcNC73EoFRYgSHwZt5tsoJC110hDyO1kjQzpgNrpdcSza9PknWN4LrA==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.5.0.tgz", + "integrity": "sha512-Fozq68InT+JKABGLqctgtb8P56pRrJFkbhW0ux+x1mdHeyinor8oNzJqwLjV/t5X5nJGfTlluxfyMnOXNggIUA==", "dependencies": { - "@mongodb-js/saslprep": "^1.1.0", - "bson": "^6.2.0", + "@mongodb-js/saslprep": "^1.1.5", + "bson": "^6.4.0", "mongodb-connection-string-url": "^3.0.0" }, "engines": { @@ -6098,11 +6108,11 @@ } }, "node_modules/shiki": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.2.0.tgz", - "integrity": "sha512-xLhiTMOIUXCv5DqJ4I70GgQCtdlzsTqFLZWcMHHG3TAieBUbvEGthdrlPDlX4mL/Wszx9C6rEcxU6kMlg4YlxA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.3.0.tgz", + "integrity": "sha512-9aNdQy/etMXctnPzsje1h1XIGm9YfRcSksKOGqZWXA/qP9G18/8fpz5Bjpma8bOgz3tqIpjERAd6/lLjFyzoww==", "dependencies": { - "@shikijs/core": "1.2.0" + "@shikijs/core": "1.3.0" } }, "node_modules/signal-exit": { @@ -6399,9 +6409,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", - "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.3.tgz", + "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -6411,7 +6421,7 @@ "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.19.1", + "jiti": "^1.21.0", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", diff --git a/package.json b/package.json index 128de7c..c0d9be1 100644 --- a/package.json +++ b/package.json @@ -10,15 +10,16 @@ "astro": "astro" }, "dependencies": { - "@alpinejs/collapse": "^3.13.3", - "@astrojs/db": "^0.9.1", + "@alpinejs/collapse": "^3.13.8", + "@astrojs/alpinejs": "^0.4.0", + "@astrojs/db": "^0.10.4", "@astrojs/prefetch": "^0.4.1", - "@astrojs/sitemap": "^3.1.1", + "@astrojs/sitemap": "^3.1.3", "@astrojs/tailwind": "^5.1.0", - "@types/alpinejs": "^3.13.5", - "alpinejs": "^3.13.3", - "astro": "^4.5.8", - "mongodb": "^6.3.0", - "tailwindcss": "^3.3.5" + "@types/alpinejs": "^3.13.10", + "alpinejs": "^3.13.8", + "astro": "4.5.8", + "mongodb": "^6.5.0", + "tailwindcss": "^3.4.3" } } diff --git a/src/env.d.ts b/src/env.d.ts index 0751073..7dbf370 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -9,3 +9,7 @@ interface ImportMetaEnv { interface ImportMeta { readonly env: ImportMetaEnv; } + +interface Window { + Alpine: import('alpinejs').Alpine; +} diff --git a/src/lib/alpine.ts b/src/lib/alpine.ts new file mode 100644 index 0000000..6deef08 --- /dev/null +++ b/src/lib/alpine.ts @@ -0,0 +1,36 @@ +import type { Alpine } from "alpinejs"; +// @ts-expect-error +import collapse from "@alpinejs/collapse"; +import Table from "$lib/components/table"; + +export default (Alpine: Alpine) => { + Alpine.plugin(collapse); + Alpine.data("table", Table); + Alpine.data("PRACTICE", Table); + Alpine.data("QUALIFY", Table); + Alpine.data("HEAT", Table); + Alpine.data("RACE", Table); + Alpine.data("tables", () => ({ + PRACTICE: false, + QUALIFY: false, + HEAT: false, + RACE: false, + toggle() { + this.$el.id.split(" ").forEach((id, index) => { + if (index) { + // @ts-expect-error + this[id] = false; + } else { + // @ts-expect-error + this[id] = !this[id]; + } + }); + }, + })); + Alpine.data("dropdown", () => ({ + opened: false, + toggle() { + this.opened = !this.opened; + }, + })); +}; diff --git a/src/lib/components/subsession/licenseInfo.astro b/src/lib/components/subsession/licenseInfo.astro index 18dc527..fb0435f 100644 --- a/src/lib/components/subsession/licenseInfo.astro +++ b/src/lib/components/subsession/licenseInfo.astro @@ -5,9 +5,10 @@ const [allowedLicenseOne, allowLicenseTwo] = licenses || []; const allowedLicenses = [allowedLicenseOne, allowLicenseTwo]; --- -
-

License Category: {licenseCategory}

-
+
+

License Information:

+

License Category: {licenseCategory}

+
Allowed Licenses: { allowedLicenses.map((license: License, index: number) => ( diff --git a/src/lib/components/subsession/raceSummary.astro b/src/lib/components/subsession/raceSummary.astro index b8b2b4b..0ea9ffb 100644 --- a/src/lib/components/subsession/raceSummary.astro +++ b/src/lib/components/subsession/raceSummary.astro @@ -11,15 +11,21 @@ const { start_time, end_time, } = subsession; +const started = new Date(start_time).toLocaleString("en-US", { + timeZone: "America/Chicago", +}); +const ended = new Date(end_time).toLocaleString("en-US", { + timeZone: "America/Chicago", +}); ---
- Race Summary: +

Race Summary:

Average Lap Time: {parseLapTime(event_average_lap)}

Laps Complete: {event_laps_complete}

Number of Cautions: {num_cautions} for {num_caution_laps} laps

Lead Changes: {num_lead_changes}

Strength of Field: {event_strength_of_field}

-

Started: {new Date(start_time)}

-

Ended: {new Date(end_time)}

+

Started: {started}

+

Ended: {ended}

diff --git a/src/lib/components/subsession/relevantIds.astro b/src/lib/components/subsession/relevantIds.astro index 9096006..ac07d37 100644 --- a/src/lib/components/subsession/relevantIds.astro +++ b/src/lib/components/subsession/relevantIds.astro @@ -35,7 +35,7 @@ const otherRelevantIdsList = Object.keys(relevantIdMap) ---
- Relevant IDs +

Relevant IDs:

{relevantIds.map((id) =>

{id}

)} {otherRelevantIdsList.map((value) =>

{value}

)}
diff --git a/src/lib/components/table/index.ts b/src/lib/components/table/index.ts index fab98b1..f4180d8 100644 --- a/src/lib/components/table/index.ts +++ b/src/lib/components/table/index.ts @@ -26,7 +26,7 @@ const stringSort = ({ return array.sort().reverse(); }; -export default (): AlpineComponent => ({ +export default (): AlpineComponent<{ sort: () => void }> => ({ sort() { const [tableName, columnName, rowCount, direction] = this.$el.id.split(" "); const rows = new Map(); diff --git a/src/lib/components/track/info.astro b/src/lib/components/track/info.astro index 812a239..ceb8c2d 100644 --- a/src/lib/components/track/info.astro +++ b/src/lib/components/track/info.astro @@ -3,8 +3,8 @@ const { cornersPerLap, track } = Astro.props; const { track_name, config_name, category } = track; --- -
- Track Facts: +
+

Track Facts:

Name: {track_name}

Configuration: {config_name}

Category: {category}

diff --git a/src/lib/layouts/default.astro b/src/lib/layouts/default.astro index 125ce0c..42fa9c8 100644 --- a/src/lib/layouts/default.astro +++ b/src/lib/layouts/default.astro @@ -28,17 +28,17 @@ const seoDescription = Home Jacob Collins Jack Glenzinski Shared Subsessions
diff --git a/src/lib/layouts/standings.astro b/src/lib/layouts/standings.astro index fb055d3..b67cb59 100644 --- a/src/lib/layouts/standings.astro +++ b/src/lib/layouts/standings.astro @@ -25,8 +25,9 @@ const finalData: Array> = standingsResults.map( incidents, points, } = result; - const [, year] = season_name.match(/([0-9]{4}) Season/) || - season_name.match(/([0-9]{4})$/) || [0, 0]; + const [, year] = season_name.trim().match(/([0-9]{4}) Season/) || + season_name.trim().match(/([0-9]{4})$/) || + season_name.trim().match(/^([0-9]{4})/) || [0, 0]; const [, season_number_of_year] = season_name.match( /Season ([0-9]{1})/ ) || [0, 0]; @@ -129,10 +130,4 @@ const generateLinkForKey = ({ }
- diff --git a/src/lib/layouts/subsessions.astro b/src/lib/layouts/subsessions.astro index 59a2a3a..ef8af59 100644 --- a/src/lib/layouts/subsessions.astro +++ b/src/lib/layouts/subsessions.astro @@ -115,10 +115,4 @@ const { keysArray, handledResults } = handleResults({ keysToDisplay, results }); }
- diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index 89d0d2e..58d24a2 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -186,7 +186,7 @@ export type Subsession = { series_short_name: string; session_id: number; session_results: Array; - userResult: SessionResult, + userResult: SessionResult; special_event_type: number; start_time: string; subsession_id: number; diff --git a/src/pages/shared-subsessions.astro b/src/pages/shared-subsessions.astro index 80ee110..ab65b00 100644 --- a/src/pages/shared-subsessions.astro +++ b/src/pages/shared-subsessions.astro @@ -173,10 +173,8 @@ const description = "Shared subsessions for all Stat 'n' Track users";
{ - //@ts-expect-error + results.reduce((object: Record, result) => { object.previouslyToggled = ""; - //@ts-expect-error object[`toggle${result.subsessionInfo.subsession_id}`] = false; return object; }, {}) @@ -253,11 +251,4 @@ const description = "Shared subsessions for all Stat 'n' Track users";
- diff --git a/src/pages/subsession/[id].astro b/src/pages/subsession/[id].astro index 59934ae..a441df5 100644 --- a/src/pages/subsession/[id].astro +++ b/src/pages/subsession/[id].astro @@ -47,13 +47,11 @@ const splitRaceResults = raceResults.find((result) => result.simsession_name.match(/HEAT/i) ) ? raceResults.reduce( - (object, raceResult) => { + (object: Record>, raceResult) => { const { simsession_name } = raceResult; if (simsession_name.match(/HEAT/i)) { - // @ts-ignore object.heatResults.push(raceResult); } else { - // @ts-ignore object.mainResults.push(raceResult); } return object; @@ -82,16 +80,12 @@ if (heatResults.length && mainResults.length) { session_results.push( ...[ { - // @ts-ignore simsession_type_name: heatResultOne?.simsession_type_name || "Race", - // @ts-ignore simsession_name: heatResultOne?.simsession_name || "HEAT", results: heatResults, }, { - // @ts-ignore simsession_type_name: mainResultOne?.simsession_type_name || "Race", - // @ts-ignore simsession_name: mainResultOne?.simsession_name || "RACE", results: mainResults, }, @@ -117,45 +111,15 @@ const description = `Subsession information for subsession - ${id}`;
-
-
- - -
-
+
-
-
+
+ +
- diff --git a/src/pages/user/[id]/scheduling/by-week/[timestamp].astro b/src/pages/user/[id]/scheduling/by-week/[timestamp].astro index bfe3873..c1b6d3e 100644 --- a/src/pages/user/[id]/scheduling/by-week/[timestamp].astro +++ b/src/pages/user/[id]/scheduling/by-week/[timestamp].astro @@ -185,10 +185,4 @@ const description = title; }
- diff --git a/src/pages/user/[id]/scheduling/index.astro b/src/pages/user/[id]/scheduling/index.astro index ef03ee6..2cbe283 100644 --- a/src/pages/user/[id]/scheduling/index.astro +++ b/src/pages/user/[id]/scheduling/index.astro @@ -174,17 +174,4 @@ const description = `Scheduling page for user ID: ${id}`; )) }
-
diff --git a/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/index.astro b/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/index.astro index 0ec5f41..4cc15bf 100644 --- a/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/index.astro +++ b/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/index.astro @@ -173,10 +173,4 @@ const description = title; }
- diff --git a/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/season-summary.astro b/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/season-summary.astro index fc44625..69d7a8d 100644 --- a/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/season-summary.astro +++ b/src/pages/user/[id]/season/[seasonId]/car-class/[carClassId]/season-summary.astro @@ -86,10 +86,8 @@ trackScheduleMap.forEach((value) => { const bestUserResult = userResults .sort( (a, b) => - // @ts-expect-error - a.userResult.aggregate_champ_points - - // @ts-expect-error - b.userResult.aggregate_champ_points + (a.userResult?.aggregate_champ_points || 0) - + (b.userResult?.aggregate_champ_points || 0) ) .pop(); if (bestUserResult) {