diff --git a/frontend/public/static/locale/en-US/translate.ftl b/frontend/public/static/locale/en-US/translate.ftl index 277ff7a560..1a723668d8 100644 --- a/frontend/public/static/locale/en-US/translate.ftl +++ b/frontend/public/static/locale/en-US/translate.ftl @@ -4,10 +4,11 @@ ## Editor ## Allows contributors to modify or propose a translation -entitydetails-editor-button-copy = Copy -entitydetails-editor-button-clear = Clear -entitydetails-editor-button-save = Save -entitydetails-editor-button-suggest = Suggest +editor-editor-sign-in-to-translate = Sign in to translate. +editor-editor-button-copy = Copy +editor-editor-button-clear = Clear +editor-editor-button-save = Save +editor-editor-button-suggest = Suggest ## EditorSettings diff --git a/frontend/public/static/locale/es/translate.ftl b/frontend/public/static/locale/es/translate.ftl index c1b6eb2370..d5af3c452a 100644 --- a/frontend/public/static/locale/es/translate.ftl +++ b/frontend/public/static/locale/es/translate.ftl @@ -4,10 +4,10 @@ ## Editor ## Allows contributors to modify or propose a translation -entitydetails-editor-button-copy = Copiar -entitydetails-editor-button-clear = Borrar -entitydetails-editor-button-save = Guardar -entitydetails-editor-button-suggest = Sugerir +editor-editor-button-copy = Copiar +editor-editor-button-clear = Borrar +editor-editor-button-save = Guardar +editor-editor-button-suggest = Sugerir ## Entity Navigation diff --git a/frontend/public/static/locale/fr/translate.ftl b/frontend/public/static/locale/fr/translate.ftl index fa3dc48ee2..674afe194c 100644 --- a/frontend/public/static/locale/fr/translate.ftl +++ b/frontend/public/static/locale/fr/translate.ftl @@ -4,10 +4,11 @@ ## Editor ## Allows contributors to modify or propose a translation -entitydetails-editor-button-copy = Copier -entitydetails-editor-button-clear = Effacer -entitydetails-editor-button-save = Sauvegarder -entitydetails-editor-button-suggest = Suggérer +editor-editor-sign-in-to-translate = Connectez-vous pour traduire. +editor-editor-button-copy = Copier +editor-editor-button-clear = Effacer +editor-editor-button-save = Sauvegarder +editor-editor-button-suggest = Suggérer ## EditorSettings diff --git a/frontend/src/modules/editor/components/Editor.css b/frontend/src/modules/editor/components/Editor.css index 0aa2e60ff0..1a7807630a 100644 --- a/frontend/src/modules/editor/components/Editor.css +++ b/frontend/src/modules/editor/components/Editor.css @@ -20,8 +20,17 @@ width: 100%; } +.editor .banner { + font-style: italic; + line-height: 40px; +} + +.editor .banner a { + color: #7BC876; +} + .editor menu { - font-size: 14px; + color: #fff; padding: 10px; position: relative; } diff --git a/frontend/src/modules/editor/components/Editor.js b/frontend/src/modules/editor/components/Editor.js index 4387221fce..36985a8fec 100644 --- a/frontend/src/modules/editor/components/Editor.js +++ b/frontend/src/modules/editor/components/Editor.js @@ -12,7 +12,7 @@ import EditorSettings from './EditorSettings'; import KeyboardShortcuts from './KeyboardShortcuts'; import type { Locale } from 'core/locales'; -import type { SettingsState } from 'core/user'; +import type { UserState } from 'core/user'; import type { DbEntity } from 'modules/entitieslist'; @@ -21,7 +21,7 @@ type Props = {| entity: ?DbEntity, locale: Locale, pluralForm: number, - settings: SettingsState, + user: UserState, sendTranslation: () => void, updateEditorTranslation: (string) => void, updateSetting: (string, boolean) => void, @@ -79,13 +79,27 @@ export default class Editor extends React.Component { updateTranslation={ this.updateTranslation } /> + { !this.props.user.isAuthenticated ? + + } + > +

+ { 'Sign in to translate.' } +

+
+ : +
- + - + - { this.props.settings.forceSuggestions ? + { this.props.user.settings.forceSuggestions ? // Suggest button, will send an unreviewed translation. - +
-
-
+
+ + }
; } diff --git a/frontend/src/modules/editor/components/Editor.test.js b/frontend/src/modules/editor/components/Editor.test.js index 2ec02acf81..7f782474f7 100644 --- a/frontend/src/modules/editor/components/Editor.test.js +++ b/frontend/src/modules/editor/components/Editor.test.js @@ -3,6 +3,8 @@ import { shallow } from 'enzyme'; import sinon from 'sinon'; import Editor from './Editor'; +import EditorSettings from './EditorSettings'; +import KeyboardShortcuts from './KeyboardShortcuts'; const TRANSLATION = 'test'; @@ -22,7 +24,8 @@ function createShallowEditor({ suggestMock, updateMock, pluralForm = -1, - forceSuggestions = true + forceSuggestions = true, + isAuthenticated = true, } = {}) { return shallow(); } @@ -94,4 +102,14 @@ describe('', () => { wrapper.find('.action-save').simulate('click'); expect(suggestMock.calledOnce).toBeTruthy(); }); + + it('hides the settings and actions when the user is logged out', () => { + const wrapper = createShallowEditor({ isAuthenticated: false }); + + expect(wrapper.find(EditorSettings)).toHaveLength(0); + expect(wrapper.find(KeyboardShortcuts)).toHaveLength(0); + expect(wrapper.find('#editor-editor-button-copy')).toHaveLength(0); + + expect(wrapper.find('#editor-editor-sign-in-to-translate')).toHaveLength(1); + }); }); diff --git a/frontend/src/modules/editor/components/EditorSettings.css b/frontend/src/modules/editor/components/EditorSettings.css index 97ed6118a9..7f6e7f7872 100644 --- a/frontend/src/modules/editor/components/EditorSettings.css +++ b/frontend/src/modules/editor/components/EditorSettings.css @@ -1,5 +1,6 @@ .editor-settings { float: left; + font-size: 14px; line-height: 22px; } diff --git a/frontend/src/modules/entitydetails/components/EntityDetails.js b/frontend/src/modules/entitydetails/components/EntityDetails.js index 94959d0bf4..a48200d614 100644 --- a/frontend/src/modules/entitydetails/components/EntityDetails.js +++ b/frontend/src/modules/entitydetails/components/EntityDetails.js @@ -203,7 +203,7 @@ export class EntityDetailsBase extends React.Component { entity={ state.selectedEntity } locale={ state.locale } pluralForm= { state.pluralForm } - settings={ state.user.settings } + user={ state.user } sendTranslation={ this.sendTranslation } updateEditorTranslation={ this.updateEditorTranslation } updateSetting={ this.updateSetting }