add tools

This commit is contained in:
sebvtl728 2025-11-02 21:36:00 +01:00
parent f242bcc5d6
commit 5909871dec
5 changed files with 129 additions and 31 deletions

View File

@ -7,6 +7,7 @@ import React, {
} from "react";
import { PDFDocument, StandardFonts } from "pdf-lib";
import { useNavigate } from "react-router-dom";
import { getToken } from "../../auth";
import "../Admin/Bilans.css";
const LOGO_URL =
@ -326,6 +327,14 @@ const Bilan = () => {
const [isAiLoading, setIsAiLoading] = useState(false);
const [dragOverBucket, setDragOverBucket] = useState(null);
const draggingIdRef = useRef(null);
const navigate = useNavigate();
const token = getToken();
useEffect(() => {
if (!token) {
navigate("/admin/login");
}
}, [token, navigate]);
useEffect(() => {
setItems(buildItemsFromDefaults(currentCp));
@ -915,7 +924,6 @@ ${notesFormateur}`,
}, [currentCp, firstName, lastName, observation, showStatus]);
const currentTitle = titles[currentCp] || { h1: "", h2: "" };
const navigate = useNavigate();
return (
<div className="bilan-wrapper">

View File

@ -14,6 +14,7 @@ import LogoutIcon from "@mui/icons-material/Logout"; // Icône de déconnexion
import ArticleIcon from "@mui/icons-material/Article";
import DashboardIcon from "@mui/icons-material/Dashboard";
import HomeIcon from "@mui/icons-material/Home"; // Icône pour la gestion page d'accueil
import BuildIcon from "@mui/icons-material/Build";
function Dashboard() {
const navigate = useNavigate();
@ -111,6 +112,35 @@ function Dashboard() {
</CardContent>
</Card>
</Grid>
<Grid item xs={12} sm={6}>
<Card
onClick={() => navigate("/admin/tools")}
sx={{
cursor: "pointer",
textAlign: "center",
padding: 2,
transition: "0.3s",
"&:hover": {
backgroundColor: "#0e467f",
color: "#ffffff",
transform: "scale(1.05)",
boxShadow: 8,
},
"&:hover svg": {
fill: "#ffffff",
},
}}
>
<CardContent>
<IconButton sx={{ fontSize: 40, color: "#0e467f" }}>
<BuildIcon fontSize="inherit" />
</IconButton>
<Typography variant="h6" sx={{ fontWeight: "bold" }}>
Tools
</Typography>
</CardContent>
</Card>
</Grid>
{/* ✅ Gérer les Articles - Deuxième carte */}
<Grid item xs={12} sm={6}>
@ -235,35 +265,6 @@ function Dashboard() {
</Card>
</Grid>
{/* ✅ Gérer les Cours - Nouvelle carte */}
<Grid item xs={12} sm={6}>
<Card
onClick={() => navigate("/admin/bilans")}
sx={{
cursor: "pointer",
textAlign: "center",
padding: 2,
transition: "0.3s",
"&:hover": {
backgroundColor: "#0e467f",
color: "#ffffff",
transform: "scale(1.05)",
boxShadow: 8,
},
"&:hover svg": {
fill: "#ffffff",
},
}}
>
<CardContent>
<IconButton sx={{ fontSize: 40, color: "#0e467f" }}>
<DashboardIcon fontSize="inherit" />
</IconButton>
<Typography variant="h6" sx={{ fontWeight: "bold" }}>
Bilans
</Typography>
</CardContent>
</Card>
</Grid>
</Grid>
</Box>
</Box>

View File

@ -0,0 +1,87 @@
import { useEffect } from "react";
import { Box, Typography, Grid, Card, CardContent, Button } from "@mui/material";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import { useNavigate } from "react-router-dom";
import { getToken } from "../../auth";
const toolsApps = [
{
id: "app-reseau",
name: "App Réseau",
description: "Application React dédiée à la gestion du réseau.",
url: "/app-reseaux/index.html?access-token=OCTO-ADMIN-2024",
external: true,
},
{
id: "bilans",
name: "Bilans",
description: "Module de suivi et génération des bilans.",
url: "/admin/bilans",
external: false,
},
{
id: "generateur-photo",
name: "Generateur Photos",
description: "Application de génération d'image.",
url: "/app-photos/index.html?access-token=OCTO-ADMIN-2024",
external: true,
},
];
function Tools() {
const navigate = useNavigate();
const token = getToken();
useEffect(() => {
if (!token) {
navigate("/admin/login");
}
}, [token, navigate]);
const handleOpenApp = (app) => {
if (app.external) {
window.open(app.url, "_blank", "noopener");
return;
}
navigate(app.url);
};
return (
<Box sx={{ minHeight: "100vh", p: 9 }}>
<Box sx={{ display: "flex", alignItems: "center", mb: 3 }}>
<Button
startIcon={<ArrowBackIcon />}
onClick={() => navigate("/admin/dashboard")}
sx={{ mr: 2 }}
>
Retour au dashboard
</Button>
<Typography variant="h4" sx={{ fontWeight: "bold" }}>
Mes applications
</Typography>
</Box>
<Grid container spacing={4}>
{toolsApps.map((app) => (
<Grid item xs={12} sm={6} md={4} key={app.id}>
<Card sx={{ height: "100%", display: "flex", flexDirection: "column" }}>
<CardContent>
<Typography variant="h6">{app.name}</Typography>
<Typography variant="body2" color="text.secondary">
{app.description}
</Typography>
<Box sx={{ mt: 2 }}>
<Button variant="contained" color="primary" onClick={() => handleOpenApp(app)}>
Ouvrir
</Button>
</Box>
</CardContent>
</Card>
</Grid>
))}
</Grid>
</Box>
);
}
export default Tools;

View File

@ -12,6 +12,7 @@ import GestionPageAccueil from "./components/Pages/GestionPageAccueil";
import GestionPagesACF from "./components/GestionPagesACF";
import GestionBureauEtudeACF from "./components/GestionBureauEtudeACF";
import EditPageACF from "./components/Pages/EditPageACF";
import Tools from "./components/Pages/Tools";
// Ajoutez les autres pages Admin
import GestionCours from "./components/Admin/GestionCours";
@ -84,6 +85,7 @@ function YourApp() {
<Route path="/admin/liste-cours" element={<ListeCours />} />
<Route path="/cours/lecture/:token" element={<CoursLecture />} />
<Route path="/admin/bilans" element={<Bilans/>} />
<Route path="/admin/tools" element={<Tools />} />
</Routes>
<Footer />
</Router>

File diff suppressed because one or more lines are too long