Commit d0b02466 authored by Chunchi Che's avatar Chunchi Che

add friendPrivateID

parent 165026cc
...@@ -13,6 +13,7 @@ import styles from "./index.module.scss"; ...@@ -13,6 +13,7 @@ import styles from "./index.module.scss";
interface CustomRoomProps { interface CustomRoomProps {
options: Options; options: Options;
isPrivate: boolean; isPrivate: boolean;
friendPrivateID?: number;
} }
const defaultProps: CustomRoomProps = { const defaultProps: CustomRoomProps = {
...@@ -25,7 +26,7 @@ export const mcCustomRoomStore = proxy<CustomRoomProps>(defaultProps); ...@@ -25,7 +26,7 @@ export const mcCustomRoomStore = proxy<CustomRoomProps>(defaultProps);
export const CustomRoomContent: React.FC = () => { export const CustomRoomContent: React.FC = () => {
const { message } = App.useApp(); const { message } = App.useApp();
const user = useSnapshot(accountStore).user; const user = useSnapshot(accountStore).user;
const { options } = useSnapshot(mcCustomRoomStore); const { options, friendPrivateID } = useSnapshot(mcCustomRoomStore);
const privateRoomID = getPrivateRoomID(user?.external_id ?? 0); const privateRoomID = getPrivateRoomID(user?.external_id ?? 0);
useEffect(() => { useEffect(() => {
...@@ -75,6 +76,9 @@ export const CustomRoomContent: React.FC = () => { ...@@ -75,6 +76,9 @@ export const CustomRoomContent: React.FC = () => {
const onChangeAutoDeath: CheckboxProps["onChange"] = (e) => { const onChangeAutoDeath: CheckboxProps["onChange"] = (e) => {
mcCustomRoomStore.options.auto_death = e.target.checked; mcCustomRoomStore.options.auto_death = e.target.checked;
}; };
const onChangePrivateID = (event: ChangeEvent<HTMLInputElement>) => {
mcCustomRoomStore.friendPrivateID = Number(event.target.value);
};
return ( return (
<div className={styles.container}> <div className={styles.container}>
...@@ -181,6 +185,12 @@ export const CustomRoomContent: React.FC = () => { ...@@ -181,6 +185,12 @@ export const CustomRoomContent: React.FC = () => {
> >
40分自动加时 40分自动加时
</Checkbox> </Checkbox>
<Input
value={friendPrivateID}
onChange={onChangePrivateID}
placeholder="在这输入你朋友的私密房间密码"
type="number"
/>
</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