Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Synced from upstream: 8853637e981ed7d8a6cff32bd98e7afe20f54362
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import type { FC } from "react";
|
|
import React from "react";
|
|
import { observer } from "mobx-react";
|
|
import { MODULE_STATUS } from "@plane/constants";
|
|
import { useTranslation } from "@plane/i18n";
|
|
import type { TModuleStatus } from "@plane/propel/icons";
|
|
import { ModuleStatusIcon } from "@plane/propel/icons";
|
|
import type { IModule } from "@plane/types";
|
|
import { CustomSelect } from "@plane/ui";
|
|
|
|
type Props = {
|
|
isDisabled: boolean;
|
|
moduleDetails: IModule;
|
|
handleModuleDetailsChange: (payload: Partial<IModule>) => Promise<void>;
|
|
};
|
|
|
|
export const ModuleStatusDropdown: FC<Props> = observer((props: Props) => {
|
|
const { isDisabled, moduleDetails, handleModuleDetailsChange } = props;
|
|
const { t } = useTranslation();
|
|
const moduleStatus = MODULE_STATUS.find((status) => status.value === moduleDetails.status);
|
|
|
|
if (!moduleStatus) return <></>;
|
|
|
|
return (
|
|
<CustomSelect
|
|
customButton={
|
|
<span
|
|
className={`flex h-6 w-20 items-center justify-center rounded-sm text-center text-xs ${
|
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
}`}
|
|
style={{
|
|
color: moduleStatus ? moduleStatus.color : "#a3a3a2",
|
|
backgroundColor: moduleStatus ? `${moduleStatus.color}20` : "#a3a3a220",
|
|
}}
|
|
>
|
|
{(moduleStatus && t(moduleStatus?.i18n_label)) ?? t("project_modules.status.backlog")}
|
|
</span>
|
|
}
|
|
value={moduleStatus?.value}
|
|
onChange={(val: TModuleStatus) => {
|
|
handleModuleDetailsChange({ status: val });
|
|
}}
|
|
disabled={isDisabled}
|
|
>
|
|
{MODULE_STATUS.map((status) => (
|
|
<CustomSelect.Option key={status.value} value={status.value}>
|
|
<div className="flex items-center gap-2">
|
|
<ModuleStatusIcon status={status.value} />
|
|
{t(status.i18n_label)}
|
|
</div>
|
|
</CustomSelect.Option>
|
|
))}
|
|
</CustomSelect>
|
|
);
|
|
});
|