forked from github/plane
refactor: remove unnecessary props
This commit is contained in:
parent
c4143a1a64
commit
3ae292a2da
@ -5,8 +5,6 @@ import { ICustomAttribute } from "types";
|
||||
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: boolean;
|
||||
onChange: (val: boolean) => void;
|
||||
};
|
||||
|
@ -6,8 +6,6 @@ import { ICustomAttribute } from "types";
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
className?: string;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: Date | undefined;
|
||||
onChange: (val: Date | null) => void;
|
||||
};
|
||||
|
@ -7,8 +7,6 @@ import { ICustomAttribute } from "types";
|
||||
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: string | undefined;
|
||||
onChange: (val: string) => void;
|
||||
};
|
||||
|
@ -22,8 +22,6 @@ import { MAX_FILE_SIZE } from "constants/workspace";
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
className?: string;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: string | undefined;
|
||||
onChange: (val: string | undefined) => void;
|
||||
};
|
||||
|
@ -9,8 +9,6 @@ import { ICustomAttribute } from "types";
|
||||
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: number | undefined;
|
||||
onChange: (val: number | undefined) => void;
|
||||
};
|
||||
|
@ -24,7 +24,6 @@ import { CYCLES_LIST, MODULE_LIST } from "constants/fetch-keys";
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
className?: string;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: string | undefined;
|
||||
onChange: (val: string | undefined) => void;
|
||||
|
@ -12,9 +12,7 @@ import { ICustomAttribute } from "types";
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
className?: string;
|
||||
issueId: string;
|
||||
onChange: (val: string | string[] | undefined) => void;
|
||||
projectId: string;
|
||||
} & (
|
||||
| {
|
||||
multiple?: false;
|
||||
|
@ -7,8 +7,6 @@ import { ICustomAttribute } from "types";
|
||||
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: string | undefined;
|
||||
onChange: (val: string) => void;
|
||||
};
|
||||
|
@ -7,8 +7,6 @@ import { ICustomAttribute } from "types";
|
||||
|
||||
type Props = {
|
||||
attributeDetails: ICustomAttribute;
|
||||
issueId: string;
|
||||
projectId: string;
|
||||
value: string | undefined;
|
||||
onChange: (val: string) => void;
|
||||
};
|
||||
|
@ -33,9 +33,7 @@ export const CustomAttributesCheckboxes: React.FC<Props> = observer((props) => {
|
||||
<div className="w-3/5 flex-shrink-0">
|
||||
<CustomCheckboxAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issueId}
|
||||
onChange={(val) => onChange(attribute.id, [`${val}`])}
|
||||
projectId={projectId}
|
||||
value={values[attribute.id]?.[0] === "true" ? true : false}
|
||||
/>
|
||||
</div>
|
||||
|
@ -47,9 +47,7 @@ export const CustomAttributesSelectFields: React.FC<Props> = observer((props) =>
|
||||
<CustomDateTimeAttribute
|
||||
attributeDetails={attribute}
|
||||
className="bg-transparent border border-custom-border-200 py-1 shadow-custom-shadow-2xs"
|
||||
issueId={issueId}
|
||||
onChange={(val) => onChange(attribute.id, val ? [val.toISOString()] : undefined)}
|
||||
projectId={projectId}
|
||||
value={values[attribute.id]?.[0] ? new Date(values[attribute.id]?.[0]) : undefined}
|
||||
/>
|
||||
)}
|
||||
@ -57,9 +55,7 @@ export const CustomAttributesSelectFields: React.FC<Props> = observer((props) =>
|
||||
<CustomFileAttribute
|
||||
attributeDetails={attribute}
|
||||
className="bg-transparent border border-custom-border-200 py-1 shadow-custom-shadow-2xs"
|
||||
issueId={issueId}
|
||||
onChange={(val) => onChange(attribute.id, val)}
|
||||
projectId={projectId}
|
||||
value={values[attribute.id]?.[0]}
|
||||
/>
|
||||
)}
|
||||
@ -67,9 +63,7 @@ export const CustomAttributesSelectFields: React.FC<Props> = observer((props) =>
|
||||
<CustomSelectAttribute
|
||||
attributeDetails={attribute}
|
||||
className="bg-transparent border border-custom-border-200 py-1 shadow-custom-shadow-2xs"
|
||||
issueId={issueId}
|
||||
onChange={(val) => onChange(attribute.id, val)}
|
||||
projectId={projectId}
|
||||
value={values[attribute.id] ?? []}
|
||||
multiple
|
||||
/>
|
||||
@ -78,7 +72,6 @@ export const CustomAttributesSelectFields: React.FC<Props> = observer((props) =>
|
||||
<CustomRelationAttribute
|
||||
attributeDetails={attribute}
|
||||
className="bg-transparent border border-custom-border-200 py-1 shadow-custom-shadow-2xs"
|
||||
issueId={issueId}
|
||||
onChange={(val) => onChange(attribute.id, val)}
|
||||
projectId={projectId}
|
||||
value={values[attribute.id]?.[0]}
|
||||
@ -88,9 +81,7 @@ export const CustomAttributesSelectFields: React.FC<Props> = observer((props) =>
|
||||
<CustomSelectAttribute
|
||||
attributeDetails={attribute}
|
||||
className="bg-transparent border border-custom-border-200 py-1 shadow-custom-shadow-2xs"
|
||||
issueId={issueId}
|
||||
onChange={(val) => onChange(attribute.id, val)}
|
||||
projectId={projectId}
|
||||
value={values[attribute.id]?.[0]}
|
||||
multiple={false}
|
||||
/>
|
||||
|
@ -125,9 +125,7 @@ export const PeekOverviewCustomAttributesList: React.FC<Props> = observer(
|
||||
{attribute.type === "checkbox" && (
|
||||
<CustomCheckboxAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, [`${val}`])}
|
||||
projectId={issue.project}
|
||||
value={
|
||||
attributeValue
|
||||
? attributeValue?.[0]?.value === "true"
|
||||
@ -140,40 +138,32 @@ export const PeekOverviewCustomAttributesList: React.FC<Props> = observer(
|
||||
{attribute.type === "datetime" && (
|
||||
<CustomDateTimeAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => {
|
||||
handleAttributeUpdate(attribute.id, val ? [val.toISOString()] : undefined);
|
||||
}}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? new Date(attributeValue?.[0]?.value ?? "") : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "email" && (
|
||||
<CustomEmailAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => {
|
||||
handleAttributeUpdate(attribute.id, val && val !== "" ? [val] : undefined);
|
||||
}}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "file" && (
|
||||
<CustomFileAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "multi_select" && (
|
||||
<CustomSelectAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={Array.isArray(attributeValue) ? attributeValue.map((v) => v.value) : []}
|
||||
multiple
|
||||
/>
|
||||
@ -181,11 +171,9 @@ export const PeekOverviewCustomAttributesList: React.FC<Props> = observer(
|
||||
{attribute.type === "number" && (
|
||||
<CustomNumberAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => {
|
||||
handleAttributeUpdate(attribute.id, val ? [val.toString()] : undefined);
|
||||
}}
|
||||
projectId={issue.project}
|
||||
value={
|
||||
attributeValue ? parseInt(attributeValue?.[0]?.value ?? "0", 10) : undefined
|
||||
}
|
||||
@ -194,7 +182,6 @@ export const PeekOverviewCustomAttributesList: React.FC<Props> = observer(
|
||||
{attribute.type === "relation" && (
|
||||
<CustomRelationAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
@ -203,9 +190,7 @@ export const PeekOverviewCustomAttributesList: React.FC<Props> = observer(
|
||||
{attribute.type === "select" && (
|
||||
<CustomSelectAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
multiple={false}
|
||||
/>
|
||||
@ -213,22 +198,18 @@ export const PeekOverviewCustomAttributesList: React.FC<Props> = observer(
|
||||
{attribute.type === "text" && (
|
||||
<CustomTextAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) =>
|
||||
handleAttributeUpdate(attribute.id, val && val !== "" ? [val] : undefined)
|
||||
}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0].value : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "url" && (
|
||||
<CustomUrlAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) =>
|
||||
handleAttributeUpdate(attribute.id, val && val !== "" ? [val] : undefined)
|
||||
}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
/>
|
||||
)}
|
||||
|
@ -124,9 +124,7 @@ export const SidebarCustomAttributesList: React.FC<Props> = observer(({ issue, p
|
||||
{attribute.type === "checkbox" && (
|
||||
<CustomCheckboxAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, [`${val}`])}
|
||||
projectId={issue.project}
|
||||
value={
|
||||
attributeValue ? (attributeValue?.[0]?.value === "true" ? true : false) : false
|
||||
}
|
||||
@ -135,40 +133,32 @@ export const SidebarCustomAttributesList: React.FC<Props> = observer(({ issue, p
|
||||
{attribute.type === "datetime" && (
|
||||
<CustomDateTimeAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => {
|
||||
handleAttributeUpdate(attribute.id, val ? [val.toISOString()] : undefined);
|
||||
}}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? new Date(attributeValue?.[0]?.value ?? "") : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "email" && (
|
||||
<CustomEmailAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => {
|
||||
handleAttributeUpdate(attribute.id, val && val !== "" ? [val] : undefined);
|
||||
}}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "file" && (
|
||||
<CustomFileAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "multi_select" && (
|
||||
<CustomSelectAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={Array.isArray(attributeValue) ? attributeValue.map((v) => v.value) : []}
|
||||
multiple
|
||||
/>
|
||||
@ -176,11 +166,9 @@ export const SidebarCustomAttributesList: React.FC<Props> = observer(({ issue, p
|
||||
{attribute.type === "number" && (
|
||||
<CustomNumberAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => {
|
||||
handleAttributeUpdate(attribute.id, val ? [val.toString()] : undefined);
|
||||
}}
|
||||
projectId={issue.project}
|
||||
value={
|
||||
attributeValue ? parseInt(attributeValue?.[0]?.value ?? "0", 10) : undefined
|
||||
}
|
||||
@ -189,7 +177,6 @@ export const SidebarCustomAttributesList: React.FC<Props> = observer(({ issue, p
|
||||
{attribute.type === "relation" && (
|
||||
<CustomRelationAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
@ -198,9 +185,7 @@ export const SidebarCustomAttributesList: React.FC<Props> = observer(({ issue, p
|
||||
{attribute.type === "select" && (
|
||||
<CustomSelectAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) => handleAttributeUpdate(attribute.id, val)}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
multiple={false}
|
||||
/>
|
||||
@ -208,22 +193,18 @@ export const SidebarCustomAttributesList: React.FC<Props> = observer(({ issue, p
|
||||
{attribute.type === "text" && (
|
||||
<CustomTextAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) =>
|
||||
handleAttributeUpdate(attribute.id, val && val !== "" ? [val] : undefined)
|
||||
}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0].value : undefined}
|
||||
/>
|
||||
)}
|
||||
{attribute.type === "url" && (
|
||||
<CustomUrlAttribute
|
||||
attributeDetails={attribute}
|
||||
issueId={issue.id}
|
||||
onChange={(val) =>
|
||||
handleAttributeUpdate(attribute.id, val && val !== "" ? [val] : undefined)
|
||||
}
|
||||
projectId={issue.project}
|
||||
value={attributeValue ? attributeValue?.[0]?.value : undefined}
|
||||
/>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user