Commit a3617792 authored by Chunchi Che's avatar Chunchi Che

rename something

parent 04548ae3
Pipeline #23642 passed with stages
in 15 minutes and 54 seconds
...@@ -34,8 +34,8 @@ interface Options { ...@@ -34,8 +34,8 @@ interface Options {
} }
export const WatchContent: React.FC<{ export const WatchContent: React.FC<{
setWatchPasswd: React.Dispatch<React.SetStateAction<string | undefined>>; setWatchID: React.Dispatch<React.SetStateAction<string | undefined>>;
}> = ({ setWatchPasswd }) => { }> = ({ setWatchID }) => {
const [rooms, setRooms] = useState<Room[]>([]); const [rooms, setRooms] = useState<Room[]>([]);
const { message } = App.useApp(); const { message } = App.useApp();
const url = new URL(athleticWatchUrl); const url = new URL(athleticWatchUrl);
...@@ -101,7 +101,7 @@ export const WatchContent: React.FC<{ ...@@ -101,7 +101,7 @@ export const WatchContent: React.FC<{
}} }}
dataSource={rooms} dataSource={rooms}
renderItem={(room) => ( renderItem={(room) => (
<List.Item key={room.id} onClick={() => setWatchPasswd(room.id)}> <List.Item key={room.id} onClick={() => setWatchID(room.id)}>
<List.Item.Meta <List.Item.Meta
avatar={ avatar={
<Avatar <Avatar
......
...@@ -18,7 +18,7 @@ import styles from "./index.module.scss"; ...@@ -18,7 +18,7 @@ import styles from "./index.module.scss";
import { MatchModal, matchStore } from "./MatchModal"; import { MatchModal, matchStore } from "./MatchModal";
import { ReplayModal, replayOpen } from "./ReplayModal"; import { ReplayModal, replayOpen } from "./ReplayModal";
import { connectSrvpro } from "./util"; import { connectSrvpro } from "./util";
import { WatchContent } from "./WatchModal"; import { WatchContent } from "./WatchContent";
const { servers: serverList } = useConfig(); const { servers: serverList } = useConfig();
...@@ -38,7 +38,7 @@ export const Component: React.FC = () => { ...@@ -38,7 +38,7 @@ export const Component: React.FC = () => {
const [singleLoading, setSingleLoading] = useState(false); // 单人模式的loading状态 const [singleLoading, setSingleLoading] = useState(false); // 单人模式的loading状态
const [matchLoading, setMatchLoading] = useState(false); // 匹配模式的loading状态 const [matchLoading, setMatchLoading] = useState(false); // 匹配模式的loading状态
const [watchLoading, setWatchLoading] = useState(false); // 观战模式的loading状态 const [watchLoading, setWatchLoading] = useState(false); // 观战模式的loading状态
const [watchPasswd, setWatchPasswd] = useState<string | undefined>(undefined); const [watchID, setWatchID] = useState<string | undefined>(undefined);
const navigate = useNavigate(); const navigate = useNavigate();
// 竞技匹配 // 竞技匹配
...@@ -73,7 +73,7 @@ export const Component: React.FC = () => { ...@@ -73,7 +73,7 @@ export const Component: React.FC = () => {
icon: null, icon: null,
okText: "进入观战", okText: "进入观战",
onOk: async () => { onOk: async () => {
if (watchPasswd) { if (watchID) {
setWatchLoading(true); setWatchLoading(true);
const mcServer = serverList.find( const mcServer = serverList.find(
...@@ -83,7 +83,7 @@ export const Component: React.FC = () => { ...@@ -83,7 +83,7 @@ export const Component: React.FC = () => {
await connectSrvpro({ await connectSrvpro({
ip: mcServer.ip + ":" + mcServer.port, ip: mcServer.ip + ":" + mcServer.port,
player: user.username, player: user.username,
passWd: watchPasswd, passWd: watchID,
}); });
} else { } else {
message.error( message.error(
...@@ -96,7 +96,7 @@ export const Component: React.FC = () => { ...@@ -96,7 +96,7 @@ export const Component: React.FC = () => {
}, },
centered: true, centered: true,
maskClosable: true, maskClosable: true,
content: <WatchContent setWatchPasswd={setWatchPasswd} />, content: <WatchContent setWatchID={setWatchID} />,
}); });
} }
}; };
......
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