Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: calls table and corresponding tables have been dropped; call is replaced with session_id. #245

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
removed: deprecated or no more necessary code has been removed.
mmoehabb authored and neuodev committed Dec 30, 2024
commit 7a14ffdffbd65fae8ff8cbf7296e67d76cfe4005
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -2,19 +2,16 @@ import {
Button,
ButtonType,
ButtonSize,
ButtonVariant,
} from "@litespace/luna/Button";
import { asFullAssetUrl } from "@litespace/luna/backend";
import { useFormatMessage } from "@litespace/luna/hooks/intl";
import { ISession } from "@litespace/types";
import { IInterview, IRoom } from "@litespace/types";
import React from "react";
import { Link } from "react-router-dom";
import { Route } from "@/types/routes";

const PendingInterview: React.FC<{
interviewer: ISession.PopuldatedMember;
session: ISession.Self;
}> = ({ interviewer, session }) => {
interviewer: IRoom.PopulatedMember;
interview: IInterview.Self;
}> = ({ interviewer }) => {
const intl = useFormatMessage();
return (
<div>
@@ -57,6 +54,7 @@ const PendingInterview: React.FC<{
</p>

<div className="flex flex-row gap-4 mt-6">
{/*
<Link to={Route.Call.replace(":id", session.sessionId)}>
<Button
size={ButtonSize.Small}
@@ -66,6 +64,7 @@ const PendingInterview: React.FC<{
{intl("global.labels.go")}
</Button>
</Link>
*/}
<Button size={ButtonSize.Small} type={ButtonType.Error}>
{intl("global.labels.cancel")}
</Button>
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { destructureInterviewStatus } from "@litespace/sol/interview";
import { ISession, 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;
session: ISession.Self;
members: ISession.PopuldatedMember[];
}> = ({ interview, session, members }) => {
members: IRoom.PopulatedMember[];
}> = ({ interview, members }) => {
// todo: handle canceled and rejected
const { pending, passed, rejected, canceled } = useMemo(
() => destructureInterviewStatus(interview.status),
@@ -17,15 +16,15 @@ 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]);

return (
<div>
{pending && interviewer ? (
<PendingInterview interviewer={interviewer} session={session} />
<PendingInterview interviewer={interviewer} interview={interview} />
) : passed && interviewer ? (
<PassedInterview
feedback={interview.feedback.interviewer}
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@ import RawHtml from "@/components/TutorOnboardingSteps/RawHtml";
// import ScheduledInterview from "@/components/TutorOnboardingSteps/Interview/ScheduledInterview";

const Interview: React.FC<{
interviews: IInterview.FindPagedInterviewsProps;
current: Element<IInterview.FindInterviewsApiResponse["list"]> | null;
}> = ({ current }) => {
// const onScheduleSuccess = useCallback(() => {
5 changes: 2 additions & 3 deletions apps/nova/src/components/TutorOnboardingSteps/index.tsx
Original file line number Diff line number Diff line change
@@ -6,11 +6,10 @@ import { Element, IInterview } from "@litespace/types";

const TutorOnboardingSteps: React.FC<{
step: number;
interviews: IInterview.FindPagedInterviewsProps;
current: Element<IInterview.FindInterviewsApiResponse["list"]> | null;
}> = ({ step, interviews, current }) => {
}> = ({ step, current }) => {
if (step === TutorOnboardingStep.Interview)
return <Interview interviews={interviews} current={current} />;
return <Interview current={current} />;
if (step === TutorOnboardingStep.Media) return <MediaShot />;
if (step === TutorOnboardingStep.Profile) return "todo";
return null;
39 changes: 13 additions & 26 deletions apps/nova/src/pages/Call.tsx
Original file line number Diff line number Diff line change
@@ -9,19 +9,17 @@ 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 {
useSessionMembers,
// useCall,
//useSessionMembers,
//usePeerIds,
useSessionV2,
useFindSessionRoomById,
//useFindSessionRoomById,
useFullScreen,
usePeerIds,
} from "@litespace/headless/sessions";
import { useDisplayRecorder } from "@litespace/headless/recorder";
import { isGhost } from "@/lib/ghost";
@@ -33,31 +31,17 @@ import Microphone from "@litespace/assets/Microphone";
import VideoSlash from "@litespace/assets/VideoSlash";
import MicrophoneSlash from "@litespace/assets/MicrophoneSlash";
import { useUser } from "@litespace/headless/context/user";
import { ISession } from "@litespace/types";
// import GhostView from "@/components/Call/GhostView";

const Call: React.FC = () => {
const { user } = useUser();
// const chat = useRender();
// const intl = useFormatMessage();
// const mediaQueries = useMediaQueries();
const { id } = useParams<{ id: ISession.Id }>();
// const { isFullScreen, toggleFullScreen, ref } = useFullScreen();

const { sessionId } = useMemo(() => {
return { sessionId: id || null };
}, [id]);


const callRoom = useFindSessionRoomById(!isGhost ? sessionId : null);

const mateInfo = useMemo(() => {
if (!callRoom.data) return;
return callRoom.data.members.find((member) => member.id !== user?.id);
}, [callRoom.data, user?.id]);

const members = useSessionMembers(sessionId);
useEffect(() => console.log("In App members: ", members), [members]);
//const members = useSessionMembers(sessionId);
//useEffect(() => console.log("In App members: ", members), [members]);

// const messages = useMemo(
// () =>
@@ -118,6 +102,7 @@ const Call: React.FC = () => {

const fullScreen = useFullScreen<HTMLDivElement>();

/*
const peers = usePeerIds(
useMemo(
() => ({
@@ -130,6 +115,7 @@ const Call: React.FC = () => {
[sessionId, mateInfo?.id, user?.role]
)
);
*/

const onCloseSession = useCallback(() => {
// peers.ghost.refetch();
@@ -150,12 +136,12 @@ const Call: React.FC = () => {
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),
onCloseSession,
}),
[onCloseSession, peers.ghost.data, peers.tutor.data, user?.id]
[onCloseSession, user?.id]
)
);

@@ -177,7 +163,7 @@ const Call: React.FC = () => {
screen: mateScreenStream,
},
speaking: true,
name: orUndefined(mateInfo?.name),
name: undefined // orUndefined(mateInfo?.name),
},
fullScreen: {
enabled: fullScreen.enabled,
@@ -189,7 +175,6 @@ const Call: React.FC = () => {
fullScreen.enabled,
fullScreen.exit,
fullScreen.start,
mateInfo?.name,
mateScreenStream,
mateStream,
user?.name,
@@ -302,12 +287,14 @@ const Call: React.FC = () => {
/*
* TODO: replace this by members views
*/
/*
<div>
<h1>Joined members</h1>
{members.map((m) => (
<label className="mx-1">-{m}-</label>
))}
</div>
*/
}

{/* <Button
6 changes: 0 additions & 6 deletions packages/atlas/src/atlas.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { User } from "@/user";
import { Auth } from "@/auth";
import { Backend } from "@litespace/types";
import { Session } from "@/session";
import { Plan } from "@/plan";
import { Coupon } from "@/coupon";
import { Invite } from "@/invite";
@@ -18,12 +17,10 @@ import { Invoice } from "@/invoice";
import { Topic } from "@/topic";
import { AuthToken } from "@/client";
import { Cache } from "@/cache";
import { Peer } from "@/peer";

export class Atlas {
public readonly user: User;
public readonly auth: Auth;
public readonly session: Session;
public readonly plan: Plan;
public readonly coupon: Coupon;
public readonly invite: Invite;
@@ -39,12 +36,10 @@ export class Atlas {
public readonly invoice: Invoice;
public readonly cache: Cache;
public readonly topic: Topic;
public readonly peer: Peer;

constructor(backend: Backend, token: AuthToken | null) {
this.user = new User(backend, token);
this.auth = new Auth(backend, token);
this.session = new Session(backend, token);
this.plan = new Plan(backend, token);
this.coupon = new Coupon(backend, token);
this.invite = new Invite(backend, token);
@@ -60,6 +55,5 @@ export class Atlas {
this.invoice = new Invoice(backend, token);
this.cache = new Cache(backend, token);
this.topic = new Topic(backend, token);
this.peer = new Peer(backend, token);
}
}
4 changes: 0 additions & 4 deletions packages/atlas/src/chat.ts
Original file line number Diff line number Diff line change
@@ -41,10 +41,6 @@ export class Chat extends Base {
return await this.get({ route: `/api/v1/chat/room/members/${room}` });
}

async findSessionRoom(session: string): Promise<IRoom.FindSessionRoomApiResponse> {
return await this.get({ route: `/api/v1/chat/room/session/${session}` });
}

async updateRoom(
room: number,
payload: IRoom.UpdateRoomApiPayload
24 changes: 0 additions & 24 deletions packages/atlas/src/peer.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/atlas/src/session.ts

This file was deleted.

Loading