Commit 7f602b1c authored by Chunchi Che's avatar Chunchi Che

handle matchAI

parent 91ea1bf9
Pipeline #22819 passed with stages
in 14 minutes and 38 seconds
......@@ -8,12 +8,21 @@ import { accountStore } from "@/stores";
import styles from "./index.module.scss";
const NeosConfig = useConfig();
const DefaultUserName = "Guest";
const Home: React.FC = () => {
const { user } = useSnapshot(accountStore);
const navigate = useNavigate();
const onLogout = () => {}; // TODO
const onMatchAI = () => {
const username = user?.username ?? DefaultUserName;
navigate(
`/room/${username}/${encodeURIComponent("AI")}/${
NeosConfig.servers[0].ip
}:${NeosConfig.servers[0].port}`
);
};
useEffect(() => {
if (!user) {
......@@ -57,8 +66,8 @@ const Home: React.FC = () => {
<button>娱乐匹配</button>
<button>竞技匹配</button>
<button onClick={() => navigate("/match")}>自定义匹配</button>
<button>人机对战</button>
<button>录像回放</button>
<button onClick={onMatchAI}>人机对战</button>
<button onClick={() => navigate("/replay")}>录像回放</button>
<button>卡组编辑</button>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment