set up for dialog for creating convo
This commit is contained in:
@@ -9,7 +9,7 @@ import { useRendersCount } from 'react-use';
|
|||||||
|
|
||||||
export default function MainPanel() {
|
export default function MainPanel() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { selectedConversation, createConversationMode } = useTerminal();
|
const { selectedConversation } = useTerminal();
|
||||||
|
|
||||||
// if selected conversation, show details
|
// if selected conversation, show details
|
||||||
// do all fetching necessary to paint things here
|
// do all fetching necessary to paint things here
|
||||||
@@ -23,24 +23,6 @@ export default function MainPanel() {
|
|||||||
const pageContent = useMemo(() => {
|
const pageContent = useMemo(() => {
|
||||||
if (selectedConversation) return <ConversationDetails />;
|
if (selectedConversation) return <ConversationDetails />;
|
||||||
|
|
||||||
if (createConversationMode)
|
|
||||||
return (
|
|
||||||
<Container
|
|
||||||
maxWidth={false}
|
|
||||||
sx={{
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: 2,
|
|
||||||
flex: 1,
|
|
||||||
background: 'white',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
creating group conversation
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container
|
<Container
|
||||||
maxWidth={false}
|
maxWidth={false}
|
||||||
@@ -60,7 +42,7 @@ export default function MainPanel() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}, [createConversationMode, selectedConversation, user]);
|
}, [selectedConversation, user]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid
|
<Grid
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Container, Dialog, IconButton } from '@mui/material';
|
||||||
|
import { FiX } from 'react-icons/fi';
|
||||||
|
|
||||||
|
export default function NewConversationDialog({
|
||||||
|
open,
|
||||||
|
handleClose,
|
||||||
|
}: {
|
||||||
|
open: boolean;
|
||||||
|
handleClose: () => void;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Dialog fullScreen open={open} onClose={handleClose}>
|
||||||
|
<Container
|
||||||
|
maxWidth={false}
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 2,
|
||||||
|
flex: 1,
|
||||||
|
background: 'white',
|
||||||
|
position: 'relative',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconButton sx={{ position: 'absolute', top: 10, right: 10 }}>
|
||||||
|
<FiX />
|
||||||
|
</IconButton>
|
||||||
|
</Container>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
ListItemIcon,
|
ListItemIcon,
|
||||||
Fab,
|
Fab,
|
||||||
Switch,
|
Switch,
|
||||||
|
Dialog,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { blueGrey } from '@mui/material/colors';
|
import { blueGrey } from '@mui/material/colors';
|
||||||
import { FiZap, FiHeadphones, FiLogOut, FiMonitor, FiSun } from 'react-icons/fi';
|
import { FiZap, FiHeadphones, FiLogOut, FiMonitor, FiSun } from 'react-icons/fi';
|
||||||
@@ -48,6 +49,7 @@ import { ContentBlock, ContentType } from '@nirvana/core/src/models/content.mode
|
|||||||
import Navbar from './Navbar';
|
import Navbar from './Navbar';
|
||||||
import MainPanel from './MainPanel';
|
import MainPanel from './MainPanel';
|
||||||
import { ConversationList } from './ConversationList';
|
import { ConversationList } from './ConversationList';
|
||||||
|
import NewConversationDialog from './NewConversationDialog';
|
||||||
type ConversationMap = {
|
type ConversationMap = {
|
||||||
[conversationId: string]: Conversation;
|
[conversationId: string]: Conversation;
|
||||||
};
|
};
|
||||||
@@ -378,6 +380,8 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
|||||||
navigator.mediaDevices
|
navigator.mediaDevices
|
||||||
.getUserMedia({ audio: true })
|
.getUserMedia({ audio: true })
|
||||||
.then((localUserMedia: MediaStream) => {
|
.then((localUserMedia: MediaStream) => {
|
||||||
|
localUserMedia.getTracks().forEach((track) => track.stop());
|
||||||
|
|
||||||
setUserAudioStream(localUserMedia);
|
setUserAudioStream(localUserMedia);
|
||||||
|
|
||||||
const userMediaRecoder = new MediaRecorder(localUserMedia);
|
const userMediaRecoder = new MediaRecorder(localUserMedia);
|
||||||
@@ -496,7 +500,7 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
|||||||
|
|
||||||
// }, [])
|
// }, [])
|
||||||
|
|
||||||
const [createConversationMode, setCreateConversationMode] = useState<boolean>(false);
|
const [createConversationMode, setCreateConversationMode] = useState<boolean>(true);
|
||||||
|
|
||||||
const handleShowCreateConvoForm = useCallback(() => {
|
const handleShowCreateConvoForm = useCallback(() => {
|
||||||
setSelectedConversationId(undefined);
|
setSelectedConversationId(undefined);
|
||||||
@@ -687,6 +691,9 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
|
{/* create chat dialog */}
|
||||||
|
<NewConversationDialog open={createConversationMode} handleClose={handleEscape} />
|
||||||
</TerminalContext.Provider>
|
</TerminalContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user