From 442c83eea2f4c57f82ebb915a3c79392c3188c54 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:18:04 +0530 Subject: [PATCH] style: spreadsheet columns (#2554) * style: spreadsheet columns * fix: build errors --- .../command-palette/command-modal.tsx | 2 +- .../issue/change-issue-assignee.tsx | 4 +- .../views/inline-issue-create-wrapper.tsx | 3 +- web/components/inbox/main-content.tsx | 8 +- web/components/issues/draft-issue-form.tsx | 7 +- web/components/issues/draft-issue-modal.tsx | 8 +- web/components/issues/form.tsx | 7 +- .../calendar/inline-create-issue-form.tsx | 12 -- .../gantt/inline-create-issue-form.tsx | 6 - .../issues/issue-layouts/kanban/block.tsx | 6 +- .../kanban/inline-create-issue-form.tsx | 12 -- .../issue-layouts/kanban/properties.tsx | 4 +- .../list/inline-create-issue-form.tsx | 12 -- .../issues/issue-layouts/list/properties.tsx | 4 +- .../spreadsheet/columns/assignee-column.tsx | 8 +- .../spreadsheet/columns/estimate-column.tsx | 12 +- .../columns/issue/issue-column.tsx | 7 +- .../issue/spreadsheet-issue-column.tsx | 4 - .../spreadsheet/columns/label-column.tsx | 4 +- .../spreadsheet/columns/priority-column.tsx | 9 +- .../spreadsheet/columns/state-column.tsx | 3 +- .../spreadsheet/inline-create-issue-form.tsx | 12 -- .../spreadsheet/spreadsheet-column.tsx | 5 +- .../spreadsheet/spreadsheet-view.tsx | 3 +- web/components/issues/modal.tsx | 5 +- .../issues/peek-overview/issue-properties.tsx | 2 +- .../issues/sidebar-select/label.tsx | 12 +- web/components/issues/sidebar.tsx | 4 +- .../issues/sub-issues/properties.tsx | 2 +- .../issues/view-select/assignee.tsx | 2 +- web/components/issues/view-select/label.tsx | 2 +- web/components/modules/form.tsx | 4 +- web/components/modules/modal.tsx | 3 +- web/components/modules/sidebar.tsx | 7 +- web/components/project/label-select.tsx | 130 +++++++++--------- web/components/project/priority-select.tsx | 43 +++--- .../web-view/issue-properties-detail.tsx | 12 +- web/constants/issue.ts | 2 - web/helpers/issue.helper.ts | 4 - .../archived-issues/[archivedIssueId].tsx | 5 - .../projects/[projectId]/issues/[issueId].tsx | 5 - .../projects/[projectId]/pages/[pageId].tsx | 7 +- .../projects/[projectId]/issues/[issueId].tsx | 4 +- web/store/issue/issue_draft.store.ts | 1 - web/types/issues.d.ts | 2 - web/types/modules.d.ts | 13 +- web/types/pages.d.ts | 1 - 47 files changed, 171 insertions(+), 263 deletions(-) diff --git a/web/components/command-palette/command-modal.tsx b/web/components/command-palette/command-modal.tsx index b3a3325eb..2d65bd58a 100644 --- a/web/components/command-palette/command-modal.tsx +++ b/web/components/command-palette/command-modal.tsx @@ -144,7 +144,7 @@ export const CommandModal: React.FC = (props) => { } else { updatedAssignees.push(assignee); } - updateIssue({ assignees_list: updatedAssignees }); + updateIssue({ assignees: updatedAssignees }); }; const redirect = (path: string) => { diff --git a/web/components/command-palette/issue/change-issue-assignee.tsx b/web/components/command-palette/issue/change-issue-assignee.tsx index d7ed90bd6..606acb536 100644 --- a/web/components/command-palette/issue/change-issue-assignee.tsx +++ b/web/components/command-palette/issue/change-issue-assignee.tsx @@ -79,7 +79,7 @@ export const ChangeIssueAssignee: FC = ({ setIsPaletteOpen, issue, user } ); const handleIssueAssignees = (assignee: string) => { - const updatedAssignees = issue.assignees_list ?? []; + const updatedAssignees = issue.assignees ?? []; if (updatedAssignees.includes(assignee)) { updatedAssignees.splice(updatedAssignees.indexOf(assignee), 1); @@ -87,7 +87,7 @@ export const ChangeIssueAssignee: FC = ({ setIsPaletteOpen, issue, user } updatedAssignees.push(assignee); } - updateIssue({ assignees_list: updatedAssignees }); + updateIssue({ assignees: updatedAssignees }); setIsPaletteOpen(false); }; diff --git a/web/components/core/views/inline-issue-create-wrapper.tsx b/web/components/core/views/inline-issue-create-wrapper.tsx index b474cb74c..b17a6b34b 100644 --- a/web/components/core/views/inline-issue-create-wrapper.tsx +++ b/web/components/core/views/inline-issue-create-wrapper.tsx @@ -198,8 +198,7 @@ export const InlineCreateIssueFormWrapper: React.FC = (props) => { if (onSuccess) await onSuccess(res); - if (formData.assignees_list?.some((assignee) => assignee === user?.id)) - mutate(USER_ISSUE(workspaceSlug as string)); + if (formData.assignees?.some((assignee) => assignee === user?.id)) mutate(USER_ISSUE(workspaceSlug as string)); if (formData.parent && formData.parent !== "") mutate(SUB_ISSUES(formData.parent)); }) diff --git a/web/components/inbox/main-content.tsx b/web/components/inbox/main-content.tsx index 6cc17abe6..a978dc7ce 100644 --- a/web/components/inbox/main-content.tsx +++ b/web/components/inbox/main-content.tsx @@ -22,10 +22,10 @@ import { IInboxIssue, IIssue } from "types"; const defaultValues: Partial = { name: "", description_html: "", - assignees_list: [], + assignees: [], priority: "low", target_date: new Date().toString(), - labels_list: [], + labels: [], }; export const InboxMainContent: React.FC = observer(() => { @@ -122,8 +122,8 @@ export const InboxMainContent: React.FC = observer(() => { reset({ ...issueDetails, - assignees_list: issueDetails.assignees_list ?? (issueDetails.assignee_details ?? []).map((user) => user.id), - labels_list: issueDetails.labels_list ?? issueDetails.labels, + assignees: issueDetails.assignees ?? (issueDetails.assignee_details ?? []).map((user) => user.id), + labels: issueDetails.labels ?? issueDetails.labels, }); }, [issueDetails, reset, inboxIssueId]); diff --git a/web/components/issues/draft-issue-form.tsx b/web/components/issues/draft-issue-form.tsx index 9220b7cf4..9deafb51a 100644 --- a/web/components/issues/draft-issue-form.tsx +++ b/web/components/issues/draft-issue-form.tsx @@ -51,9 +51,7 @@ const defaultValues: Partial = { parent: null, priority: "none", assignees: [], - assignees_list: [], labels: [], - labels_list: [], start_date: null, target_date: null, }; @@ -310,10 +308,7 @@ export const DraftIssueForm: FC = (props) => { handleClose={() => setLabelModal(false)} projectId={projectId} user={user} - onSuccess={(response) => { - setValue("labels", [...watch("labels"), response.id]); - setValue("labels_list", [...watch("labels_list"), response.id]); - }} + onSuccess={(response) => setValue("labels", [...watch("labels"), response.id])} /> )} diff --git a/web/components/issues/draft-issue-modal.tsx b/web/components/issues/draft-issue-modal.tsx index 535b77abc..80aebcbbd 100644 --- a/web/components/issues/draft-issue-modal.tsx +++ b/web/components/issues/draft-issue-modal.tsx @@ -208,8 +208,7 @@ export const CreateUpdateDraftIssueModal: React.FC = observer( message: "Issue created successfully.", }); - if (payload.assignees_list?.some((assignee) => assignee === user?.id)) - mutate(USER_ISSUE(workspaceSlug as string)); + if (payload.assignees?.some((assignee) => assignee === user?.id)) mutate(USER_ISSUE(workspaceSlug as string)); }) .catch(() => { setToastAlert({ @@ -325,8 +324,7 @@ export const CreateUpdateDraftIssueModal: React.FC = observer( if (!createMore) onClose(); - if (payload.assignees_list?.some((assignee) => assignee === user?.id)) - mutate(USER_ISSUE(workspaceSlug as string)); + if (payload.assignees?.some((assignee) => assignee === user?.id)) mutate(USER_ISSUE(workspaceSlug as string)); if (payload.parent && payload.parent !== "") mutate(SUB_ISSUES(payload.parent)); }) @@ -347,8 +345,6 @@ export const CreateUpdateDraftIssueModal: React.FC = observer( const payload: Partial = { ...formData, - assignees_list: formData.assignees ?? [], - labels_list: formData.labels ?? [], description: formData.description ?? "", description_html: formData.description_html ?? "

", }; diff --git a/web/components/issues/form.tsx b/web/components/issues/form.tsx index 13e622385..071a7661b 100644 --- a/web/components/issues/form.tsx +++ b/web/components/issues/form.tsx @@ -41,9 +41,7 @@ const defaultValues: Partial = { parent: null, priority: "none", assignees: [], - assignees_list: [], labels: [], - labels_list: [], start_date: null, target_date: null, }; @@ -262,10 +260,7 @@ export const IssueForm: FC = observer((props) => { handleClose={() => setLabelModal(false)} projectId={projectId} user={user ?? undefined} - onSuccess={(response) => { - setValue("labels", [...watch("labels"), response.id]); - setValue("labels_list", [...watch("labels_list"), response.id]); - }} + onSuccess={(response) => setValue("labels", [...watch("labels"), response.id])} /> )} diff --git a/web/components/issues/issue-layouts/calendar/inline-create-issue-form.tsx b/web/components/issues/issue-layouts/calendar/inline-create-issue-form.tsx index 3ab74c368..18b76c449 100644 --- a/web/components/issues/issue-layouts/calendar/inline-create-issue-form.tsx +++ b/web/components/issues/issue-layouts/calendar/inline-create-issue-form.tsx @@ -147,18 +147,6 @@ export const CalendarInlineCreateIssueForm: React.FC = observer((props) = const payload = createIssuePayload(workspaceDetail!, projectDetails!, { ...(prePopulatedData ?? {}), ...formData, - labels_list: - formData.labels_list?.length !== 0 - ? formData.labels_list - : prePopulatedData?.labels && prePopulatedData?.labels.toString() !== "none" - ? [prePopulatedData.labels as any] - : [], - assignees_list: - formData.assignees_list?.length !== 0 - ? formData.assignees_list - : prePopulatedData?.assignees && prePopulatedData?.assignees.toString() !== "none" - ? [prePopulatedData.assignees as any] - : [], }); try { diff --git a/web/components/issues/issue-layouts/gantt/inline-create-issue-form.tsx b/web/components/issues/issue-layouts/gantt/inline-create-issue-form.tsx index b4edddbd1..bcdd1ba13 100644 --- a/web/components/issues/issue-layouts/gantt/inline-create-issue-form.tsx +++ b/web/components/issues/issue-layouts/gantt/inline-create-issue-form.tsx @@ -113,12 +113,6 @@ export const GanttInlineCreateIssueForm: React.FC = observer((props) => { const payload = createIssuePayload(workspaceDetail!, projectDetails!, { ...(prePopulatedData ?? {}), ...formData, - labels_list: - formData.labels_list?.length !== 0 - ? formData.labels_list - : prePopulatedData?.labels && prePopulatedData?.labels.toString() !== "none" - ? [prePopulatedData.labels as any] - : [], start_date: renderDateFormat(new Date()), target_date: renderDateFormat(new Date(new Date().getTime() + 24 * 60 * 60 * 1000)), }); diff --git a/web/components/issues/issue-layouts/kanban/block.tsx b/web/components/issues/issue-layouts/kanban/block.tsx index 51197c45d..f30453a44 100644 --- a/web/components/issues/issue-layouts/kanban/block.tsx +++ b/web/components/issues/issue-layouts/kanban/block.tsx @@ -65,9 +65,9 @@ export const KanbanIssueBlock: React.FC = (props) => { )}
{displayProperties && displayProperties?.key && (
diff --git a/web/components/issues/issue-layouts/kanban/inline-create-issue-form.tsx b/web/components/issues/issue-layouts/kanban/inline-create-issue-form.tsx index cad0814b8..764c8a7c6 100644 --- a/web/components/issues/issue-layouts/kanban/inline-create-issue-form.tsx +++ b/web/components/issues/issue-layouts/kanban/inline-create-issue-form.tsx @@ -117,18 +117,6 @@ export const BoardInlineCreateIssueForm: React.FC = observer((props) => { const payload = createIssuePayload(workspaceDetail!, projectDetails!, { ...(prePopulatedData ?? {}), ...formData, - labels_list: - formData.labels_list && formData.labels_list.length !== 0 - ? formData.labels_list - : prePopulatedData?.labels && prePopulatedData?.labels.toString() !== "none" - ? [prePopulatedData.labels as any] - : [], - assignees_list: - formData.assignees_list && formData.assignees_list.length !== 0 - ? formData.assignees_list - : prePopulatedData?.assignees && prePopulatedData?.assignees.toString() !== "none" - ? [prePopulatedData.assignees as any] - : [], }); try { diff --git a/web/components/issues/issue-layouts/kanban/properties.tsx b/web/components/issues/issue-layouts/kanban/properties.tsx index 4ab4613aa..f40434686 100644 --- a/web/components/issues/issue-layouts/kanban/properties.tsx +++ b/web/components/issues/issue-layouts/kanban/properties.tsx @@ -65,7 +65,7 @@ export const KanBanProperties: React.FC = observer((props) => handleIssues( !sub_group_id && sub_group_id === "null" ? null : sub_group_id, !group_id && group_id === "null" ? null : group_id, - { ...issue, labels_list: ids } + { ...issue, labels: ids } ); }; @@ -73,7 +73,7 @@ export const KanBanProperties: React.FC = observer((props) => handleIssues( !sub_group_id && sub_group_id === "null" ? null : sub_group_id, !group_id && group_id === "null" ? null : group_id, - { ...issue, assignees_list: ids } + { ...issue, assignees: ids } ); }; diff --git a/web/components/issues/issue-layouts/list/inline-create-issue-form.tsx b/web/components/issues/issue-layouts/list/inline-create-issue-form.tsx index a0624a74f..761fd7f9e 100644 --- a/web/components/issues/issue-layouts/list/inline-create-issue-form.tsx +++ b/web/components/issues/issue-layouts/list/inline-create-issue-form.tsx @@ -116,18 +116,6 @@ export const ListInlineCreateIssueForm: React.FC = observer((props) => { const payload = createIssuePayload(workspaceDetail!, projectDetails!, { ...(prePopulatedData ?? {}), ...formData, - labels_list: - formData.labels_list?.length !== 0 - ? formData.labels_list - : prePopulatedData?.labels && prePopulatedData?.labels.toString() !== "none" - ? [prePopulatedData.labels as any] - : [], - assignees_list: - formData.assignees_list?.length !== 0 - ? formData.assignees_list - : prePopulatedData?.assignees && prePopulatedData?.assignees.toString() !== "none" - ? [prePopulatedData.assignees as any] - : [], }); try { diff --git a/web/components/issues/issue-layouts/list/properties.tsx b/web/components/issues/issue-layouts/list/properties.tsx index 9c70f9fdd..e751a2fe9 100644 --- a/web/components/issues/issue-layouts/list/properties.tsx +++ b/web/components/issues/issue-layouts/list/properties.tsx @@ -36,11 +36,11 @@ export const KanBanProperties: FC = observer((props) => { }; const handleLabel = (ids: string[]) => { - handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, labels_list: ids }); + handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, labels: ids }); }; const handleAssignee = (ids: string[]) => { - handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, assignees_list: ids }); + handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, assignees: ids }); }; const handleStartDate = (date: string) => { diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/assignee-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/assignee-column.tsx index f4878d137..db06d81b8 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/assignee-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/assignee-column.tsx @@ -21,12 +21,12 @@ export const SpreadsheetAssigneeColumn: React.FC = ({ issue, members, onC const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); return ( - <> +
onChange({ assignees_list: data })} + onChange={(data) => onChange({ assignees: data })} members={members ?? []} - buttonClassName="!p-0 !rounded-none !shadow-none !border-0" + buttonClassName="!p-0 !rounded-none !border-0" hideDropdownArrow disabled={disabled} multiple @@ -46,6 +46,6 @@ export const SpreadsheetAssigneeColumn: React.FC = ({ issue, members, onC disabled={disabled} /> ))} - +
); }; diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/estimate-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/estimate-column.tsx index 156fb707f..fa1cd4c0e 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/estimate-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/estimate-column.tsx @@ -1,5 +1,5 @@ // components -import { ViewEstimateSelect } from "components/issues"; +import { EstimateSelect } from "components/estimates"; // hooks import useSubIssue from "hooks/use-sub-issue"; // types @@ -21,7 +21,15 @@ export const SpreadsheetEstimateColumn: React.FC = (props) => { return ( <> - onChange({ estimate_point: data })} disabled={disabled} /> + onChange({ estimate_point: data })} + className="h-full" + buttonClassName="!border-0 !h-full !w-full !rounded-none px-4" + estimatePoints={undefined} + disabled={disabled} + hideDropdownArrow + /> {isExpanded && !isLoading && diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx index 8bb5235c9..e26cdb789 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/issue/issue-column.tsx @@ -5,13 +5,12 @@ import { MoreHorizontal, Pencil, Trash2, ChevronRight, Link } from "lucide-react // hooks import useToast from "hooks/use-toast"; // helpers -import { copyTextToClipboard } from "helpers/string.helper"; +import { copyUrlToClipboard } from "helpers/string.helper"; // types import { IIssue, IIssueDisplayProperties } from "types"; type Props = { issue: IIssue; - projectId: string; expanded: boolean; handleToggleExpand: (issueId: string) => void; properties: IIssueDisplayProperties; @@ -23,7 +22,6 @@ type Props = { export const IssueColumn: React.FC = ({ issue, - projectId, expanded, handleToggleExpand, properties, @@ -50,8 +48,7 @@ export const IssueColumn: React.FC = ({ }; const handleCopyText = () => { - const originURL = typeof window !== "undefined" && window.location.origin ? window.location.origin : ""; - copyTextToClipboard(`${originURL}/${workspaceSlug}/projects/${projectId}/issues/${issue.id}`).then(() => { + copyUrlToClipboard(`${workspaceSlug}/projects/${issue.project}/issues/${issue.id}`).then(() => { setToastAlert({ type: "success", title: "Link Copied!", diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx index 887b7bae4..22692a396 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/issue/spreadsheet-issue-column.tsx @@ -9,7 +9,6 @@ import { IIssue, IIssueDisplayProperties } from "types"; type Props = { issue: IIssue; - projectId: string; expandedIssues: string[]; setExpandedIssues: React.Dispatch>; properties: IIssueDisplayProperties; @@ -20,7 +19,6 @@ type Props = { export const SpreadsheetIssuesColumn: React.FC = ({ issue, - projectId, expandedIssues, setExpandedIssues, properties, @@ -48,7 +46,6 @@ export const SpreadsheetIssuesColumn: React.FC = ({ <> = ({ = (props) => { <> onChange({ labels_list: data })} + onChange={(data) => onChange({ labels: data })} labels={labels ?? []} + className="h-full" + buttonClassName="!border-0 !h-full !w-full !rounded-none" hideDropdownArrow maxRender={1} disabled={disabled} diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/priority-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/priority-column.tsx index 22ef2a0bd..1f1301d5e 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/priority-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/priority-column.tsx @@ -20,11 +20,14 @@ export const SpreadsheetPriorityColumn: React.FC = ({ issue, onChange, ex const { subIssues, isLoading } = useSubIssue(issue.project_detail.id, issue.id, isExpanded); return ( -
+ <> onChange({ priority: data })} - buttonClassName="!p-0 !rounded-none !shadow-none !border-0" + className="h-full" + buttonClassName="!border-0 !h-full !w-full !rounded-none px-4" + showTitle + highlightUrgentPriority={false} hideDropdownArrow disabled={disabled} /> @@ -42,6 +45,6 @@ export const SpreadsheetPriorityColumn: React.FC = ({ issue, onChange, ex disabled={disabled} /> ))} -
+ ); }; diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/state-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/state-column.tsx index 81f45d04f..1a9a32e2e 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/state-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/state-column.tsx @@ -32,7 +32,8 @@ export const SpreadsheetStateColumn: React.FC = (props) => { value={issue.state_detail} onChange={(data) => onChange({ state: data.id, state_detail: data })} states={statesList} - buttonClassName="!shadow-none !border-0" + className="h-full" + buttonClassName="!border-0 !h-full !w-full !rounded-none" hideDropdownArrow disabled={disabled} /> diff --git a/web/components/issues/issue-layouts/spreadsheet/inline-create-issue-form.tsx b/web/components/issues/issue-layouts/spreadsheet/inline-create-issue-form.tsx index 20105a67e..5284d64e4 100644 --- a/web/components/issues/issue-layouts/spreadsheet/inline-create-issue-form.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/inline-create-issue-form.tsx @@ -120,18 +120,6 @@ export const SpreadsheetInlineCreateIssueForm: React.FC = observer((props const payload = createIssuePayload(workspaceDetail!, projectDetails!, { ...(prePopulatedData ?? {}), ...formData, - labels_list: - formData.labels_list && formData.labels_list?.length !== 0 - ? formData.labels_list - : prePopulatedData?.labels && prePopulatedData?.labels.toString() !== "none" - ? [prePopulatedData.labels as any] - : [], - assignees_list: - formData.assignees_list && formData.assignees_list?.length !== 0 - ? formData.assignees_list - : prePopulatedData?.assignees && prePopulatedData?.assignees.toString() !== "none" - ? [prePopulatedData.assignees as any] - : [], }); try { diff --git a/web/components/issues/issue-layouts/spreadsheet/spreadsheet-column.tsx b/web/components/issues/issue-layouts/spreadsheet/spreadsheet-column.tsx index d6e674e28..4013c7737 100644 --- a/web/components/issues/issue-layouts/spreadsheet/spreadsheet-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/spreadsheet-column.tsx @@ -100,6 +100,7 @@ export const SpreadsheetColumn: React.FC = (props) => {
} width="xl" + placement="bottom-end" > handleOrderBy(propertyDetails.ascendingOrderKey, property)}>
= (props) => { {issues?.map((issue) => (
{property === "state" ? ( = observer((props) => { Issue
- {issues.map((issue: IIssue, index) => ( + {issues.map((issue, index) => ( = observer((prop setFormDirtyState(null); setShowConfirmDiscard(false); - if (payload.assignees_list?.some((assignee) => assignee === user?.id)) - mutate(USER_ISSUE(workspaceSlug as string)); + if (payload.assignees?.some((assignee) => assignee === user?.id)) mutate(USER_ISSUE(workspaceSlug as string)); if (payload.parent && payload.parent !== "") mutate(SUB_ISSUES(payload.parent)); }) @@ -271,8 +270,6 @@ export const CreateUpdateIssueModal: React.FC = observer((prop const payload: Partial = { ...formData, - assignees_list: formData.assignees ?? [], - labels_list: formData.labels ?? [], description: formData.description ?? "", description_html: formData.description_html ?? "

", }; diff --git a/web/components/issues/peek-overview/issue-properties.tsx b/web/components/issues/peek-overview/issue-properties.tsx index 9a871dfa2..6bb267a6c 100644 --- a/web/components/issues/peek-overview/issue-properties.tsx +++ b/web/components/issues/peek-overview/issue-properties.tsx @@ -93,7 +93,7 @@ export const PeekOverviewIssueProperties: FC = (props) => {
handleUpdateIssue({ assignees_list: val })} + onChange={(val: string[]) => handleUpdateIssue({ assignees: val })} disabled={readOnly} />
diff --git a/web/components/issues/sidebar-select/label.tsx b/web/components/issues/sidebar-select/label.tsx index dffb97f56..a442a1d42 100644 --- a/web/components/issues/sidebar-select/label.tsx +++ b/web/components/issues/sidebar-select/label.tsx @@ -77,7 +77,7 @@ export const SidebarLabelSelect: React.FC = ({ issueLabelMutate((prevData: any) => [...(prevData ?? []), res], false); - submitChanges({ labels_list: [...(issueDetails?.labels ?? []), res.id] }); + submitChanges({ labels: [...(issueDetails?.labels ?? []), res.id] }); setCreateLabelForm(false); }); @@ -99,7 +99,7 @@ export const SidebarLabelSelect: React.FC = ({
- {watchIssue("labels_list")?.map((labelId) => { + {watchIssue("labels")?.map((labelId) => { const label = issueLabels?.find((l) => l.id === labelId); if (label) @@ -108,9 +108,9 @@ export const SidebarLabelSelect: React.FC = ({ key={label.id} className="group flex cursor-pointer items-center gap-1 rounded-2xl border border-custom-border-100 px-1 py-0.5 text-xs hover:border-red-500/20 hover:bg-red-500/20" onClick={() => { - const updatedLabels = watchIssue("labels_list")?.filter((l) => l !== labelId); + const updatedLabels = watchIssue("labels")?.filter((l) => l !== labelId); submitChanges({ - labels_list: updatedLabels, + labels: updatedLabels, }); }} > @@ -127,12 +127,12 @@ export const SidebarLabelSelect: React.FC = ({ })} ( submitChanges({ labels_list: val })} + onChange={(val: any) => submitChanges({ labels: val })} className="flex-shrink-0" multiple disabled={isNotAllowed || uneditable} diff --git a/web/components/issues/sidebar.tsx b/web/components/issues/sidebar.tsx index 075c43cc3..d87033f5b 100644 --- a/web/components/issues/sidebar.tsx +++ b/web/components/issues/sidebar.tsx @@ -357,11 +357,11 @@ export const IssueDetailsSidebar: React.FC = ({
( submitChanges({ assignees_list: val })} + onChange={(val: string[]) => submitChanges({ assignees: val })} disabled={memberRole.isGuest || memberRole.isViewer || uneditable} /> )} diff --git a/web/components/issues/sub-issues/properties.tsx b/web/components/issues/sub-issues/properties.tsx index ce84d92c5..665ff8514 100644 --- a/web/components/issues/sub-issues/properties.tsx +++ b/web/components/issues/sub-issues/properties.tsx @@ -72,7 +72,7 @@ export const IssueProperty: React.FC = observer((props) => { }; const handleAssigneeChange = (data: string[]) => { - partialUpdateIssue({ assignees_list: data, assignees: data }); + partialUpdateIssue({ assignees: data }); trackEventService.trackIssuePartialPropertyUpdateEvent( { diff --git a/web/components/issues/view-select/assignee.tsx b/web/components/issues/view-select/assignee.tsx index f096c03fc..3be22b25d 100644 --- a/web/components/issues/view-select/assignee.tsx +++ b/web/components/issues/view-select/assignee.tsx @@ -90,7 +90,7 @@ export const ViewAssigneeSelect: React.FC = ({ if (newData.includes(data)) newData.splice(newData.indexOf(data), 1); else newData.push(data); - partialUpdateIssue({ assignees_list: data }, issue); + partialUpdateIssue({ assignees: data }, issue); trackEventService.trackIssuePartialPropertyUpdateEvent( { diff --git a/web/components/issues/view-select/label.tsx b/web/components/issues/view-select/label.tsx index 6aa85fb1a..c7f71e4f1 100644 --- a/web/components/issues/view-select/label.tsx +++ b/web/components/issues/view-select/label.tsx @@ -139,7 +139,7 @@ export const ViewLabelSelect: FC = ({ { - partialUpdateIssue({ labels_list: data }, issue); + partialUpdateIssue({ labels: data }, issue); }} options={options} {...(customButton ? { customButton: labelsLabel } : { label: labelsLabel })} diff --git a/web/components/modules/form.tsx b/web/components/modules/form.tsx index 15fe24cca..c26926ff8 100644 --- a/web/components/modules/form.tsx +++ b/web/components/modules/form.tsx @@ -23,7 +23,7 @@ const defaultValues: Partial = { description: "", status: "backlog", lead: null, - members_list: [], + members: [], }; export const ModuleForm: React.FC = ({ @@ -47,7 +47,7 @@ export const ModuleForm: React.FC = ({ description: data?.description || "", status: data?.status || "backlog", lead: data?.lead || null, - members_list: data?.members_list || [], + members: data?.members || [], }, }); diff --git a/web/components/modules/modal.tsx b/web/components/modules/modal.tsx index cfb422cbf..887884ba2 100644 --- a/web/components/modules/modal.tsx +++ b/web/components/modules/modal.tsx @@ -24,7 +24,7 @@ const defaultValues: Partial = { description: "", status: "backlog", lead: null, - members_list: [], + members: [], }; export const CreateUpdateModuleModal: React.FC = observer((props) => { @@ -98,7 +98,6 @@ export const CreateUpdateModuleModal: React.FC = observer((props) => { const payload: Partial = { ...formData, - members_list: formData.members, }; if (!data) await createModule(payload); diff --git a/web/components/modules/sidebar.tsx b/web/components/modules/sidebar.tsx index f931f3fc1..58ea811a6 100644 --- a/web/components/modules/sidebar.tsx +++ b/web/components/modules/sidebar.tsx @@ -32,7 +32,7 @@ import { MODULE_STATUS } from "constants/module"; const defaultValues: Partial = { lead: "", - members_list: [], + members: [], start_date: null, target_date: null, status: "backlog", @@ -186,7 +186,6 @@ export const ModuleDetailsSidebar: React.FC = observer((props) => { if (moduleDetails) reset({ ...moduleDetails, - members_list: moduleDetails.members_list ?? moduleDetails.members_detail?.map((m) => m.id), }); }, [moduleDetails, reset]); @@ -301,12 +300,12 @@ export const ModuleDetailsSidebar: React.FC = observer((props) => { /> ( { - submitChanges({ members_list: val }); + submitChanges({ members: val }); }} /> )} diff --git a/web/components/project/label-select.tsx b/web/components/project/label-select.tsx index ebf7f4776..c70aa8d29 100644 --- a/web/components/project/label-select.tsx +++ b/web/components/project/label-select.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import { usePopper } from "react-popper"; import { Placement } from "@popperjs/core"; import { Combobox } from "@headlessui/react"; -import { Check, ChevronDown, PlusIcon, Search } from "lucide-react"; +import { Check, ChevronDown, Search } from "lucide-react"; // ui import { Tooltip } from "components/ui"; // types @@ -21,18 +21,20 @@ type Props = { disabled?: boolean; }; -export const LabelSelect: React.FC = ({ - value, - onChange, - labels, - className = "", - buttonClassName = "", - optionsClassName = "", - maxRender = 2, - placement, - hideDropdownArrow = false, - disabled = false, -}) => { +export const LabelSelect: React.FC = (props) => { + const { + value, + onChange, + labels, + className = "", + buttonClassName = "", + optionsClassName = "", + maxRender = 2, + placement, + hideDropdownArrow = false, + disabled = false, + } = props; + const [query, setQuery] = useState(""); const [referenceElement, setReferenceElement] = useState(null); @@ -79,63 +81,57 @@ export const LabelSelect: React.FC = ({ multiple > - diff --git a/web/components/project/priority-select.tsx b/web/components/project/priority-select.tsx index 5c9ff83e7..38a51ff6e 100644 --- a/web/components/project/priority-select.tsx +++ b/web/components/project/priority-select.tsx @@ -20,6 +20,8 @@ type Props = { buttonClassName?: string; optionsClassName?: string; placement?: Placement; + showTitle?: boolean; + highlightUrgentPriority?: boolean; hideDropdownArrow?: boolean; disabled?: boolean; }; @@ -31,6 +33,8 @@ export const PrioritySelect: React.FC = ({ buttonClassName = "", optionsClassName = "", placement, + showTitle = false, + highlightUrgentPriority = true, hideDropdownArrow = false, disabled = false, }) => { @@ -69,20 +73,21 @@ export const PrioritySelect: React.FC = ({ const label = ( - +
+ + {showTitle && {value}} +
); @@ -99,9 +104,13 @@ export const PrioritySelect: React.FC = ({ ref={setReferenceElement} type="button" className={`flex items-center justify-between gap-1 h-full w-full text-xs rounded border-[0.5px] ${ - value === "urgent" ? "border-red-500/20 bg-red-500" : "border-custom-border-300" - } ${ - disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer hover:bg-custom-background-80" + value === "urgent" + ? highlightUrgentPriority + ? "border-red-500/20 bg-red-500" + : "border-custom-border-300" + : "border-custom-border-300" + } ${!disabled ? "hover:bg-custom-background-80" : ""} ${ + disabled ? "cursor-not-allowed text-custom-text-200" : "cursor-pointer" } ${buttonClassName}`} > {label} diff --git a/web/components/web-view/issue-properties-detail.tsx b/web/components/web-view/issue-properties-detail.tsx index 40b84ff82..67e067dac 100644 --- a/web/components/web-view/issue-properties-detail.tsx +++ b/web/components/web-view/issue-properties-detail.tsx @@ -144,7 +144,7 @@ export const IssuePropertiesDetail: React.FC = (props) => {
( = (props) => { onChange={(val: string) => { const assignees = value?.includes(val) ? value?.filter((i) => i !== val) : [...(value ?? []), val]; - submitChanges({ assignees_list: assignees }); + submitChanges({ assignees: assignees }); }} /> )} @@ -232,7 +232,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { JSON.stringify({ issue_id: relation.issue_detail?.id, project_id: relation.issue_detail?.project_detail.id, - issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}` + issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}`, }) ) } @@ -295,7 +295,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { JSON.stringify({ issue_id: relation.issue_detail?.id, project_id: relation.issue_detail?.project_detail.id, - issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}` + issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}`, }) ) } @@ -358,7 +358,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { JSON.stringify({ issue_id: relation.issue_detail?.id, project_id: relation.issue_detail?.project_detail.id, - issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}` + issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}`, }) ) } @@ -421,7 +421,7 @@ export const IssuePropertiesDetail: React.FC = (props) => { JSON.stringify({ issue_id: relation.issue_detail?.id, project_id: relation.issue_detail?.project_detail.id, - issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}` + issue_identifier: `${relation.issue_detail?.project_detail.identifier}-${relation.issue_detail?.sequence_id}`, }) ) } diff --git a/web/constants/issue.ts b/web/constants/issue.ts index 2e7983c11..376c99aa0 100644 --- a/web/constants/issue.ts +++ b/web/constants/issue.ts @@ -437,7 +437,6 @@ export const createIssuePayload: ( archived_at: null, assignees: [], assignee_details: [], - assignees_list: [], attachment_count: 0, attachments: [], issue_relations: [], @@ -459,7 +458,6 @@ export const createIssuePayload: ( labels: [], label_details: [], is_draft: false, - labels_list: [], links_list: [], link_count: 0, module: null, diff --git a/web/helpers/issue.helper.ts b/web/helpers/issue.helper.ts index 919699d69..6f4381dec 100644 --- a/web/helpers/issue.helper.ts +++ b/web/helpers/issue.helper.ts @@ -37,8 +37,6 @@ export const handleIssuesMutation: THandleIssuesMutation = ( const updatedIssue = { ...prevData[issueIndex], ...formData, - assignees: formData?.assignees_list ?? prevData[issueIndex]?.assignees, - labels: formData?.labels_list ?? prevData[issueIndex]?.labels, }; prevData.splice(issueIndex, 1, updatedIssue); @@ -55,8 +53,6 @@ export const handleIssuesMutation: THandleIssuesMutation = ( const updatedIssue = { ...oldGroup[issueIndex], ...formData, - assignees: formData?.assignees_list ?? oldGroup[issueIndex]?.assignees, - labels: formData?.labels_list ?? oldGroup[issueIndex]?.labels, }; if (selectedGroupBy !== Object.keys(formData)[0]) diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx index df20f8a1f..d6d0c6859 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/archived-issues/[archivedIssueId].tsx @@ -32,12 +32,10 @@ const defaultValues: Partial = { description_html: "", estimate_point: null, state: "", - assignees_list: [], priority: "low", target_date: new Date().toString(), issue_cycle: null, issue_module: null, - labels_list: [], }; // services @@ -109,9 +107,6 @@ const ArchivedIssueDetailsPage: NextPage = () => { mutate(PROJECT_ISSUES_ACTIVITY(archivedIssueId as string)); reset({ ...issueDetails, - assignees_list: issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), - labels_list: issueDetails.labels_list ?? issueDetails.labels, - labels: issueDetails.labels_list ?? issueDetails.labels, }); }, [issueDetails, reset, archivedIssueId]); diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx index af942ef47..c8e70bdb7 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx @@ -27,13 +27,11 @@ import { PROJECT_ISSUES_ACTIVITY, ISSUE_DETAILS } from "constants/fetch-keys"; // helper const defaultValues: Partial = { - assignees_list: [], description: "", description_html: "", estimate_point: null, issue_cycle: null, issue_module: null, - labels_list: [], name: "", priority: "low", start_date: null, @@ -109,9 +107,6 @@ const IssueDetailsPage: NextPage = () => { mutate(PROJECT_ISSUES_ACTIVITY(issueId as string)); reset({ ...issueDetails, - assignees_list: issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), - labels_list: issueDetails.labels_list ?? issueDetails.labels, - labels: issueDetails.labels_list ?? issueDetails.labels, }); }, [issueDetails, reset, issueId]); diff --git a/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx b/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx index 7c4cae55d..24a25fa9d 100644 --- a/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx +++ b/web/pages/[workspaceSlug]/projects/[projectId]/pages/[pageId].tsx @@ -133,7 +133,6 @@ const SinglePage: NextPage = () => { (prevData) => ({ ...(prevData as IPage), ...formData, - labels: formData.labels_list ? formData.labels_list : (prevData as IPage).labels, }), false ); @@ -361,7 +360,7 @@ const SinglePage: NextPage = () => { className="group flex cursor-pointer items-center gap-1 rounded-2xl border border-custom-border-200 px-2 py-0.5 text-xs hover:border-red-500 hover:bg-red-50" onClick={() => { const updatedLabels = pageDetails.labels.filter((l) => l !== labelId); - partialUpdatePage({ labels_list: updatedLabels }); + partialUpdatePage({ labels: updatedLabels }); }} style={{ backgroundColor: `${label?.color && label.color !== "" ? label.color : "#000000"}20`, @@ -402,7 +401,7 @@ const SinglePage: NextPage = () => { } - onChange={(val: string[]) => partialUpdatePage({ labels_list: val })} + onChange={(val: string[]) => partialUpdatePage({ labels: val })} options={options} multiple noChevron @@ -606,7 +605,7 @@ const SinglePage: NextPage = () => { user={user} onSuccess={(response) => { partialUpdatePage({ - labels_list: [...(pageDetails.labels ?? []), response.id], + labels: [...(pageDetails.labels ?? []), response.id], }); }} /> diff --git a/web/pages/m/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx b/web/pages/m/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx index 167b89de7..37ce2d90e 100644 --- a/web/pages/m/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx +++ b/web/pages/m/[workspaceSlug]/projects/[projectId]/issues/[issueId].tsx @@ -69,15 +69,13 @@ const MobileWebViewIssueDetail_ = () => { useEffect(() => { if (!issueDetails) return; + reset({ ...issueDetails, name: issueDetails.name, description: issueDetails.description, description_html: issueDetails.description_html, state: issueDetails.state, - assignees_list: issueDetails.assignees_list ?? issueDetails.assignee_details?.map((user) => user.id), - labels_list: issueDetails.labels_list ?? issueDetails.labels, - labels: issueDetails.labels_list ?? issueDetails.labels, }); }, [issueDetails, reset]); diff --git a/web/store/issue/issue_draft.store.ts b/web/store/issue/issue_draft.store.ts index 815e58278..76faacb7e 100644 --- a/web/store/issue/issue_draft.store.ts +++ b/web/store/issue/issue_draft.store.ts @@ -122,7 +122,6 @@ export class DraftIssuesStore { // immediately update the issue in the store const updatedIssue = { ...this.issues[issueId], ...issueForm }; - if (updatedIssue.assignees_list) updatedIssue.assignees = updatedIssue.assignees_list; try { runInAction(() => { diff --git a/web/types/issues.d.ts b/web/types/issues.d.ts index 164718237..553a12ced 100644 --- a/web/types/issues.d.ts +++ b/web/types/issues.d.ts @@ -80,7 +80,6 @@ export interface IIssue { archived_at: string; assignees: string[]; assignee_details: IUser[]; - assignees_list: string[]; attachment_count: number; attachments: any[]; issue_relations: IssueRelation[]; @@ -105,7 +104,6 @@ export interface IIssue { labels: string[]; label_details: any[]; is_draft: boolean; - labels_list: string[]; links_list: IIssueLink[]; link_count: number; module: string | null; diff --git a/web/types/modules.d.ts b/web/types/modules.d.ts index 709d1d300..6ec86c4f5 100644 --- a/web/types/modules.d.ts +++ b/web/types/modules.d.ts @@ -10,13 +10,7 @@ import type { linkDetails, } from "types"; -export type TModuleStatus = - | "backlog" - | "planned" - | "in-progress" - | "paused" - | "completed" - | "cancelled"; +export type TModuleStatus = "backlog" | "planned" | "in-progress" | "paused" | "completed" | "cancelled"; export interface IModule { backlog_issues: number; @@ -38,7 +32,6 @@ export interface IModule { link_module: linkDetails[]; links_list: ModuleLink[]; members: string[]; - members_list: string[]; members_detail: IUserLite[]; is_favorite: boolean; name: string; @@ -80,8 +73,6 @@ export type ModuleLink = { url: string; }; -export type SelectModuleType = - | (IModule & { actionType: "edit" | "delete" | "create-issue" }) - | undefined; +export type SelectModuleType = (IModule & { actionType: "edit" | "delete" | "create-issue" }) | undefined; export type SelectIssue = (IIssue & { actionType: "edit" | "delete" | "create" }) | undefined; diff --git a/web/types/pages.d.ts b/web/types/pages.d.ts index 6be966f7c..f7850d11d 100644 --- a/web/types/pages.d.ts +++ b/web/types/pages.d.ts @@ -14,7 +14,6 @@ export interface IPage { is_favorite: boolean; label_details: IIssueLabels[]; labels: string[]; - labels_list: string[]; name: string; owned_by: string; project: string;