create room instantly
This commit is contained in:
@@ -372,15 +372,19 @@ export default function DashboardRoom() {
|
|||||||
<span className="flex flex-col mr-auto">
|
<span className="flex flex-col mr-auto">
|
||||||
<span className="text-white ">
|
<span className="text-white ">
|
||||||
ROOMS
|
ROOMS
|
||||||
<button
|
<Tooltip
|
||||||
onClick={() =>
|
title={"Press q to create an instant room if you have GSuite."}
|
||||||
window.open("https://meet.google.com/new", "_blank")
|
|
||||||
}
|
|
||||||
className="right-1 rounded-lg py-1 px-2 ml-1
|
|
||||||
shadow-md text-center text-white text-sm font-bold"
|
|
||||||
>
|
>
|
||||||
CTRL + Q
|
<button
|
||||||
</button>
|
onClick={() =>
|
||||||
|
window.open("https://meet.google.com/new", "_blank")
|
||||||
|
}
|
||||||
|
className="right-1 rounded-lg py-1 px-2 ml-1
|
||||||
|
shadow-md text-center text-white text-sm font-bold"
|
||||||
|
>
|
||||||
|
Q
|
||||||
|
</button>
|
||||||
|
</Tooltip>
|
||||||
</span>
|
</span>
|
||||||
{relativeTimeNextMeeting ? (
|
{relativeTimeNextMeeting ? (
|
||||||
<span className="text-gray-300 text-xs">
|
<span className="text-gray-300 text-xs">
|
||||||
|
|||||||
@@ -79,14 +79,16 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
props.handleClose();
|
props.handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async (e) => {
|
const handleSubmit = async () => {
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
// make sure link, room, and type are selected
|
// make sure link, room, and type are selected
|
||||||
if (!roomLink || !roomName) {
|
if (!roomName) {
|
||||||
toast.error("Please fill in room link and name.");
|
toast.error("Please fill in room link and name.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!roomLink && !hasGSuite) {
|
||||||
|
toast.error("must provide room link if you don't have a GSuite");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const newRoom = new Room();
|
const newRoom = new Room();
|
||||||
@@ -95,16 +97,35 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
newRoom.attachments = [roomAttachment];
|
newRoom.attachments = [roomAttachment];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasGSuite) {
|
||||||
|
// create google meet link based on the room name without spaces
|
||||||
|
|
||||||
|
var slugName =
|
||||||
|
user.firstName +
|
||||||
|
"-" +
|
||||||
|
"room" +
|
||||||
|
moment(new Date()).format("dddddohmma");
|
||||||
|
slugName = slugName.replace(/\s/g, "-");
|
||||||
|
|
||||||
|
const autoLink =
|
||||||
|
"https://accounts.google.com/AccountChooser/signinchooser?continue=https://g.co/meet/" +
|
||||||
|
slugName;
|
||||||
|
|
||||||
|
newRoom.link = autoLink;
|
||||||
|
} else {
|
||||||
|
newRoom.link = roomLink;
|
||||||
|
}
|
||||||
|
|
||||||
if (roomType == RoomType.now) {
|
if (roomType == RoomType.now) {
|
||||||
// make sure approximate time isn't selected
|
// make sure approximate time isn't selected
|
||||||
newRoom.approximateDateTime = null;
|
newRoom.approximateDateTime = null;
|
||||||
newRoom.status = RoomStatus.live;
|
newRoom.status = RoomStatus.live;
|
||||||
|
|
||||||
// automatically add me to the room
|
// automatically add me to the room
|
||||||
newRoom.membersInRoom = [currUser.uid];
|
newRoom.membersInRoom = [];
|
||||||
|
|
||||||
// navigate to the new room automatically
|
// navigate to the new room automatically
|
||||||
window.open(roomLink, "_blank");
|
// window.open(roomLink, "_blank");
|
||||||
} else if (roomType == RoomType.scheduled) {
|
} else if (roomType == RoomType.scheduled) {
|
||||||
// make sure that either appx or time picker is selected, not both
|
// make sure that either appx or time picker is selected, not both
|
||||||
if (!dateTimePicker) {
|
if (!dateTimePicker) {
|
||||||
@@ -122,7 +143,6 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
newRoom.approximateDateTime = roomAppxDateTime;
|
newRoom.approximateDateTime = roomAppxDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
newRoom.link = roomLink;
|
|
||||||
newRoom.members = [...membersSelected]; // add currUser to the list of "people"
|
newRoom.members = [...membersSelected]; // add currUser to the list of "people"
|
||||||
newRoom.type = roomType;
|
newRoom.type = roomType;
|
||||||
newRoom.description = roomDescription;
|
newRoom.description = roomDescription;
|
||||||
@@ -133,6 +153,9 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
if (props.updateRoom) {
|
if (props.updateRoom) {
|
||||||
newRoom.id = props.updateRoom.id;
|
newRoom.id = props.updateRoom.id;
|
||||||
newRoom.membersInRoom = props.updateRoom.membersInRoom;
|
newRoom.membersInRoom = props.updateRoom.membersInRoom;
|
||||||
|
toast.success("updated room");
|
||||||
|
} else {
|
||||||
|
toast.success("created room");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(newRoom);
|
console.log(newRoom);
|
||||||
@@ -142,10 +165,8 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
await roomService.createOrUpdateRoom(newRoom);
|
await roomService.createOrUpdateRoom(newRoom);
|
||||||
|
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|
||||||
toast.success("done");
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("problem creating room");
|
toast.error("problem creating/updating room");
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -153,7 +174,9 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
function resetForm() {
|
function resetForm() {
|
||||||
setRoomLink("");
|
setRoomLink("");
|
||||||
setRoomName(
|
setRoomName(
|
||||||
user.firstName + "'s Room - " + moment(new Date()).format("dddd do")
|
user.firstName +
|
||||||
|
"'s Room - " +
|
||||||
|
moment(new Date()).format("dddd do h:mm a")
|
||||||
);
|
);
|
||||||
setRoomDescription("");
|
setRoomDescription("");
|
||||||
setMembersSelected([currUser.uid] as string[]);
|
setMembersSelected([currUser.uid] as string[]);
|
||||||
@@ -164,11 +187,13 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
setDateTimePicker(null);
|
setDateTimePicker(null);
|
||||||
|
|
||||||
setShowMoreDetails(false);
|
setShowMoreDetails(false);
|
||||||
|
|
||||||
|
sethasGSuite(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [roomLink, setRoomLink] = useState<string>(pastedLink ?? "");
|
const [roomLink, setRoomLink] = useState<string>(pastedLink ?? "");
|
||||||
const [roomName, setRoomName] = useState<string>(
|
const [roomName, setRoomName] = useState<string>(
|
||||||
user.firstName + "'s Room - " + moment(new Date()).format("dddd do")
|
user.firstName + "'s Room - " + moment(new Date()).format("dddd do h:mm a")
|
||||||
);
|
);
|
||||||
const [roomDescription, setRoomDescription] = useState<string>("");
|
const [roomDescription, setRoomDescription] = useState<string>("");
|
||||||
|
|
||||||
@@ -182,6 +207,7 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
const [dateTimePicker, setDateTimePicker] = useState(null);
|
const [dateTimePicker, setDateTimePicker] = useState(null);
|
||||||
|
|
||||||
const [showMoreDetails, setShowMoreDetails] = useState<boolean>(false);
|
const [showMoreDetails, setShowMoreDetails] = useState<boolean>(false);
|
||||||
|
const [hasGSuite, sethasGSuite] = useState<boolean>(true);
|
||||||
|
|
||||||
function handleSelectMember(value) {
|
function handleSelectMember(value) {
|
||||||
// passed in array of selections...userIds
|
// passed in array of selections...userIds
|
||||||
@@ -227,20 +253,22 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function createRoomNow() {
|
function createRoomNow() {
|
||||||
// show modal
|
console.log("creating room");
|
||||||
|
|
||||||
// enter a google meet link automaticall
|
// reset form for the right values to be in there
|
||||||
|
// resetForm();
|
||||||
|
|
||||||
// create a date based room name
|
// handleGetAutoGSuiteLink();
|
||||||
|
|
||||||
//
|
// submit form
|
||||||
|
// handleSubmit().then(() => {
|
||||||
console.log("creating room instantly");
|
// console.log("creating room instantly");
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyMap: KeyMap = {
|
const keyMap: KeyMap = {
|
||||||
CREATE_ROOM_NOW: {
|
CREATE_ROOM_NOW: {
|
||||||
name: "Stop recording",
|
name: "create room now",
|
||||||
sequence: "q",
|
sequence: "q",
|
||||||
action: "keyup",
|
action: "keyup",
|
||||||
},
|
},
|
||||||
@@ -260,35 +288,56 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) {
|
|||||||
<GlobalHotKeys keyMap={keyMap} handlers={handlers} />
|
<GlobalHotKeys keyMap={keyMap} handlers={handlers} />
|
||||||
|
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<span className="flex flex-col items-start">
|
{hasGSuite ? (
|
||||||
<span className="text-lg">Link</span>
|
<span className="flex flex-col items-start">
|
||||||
{roomLink ? (
|
<span className="text-lg">Link</span>
|
||||||
<span className="text-gray-300 text-xs mb-2">
|
<span className="text-gray-300 text-xs flex-1">
|
||||||
Please make sure this is valid so that your team can join
|
We'll create a link for you. Don't have a GSuite?{" "}
|
||||||
properly.
|
<button
|
||||||
</span>
|
onClick={() => sethasGSuite(false)}
|
||||||
) : (
|
className="text-blue-500"
|
||||||
<span className="text-xs mb-2">
|
|
||||||
<a
|
|
||||||
href="https://meet.google.com/new"
|
|
||||||
target={"_blank"}
|
|
||||||
rel={"noreferrer"}
|
|
||||||
className=""
|
|
||||||
>
|
>
|
||||||
Click here to create one
|
Click here.
|
||||||
</a>{" "}
|
</button>
|
||||||
and then come back and paste the link for your team.
|
|
||||||
</span>
|
</span>
|
||||||
)}
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="flex flex-col items-start">
|
||||||
|
<span className="text-lg">Link</span>
|
||||||
|
{roomLink ? (
|
||||||
|
<span className="text-gray-300 text-xs mb-2">
|
||||||
|
Please make sure this is valid so that your team can join
|
||||||
|
properly.
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="text-xs mb-2">
|
||||||
|
<a
|
||||||
|
href="https://meet.google.com/new"
|
||||||
|
target={"_blank"}
|
||||||
|
rel={"noreferrer"}
|
||||||
|
className=""
|
||||||
|
>
|
||||||
|
Click here to create one
|
||||||
|
</a>{" "}
|
||||||
|
and then come back and paste the link for your team.{" "}
|
||||||
|
<button
|
||||||
|
onClick={() => sethasGSuite(true)}
|
||||||
|
className="text-blue-500"
|
||||||
|
>
|
||||||
|
Have a GSuite? Click here.
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
|
||||||
<input
|
<input
|
||||||
autoFocus
|
autoFocus
|
||||||
className="w-full rounded-lg bg-gray-50 p-3"
|
className="w-full rounded-lg bg-gray-50 p-3"
|
||||||
value={roomLink}
|
value={roomLink}
|
||||||
placeholder="https://meet.google.com/xxx-xxxx"
|
placeholder="https://meet.google.com/xxx-xxxx"
|
||||||
onChange={(e) => setRoomLink(e.target.value)}
|
onChange={(e) => setRoomLink(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
)}
|
||||||
|
|
||||||
<span className="flex flex-col items-start flex-1 mt-4 ">
|
<span className="flex flex-col items-start flex-1 mt-4 ">
|
||||||
<span className="text-lg">Room Name</span>
|
<span className="text-lg">Room Name</span>
|
||||||
|
|||||||
@@ -337,9 +337,6 @@ export default function KeyboardContextProvider({ children }) {
|
|||||||
|
|
||||||
const handleKeyUp = useCallback(
|
const handleKeyUp = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
console.log("on key up");
|
|
||||||
console.log(event.keyCode);
|
|
||||||
|
|
||||||
// if was recording and released R, then stop recording and send message
|
// if was recording and released R, then stop recording and send message
|
||||||
if (event.keyCode == KeyCode.R && selectedTeammate && isRecording) {
|
if (event.keyCode == KeyCode.R && selectedTeammate && isRecording) {
|
||||||
console.log("stopped recording");
|
console.log("stopped recording");
|
||||||
@@ -394,8 +391,6 @@ export default function KeyboardContextProvider({ children }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(event.keyCode);
|
|
||||||
|
|
||||||
// recording
|
// recording
|
||||||
if (event.keyCode == KeyCode.R && !ctrlDown) {
|
if (event.keyCode == KeyCode.R && !ctrlDown) {
|
||||||
if (!audioInputDeviceId) {
|
if (!audioInputDeviceId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user