From ae0f61cda934af87e5ce7a6accaf1b69f07eb826 Mon Sep 17 00:00:00 2001 From: Allen <49468724+Allenyzh@users.noreply.github.com> Date: Sun, 2 Feb 2025 15:29:04 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.jsx | 49 +++++------------------------------------- src/Router.jsx | 22 +++++++++++++++++++ src/pages/ChatPage.jsx | 22 +++++++++++-------- 3 files changed, 40 insertions(+), 53 deletions(-) create mode 100644 src/Router.jsx diff --git a/src/App.jsx b/src/App.jsx index a057b2b..a90a5a9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,51 +1,12 @@ import "./App.css"; -import Messages from "./components/Messages"; -import ChatPage from "./pages/ChatPage"; -import AdminPage from "./pages/admin"; -import Scenario from "../src/pages/Scenarios"; -import ScenarioForm from "./pages/admin/ScenarioForm"; -import { BrowserRouter, Routes, Route } from "react-router"; + +import Router from "./Router"; function App() { return ( - - - - - - } - /> - - - - } - > - } /> - - - - - } - /> - - - - } - /> - - +
+ +
); } diff --git a/src/Router.jsx b/src/Router.jsx new file mode 100644 index 0000000..41e1346 --- /dev/null +++ b/src/Router.jsx @@ -0,0 +1,22 @@ +import { BrowserRouter, Routes, Route } from "react-router"; +import Scenarios from "./pages/Scenarios"; +import ChatPage from "./pages/ChatPage"; +// import Messages from "./components/Messages"; +import AdminPage from "./pages/admin"; +import ScenarioForm from "./pages/admin/ScenarioForm"; + +export default function Router() { + return ( + + + } /> + + } /> + + + } /> + } /> + + + ); +} diff --git a/src/pages/ChatPage.jsx b/src/pages/ChatPage.jsx index d924f1e..e8e42ed 100644 --- a/src/pages/ChatPage.jsx +++ b/src/pages/ChatPage.jsx @@ -68,15 +68,19 @@ export default function ChatPage() {

MTLove Score: {score}

- - - - + +
+ + + + Home + +
From dc659030226e4386e79856c96631872c3636f32c Mon Sep 17 00:00:00 2001 From: Allenyzh Date: Sun, 2 Feb 2025 21:38:27 -0500 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复移动端布局异常 - 修复游戏结束后点击exit再点击对话界面,仍显示之前游戏状态的错误 --- src/App.jsx | 6 +--- src/components/GameOver.jsx | 12 ++++++++ src/components/Messages.jsx | 11 ++++--- src/components/Win.jsx | 10 +++++++ src/pages/ChatPage.jsx | 16 +++++----- src/store/store.js | 58 +++++++++++++++++++++---------------- vite.config.js | 9 ++++-- 7 files changed, 76 insertions(+), 46 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index a90a5a9..4cde4ef 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3,11 +3,7 @@ import "./App.css"; import Router from "./Router"; function App() { - return ( -
- -
- ); + return ; } export default App; diff --git a/src/components/GameOver.jsx b/src/components/GameOver.jsx index 0d60e92..d04b1dc 100644 --- a/src/components/GameOver.jsx +++ b/src/components/GameOver.jsx @@ -1,9 +1,13 @@ /* eslint-disable react/prop-types */ import { useState, useEffect } from "react"; import { Link } from "react-router"; +import { useStore } from "../store/store"; export default function GameOver({ score, onRestart }) { const [visible, setVisible] = useState(false); + const { messages, resetGame } = useStore(); + + console.log(messages); useEffect(() => { setTimeout(() => setVisible(true), 500); @@ -20,6 +24,13 @@ export default function GameOver({ score, onRestart }) { Your Score: {score}

+

+ The last word is: + + {messages[messages.length - 1].content} + +

+
- + Home
-
+
-
+