Web:Component:Cron Fixed prefix

This commit is contained in:
Akmal Isomadinov 2023-08-18 12:45:50 +05:00
parent ce22803620
commit 57e46fffbb
4 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ function Cron({ value = defaultCronString, setValue, onError }: CronProps) {
const [monthDays, setMonthDays] = useState<number[]>([]);
useEffect(() => {
onError?.(undefined);
onError?.(undefined); // reset error state
if (valueRef.current !== value) init();
}, [value]);

View File

@ -4,7 +4,8 @@ import { units } from "../../constants";
import MinutesProps from "./Minutes.props";
function Minutes({ minutes, setMinutes, period }: MinutesProps) {
const prefix = period === "Hour" ? "At" : ":";
const isHour = period === "Hour";
const prefix = isHour ? "At" : ":";
return (
<Select
@ -14,6 +15,7 @@ function Minutes({ minutes, setMinutes, period }: MinutesProps) {
unit={units[0]}
prefix={prefix}
dropDownMaxHeight={300}
withTranslationPrefix={isHour}
/>
);
}

View File

@ -7,6 +7,7 @@ interface SelectProps {
setValue: Dispatch<SetStateAction<number[]>>;
prefix: string;
dropDownMaxHeight?: number;
withTranslationPrefix?: boolean;
}
export default SelectProps;

View File

@ -14,6 +14,7 @@ function Select({
setValue,
prefix,
dropDownMaxHeight,
withTranslationPrefix = true,
}: SelectProps) {
const { t } = useTranslation("Cron");
@ -66,7 +67,7 @@ function Select({
return (
<SelectWrapper>
<span>{t(prefix)}</span>
<span>{withTranslationPrefix ? t(prefix) : prefix}</span>
<ComboBox
scaledOptions
size="content"