@@ -10,9 +10,9 @@ import FormSelect from "../util/forms/select";
1010import ContentBody from "../util/content-body/content-body" ;
1111import ContentFooter from "../util/content-footer/content-footer" ;
1212import FormInput from "../util/forms/form-input" ;
13- import CalendarApiFeedType from "./templates/calendar-api-feed-type.jsx " ;
14- import NotifiedFeedType from "./templates/notified-feed-type.jsx " ;
15- import EventDatabaseApiFeedType from "./templates/event-database-feed-type.jsx " ;
13+ import CalendarApiFeedType from "./templates/calendar-api-feed-type" ;
14+ import NotifiedFeedType from "./templates/notified-feed-type" ;
15+ import EventDatabaseApiFeedType from "./templates/event-database-feed-type" ;
1616
1717/**
1818 * The feed-source form component.
@@ -22,13 +22,14 @@ import EventDatabaseApiFeedType from "./templates/event-database-feed-type.jsx";
2222 * @param {Function } props.handleInput Handles form input.
2323 * @param {Function } props.handleSubmit Handles form submit.
2424 * @param {string } props.headerText Headline text.
25- * @param {boolean } [props.isLoading=false] Indicator of whether the form is
26- * loading. Default is `false`
27- * @param {string } [props.loadingMessage=""] The loading message for the
28- * spinner. Default is `""`
29- * @param {object } props.feedSource The feed source object
25+ * @param {boolean } [props.isLoading] Indicator of whether the form is loading.
26+ * Default is `false`
27+ * @param {string } [props.loadingMessage] The loading message for the spinner.
28+ * Default is `""`
3029 * @param {object } props.feedSourceTypeOptions The options for feed source types
3130 * @param {string } props.mode The mode
31+ * @param {Function } props.onFeedTypeChange Callback on feed type change.
32+ * @param {Function } props.handleSecretInput Callback on secret input change.
3233 * @returns {object } The feed-source form.
3334 */
3435function FeedSourceForm ( {
@@ -81,15 +82,28 @@ function FeedSourceForm({
8182 options = { feedSourceTypeOptions }
8283 />
8384
84- { feedSource ?. feedType === "App\\Feed\\CalendarApiFeedType" &&
85- ( < CalendarApiFeedType handleInput = { handleSecretInput } formStateObject = { feedSource . secrets } mode = { mode } feedSourceId = { feedSource [ '@id' ] } /> )
86- }
87- { feedSource ?. feedType === "App\\Feed\\EventDatabaseApiFeedType" &&
88- ( < EventDatabaseApiFeedType handleInput = { handleSecretInput } formStateObject = { feedSource . secrets } mode = { mode } /> )
89- }
90- { feedSource ?. feedType === "App\\Feed\\NotifiedFeedType" &&
91- ( < NotifiedFeedType handleInput = { handleSecretInput } formStateObject = { feedSource . secrets } mode = { mode } /> )
92- }
85+ { feedSource ?. feedType === "App\\Feed\\CalendarApiFeedType" && (
86+ < CalendarApiFeedType
87+ handleInput = { handleSecretInput }
88+ formStateObject = { feedSource . secrets }
89+ mode = { mode }
90+ feedSourceId = { feedSource [ "@id" ] }
91+ />
92+ ) }
93+ { feedSource ?. feedType === "App\\Feed\\EventDatabaseApiFeedType" && (
94+ < EventDatabaseApiFeedType
95+ handleInput = { handleSecretInput }
96+ formStateObject = { feedSource . secrets }
97+ mode = { mode }
98+ />
99+ ) }
100+ { feedSource ?. feedType === "App\\Feed\\NotifiedFeedType" && (
101+ < NotifiedFeedType
102+ handleInput = { handleSecretInput }
103+ formStateObject = { feedSource . secrets }
104+ mode = { mode }
105+ />
106+ ) }
93107 </ ContentBody >
94108 < ContentFooter >
95109 < Button
@@ -126,13 +140,11 @@ FeedSourceForm.propTypes = {
126140 } ) ,
127141 handleInput : PropTypes . func . isRequired ,
128142 handleSubmit : PropTypes . func . isRequired ,
143+ handleSecretInput : PropTypes . func . isRequired ,
144+ onFeedTypeChange : PropTypes . func . isRequired ,
129145 headerText : PropTypes . string . isRequired ,
130146 isLoading : PropTypes . bool ,
131147 loadingMessage : PropTypes . string ,
132- dynamicFormElement : PropTypes . oneOfType ( [
133- PropTypes . element ,
134- PropTypes . arrayOf ( PropTypes . element ) ,
135- ] ) ,
136148 feedSourceTypeOptions : PropTypes . arrayOf (
137149 PropTypes . shape ( {
138150 value : PropTypes . string . isRequired ,
0 commit comments