diff --git a/web/components/custom-attributes/attribute-display/relation.tsx b/web/components/custom-attributes/attribute-display/relation.tsx index fd8e73306..e1940493f 100644 --- a/web/components/custom-attributes/attribute-display/relation.tsx +++ b/web/components/custom-attributes/attribute-display/relation.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useRef, useState } from "react"; import { useRouter } from "next/router"; @@ -9,14 +9,17 @@ import { Combobox, Transition } from "@headlessui/react"; // services import cyclesService from "services/cycles.service"; import modulesService from "services/modules.service"; +// hooks +import useProjectMembers from "hooks/use-project-members"; +import useDynamicDropdownPosition from "hooks/use-dynamic-dropdown"; +// ui +import { Avatar } from "components/ui"; // icons import { Search } from "lucide-react"; // types 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; @@ -37,8 +40,12 @@ export const CustomRelationAttribute: React.FC = ({ const router = useRouter(); const { workspaceSlug } = router.query; + const [isOpen, setIsOpen] = useState(false); const [query, setQuery] = useState(""); + const dropdownButtonRef = useRef(null); + const dropdownOptionsRef = useRef(null); + const { data: cycles } = useSWR( workspaceSlug && projectId && attributeDetails.unit === "cycle" ? CYCLES_LIST(projectId.toString()) @@ -84,64 +91,59 @@ export const CustomRelationAttribute: React.FC = ({ option.query.toLowerCase().includes(query.toLowerCase()) ); + useDynamicDropdownPosition(isOpen, () => setIsOpen(false), dropdownButtonRef, dropdownOptionsRef); + return ( onChange(val)} - className="relative flex-shrink-0 text-left" + className="flex-shrink-0 text-left flex items-center" > {({ open }: { open: boolean }) => ( <> {selectedOption?.label ?? `Select ${attributeDetails.unit}`} - - -
- - setQuery(e.target.value)} - placeholder="Type to search..." - displayValue={(assigned: any) => assigned?.name} - /> -
-
- {options ? ( - options.length > 0 ? ( - options.map((option) => ( - - {option.label} - - )) - ) : ( -

- No {attributeDetails.unit}s found -

- ) +
+ + setQuery(e.target.value)} + placeholder="Type to search..." + displayValue={(assigned: any) => assigned?.name} + /> +
+
+ {options ? ( + options.length > 0 ? ( + options.map((option) => ( + + {option.label} + + )) ) : ( -

Loading...

- )} -
- - +

+ No {attributeDetails.unit}s found +

+ ) + ) : ( +

Loading...

+ )} +
+
)}
diff --git a/web/components/custom-attributes/attribute-display/select.tsx b/web/components/custom-attributes/attribute-display/select.tsx index 49a720726..42e11588d 100644 --- a/web/components/custom-attributes/attribute-display/select.tsx +++ b/web/components/custom-attributes/attribute-display/select.tsx @@ -125,7 +125,9 @@ export const CustomSelectAttribute: React.FC = (props) => { )} -
+
= observer(
-
-
- - + + +
+

New Object

@@ -253,10 +253,10 @@ export const ObjectModal: React.FC = observer( )}
- - -
-
+
+
+ + ); diff --git a/web/components/issues/modal.tsx b/web/components/issues/modal.tsx index cd6401fef..334c914a5 100644 --- a/web/components/issues/modal.tsx +++ b/web/components/issues/modal.tsx @@ -538,18 +538,18 @@ export const CreateUpdateIssueModal: React.FC = observer(
-
-
- - + + +
+
= observer( handleCustomAttributesChange={handleCustomAttributesChange} handleFormDirty={handleFormDirty} /> - - -
-
+
+
+ + diff --git a/web/components/issues/peek-overview/layout.tsx b/web/components/issues/peek-overview/layout.tsx index 57bcb904c..bd40fb0a8 100644 --- a/web/components/issues/peek-overview/layout.tsx +++ b/web/components/issues/peek-overview/layout.tsx @@ -102,17 +102,17 @@ export const IssuePeekOverview: React.FC = observer( /> -
- - + + +
setDeleteIssueModal(true)} @@ -123,9 +123,9 @@ export const IssuePeekOverview: React.FC = observer( setMode={(mode) => setPeekOverviewMode(mode)} workspaceSlug={workspaceSlug} /> - - -
+
+ +