Skip to content

Commit

Permalink
Merge pull request #90 from bhargavmodak/main
Browse files Browse the repository at this point in the history
FrontEnd is ready for deployment on Netlify
  • Loading branch information
bhargavmodak authored Apr 8, 2024
2 parents 983a032 + 12595dd commit 4c2b529
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 93 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/client/build

# misc
.DS_Store
Expand Down
16 changes: 10 additions & 6 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion client/src/components/home/HomeMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import LightModeIcon from '@mui/icons-material/LightMode';
import DarkModeIcon from '@mui/icons-material/DarkMode';

export default function HomeMenu({
notificationGranted,
setNotificationGranted,
themeChange,
mode,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/home/HomeRightSide.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default function HomeRightSide({ mode, chat }) {
backgroundColor: mode === 'dark' ? '#1a1a1a' : '#f5f5f5',
}}
>
<OtherUserHeader chat={chat} mode={mode} />
<OtherUserHeader {...{ chat, mode, startVideoCall, startWorkspace }} />
<Box
sx={{
pt: '20px',
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/landing_page/GoogleOneTapLogIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ const GoogleOneTapLogin = () => {
navigate('/chat');
})
.catch((error) => {
console.log(error);
dispatch(
notifyAction(
true,
'error',
'Log In Failed. Please try again'
error.message || 'Log In Failed. Please try again'
)
);
});
Expand Down
14 changes: 1 addition & 13 deletions client/src/components/main_chat/OtherUserHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,9 @@ import VideoCallIcon from '@mui/icons-material/VideoCall';
import WorkspacesIcon from '@mui/icons-material/Workspaces';
import AccountCircleIcon from '@mui/icons-material/AccountCircle';
import OtherUserModal from './other_user_modal/OtherUserModal';
import Divider from '@mui/material/Divider';

export default function OtherUserHeader({ chat = [], mode }) {

export default function OtherUserHeader({ chat = [], mode, startVideoCall, startWorkspace }) {
const [modalOpen, setModalOpen] = useState(false);

const startVideoCall = () => {
// handleSendMessage(INVITE_TEMPLATE, true);
window.location.href = `/meet/${chat[0]}`;
};

const startWorkspace = () => {
window.location.href = `/workspace/${chat[0]}`;
};

return (
<>
{modalOpen && (
Expand Down
8 changes: 7 additions & 1 deletion client/src/components/main_chat/TabsNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,13 @@ export default function TabsNav({
unsub();
};
} catch (error) {
console.log(error);
dispatch(
notifyAction(
true,
'error',
error.message || 'Something went wrong, please try again'
)
);
}
};
currentUser.uid && getUserChats();
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/main_chat/UserProfileModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ export default function UserProfileModal({
notifyAction(
true,
'error',
'Something went wrong! please try again later.'
error.message || 'An error occurred. Please try again.'
)
);
console.log(error);
}
dispatch(stopLoadingAction());
setModalOpen(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { Box, Typography } from '@mui/material';
import { Box } from '@mui/material';

const GithubStats = ({ mode, userGithub }) => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import GithubStats from './GithubStats';

// Firebase
import { db } from '../../../firebaseConfig';
import { doc, setDoc, updateDoc, getDoc } from 'firebase/firestore';
import { doc, getDoc } from 'firebase/firestore';

// Actions
import {
Expand Down
1 change: 0 additions & 1 deletion client/src/components/util/MarkComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Box, IconButton } from '@mui/material';

const MarkComponent = (props) => {
const language = props.className;
console.log(language?.replace('language-', ''));
return (
<Box sx={{
position: 'relative',
Expand Down
1 change: 0 additions & 1 deletion client/src/components/workspace/CodeSidePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export default function CodeSidePanel({
};

const handleCodeSubmission = async () => {
console.log(codeRef.current);
const sourceCode = codeRef.current;
const languageId = lang.id;
setProcessingCode(true);
Expand Down
5 changes: 2 additions & 3 deletions client/src/components/workspace/SideStrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import MicOffIcon from '@mui/icons-material/MicOff';
import HeadsetIcon from '@mui/icons-material/Headset';
import HeadsetOffIcon from '@mui/icons-material/HeadsetOff';
import CallEndIcon from '@mui/icons-material/CallEnd';
import { doc, updateDoc, setDoc } from 'firebase/firestore';
import { doc, updateDoc } from 'firebase/firestore';
import { db } from '../../firebaseConfig';
import { useParams } from 'react-router-dom';
import { useDispatch } from 'react-redux';
Expand Down Expand Up @@ -98,9 +98,8 @@ export default function SideStrip({ handleSelect, selected }) {
await updateDoc(dbRef, data);
window.location.href = '/chat';
} catch (error) {
console.log(error);
dispatch(
notifyAction(true, 'error', 'Error uploading data to cloud')
notifyAction(true, 'error', error.message || 'Error uploading data to cloud')
);
} finally {
dispatch(stopLoadingAction());
Expand Down
4 changes: 1 addition & 3 deletions client/src/components/workspace/StartCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {

import Box from '@mui/material/Box';
import IconButton from '@mui/material/IconButton';
import AddIcCallIcon from '@mui/icons-material/AddIcCall';
import PhoneInTalkIcon from '@mui/icons-material/PhoneInTalk';

import CoderOnCall from './CoderOnCall';
Expand Down Expand Up @@ -81,7 +80,6 @@ export default function StartCall() {
dispatch(startLoadingAction());
try {
const response = await getToken();
console.log(response);
await hmsActions.join({
userName: currentUser.username || 'Anonymous',
authToken: response,
Expand All @@ -92,7 +90,7 @@ export default function StartCall() {
process.env.REACT_APP_100MS_TOKEN_ENDPOINT || undefined,
});
} catch (error) {
console.log(error);
// console.error('Error while joining call', error);
}
dispatch(stopLoadingAction());
};
Expand Down
53 changes: 1 addition & 52 deletions client/src/components/workspace/WorkSpace.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import React, { useState, useRef, useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { useSelector } from 'react-redux';
import { useParams } from 'react-router-dom';
import Box from '@mui/material/Box';
import Fab from '@mui/material/Fab';
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
import CssBaseline from '@mui/material/CssBaseline';
import Tooltip from '@mui/material/Tooltip';
import { doc, updateDoc, setDoc } from 'firebase/firestore';

import SidePanel from './SidePanel';
import Whiteboard from './whiteboard/Whiteboard';
Expand All @@ -15,19 +11,12 @@ import SideStrip from './SideStrip';
import useWorkspaceSocket from '../../hooks/useWorkspaceSocket';
import { languageOptions } from '../../utils/languageOptions';
import { customGlobalScrollBars } from '../CustomGlobalCSS';
import { db } from '../../firebaseConfig';
import {
notifyAction,
startLoadingAction,
stopLoadingAction,
} from '../../actions/actions';

export default function WorkSpace() {
const params = useParams();
const canvasRef = useRef(null);
const socketRef = useRef();
const codeRef = useRef(null);
const dispatch = useDispatch();

useEffect(() => {
if (!window.localStorage.getItem('dev')) {
Expand Down Expand Up @@ -88,28 +77,6 @@ export default function WorkSpace() {
});
};

const uploadDataToCloud = async () => {
try {
dispatch(startLoadingAction());
const canvasData = localStorage.getItem(
`${params.workspaceId}-drawing`
);
const code = localStorage.getItem(`${params.workspaceId}-code`);
const data = {
code,
canvasData,
};
const dbRef = doc(db, 'workspace', params.workspaceId);
await updateDoc(dbRef, data);
} catch (error) {
dispatch(
notifyAction(true, 'error', 'Error uploading data to cloud')
);
} finally {
dispatch(stopLoadingAction());
}
};

return (
<Box
sx={{
Expand Down Expand Up @@ -160,24 +127,6 @@ export default function WorkSpace() {
/>
</Box>
)}
{/* <Tooltip title='Backup workspace data to cloud' placement='top'>
<Fab
sx={{
position: 'absolute',
bottom: 16,
right: 16,
backgroundColor: '#03256C',
color: 'white',
'&:hover': {
backgroundColor: '#2196f3',
},
}}
onClick={uploadDataToCloud}
>
<CloudUploadIcon />
</Fab>
</Tooltip> */}
</Box>
);
}
9 changes: 4 additions & 5 deletions client/src/components/workspace/whiteboard/Whiteboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { useNavigate, useParams } from 'react-router-dom';
import { useSelector } from 'react-redux';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
import DeleteIcon from '@mui/icons-material/Delete';
import PermMediaIcon from '@mui/icons-material/PermMedia';
import { db } from './../../../firebaseConfig';
import { doc, getDoc, updateDoc } from 'firebase/firestore';
import { doc, getDoc } from 'firebase/firestore';

import './Whiteboard.css';

Expand All @@ -19,7 +18,7 @@ export default function Whiteboard({ canvasRef, socketRef }) {
const [canvasCurrent, setCanvasCurrent] = useState(null);

useEffect(() => {
const fetchData=async()=>{
const fetchData = async () => {
const drawingData = await getDoc(doc(db, 'workspace', params.workspaceId));
if (drawingData.exists()) {
const canvas = canvasRef.current;
Expand Down Expand Up @@ -51,8 +50,8 @@ export default function Whiteboard({ canvasRef, socketRef }) {
context.drawImage(image, 0, 0);
};
image.src = drawingData;
}else{

} else {
fetchData();
}
}, []);
Expand Down

0 comments on commit 4c2b529

Please sign in to comment.