From c33e8f26781d3fb4e3c7d17362218e7d82bf99d2 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 6 Sep 2025 07:10:14 +0000 Subject: [PATCH] Modifica visualizzazione statistiche/elenco modelli --- frontend/src/ChatLayout.jsx | 6 +- frontend/src/ModelOverview.jsx | 124 +++++++++++++++++++-------------- 2 files changed, 71 insertions(+), 59 deletions(-) diff --git a/frontend/src/ChatLayout.jsx b/frontend/src/ChatLayout.jsx index 60a271b..805db2a 100644 --- a/frontend/src/ChatLayout.jsx +++ b/frontend/src/ChatLayout.jsx @@ -6,7 +6,6 @@ import ChatInput from "./ChatInput"; import SessionTable from "./SessionTable"; import NoSessionBox from "./NoSessionBox"; import ModelOverview from "./ModelOverview"; -import LmStats from "./LmStats"; export default function ChatLayout({ theme, @@ -76,10 +75,7 @@ export default function ChatLayout({
{showModelPage ? ( -
- - setShowModelPage(false)} /> -
+ setShowModelPage(false)} /> ) : ( /* AREA SCROLLABILE */ diff --git a/frontend/src/ModelOverview.jsx b/frontend/src/ModelOverview.jsx index 9728c8d..7aaade1 100644 --- a/frontend/src/ModelOverview.jsx +++ b/frontend/src/ModelOverview.jsx @@ -1,12 +1,14 @@ // src/ModelOverview.jsx import React, { useEffect, useState } from "react"; +import LmStats from "./LmStats"; export default function ModelOverview({ onBackToChat }) { const [defaultModel, setDefaultModel] = useState(""); const [modelInfo, setModelInfo] = useState([]); const [searchTerm, setSearchTerm] = useState(""); const [loading, setLoading] = useState(false); + const [showStats, setShowStats] = useState(false); // 👈 nuovo stato toggle const fetchModelData = async () => { setLoading(true); @@ -58,63 +60,77 @@ export default function ModelOverview({ onBackToChat }) {

-
- - +
+
+ + +
+
+ +
-
- setSearchTerm(e.target.value)} - /> -
+ {showStats ? ( + + ) : ( + <> +
+ setSearchTerm(e.target.value)} + /> +
-
- - - - - - {/**/} - - - - - {loading && ( - - - - )} - {!loading && filteredModels.length === 0 && ( - - - - )} - {!loading && filteredModels.map((model) => ( - - - - {/**/} - - - ))} - -
NomeDescrizioneAnnoCaratteristiche
Caricamento…
Nessun modello trovato
{model.name}{model.description || "—"}{model.year || "—"} -
    - {Array.isArray(model.features) && model.features.length > 0 - ? model.features.map((f, i) =>
  • {f}
  • ) - :
  • } -
-
-
+
+ + + + + + + + + + {loading && ( + + + + )} + {!loading && filteredModels.length === 0 && ( + + + + )} + {!loading && filteredModels.map((model) => ( + + + + + + ))} + +
NomeDescrizioneCaratteristiche
Caricamento…
Nessun modello trovato
{model.name}{model.description || "—"} +
    + {Array.isArray(model.features) && model.features.length > 0 + ? model.features.map((f, i) =>
  • {f}
  • ) + :
  • } +
+
+
+ + )}
); }