From 89af3d8c99f26c5fdf0ce8d6149267cb4079185c Mon Sep 17 00:00:00 2001 From: Owen Rees Date: Mon, 10 Jul 2023 11:40:03 +0200 Subject: [PATCH 1/3] screen size calc now done with useBreakpoint hook --- .gitignore | 1 + .idea/.gitignore | 8 ++++++++ .idea/discord.xml | 7 +++++++ .idea/echecsfrance.iml | 11 +++++++++++ .idea/inspectionProfiles/Project_Default.xml | 6 ++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ TODO | 18 ------------------ app/[lang]/tournois/ScrollToTopButton.tsx | 14 ++------------ 10 files changed, 55 insertions(+), 30 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/discord.xml create mode 100644 .idea/echecsfrance.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml delete mode 100644 TODO diff --git a/.gitignore b/.gitignore index 74206d9..e8eaae9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. TODO diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..30bab2a --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/echecsfrance.iml b/.idea/echecsfrance.iml new file mode 100644 index 0000000..478db44 --- /dev/null +++ b/.idea/echecsfrance.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..639900d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e8c917d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TODO b/TODO deleted file mode 100644 index a0902d1..0000000 --- a/TODO +++ /dev/null @@ -1,18 +0,0 @@ -BUGS -//TODO tournament page load is weird on 2nd click. On safari it pauses for a few seconds. Is it trying to load the entire page before displaying? -//TODO Nodemailer 'from' reverts to echecsfrance@gmail.com - quick fix done with sender address in subject line - ----------------------------------------------------------------- -DESIGN CHANGES -//TODO font size on mobile screen -//TODO mobile navbar is creeping into the page by a few pixels when hidden - move it to the right a bit. It is easier to see in light mode. I cant see this on Linux -//TODO logo for navbar and favicon -//TODO mobile map needs improving - ----------------------------------------------------------------- -LOGIC -//TODO error handling - check everything, wrap in try/catch or use library to handle, log errors - -MISC ----------------------------------------------------------------- -//TODO move smaller ui components into a new folder, and make them reusable - such as using generic prop names diff --git a/app/[lang]/tournois/ScrollToTopButton.tsx b/app/[lang]/tournois/ScrollToTopButton.tsx index 321ac3b..f7d702d 100644 --- a/app/[lang]/tournois/ScrollToTopButton.tsx +++ b/app/[lang]/tournois/ScrollToTopButton.tsx @@ -5,21 +5,11 @@ import { ScrollableElement } from "@/types"; import { FaArrowUp } from "react-icons/fa"; import { handleScrollToTop } from "@/handlers/scrollHandlers"; import { useEffect, useRef, useState } from "react"; +import {useBreakpoint} from "@/hooks/tailwind"; const ScrollToTopButton = () => { const scrollToTopElementRef = useRef(null); - const [isLgScreen, setIsLgScreen] = useState(false); - - // calculate screen size - useEffect(() => { - const handleResize = () => { - setIsLgScreen(window.innerWidth >= 1024); - }; - handleResize(); - - window.addEventListener("resize", handleResize); - return () => window.removeEventListener("resize", handleResize); - }); + const isLgScreen = useBreakpoint("lg"); // determine scrollable element based on screen size - window or div useEffect(() => { From d04747d8968177bc09fe0e9ead5d2b4d2d9d92ff Mon Sep 17 00:00:00 2001 From: Owen Rees Date: Mon, 10 Jul 2023 11:41:53 +0200 Subject: [PATCH 2/3] readme update --- README-fr.md | 2 -- README.md | 3 --- 2 files changed, 5 deletions(-) diff --git a/README-fr.md b/README-fr.md index b532155..be2729b 100644 --- a/README-fr.md +++ b/README-fr.md @@ -30,5 +30,3 @@ et est déployé sur [Vercel](https://vercel.com/) Les contributions sont encouragées. Veuillez ouvrir une nouvelle 'issue' sur GitHub pour discuter de vos idées. Nous utilisons une stratégie de branchement [Github Flow](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy#github-flow-considerations). Créez une nouvelle branche en utilisant Git et ajoutez votre code dedans. Vous pouvez utiliser: `fonctionalité/nom_de_la_fonctionnalité` comme nom de branche. - -Veuillez consulter le fichier [TODO](https://github.com/TheRealOwenRees/echecsfrance/blob/main/TODO) pour une liste de suggestions. diff --git a/README.md b/README.md index c760b11..cd4a514 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,3 @@ and is deployed on [Vercel](https://vercel.com/) ## Contributions Contributions are encouraged. Please open an issue to discuss your ideas. Add your code into a feature branch such as `feature/feature-name`. We utilise a [GitHub Flow](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy#github-flow-considerations) branching strategy. - - -Please see the [TODO](https://github.com/TheRealOwenRees/echecsfrance/blob/main/TODO) file for a list of suggestions. From 27a43caa7b5743923710c9f15f75fcebeae5be38 Mon Sep 17 00:00:00 2001 From: Owen Rees Date: Mon, 10 Jul 2023 13:10:31 +0200 Subject: [PATCH 3/3] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index e8eaae9..74206d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. TODO