meeting page frontend fixes

This commit is contained in:
Igor Loskutov
2025-09-17 12:18:25 -04:00
parent 3bd2190aa8
commit 1764c591c4
16 changed files with 259 additions and 67 deletions

View File

@@ -12,7 +12,7 @@ import { useAuth } from "./AuthProvider";
* or, limitation or incorrect usage of .d type generator from json schema
* */
const useAuthReady = () => {
export const useAuthReady = () => {
const auth = useAuth();
return {
@@ -695,8 +695,6 @@ const MEETING_LIST_PATH_PARTIALS = [
];
export function useRoomActiveMeetings(roomName: string | null) {
const { isAuthenticated } = useAuthReady();
return $api.useQuery(
"get",
"/v1/rooms/{room_name}/meetings/active" satisfies `/v1/rooms/{room_name}/${typeof MEETINGS_ACTIVE_PATH_PARTIAL}`,
@@ -706,7 +704,28 @@ export function useRoomActiveMeetings(roomName: string | null) {
},
},
{
enabled: !!roomName && isAuthenticated,
enabled: !!roomName,
},
);
}
export function useRoomGetMeeting(
roomName: string | null,
meetingId: string | null,
) {
return $api.useQuery(
"get",
"/v1/rooms/{room_name}/meetings/{meeting_id}",
{
params: {
path: {
room_name: roomName!,
meeting_id: meetingId!,
},
},
},
{
enabled: !!roomName && !!meetingId,
},
);
}

View File

@@ -1 +1,7 @@
export const roomUrl = (roomName: string) => `/${roomName}`;
import { NonEmptyString } from "./utils";
export const roomUrl = (roomName: NonEmptyString) => `/${roomName}`;
export const roomMeetingUrl = (
roomName: NonEmptyString,
meetingId: NonEmptyString,
) => `${roomUrl(roomName)}/${meetingId}`;

View File

@@ -1,4 +1,5 @@
import { roomUrl } from "./routes";
import { NonEmptyString } from "./utils";
export const roomAbsoluteUrl = (roomName: string) =>
export const roomAbsoluteUrl = (roomName: NonEmptyString) =>
`${window.location.origin}${roomUrl(roomName)}`;

View File

@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
import { components } from "../reflector-api";
export const useWhereby = () => {
const [wherebyLoaded, setWherebyLoaded] = useState(false);
@@ -13,3 +14,9 @@ export const useWhereby = () => {
}, []);
return wherebyLoaded;
};
export const getWherebyUrl = (
meeting: Pick<components["schemas"]["Meeting"], "room_url" | "host_room_url">,
) =>
// host_room_url possible '' atm
meeting.host_room_url || meeting.room_url;