mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: created a new constant for archivable state groups (#4668)
This commit is contained in:
parent
98ebe88c86
commit
830f0861c1
@ -48,7 +48,7 @@ import {
|
|||||||
} from "@/components/issues";
|
} from "@/components/issues";
|
||||||
// helpers
|
// helpers
|
||||||
// types
|
// types
|
||||||
import { STATE_GROUPS } from "@/constants/state";
|
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper";
|
import { getDate, renderFormattedPayloadDate } from "@/helpers/date-time.helper";
|
||||||
import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper";
|
import { shouldHighlightIssueDueDate } from "@/helpers/issue.helper";
|
||||||
@ -117,8 +117,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 isInArchivableGroup = !!stateDetails && ARCHIVABLE_STATE_GROUPS.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;
|
||||||
minDate?.setDate(minDate.getDate());
|
minDate?.setDate(minDate.getDate());
|
||||||
|
@ -11,7 +11,7 @@ import { ArchiveIcon, ContextMenu, CustomMenu, TContextMenuItem, TOAST_TYPE, set
|
|||||||
import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues";
|
import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/components/issues";
|
||||||
// constants
|
// constants
|
||||||
import { EIssuesStoreType } from "@/constants/issue";
|
import { EIssuesStoreType } from "@/constants/issue";
|
||||||
import { STATE_GROUPS } from "@/constants/state";
|
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||||
@ -48,8 +48,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 isInArchivableGroup = !!stateDetails && ARCHIVABLE_STATE_GROUPS.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}`;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/c
|
|||||||
// constants
|
// constants
|
||||||
import { EIssuesStoreType } from "@/constants/issue";
|
import { EIssuesStoreType } from "@/constants/issue";
|
||||||
import { EUserProjectRoles } from "@/constants/project";
|
import { EUserProjectRoles } from "@/constants/project";
|
||||||
import { STATE_GROUPS } from "@/constants/state";
|
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||||
@ -54,8 +54,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 isInArchivableGroup = !!stateDetails && ARCHIVABLE_STATE_GROUPS.includes(stateDetails?.group);
|
||||||
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
|
|
||||||
const isDeletingAllowed = isEditingAllowed;
|
const isDeletingAllowed = isEditingAllowed;
|
||||||
|
|
||||||
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
||||||
|
@ -12,7 +12,7 @@ import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/c
|
|||||||
// constants
|
// constants
|
||||||
import { EIssuesStoreType } from "@/constants/issue";
|
import { EIssuesStoreType } from "@/constants/issue";
|
||||||
import { EUserProjectRoles } from "@/constants/project";
|
import { EUserProjectRoles } from "@/constants/project";
|
||||||
import { STATE_GROUPS } from "@/constants/state";
|
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||||
@ -54,8 +54,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 isInArchivableGroup = !!stateDetails && ARCHIVABLE_STATE_GROUPS.includes(stateDetails?.group);
|
||||||
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
|
|
||||||
const isDeletingAllowed = isEditingAllowed;
|
const isDeletingAllowed = isEditingAllowed;
|
||||||
|
|
||||||
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
const activeLayout = `${issuesFilter.issueFilters?.displayFilters?.layout} layout`;
|
||||||
|
@ -12,7 +12,7 @@ import { ArchiveIssueModal, CreateUpdateIssueModal, DeleteIssueModal } from "@/c
|
|||||||
// constants
|
// constants
|
||||||
import { EIssuesStoreType } from "@/constants/issue";
|
import { EIssuesStoreType } from "@/constants/issue";
|
||||||
import { EUserProjectRoles } from "@/constants/project";
|
import { EUserProjectRoles } from "@/constants/project";
|
||||||
import { STATE_GROUPS } from "@/constants/state";
|
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||||
@ -54,8 +54,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 isInArchivableGroup = !!stateDetails && ARCHIVABLE_STATE_GROUPS.includes(stateDetails?.group);
|
||||||
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
|
|
||||||
const isDeletingAllowed = isEditingAllowed;
|
const isDeletingAllowed = isEditingAllowed;
|
||||||
|
|
||||||
const issueLink = `${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`;
|
const issueLink = `${workspaceSlug}/projects/${issue.project_id}/issues/${issue.id}`;
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
} from "@plane/ui";
|
} from "@plane/ui";
|
||||||
// components
|
// components
|
||||||
import { IssueSubscription, IssueUpdateStatus } from "@/components/issues";
|
import { IssueSubscription, IssueUpdateStatus } from "@/components/issues";
|
||||||
import { STATE_GROUPS } from "@/constants/state";
|
import { ARCHIVABLE_STATE_GROUPS } from "@/constants/state";
|
||||||
// helpers
|
// helpers
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
import { copyUrlToClipboard } from "@/helpers/string.helper";
|
||||||
@ -100,8 +100,7 @@ export const IssuePeekOverviewHeader: FC<PeekOverviewHeaderProps> = observer((pr
|
|||||||
};
|
};
|
||||||
// auth
|
// auth
|
||||||
const isArchivingAllowed = !isArchived && !disabled;
|
const isArchivingAllowed = !isArchived && !disabled;
|
||||||
const isInArchivableGroup =
|
const isInArchivableGroup = !!stateDetails && ARCHIVABLE_STATE_GROUPS.includes(stateDetails?.group);
|
||||||
!!stateDetails && [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateDetails?.group);
|
|
||||||
const isRestoringAllowed = isArchived && !disabled;
|
const isRestoringAllowed = isArchived && !disabled;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -33,3 +33,5 @@ export const STATE_GROUPS: {
|
|||||||
color: "#dc2626",
|
color: "#dc2626",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ARCHIVABLE_STATE_GROUPS = [STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key];
|
||||||
|
Loading…
Reference in New Issue
Block a user