From 5511577d2c5c6ec2733a0ef7c86f3ad68a2fafcf Mon Sep 17 00:00:00 2001 From: Jeremie Pardou <571533+jrmi@users.noreply.github.com> Date: Mon, 11 Sep 2023 22:13:47 +0200 Subject: [PATCH] Allow to rotate the board --- package-lock.json | 14 +++++++------- package.json | 2 +- src/i18n/en.json | 7 ++++--- src/i18n/fr.json | 7 ++++--- src/views/BoardView/NavBar.jsx | 11 +++++++++++ 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 49a9d786..f24f639a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "react-icons": "^4.8.0", "react-query": "^3.39.3", "react-router-dom": "^6.8.0", - "react-sync-board": "^1.1.6", + "react-sync-board": "^1.2.0", "react-toastify": "^6.1.0", "recoil": "^0.7.4", "socket.io-client": "^4.1.2", @@ -9189,9 +9189,9 @@ } }, "node_modules/react-sync-board": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/react-sync-board/-/react-sync-board-1.1.6.tgz", - "integrity": "sha512-FGZ69wMyGb0KgqlgWH1BVx2xzPcOW1UkHIsVgtirGIlygiRTZYvp1Dtt0Zh1ZJXmmcqusVUTTSFQ0kFjY+AC9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/react-sync-board/-/react-sync-board-1.2.0.tgz", + "integrity": "sha512-McWa6LC7ZbAb9mcH0v8obvRi+FtbwRMebUfgUhC1DUWpKwzYc+J9c38WtMb4l+y5Wt68pEolykSHfYzlBQF+uw==", "dependencies": { "@react-hookz/web": "^22.0.0", "color2k": "^2.0.0", @@ -17857,9 +17857,9 @@ } }, "react-sync-board": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/react-sync-board/-/react-sync-board-1.1.6.tgz", - "integrity": "sha512-FGZ69wMyGb0KgqlgWH1BVx2xzPcOW1UkHIsVgtirGIlygiRTZYvp1Dtt0Zh1ZJXmmcqusVUTTSFQ0kFjY+AC9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/react-sync-board/-/react-sync-board-1.2.0.tgz", + "integrity": "sha512-McWa6LC7ZbAb9mcH0v8obvRi+FtbwRMebUfgUhC1DUWpKwzYc+J9c38WtMb4l+y5Wt68pEolykSHfYzlBQF+uw==", "requires": { "@react-hookz/web": "^22.0.0", "color2k": "^2.0.0", diff --git a/package.json b/package.json index 66abec78..c038d727 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "react-icons": "^4.8.0", "react-query": "^3.39.3", "react-router-dom": "^6.8.0", - "react-sync-board": "^1.1.6", + "react-sync-board": "^1.2.0", "react-toastify": "^6.1.0", "recoil": "^0.7.4", "socket.io-client": "^4.1.2", diff --git a/src/i18n/en.json b/src/i18n/en.json index 7f5d8637..330fdb07 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -211,10 +211,10 @@ "You've locked your first element. Long click to select it again.": "You've locked your first element. Long click on it to select it again.", "Your games": "Your games", "Zone": "Zone", - "about": "<0>Air Board Game is a plateform designed to play any board games with your friends online. For more information or to access source code visit <1>Github.<1>Legal mentions<2>This site is hosted by Netlify (San Francisco, US) and OVH (2, rue Kellermann, 59100 Roubaix)<3>Abuse report<4>To report abuse, please email at abu<1>anti-spanse-report@airboardgame.com<5>RGPD<6>No personnal data are collected. When you use your email to login, this information is lost and not used for anything else than sending you an authentication link.<7>Credits<8>Thanks to everybody !", + "about": "<0>Air Board Game is a platform designed to play any board games with your friends online. For more information or to access source code visit <1>Github.<1>Legal mentions<2>This site is hosted by Netlify (San Francisco, US) and OVH (2, rue Kellermann, 59100 Roubaix)<3>Abuse report<4>To report abuse, please email at abu<1>anti-spanse-report@airboardgame.com<5>RGPD<6>No personnal data are collected. When you use your email to login, this information is lost and not used for anything else than sending you an authentication link.<7>Credits<8>Thanks to everybody !", "baseline": "<0>Play board games online<1>with your friends - for free!<1>Choose from our selection or create your own.<1>No need to sign up. Just start a game and share the link with your friends.", "games-available": "{{ nbOfGames }} games available", - "helpBoard": "<0><0>Move the board with middle mouse button click. Alternatively you can use left button with alt key.<1>Zoom with mouse wheel.<2>Switch to edit mode with top button to be able to edit the game.<3>You can save and reload game by clicking the burger menu.<4>Use <5>Ctrl + <5>1…<5>9 to save a position and <5>1…<5>9 to restore it.<4>Press <5>space to zoom temporally.", + "helpBoard": "<0><0>Move the board with the left mouse button. Alternatively you can use right button with alt key.<1>Zoom with mouse wheel.<2>Switch to edit mode with the bottom button button bar to be able to edit an item.<3>You can save and reload game by clicking the burger menu.<4>Use <5>Ctrl + <5>1…<5>9 to save a position and <5>1…<5>9 to restore it.<4>Press <5>space to zoom temporally.", "helpItem": "<0><0>Double click on any item to execute his main action.<1>Long click an item to select a locked item<2>See other shortcut on action menu", "items": "One item", "items_plural": "{{count}} items", @@ -355,5 +355,6 @@ "Die": "Die", "Image die": "Image die", "Include files": "Include files", - "An error occurred. Try again!": "An error occurred. Try again!" + "An error occurred. Try again!": "An error occurred. Try again!", + "Rotate board": "Rotate board" } diff --git a/src/i18n/fr.json b/src/i18n/fr.json index d75d4639..7ee1513d 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -211,10 +211,10 @@ "You've locked your first element. Long click to select it again.": "Vous avez figé votre premier élément. Un long click sur celui-ci permet de le sélectionner de nouveau.", "Your games": "Vos jeux", "Zone": "Zone", - "about": "<0>Air Board Game is a plateform designed to play any board games with your friends online. For more information or to access source code visit <1>Github.<1>Legal mentions<2>This site is hosted by Netlify (San Francisco, US) and OVH (2, rue Kellermann, 59100 Roubaix)<3>Abuse report<4>To report abuse, please email at abu<1>anti-spanse-report@airboardgame.com<5>RGPD<6>No personnal data are collected. When you use your email to login, this information is lost and not used for anything else than sending you an authentication link.<7>Credits<8>Thanks to everybody !", + "about": "<0>Airboardgame est une plateforme pour jouer avec vos amis en ligne. For more information or to access source code visit <1>Github.<1>Legal mentions<2>This site is hosted by Netlify (San Francisco, US) and OVH (2, rue Kellermann, 59100 Roubaix)<3>Abuse report<4>To report abuse, please email at abu<1>anti-spanse-report@airboardgame.com<5>RGPD<6>No personnal data are collected. When you use your email to login, this information is lost and not used for anything else than sending you an authentication link.<7>Credits<8>Thanks to everybody !", "baseline": "<0>Jouez aux jeux de société en ligne<1>avec vos amis - gratuitement !<1>Choisissez parmi notre sélection ou ajoutez le votre.<1>Pas besoin de compte, démarrez un jeu et partagez le lien avec vos amis.", "games-available": "{{ nbOfGames }} jeux disponibles", - "helpBoard": "<0><0>Déplacez le plateau en cliquant avec le bouton du milieu de la souris. vous pouvez également utiliser le bouton gauche tout en maintenant la touche Alt de votre clavier.<1>Utilisez la molette pour zoomer.<2>Basculer en mode édition avec le bouton dédié afin d'éditer les éléments du jeu.<3>Vous pouvez enregistrer et charger vos parties en ouvrant le menu.<4>Utilisez <5>Ctrl + <5>1…<5>9 pour enregistrer une position et <5>1…<5>9 la restaurer.<4>Pressez <5>espace pour zoomer temporairement.", + "helpBoard": "<0><0>Déplacez le plateau en cliquant avec le bouton de gauche de la souris. vous pouvez également utiliser le bouton de droite tout en maintenant la touche Alt de votre clavier.<1>Utilisez la molette pour zoomer.<2>Basculer en mode édition avec le bouton dans la barre en bas de l'écran afin d'éditer les éléments du jeu.<3>Vous pouvez enregistrer et charger vos parties en ouvrant le menu.<4>Utilisez <5>Ctrl + <5>1…<5>9 pour enregistrer une position et <5>1…<5>9 la restaurer.<4>Pressez <5>espace pour zoomer temporairement.", "helpItem": "<0><0>Double cliquez sur un élément pour exécuter son action principale.<1>Cliquez longuement sur un élément afin de le déverrouiller<2>Découvrez les autres raccourcis dans le menu d'actions.", "items": "Un élément", "items_plural": "{{count}} éléments", @@ -355,5 +355,6 @@ "Die": "Dé", "Image die": "Dé image", "Include files": "Inclure les fichiers", - "An error occurred. Try again!": "Une erreur est survenue. Veuillez réessayer !" + "An error occurred. Try again!": "Une erreur est survenue. Veuillez réessayer !", + "Rotate board": "Tourner le plateau" } diff --git a/src/views/BoardView/NavBar.jsx b/src/views/BoardView/NavBar.jsx index c1ab0695..9272a73a 100644 --- a/src/views/BoardView/NavBar.jsx +++ b/src/views/BoardView/NavBar.jsx @@ -13,9 +13,12 @@ import { FiMousePointer, FiHome, FiMaximize, + FiRotateCw, } from "react-icons/fi"; import { GiPokerHand } from "react-icons/gi"; +import { useBoardPosition } from "react-sync-board"; + import BoardForm from "./BoardForm"; import SessionForm from "./SessionForm"; import NavButton from "../../ui/NavButton"; @@ -46,6 +49,8 @@ const NavBar = ({ editMode, itemLibraries, moveFirst, setMoveFirst }) => { const { t } = useTranslation(); const { isVassalSession } = useSession(); + const { rotateBoard } = useBoardPosition(); + const { toggleFullScreen, active: isFullScreen } = useFullScreen(); const { isSpaceMaster: isMaster } = useUsers(); @@ -173,6 +178,12 @@ const NavBar = ({ editMode, itemLibraries, moveFirst, setMoveFirst }) => { Icon={moveFirst ? FiMove : FiMousePointer} /> + rotateBoard((prev) => prev + 90)} + alt={t("Rotate board")} + title={t("Rotate board")} + />