diff options
author | Bennett <hello@vantezzen.io> | 2020-02-26 12:12:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 12:12:02 +0100 |
commit | ce988c280f5ca6dfc202d209e66d7cfce257c43b (patch) | |
tree | f469740cba0141af5b15a50b764a79f0b9b84a91 /src/components | |
parent | Avoid AppVeyor builds on i18n-only commits (diff) | |
download | ferdium-app-ce988c280f5ca6dfc202d209e66d7cfce257c43b.tar.gz ferdium-app-ce988c280f5ca6dfc202d209e66d7cfce257c43b.tar.zst ferdium-app-ce988c280f5ca6dfc202d209e66d7cfce257c43b.zip |
Implement user.css and user.js (#401)
* #83 Implement user.css and user.js
* Fix button layout in settings
* Fix user script not loading
Co-authored-by: Amine <amine@mouafik.fr>
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 65 |
1 files changed, 43 insertions, 22 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 89c82c7f8..98051d78f 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -33,6 +33,18 @@ const messages = defineMessages({ | |||
33 | id: 'settings.service.form.openDarkmodeCss', | 33 | id: 'settings.service.form.openDarkmodeCss', |
34 | defaultMessage: '!!!Open darkmode.css', | 34 | defaultMessage: '!!!Open darkmode.css', |
35 | }, | 35 | }, |
36 | openUserCss: { | ||
37 | id: 'settings.service.form.openUserCss', | ||
38 | defaultMessage: '!!!Open user.css', | ||
39 | }, | ||
40 | openUserJs: { | ||
41 | id: 'settings.service.form.openUserJs', | ||
42 | defaultMessage: '!!!Open user.js', | ||
43 | }, | ||
44 | recipeFileInfo: { | ||
45 | id: 'settings.service.form.recipeFileInfo', | ||
46 | defaultMessage: '!!!Your user files will be inserted into the webpage so you can customize services in any way you like. User files are only stored locally and are not transferred to other computers using the same account.', | ||
47 | }, | ||
36 | availableServices: { | 48 | availableServices: { |
37 | id: 'settings.service.form.availableServices', | 49 | id: 'settings.service.form.availableServices', |
38 | defaultMessage: '!!!Available services', | 50 | defaultMessage: '!!!Available services', |
@@ -131,8 +143,7 @@ export default @observer class EditServiceForm extends Component { | |||
131 | form: PropTypes.instanceOf(Form).isRequired, | 143 | form: PropTypes.instanceOf(Form).isRequired, |
132 | onSubmit: PropTypes.func.isRequired, | 144 | onSubmit: PropTypes.func.isRequired, |
133 | onDelete: PropTypes.func.isRequired, | 145 | onDelete: PropTypes.func.isRequired, |
134 | openDarkmodeCss: PropTypes.func.isRequired, | 146 | openRecipeFile: PropTypes.func.isRequired, |
135 | isOpeningDarkModeCss: PropTypes.bool.isRequired, | ||
136 | isSaving: PropTypes.bool.isRequired, | 147 | isSaving: PropTypes.bool.isRequired, |
137 | isDeleting: PropTypes.bool.isRequired, | 148 | isDeleting: PropTypes.bool.isRequired, |
138 | isProxyFeatureEnabled: PropTypes.bool.isRequired, | 149 | isProxyFeatureEnabled: PropTypes.bool.isRequired, |
@@ -199,8 +210,7 @@ export default @observer class EditServiceForm extends Component { | |||
199 | isSaving, | 210 | isSaving, |
200 | isDeleting, | 211 | isDeleting, |
201 | onDelete, | 212 | onDelete, |
202 | openDarkmodeCss, | 213 | openRecipeFile, |
203 | isOpeningDarkModeCss, | ||
204 | isProxyFeatureEnabled, | 214 | isProxyFeatureEnabled, |
205 | isServiceProxyIncludedInCurrentPlan, | 215 | isServiceProxyIncludedInCurrentPlan, |
206 | isSpellcheckerIncludedInCurrentPlan, | 216 | isSpellcheckerIncludedInCurrentPlan, |
@@ -226,23 +236,6 @@ export default @observer class EditServiceForm extends Component { | |||
226 | /> | 236 | /> |
227 | ); | 237 | ); |
228 | 238 | ||
229 | const openDarkmodeCssButton = isOpeningDarkModeCss ? ( | ||
230 | <Button | ||
231 | label={intl.formatMessage(messages.openDarkmodeCss)} | ||
232 | loaded={false} | ||
233 | buttonType="secondary" | ||
234 | className="settings__open-dark-mode-button" | ||
235 | disabled | ||
236 | /> | ||
237 | ) : ( | ||
238 | <Button | ||
239 | buttonType="secondary" | ||
240 | label={intl.formatMessage(messages.openDarkmodeCss)} | ||
241 | className="settings__open-dark-mode-button" | ||
242 | onClick={openDarkmodeCss} | ||
243 | /> | ||
244 | ); | ||
245 | |||
246 | let activeTabIndex = 0; | 239 | let activeTabIndex = 0; |
247 | if (recipe.hasHostedOption && service.team) { | 240 | if (recipe.hasHostedOption && service.team) { |
248 | activeTabIndex = 1; | 241 | activeTabIndex = 1; |
@@ -430,11 +423,39 @@ export default @observer class EditServiceForm extends Component { | |||
430 | </PremiumFeatureContainer> | 423 | </PremiumFeatureContainer> |
431 | )} | 424 | )} |
432 | </form> | 425 | </form> |
426 | |||
427 | {action === 'edit' && ( | ||
428 | <> | ||
429 | <div className="settings__open-recipe-file-container"> | ||
430 | <Button | ||
431 | buttonType="secondary" | ||
432 | label={intl.formatMessage(messages.openDarkmodeCss)} | ||
433 | className="settings__open-recipe-file-button" | ||
434 | onClick={() => openRecipeFile('darkmode.css')} | ||
435 | /> | ||
436 | <Button | ||
437 | buttonType="secondary" | ||
438 | label={intl.formatMessage(messages.openUserCss)} | ||
439 | className="settings__open-recipe-file-button" | ||
440 | onClick={() => openRecipeFile('user.css')} | ||
441 | /> | ||
442 | <Button | ||
443 | buttonType="secondary" | ||
444 | label={intl.formatMessage(messages.openUserJs)} | ||
445 | className="settings__open-recipe-file-button" | ||
446 | onClick={() => openRecipeFile('user.js')} | ||
447 | /> | ||
448 | </div> | ||
449 | <p style={{ marginTop: 10 }}> | ||
450 | <span className="mdi mdi-information" /> | ||
451 | {intl.formatMessage(messages.recipeFileInfo)} | ||
452 | </p> | ||
453 | </> | ||
454 | )} | ||
433 | </div> | 455 | </div> |
434 | <div className="settings__controls"> | 456 | <div className="settings__controls"> |
435 | {/* Delete Button */} | 457 | {/* Delete Button */} |
436 | {action === 'edit' && deleteButton} | 458 | {action === 'edit' && deleteButton} |
437 | {action === 'edit' && openDarkmodeCssButton} | ||
438 | 459 | ||
439 | {/* Save Button */} | 460 | {/* Save Button */} |
440 | {isSaving || isValidatingCustomUrl ? ( | 461 | {isSaving || isValidatingCustomUrl ? ( |