import { Avatar, Card, Container, IconButton, Stack, Tooltip, Typography } from '@mui/material';
import { FiAirplay, FiCircle, FiLink, FiUserPlus } from 'react-icons/fi';
import React, { useEffect, useMemo, useRef } from 'react';
import { Box } from '@mui/system';
import ConversationLabel from '../subcomponents/ConversationLabel';
import { MasterConversation } from '../util/types';
import { blueGrey } from '@mui/material/colors';
import useAuth from '../providers/AuthProvider';
import useConversations from '../providers/ConversationProvider';
import { useRendersCount } from 'react-use';
export default function MainPanel() {
const { user } = useAuth();
const { selectedConversation } = useConversations();
// if selected conversation, show details
// do all fetching necessary to paint things here
// render room contents if there are people with video or other tracks
const rendersCount = useRendersCount();
// console.warn('RENDER COUNT | MAINPANEL | ', rendersCount);
if (selectedConversation)
return ;
return (
{`Hi ${user.givenName?.split(' ')[0] ?? 'there'}!`}
Start a conversation with one tap
or just take a breather.
);
}
function ConversationDetails({ masterConversation }: { masterConversation: MasterConversation }) {
const { user } = useAuth();
const isPriority = useMemo(() => {
const personalConvoMember = masterConversation.members.find(
(mem) => mem._id.toString() === user._id.toString(),
);
if (personalConvoMember && personalConvoMember.memberState === 'priority') {
return true;
}
return false;
}, [masterConversation, user]);
return (
{/* conversation header */}
{/* conversation controls */}
{/* main canvas */}
last week
Arjun Patel
6/18/22 | 2:35pm
1m 30s
James Pod
6/19/22 | 10:00am
7 sec
Arjun Patel
6/19/22 | 4:02pm
25 sec
yesterday
Joshua Bottle
11:35am
17 sec
today
Arjun Patel
4:02pm
22 sec
Mary Ann
4:03pm
2m 30s
{/* live video and screenshares */}
{/* {masterConversation.room &&
Object.entries(masterConversation.room).map(([userId, userPeerContents]) => {
return (
);
})} */}
);
}
function Video({ stream }: { stream: MediaStream }) {
const videoRef = useRef(null);
useEffect(() => {
if (stream && videoRef.current) {
videoRef.current.srcObject = stream;
videoRef.current.autoplay = true;
videoRef.current.muted = true;
}
}, [stream]);
return (
);
}
const marks = [
{
value: 0,
label: 'Arjun',
avatar: ,
},
{
value: 20,
label: 'Nick',
avatar: ,
},
{
value: 37,
label: 'Jeremy',
avatar: ,
},
{
value: 100,
label: '43 sec',
avatar: ,
},
];
function valuetext(value: number) {
return `${value}°C`;
}
// TODO: get label based on what region we are in
function valueLabelFormat(value: number) {
return (
marks.find((mark) => mark.value === value)?.avatar ?? (
)
);
}
function ConversationChunk() {
return (
Arjun Patel
6/18/22
);
}