not the pattern I want but have to think about it more
This commit is contained in:
@@ -28,6 +28,7 @@ import useAuth from '../providers/AuthProvider';
|
||||
import { useImmer } from 'use-immer';
|
||||
import { useSearchConversations } from '../util/clientSearch';
|
||||
import { useSnackbar } from 'notistack';
|
||||
import useStreamHandler from '../hooks/useStreamHandler';
|
||||
|
||||
interface ITerminalContext {
|
||||
conversationMap: ConversationMap;
|
||||
@@ -192,6 +193,9 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
|
||||
// return undefined;
|
||||
}, [selectedConversationId, conversationMap, enqueueSnackbar]);
|
||||
|
||||
// handles stream and device stuff
|
||||
useStreamHandler(selectedConversation);
|
||||
|
||||
// handle create or open existing conversation
|
||||
// not 100% consistent to the second, but still works...don't need atomicity
|
||||
const handleQuickDial = useCallback(
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import Conversation from '@nirvana/core/src/models/conversation.model';
|
||||
import { useMediaDevices } from 'react-use';
|
||||
|
||||
export default function useStreamHandler(selectedConversation: Conversation) {
|
||||
const devices = useMediaDevices();
|
||||
|
||||
console.log('devices');
|
||||
|
||||
console.log(devices);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedConversation) {
|
||||
console.log('handle stream for this newly selected conversation');
|
||||
}
|
||||
}, [selectedConversation]);
|
||||
}
|
||||
Reference in New Issue
Block a user