From 3f3fb373ccd23648079ae22979567f369889736c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:04:24 +0530 Subject: [PATCH] fix: issue archive improvement, chore: code refactor (#1520) * style: select month modal * chore: automation setting dropdown updated ,style: month dropdown styling * chore: restore issue alert message updated * chore: archive issue fetching updated and code refactor * fix: build fix --- .../automation/auto-archive-automation.tsx | 15 +++---- .../automation/auto-close-automation.tsx | 11 +++-- .../automation/select-month-modal.tsx | 2 +- apps/app/components/issues/main-content.tsx | 12 +++--- apps/app/components/issues/sidebar.tsx | 42 +++++++++---------- apps/app/constants/fetch-keys.ts | 4 +- apps/app/constants/project.ts | 2 +- apps/app/hooks/use-issues-view.tsx | 6 +-- .../archived-issues/[archivedIssueId].tsx | 10 ++--- apps/app/services/issues.service.ts | 2 +- 10 files changed, 53 insertions(+), 53 deletions(-) diff --git a/apps/app/components/automation/auto-archive-automation.tsx b/apps/app/components/automation/auto-archive-automation.tsx index 8a78fc543..b8321548a 100644 --- a/apps/app/components/automation/auto-archive-automation.tsx +++ b/apps/app/components/automation/auto-archive-automation.tsx @@ -33,8 +33,8 @@ export const AutoArchiveAutomation: React.FC = ({ projectDetails, handleC

Auto-archive closed issues

- Plane will automatically archive issues that have been completed or canceled for the - configured time period + Plane will automatically archive issues that have been completed or cancelled for the + configured time period.

= ({ projectDetails, handleC value={projectDetails?.archive_in} customButton={ } @@ -67,6 +69,7 @@ export const AutoArchiveAutomation: React.FC = ({ projectDetails, handleC handleChange({ archive_in: val }); }} input + verticalPosition="top" width="w-full" > <> @@ -78,12 +81,10 @@ export const AutoArchiveAutomation: React.FC = ({ projectDetails, handleC diff --git a/apps/app/components/automation/auto-close-automation.tsx b/apps/app/components/automation/auto-close-automation.tsx index 11451d045..907cf50ee 100644 --- a/apps/app/components/automation/auto-close-automation.tsx +++ b/apps/app/components/automation/auto-close-automation.tsx @@ -109,7 +109,9 @@ export const AutoCloseAutomation: React.FC = ({ projectDetails, handleCha value={projectDetails?.close_in} customButton={ } @@ -125,15 +127,12 @@ export const AutoCloseAutomation: React.FC = ({ projectDetails, handleCha {month.label} ))} - diff --git a/apps/app/components/automation/select-month-modal.tsx b/apps/app/components/automation/select-month-modal.tsx index ceb7ffa1a..b91c03391 100644 --- a/apps/app/components/automation/select-month-modal.tsx +++ b/apps/app/components/automation/select-month-modal.tsx @@ -65,7 +65,7 @@ export const SelectMonthModal: React.FC = ({ min: 1, max: 12, }} - style={{ appearance: "none" }} + className="border-custom-border-200" /> Months diff --git a/apps/app/components/issues/main-content.tsx b/apps/app/components/issues/main-content.tsx index 92afc6466..f81933dbe 100644 --- a/apps/app/components/issues/main-content.tsx +++ b/apps/app/components/issues/main-content.tsx @@ -28,13 +28,13 @@ import { SUB_ISSUES } from "constants/fetch-keys"; type Props = { issueDetails: IIssue; submitChanges: (formData: Partial) => Promise; - nonEditable?: boolean; + uneditable?: boolean; }; export const IssueMainContent: React.FC = ({ issueDetails, submitChanges, - nonEditable = false, + uneditable = false, }) => { const router = useRouter(); const { workspaceSlug, projectId, issueId, archivedIssueId } = router.query; @@ -100,16 +100,16 @@ export const IssueMainContent: React.FC = ({
- +

Attachments

- +
@@ -122,7 +122,7 @@ export const IssueMainContent: React.FC = ({ diff --git a/apps/app/components/issues/sidebar.tsx b/apps/app/components/issues/sidebar.tsx index c9cbd2575..5ae8969da 100644 --- a/apps/app/components/issues/sidebar.tsx +++ b/apps/app/components/issues/sidebar.tsx @@ -73,7 +73,7 @@ type Props = { | "delete" | "all" )[]; - nonEditable?: boolean; + uneditable?: boolean; }; const defaultValues: Partial = { @@ -87,7 +87,7 @@ export const IssueDetailsSidebar: React.FC = ({ issueDetail, watch: watchIssue, fieldsToShow = ["all"], - nonEditable = false, + uneditable = false, }) => { const [createLabelForm, setCreateLabelForm] = useState(false); const [deleteIssueModal, setDeleteIssueModal] = useState(false); @@ -310,7 +310,7 @@ export const IssueDetailsSidebar: React.FC = ({ -
+
{showFirstSection && (
{(fieldsToShow.includes("all") || fieldsToShow.includes("state")) && ( @@ -322,7 +322,7 @@ export const IssueDetailsSidebar: React.FC = ({ value={value} onChange={(val: string) => submitChanges({ state: val })} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} /> @@ -336,7 +336,7 @@ export const IssueDetailsSidebar: React.FC = ({ value={value} onChange={(val: string[]) => submitChanges({ assignees_list: val })} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} /> @@ -350,7 +350,7 @@ export const IssueDetailsSidebar: React.FC = ({ value={value} onChange={(val: string) => submitChanges({ priority: val })} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} /> @@ -364,7 +364,7 @@ export const IssueDetailsSidebar: React.FC = ({ value={value} onChange={(val: number | null) => submitChanges({ estimate_point: val })} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} /> @@ -396,7 +396,7 @@ export const IssueDetailsSidebar: React.FC = ({ } watch={watchIssue} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} {(fieldsToShow.includes("all") || fieldsToShow.includes("blocker")) && ( @@ -405,7 +405,7 @@ export const IssueDetailsSidebar: React.FC = ({ submitChanges={submitChanges} watch={watchIssue} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} {(fieldsToShow.includes("all") || fieldsToShow.includes("blocked")) && ( @@ -414,7 +414,7 @@ export const IssueDetailsSidebar: React.FC = ({ submitChanges={submitChanges} watch={watchIssue} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} {(fieldsToShow.includes("all") || fieldsToShow.includes("dueDate")) && ( @@ -437,7 +437,7 @@ export const IssueDetailsSidebar: React.FC = ({ }) } className="bg-custom-background-90" - disabled={isNotAllowed || nonEditable} + disabled={isNotAllowed || uneditable} /> )} /> @@ -453,7 +453,7 @@ export const IssueDetailsSidebar: React.FC = ({ issueDetail={issueDetail} handleCycleChange={handleCycleChange} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )} {(fieldsToShow.includes("all") || fieldsToShow.includes("module")) && ( @@ -461,14 +461,14 @@ export const IssueDetailsSidebar: React.FC = ({ issueDetail={issueDetail} handleModuleChange={handleModuleChange} userAuth={memberRole} - disabled={nonEditable} + disabled={uneditable} /> )}
)}
{(fieldsToShow.includes("all") || fieldsToShow.includes("label")) && ( -
+
@@ -515,13 +515,13 @@ export const IssueDetailsSidebar: React.FC = ({ onChange={(val: any) => submitChanges({ labels_list: val })} className="flex-shrink-0" multiple - disabled={isNotAllowed || nonEditable} + disabled={isNotAllowed || uneditable} > {({ open }) => (
= ({
)} {(fieldsToShow.includes("all") || fieldsToShow.includes("link")) && ( -
+

Links

{!isNotAllowed && ( diff --git a/apps/app/constants/fetch-keys.ts b/apps/app/constants/fetch-keys.ts index 949f8627b..70aca787b 100644 --- a/apps/app/constants/fetch-keys.ts +++ b/apps/app/constants/fetch-keys.ts @@ -71,11 +71,11 @@ export const PROJECT_ISSUES_LIST_WITH_PARAMS = (projectId: string, params?: any) return `PROJECT_ISSUES_LIST_WITH_PARAMS_${projectId.toUpperCase()}_${paramsKey}`; }; export const PROJECT_ARCHIVED_ISSUES_LIST_WITH_PARAMS = (projectId: string, params?: any) => { - if (!params) return `PROJECT_ARCHIVED_ISSUES_LIST_WITH_PARAMS${projectId.toUpperCase()}`; + if (!params) return `PROJECT_ARCHIVED_ISSUES_LIST_WITH_PARAMS_${projectId.toUpperCase()}`; const paramsKey = paramsToKey(params); - return `PROJECT_ARCHIVED_ISSUES_LIST_WITH_PARAMS${projectId.toUpperCase()}_${paramsKey}`; + return `PROJECT_ARCHIVED_ISSUES_LIST_WITH_PARAMS_${projectId.toUpperCase()}_${paramsKey}`; }; export const PROJECT_ISSUES_DETAILS = (issueId: string) => `PROJECT_ISSUES_DETAILS_${issueId.toUpperCase()}`; diff --git a/apps/app/constants/project.ts b/apps/app/constants/project.ts index 83ee09f00..9af4977ca 100644 --- a/apps/app/constants/project.ts +++ b/apps/app/constants/project.ts @@ -28,7 +28,7 @@ export const MONTHS = [ export const DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; export const PROJECT_AUTOMATION_MONTHS = [ - { label: "1 Months", value: 1 }, + { label: "1 Month", value: 1 }, { label: "3 Months", value: 3 }, { label: "6 Months", value: 6 }, { label: "9 Months", value: 9 }, diff --git a/apps/app/hooks/use-issues-view.tsx b/apps/app/hooks/use-issues-view.tsx index 706717993..667499a01 100644 --- a/apps/app/hooks/use-issues-view.tsx +++ b/apps/app/hooks/use-issues-view.tsx @@ -44,7 +44,7 @@ const useIssuesView = () => { } = useContext(issueViewContext); const router = useRouter(); - const { workspaceSlug, projectId, cycleId, moduleId, viewId } = router.query; + const { workspaceSlug, projectId, cycleId, moduleId, viewId, archivedIssueId } = router.query; const isArchivedIssues = router.pathname.includes("archived-issues"); const params: any = { @@ -76,10 +76,10 @@ const useIssuesView = () => { ); const { data: projectArchivedIssues } = useSWR( - workspaceSlug && projectId + workspaceSlug && projectId && params && isArchivedIssues && !archivedIssueId ? PROJECT_ARCHIVED_ISSUES_LIST_WITH_PARAMS(projectId as string, params) : null, - workspaceSlug && projectId && params + workspaceSlug && projectId && params && isArchivedIssues && !archivedIssueId ? () => issuesService.getArchivedIssues(workspaceSlug as string, projectId as string, params) : null ); diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx index 78ca847c6..bff1a93b3 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx @@ -118,12 +118,12 @@ const ArchivedIssueDetailsPage: NextPage = () => { if (!workspaceSlug || !projectId || !archivedIssueId) return; await issuesService - .unArchivedIssue(workspaceSlug as string, projectId as string, archivedIssueId as string) + .unarchiveIssue(workspaceSlug as string, projectId as string, archivedIssueId as string) .then(() => { setToastAlert({ type: "success", - title: "Success!", - message: "Issue restored successfully.", + title: "Success", + message: `${issueDetails?.project_detail?.identifier}-${issueDetails?.sequence_id} is restored successfully under the project ${issueDetails?.project_detail?.name}`, }); router.push(`/${workspaceSlug}/projects/${projectId}/issues/${archivedIssueId}`); }) @@ -174,7 +174,7 @@ const ArchivedIssueDetailsPage: NextPage = () => {
@@ -184,7 +184,7 @@ const ArchivedIssueDetailsPage: NextPage = () => { issueDetail={issueDetails} submitChanges={submitChanges} watch={watch} - nonEditable + uneditable />
diff --git a/apps/app/services/issues.service.ts b/apps/app/services/issues.service.ts index 1d695a403..627d0093a 100644 --- a/apps/app/services/issues.service.ts +++ b/apps/app/services/issues.service.ts @@ -536,7 +536,7 @@ class ProjectIssuesServices extends APIService { }); } - async unArchivedIssue(workspaceSlug: string, projectId: string, issueId: string): Promise { + async unarchiveIssue(workspaceSlug: string, projectId: string, issueId: string): Promise { return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/unarchive/${issueId}/`) .then((response) => response?.data) .catch((error) => {