mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
import * as React from 'react';
|
|
|
|
import { Box, FormControl, FormLabel, IconButton, Switch } from '@mui/joy';
|
|
|
|
import { ChatMulticastOnIcon } from '~/common/components/icons/ChatMulticastOnIcon';
|
|
import { ChatMulticastOffIcon } from '~/common/components/icons/ChatMulticastOffIcon';
|
|
|
|
|
|
export const ButtonMultiChatMemo = React.memo(ButtonMultiChat);
|
|
|
|
export function ButtonMultiChat(props: { isMobile?: boolean, multiChat: boolean, onSetMultiChat: (multiChat: boolean) => void }) {
|
|
const { multiChat } = props;
|
|
return props.isMobile ? (
|
|
<IconButton
|
|
variant={multiChat ? 'solid' : 'outlined'}
|
|
color={multiChat ? 'warning' : undefined}
|
|
onClick={() => props.onSetMultiChat(!multiChat)}
|
|
>
|
|
{multiChat ? <ChatMulticastOnIcon /> : <ChatMulticastOffIcon />}
|
|
</IconButton>
|
|
) : (
|
|
<FormControl orientation='horizontal' sx={{ minHeight: '2.25rem', justifyContent: 'space-between' }}>
|
|
<FormLabel sx={{ gap: 1, flexFlow: 'row nowrap' }}>
|
|
<Box sx={{ display: { xs: 'none', lg: 'inline-block' } }}>
|
|
{multiChat ? <ChatMulticastOnIcon color='primary' /> : <ChatMulticastOffIcon />}
|
|
</Box>
|
|
{multiChat ? 'Multichat · On' : 'Multichat'}
|
|
</FormLabel>
|
|
<Switch color={multiChat ? 'primary' : undefined} checked={multiChat} onChange={(e) => props.onSetMultiChat(e.target.checked)} />
|
|
</FormControl>
|
|
);
|
|
} |