refactor: create issue modal input fields (#310)

This commit is contained in:
Aaryan Khandelwal 2023-02-21 19:12:38 +05:30 committed by GitHub
parent 8d6a357a7f
commit c0263acb8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -201,7 +201,6 @@ export const SingleBoardIssue: React.FC<Props> = ({
<div className="absolute top-1.5 right-1.5 z-10 opacity-0 group-hover/card:opacity-100"> <div className="absolute top-1.5 right-1.5 z-10 opacity-0 group-hover/card:opacity-100">
{type && !isNotAllowed && ( {type && !isNotAllowed && (
<CustomMenu width="auto" ellipsis> <CustomMenu width="auto" ellipsis>
<CustomMenu.MenuItem onClick={handleCopyText}>Copy issue link</CustomMenu.MenuItem>
<CustomMenu.MenuItem onClick={editIssue}>Edit</CustomMenu.MenuItem> <CustomMenu.MenuItem onClick={editIssue}>Edit</CustomMenu.MenuItem>
{type !== "issue" && removeIssue && ( {type !== "issue" && removeIssue && (
<CustomMenu.MenuItem onClick={removeIssue}> <CustomMenu.MenuItem onClick={removeIssue}>
@ -211,6 +210,7 @@ export const SingleBoardIssue: React.FC<Props> = ({
<CustomMenu.MenuItem onClick={() => handleDeleteIssue(issue)}> <CustomMenu.MenuItem onClick={() => handleDeleteIssue(issue)}>
Delete permanently Delete permanently
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem onClick={handleCopyText}>Copy issue link</CustomMenu.MenuItem>
</CustomMenu> </CustomMenu>
)} )}
</div> </div>

View File

@ -195,7 +195,6 @@ export const SingleListIssue: React.FC<Props> = ({
)} )}
{type && !isNotAllowed && ( {type && !isNotAllowed && (
<CustomMenu width="auto" ellipsis> <CustomMenu width="auto" ellipsis>
<CustomMenu.MenuItem onClick={handleCopyText}>Copy issue link</CustomMenu.MenuItem>
<CustomMenu.MenuItem onClick={editIssue}>Edit</CustomMenu.MenuItem> <CustomMenu.MenuItem onClick={editIssue}>Edit</CustomMenu.MenuItem>
{type !== "issue" && removeIssue && ( {type !== "issue" && removeIssue && (
<CustomMenu.MenuItem onClick={removeIssue}> <CustomMenu.MenuItem onClick={removeIssue}>
@ -205,6 +204,7 @@ export const SingleListIssue: React.FC<Props> = ({
<CustomMenu.MenuItem onClick={() => handleDeleteIssue(issue)}> <CustomMenu.MenuItem onClick={() => handleDeleteIssue(issue)}>
Delete permanently Delete permanently
</CustomMenu.MenuItem> </CustomMenu.MenuItem>
<CustomMenu.MenuItem onClick={handleCopyText}>Copy issue link</CustomMenu.MenuItem>
</CustomMenu> </CustomMenu>
)} )}
</div> </div>

View File

@ -117,8 +117,6 @@ export const IssueForm: FC<IssueFormProps> = ({
...defaultValues, ...defaultValues,
...initialData, ...initialData,
project: projectId, project: projectId,
assignees_list: initialData?.assignees ?? [],
labels_list: initialData?.labels ?? [],
}); });
}, [initialData, reset, projectId]); }, [initialData, reset, projectId]);
@ -276,7 +274,7 @@ export const IssueForm: FC<IssueFormProps> = ({
/> />
<Controller <Controller
control={control} control={control}
name="labels_list" name="labels"
render={({ field: { value, onChange } }) => ( render={({ field: { value, onChange } }) => (
<IssueLabelSelect <IssueLabelSelect
setIsOpen={setLabelModal} setIsOpen={setLabelModal}
@ -301,7 +299,7 @@ export const IssueForm: FC<IssueFormProps> = ({
</div> </div>
<Controller <Controller
control={control} control={control}
name="assignees_list" name="assignees"
render={({ field: { value, onChange } }) => ( render={({ field: { value, onChange } }) => (
<IssueAssigneeSelect projectId={projectId} value={value} onChange={onChange} /> <IssueAssigneeSelect projectId={projectId} value={value} onChange={onChange} />
)} )}

View File

@ -192,6 +192,8 @@ export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = ({
const payload: Partial<IIssue> = { const payload: Partial<IIssue> = {
...formData, ...formData,
assignees_list: formData.assignees,
labels_list: formData.labels,
description: formData.description ?? "", description: formData.description ?? "",
description_html: formData.description_html ?? "<p></p>", description_html: formData.description_html ?? "<p></p>",
}; };

View File

@ -55,7 +55,7 @@ export interface IIssueLink {
} }
export interface IIssue { export interface IIssue {
assignees: string[] | null; assignees: string[];
assignee_details: IUser[]; assignee_details: IUser[];
assignees_list: string[]; assignees_list: string[];
attachments: any[]; attachments: any[];