From bdf5132a8058efaf8a89f2fb10b09764dc408569 Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Sat, 15 Aug 2020 17:03:05 +0300 Subject: [PATCH] Plugin manager create proposal modal has a left border and padding like the other modals --- .../CreatePluginManagerProposal.tsx | 365 +++++++++--------- 1 file changed, 183 insertions(+), 182 deletions(-) diff --git a/src/components/Proposal/Create/PluginForms/CreatePluginManagerProposal.tsx b/src/components/Proposal/Create/PluginForms/CreatePluginManagerProposal.tsx index 18b7aefac..0bbb39511 100644 --- a/src/components/Proposal/Create/PluginForms/CreatePluginManagerProposal.tsx +++ b/src/components/Proposal/Create/PluginForms/CreatePluginManagerProposal.tsx @@ -498,201 +498,202 @@ class CreatePluginManagerProposal extends React.Component { : ""} +
+
+ { + const errors: any = {}; + + this.currentFormValues = values; + + const require = (name: string) => { + if (!(values as any)[name]) { + errors[name] = "Required"; + } + }; -
- { - const errors: any = {}; + require("description"); + require("title"); - this.currentFormValues = values; + if (values.title.length > 120) { + errors.title = "Title is too long (max 120 characters)"; + } - const require = (name: string) => { - if (!(values as any)[name]) { - errors[name] = "Required"; + if (currentTab === "addPlugin") { + require("pluginToAdd"); + } else if (currentTab === "removePlugin") { + require("pluginToRemove"); + } else if (currentTab === "replacePlugin") { + require("pluginToAdd"); + require("pluginToRemove"); } - }; - - require("description"); - require("title"); - - if (values.title.length > 120) { - errors.title = "Title is too long (max 120 characters)"; - } - - if (currentTab === "addPlugin") { - require("pluginToAdd"); - } else if (currentTab === "removePlugin") { - require("pluginToRemove"); - } else if (currentTab === "replacePlugin") { - require("pluginToAdd"); - require("pluginToRemove"); - } - - if (!isValidUrl(values.url)) { - errors.url = "Invalid URL"; - } - - return errors; - }} - onSubmit={this.handleSubmit} - // eslint-disable-next-line react/jsx-no-bind - render={({ - errors, - touched, - handleChange, - isSubmitting, - resetForm, - setFieldValue, - values, - }: FormikProps) => { - return ( -
- - {(currentTab === "addPlugin") ? -
Propose to add a new plugin to the DAO.
: - (currentTab === "removePlugin") ? -
Propose to remove a plugin from the DAO.
: - (currentTab === "replacePlugin") ? -
Propose to replace a plugin from the DAO.
: "" - } - - - - - - - - - { setFieldValue("description", value); }} - id="descriptionInput" - placeholder={i18next.t("Description Placeholder")} - name="description" - className={touched.description && errors.description ? css.error : null} - /> - - - - - -
- -
- - - - - - -
-
-
-
-
-
+
+
+ + { + // call the built-in handleChange + handleChange(e); + }} + > + + {Object.entries(PLUGIN_NAMES).map(([name, uiName]) => { + return ; + })} + +
-
- - - - - - - - -
+ +
+ + + + - -
- - ); - }} - /> + + + + + + +
+ + ); + }} + /> +
);