From 744c97c1d5315cc9d5c938ae09917957db201c27 Mon Sep 17 00:00:00 2001 From: Benji Grant Date: Sun, 18 Jun 2023 12:14:13 +1000 Subject: [PATCH 1/5] Cache and suspend stats until loaded --- frontend/src/app/page.tsx | 5 ++++- frontend/src/config/api.ts | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index f71e033..ced131b 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,3 +1,4 @@ +import { Suspense } from 'react' import { Trans } from 'react-i18next/TransWithoutContext' import Link from 'next/link' @@ -31,7 +32,9 @@ const Page = async () => {

{t('about.name')}

- + + +

_
__

diff --git a/frontend/src/config/api.ts b/frontend/src/config/api.ts index 4c172ab..312b092 100644 --- a/frontend/src/config/api.ts +++ b/frontend/src/config/api.ts @@ -43,11 +43,12 @@ export const StatsResponse = z.object({ }) export type StatsResponse = z.infer -const get = async (url: string, schema: S, auth?: string): Promise> => { +const get = async (url: string, schema: S, auth?: string, nextOptions?: NextFetchRequestConfig): Promise> => { const res = await fetch(new URL(url, API_BASE), { headers: { ...auth && { Authorization: `Bearer ${auth}` }, - } + }, + next: nextOptions, }) .catch(console.warn) if (!res?.ok) throw res @@ -69,7 +70,7 @@ const post = async (url: string, schema: S, input: unknown, } // Get -export const getStats = () => get('/stats', StatsResponse) +export const getStats = () => get('/stats', StatsResponse, undefined, { revalidate: 60 }) export const getEvent = (eventId: string) => get(`/event/${eventId}`, EventResponse) export const getPeople = (eventId: string) => get(`/event/${eventId}/people`, PersonResponse.array()) export const getPerson = (eventId: string, personName: string, password?: string) => get(`/event/${eventId}/people/${personName}`, PersonResponse, password && btoa(password)) From 1855188ea14b305b6452d6be6f6741e4cef73ffb Mon Sep 17 00:00:00 2001 From: Benji Grant Date: Sun, 18 Jun 2023 13:55:23 +1000 Subject: [PATCH 2/5] Update packages --- frontend/package.json | 24 +-- frontend/yarn.lock | 347 ++++++++++++++++++++++-------------------- 2 files changed, 196 insertions(+), 175 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 4d82a6f..486af7a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,16 +19,16 @@ "accept-language": "^3.0.18", "chroma.ts": "^1.0.10", "hue-map": "^1.0.0", - "i18next": "^22.5.1", + "i18next": "^23.1.0", "i18next-browser-languagedetector": "^7.0.2", "i18next-http-backend": "^2.2.1", "i18next-resources-to-backend": "^1.1.4", - "lucide-react": "^0.241.0", - "next": "^13.4.4", + "lucide-react": "^0.244.0", + "next": "^13.4.6", "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "^7.44.3", - "react-i18next": "^12.3.1", + "react-i18next": "^13.0.0", "zod": "^3.21.4", "zustand": "^4.3.8" }, @@ -36,15 +36,15 @@ "@types/gapi": "^0.0.44", "@types/gapi.calendar": "^3.0.6", "@types/google.accounts": "^0.0.7", - "@types/node": "^20.2.5", - "@types/react": "^18.2.9", - "@types/react-dom": "^18.2.4", - "@typescript-eslint/eslint-plugin": "^5.59.9", - "@typescript-eslint/parser": "^5.59.9", - "eslint": "^8.42.0", - "eslint-config-next": "^13.4.4", + "@types/node": "^20.3.1", + "@types/react": "^18.2.12", + "@types/react-dom": "^18.2.5", + "@typescript-eslint/eslint-plugin": "^5.59.11", + "@typescript-eslint/parser": "^5.59.11", + "eslint": "^8.43.0", + "eslint-config-next": "^13.4.6", "eslint-plugin-simple-import-sort": "^10.0.0", - "sass": "^1.63.2", + "sass": "^1.63.4", "typescript": "^5.1.3", "typescript-plugin-css-modules": "^5.0.1" } diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 4655d3b..eef3a79 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -26,13 +26,20 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.19.4", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5": +"@babel/runtime@^7.19.4", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.5.tgz#8492dddda9644ae3bda3b45eabe87382caee7200" integrity sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q== dependencies: regenerator-runtime "^0.13.11" +"@babel/runtime@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.5.tgz#8564dd588182ce0047d55d7a75e93921107b57ec" + integrity sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA== + dependencies: + regenerator-runtime "^0.13.11" + "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -60,10 +67,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.42.0": - version "8.42.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.42.0.tgz#484a1d638de2911e6f5a30c12f49c7e4a3270fb6" - integrity sha512-6SWlXpWU5AvId8Ac7zjzmIOqMOba/JWY8XZ4A7q7Gn1Vlfg/SFFIlrtHXt9nPn4op9ZPAkl91Jao+QQv3r/ukw== +"@eslint/js@8.43.0": + version "8.43.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.43.0.tgz#559ca3d9ddbd6bf907ad524320a0d14b85586af0" + integrity sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg== "@floating-ui/core@^1.3.0": version "1.3.0" @@ -124,62 +131,62 @@ "@babel/runtime" "^7.12.5" tslib "^2.2.0" -"@next/env@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.4.tgz#46b620f6bef97fe67a1566bf570dbb791d40c50a" - integrity sha512-q/y7VZj/9YpgzDe64Zi6rY1xPizx80JjlU2BTevlajtaE3w1LqweH1gGgxou2N7hdFosXHjGrI4OUvtFXXhGLg== +"@next/env@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/env/-/env-13.4.6.tgz#3f2041c7758660d7255707ae4cb9166519113dea" + integrity sha512-nqUxEtvDqFhmV1/awSg0K2XHNwkftNaiUqCYO9e6+MYmqNObpKVl7OgMkGaQ2SZnFx5YqF0t60ZJTlyJIDAijg== -"@next/eslint-plugin-next@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-13.4.4.tgz#0df2f699e61b97c65035f87f54795f799e12fead" - integrity sha512-5jnh7q6I15efnjR/rR+/TGTc9hn53g3JTbEjAMjmeQiExKqEUgIXqrHI5zlTNlNyzCPkBB860/ctxXheZaF2Vw== +"@next/eslint-plugin-next@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-13.4.6.tgz#6a291305226b3f762fdbc01e123efadeb63e5aaf" + integrity sha512-bPigeu0RI7bgy1ucBA2Yqcfg539y0Lzo38P2hIkrRB1GNvFSbYg6RTu8n6tGqPVrH3TTlPTNKLXG01wc+5NuwQ== dependencies: glob "7.1.7" -"@next/swc-darwin-arm64@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.4.tgz#8c14083c2478e2a9a8d140cce5900f76b75667ff" - integrity sha512-xfjgXvp4KalNUKZMHmsFxr1Ug+aGmmO6NWP0uoh4G3WFqP/mJ1xxfww0gMOeMeSq/Jyr5k7DvoZ2Pv+XOITTtw== +"@next/swc-darwin-arm64@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.6.tgz#47485f3deaee6681b4a4036c74bb9c4b728d5ddd" + integrity sha512-ahi6VP98o4HV19rkOXPSUu+ovfHfUxbJQ7VVJ7gL2FnZRr7onEFC1oGQ6NQHpm8CxpIzSSBW79kumlFMOmZVjg== -"@next/swc-darwin-x64@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.4.tgz#5fe01c65c80fcb833c8789fd70f074ea99893864" - integrity sha512-ZY9Ti1hkIwJsxGus3nlubIkvYyB0gNOYxKrfsOrLEqD0I2iCX8D7w8v6QQZ2H+dDl6UT29oeEUdDUNGk4UEpfg== +"@next/swc-darwin-x64@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.6.tgz#a6a5b232ec0f2079224fb8ed6bf11dc479af1acf" + integrity sha512-13cXxKFsPJIJKzUqrU5XB1mc0xbUgYsRcdH6/rB8c4NMEbWGdtD4QoK9ShN31TZdePpD4k416Ur7p+deMIxnnA== -"@next/swc-linux-arm64-gnu@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.4.tgz#f2e071f38e8a6cdadf507cc5d28956f73360d064" - integrity sha512-+KZnDeMShYkpkqAvGCEDeqYTRADJXc6SY1jWXz+Uo6qWQO/Jd9CoyhTJwRSxvQA16MoYzvILkGaDqirkRNctyA== +"@next/swc-linux-arm64-gnu@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.6.tgz#2a67144e863d9c45fdbd13c7827370e7f2a28405" + integrity sha512-Ti+NMHEjTNktCVxNjeWbYgmZvA2AqMMI2AMlzkXsU7W4pXCMhrryAmAIoo+7YdJbsx01JQWYVxGe62G6DoCLaA== -"@next/swc-linux-arm64-musl@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.4.tgz#23bf75c544e54562bc24ec1be036e4bd9cf89e2c" - integrity sha512-evC1twrny2XDT4uOftoubZvW3EG0zs0ZxMwEtu/dDGVRO5n5pT48S8qqEIBGBUZYu/Xx4zzpOkIxx1vpWdE+9A== +"@next/swc-linux-arm64-musl@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.6.tgz#5a191ac3575a70598e9e9c6e7264fc0b8a90b2db" + integrity sha512-OHoC6gO7XfjstgwR+z6UHKlvhqJfyMtNaJidjx3sEcfaDwS7R2lqR5AABi8PuilGgi0BO0O0sCXqLlpp3a0emQ== -"@next/swc-linux-x64-gnu@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.4.tgz#bd42590950a01957952206f89cf5622e7c9e4196" - integrity sha512-PX706XcCHr2FfkyhP2lpf+pX/tUvq6/ke7JYnnr0ykNdEMo+sb7cC/o91gnURh4sPYSiZJhsF2gbIqg9rciOHQ== +"@next/swc-linux-x64-gnu@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.6.tgz#d38adf842a8b8f9de492454328fd32a2c53350f3" + integrity sha512-zHZxPGkUlpfNJCboUrFqwlwEX5vI9LSN70b8XEb0DYzzlrZyCyOi7hwDp/+3Urm9AB7YCAJkgR5Sp1XBVjHdfQ== -"@next/swc-linux-x64-musl@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.4.tgz#907d81feb1abec3daec0ecb61e3f39b56e7aeafe" - integrity sha512-TKUUx3Ftd95JlHV6XagEnqpT204Y+IsEa3awaYIjayn0MOGjgKZMZibqarK3B1FsMSPaieJf2FEAcu9z0yT5aA== +"@next/swc-linux-x64-musl@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.6.tgz#74c745774358b78be7f958e7a8b7d93936cd6ebc" + integrity sha512-K/Y8lYGTwTpv5ME8PSJxwxLolaDRdVy+lOd9yMRMiQE0BLUhtxtCWC9ypV42uh9WpLjoaD0joOsB9Q6mbrSGJg== -"@next/swc-win32-arm64-msvc@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.4.tgz#1d754d2bb10bdf9907c0acc83711438697c3b5fe" - integrity sha512-FP8AadgSq4+HPtim7WBkCMGbhr5vh9FePXiWx9+YOdjwdQocwoCK5ZVC3OW8oh3TWth6iJ0AXJ/yQ1q1cwSZ3A== +"@next/swc-win32-arm64-msvc@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.6.tgz#1e1e02c175573e64808fc1a7e8650e3e217f1edc" + integrity sha512-U6LtxEUrjBL2tpW+Kr1nHCSJWNeIed7U7l5o7FiKGGwGgIlFi4UHDiLI6TQ2lxi20fAU33CsruV3U0GuzMlXIw== -"@next/swc-win32-ia32-msvc@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.4.tgz#77b2c7f7534b675d46e46301869e08d504d23956" - integrity sha512-3WekVmtuA2MCdcAOrgrI+PuFiFURtSyyrN1I3UPtS0ckR2HtLqyqmS334Eulf15g1/bdwMteePdK363X/Y9JMg== +"@next/swc-win32-ia32-msvc@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.6.tgz#2b528ae3ec7f6e727f4f0d81a1015f63da55c7a6" + integrity sha512-eEBeAqpCfhdPSlCZCayjCiyIllVqy4tcqvm1xmg3BgJG0G5ITiMM4Cw2WVeRSgWDJqQGRyyb+q8Y2ltzhXOWsQ== -"@next/swc-win32-x64-msvc@13.4.4": - version "13.4.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.4.tgz#faab69239f8a9d0be7cd473e65f5a07735ef7b0e" - integrity sha512-AHRITu/CrlQ+qzoqQtEMfaTu7GHaQ6bziQln/pVWpOYC1wU+Mq6VQQFlsDtMCnDztPZtppAXdvvbNS7pcfRzlw== +"@next/swc-win32-x64-msvc@13.4.6": + version "13.4.6" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.6.tgz#38620bd68267ff13e50ecd432f1822eac51382a8" + integrity sha512-OrZs94AuO3ZS5tnqlyPRNgfWvboXaDQCi5aXGve3o3C+Sj0ctMUV9+Do+0zMvvLRumR8E0PTWKvtz9n5vzIsWw== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -253,10 +260,10 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/node@^20.2.5": - version "20.2.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.2.5.tgz#26d295f3570323b2837d322180dfbf1ba156fefb" - integrity sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ== +"@types/node@^20.3.1": + version "20.3.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.1.tgz#e8a83f1aa8b649377bb1fb5d7bac5cb90e784dfe" + integrity sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg== "@types/postcss-modules-local-by-default@^4.0.0": version "4.0.0" @@ -277,10 +284,10 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf" integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w== -"@types/react-dom@^18.2.4": - version "18.2.4" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.4.tgz#13f25bfbf4e404d26f62ac6e406591451acba9e0" - integrity sha512-G2mHoTMTL4yoydITgOGwWdWMVd8sNgyEP85xVmMKAPUBwQWm9wBPQUmvbeF4V3WBY1P7mmL4BkjQ0SqUpf1snw== +"@types/react-dom@^18.2.5": + version "18.2.5" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.5.tgz#5c5f13548bda23cd98f50ca4a59107238bfe18f3" + integrity sha512-sRQsOS/sCLnpQhR4DSKGTtWFE3FZjpQa86KPVbhUqdYMRZ9FEFcfAytKhR/vUG2rH1oFbOOej6cuD7MFSobDRQ== dependencies: "@types/react" "*" @@ -293,10 +300,10 @@ "@types/scheduler" "*" csstype "^3.0.2" -"@types/react@^18.2.9": - version "18.2.9" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.9.tgz#9207f8571afdc59a9c9c30df50e8ad2591ecefaf" - integrity sha512-pL3JAesUkF7PEQGxh5XOwdXGV907te6m1/Qe1ERJLgomojS6Ne790QiA7GUl434JEkFA2aAaB6qJ5z4e1zJn/w== +"@types/react@^18.2.12": + version "18.2.12" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.12.tgz#95d584338610b78bb9ba0415e3180fb03debdf97" + integrity sha512-ndmBMLCgn38v3SntMeoJaIrO6tGHYKMEBohCUmw8HoLLQdRMOIGXfeYaBTLe2lsFaSB3MOK1VXscYFnmLtTSmw== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -312,15 +319,15 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== -"@typescript-eslint/eslint-plugin@^5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.9.tgz#2604cfaf2b306e120044f901e20c8ed926debf15" - integrity sha512-4uQIBq1ffXd2YvF7MAvehWKW3zVv/w+mSfRAu+8cKbfj3nwzyqJLNcZJpQ/WZ1HLbJDiowwmQ6NO+63nCA+fqA== +"@typescript-eslint/eslint-plugin@^5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz#8d466aa21abea4c3f37129997b198d141f09e76f" + integrity sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg== dependencies: "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.59.9" - "@typescript-eslint/type-utils" "5.59.9" - "@typescript-eslint/utils" "5.59.9" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/type-utils" "5.59.11" + "@typescript-eslint/utils" "5.59.11" debug "^4.3.4" grapheme-splitter "^1.0.4" ignore "^5.2.0" @@ -338,16 +345,24 @@ "@typescript-eslint/typescript-estree" "5.59.6" debug "^4.3.4" -"@typescript-eslint/parser@^5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.9.tgz#a85c47ccdd7e285697463da15200f9a8561dd5fa" - integrity sha512-FsPkRvBtcLQ/eVK1ivDiNYBjn3TGJdXy2fhXX+rc7czWl4ARwnpArwbihSOHI2Peg9WbtGHrbThfBUkZZGTtvQ== +"@typescript-eslint/parser@^5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.11.tgz#af7d4b7110e3068ce0b97550736de455e4250103" + integrity sha512-s9ZF3M+Nym6CAZEkJJeO2TFHHDsKAM3ecNkLuH4i4s8/RCPnF5JRip2GyviYkeEAcwGMJxkqG9h2dAsnA1nZpA== dependencies: - "@typescript-eslint/scope-manager" "5.59.9" - "@typescript-eslint/types" "5.59.9" - "@typescript-eslint/typescript-estree" "5.59.9" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/typescript-estree" "5.59.11" debug "^4.3.4" +"@typescript-eslint/scope-manager@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz#5d131a67a19189c42598af9fb2ea1165252001ce" + integrity sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q== + dependencies: + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/visitor-keys" "5.59.11" + "@typescript-eslint/scope-manager@5.59.6": version "5.59.6" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.6.tgz#d43a3687aa4433868527cfe797eb267c6be35f19" @@ -356,33 +371,38 @@ "@typescript-eslint/types" "5.59.6" "@typescript-eslint/visitor-keys" "5.59.6" -"@typescript-eslint/scope-manager@5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.9.tgz#eadce1f2733389cdb58c49770192c0f95470d2f4" - integrity sha512-8RA+E+w78z1+2dzvK/tGZ2cpGigBZ58VMEHDZtpE1v+LLjzrYGc8mMaTONSxKyEkz3IuXFM0IqYiGHlCsmlZxQ== +"@typescript-eslint/type-utils@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz#5eb67121808a84cb57d65a15f48f5bdda25f2346" + integrity sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g== dependencies: - "@typescript-eslint/types" "5.59.9" - "@typescript-eslint/visitor-keys" "5.59.9" - -"@typescript-eslint/type-utils@5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.9.tgz#53bfaae2e901e6ac637ab0536d1754dfef4dafc2" - integrity sha512-ksEsT0/mEHg9e3qZu98AlSrONAQtrSTljL3ow9CGej8eRo7pe+yaC/mvTjptp23Xo/xIf2mLZKC6KPv4Sji26Q== - dependencies: - "@typescript-eslint/typescript-estree" "5.59.9" - "@typescript-eslint/utils" "5.59.9" + "@typescript-eslint/typescript-estree" "5.59.11" + "@typescript-eslint/utils" "5.59.11" debug "^4.3.4" tsutils "^3.21.0" +"@typescript-eslint/types@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.11.tgz#1a9018fe3c565ba6969561f2a49f330cf1fe8db1" + integrity sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA== + "@typescript-eslint/types@5.59.6": version "5.59.6" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.6.tgz#5a6557a772af044afe890d77c6a07e8c23c2460b" integrity sha512-tH5lBXZI7T2MOUgOWFdVNUILsI02shyQvfzG9EJkoONWugCG77NDDa1EeDGw7oJ5IvsTAAGVV8I3Tk2PNu9QfA== -"@typescript-eslint/types@5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.9.tgz#3b4e7ae63718ce1b966e0ae620adc4099a6dcc52" - integrity sha512-uW8H5NRgTVneSVTfiCVffBb8AbwWSKg7qcA4Ot3JI3MPCJGsB4Db4BhvAODIIYE5mNj7Q+VJkK7JxmRhk2Lyjw== +"@typescript-eslint/typescript-estree@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz#b2caaa31725e17c33970c1197bcd54e3c5f42b9f" + integrity sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA== + dependencies: + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/visitor-keys" "5.59.11" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" "@typescript-eslint/typescript-estree@5.59.6": version "5.59.6" @@ -397,33 +417,28 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.9.tgz#6bfea844e468427b5e72034d33c9fffc9557392b" - integrity sha512-pmM0/VQ7kUhd1QyIxgS+aRvMgw+ZljB3eDb+jYyp6d2bC0mQWLzUDF+DLwCTkQ3tlNyVsvZRXjFyV0LkU/aXjA== - dependencies: - "@typescript-eslint/types" "5.59.9" - "@typescript-eslint/visitor-keys" "5.59.9" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.3.7" - tsutils "^3.21.0" - -"@typescript-eslint/utils@5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.9.tgz#adee890107b5ffe02cd46fdaa6c2125fb3c6c7c4" - integrity sha512-1PuMYsju/38I5Ggblaeb98TOoUvjhRvLpLa1DoTOFaLWqaXl/1iQ1eGurTXgBY58NUdtfTXKP5xBq7q9NDaLKg== +"@typescript-eslint/utils@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.11.tgz#9dbff49dc80bfdd9289f9f33548f2e8db3c59ba1" + integrity sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.59.9" - "@typescript-eslint/types" "5.59.9" - "@typescript-eslint/typescript-estree" "5.59.9" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/typescript-estree" "5.59.11" eslint-scope "^5.1.1" semver "^7.3.7" +"@typescript-eslint/visitor-keys@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz#dca561ddad169dc27d62396d64f45b2d2c3ecc56" + integrity sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA== + dependencies: + "@typescript-eslint/types" "5.59.11" + eslint-visitor-keys "^3.3.0" + "@typescript-eslint/visitor-keys@5.59.6": version "5.59.6" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.6.tgz#673fccabf28943847d0c8e9e8d008e3ada7be6bb" @@ -432,14 +447,6 @@ "@typescript-eslint/types" "5.59.6" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@5.59.9": - version "5.59.9" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.9.tgz#9f86ef8e95aca30fb5a705bb7430f95fc58b146d" - integrity sha512-bT7s0td97KMaLwpEBckbzj/YohnvXtqbe2XgqNvTl6RJVakY5mvENOTPvw5u66nljfZxthESpDozs86U+oLY8Q== - dependencies: - "@typescript-eslint/types" "5.59.9" - eslint-visitor-keys "^3.3.0" - "@vercel/analytics@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-1.0.1.tgz#38308a626c91866cb00a249c08bf65251e9b9d81" @@ -949,12 +956,12 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-config-next@^13.4.4: - version "13.4.4" - resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-13.4.4.tgz#95356e96f3796ad0587fa2aaa51ec4a81e71cedc" - integrity sha512-z/PMbm6L0iC/fwISULxe8IVy4DtNqZk2wQY711o35klenq70O6ns82A8yuMVCFjHC0DIyB2lyugesRtuk9u8dQ== +eslint-config-next@^13.4.6: + version "13.4.6" + resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-13.4.6.tgz#ccccf5dad45b23a56418d66caad5339116297308" + integrity sha512-nlv4FYish1RYYHILbQwM5/rD37cOvEqtMfDjtQCYbXdE2O3MggqHu2q6IDeLE2Z6u8ZJyNPgWOA6OimWcxj3qw== dependencies: - "@next/eslint-plugin-next" "13.4.4" + "@next/eslint-plugin-next" "13.4.6" "@rushstack/eslint-patch" "^1.1.3" "@typescript-eslint/parser" "^5.42.0" eslint-import-resolver-node "^0.3.6" @@ -1089,15 +1096,15 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== -eslint@^8.42.0: - version "8.42.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.42.0.tgz#7bebdc3a55f9ed7167251fe7259f75219cade291" - integrity sha512-ulg9Ms6E1WPf67PHaEY4/6E2tEn5/f7FXGzr3t9cBMugOmf1INYvuUwwh1aXQN4MfJ6a5K2iNwP3w4AColvI9A== +eslint@^8.43.0: + version "8.43.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.43.0.tgz#3e8c6066a57097adfd9d390b8fc93075f257a094" + integrity sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.4.0" "@eslint/eslintrc" "^2.0.3" - "@eslint/js" "8.42.0" + "@eslint/js" "8.43.0" "@humanwhocodes/config-array" "^0.11.10" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -1349,6 +1356,11 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" +glob-to-regexp@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + glob@7.1.7: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" @@ -1516,12 +1528,12 @@ i18next-resources-to-backend@^1.1.4: dependencies: "@babel/runtime" "^7.21.5" -i18next@^22.5.1: - version "22.5.1" - resolved "https://registry.yarnpkg.com/i18next/-/i18next-22.5.1.tgz#99df0b318741a506000c243429a7352e5f44d424" - integrity sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA== +i18next@^23.1.0: + version "23.1.0" + resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.1.0.tgz#d0c4222b38a3007e6070d43d40fe59ca57d6bbaa" + integrity sha512-CObNPofJpw7zGVGYLd58mtMZUF+NZQl9czYMihbJkStjX+Nlu9kC3PHiC6uE1niP3qxP/3ocLXIBc2zqbAb1dg== dependencies: - "@babel/runtime" "^7.20.6" + "@babel/runtime" "^7.22.5" iconv-lite@^0.6.3: version "0.6.3" @@ -1916,10 +1928,10 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -lucide-react@^0.241.0: - version "0.241.0" - resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.241.0.tgz#e5116bb66e64e8c1742bd063a96248f54b527a8e" - integrity sha512-g22ci6iHuNc2hUwjiFz0D3jQQfQYrZBZesXG6+AX5rOV68Epttkt/nF6dMdz6reKJjtpoNzu+LKeKHGu/qjOgQ== +lucide-react@^0.244.0: + version "0.244.0" + resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.244.0.tgz#9626f44881830280012dad23afda7ddbcffff24b" + integrity sha512-PeDVbx5PlIRrVvdxiuSxPfBo7sK5qrL3LbvvRoGVNiHYRAkBm/48lKqoioxcmp0bgsyJs9lMw7CdtGFvnMJbVg== make-dir@^2.1.0: version "2.1.0" @@ -2013,28 +2025,29 @@ needle@^3.1.0: iconv-lite "^0.6.3" sax "^1.2.4" -next@^13.4.4: - version "13.4.4" - resolved "https://registry.yarnpkg.com/next/-/next-13.4.4.tgz#d1027c8d77f4c51be0b39f671b4820db03c93e60" - integrity sha512-C5S0ysM0Ily9McL4Jb48nOQHT1BukOWI59uC3X/xCMlYIh9rJZCv7nzG92J6e1cOBqQbKovlpgvHWFmz4eKKEA== +next@^13.4.6: + version "13.4.6" + resolved "https://registry.yarnpkg.com/next/-/next-13.4.6.tgz#ebe52f5c74d60176d45b45e73f25a51103713ea4" + integrity sha512-sjVqjxU+U2aXZnYt4Ud6CTLNNwWjdSfMgemGpIQJcN3Z7Jni9xRWbR0ie5fQzCg87aLqQVhKA2ud2gPoqJ9lGw== dependencies: - "@next/env" "13.4.4" + "@next/env" "13.4.6" "@swc/helpers" "0.5.1" busboy "1.6.0" caniuse-lite "^1.0.30001406" postcss "8.4.14" styled-jsx "5.1.1" + watchpack "2.4.0" zod "3.21.4" optionalDependencies: - "@next/swc-darwin-arm64" "13.4.4" - "@next/swc-darwin-x64" "13.4.4" - "@next/swc-linux-arm64-gnu" "13.4.4" - "@next/swc-linux-arm64-musl" "13.4.4" - "@next/swc-linux-x64-gnu" "13.4.4" - "@next/swc-linux-x64-musl" "13.4.4" - "@next/swc-win32-arm64-msvc" "13.4.4" - "@next/swc-win32-ia32-msvc" "13.4.4" - "@next/swc-win32-x64-msvc" "13.4.4" + "@next/swc-darwin-arm64" "13.4.6" + "@next/swc-darwin-x64" "13.4.6" + "@next/swc-linux-arm64-gnu" "13.4.6" + "@next/swc-linux-arm64-musl" "13.4.6" + "@next/swc-linux-x64-gnu" "13.4.6" + "@next/swc-linux-x64-musl" "13.4.6" + "@next/swc-win32-arm64-msvc" "13.4.6" + "@next/swc-win32-ia32-msvc" "13.4.6" + "@next/swc-win32-x64-msvc" "13.4.6" node-fetch@^2.6.11: version "2.6.11" @@ -2346,12 +2359,12 @@ react-hook-form@^7.44.3: resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.44.3.tgz#a99e560c6ef2b668db1daaebc4f98267331b6828" integrity sha512-/tHId6p2ViAka1wECMw8FEPn/oz/w226zehHrJyQ1oIzCBNMIJCaj6ZkQcv+MjDxYh9MWR7RQic7Qqwe4a5nkw== -react-i18next@^12.3.1: - version "12.3.1" - resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-12.3.1.tgz#30134a41a2a71c61dc69c6383504929aed1c99e7" - integrity sha512-5v8E2XjZDFzK7K87eSwC7AJcAkcLt5xYZ4+yTPDAW1i7C93oOY1dnr4BaQM7un4Hm+GmghuiPvevWwlca5PwDA== +react-i18next@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-13.0.0.tgz#358a3ed93206fd2d5b78507bccce89a6f7d73e17" + integrity sha512-qRFbrSgynsBSjfnSTb/Um3mw9uPjOfDi4Iq2rMCuzfsRsYGdkEdyCr0i+T0bR0bG6xwULvK4k1oRVLLd7ZDBVw== dependencies: - "@babel/runtime" "^7.20.6" + "@babel/runtime" "^7.22.5" html-parse-stringify "^3.0.1" react-is@^16.13.1: @@ -2469,10 +2482,10 @@ sass@^1.58.3: immutable "^4.0.0" source-map-js ">=0.6.2 <2.0.0" -sass@^1.63.2: - version "1.63.2" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.63.2.tgz#75f7d9a8e67d1d5b98a989507f4d98b6067b1f75" - integrity sha512-u56TU0AIFqMtauKl/OJ1AeFsXqRHkgO7nCWmHaDwfxDo9GUMSqBA4NEh6GMuh1CYVM7zuROYtZrHzPc2ixK+ww== +sass@^1.63.4: + version "1.63.4" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.63.4.tgz#caf60643321044c61f6a0fe638a07abbd31cfb5d" + integrity sha512-Sx/+weUmK+oiIlI+9sdD0wZHsqpbgQg8wSwSnGBjwb5GwqFhYNwwnI+UWZtLjKvKyFlKkatRK235qQ3mokyPoQ== dependencies: chokidar ">=3.0.0 <4.0.0" immutable "^4.0.0" @@ -2839,6 +2852,14 @@ void-elements@3.1.0: resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09" integrity sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w== +watchpack@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" + integrity sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg== + dependencies: + glob-to-regexp "^0.4.1" + graceful-fs "^4.1.2" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" From 8d9a8cf8680c7745dec802d611b4e4c7e09c8396 Mon Sep 17 00:00:00 2001 From: Benji Grant Date: Sun, 18 Jun 2023 13:55:44 +1000 Subject: [PATCH 3/5] Wrap event page parts in suspense --- frontend/src/app/[id]/EventAvailabilities.tsx | 48 ++++++++-------- frontend/src/app/[id]/page.module.scss | 9 +++ frontend/src/app/[id]/page.tsx | 57 ++++++++++++------- .../AvailabilityEditor/AvailabilityEditor.tsx | 6 +- .../AvailabilityViewer/AvailabilityViewer.tsx | 4 +- .../CalendarField/components/Month/Month.tsx | 4 +- .../components/Weekdays/Weekdays.tsx | 2 +- frontend/src/components/Copyable/Copyable.tsx | 9 ++- .../components/EventInfo/EventInfo.tsx | 2 +- .../src/components/Error/Error.module.scss | 6 ++ frontend/src/components/Footer/Footer.tsx | 2 +- frontend/src/components/Legend/Legend.tsx | 2 +- .../src/components/Login/Login.module.scss | 5 +- frontend/src/components/Login/Login.tsx | 4 +- frontend/src/components/Settings/Settings.tsx | 2 +- frontend/src/components/Video/Video.tsx | 4 +- frontend/src/utils/calculateAvailability.ts | 4 +- frontend/src/utils/calculateTable.ts | 2 +- frontend/src/utils/convertTimesToDates.ts | 2 +- 19 files changed, 103 insertions(+), 71 deletions(-) diff --git a/frontend/src/app/[id]/EventAvailabilities.tsx b/frontend/src/app/[id]/EventAvailabilities.tsx index 992f48e..ddf6dfd 100644 --- a/frontend/src/app/[id]/EventAvailabilities.tsx +++ b/frontend/src/app/[id]/EventAvailabilities.tsx @@ -1,6 +1,6 @@ 'use client' -import { useEffect, useMemo, useState } from 'react' +import { useEffect, useMemo, useRef, useState } from 'react' import { Trans } from 'react-i18next/TransWithoutContext' import AvailabilityEditor from '/src/components/AvailabilityEditor/AvailabilityEditor' @@ -20,17 +20,16 @@ import { calculateTable, expandTimes, makeClass } from '/src/utils' import styles from './page.module.scss' interface EventAvailabilitiesProps { - event: EventResponse - people: PersonResponse[] + event?: EventResponse } -const EventAvailabilities = ({ event, ...data }: EventAvailabilitiesProps) => { +const EventAvailabilities = ({ event }: EventAvailabilitiesProps) => { const { t, i18n } = useTranslation('event') const timeFormat = useStore(useSettingsStore, state => state.timeFormat) ?? '12h' - const [people, setPeople] = useState(data.people) - const expandedTimes = useMemo(() => expandTimes(event.times), [event.times]) + const [people, setPeople] = useState([]) + const expandedTimes = useMemo(() => expandTimes(event?.times ?? []), [event?.times]) const [user, setUser] = useState() const [password, setPassword] = useState() @@ -39,40 +38,40 @@ const EventAvailabilities = ({ event, ...data }: EventAvailabilitiesProps) => { const [timezone, setTimezone] = useState(Intl.DateTimeFormat().resolvedOptions().timeZone) // Web worker for calculating the heatmap table - const tableWorker = useMemo(() => (typeof window !== undefined && window.Worker) ? new Worker(new URL('/src/workers/calculateTable', import.meta.url)) : undefined, []) + const tableWorker = useRef() // Calculate table (using a web worker if available) const [table, setTable] = useState>() useEffect(() => { + if (!tableWorker.current) { + tableWorker.current = window.Worker ? new Worker(new URL('/src/workers/calculateTable', import.meta.url)) : undefined + } const args = { times: expandedTimes, locale: i18n.language, timeFormat, timezone } - if (tableWorker) { - tableWorker.postMessage(args) + if (tableWorker.current) { + tableWorker.current.onmessage = (e: MessageEvent>) => setTable(e.data) + tableWorker.current.postMessage(args) setTable(undefined) } else { setTable(calculateTable(args)) } - }, [tableWorker, expandedTimes, i18n.language, timeFormat, timezone]) - - useEffect(() => { - if (tableWorker) { - tableWorker.onmessage = (e: MessageEvent>) => setTable(e.data) - } - }, [tableWorker]) + }, [expandedTimes, i18n.language, timeFormat, timezone]) // Add this event to recents const addRecent = useRecentsStore(state => state.addRecent) useEffect(() => { - addRecent({ - id: event.id, - name: event.name, - created_at: event.created_at, - }) + if (event) { + addRecent({ + id: event.id, + name: event.name, + created_at: event.created_at, + }) + } }, [addRecent]) // Refetch availabilities useEffect(() => { - if (tab === 'group') { + if (tab === 'group' && event) { getPeople(event.id) .then(setPeople) .catch(console.warn) @@ -82,7 +81,7 @@ const EventAvailabilities = ({ event, ...data }: EventAvailabilitiesProps) => { return <>
- { + { setUser(u) setPassword(p) setTab(u ? 'you' : 'group') @@ -148,7 +147,7 @@ const EventAvailabilities = ({ event, ...data }: EventAvailabilitiesProps) => { document.dispatchEvent(new CustomEvent('focusName')) } }} - title={user ? '' : t('tabs.you_tooltip')} + title={user ? '' : t('tabs.you_tooltip')} >{t('tabs.you')} - {times[0].length === 13 && + {times[0]?.length === 13 &&
('greyed_times')} + title={t('greyed_times')} /> const isSelected = ( @@ -162,7 +162,7 @@ const AvailabilityEditor = ({ times, timezone, value = [], onChange, table }: Av })}
:
} - ) ?? } + ) ?? }
diff --git a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx index eee8bad..05f31e1 100644 --- a/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx +++ b/frontend/src/components/AvailabilityViewer/AvailabilityViewer.tsx @@ -70,7 +70,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = if (!cell) return
('greyed_times')} + title={t('greyed_times')} /> let peopleHere = availabilities.find(a => a.date === cell.serialized)?.people ?? [] @@ -106,7 +106,7 @@ const AvailabilityViewer = ({ times, people, table }: AvailabilityViewerProps) = })}
:
} - ) ?? , [ + ) ?? , [ availabilities, table?.columns, highlight, diff --git a/frontend/src/components/CalendarField/components/Month/Month.tsx b/frontend/src/components/CalendarField/components/Month/Month.tsx index e6ceeef..ed570d8 100644 --- a/frontend/src/components/CalendarField/components/Month/Month.tsx +++ b/frontend/src/components/CalendarField/components/Month/Month.tsx @@ -55,13 +55,13 @@ const Month = ({ value, onChange }: MonthProps) => { return <> {useMemo(() =>
} diff --git a/frontend/src/components/Error/Error.module.scss b/frontend/src/components/Error/Error.module.scss index 0a9e38f..5057cea 100644 --- a/frontend/src/components/Error/Error.module.scss +++ b/frontend/src/components/Error/Error.module.scss @@ -39,4 +39,10 @@ justify-content: center; margin-left: 16px; padding: 0; + border-radius: .2em; + + &:focus-visible { + outline: 2px solid currentColor; + outline-offset: 2px; + } } diff --git a/frontend/src/components/Footer/Footer.tsx b/frontend/src/components/Footer/Footer.tsx index 2a668af..7f7d690 100644 --- a/frontend/src/components/Footer/Footer.tsx +++ b/frontend/src/components/Footer/Footer.tsx @@ -23,7 +23,7 @@ const Footer = async ({ isSmall }: FooterProps) => { {t('donate.info')} { width="560" height="315" src="https://www.youtube.com/embed/yXGd4VXZzcY?modestbranding=1&rel=0&autoplay=1" - title={t('video.title')} + title={t('video.title')} frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen @@ -34,7 +34,7 @@ const Video = () => { setIsPlaying(true) }} > - {t<string('video.button')} /> + {t('video.button')} {t('video.button')} ) diff --git a/frontend/src/utils/calculateAvailability.ts b/frontend/src/utils/calculateAvailability.ts index 93b4b01..67286f3 100644 --- a/frontend/src/utils/calculateAvailability.ts +++ b/frontend/src/utils/calculateAvailability.ts @@ -23,8 +23,8 @@ interface AvailabilityInfo { * group availability for each date passed in. */ export const calculateAvailability = (dates: string[], people: Person[]): AvailabilityInfo => { - let min = Infinity - let max = -Infinity + let min = 0 + let max = people.length const availabilities: Availability[] = dates.map(date => { const names = people.flatMap(p => p.availability.some(d => d === date) ? [p.name] : []) diff --git a/frontend/src/utils/calculateTable.ts b/frontend/src/utils/calculateTable.ts index b2358c4..500734c 100644 --- a/frontend/src/utils/calculateTable.ts +++ b/frontend/src/utils/calculateTable.ts @@ -26,7 +26,7 @@ export const calculateTable = ({ const columns = calculateColumns(dates) // Is specific dates or just days of the week - const isSpecificDates = times[0].length === 13 + const isSpecificDates = times[0]?.length === 13 return { rows: rows.map(row => row && row.minute === 0 ? { diff --git a/frontend/src/utils/convertTimesToDates.ts b/frontend/src/utils/convertTimesToDates.ts index a0064ff..62dc505 100644 --- a/frontend/src/utils/convertTimesToDates.ts +++ b/frontend/src/utils/convertTimesToDates.ts @@ -6,7 +6,7 @@ import { Temporal } from '@js-temporal/polyfill' * @param timezone The target timezone */ export const convertTimesToDates = (times: string[], timezone: string): Temporal.ZonedDateTime[] => { - const isSpecificDates = times[0].length === 13 + const isSpecificDates = times[0]?.length === 13 return times.map(time => isSpecificDates ? parseSpecificDate(time).withTimeZone(timezone) From e49a7e8c97c770e8894b9443a85ffc2ab095d6b9 Mon Sep 17 00:00:00 2001 From: Benji Grant Date: Sun, 18 Jun 2023 17:22:15 +1000 Subject: [PATCH 4/5] Disable login form while loading --- frontend/src/app/[id]/loading.tsx | 17 +++++++++ frontend/src/app/[id]/page.tsx | 46 +++++++++++-------------- frontend/src/components/Login/Login.tsx | 4 ++- 3 files changed, 40 insertions(+), 27 deletions(-) create mode 100644 frontend/src/app/[id]/loading.tsx diff --git a/frontend/src/app/[id]/loading.tsx b/frontend/src/app/[id]/loading.tsx new file mode 100644 index 0000000..25825ef --- /dev/null +++ b/frontend/src/app/[id]/loading.tsx @@ -0,0 +1,17 @@ +import EventAvailabilities from '/src/app/[id]/EventAvailabilities' +import Content from '/src/components/Content/Content' + +import styles from './page.module.scss' + +const Loading = async () => <> + +

+
+
+
+
+ + + + +export default Loading diff --git a/frontend/src/app/[id]/page.tsx b/frontend/src/app/[id]/page.tsx index 44b18f1..0090a33 100644 --- a/frontend/src/app/[id]/page.tsx +++ b/frontend/src/app/[id]/page.tsx @@ -6,7 +6,7 @@ import { Temporal } from '@js-temporal/polyfill' import Content from '/src/components/Content/Content' import Copyable from '/src/components/Copyable/Copyable' -import { EventResponse, getEvent } from '/src/config/api' +import { getEvent } from '/src/config/api' import { useTranslation } from '/src/i18n/server' import { makeClass, relativeTimeFormat } from '/src/utils' @@ -27,7 +27,10 @@ export const generateMetadata = async ({ params }: PageProps): Promise } const Page = async ({ params }: PageProps) => { - const event = getEvent(params.id) + const event = await getEvent(params.id).catch(() => undefined) + if (!event) notFound() + + const { t, i18n } = await useTranslation(['common', 'event']) return <> {
} > - + +

{event.name}

+ {t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })} + + + {`https://crab.fit/${event.id}`} + +

+ ___ +

+
- undefined)} /> + } -const EventMeta = async (props: { event: Promise }) => { - const event = await props.event.catch(() => undefined) - if (!event) notFound() - - const { t, i18n } = await useTranslation(['common', 'event']) - - return -

{event.name}

- {t('common:created', { date: relativeTimeFormat(Temporal.Instant.fromEpochSeconds(event.created_at), i18n.language) })} - - - {`https://crab.fit/${event.id}`} - -

- ___ -

-
-} - export default Page diff --git a/frontend/src/components/Login/Login.tsx b/frontend/src/components/Login/Login.tsx index c3178ec..d3f86c3 100644 --- a/frontend/src/components/Login/Login.tsx +++ b/frontend/src/components/Login/Login.tsx @@ -78,6 +78,7 @@ const Login = ({ eventId, user, onChange }: LoginProps) => { type="text" isInline required + disabled={!eventId} {...register('username')} /> @@ -85,13 +86,14 @@ const Login = ({ eventId, user, onChange }: LoginProps) => { label={t('form.password')} type="password" isInline + disabled={!eventId} {...register('password')} /> setError(undefined)}>{error} From ab6e03adacc72e51072f7fe2705752a8b1c36458 Mon Sep 17 00:00:00 2001 From: Benji Grant Date: Sun, 18 Jun 2023 17:24:46 +1000 Subject: [PATCH 5/5] Don't load worker while loading event --- frontend/src/app/[id]/EventAvailabilities.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/[id]/EventAvailabilities.tsx b/frontend/src/app/[id]/EventAvailabilities.tsx index ddf6dfd..54dfbe7 100644 --- a/frontend/src/app/[id]/EventAvailabilities.tsx +++ b/frontend/src/app/[id]/EventAvailabilities.tsx @@ -44,16 +44,18 @@ const EventAvailabilities = ({ event }: EventAvailabilitiesProps) => { const [table, setTable] = useState>() useEffect(() => { - if (!tableWorker.current) { - tableWorker.current = window.Worker ? new Worker(new URL('/src/workers/calculateTable', import.meta.url)) : undefined - } - const args = { times: expandedTimes, locale: i18n.language, timeFormat, timezone } - if (tableWorker.current) { - tableWorker.current.onmessage = (e: MessageEvent>) => setTable(e.data) - tableWorker.current.postMessage(args) - setTable(undefined) - } else { - setTable(calculateTable(args)) + if (event && expandTimes.length > 0) { + if (!tableWorker.current) { + tableWorker.current = window.Worker ? new Worker(new URL('/src/workers/calculateTable', import.meta.url)) : undefined + } + const args = { times: expandedTimes, locale: i18n.language, timeFormat, timezone } + if (tableWorker.current) { + tableWorker.current.onmessage = (e: MessageEvent>) => setTable(e.data) + tableWorker.current.postMessage(args) + setTable(undefined) + } else { + setTable(calculateTable(args)) + } } }, [expandedTimes, i18n.language, timeFormat, timezone])