Skip to content

Commit f4cf29c

Browse files
Merge branch 'dev' into feature/finalReadme
2 parents 4cb7c59 + ac190b9 commit f4cf29c

File tree

13 files changed

+308
-72
lines changed

13 files changed

+308
-72
lines changed

CHANGE_LOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
- **Developer Improvement:**
1111
- Fixed testing suite compatability issues and added 30 new tests for new features
12-
- Added 264 JSDoc comment blocks throughout the codebase
12+
- Added 273 JSDoc comment blocks throughout the codebase
1313
- **User Features:**
1414
- **Material UI Components:**
1515
- Integrated 49 new, pre-styled Material UI components

__tests__/BottomTabs.test.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @vitest-environment jsdom
22

3-
import { describe, it, expect } from 'vitest'
3+
import { describe, it, expect } from 'vitest';
44
import {
55
fireEvent,
66
render,
@@ -26,19 +26,18 @@ import store from '../app/src/redux/store';
2626

2727
describe('Bottom Panel Render test', () => {
2828
it('should render all six tabs', () => {
29-
const { unmount } = render(
29+
const { unmount } = render(
3030
<Provider store={store}>
3131
<BottomTabs />
3232
</Provider>
3333
);
34-
expect(screen.getAllByRole('tab')).toHaveLength(8);
34+
expect(screen.getAllByRole('tab')).toHaveLength(7);
3535
expect(screen.getByText('Component Tree')).toBeDefined();
3636
expect(screen.getByText('Creation Panel')).toBeDefined();
3737
expect(screen.getByText('Customization')).toBeDefined();
3838
expect(screen.getByText('CSS Editor')).toBeDefined();
3939
expect(screen.getByText('Context Manager')).toBeDefined();
4040
expect(screen.getByText('State Manager')).toBeDefined();
41-
expect(screen.getByText('MUI Props')).toBeDefined();
4241
unmount();
4342
});
4443
});
@@ -54,9 +53,7 @@ describe('Creation Panel', () => {
5453
fireEvent.click(screen.getByText('Create'));
5554

5655
await waitFor(() => {
57-
expect(
58-
screen.getByText('Component name cannot be blank.')
59-
).toBeDefined();
56+
expect(screen.getByText('Component name cannot be blank.')).toBeDefined();
6057
});
6158
unmount();
6259
});
@@ -83,7 +80,7 @@ describe('Creation Panel', () => {
8380
});
8481
unmount();
8582
});
86-
})
83+
});
8784

8885
describe('HTML Panel', () => {
8986
it('should invalidate empty field in HTML Tag tag', async () => {
@@ -211,10 +208,14 @@ describe('Customization Panel', () => {
211208
);
212209
expect(screen.getByText('Parent Component:')).toBeDefined();
213210
expect(screen.getByText('App')).toBeDefined();
214-
expect(screen.getByText('Drag or click an html element to the canvas to see what happens!')).toBeDefined();
211+
expect(
212+
screen.getByText(
213+
'Drag or click an html element to the canvas to see what happens!'
214+
)
215+
).toBeDefined();
215216
unmount();
216217
});
217-
})
218+
});
218219

