Commit 23b803a0 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'fix/duel_end_v2' into 'main'

Fix/duel end v2

See merge request !398
parents 17edc027 e633a532
Pipeline #28721 passed with stages
in 13 minutes and 1 second
...@@ -84,4 +84,8 @@ export class WebSocketStream { ...@@ -84,4 +84,8 @@ export class WebSocketStream {
close() { close() {
this.ws.close(); this.ws.close();
} }
isClosed(): boolean {
return this.ws.readyState === WebSocket.CLOSED;
}
} }
...@@ -127,7 +127,7 @@ export const DeckDatabase: React.FC = () => { ...@@ -127,7 +127,7 @@ export const DeckDatabase: React.FC = () => {
<Space className={styles.title} direction="horizontal"> <Space className={styles.title} direction="horizontal">
<Input <Input
placeholder={i18n("KeywordsPlaceholder")} placeholder={i18n("KeywordsPlaceholder")}
bordered={false} variant="borderless"
suffix={ suffix={
<Button <Button
type="text" type="text"
......
...@@ -74,7 +74,7 @@ export const AnnounceModal: React.FC = () => { ...@@ -74,7 +74,7 @@ export const AnnounceModal: React.FC = () => {
<Input <Input
className={styles.input} className={styles.input}
placeholder="请输入宣言卡名(或关键字)" placeholder="请输入宣言卡名(或关键字)"
bordered={false} variant="borderless"
value={searchWord} value={searchWord}
onChange={(e) => setSearchWord(e.target.value)} onChange={(e) => setSearchWord(e.target.value)}
suffix={ suffix={
......
import { App } from "antd";
import React, { CSSProperties } from "react"; import React, { CSSProperties } from "react";
import { useNavigate } from "react-router-dom";
import { proxy, useSnapshot } from "valtio"; import { proxy, useSnapshot } from "valtio";
import { fetchStrings, Region } from "@/api"; import { fetchStrings, Region } from "@/api";
import { getUIContainer } from "@/container/compat";
import { replayStore, resetDuel } from "@/stores"; import { replayStore, resetDuel } from "@/stores";
import { NeosModal } from "../NeosModal"; import { NeosModal } from "../NeosModal";
...@@ -21,12 +24,21 @@ const defaultProps: EndProps = { ...@@ -21,12 +24,21 @@ const defaultProps: EndProps = {
const localStore = proxy(defaultProps); const localStore = proxy(defaultProps);
export const EndModal: React.FC = () => { export const EndModal: React.FC = () => {
const container = getUIContainer();
const { message } = App.useApp();
const { isOpen, isWin, reason } = useSnapshot(localStore); const { isOpen, isWin, reason } = useSnapshot(localStore);
const { isReplay } = useSnapshot(replayStore); const { isReplay } = useSnapshot(replayStore);
const navigate = useNavigate();
const onReturn = () => { const onReturn = () => {
resetDuel(); resetDuel();
rs(); rs();
if (container.conn.isClosed()) {
message.info("服务器关闭了连接,返回匹配页。");
navigate("/match");
}
}; };
return ( return (
......
...@@ -39,7 +39,7 @@ export const ChatBox: React.FC = () => { ...@@ -39,7 +39,7 @@ export const ChatBox: React.FC = () => {
</ScrollableArea> </ScrollableArea>
<div className={styles.input}> <div className={styles.input}>
<Input.TextArea <Input.TextArea
bordered={false} variant="borderless"
value={input} value={input}
onChange={(event) => setInput(event.target.value)} onChange={(event) => setInput(event.target.value)}
autoSize autoSize
......
...@@ -28,6 +28,7 @@ import { ...@@ -28,6 +28,7 @@ import {
import { useConfig } from "@/config"; import { useConfig } from "@/config";
import { accountStore } from "@/stores"; import { accountStore } from "@/stores";
import { setCssProperties } from "../Duel/PlayMat/css";
import { Setting } from "../Setting"; import { Setting } from "../Setting";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
import { import {
...@@ -40,7 +41,6 @@ import { ...@@ -40,7 +41,6 @@ import {
initSuper, initSuper,
initWASM, initWASM,
} from "./utils"; } from "./utils";
import { setCssProperties } from "../Duel/PlayMat/css";
const NeosConfig = useConfig(); const NeosConfig = useConfig();
......
...@@ -23,7 +23,7 @@ export const Chat: React.FC = () => { ...@@ -23,7 +23,7 @@ export const Chat: React.FC = () => {
</ScrollableArea> </ScrollableArea>
<div className={styles.input}> <div className={styles.input}>
<Input.TextArea <Input.TextArea
bordered={false} variant="borderless"
value={input} value={input}
onChange={(event) => setInput(event.target.value)} onChange={(event) => setInput(event.target.value)}
autoSize autoSize
......
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