[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 <gurusainath007@gmail.com>
This commit is contained in:
Anmol Singh Bhatia 2024-03-26 15:13:26 +05:30 committed by GitHub
parent 7452e40134
commit ea728a385f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 18 additions and 16 deletions

View File

@ -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,

View File

@ -56,7 +56,7 @@ export const CycleCreateUpdateModal: React.FC<CycleModalProps> = (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<CycleModalProps> = (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.",
});
});
};

View File

@ -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",
});
});
}

View File

@ -143,7 +143,7 @@ export const BaseKanBanRoot: React.FC<IBaseKanBanLayout> = 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",
});
});
}

View File

@ -68,7 +68,7 @@ export const CreateUpdateModuleModal: React.FC<Props> = 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<Props> = 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,

View File

@ -209,8 +209,10 @@ export const CreateProjectForm: FC<Props> = 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
}
/>
)}
/>

View File

@ -166,8 +166,10 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (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}
/>
)}

View File

@ -11,7 +11,7 @@ type Props = {
export const ProjectLogo: React.FC<Props> = (props) => {
const { className, logo } = props;
if (logo && logo.in_use === "icon" && logo.icon)
if (logo?.in_use === "icon" && logo?.icon)
return (
<span
style={{
@ -23,12 +23,12 @@ export const ProjectLogo: React.FC<Props> = (props) => {
</span>
);
if (logo && logo.in_use === "emoji" && logo.emoji)
if (logo?.in_use === "emoji" && logo?.emoji)
return (
<span className={cn("text-base", className)}>
{logo.emoji.value?.split("-").map((emoji) => String.fromCodePoint(parseInt(emoji, 10)))}
</span>
);
return <span />;
return <></>;
};

View File

@ -54,7 +54,7 @@ export const CreateUpdateProjectViewModal: FC<Props> = 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.",
})
);
};