Fix: missing fields and moveing to mutation

This commit is contained in:
Tainan Felipe 2024-04-03 21:54:32 -03:00
parent 901d2a7fbb
commit 4393bc4ea6
3 changed files with 64 additions and 68 deletions

View File

@ -1,4 +1,4 @@
import { useSubscription } from '@apollo/client';
import { useMutation, useSubscription } from '@apollo/client';
import React, { useEffect, useMemo } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import Styled from './styles';
@ -10,8 +10,8 @@ import {
getBreakoutData,
GetBreakoutDataResponse,
} from './queries';
import { requestJoinURL } from './service';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import { BREAKOUT_ROOM_REQUEST_JOIN_URL } from '../../breakout-room/mutations';
const intlMessages = defineMessages({
title: {
@ -59,11 +59,16 @@ const BreakoutJoinConfirmation: React.FC<BreakoutJoinConfirmationProps> = ({
breakouts,
currentUserJoined,
}) => {
const [breakoutRoomRequestJoinURL] = useMutation(BREAKOUT_ROOM_REQUEST_JOIN_URL);
const intl = useIntl();
const [waiting, setWaiting] = React.useState(false);
const [isOpen, setIsOpen] = React.useState(false);
const [selectValue, setSelectValue] = React.useState('');
const requestJoinURL = (breakoutRoomId: string) => {
breakoutRoomRequestJoinURL({ variables: { breakoutRoomId } });
};
const handleSelectChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
setSelectValue(event.target.value);
const selectedBreakout = breakouts.find(({ breakoutRoomId }) => breakoutRoomId === event.target.value);
@ -157,7 +162,7 @@ const BreakoutJoinConfirmation: React.FC<BreakoutJoinConfirmationProps> = ({
};
const BreakoutJoinConfirmationContainer: React.FC = () => {
const { data: currentUser, loading: currentUserLoading } = useCurrentUser((u) => {
const { data: currentUser } = useCurrentUser((u) => {
return {
isModerator: u.isModerator,
breakoutRooms: u.breakoutRooms,
@ -165,14 +170,10 @@ const BreakoutJoinConfirmationContainer: React.FC = () => {
});
const {
data: breakoutData,
loading: breakoutDataLoading,
error: breakoutDataError,
} = useSubscription<GetBreakoutDataResponse>(getBreakoutData);
const {
data: breakoutCountData,
loading: breakoutCountLoading,
error: breakoutCountError,
} = useSubscription<GetBreakoutCountResponse>(getBreakoutCount);
if (!breakoutCountData || !breakoutCountData.breakoutRoom_aggregate.aggregate.count) return null;
if (!breakoutData || breakoutData.breakoutRoom.length === 0) return null;

View File

@ -1,11 +0,0 @@
import { makeCall } from '/imports/ui/services/api';
export const requestJoinURL = (breakoutId: string) => {
makeCall('requestJoinURL', {
breakoutId,
});
};
export default {
requestJoinURL,
};

View File

@ -17,61 +17,67 @@ subscription userCurrentSubscription {
ejected
emoji
enforceLayout
cameras {
streamId
}
clientType
color
customParameters {
parameter
value
}
disconnected
away
raiseHand
emoji
extId
guest
guestStatus
hasDrawPermissionOnCurrentPage
isDialIn
isModerator
joined
userId
breakoutRooms {
currentRoomJoined
assignedAt
breakoutRoomId
currentRoomPriority
currentRoomRegisteredAt
durationInSeconds
endedAt
freeJoin
inviteDismissedAt
isDefaultName
joinURL
lastRoomIsOnline
lastRoomJoinedAt
lastRoomJoinedId
expired
extId
guest
guestStatus
hasDrawPermissionOnCurrentPage
inactivityWarningDisplay
inactivityWarningTimeoutSecs
isDialIn
isModerator
isOnline
isRunningEchoTest
joinErrorCode
joinErrorMessage
joined
locked
loggedOut
mobile
name
sendInvitationToModerators
sequence
shortName
showInvitation
startedAt
currentRoomIsOnline
}
lastBreakoutRoom {
breakoutRoomId
currentlyInRoom
isDefaultName
sequence
shortName
}
nameSortable
pinned
presenter
raiseHand
registeredAt
registeredOn
role
speechLocale
userId
customParameters {
parameter
value
}
breakoutRooms {
currentRoomJoined
assignedAt
breakoutRoomId
currentRoomPriority
currentRoomRegisteredAt
durationInSeconds
endedAt
freeJoin
inviteDismissedAt
isDefaultName
joinURL
lastRoomIsOnline
lastRoomJoinedAt
lastRoomJoinedId
name
sendInvitationToModerators
sequence
shortName
showInvitation
startedAt
currentRoomIsOnline
}
lastBreakoutRoom {
breakoutRoomId
currentlyInRoom
isDefaultName
sequence
shortName
}
cameras {
streamId
}