Commit 0c5052f5 authored by timel's avatar timel

refactor: remove unused components and pages

parent e8ac3d50
Pipeline #22959 failed with stages
in 12 minutes and 56 seconds
......@@ -7,7 +7,7 @@ import { fetchCard, ygopro } from "@/api";
import { useConfig } from "@/config";
import { sleep } from "@/infra";
import { cardStore, CardType, matStore } from "@/stores";
import { replayStart } from "@/ui/NewMatch/ReplayModal";
import { replayStart } from "@/ui/Match/ReplayModal";
const TOKEN_SIZE = 13; // 每人场上最多就只可能有13个token
export default async (start: ygopro.StocGameMessage.MsgStart) => {
......
import { createBrowserRouter, RouterProvider } from "react-router-dom";
// TODO: finish this
const _router = createBrowserRouter([
const router = createBrowserRouter([
{
path: "/",
lazy: () => import("./Layout"),
......@@ -11,8 +10,8 @@ const _router = createBrowserRouter([
lazy: () => import("./Start"),
},
{
path: "/match/*",
lazy: () => import("./NewMatch"),
path: "/match",
lazy: () => import("./Match"),
},
{
path: "/build",
......@@ -20,11 +19,11 @@ const _router = createBrowserRouter([
},
{
path: "/profile",
lazy: () => import("./NewProfile"),
lazy: () => import("./Profile"),
},
{
path: "/waitroom",
lazy: () => import("./NewWaitRoom"),
lazy: () => import("./WaitRoom"),
},
{
path: "/duel/:ip/:player/:passWd",
......@@ -34,4 +33,4 @@ const _router = createBrowserRouter([
},
]);
export const NeosRouter = () => <RouterProvider router={_router} />;
export const NeosRouter = () => <RouterProvider router={router} />;
export const Component = () => <>profile</>;
Component.displayName = "Build";
.account-header {
position: relative;
z-index: 200;
border-bottom: 1px solid rgba(150, 150, 150, 0.2);
width: 100%;
height: 0;
.header-user {
position: absolute;
right: 2%;
top: 0;
display: flex;
align-items: center;
img {
margin: 0 0.5rem;
}
.header-user-btn {
color: #c9cbd0;
}
.sep {
margin: 0 0.8rem;
}
}
}
.container {
position: relative;
display: flex;
width: 100%;
height: calc(100vh - 48px);
align-items: center;
.bg {
width: 100%;
height: 100%;
background: url(/neos-assets/home-background.png);
background-size: cover;
opacity: 0.2;
}
.box {
position: absolute;
display: flex;
flex-direction: column;
width: 500px;
height: 500px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: #333b51;
opacity: 0.8;
border-radius: 1.2em;
box-shadow: 0 2px 10px -5px rgba(9, 2, 4, 0.8);
align-items: center;
p {
font-size: 2em;
}
button {
font-size: 1.2em;
width: 350px;
height: 45px;
margin: 0.5em;
background-color: #2c2c2c;
border-width: 0.3em;
border-image: url(/neos-assets/border.webp) 10;
color: white;
}
button:hover {
background-color: #393983;
}
button:active {
background-color: #9d3939;
}
}
}
import React, { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useSnapshot } from "valtio";
// import { match } from "@/api";
import { useConfig } from "@/config";
import { accountStore } from "@/stores";
import styles from "./index.module.scss";
const NeosConfig = useConfig();
const DefaultUserName = "Guest";
export const Component: React.FC = () => {
const { user } = useSnapshot(accountStore);
const navigate = useNavigate();
const onLogout = () => {}; // TODO
const onMatchAI = () => {
const username = accountStore.user?.username ?? DefaultUserName;
navigate(
`/room/${username}/${encodeURIComponent("AI")}/${
NeosConfig.servers[0].ip
}:${NeosConfig.servers[0].port}`
);
};
const onEntertainMatch = async () => {
// if (user) {
// const matchInfo = await match(user.username, user.external_id);
// if (matchInfo) {
// navigate(
// `/room/${user.username}/${encodeURIComponent(matchInfo.password)}/${
// matchInfo.address
// }:${matchInfo.port}`
// );
// } else {
// alert("匹配失败");
// }
// } else {
// alert("请先登录萌卡账号");
// }
// TODO: 这部分需要修改后端逻辑,改完后端后再来补充这里
alert("暂不支持,敬请期待");
};
useEffect(() => {
if (!user) {
// 跳转SSO界面进行登录
navigate("/sso");
}
}, [user]);
return (
<>
<div className={styles["account-header"]}>
<div className={styles["header-user"]}>
<img
src={
user?.avatar_url ?? `${NeosConfig.assetsPath}/default-avatar.png`
}
alt={user?.username}
height={40}
/>
<a className={styles["header-user-btn"]} href={NeosConfig.profileUrl}>
个人中心
</a>
<span className={styles.sep}>|</span>
<a className={styles["header-user-btn"]} href="" onClick={onLogout}>
登出
</a>
</div>
</div>
<div className={styles.container}>
<div className={styles.bg}></div>
<div className={styles.box}>
<p>欢迎来到NEOS,{user?.username}</p>
<button onClick={onEntertainMatch}>娱乐匹配</button>
<button onClick={() => alert("暂不支持,敬请期待")}>竞技匹配</button>
<button onClick={() => navigate("/match")}>自定义匹配</button>
<button onClick={onMatchAI}>人机对战</button>
<button onClick={() => navigate("/replay")}>录像回放</button>
<button onClick={() => alert("暂不支持,敬请期待")}>卡组编辑</button>
</div>
</div>
</>
);
};
Component.displayName = "Profile";
export const Component = () => <>profile</>;
Component.displayName = "Build";
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