mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
4c2cb2368a
* chore: store various shades of accent color * refactor: custom theme selector * refactor: custom theme selector * chore: update custom theme input labels * fix: color generator function logic * fix: accent color preloaded data * chore: new theming structure * chore: update shades calculation logic * refactor: variable names * chore: update color scheming * chore: new color scheming * refactor: themes folder structure * chore: update classnames to the new ones * chore: update static colors * chore: sidebar link colors * chore: placeholder color * chore: update border classnames
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
import React from "react";
|
|
|
|
// hooks
|
|
import useEstimateOption from "hooks/use-estimate-option";
|
|
// ui
|
|
import { CustomSelect } from "components/ui";
|
|
// icons
|
|
import { PlayIcon } from "@heroicons/react/24/outline";
|
|
// types
|
|
import { UserAuth } from "types";
|
|
|
|
type Props = {
|
|
value: number | null;
|
|
onChange: (val: number | null) => void;
|
|
userAuth: UserAuth;
|
|
};
|
|
|
|
export const SidebarEstimateSelect: React.FC<Props> = ({ value, onChange, userAuth }) => {
|
|
const isNotAllowed = userAuth.isGuest || userAuth.isViewer;
|
|
|
|
const { isEstimateActive, estimatePoints } = useEstimateOption();
|
|
|
|
if (!isEstimateActive) return null;
|
|
|
|
return (
|
|
<div className="flex flex-wrap items-center py-2">
|
|
<div className="flex items-center gap-x-2 text-sm text-custom-text-200 sm:basis-1/2">
|
|
<PlayIcon className="h-4 w-4 flex-shrink-0 -rotate-90" />
|
|
<p>Estimate</p>
|
|
</div>
|
|
<div className="sm:basis-1/2">
|
|
<CustomSelect
|
|
value={value}
|
|
label={
|
|
<div className="flex items-center gap-2 text-xs">
|
|
<PlayIcon
|
|
className={`h-4 w-4 -rotate-90 ${
|
|
value !== null ? "text-custom-text-100" : "text-custom-text-200"
|
|
}`}
|
|
/>
|
|
{estimatePoints?.find((e) => e.key === value)?.value ?? (
|
|
<span className="text-custom-text-200">No estimates</span>
|
|
)}
|
|
</div>
|
|
}
|
|
onChange={onChange}
|
|
position="right"
|
|
width="w-full"
|
|
disabled={isNotAllowed}
|
|
>
|
|
<CustomSelect.Option value={null}>
|
|
<>
|
|
<span>
|
|
<PlayIcon className="h-4 w-4 -rotate-90" />
|
|
</span>
|
|
None
|
|
</>
|
|
</CustomSelect.Option>
|
|
{estimatePoints &&
|
|
estimatePoints.map((point) => (
|
|
<CustomSelect.Option key={point.key} value={point.key}>
|
|
<>
|
|
<span>
|
|
<PlayIcon className="h-4 w-4 -rotate-90" />
|
|
</span>
|
|
{point.value}
|
|
</>
|
|
</CustomSelect.Option>
|
|
))}
|
|
</CustomSelect>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|