Skip to content

Commit

Permalink
make cq target_type as selecter
Browse files Browse the repository at this point in the history
  • Loading branch information
SummonHIM committed Apr 8, 2023
1 parent c39ccfb commit 4cf77e4
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions apps/web/src/pages/Start/ConfigDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import FormGroup from '@mui/material/FormGroup';
import Switch from '@mui/material/Switch';
import Divider from '@mui/material/Divider';
import Box from '@mui/material/Box';
import MenuItem from '@mui/material/MenuItem';

type renderLoginType = React.FC<{
onOK: (phone: string, password: string) => Promise<any>;
Expand Down Expand Up @@ -79,6 +80,17 @@ export const RenderLogin: renderLoginType = (props) => {
);
};

const listTargetType = [
{
value: 'private',
label: '私聊',
},
{
value: 'group',
label: '群组',
},
];

export const RenderConfig: renderConfigType = (props) => {
const [config, setConfig] = useState<UserConfig>(defaultConfig);

Expand Down Expand Up @@ -291,17 +303,22 @@ export const RenderConfig: renderConfigType = (props) => {
<TextField
margin="dense"
id="target_type"
label="私聊或群组(private或group)"
type="text"
label="消息推送目标"
select
value={config.cqserver.target_type}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
setConfig(prev => {
return { ...prev, cqserver: { ...prev.cqserver, target_type: event.target.value } };
});
}}
fullWidth
variant="outlined"
/>
variant="outlined">
{listTargetType.map((option) => (
<MenuItem key={option.value} value={option.value}>
{option.label}
</MenuItem>
))}
</TextField>
<TextField
margin="dense"
id="target_id"
Expand Down

0 comments on commit 4cf77e4

Please sign in to comment.