diff --git a/README.md b/README.md index 931fd7087..79f3acced 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ - `apps/dashboard` - LiteSpace admin dashboard. - `apps/mobile` - LiteSpace mobile app. - `apps/nebula` - LiteSpace landing page. - - `apps/nova` - LiteSpace main web platform. + - `apps/nova` - LiteSpace main web platform. # Project Setup diff --git a/apps/nova/src/components/Call/GhostView.tsx b/apps/nova/src/components/Call/GhostView.tsx index 292edb45b..5b5b1ef75 100644 --- a/apps/nova/src/components/Call/GhostView.tsx +++ b/apps/nova/src/components/Call/GhostView.tsx @@ -1,6 +1,6 @@ import { useFormatMessage } from "@litespace/luna/hooks/intl"; import { Typography } from "@litespace/luna/Typography"; -import { RemoteStream } from "@litespace/headless/calls"; +import { RemoteStream } from "@litespace/headless/sessions"; import { isEmpty } from "lodash"; import React from "react"; import UserMedia from "@/components/Call/UserMedia"; diff --git a/apps/nova/src/components/Interviews/Interview.tsx b/apps/nova/src/components/Interviews/Interview.tsx index f9382a426..d72077f93 100644 --- a/apps/nova/src/components/Interviews/Interview.tsx +++ b/apps/nova/src/components/Interviews/Interview.tsx @@ -97,7 +97,7 @@ const Interview: React.FC<{
{upcoming ? ( - + diff --git a/apps/nova/src/components/TutorOnboardingSteps/Interview/ScheduledInterview/index.tsx b/apps/nova/src/components/TutorOnboardingSteps/Interview/ScheduledInterview/index.tsx index c174c82f7..25cc8b55b 100644 --- a/apps/nova/src/components/TutorOnboardingSteps/Interview/ScheduledInterview/index.tsx +++ b/apps/nova/src/components/TutorOnboardingSteps/Interview/ScheduledInterview/index.tsx @@ -1,14 +1,13 @@ import { destructureInterviewStatus } from "@litespace/sol/interview"; -import { ICall, IInterview } from "@litespace/types"; +import { IInterview, IRoom } from "@litespace/types"; import React, { useMemo } from "react"; import PendingInterview from "@/components/TutorOnboardingSteps/Interview/ScheduledInterview/PendingInterview"; import PassedInterview from "@/components/TutorOnboardingSteps/Interview/ScheduledInterview/PassedInterview"; const ScheduledInterview: React.FC<{ interview: IInterview.Self; - call: ICall.Self; - members: ICall.PopuldatedMember[]; -}> = ({ interview, call, members }) => { + members: IRoom.PopulatedMember[]; +}> = ({ interview, members }) => { // todo: handle canceled and rejected const { pending, passed, rejected, canceled } = useMemo( () => destructureInterviewStatus(interview.status), @@ -17,7 +16,7 @@ const ScheduledInterview: React.FC<{ const interviewer = useMemo(() => { return ( - members.find((member) => member.userId === interview.ids.interviewer) || + members.find((member) => member.id === interview.ids.interviewer) || null ); }, [interview.ids.interviewer, members]); @@ -25,7 +24,7 @@ const ScheduledInterview: React.FC<{ return (
{pending && interviewer ? ( - + ) : passed && interviewer ? ( | null; }> = ({ current }) => { // const onScheduleSuccess = useCallback(() => { diff --git a/apps/nova/src/components/TutorOnboardingSteps/index.tsx b/apps/nova/src/components/TutorOnboardingSteps/index.tsx index 86af132e1..a45ce790e 100644 --- a/apps/nova/src/components/TutorOnboardingSteps/index.tsx +++ b/apps/nova/src/components/TutorOnboardingSteps/index.tsx @@ -6,11 +6,10 @@ import { Element, IInterview } from "@litespace/types"; const TutorOnboardingSteps: React.FC<{ step: number; - interviews: IInterview.FindPagedInterviewsProps; current: Element | null; -}> = ({ step, interviews, current }) => { +}> = ({ step, current }) => { if (step === TutorOnboardingStep.Interview) - return ; + return ; if (step === TutorOnboardingStep.Media) return ; if (step === TutorOnboardingStep.Profile) return "todo"; return null; diff --git a/apps/nova/src/hooks/call.ts b/apps/nova/src/hooks/call.ts index 22b558c0f..ffa1edb44 100644 --- a/apps/nova/src/hooks/call.ts +++ b/apps/nova/src/hooks/call.ts @@ -2,7 +2,7 @@ import { useCallback, useEffect, useState, useRef } from "react"; import { isPermissionDenied, safe } from "@/lib/error"; import { MediaConnection } from "peerjs"; import peer from "@/lib/peer"; -import { Wss } from "@litespace/types"; +import { ISession, Wss } from "@litespace/types"; import hark from "hark"; import { useToast } from "@litespace/luna/Toast"; import { useFormatMessage } from "@litespace/luna/hooks/intl"; @@ -235,7 +235,7 @@ function useStreamState(stream: MediaStream | null) { export function useCallEvents( stream: MediaStream | null, - call: number | null, + session: ISession.Id | null, mate?: number ) { const [mateVideo, setMateVideo] = useState(false); @@ -245,18 +245,18 @@ export function useCallEvents( const notifyCameraToggle = useCallback( (camera: boolean) => { - if (!call || !socket) return; - socket.emit(Wss.ClientEvent.ToggleCamera, { call, camera }); + if (!session || !socket) return; + socket.emit(Wss.ClientEvent.ToggleCamera, { session, camera }); }, - [call, socket] + [session, socket] ); const notifyMicToggle = useCallback( (mic: boolean) => { - if (!call || !socket) return; - socket.emit(Wss.ClientEvent.ToggleMic, { call, mic }); + if (!session || !socket) return; + socket.emit(Wss.ClientEvent.ToggleMic, { session, mic }); }, - [call, socket] + [session, socket] ); const onCameraToggle = useCallback( diff --git a/apps/nova/src/pages/Call.tsx b/apps/nova/src/pages/Call.tsx index bb22f14fc..30308278c 100644 --- a/apps/nova/src/pages/Call.tsx +++ b/apps/nova/src/pages/Call.tsx @@ -9,20 +9,18 @@ import { // import { useMediaQueries } from "@litespace/luna/hooks/media"; // import { useRender } from "@litespace/luna/hooks/common"; // import { useFormatMessage } from "@litespace/luna/hooks/intl"; -import { useParams } from "react-router-dom"; import cn from "classnames"; // import { useFullScreen } from "@/hooks/call"; // import Media from "@/components/Call/Media"; // import Messages from "@/components/Chat/Messages"; import { orNull, orUndefined } from "@litespace/sol/utils"; import { - useCallMembers, - // useCall, - useCallV2, - useFindCallRoomById, + //useSessionMembers, + //usePeerIds, + useSessionV2, + //useFindSessionRoomById, useFullScreen, - usePeerIds, -} from "@litespace/headless/calls"; +} from "@litespace/headless/sessions"; import { useDisplayRecorder } from "@litespace/headless/recorder"; import { isGhost } from "@/lib/ghost"; import CallView, { CallViewProps } from "@/components/Call/CallView"; @@ -32,7 +30,6 @@ import Video from "@litespace/assets/Video"; import Microphone from "@litespace/assets/Microphone"; import VideoSlash from "@litespace/assets/VideoSlash"; import MicrophoneSlash from "@litespace/assets/MicrophoneSlash"; -import { ICall } from "@litespace/types"; import { useUser } from "@litespace/headless/context/user"; // import GhostView from "@/components/Call/GhostView"; @@ -41,29 +38,10 @@ const Call: React.FC = () => { // const chat = useRender(); // const intl = useFormatMessage(); // const mediaQueries = useMediaQueries(); - const { id, type } = useParams<{ id: string; type: ICall.Type }>(); // const { isFullScreen, toggleFullScreen, ref } = useFullScreen(); - const callId = useMemo(() => { - const call = Number(id); - if (!id || Number.isNaN(call)) return null; - return call; - }, [id]); - - const ctype = useMemo(() => { - if (type != "lesson" && type != "interview") return null; - return type; - }, [type]); - - const callRoom = useFindCallRoomById(!isGhost ? callId : null); - - const mateInfo = useMemo(() => { - if (!callRoom.data) return; - return callRoom.data.members.find((member) => member.id !== user?.id); - }, [callRoom.data, user?.id]); - - const members = useCallMembers(callId, ctype); - useEffect(() => console.log("In App members: ", members), [members]); + //const members = useSessionMembers(sessionId); + //useEffect(() => console.log("In App members: ", members), [members]); // const messages = useMemo( // () => @@ -124,20 +102,22 @@ const Call: React.FC = () => { const fullScreen = useFullScreen(); + /* const peers = usePeerIds( useMemo( () => ({ - callId, + sessionId, isGhost, mateUserId: orNull(mateInfo?.id), role: orNull(user?.role), disableGhost: false, }), - [callId, mateInfo?.id, user?.role] + [sessionId, mateInfo?.id, user?.role] ) ); + */ - const onCloseCall = useCallback(() => { + const onCloseSession = useCallback(() => { // peers.ghost.refetch(); // peers.tutor.refetch(); }, []); @@ -152,16 +132,16 @@ const Call: React.FC = () => { }); */ - const { userMedia, mateStream, mateScreenStream, ghostStreams } = useCallV2( + const { userMedia, mateStream, mateScreenStream, ghostStreams } = useSessionV2( useMemo( () => ({ isGhost, - ghostPeerId: orNull(peers.ghost.data), - tutorPeerId: orNull(peers.tutor.data), + ghostPeerId: orNull("ghost"), // TODO: pass peers.ghost.data + tutorPeerId: orNull("ghost"), // TODO: pass peers.tutor.data userId: orNull(user?.id), - onCloseCall, + onCloseSession, }), - [onCloseCall, peers.ghost.data, peers.tutor.data, user?.id] + [onCloseSession, user?.id] ) ); @@ -183,7 +163,7 @@ const Call: React.FC = () => { screen: mateScreenStream, }, speaking: true, - name: orUndefined(mateInfo?.name), + name: undefined // orUndefined(mateInfo?.name), }, fullScreen: { enabled: fullScreen.enabled, @@ -195,7 +175,6 @@ const Call: React.FC = () => { fullScreen.enabled, fullScreen.exit, fullScreen.start, - mateInfo?.name, mateScreenStream, mateStream, user?.name, @@ -308,12 +287,14 @@ const Call: React.FC = () => { /* * TODO: replace this by members views */ + /*

Joined members

{members.map((m) => ( ))}
+ */ } {/*