finalizing team support

This commit is contained in:
daniel31x13
2024-10-29 18:08:47 -04:00
parent b09de5a8af
commit 665019dc59
25 changed files with 511 additions and 201 deletions
+17 -8
View File
@@ -3,6 +3,7 @@ import Button from "../ui/Button";
import { useTranslation } from "next-i18next";
import { useDeleteUser } from "@/hooks/store/admin/users";
import { useState } from "react";
import { useSession } from "next-auth/react";
type Props = {
onClose: Function;
@@ -30,25 +31,33 @@ export default function DeleteUserModal({ onClose, userId }: Props) {
}
};
const { data } = useSession();
const isAdmin = data?.user?.id === Number(process.env.NEXT_PUBLIC_ADMIN);
return (
<Modal toggleModal={onClose}>
<p className="text-xl font-thin text-red-500">{t("delete_user")}</p>
<p className="text-xl font-thin text-red-500">
{isAdmin ? t("delete_user") : t("remove_user")}
</p>
<div className="divider mb-3 mt-1"></div>
<div className="flex flex-col gap-3">
<p>{t("confirm_user_deletion")}</p>
<p>{t("confirm_user_removal_desc")}</p>
<div role="alert" className="alert alert-warning">
<i className="bi-exclamation-triangle text-xl" />
<span>
<b>{t("warning")}:</b> {t("irreversible_action_warning")}
</span>
</div>
{isAdmin && (
<div role="alert" className="alert alert-warning">
<i className="bi-exclamation-triangle text-xl" />
<span>
<b>{t("warning")}:</b> {t("irreversible_action_warning")}
</span>
</div>
)}
<Button className="ml-auto" intent="destructive" onClick={submit}>
<i className="bi-trash text-xl" />
{t("delete_confirmation")}
{isAdmin ? t("delete_confirmation") : t("confirm")}
</Button>
</div>
</Modal>
@@ -150,12 +150,12 @@ export default function EditCollectionSharingModal({
<TextInput
value={memberUsername || ""}
className="bg-base-200"
placeholder={t("members_username_placeholder")}
placeholder={t("add_member_placeholder")}
onChange={(e) => setMemberUsername(e.target.value)}
onKeyDown={(e) =>
e.key === "Enter" &&
addMemberToCollection(
user.username as string,
user,
memberUsername || "",
collection,
setMemberState,
@@ -167,7 +167,7 @@ export default function EditCollectionSharingModal({
<div
onClick={() =>
addMemberToCollection(
user.username as string,
user,
memberUsername || "",
collection,
setMemberState,
+3 -3
View File
@@ -49,13 +49,13 @@ export default function InviteModal({ onClose }: Props) {
await addUser.mutateAsync(form, {
onSettled: () => {
setSubmitLoader(false);
signIn("invite", {
},
onSuccess: async () => {
await signIn("invite", {
email: form.email,
callbackUrl: "/member-onboarding",
redirect: false,
});
},
onSuccess: () => {
onClose();
},
});