cleanup | distraction free with all toasts

This commit is contained in:
talksik
2022-05-30 11:07:15 -05:00
parent f5755e66aa
commit 0c6aff6ada
3 changed files with 15 additions and 25 deletions
+1 -8
View File
@@ -251,14 +251,12 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
});
if (findExistingConversation) {
enqueueSnackbar('quick dialed someone!', { variant: 'success' });
setSelectedConversationId(findExistingConversation.id);
return;
}
// create conversation in this case
const newConversationId = await createOneOnOneConversation(otherUser, nirvanaUser);
enqueueSnackbar('started conversation!', { variant: 'success' });
setSelectedConversationId(newConversationId);
} catch (error) {
enqueueSnackbar('Something went wrong, please try again', { variant: 'error' });
@@ -313,8 +311,6 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
audioChunks[0].type,
);
await sendContentBlockToConversation(contentBlock, selectedConversation.id);
enqueueSnackbar('clip sent!', { variant: 'success' });
} catch (error) {
console.error(error);
enqueueSnackbar('Problem in recording clip', { variant: 'error' });
@@ -383,7 +379,6 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
}
try {
enqueueSnackbar('started recording');
setIsCloudDoingMagic(true);
mediaRecorder.start();
setIsUserSpeaking(true);
@@ -406,14 +401,13 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
const handleStopBroadcast = useCallback(() => {
if (isUserSpeaking) {
setIsUserSpeaking(false);
enqueueSnackbar('stopped...', { variant: 'info' });
// actually stop talking after 2 seconds to capture everything
setTimeout(() => {
mediaRecorder.stop();
}, 200);
}
}, [setIsUserSpeaking, isUserSpeaking, mediaRecorder, enqueueSnackbar]);
}, [setIsUserSpeaking, isUserSpeaking, mediaRecorder]);
useKeyPressEvent('`', handleBroadcast, handleStopBroadcast);
@@ -486,7 +480,6 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
nirvanaUser,
conversationName ?? null,
);
enqueueSnackbar('started group conversation!', { variant: 'success' });
setSelectedConversationId(newConversationId);
setCreateConversationMode(false);
+13 -15
View File
@@ -1,27 +1,26 @@
import { Credentials } from 'google-auth-library/build/src/auth/credentials';
import { Button, Container } from '@mui/material';
import React, { useContext, useEffect, useCallback, useState } from 'react';
import { FcGoogle } from 'react-icons/fc';
import { blueGrey } from '@mui/material/colors';
import Channels from '../electron/constants';
import { firebaseAuth } from '../firebase/connect';
import {
GoogleAuthProvider,
signInWithCredential,
setPersistence,
browserLocalPersistence,
User as FirebaseUser,
onAuthStateChanged,
updateCurrentUser,
GoogleAuthProvider,
browserLocalPersistence,
getAuth,
onAuthStateChanged,
setPersistence,
signInWithCredential,
updateCurrentUser,
} from 'firebase/auth';
import { useSnackbar } from 'notistack';
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { createUser, getUserById } from '../firebase/firestore';
import Channels from '../electron/constants';
import CircularProgress from '@mui/material/CircularProgress';
import { Credentials } from 'google-auth-library/build/src/auth/credentials';
import { FcGoogle } from 'react-icons/fc';
import NirvanaLogo from '../components/NirvanaLogo';
import { User } from '@nirvana/core/src/models/user.model';
import { blueGrey } from '@mui/material/colors';
import { firebaseAuth } from '../firebase/connect';
import { useSnackbar } from 'notistack';
interface IAuthContext {
user?: FirebaseUser;
@@ -93,7 +92,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
const user = result.user;
console.log(user);
updateCurrentUser(firebaseAuth, user);
enqueueSnackbar('Signed in! All set!', { variant: 'success' });
});
})
.catch((error: any) => {
@@ -1,6 +1,5 @@
import React from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import React from 'react';
import { useSnackbar } from 'notistack';
function MyFallbackComponent({