From ea728a385ff509e9ae15353ba2df9ec6cee278e6 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 26 Mar 2024 15:13:26 +0530 Subject: [PATCH] [WEB-831] fix: sentry issue and code refactor (#4063) * chore: unnecessary console log removed * chore: in_use sentry issue resolved * chore: detail sentry issue resolved * fix: updated project logo validation in project icon --------- Co-authored-by: gurusainath --- web/components/command-palette/command-palette.tsx | 2 -- web/components/cycles/modal.tsx | 4 ++-- .../issues/issue-layouts/calendar/base-calendar-root.tsx | 2 +- .../issues/issue-layouts/kanban/base-kanban-root.tsx | 2 +- web/components/modules/modal.tsx | 4 ++-- web/components/project/create-project-form.tsx | 6 ++++-- web/components/project/form.tsx | 6 ++++-- web/components/project/project-logo.tsx | 6 +++--- web/components/views/modal.tsx | 2 +- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/web/components/command-palette/command-palette.tsx b/web/components/command-palette/command-palette.tsx index 8d162f6ab..490d392e2 100644 --- a/web/components/command-palette/command-palette.tsx +++ b/web/components/command-palette/command-palette.tsx @@ -113,8 +113,6 @@ export const CommandPalette: FC = observer(() => { const canPerformWorkspaceCreateActions = useCallback( (showToast: boolean = true) => { const isAllowed = !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; - console.log("currentWorkspaceRole", currentWorkspaceRole); - console.log("isAllowed", isAllowed); if (!isAllowed && showToast) setToast({ type: TOAST_TYPE.ERROR, diff --git a/web/components/cycles/modal.tsx b/web/components/cycles/modal.tsx index 008cdcbde..6ed53eb32 100644 --- a/web/components/cycles/modal.tsx +++ b/web/components/cycles/modal.tsx @@ -56,7 +56,7 @@ export const CycleCreateUpdateModal: React.FC = (props) => { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", - message: err.detail ?? "Error in creating cycle. Please try again.", + message: err?.detail ?? "Error in creating cycle. Please try again.", }); captureCycleEvent({ eventName: CYCLE_CREATED, @@ -90,7 +90,7 @@ export const CycleCreateUpdateModal: React.FC = (props) => { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", - message: err.detail ?? "Error in updating cycle. Please try again.", + message: err?.detail ?? "Error in updating cycle. Please try again.", }); }); }; diff --git a/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx b/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx index 9e54d2cf7..d5b263776 100644 --- a/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx +++ b/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx @@ -73,7 +73,7 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => { setToast({ title: "Error", type: TOAST_TYPE.ERROR, - message: err.detail ?? "Failed to perform this action", + message: err?.detail ?? "Failed to perform this action", }); }); } diff --git a/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx b/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx index 21e47c1cd..410430853 100644 --- a/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx +++ b/web/components/issues/issue-layouts/kanban/base-kanban-root.tsx @@ -143,7 +143,7 @@ export const BaseKanBanRoot: React.FC = observer((props: IBas setToast({ title: "Error", type: TOAST_TYPE.ERROR, - message: err.detail ?? "Failed to perform this action", + message: err?.detail ?? "Failed to perform this action", }); }); } diff --git a/web/components/modules/modal.tsx b/web/components/modules/modal.tsx index 7242073b1..89ae7f321 100644 --- a/web/components/modules/modal.tsx +++ b/web/components/modules/modal.tsx @@ -68,7 +68,7 @@ export const CreateUpdateModuleModal: React.FC = observer((props) => { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", - message: err.detail ?? "Module could not be created. Please try again.", + message: err?.detail ?? "Module could not be created. Please try again.", }); captureModuleEvent({ eventName: MODULE_CREATED, @@ -99,7 +99,7 @@ export const CreateUpdateModuleModal: React.FC = observer((props) => { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", - message: err.detail ?? "Module could not be updated. Please try again.", + message: err?.detail ?? "Module could not be updated. Please try again.", }); captureModuleEvent({ eventName: MODULE_UPDATED, diff --git a/web/components/project/create-project-form.tsx b/web/components/project/create-project-form.tsx index a9d76210d..14d723e6d 100644 --- a/web/components/project/create-project-form.tsx +++ b/web/components/project/create-project-form.tsx @@ -209,8 +209,10 @@ export const CreateProjectForm: FC = observer((props) => { [val.type]: logoValue, }); }} - defaultIconColor={value.in_use === "icon" ? value.icon?.color : undefined} - defaultOpen={value.in_use === "emoji" ? EmojiIconPickerTypes.EMOJI : EmojiIconPickerTypes.ICON} + defaultIconColor={value.in_use && value.in_use === "icon" ? value.icon?.color : undefined} + defaultOpen={ + value.in_use && value.in_use === "emoji" ? EmojiIconPickerTypes.EMOJI : EmojiIconPickerTypes.ICON + } /> )} /> diff --git a/web/components/project/form.tsx b/web/components/project/form.tsx index aaaaf03b3..3e770a618 100644 --- a/web/components/project/form.tsx +++ b/web/components/project/form.tsx @@ -166,8 +166,10 @@ export const ProjectDetailsForm: FC = (props) => { [val.type]: logoValue, }); }} - defaultIconColor={value.in_use === "icon" ? value.icon?.color : undefined} - defaultOpen={value.in_use === "emoji" ? EmojiIconPickerTypes.EMOJI : EmojiIconPickerTypes.ICON} + defaultIconColor={value?.in_use && value.in_use === "icon" ? value?.icon?.color : undefined} + defaultOpen={ + value.in_use && value.in_use === "emoji" ? EmojiIconPickerTypes.EMOJI : EmojiIconPickerTypes.ICON + } disabled={!isAdmin} /> )} diff --git a/web/components/project/project-logo.tsx b/web/components/project/project-logo.tsx index c06dc3061..fc90fdba3 100644 --- a/web/components/project/project-logo.tsx +++ b/web/components/project/project-logo.tsx @@ -11,7 +11,7 @@ type Props = { export const ProjectLogo: React.FC = (props) => { const { className, logo } = props; - if (logo && logo.in_use === "icon" && logo.icon) + if (logo?.in_use === "icon" && logo?.icon) return ( = (props) => { ); - if (logo && logo.in_use === "emoji" && logo.emoji) + if (logo?.in_use === "emoji" && logo?.emoji) return ( {logo.emoji.value?.split("-").map((emoji) => String.fromCodePoint(parseInt(emoji, 10)))} ); - return ; + return <>; }; diff --git a/web/components/views/modal.tsx b/web/components/views/modal.tsx index c7b9c9a31..6e30a76ec 100644 --- a/web/components/views/modal.tsx +++ b/web/components/views/modal.tsx @@ -54,7 +54,7 @@ export const CreateUpdateProjectViewModal: FC = observer((props) => { setToast({ type: TOAST_TYPE.ERROR, title: "Error!", - message: err.detail ?? "Something went wrong. Please try again.", + message: err?.detail ?? "Something went wrong. Please try again.", }) ); };