diff --git a/web/components/custom-attributes/attribute-display/date-time.tsx b/web/components/custom-attributes/attribute-display/date-time.tsx index eae92e663..ce9082266 100644 --- a/web/components/custom-attributes/attribute-display/date-time.tsx +++ b/web/components/custom-attributes/attribute-display/date-time.tsx @@ -5,6 +5,7 @@ import { ICustomAttribute } from "types"; type Props = { attributeDetails: ICustomAttribute; + className?: string; issueId: string; projectId: string; value: Date | undefined; @@ -22,25 +23,29 @@ const TIME_FORMATS: { [key: string]: string } = { "24": "HH:mm", }; -export const CustomDateTimeAttribute: React.FC = ({ attributeDetails, onChange, value }) => ( -
- -
-); +export const CustomDateTimeAttribute: React.FC = (props) => { + const { attributeDetails, className = "", onChange, value } = props; + + return ( +
+ +
+ ); +}; diff --git a/web/components/custom-attributes/attribute-display/file.tsx b/web/components/custom-attributes/attribute-display/file.tsx index 4b808f2d2..e3f66b7e1 100644 --- a/web/components/custom-attributes/attribute-display/file.tsx +++ b/web/components/custom-attributes/attribute-display/file.tsx @@ -13,12 +13,13 @@ import useWorkspaceDetails from "hooks/use-workspace-details"; import { getFileIcon } from "components/icons"; import { X } from "lucide-react"; // helpers -import { getFileExtension, getFileName } from "helpers/attachment.helper"; +import { getFileExtension } from "helpers/attachment.helper"; // types import { ICustomAttribute } from "types"; type Props = { attributeDetails: ICustomAttribute; + className?: string; issueId: string; projectId: string; value: string | undefined; @@ -28,7 +29,7 @@ type Props = { const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5 MB export const CustomFileAttribute: React.FC = (props) => { - const { attributeDetails, onChange, value } = props; + const { attributeDetails, className = "", onChange, value } = props; const [isUploading, setIsUploading] = useState(false); @@ -136,7 +137,7 @@ export const CustomFileAttribute: React.FC = (props) => { {...getRootProps()} className={`flex items-center bg-custom-background-80 text-xs rounded px-2.5 py-0.5 cursor-pointer truncate w-min max-w-full whitespace-nowrap ${ isDragActive ? "bg-custom-primary-100/10" : "" - } ${isDragReject ? "bg-red-500/10" : ""}`} + } ${isDragReject ? "bg-red-500/10" : ""} ${className}`} > diff --git a/web/components/custom-attributes/attribute-display/relation.tsx b/web/components/custom-attributes/attribute-display/relation.tsx index 2730be2bd..908eb93b9 100644 --- a/web/components/custom-attributes/attribute-display/relation.tsx +++ b/web/components/custom-attributes/attribute-display/relation.tsx @@ -15,9 +15,12 @@ import { Search } from "lucide-react"; import { ICustomAttribute } from "types"; // fetch-keys import { CYCLES_LIST, MODULE_LIST } from "constants/fetch-keys"; +import useProjectMembers from "hooks/use-project-members"; +import { Avatar } from "components/ui"; type Props = { attributeDetails: ICustomAttribute; + className?: string; issueId: string; projectId: string; value: string | undefined; @@ -26,6 +29,7 @@ type Props = { export const CustomRelationAttribute: React.FC = ({ attributeDetails, + className = "", onChange, projectId, value, @@ -54,17 +58,30 @@ export const CustomRelationAttribute: React.FC = ({ : null ); + const { members } = useProjectMembers(workspaceSlug?.toString(), projectId); + const optionsList = attributeDetails.unit === "cycle" - ? cycles?.map((c) => ({ id: c.id, name: c.name })) + ? cycles?.map((c) => ({ id: c.id, query: c.name, label: c.name })) : attributeDetails.unit === "module" - ? modules?.map((m) => ({ id: m.id, name: m.name })) + ? modules?.map((m) => ({ id: m.id, query: m.name, label: m.name })) + : attributeDetails.unit === "user" + ? members?.map((m) => ({ + id: m.member.id, + query: m.member.display_name, + label: ( +
+ + {m.member.is_bot ? m.member.first_name : m.member.display_name} +
+ ), + })) : []; const selectedOption = (optionsList ?? []).find((option) => option.id === value); const options = (optionsList ?? []).filter((option) => - option.name.toLowerCase().includes(query.toLowerCase()) + option.query.toLowerCase().includes(query.toLowerCase()) ); return ( @@ -76,8 +93,10 @@ export const CustomRelationAttribute: React.FC = ({ > {({ open }: { open: boolean }) => ( <> - - {selectedOption?.name ?? `Select ${attributeDetails.unit}`} + + {selectedOption?.label ?? `Select ${attributeDetails.unit}`} = ({ value={option.id} className="flex items-center gap-1 cursor-pointer select-none truncate rounded px-1 py-1.5 hover:bg-custom-background-80 w-full" > - {option.name} + {option.label} )) ) : ( diff --git a/web/components/custom-attributes/attribute-display/select.tsx b/web/components/custom-attributes/attribute-display/select.tsx index 3c58afd94..53cd1ed2c 100644 --- a/web/components/custom-attributes/attribute-display/select.tsx +++ b/web/components/custom-attributes/attribute-display/select.tsx @@ -11,6 +11,7 @@ import { ICustomAttribute } from "types"; type Props = { attributeDetails: ICustomAttribute; + className?: string; issueId: string; onChange: (val: string | string[] | undefined) => void; projectId: string; @@ -23,7 +24,7 @@ type Props = { ); export const CustomSelectAttribute: React.FC = (props) => { - const { attributeDetails, multiple = false, onChange, value } = props; + const { attributeDetails, className = "", multiple = false, onChange, value } = props; const [isOpen, setIsOpen] = useState(false); const [query, setQuery] = useState(""); @@ -31,10 +32,6 @@ export const CustomSelectAttribute: React.FC = (props) => { const dropdownButtonRef = useRef(null); const dropdownOptionsRef = useRef(null); - const selectedOption = - attributeDetails.children.find((option) => option.id === value) ?? - attributeDetails.children.find((option) => option.is_default); - const options = attributeDetails.children.filter((option) => option.display_name.toLowerCase().includes(query.toLowerCase()) ); @@ -118,7 +115,9 @@ export const CustomSelectAttribute: React.FC = (props) => { })} ) : ( -
+
Select {attributeDetails.display_name}
) @@ -148,7 +147,9 @@ export const CustomSelectAttribute: React.FC = (props) => {
) ) : ( -
+
Select {attributeDetails.display_name}
)} diff --git a/web/components/custom-attributes/attribute-forms/relation-attribute-form.tsx b/web/components/custom-attributes/attribute-forms/relation-attribute-form.tsx index f9a9eeae5..629abdff1 100644 --- a/web/components/custom-attributes/attribute-forms/relation-attribute-form.tsx +++ b/web/components/custom-attributes/attribute-forms/relation-attribute-form.tsx @@ -28,15 +28,11 @@ export const RelationAttributeForm: React.FC = ({ control }) optionsClassName="w-full" input > - {CUSTOM_ATTRIBUTE_UNITS.map((unit) => { - if (unit.value === "user") return null; - - return ( - - {unit.label} - - ); - })} + {CUSTOM_ATTRIBUTE_UNITS.map((unit) => ( + + {unit.label} + + ))} )} /> diff --git a/web/components/custom-attributes/attributes-list/issue-modal-attributes-list.tsx b/web/components/custom-attributes/attributes-list/issue-modal-attributes-list.tsx index 0b708f245..e0c1d0b71 100644 --- a/web/components/custom-attributes/attributes-list/issue-modal-attributes-list.tsx +++ b/web/components/custom-attributes/attributes-list/issue-modal-attributes-list.tsx @@ -77,7 +77,7 @@ export const IssueModalCustomAttributesList: React.FC = observer((props)
@@ -119,7 +119,7 @@ export const IssueModalCustomAttributesList: React.FC = observer((props) )} -
+
{Object.entries(nonDescriptionFields).map(([attributeId, attribute]) => (
{attribute.type === "checkbox" && ( @@ -134,6 +134,7 @@ export const IssueModalCustomAttributesList: React.FC = observer((props) {attribute.type === "datetime" && ( onChange(attribute.id, val ? [val.toISOString()] : undefined) @@ -147,15 +148,17 @@ export const IssueModalCustomAttributesList: React.FC = observer((props) {attribute.type === "file" && ( onChange(attribute.id, val)} projectId={projectId} - value={undefined} + value={values[attribute.id]?.[0]} /> )} {attribute.type === "multi_select" && ( onChange(attribute.id, val)} projectId={projectId} @@ -166,6 +169,7 @@ export const IssueModalCustomAttributesList: React.FC = observer((props) {attribute.type === "relation" && ( onChange(attribute.id, val)} projectId={projectId} @@ -175,6 +179,7 @@ export const IssueModalCustomAttributesList: React.FC = observer((props) {attribute.type === "select" && ( onChange(attribute.id, val)} projectId={projectId} diff --git a/web/components/custom-attributes/objects-select.tsx b/web/components/custom-attributes/objects-select.tsx index 47b336e91..15968dcd0 100644 --- a/web/components/custom-attributes/objects-select.tsx +++ b/web/components/custom-attributes/objects-select.tsx @@ -42,17 +42,14 @@ export const ObjectsSelect: React.FC = observer(({ onChange, projectId, v return ( - {entities?.find((e) => e.id === value)?.display_name ?? "Default"} - - } + label={entities?.find((e) => e.id === value)?.display_name ?? "Default"} value={value} maxHeight="md" optionsClassName="!min-w-[10rem]" onChange={onChange} options={options} position="right" + noChevron /> ); }); diff --git a/web/components/issues/select/assignee.tsx b/web/components/issues/select/assignee.tsx index 30c5cfc8d..7e44ab115 100644 --- a/web/components/issues/select/assignee.tsx +++ b/web/components/issues/select/assignee.tsx @@ -49,7 +49,7 @@ export const IssueAssigneeSelect: React.FC = ({ projectId, value = [], on
) : ( -
+
Assignee
diff --git a/web/components/issues/select/date.tsx b/web/components/issues/select/date.tsx index 01fbacda3..0490b7ae0 100644 --- a/web/components/issues/select/date.tsx +++ b/web/components/issues/select/date.tsx @@ -19,7 +19,7 @@ export const IssueDateSelect: React.FC = ({ label, maxDate, minDate, onCh {({ close }) => ( <> - + {value ? ( <> diff --git a/web/components/issues/select/label.tsx b/web/components/issues/select/label.tsx index cf960b3a0..6133b19b8 100644 --- a/web/components/issues/select/label.tsx +++ b/web/components/issues/select/label.tsx @@ -69,7 +69,7 @@ export const IssueLabelSelect: React.FC = ({ setIsOpen, value, onChange, /> ) : ( - + Label diff --git a/web/components/ui/dropdowns/custom-search-select.tsx b/web/components/ui/dropdowns/custom-search-select.tsx index afbd27e4a..ad271981c 100644 --- a/web/components/ui/dropdowns/custom-search-select.tsx +++ b/web/components/ui/dropdowns/custom-search-select.tsx @@ -78,7 +78,7 @@ export const CustomSearchSelect = ({ ) : (