mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
1e152c666c
* chore: moved app & space from apps to root * chore: modified workspace configuration * chore: modified dockerfiles for space and web * chore: modified icons for space * feat: updated files for new svg icons supported by next-images * chore: added /spaces base path for next * chore: added compose config for space * chore: updated husky configuration * chore: updated workflows for new configuration * chore: changed app name to web * fix: resolved build errors with web * chore: reset file tracing root for both projects * chore: added nginx config for deploy * fix: eslint and tsconfig settings for space app * husky setup fixes based on new dir * eslint fixes * prettier formatting --------- Co-authored-by: Henit Chobisa <chobisa.henit@gmail.com>
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import React from "react";
|
|
|
|
// react hook form
|
|
import { Controller, FieldError, Control } from "react-hook-form";
|
|
// ui
|
|
import { CustomSelect } from "components/ui";
|
|
// icons
|
|
import { Squares2X2Icon } from "@heroicons/react/24/outline";
|
|
import { ModuleStatusIcon } from "components/icons";
|
|
// types
|
|
import type { IModule } from "types";
|
|
// constants
|
|
import { MODULE_STATUS } from "constants/module";
|
|
|
|
type Props = {
|
|
control: Control<IModule, any>;
|
|
error?: FieldError;
|
|
};
|
|
|
|
export const ModuleStatusSelect: React.FC<Props> = ({ control, error }) => (
|
|
<Controller
|
|
control={control}
|
|
rules={{ required: true }}
|
|
name="status"
|
|
render={({ field: { value, onChange } }) => (
|
|
<CustomSelect
|
|
value={value}
|
|
label={
|
|
<div
|
|
className={`flex items-center justify-center gap-2 text-xs ${
|
|
error ? "text-red-500" : ""
|
|
}`}
|
|
>
|
|
{value ? (
|
|
<ModuleStatusIcon status={value} />
|
|
) : (
|
|
<Squares2X2Icon
|
|
className={`h-3 w-3 ${error ? "text-red-500" : "text-custom-text-200"}`}
|
|
/>
|
|
)}
|
|
{MODULE_STATUS.find((s) => s.value === value)?.label ?? (
|
|
<span className={`${error ? "text-red-500" : "text-custom-text-200"}`}>Status</span>
|
|
)}
|
|
</div>
|
|
}
|
|
onChange={onChange}
|
|
noChevron
|
|
>
|
|
{MODULE_STATUS.map((status) => (
|
|
<CustomSelect.Option key={status.value} value={status.value}>
|
|
<div className="flex items-center gap-2">
|
|
<ModuleStatusIcon status={status.value} />
|
|
{status.label}
|
|
</div>
|
|
</CustomSelect.Option>
|
|
))}
|
|
</CustomSelect>
|
|
)}
|
|
/>
|
|
);
|