Web:Component:Cron Fixed prefix
This commit is contained in:
parent
ce22803620
commit
57e46fffbb
@ -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]);
|
||||
|
||||
|
@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ interface SelectProps {
|
||||
setValue: Dispatch<SetStateAction<number[]>>;
|
||||
prefix: string;
|
||||
dropDownMaxHeight?: number;
|
||||
withTranslationPrefix?: boolean;
|
||||
}
|
||||
|
||||
export default SelectProps;
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user