chore: typos and refactor

This commit is contained in:
Ramesh Kumar Chandra 2024-04-26 19:28:05 +05:30
parent e75947a5f4
commit 58de5bfd6a
15 changed files with 49 additions and 50 deletions

View File

@ -47,7 +47,7 @@ export const ActiveCycleHeader: FC<ActiveCycleHeaderProps> = (props) => {
</div> </div>
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<div className="rounded-sm text-sm"> <div className="rounded-sm text-sm">
<div className="flex gap-2 divide-x spac divide-x-border-300 text-sm whitespace-nowrap text-custom-text-300 font-medium"> <div className="flex gap-2 divide-x divide-x-border-300 text-sm whitespace-nowrap text-custom-text-300 font-medium">
<Avatar name={cycleOwnerDetails?.display_name} src={cycleOwnerDetails?.avatar} /> <Avatar name={cycleOwnerDetails?.display_name} src={cycleOwnerDetails?.avatar} />
{cycleAssignee.length > 0 && ( {cycleAssignee.length > 0 && (
<span className="pl-2"> <span className="pl-2">

View File

@ -98,7 +98,7 @@ export const DeleteEstimateModal: React.FC<Props> = observer((props) => {
<p className="break-words text-sm leading-7 text-custom-text-200"> <p className="break-words text-sm leading-7 text-custom-text-200">
Are you sure you want to delete estimate-{" "} Are you sure you want to delete estimate-{" "}
<span className="break-words font-medium text-custom-text-100">{data?.name}</span> <span className="break-words font-medium text-custom-text-100">{data?.name}</span>
{""}? All of the data related to the estiamte will be permanently removed. This action cannot be {""}? All of the data related to the estimate will be permanently removed. This action cannot be
undone. undone.
</p> </p>
</span> </span>

View File

@ -122,7 +122,7 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
const stateDetails = getStateById(issue.state_id); const stateDetails = getStateById(issue.state_id);
// auth // auth
const isArchivingAllowed = !is_archived && issueOperations.archive && isEditable; const isArchivingAllowed = !is_archived && issueOperations.archive && isEditable;
const isInArchivableGroup = const isInArchiveGroup =
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group); !!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
const minDate = issue.start_date ? getDate(issue.start_date) : null; const minDate = issue.start_date ? getDate(issue.start_date) : null;
@ -164,19 +164,19 @@ export const IssueDetailsSidebar: React.FC<Props> = observer((props) => {
{isArchivingAllowed && ( {isArchivingAllowed && (
<Tooltip <Tooltip
isMobile={isMobile} isMobile={isMobile}
tooltipContent={isInArchivableGroup ? "Archive" : "Only completed or canceled issues can be archived"} tooltipContent={isInArchiveGroup ? "Archive" : "Only completed or canceled issues can be archived"}
> >
<button <button
type="button" type="button"
className={cn( className={cn(
"grid h-5 w-5 place-items-center rounded focus:outline-none focus:ring-2 focus:ring-custom-primary", "grid h-5 w-5 place-items-center rounded focus:outline-none focus:ring-2 focus:ring-custom-primary",
{ {
"hover:text-custom-text-200": isInArchivableGroup, "hover:text-custom-text-200": isInArchiveGroup,
"cursor-not-allowed text-custom-text-400": !isInArchivableGroup, "cursor-not-allowed text-custom-text-400": !isInArchiveGroup,
} }
)} )}
onClick={() => { onClick={() => {
if (!isInArchivableGroup) return; if (!isInArchiveGroup) return;
setArchiveIssueModal(true); setArchiveIssueModal(true);
}} }}
> >

View File

@ -45,7 +45,7 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = observer((props
const isEditingAllowed = !readOnly; const isEditingAllowed = !readOnly;
// auth // auth
const isArchivingAllowed = handleArchive && isEditingAllowed; const isArchivingAllowed = handleArchive && isEditingAllowed;
const isInArchivableGroup = const isInArchiveGroup =
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group); !!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
const issueLink = `${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`; const issueLink = `${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`;
@ -143,8 +143,8 @@ export const AllIssueQuickActions: React.FC<IQuickActionProps> = observer((props
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
)} )}
{isArchivingAllowed && ( {isArchivingAllowed && (
<CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchivableGroup}> <CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchiveGroup}>
{isInArchivableGroup ? ( {isInArchiveGroup ? (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<ArchiveIcon className="h-3 w-3" /> <ArchiveIcon className="h-3 w-3" />
Archive Archive

View File

@ -53,7 +53,7 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = observer((pro
// auth // auth
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER && !readOnly; const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER && !readOnly;
const isArchivingAllowed = handleArchive && isEditingAllowed; const isArchivingAllowed = handleArchive && isEditingAllowed;
const isInArchivableGroup = const isInArchiveGroup =
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group); !!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
const isDeletingAllowed = isEditingAllowed; const isDeletingAllowed = isEditingAllowed;
@ -170,8 +170,8 @@ export const CycleIssueQuickActions: React.FC<IQuickActionProps> = observer((pro
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
)} )}
{isArchivingAllowed && ( {isArchivingAllowed && (
<CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchivableGroup}> <CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchiveGroup}>
{isInArchivableGroup ? ( {isInArchiveGroup ? (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<ArchiveIcon className="h-3 w-3" /> <ArchiveIcon className="h-3 w-3" />
Archive Archive

View File

@ -52,7 +52,7 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = observer((pr
// auth // auth
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER && !readOnly; const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER && !readOnly;
const isArchivingAllowed = handleArchive && isEditingAllowed; const isArchivingAllowed = handleArchive && isEditingAllowed;
const isInArchivableGroup = const isInArchiveGroup =
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group); !!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
const isDeletingAllowed = isEditingAllowed; const isDeletingAllowed = isEditingAllowed;
@ -166,8 +166,8 @@ export const ModuleIssueQuickActions: React.FC<IQuickActionProps> = observer((pr
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
)} )}
{isArchivingAllowed && ( {isArchivingAllowed && (
<CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchivableGroup}> <CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchiveGroup}>
{isInArchivableGroup ? ( {isInArchiveGroup ? (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<ArchiveIcon className="h-3 w-3" /> <ArchiveIcon className="h-3 w-3" />
Archive Archive

View File

@ -51,7 +51,7 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = observer((p
// auth // auth
const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER && !readOnly; const isEditingAllowed = !!currentProjectRole && currentProjectRole >= EUserProjectRoles.MEMBER && !readOnly;
const isArchivingAllowed = handleArchive && isEditingAllowed; const isArchivingAllowed = handleArchive && isEditingAllowed;
const isInArchivableGroup = const isInArchiveGroup =
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group); !!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
const isDeletingAllowed = isEditingAllowed; const isDeletingAllowed = isEditingAllowed;
@ -155,8 +155,8 @@ export const ProjectIssueQuickActions: React.FC<IQuickActionProps> = observer((p
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
)} )}
{isArchivingAllowed && ( {isArchivingAllowed && (
<CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchivableGroup}> <CustomMenu.MenuItem onClick={() => setArchiveIssueModal(true)} disabled={!isInArchiveGroup}>
{isInArchivableGroup ? ( {isInArchiveGroup ? (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<ArchiveIcon className="h-3 w-3" /> <ArchiveIcon className="h-3 w-3" />
Archive Archive

View File

@ -101,7 +101,7 @@ export const IssuePeekOverviewHeader: FC<PeekOverviewHeaderProps> = observer((pr
}; };
// auth // auth
const isArchivingAllowed = !isArchived && !disabled; const isArchivingAllowed = !isArchived && !disabled;
const isInArchivableGroup = const isInArchiveGroup =
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group); !!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
const isRestoringAllowed = isArchived && !disabled; const isRestoringAllowed = isArchived && !disabled;
@ -168,16 +168,16 @@ export const IssuePeekOverviewHeader: FC<PeekOverviewHeaderProps> = observer((pr
{isArchivingAllowed && ( {isArchivingAllowed && (
<Tooltip <Tooltip
isMobile={isMobile} isMobile={isMobile}
tooltipContent={isInArchivableGroup ? "Archive" : "Only completed or canceled issues can be archived"} tooltipContent={isInArchiveGroup ? "Archive" : "Only completed or canceled issues can be archived"}
> >
<button <button
type="button" type="button"
className={cn("text-custom-text-300", { className={cn("text-custom-text-300", {
"hover:text-custom-text-200": isInArchivableGroup, "hover:text-custom-text-200": isInArchiveGroup,
"cursor-not-allowed text-custom-text-400": !isInArchivableGroup, "cursor-not-allowed text-custom-text-400": !isInArchiveGroup,
})} })}
onClick={() => { onClick={() => {
if (!isInArchivableGroup) return; if (!isInArchiveGroup) return;
toggleArchiveIssueModal(true); toggleArchiveIssueModal(true);
}} }}
> >

View File

@ -42,7 +42,7 @@ export const ModuleQuickActions: React.FC<Props> = observer((props) => {
!!currentWorkspaceAllProjectsRole && currentWorkspaceAllProjectsRole[projectId] >= EUserProjectRoles.MEMBER; !!currentWorkspaceAllProjectsRole && currentWorkspaceAllProjectsRole[projectId] >= EUserProjectRoles.MEMBER;
const moduleState = moduleDetails?.status?.toLocaleLowerCase(); const moduleState = moduleDetails?.status?.toLocaleLowerCase();
const isInArchivableGroup = !!moduleState && ["completed", "cancelled"].includes(moduleState); const isInArchiveGroup = !!moduleState && ["completed", "cancelled"].includes(moduleState);
const handleCopyText = (e: React.MouseEvent<HTMLButtonElement>) => { const handleCopyText = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation(); e.stopPropagation();
@ -128,8 +128,8 @@ export const ModuleQuickActions: React.FC<Props> = observer((props) => {
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
)} )}
{isEditingAllowed && !isArchived && ( {isEditingAllowed && !isArchived && (
<CustomMenu.MenuItem onClick={handleArchiveModule} disabled={!isInArchivableGroup}> <CustomMenu.MenuItem onClick={handleArchiveModule} disabled={!isInArchiveGroup}>
{isInArchivableGroup ? ( {isInArchiveGroup ? (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<ArchiveIcon className="h-3 w-3" /> <ArchiveIcon className="h-3 w-3" />
Archive module Archive module

View File

@ -89,7 +89,7 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
const moduleDetails = getModuleById(moduleId); const moduleDetails = getModuleById(moduleId);
const moduleState = moduleDetails?.status?.toLocaleLowerCase(); const moduleState = moduleDetails?.status?.toLocaleLowerCase();
const isInArchivableGroup = !!moduleState && ["completed", "cancelled"].includes(moduleState); const isInArchiveGroup = !!moduleState && ["completed", "cancelled"].includes(moduleState);
const { reset, control } = useForm({ const { reset, control } = useForm({
defaultValues, defaultValues,
@ -354,8 +354,8 @@ export const ModuleDetailsSidebar: React.FC<Props> = observer((props) => {
{isEditingAllowed && ( {isEditingAllowed && (
<CustomMenu placement="bottom-end" ellipsis> <CustomMenu placement="bottom-end" ellipsis>
{!isArchived && ( {!isArchived && (
<CustomMenu.MenuItem onClick={() => setArchiveModuleModal(true)} disabled={!isInArchivableGroup}> <CustomMenu.MenuItem onClick={() => setArchiveModuleModal(true)} disabled={!isInArchiveGroup}>
{isInArchivableGroup ? ( {isInArchiveGroup ? (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<ArchiveIcon className="h-3 w-3" /> <ArchiveIcon className="h-3 w-3" />
Archive module Archive module

View File

@ -29,7 +29,7 @@ const PROJECT_FEATURES_LIST = [
}, },
{ {
title: "Views", title: "Views",
description: "Apply filters to issues and save them to analyse and investigate work.", description: "Apply filters to issues and save them to analyze and investigate work.",
icon: <PhotoFilterIcon className="h-4 w-4 flex-shrink-0 text-cyan-500" />, icon: <PhotoFilterIcon className="h-4 w-4 flex-shrink-0 text-cyan-500" />,
property: "issue_views_view", property: "issue_views_view",
}, },

View File

@ -19,11 +19,10 @@ export const ProfilePreferenceSettingsLayout: FC<IProfilePreferenceSettingsLayou
const router = useRouter(); const router = useRouter();
const { theme: themeStore } = useApplication(); const { theme: themeStore } = useApplication();
const showMenuItem = () => { const showMenuLabel = () => {
const item = router.asPath.split("/"); const path = router.asPath.split("/");
let splittedItem = item[item.length - 1]; const menuLabel = path[path.length - 1];
splittedItem = splittedItem.replace(splittedItem[0], splittedItem[0].toUpperCase()); return menuLabel;
return splittedItem;
}; };
const profilePreferenceLinks: Array<{ const profilePreferenceLinks: Array<{
@ -51,15 +50,15 @@ export const ProfilePreferenceSettingsLayout: FC<IProfilePreferenceSettingsLayou
placement="bottom-start" placement="bottom-start"
customButton={ customButton={
<div className="flex gap-2 items-center px-2 py-1.5 border rounded-md border-custom-border-400"> <div className="flex gap-2 items-center px-2 py-1.5 border rounded-md border-custom-border-400">
<span className="flex flex-grow justify-center text-custom-text-200 text-sm">{showMenuItem()}</span> <span className="flex flex-grow justify-center text-custom-text-200 text-sm capitalize">{showMenuLabel()}</span>
<ChevronDown className="w-4 h-4 text-custom-text-400" /> <ChevronDown className="w-4 h-4 text-custom-text-400" />
</div> </div>
} }
customButtonClassName="flex flex-grow justify-start text-custom-text-200 text-sm" customButtonClassName="flex flex-grow justify-start text-custom-text-200 text-sm"
> >
<></> <></>
{profilePreferenceLinks.map((link) => ( {profilePreferenceLinks.map((link, index) => (
<CustomMenu.MenuItem className="flex items-center gap-2"> <CustomMenu.MenuItem className="flex items-center gap-2" key={index}>
<Link key={link.href} href={link.href} className="text-custom-text-300 w-full"> <Link key={link.href} href={link.href} className="text-custom-text-300 w-full">
{link.label} {link.label}
</Link> </Link>

View File

@ -10,7 +10,7 @@ import { ModulesListHeader } from "@/components/headers";
import { ModuleAppliedFiltersList, ModulesListView } from "@/components/modules"; import { ModuleAppliedFiltersList, ModulesListView } from "@/components/modules";
// types // types
// hooks // hooks
import ModulesListMobileHeader from "@/components/modules/moduels-list-mobile-header"; import ModulesListMobileHeader from "@/components/modules/modules-list-mobile-header";
import { EmptyStateType } from "@/constants/empty-state"; import { EmptyStateType } from "@/constants/empty-state";
import { calculateTotalFilters } from "@/helpers/filter.helper"; import { calculateTotalFilters } from "@/helpers/filter.helper";
import { useModuleFilter, useProject } from "@/hooks/store"; import { useModuleFilter, useProject } from "@/hooks/store";

View File

@ -52,7 +52,7 @@ const ProfilePreferencesThemePage: NextPageWithLayout = observer(() => {
return ( return (
<> <>
<PageHead title="Profile - Theme Prefrence" /> <PageHead title="Profile - Theme Preference" />
{currentUser ? ( {currentUser ? (
<div className="mx-auto mt-10 h-full w-full overflow-y-auto px-6 pb-8 md:mt-14 lg:px-20 vertical-scrollbar scrollbar-md"> <div className="mx-auto mt-10 h-full w-full overflow-y-auto px-6 pb-8 md:mt-14 lg:px-20 vertical-scrollbar scrollbar-md">
<div className="flex items-center border-b border-custom-border-100 pb-3.5"> <div className="flex items-center border-b border-custom-border-100 pb-3.5">