diff --git a/CHANGELOG.md b/CHANGELOG.md index 5816c1b5..226d38a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- [#253](https://github.com/os2display/display-admin-client/pull/253) + - Refactored scheduling to increase user experience. + - Added interval and count to rrule inputs. - [#249](https://github.com/os2display/display-admin-client/pull/249) - Set infrastructure node version to 20. - Fixed base path to /admin in vite setup. diff --git a/package.json b/package.json index bd50910b..583c73bd 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "react-select": "^5.2.2", "react-table": "^7.7.0", "react-toastify": "^10.0.0", + "react-tooltip": "^5.28.0", "rrule": "^2.7.2", "typescript": "^4.4.2", "ulid": "^2.3.0", diff --git a/src/components/util/forms/form-input.jsx b/src/components/util/forms/form-input.jsx index 27316ff0..78eae152 100644 --- a/src/components/util/forms/form-input.jsx +++ b/src/components/util/forms/form-input.jsx @@ -2,6 +2,7 @@ import { React } from "react"; import PropTypes from "prop-types"; import { FormControl, FormGroup, FormLabel, InputGroup } from "react-bootstrap"; import { useTranslation } from "react-i18next"; +import Tooltip from "../tooltip"; /** * An input for forms. @@ -19,6 +20,7 @@ import { useTranslation } from "react-i18next"; * @param {string} props.formGroupClasses Classes for the form group * @param {boolean} props.disabled If the input is disabled * @param {boolean} props.required If the input is required + * @param {string | null} props.tooltip Tooltip text. Does not display if null. * @param {object | null} props.inputGroupExtra Extra elements for input group. * @returns {object} An input. */ @@ -36,6 +38,7 @@ function FormInput({ label = null, inputGroupExtra = null, required = false, + tooltip = null, ...rest }) { const { t } = useTranslation("common"); @@ -43,12 +46,15 @@ function FormInput({ /* eslint-disable react/jsx-props-no-spreading */ return ( - {label && ( + {label && (<> {label} {required && " *"} - )} + {tooltip !== null && ( + + )} + )} + {tooltip !== null && ( + <> + + + + )} - changeSchedule(schedule.id, target.id, target.value) - } - value={schedule.freq} - label={t("schedule.freq")} - name="freq" - options={freqOptions} - allowNull={false} - /> - -
- - - - byWeekdayOptions.find( - (weekDay) => weekDay.value === weekdayNumber - ) - ) - : [] - } - name="byweekday" - disableSearch - overrideStrings={{ - allItemsAreSelected: t("schedule.all-selected"), - clearSelected: t("schedule.clear-selection"), - selectAll: t("schedule.selected-all"), - selectSomeItems: t("schedule.select-some-options"), - }} - labelledBy="Select" - onChange={(value) => { - changeSchedule( - schedule.id, - "byweekday", - value.map((v) => v.value) - ); - }} - /> - -
- - -
-
- - - - changeSchedule( - schedule.id, - "bymonth", - values.map((v) => v.value) - ) - } - /> - -
-
- - changeSchedule(schedule.id, target.id, target.value) - } - name="byweekno" - type="number" - min="0" - max="52" +
+
+ toggleRepeat(schedule)} + name="enableRepeat" + type="checkbox" + value={displayRepeat(schedule)} + label={t('schedule.enable-repeat')} + formGroupClasses="d-inline-block mb-2" /> -
-
-
+ -
-
-
- - + {displayRepeat(schedule) && ( + <> +
+
+