nice showing if incoming message from user or not
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { FaPlus, FaExternalLinkAlt, FaLink, FaBackward } from "react-icons/fa";
|
import {
|
||||||
|
FaPlus,
|
||||||
|
FaExternalLinkAlt,
|
||||||
|
FaLink,
|
||||||
|
FaBackward,
|
||||||
|
FaArrowCircleDown,
|
||||||
|
} from "react-icons/fa";
|
||||||
import { IoPulseOutline, IoRemoveOutline, IoTimer } from "react-icons/io5";
|
import { IoPulseOutline, IoRemoveOutline, IoTimer } from "react-icons/io5";
|
||||||
import { MdScreenShare } from "react-icons/md";
|
import { MdScreenShare } from "react-icons/md";
|
||||||
import { BsThreeDots } from "react-icons/bs";
|
import { BsThreeDots } from "react-icons/bs";
|
||||||
@@ -43,7 +49,7 @@ export default function TeamVoiceLine() {
|
|||||||
} = useKeyboardContext();
|
} = useKeyboardContext();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { teamid } = router.query;
|
const { teamid } = router.query;
|
||||||
const { team, user, userTeamMember, teamMembers, teamUsers } =
|
const { userTeamMember, teamUsers, messagesByTeamMate } =
|
||||||
useTeamDashboardContext();
|
useTeamDashboardContext();
|
||||||
|
|
||||||
// todo use a global is loading
|
// todo use a global is loading
|
||||||
@@ -99,13 +105,26 @@ export default function TeamVoiceLine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return teamUsers.map((tmember, i) => {
|
return teamUsers.map((tmember, i) => {
|
||||||
|
var isMessageIncoming: boolean = false;
|
||||||
|
if (tmember.id in messagesByTeamMate) {
|
||||||
|
console.log(messagesByTeamMate[tmember.id][0]);
|
||||||
|
if (messagesByTeamMate[tmember.id][0].receiverUserId == currUser.uid) {
|
||||||
|
isMessageIncoming = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var customSelectClasses: string = "";
|
||||||
|
if (tmember.id == selectedTeammate) {
|
||||||
|
customSelectClasses = "bg-white scale-150 z-20";
|
||||||
|
} else if (isMessageIncoming) {
|
||||||
|
customSelectClasses = "bg-orange-500 bg-opacity-20";
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
onClick={() => selectTeamMember(tmember.id)}
|
onClick={() => selectTeamMember(tmember.id)}
|
||||||
key={i}
|
key={i}
|
||||||
className={`rounded flex flex-row items-center py-2 px-2 justify-items-start ease-in-out duration-300 hover:cursor-pointer ${
|
className={`rounded flex flex-row items-center py-2 px-2 justify-items-start ease-in-out duration-300 hover:cursor-pointer ${customSelectClasses}`}
|
||||||
tmember.id == selectedTeammate ? "bg-white scale-150 z-20" : ""
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<span className="relative flex mr-2">
|
<span className="relative flex mr-2">
|
||||||
<span className="bg-gray-200 bg-opacity-30 rounded-full shadow-md absolute w-full h-full"></span>
|
<span className="bg-gray-200 bg-opacity-30 rounded-full shadow-md absolute w-full h-full"></span>
|
||||||
@@ -126,10 +145,16 @@ export default function TeamVoiceLine() {
|
|||||||
<span className="text-xs text-black font-bold">
|
<span className="text-xs text-black font-bold">
|
||||||
{tmember.nickName}
|
{tmember.nickName}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
{isMessageIncoming ? (
|
||||||
|
<FaArrowCircleDown className="text-orange-500" />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className={"text-xs span-sans text-gray-500"}>
|
<span className={"text-xs span-sans text-gray-500"}>
|
||||||
{tmember.teamRole}
|
{tmember.teamRole}{" "}
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@@ -139,6 +164,12 @@ export default function TeamVoiceLine() {
|
|||||||
{tmember.nickName}
|
{tmember.nickName}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
{isMessageIncoming ? (
|
||||||
|
<FaArrowCircleDown className="text-orange-500" />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
|
||||||
<span className="text-white shadow-xl font-bold px-3 py-1 rounded">
|
<span className="text-white shadow-xl font-bold px-3 py-1 rounded">
|
||||||
{/* keyboard shortcuts start from 1 */}
|
{/* keyboard shortcuts start from 1 */}
|
||||||
{i + 1}
|
{i + 1}
|
||||||
|
|||||||
@@ -397,7 +397,6 @@ export default function KeyboardContextProvider({ children }) {
|
|||||||
handleResetView();
|
handleResetView();
|
||||||
|
|
||||||
setCtrlDown(true);
|
setCtrlDown(true);
|
||||||
toast("control down");
|
|
||||||
} else if (event.keyCode == KeyCode.Q && ctrlDown) {
|
} else if (event.keyCode == KeyCode.Q && ctrlDown) {
|
||||||
toast("navigating to create google meet");
|
toast("navigating to create google meet");
|
||||||
|
|
||||||
@@ -432,7 +431,8 @@ export default function KeyboardContextProvider({ children }) {
|
|||||||
toast.error("Please enable permissions for clipboard");
|
toast.error("Please enable permissions for clipboard");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toast("Invalid keyboard shortcut.");
|
// toast("Invalid keyboard shortcut.");
|
||||||
|
console.log("no shortcut logged");
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo play message if pressing space
|
// todo play message if pressing space
|
||||||
|
|||||||
Reference in New Issue
Block a user