219220
describe('Canvas', () => {
220221
it('Should render all buttons and inputs when Canvas has element', async () => {
@@ -224,7 +225,7 @@ describe('Canvas', () => {
224225
<DndProvider backend={HTML5Backend}>
225226
<DragDropPanel />
226227
<MainContainer />
227-
<CustomizationPanel isThemeLight={true}/>
228+
<CustomizationPanel isThemeLight={true} />
228229
</DndProvider>
229230
</BrowserRouter>
230231
</Provider>

app/src/components/bottom/BottomTabs.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import StylesEditor from './StylesEditor';
1111
import Tree from '../../tree/TreeChart';
1212
import ContextManager from '../ContextAPIManager/ContextManager';
1313
import StateManager from '../StateManagement/StateManagement';
14-
import MUIProps from './MUIProps';
1514
import makeStyles from '@mui/styles/makeStyles';
1615
import Tabs from '@mui/material/Tabs';
1716
import Tab from '@mui/material/Tab';
@@ -91,9 +90,9 @@ const BottomTabs = (props): JSX.Element => {
9190
indicator: classes.tabsIndicator
9291
}}
9392
variant="scrollable"
94-
scrollButtons="auto"
93+
scrollButtons="auto"
9594
>
96-
<Tab
95+
<Tab
9796
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
9897
label="Live Chat"
9998
onClick={showBottomPanel}
@@ -132,11 +131,6 @@ const BottomTabs = (props): JSX.Element => {
132131
label="State Manager"
133132
onClick={showBottomPanel}
134133
/>
135-
<Tab
136-
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
137-
label="MUI Props"
138-
onClick={showBottomPanel}
139-
/>
140134
</Tabs>
141135

142136
<div className={classes.projectTypeWrapper}>
@@ -177,8 +171,13 @@ const BottomTabs = (props): JSX.Element => {
177171
{tab === 3 && <StylesEditor theme={theme} setTheme={setTheme} />}
178172
{tab === 4 && <Tree data={components} />}
179173
{tab === 5 && <ContextManager theme={theme} setTheme={setTheme} />}
180-
{tab === 6 && (<StateManager theme={theme} setTheme={setTheme} isThemeLight={isThemeLight} />)}
181-
{tab === 7 && <MUIProps theme={theme} setTheme={setTheme} />}
174+
{tab === 6 && (
175+
<StateManager
176+
theme={theme}
177+
setTheme={setTheme}
178+
isThemeLight={isThemeLight}
179+
/>
180+
)}
182181
</div>
183182
</div>
184183
</MeetingProvider>

app/src/components/bottom/ChatRoom.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ import { emitEvent } from '../../helperFunctions/socket';
55
import Videomeeting from './VideoMeeting';
66
import { Send } from '@mui/icons-material';
77

8+
/**
9+
* Chatroom component for handling and displaying chat messages within a collaboration room.
10+
* This component integrates with the Redux store to access and manage chat-related states such as user details, room code, and messages.
11+
* It also provides a real-time chat interface that allows users to send messages that are displayed in a styled format based on the sender.
12+
*
13+
* @component
14+
* @example
15+
* return <Chatroom />
16+
*
17+
* @returns {JSX.Element} The Chatroom component with interactive chat and video meeting functionalities.
18+
*
19+
* Props:
20+
* - userName (string): The current user's name.
21+
* - roomCode (string): The unique code for the current chat room.
22+
* - messages (array): An array of message objects that contains details like message type, sender's username, and the message content.
23+
* - userJoinCollabRoom (boolean): A boolean state that indicates whether the user has joined a collaborative room.
24+
*
25+
* Redux State:
26+
* - userName (string): The user's name fetched from the Redux store.
27+
* - roomCode (string): The room code for the current session.
28+
* - messages (array): List of messages in the current chat room.
29+
* - userJoinCollabRoom (boolean): Indicates if the user has joined a collaboration room, affecting visibility of certain UI elements.
30+
*
31+
* Styles:
32+
* - wrapperStyles: Styles for the main message container.
33+
* - inputContainerStyles: Styles for the input container.
34+
* - inputStyles: Styles for the text input where users type their messages.
35+
* - buttonStyles: Styles for the send button.
36+
*
37+
* Functions:
38+
* - handleSubmit: Handles the submission of the chat form to send a message.
39+
* - handleMessageContainerStyle: Returns styling for message bubbles based on the message type and sender.
40+
* - renderMessages: Maps through the `messages` array and renders each message using specific styles.
41+
*/
842
const Chatroom = (props): JSX.Element => {
943
const { userName, roomCode, messages, userJoinCollabRoom } = useSelector(
1044
(store: RootState) => store.roomSlice

app/src/components/bottom/MUIProps.tsx

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/src/components/bottom/VideoMeeting.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,47 @@ import VideocamIcon from '@mui/icons-material/Videocam';
2121
import VideocamOffIcon from '@mui/icons-material/VideocamOff';
2222
import VideoMeetingControl from './VideoMeetingControl';
2323

24+
/**
25+
* Videomeeting component that integrates video and audio functionalities for a meeting using VideoSDK.
26+
* It handles user interactions such as joining/leaving a meeting, enabling/disabling the microphone, and camera.
27+
* It uses the `useMeeting` and `useParticipant` hooks from the VideoSDK to manage meeting states and participant data.
28+
*
29+
* @component
30+
* @example
31+
* return <Videomeeting />
32+
*
33+
* @returns {JSX.Element} The Videomeeting component providing video and audio interaction within a meeting environment.
34+
*
35+
* Redux State:
36+
* - meetingId (string): The unique identifier for the current meeting.
37+
* - userJoinCollabRoom (boolean): Indicates if the user has joined a collaborative room.
38+
* - userJoinMeetingStatus (string | null): Represents the current user's meeting join status.
39+
* - meetingParticipants (array): Array of participant IDs currently in the meeting.
40+
* - useMic (boolean): State to track if the user's microphone is active.
41+
* - useWebcam (boolean): State to track if the user's webcam is active.
42+
*
43+
* Props:
44+
* - meetingId (string): Unique identifier for the meeting.
45+
* - userJoinCollabRoom (boolean): Indicates whether the user has joined a collaboration room.
46+
* - userJoinMeetingStatus (string | null): Indicates the user's current status in the meeting.
47+
* - meetingParticipants (array): IDs of participants in the meeting.
48+
* - useMic (boolean): Indicates if the microphone is being used.
49+
* - useWebcam (boolean): Indicates if the webcam is active.
50+
*
51+
* Functions:
52+
* - onMeetingLeave(): Handles actions when leaving a meeting, such as updating Redux states.
53+
* - handleUserInfoStyle(isLocalParticipant: boolean): Provides styling for user information based on whether the participant is local.
54+
* - ParticipantView({ participantId, isLocalParticipant }): Renders individual participant views including video and audio components.
55+
* - MeetingView({ onMeetingLeave }): Manages the entire meeting view, including joining and leaving functionalities, and displaying all participants.
56+
* - TurnOffCameraDisplay(): Displays an icon when the camera is turned off.
57+
*
58+
* Hooks:
59+
* - useMemo: Used for memoizing the video stream creation.
60+
* - useEffect: Handles side effects related to microphone stream management.
61+
* - useRef: References to HTML audio elements for real-time audio playback.
62+
* - useDispatch: To dispatch Redux actions.
63+
* - useSelector: To access Redux state.
64+
*/
2465
const Videomeeting = (props): JSX.Element => {
2566
const dispatch = useDispatch();
2667
const {

app/src/components/bottom/VideoMeetingControl.tsx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,40 @@ enum ButtonType {
2222
WEBCAM = 'Webcam'
2323
}
2424

25-
const VideoMeetingControl: React.FC<VideoMeetingControlProps> = () => {
25+
/**
26+
* VideoMeetingControl is a component that provides user interface controls for managing video and audio settings
27+
* during a video meeting. It includes buttons to toggle microphone and webcam states, and to leave the meeting.
28+
* This component utilizes the VideoSDK's `useMeeting` hook for control functionality and interacts with Redux to manage
29+
* application state.
30+
*
31+
* @component
32+
* @example
33+
* const props = {
34+
* userJoinMeetingStatus: 'JOINED',
35+
* useWebcam: true,
36+
* useMic: true
37+
* }
38+
* return <VideoMeetingControl {...props} />
39+
*
40+
* @param {Object} props - The props object.
41+
* @param {string} props.userJoinMeetingStatus - Current status of the user's meeting join process.
42+
* @param {boolean} props.useWebcam - Indicates whether the webcam is currently activated.
43+
* @param {boolean} props.useMic - Indicates whether the microphone is currently activated.
44+
*
45+
* Redux State:
46+
* - userJoinMeetingStatus (string): Reflects whether the user has joined the meeting.
47+
* - useMic (boolean): State to track if the user's microphone is active.
48+
* - useWebcam (boolean): State to track if the user's webcam is active.
49+
*
50+
* Functions:
51+
* - handleButtonHover(button: string, hovered: boolean): Manages hover state changes for control buttons.
52+
* - toggleMic(): Toggles the microphone on or off.
53+
* - toggleWebcam(): Toggles the webcam on or off.
54+
* - leave(): Function from useMeeting hook that is called to leave the meeting.
55+
*
56+
* @returns {JSX.Element | null} Renders the control bar with microphone, webcam, and call end buttons, or null if the user has not joined.
57+
*/
58+
const VideoMeetingControl: React.FC<VideoMeetingControlProps> = (): JSX.Element | null => {
2659
const { leave, toggleMic, toggleWebcam } = useMeeting();
2760

2861
const [callEndHovered, setCallEndHovered] = useState(false);

app/src/redux/reducers/rootReducer.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ import appStateReducer from './slice/appStateSlice';
77
import styleReducer from './slice/styleSlice';
88
import roomReducer from './slice/roomSlice';
99

10+
/**
11+
* Combines individual reducers into a single root reducer to be used in the Redux store configuration.
12+
* This rootReducer integrates various features of the application such as code preview, context management,
13+
* application state, styling properties, and room functionalities into the Redux state management.
14+
*
15+
* Each reducer manages a specific aspect of the application's state:
16+
* - `codePreviewSlice`: Manages state related to code previews in the application.
17+
* - `contextSlice`: Handles state for contextual information within the application.
18+
* - `appState`: Manages general application state and settings.
19+
* - `styleSlice`: Controls style-related state, likely for dynamic styling in the app.
20+
* - `roomSlice`: Manages state related to room and meeting functionalities.
21+
*
22+
* @module rootReducer
23+
* @function
24+
* @example
25+
* import rootReducer from './reducers/rootReducer';
26+
*
27+
* const store = configureStore({
28+
* reducer: rootReducer
29+
* });
30+
*
31+
* @returns {Reducer<CombinedState>} The combined reducer containing all individual slice reducers, ready to be used in the Redux store.
32+
*/
1033
const rootReducer = combineReducers({
1134
codePreviewSlice: codePreviewReducer,
1235
contextSlice: contextReducer,

app/src/redux/reducers/slice/codePreviewSlice.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,29 @@ const initialState = {
55
input: ``
66
};
77

8-
//realtime updates for the code preview
9-
8+
/**
9+
* `codePreviewSlice` manages the state of the code preview functionality in the application.
10+
* It handles real-time updates to the code editor and input fields. This slice is essential for functionalities
11+
* that require storing and retrieving user-entered code and associated input for execution or display purposes.
12+
*
13+
* @module codePreviewSlice
14+
* @type {Slice}
15+
*
16+
* @typedef {Object} CodePreviewState
17+
* @property {string} code - The current code stored in the state, typically representing the code written in an editor.
18+
* @property {string} input - Additional input or parameters associated with the code that might affect its execution or presentation.
19+
*
20+
* Actions:
21+
* - codePreviewSave: Updates the `code` property in the state with new content.
22+
* - codePreviewInput: Updates the `input` property in the state with new content.
23+
* - codePreviewCooperative: Merges provided payload into the existing state in a cooperative manner.
24+
*
25+
* @example
26+
* dispatch(codePreviewSave("function example() { return 'Hello, world!'; }"));
27+
* dispatch(codePreviewInput("Example input"));
28+
*
29+
* @returns {Reducer<CodePreviewState>} The reducer for this slice of state, handling updates to code and input properties.
30+
*/
1031
const codePreviewSlice = createSlice({
1132
name: 'codePreview',
1233
initialState,

0 commit comments

Comments
 (0)