|
|
|
@ -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)}
|
|
|
|
|
</td>
|
|
|
|
@ -221,7 +223,7 @@ function Team({ teams }: { teams: Team[] }) {
|
|
|
|
|
<div id="teams">
|
|
|
|
|
<div className="titre-side-menu">
|
|
|
|
|
<h2 className="title">Mes équipes</h2>
|
|
|
|
|
<button className="new" onClick={() => navigate("/team/new")}>
|
|
|
|
|
<button className="new" onClick={() => startTransition(() => navigate("/team/new"))}>
|
|
|
|
|
+
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
@ -240,7 +242,7 @@ function Tactic({ lastTactics }: { lastTactics: Tactic[] }) {
|
|
|
|
|
<button
|
|
|
|
|
className="new"
|
|
|
|
|
id="create-tactic"
|
|
|
|
|
onClick={() => navigate("/tactic/new")}>
|
|
|
|
|
onClick={() => startTransition(() => navigate("/tactic/new"))}>
|
|
|
|
|
+
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
@ -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}
|
|
|
|
|
</div>
|
|
|
|
@ -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}
|
|
|
|
|
</div>
|
|
|
|
|