From defd53c9bcb8db3c461c44fb9a51503c8dd06f77 Mon Sep 17 00:00:00 2001 From: maxime Date: Wed, 21 Feb 2024 17:31:20 +0100 Subject: [PATCH] fix redirections --- src/index.css | 2 -- src/pages/Editor.tsx | 10 +++---- src/pages/HomePage.tsx | 50 ++++++++++++++++++++--------------- src/pages/LoginPage.tsx | 5 ++-- src/pages/NewTacticPage.tsx | 4 +-- src/pages/RegisterPage.tsx | 8 +++++- src/pages/template/Header.tsx | 8 +++--- src/style/form.css | 4 +-- src/style/template/header.css | 6 ++--- src/style/title_input.css | 2 ++ 10 files changed, 57 insertions(+), 42 deletions(-) diff --git a/src/index.css b/src/index.css index d7d83a6..0e1eb7b 100644 --- a/src/index.css +++ b/src/index.css @@ -3,8 +3,6 @@ line-height: 1.5; font-weight: 400; - color-scheme: light dark; - font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; diff --git a/src/pages/Editor.tsx b/src/pages/Editor.tsx index 11df02c..1a1e177 100644 --- a/src/pages/Editor.tsx +++ b/src/pages/Editor.tsx @@ -2,7 +2,7 @@ import { CSSProperties, Dispatch, RefObject, - SetStateAction, + SetStateAction, startTransition, useCallback, useEffect, useMemo, @@ -196,9 +196,9 @@ function Editor({ id, name, courtType, content }: EditorProps) { { content }, "PUT", ) - if (response.status == 401) { + if (response.status == 401) startTransition(() => { navigate("/login") - } + }) return response.ok ? SaveStates.Ok : SaveStates.Err }} onNameChange={async (name: string) => { @@ -212,9 +212,9 @@ function Editor({ id, name, courtType, content }: EditorProps) { { name }, "PUT", ) - if (response.status == 401) { + if (response.status == 401) startTransition(() => { navigate("/login") - } + }) return response.ok }} /> diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx index 1ec9647..8579e19 100644 --- a/src/pages/HomePage.tsx +++ b/src/pages/HomePage.tsx @@ -1,7 +1,7 @@ import "../style/home/home.css" import { getSession } from "../api/session.ts" import { useNavigate } from "react-router-dom" -import { startTransition, useLayoutEffect, useState } from "react" +import { startTransition, useEffect, useState } from "react" import { User } from "../model/User.ts" import { fetchAPIGet } from "../Fetcher.ts" @@ -28,7 +28,7 @@ export default function HomePage() { const navigate = useNavigate() - useLayoutEffect(() => { + useEffect(() => { const session = getSession() if (!session.auth) { @@ -59,10 +59,10 @@ export default function HomePage() { } function Home({ - lastTactics, - allTactics, - teams, -}: { + lastTactics, + allTactics, + teams, + }: { lastTactics: Tactic[] allTactics: Tactic[] teams: Team[] @@ -79,10 +79,10 @@ function Home({ } function Body({ - lastTactics, - allTactics, - teams, -}: { + lastTactics, + allTactics, + teams, + }: { lastTactics: Tactic[] allTactics: Tactic[] teams: Team[] @@ -102,10 +102,10 @@ function Body({ } function SideMenu({ - width, - lastTactics, - teams, -}: { + width, + lastTactics, + teams, + }: { width: number lastTactics: Tactic[] teams: Team[] @@ -125,9 +125,9 @@ function SideMenu({ } function PersonalSpace({ - width, - allTactics, -}: { + width, + allTactics, + }: { width: number allTactics: Tactic[] }) { @@ -177,7 +177,9 @@ function TableData({ allTactics }: { allTactics: Tactic[] }) { key={tactic.id} className="data" onClick={() => { - navigate("/tactic/" + tactic.id + "/edit") + startTransition(() => { + navigate("/tactic/" + tactic.id + "/edit") + }) }}> {truncateString(tactic.name, 25)} @@ -221,7 +223,7 @@ function Team({ teams }: { teams: Team[] }) {

Mes équipes

-
@@ -240,7 +242,7 @@ function Tactic({ lastTactics }: { lastTactics: Tactic[] }) {
@@ -273,7 +275,9 @@ function ButtonTeam({ team }: { team: Team }) { id={"button-team" + team.id} className="button-side-menu data" onClick={() => { - navigate("/team/" + team.id) + startTransition(() => { + navigate("/team/" + team.id) + }) }}> {name} @@ -290,7 +294,9 @@ function ButtonLastTactic({ tactic }: { tactic: Tactic }) { id={"button" + tactic.id} className="button-side-menu data" onClick={() => { - navigate("/tactic/" + tactic.id + "/edit") + startTransition(() => { + navigate("/tactic/" + tactic.id + "/edit") + }) }}> {name} diff --git a/src/pages/LoginPage.tsx b/src/pages/LoginPage.tsx index ae83a9b..1314d7d 100644 --- a/src/pages/LoginPage.tsx +++ b/src/pages/LoginPage.tsx @@ -85,17 +85,18 @@ export default function LoginApp() {
- + - + Vous n'avez pas de compte ?
diff --git a/src/pages/NewTacticPage.tsx b/src/pages/NewTacticPage.tsx index c390f0e..149f6e8 100644 --- a/src/pages/NewTacticPage.tsx +++ b/src/pages/NewTacticPage.tsx @@ -66,11 +66,11 @@ function CourtKindButton({ "POST", ) - if (response.status === 401) { + if (response.status === 401) startTransition(() => { // if unauthorized navigate("/login") return - } + }) const { id } = await response.json() startTransition(() => { diff --git a/src/pages/RegisterPage.tsx b/src/pages/RegisterPage.tsx index baffa09..1c6eb40 100644 --- a/src/pages/RegisterPage.tsx +++ b/src/pages/RegisterPage.tsx @@ -95,6 +95,7 @@ export default function RegisterPage() { Mot de passe : Email :