forked from github/plane
style: create issue modal inputs
This commit is contained in:
parent
a014564d11
commit
14be78564a
@ -34,8 +34,6 @@ export const ObjectsSelect: React.FC<Props> = observer(({ onChange, projectId, v
|
|||||||
}));
|
}));
|
||||||
options?.unshift({ value: null, query: "default", content: "Default" });
|
options?.unshift({ value: null, query: "default", content: "Default" });
|
||||||
|
|
||||||
console.log("entities", entities);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!workspaceSlug) return;
|
if (!workspaceSlug) return;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import useToast from "hooks/use-toast";
|
|||||||
import useLocalStorage from "hooks/use-local-storage";
|
import useLocalStorage from "hooks/use-local-storage";
|
||||||
// components
|
// components
|
||||||
import { GptAssistantModal } from "components/core";
|
import { GptAssistantModal } from "components/core";
|
||||||
import { ParentIssuesListModal } from "components/issues";
|
import { ParentIssuesListModal, TIssueFormAttributes } from "components/issues";
|
||||||
import {
|
import {
|
||||||
IssueAssigneeSelect,
|
IssueAssigneeSelect,
|
||||||
IssueDateSelect,
|
IssueDateSelect,
|
||||||
@ -67,21 +67,7 @@ export interface IssueFormProps {
|
|||||||
handleFormDirty: (payload: Partial<IIssue> | null) => void;
|
handleFormDirty: (payload: Partial<IIssue> | null) => void;
|
||||||
customAttributesList: { [key: string]: string[] };
|
customAttributesList: { [key: string]: string[] };
|
||||||
handleCustomAttributesChange: (attributeId: string, val: string[]) => void;
|
handleCustomAttributesChange: (attributeId: string, val: string[]) => void;
|
||||||
fieldsToShow: (
|
fieldsToShow: TIssueFormAttributes[];
|
||||||
| "project"
|
|
||||||
| "name"
|
|
||||||
| "description"
|
|
||||||
| "entity"
|
|
||||||
| "state"
|
|
||||||
| "priority"
|
|
||||||
| "assignee"
|
|
||||||
| "label"
|
|
||||||
| "startDate"
|
|
||||||
| "dueDate"
|
|
||||||
| "estimate"
|
|
||||||
| "parent"
|
|
||||||
| "all"
|
|
||||||
)[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IssueForm: FC<IssueFormProps> = observer((props) => {
|
export const IssueForm: FC<IssueFormProps> = observer((props) => {
|
||||||
|
@ -4,6 +4,9 @@ import { useRouter } from "next/router";
|
|||||||
|
|
||||||
import { mutate } from "swr";
|
import { mutate } from "swr";
|
||||||
|
|
||||||
|
// mobx
|
||||||
|
import { observer } from "mobx-react-lite";
|
||||||
|
import { useMobxStore } from "lib/mobx/store-provider";
|
||||||
// headless ui
|
// headless ui
|
||||||
import { Dialog, Transition } from "@headlessui/react";
|
import { Dialog, Transition } from "@headlessui/react";
|
||||||
// services
|
// services
|
||||||
@ -39,42 +42,41 @@ import {
|
|||||||
} from "constants/fetch-keys";
|
} from "constants/fetch-keys";
|
||||||
// constants
|
// constants
|
||||||
import { INBOX_ISSUE_SOURCE } from "constants/inbox";
|
import { INBOX_ISSUE_SOURCE } from "constants/inbox";
|
||||||
import { observer } from "mobx-react-lite";
|
|
||||||
import { useMobxStore } from "lib/mobx/store-provider";
|
export type TIssueFormAttributes =
|
||||||
|
| "project"
|
||||||
|
| "name"
|
||||||
|
| "description"
|
||||||
|
| "entity"
|
||||||
|
| "state"
|
||||||
|
| "priority"
|
||||||
|
| "assignee"
|
||||||
|
| "label"
|
||||||
|
| "startDate"
|
||||||
|
| "dueDate"
|
||||||
|
| "estimate"
|
||||||
|
| "parent"
|
||||||
|
| "all";
|
||||||
|
|
||||||
export interface IssuesModalProps {
|
export interface IssuesModalProps {
|
||||||
data?: IIssue | null;
|
data?: IIssue | null;
|
||||||
|
fieldsToShow?: TIssueFormAttributes[];
|
||||||
handleClose: () => void;
|
handleClose: () => void;
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
isUpdatingSingleIssue?: boolean;
|
isUpdatingSingleIssue?: boolean;
|
||||||
prePopulateData?: Partial<IIssue>;
|
|
||||||
fieldsToShow?: (
|
|
||||||
| "project"
|
|
||||||
| "name"
|
|
||||||
| "description"
|
|
||||||
| "entity"
|
|
||||||
| "state"
|
|
||||||
| "priority"
|
|
||||||
| "assignee"
|
|
||||||
| "label"
|
|
||||||
| "startDate"
|
|
||||||
| "dueDate"
|
|
||||||
| "estimate"
|
|
||||||
| "parent"
|
|
||||||
| "all"
|
|
||||||
)[];
|
|
||||||
onSubmit?: (data: Partial<IIssue>) => Promise<void>;
|
onSubmit?: (data: Partial<IIssue>) => Promise<void>;
|
||||||
|
prePopulateData?: Partial<IIssue>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer(
|
export const CreateUpdateIssueModal: React.FC<IssuesModalProps> = observer(
|
||||||
({
|
({
|
||||||
data,
|
data,
|
||||||
|
fieldsToShow = ["all"],
|
||||||
handleClose,
|
handleClose,
|
||||||
isOpen,
|
isOpen,
|
||||||
isUpdatingSingleIssue = false,
|
isUpdatingSingleIssue = false,
|
||||||
prePopulateData,
|
|
||||||
fieldsToShow = ["all"],
|
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
prePopulateData,
|
||||||
}) => {
|
}) => {
|
||||||
// states
|
// states
|
||||||
const [createMore, setCreateMore] = useState(false);
|
const [createMore, setCreateMore] = useState(false);
|
||||||
|
@ -19,22 +19,20 @@ export const IssueDateSelect: React.FC<Props> = ({ label, maxDate, minDate, onCh
|
|||||||
<Popover className="relative flex items-center justify-center rounded-lg">
|
<Popover className="relative flex items-center justify-center rounded-lg">
|
||||||
{({ close }) => (
|
{({ close }) => (
|
||||||
<>
|
<>
|
||||||
<Popover.Button className="flex cursor-pointer items-center rounded-md border border-custom-border-200 text-xs shadow-sm duration-200">
|
<Popover.Button className="flex items-center gap-1 rounded text-xs bg-custom-background-80 px-2.5 py-0.5">
|
||||||
<span className="flex items-center justify-center gap-2 px-2 py-1 text-xs text-custom-text-200 hover:bg-custom-background-80">
|
{value ? (
|
||||||
{value ? (
|
<>
|
||||||
<>
|
<span className="text-custom-text-100">{renderShortDateWithYearFormat(value)}</span>
|
||||||
<span className="text-custom-text-100">{renderShortDateWithYearFormat(value)}</span>
|
<button onClick={() => onChange(null)}>
|
||||||
<button onClick={() => onChange(null)}>
|
<XMarkIcon className="h-3 w-3" />
|
||||||
<XMarkIcon className="h-3 w-3" />
|
</button>
|
||||||
</button>
|
</>
|
||||||
</>
|
) : (
|
||||||
) : (
|
<>
|
||||||
<>
|
<CalendarDaysIcon className="h-3.5 w-3.5 flex-shrink-0" />
|
||||||
<CalendarDaysIcon className="h-3.5 w-3.5 flex-shrink-0" />
|
<span>{label}</span>
|
||||||
<span>{label}</span>
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</Popover.Button>
|
</Popover.Button>
|
||||||
|
|
||||||
<Transition
|
<Transition
|
||||||
|
@ -69,9 +69,9 @@ export const IssueLabelSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span className="flex items-center justify-center gap-2 px-2 py-1 text-xs rounded shadow-sm border border-custom-border-300 hover:bg-custom-background-80">
|
<span className="flex items-center justify-center gap-2 px-2.5 py-0.5 text-xs rounded bg-custom-background-80">
|
||||||
<TagIcon className="h-3.5 w-3.5 text-custom-text-200" />
|
<TagIcon className="h-3.5 w-3.5" />
|
||||||
<span className=" text-custom-text-200">Label</span>
|
<span>Label</span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</Combobox.Button>
|
</Combobox.Button>
|
||||||
|
@ -17,8 +17,11 @@ type Props = {
|
|||||||
export const IssuePrioritySelect: React.FC<Props> = ({ value, onChange }) => (
|
export const IssuePrioritySelect: React.FC<Props> = ({ value, onChange }) => (
|
||||||
<CustomSelect
|
<CustomSelect
|
||||||
value={value}
|
value={value}
|
||||||
label={
|
customButton={
|
||||||
<div className="flex items-center justify-center gap-2 text-xs">
|
<button
|
||||||
|
type="button"
|
||||||
|
className="flex items-center justify-center gap-2 text-xs bg-custom-background-80 rounded px-2.5 py-0.5"
|
||||||
|
>
|
||||||
<span className="flex items-center">
|
<span className="flex items-center">
|
||||||
<PriorityIcon
|
<PriorityIcon
|
||||||
priority={value}
|
priority={value}
|
||||||
@ -28,7 +31,7 @@ export const IssuePrioritySelect: React.FC<Props> = ({ value, onChange }) => (
|
|||||||
<span className={`${value ? "" : "text-custom-text-200"} capitalize`}>
|
<span className={`${value ? "" : "text-custom-text-200"} capitalize`}>
|
||||||
{value ?? "Priority"}
|
{value ?? "Priority"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</button>
|
||||||
}
|
}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
noChevron
|
noChevron
|
||||||
|
@ -55,8 +55,11 @@ export const IssueStateSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
|
|||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
options={options}
|
options={options}
|
||||||
label={
|
customButton={
|
||||||
<div className="flex items-center gap-2">
|
<button
|
||||||
|
type="button"
|
||||||
|
className="flex items-center gap-2 bg-custom-background-80 rounded text-xs px-2.5 py-0.5"
|
||||||
|
>
|
||||||
{selectedOption ? (
|
{selectedOption ? (
|
||||||
<StateGroupIcon stateGroup={selectedOption.group} color={selectedOption.color} />
|
<StateGroupIcon stateGroup={selectedOption.group} color={selectedOption.color} />
|
||||||
) : currentDefaultState ? (
|
) : currentDefaultState ? (
|
||||||
@ -70,7 +73,7 @@ export const IssueStateSelect: React.FC<Props> = ({ setIsOpen, value, onChange,
|
|||||||
{selectedOption?.name
|
{selectedOption?.name
|
||||||
? selectedOption.name
|
? selectedOption.name
|
||||||
: currentDefaultState?.name ?? <span className="text-custom-text-200">State</span>}
|
: currentDefaultState?.name ?? <span className="text-custom-text-200">State</span>}
|
||||||
</div>
|
</button>
|
||||||
}
|
}
|
||||||
footerOption={
|
footerOption={
|
||||||
<button
|
<button
|
||||||
|
Loading…
Reference in New Issue
Block a user