ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: профиль, редиректы и визуальные статусы задач
This commit is contained in:
@@ -22,7 +22,7 @@ import { useUser } from "@/hooks/store/user";
|
||||
import { AuthService } from "@/services/auth.service";
|
||||
import userService from "@/services/user.service";
|
||||
|
||||
type Props = { isOpen: boolean; onClose: () => void };
|
||||
type Props = { isOpen: boolean; onClose: () => void; isSMTPConfigured?: boolean };
|
||||
|
||||
type TModalStep = "EMAIL" | "UNIQUE_CODE";
|
||||
type TUniqueCodeValuesForm = { email: string; code: string };
|
||||
@@ -33,7 +33,7 @@ const defaultValues: TUniqueCodeValuesForm = { email: "", code: "" };
|
||||
const authService = new AuthService();
|
||||
|
||||
export const ChangeEmailModal = observer(function ChangeEmailModal(props: Props) {
|
||||
const { isOpen, onClose } = props;
|
||||
const { isOpen, onClose, isSMTPConfigured = true } = props;
|
||||
// states
|
||||
const [currentStep, setCurrentStep] = useState<TModalStep>("EMAIL");
|
||||
// store hooks
|
||||
@@ -107,6 +107,20 @@ export const ChangeEmailModal = observer(function ChangeEmailModal(props: Props)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSMTPConfigured) {
|
||||
await userService.updateEmailDirect({ email: formData.email });
|
||||
|
||||
setToast({
|
||||
type: TOAST_TYPE.SUCCESS,
|
||||
title: changeEmailT("toasts.success_title"),
|
||||
message: changeEmailT("toasts.success_message"),
|
||||
});
|
||||
|
||||
await handleSignOut();
|
||||
handleClose();
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate verification code and send to new email
|
||||
await userService.generateEmailCode({ email: formData.email });
|
||||
|
||||
@@ -135,7 +149,9 @@ export const ChangeEmailModal = observer(function ChangeEmailModal(props: Props)
|
||||
<ModalCore isOpen={isOpen} handleClose={handleClose} position={EModalPosition.CENTER} width={EModalWidth.XXL}>
|
||||
<div className="space-y-0 px-4 py-4">
|
||||
<h3 className="text-16 leading-6 font-medium text-primary">{changeEmailT("title")}</h3>
|
||||
<p className="my-4 text-13 text-secondary">{changeEmailT("description")}</p>
|
||||
<p className="my-4 text-13 text-secondary">
|
||||
{isSMTPConfigured ? changeEmailT("description") : changeEmailT("direct_description")}
|
||||
</p>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-4 px-4" noValidate>
|
||||
<div className="flex flex-col gap-1">
|
||||
|
||||
@@ -225,6 +225,7 @@ const HomeInternalContourDeckCard = observer(function HomeInternalContourDeckCar
|
||||
>
|
||||
<NodedcWorkItemCard
|
||||
isActive={isActive}
|
||||
priority={issue.priority}
|
||||
surfaceClassName={cn(
|
||||
"nodedc-home-task-card-surface px-0",
|
||||
compact && "!rounded-[24px]",
|
||||
@@ -276,6 +277,7 @@ const HomeExternalContourDeckCard = observer(function HomeExternalContourDeckCar
|
||||
>
|
||||
<div
|
||||
data-active={isActive}
|
||||
data-priority={issue.priority ?? "none"}
|
||||
className={cn(
|
||||
"nodedc-external-card nodedc-home-task-card-surface relative flex w-full flex-col",
|
||||
compact ? "min-h-[168px] rounded-[24px] p-3" : "min-h-[220px] p-4",
|
||||
|
||||
@@ -74,6 +74,7 @@ export const InboxIssueListItem = observer(function InboxIssueListItem(props: In
|
||||
>
|
||||
<NodedcWorkItemCard
|
||||
isActive={isActive}
|
||||
priority={issue.priority}
|
||||
surfaceClassName="transition-transform duration-200 hover:-translate-y-0.5"
|
||||
header={
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
|
||||
+1
@@ -215,6 +215,7 @@ export const InternalContourKanbanCard = observer(function InternalContourKanban
|
||||
return (
|
||||
<NodedcWorkItemCard
|
||||
isActive={isActive}
|
||||
priority={issue.priority}
|
||||
surfaceClassName="!rounded-[24px] !p-0"
|
||||
contentClassName="min-h-[220px]"
|
||||
header={header}
|
||||
|
||||
+5
@@ -5,10 +5,12 @@
|
||||
*/
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import type { TIssuePriorities } from "@plane/types";
|
||||
import { cn } from "@plane/utils";
|
||||
|
||||
type TNodedcWorkItemCardProps = {
|
||||
isActive: boolean;
|
||||
priority?: TIssuePriorities | null;
|
||||
header: ReactNode;
|
||||
title: ReactNode;
|
||||
footer: ReactNode;
|
||||
@@ -37,6 +39,7 @@ export const getNodedcWorkItemCardAppearance = (isActive: boolean) => ({
|
||||
|
||||
export const NodedcWorkItemCard = ({
|
||||
isActive,
|
||||
priority,
|
||||
header,
|
||||
title,
|
||||
footer,
|
||||
@@ -52,6 +55,8 @@ export const NodedcWorkItemCard = ({
|
||||
|
||||
return (
|
||||
<div
|
||||
data-active={isActive}
|
||||
data-priority={priority ?? "none"}
|
||||
className={cn(
|
||||
"nodedc-work-item-card rounded-[28px] border-0 p-4 shadow-none ring-0 outline-none",
|
||||
appearance.surfaceClassName,
|
||||
|
||||
+13
-13
@@ -191,7 +191,11 @@ export const GeneralProfileSettingsForm = observer(function GeneralProfileSettin
|
||||
return (
|
||||
<>
|
||||
<DeactivateAccountModal isOpen={deactivateAccountModal} onClose={() => setDeactivateAccountModal(false)} />
|
||||
<ChangeEmailModal isOpen={isChangeEmailModalOpen} onClose={() => setIsChangeEmailModalOpen(false)} />
|
||||
<ChangeEmailModal
|
||||
isOpen={isChangeEmailModalOpen}
|
||||
onClose={() => setIsChangeEmailModalOpen(false)}
|
||||
isSMTPConfigured={isSMTPConfigured}
|
||||
/>
|
||||
<Controller
|
||||
control={control}
|
||||
name="avatar_url"
|
||||
@@ -371,23 +375,19 @@ export const GeneralProfileSettingsForm = observer(function GeneralProfileSettin
|
||||
ref={ref}
|
||||
hasError={Boolean(errors.email)}
|
||||
placeholder={t("profile_general.email_placeholder")}
|
||||
className={`nodedc-settings-input w-full cursor-not-allowed !bg-white/4 ${
|
||||
errors.email ? "border-danger-strong" : ""
|
||||
}`}
|
||||
className={`nodedc-settings-input w-full !bg-white/4 ${errors.email ? "border-danger-strong" : ""}`}
|
||||
autoComplete="on"
|
||||
disabled
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{isSMTPConfigured && (
|
||||
<button
|
||||
type="button"
|
||||
className="nodedc-settings-chip flex w-fit items-center gap-2 px-3.5 py-1.5 text-12 font-medium text-primary"
|
||||
onClick={() => setIsChangeEmailModalOpen(true)}
|
||||
>
|
||||
{t("account_settings.profile.change_email_modal.title")}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="nodedc-settings-chip flex w-fit items-center gap-2 px-3.5 py-1.5 text-12 font-medium text-primary"
|
||||
onClick={() => setIsChangeEmailModalOpen(true)}
|
||||
>
|
||||
{t("account_settings.profile.change_email_modal.title")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user