-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #264 from os2display/feature/2321-checkbox-options
Added checkbox options component for use in calendar modifiers
- Loading branch information
Showing
39 changed files
with
475 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/components/feed-sources/templates/calendar-api-feed-type.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { React, useEffect, useState } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { useTranslation } from "react-i18next"; | ||
import { Alert } from "react-bootstrap"; | ||
import MultiselectFromEndpoint from "../../slide/content/multiselect-from-endpoint"; | ||
import ConfigLoader from "../../../config-loader"; | ||
|
||
const CalendarApiFeedType = ({ | ||
feedSourceId, | ||
handleInput, | ||
formStateObject, | ||
}) => { | ||
const { t } = useTranslation("common", { | ||
keyPrefix: "feed-source-manager.dynamic-fields.calendar-api-feed-type", | ||
}); | ||
|
||
const [optionsEndpoint, setOptionsEndpoint] = useState(null); | ||
|
||
useEffect(() => { | ||
if (feedSourceId && feedSourceId !== "") { | ||
ConfigLoader.loadConfig().then((config) => { | ||
setOptionsEndpoint(`${config.api + feedSourceId}/config/locations`); | ||
}); | ||
} | ||
}, [feedSourceId]); | ||
|
||
return ( | ||
<> | ||
{!feedSourceId && ( | ||
<Alert className="mt-4" variant="warning"> | ||
{t("save-before-locations-can-be-set")} | ||
</Alert> | ||
)} | ||
{optionsEndpoint && ( | ||
<MultiselectFromEndpoint | ||
onChange={handleInput} | ||
name="locations" | ||
label={t("locations")} | ||
value={formStateObject.locations ?? []} | ||
optionsEndpoint={optionsEndpoint} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
CalendarApiFeedType.propTypes = { | ||
handleInput: PropTypes.func, | ||
formStateObject: PropTypes.shape({ | ||
locations: PropTypes.arrayOf(PropTypes.string), | ||
}), | ||
feedSourceId: PropTypes.string, | ||
}; | ||
|
||
export default CalendarApiFeedType; |
37 changes: 0 additions & 37 deletions
37
src/components/feed-sources/templates/calendar-feed-type.jsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.