ENCOA-217: Adapted the invite system to now work based on Entities instead of Users/Groups
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Invite, InviteWithUsers} from "@/interfaces/invite";
|
||||
import {Invite, InviteWithEntity} from "@/interfaces/invite";
|
||||
import {User} from "@/interfaces/user";
|
||||
import {getUserName} from "@/utils/users";
|
||||
import axios from "axios";
|
||||
@@ -7,14 +7,14 @@ import {BsArrowRepeat} from "react-icons/bs";
|
||||
import {toast} from "react-toastify";
|
||||
|
||||
interface Props {
|
||||
invite: InviteWithUsers;
|
||||
invite: InviteWithEntity;
|
||||
reload: () => void;
|
||||
}
|
||||
|
||||
export default function InviteWithUserCard({invite, reload}: Props) {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const name = useMemo(() => (!invite.from ? null : getUserName(invite.from)), [invite.from]);
|
||||
const name = useMemo(() => (!invite.entity ? null : invite.entity.label), [invite.entity]);
|
||||
|
||||
const decide = (decision: "accept" | "decline") => {
|
||||
if (!confirm(`Are you sure you want to ${decision} this invite?`)) return;
|
||||
@@ -37,7 +37,7 @@ export default function InviteWithUserCard({invite, reload}: Props) {
|
||||
|
||||
return (
|
||||
<div className="border-mti-gray-anti-flash flex min-w-[200px] flex-col gap-6 rounded-xl border p-4 text-black">
|
||||
<span>Invited by {name}</span>
|
||||
<span>Invited to <b>{name}</b></span>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
onClick={() => decide("accept")}
|
||||
|
||||
Reference in New Issue
Block a user