From ef620fed61833c443ee4040689eb4273728917ce Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Thu, 7 Dec 2017 11:38:22 +1100 Subject: [PATCH 1/6] Newsletter unsubscribe page + large videos on VideoDebate --- app/assets/assets/locales/en/user.json | 6 +++- app/assets/assets/locales/fr/user.json | 6 +++- .../Users/NewsletterSubscription.jsx | 35 +++++++++++++++++++ app/components/Utils/Notification.jsx | 4 +-- app/router.jsx | 2 ++ .../_components/VideoDebate/video_debate.sass | 3 +- 6 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 app/components/Users/NewsletterSubscription.jsx diff --git a/app/assets/assets/locales/en/user.json b/app/assets/assets/locales/en/user.json index fccaf6a1f..2b42a0c39 100644 --- a/app/assets/assets/locales/en/user.json +++ b/app/assets/assets/locales/en/user.json @@ -23,5 +23,9 @@ "emailConfirmed": "Email confirmed", "linkedAccounts": "Linked accounts", "linkAccount": "Link account", - "unlinkAccount": "Unlink account" + "unlinkAccount": "Unlink account", + "newsletter": { + "unsubscribe_success": "You've been unsubscribed from our newsletter", + "unsubscribe_error": "Given token seems invalid. If the problem persist, contact us" + } } \ No newline at end of file diff --git a/app/assets/assets/locales/fr/user.json b/app/assets/assets/locales/fr/user.json index 5ce3582bf..4642b7958 100644 --- a/app/assets/assets/locales/fr/user.json +++ b/app/assets/assets/locales/fr/user.json @@ -23,5 +23,9 @@ "emailConfirmed": "Email confirmé", "linkedAccounts": "Comptes liés", "linkAccount": "Lier le compte", - "unlinkAccount": "Délier le compte" + "unlinkAccount": "Délier le compte", + "newsletter": { + "unsubscribe_success": "Désinscription de la newsletter enregistrée !", + "unsubscribe_error": "Erreur lors de la desinscription, le code est probablement invalide. Si le problème persiste, contactez nous" + } } \ No newline at end of file diff --git a/app/components/Users/NewsletterSubscription.jsx b/app/components/Users/NewsletterSubscription.jsx new file mode 100644 index 000000000..0945b4ba0 --- /dev/null +++ b/app/components/Users/NewsletterSubscription.jsx @@ -0,0 +1,35 @@ +import React from 'react' +import { translate } from 'react-i18next' + +import Notification from '../Utils/Notification' +import { HttpApi } from '../../API' +import { LoadingFrame } from '../Utils/LoadingFrame' + + +@translate('user') +export default class NewsletterSubscription extends React.PureComponent { + constructor(props) { + super(props) + this.state = {status: 'loading'} + } + + componentDidMount() { + // Send request + HttpApi.get(`newsletter/unsubscribe/${this.props.params.token}`) + .then(() => this.setState({status: 'success'})) + .catch(() => this.setState({status: 'error'})) + } + + render() { + if (this.state.status === 'loading') + return + const cssType = this.state.status === 'success' ? this.state.status : 'danger' + return ( +
+ + {this.props.t('newsletter.unsubscribe', {context: this.state.status})} + +
+ ) + } +} \ No newline at end of file diff --git a/app/components/Utils/Notification.jsx b/app/components/Utils/Notification.jsx index 169c3faf8..e1ef44545 100644 --- a/app/components/Utils/Notification.jsx +++ b/app/components/Utils/Notification.jsx @@ -1,7 +1,7 @@ import React from 'react' -const Notification = ({children, type='info'}) => -
+const Notification = ({children, type='info', ...otherProps}) => +
{children}
diff --git a/app/router.jsx b/app/router.jsx index b533f13a8..1d474aa3c 100644 --- a/app/router.jsx +++ b/app/router.jsx @@ -29,6 +29,7 @@ import ResetPasswordRequestForm from './components/Users/ResetPasswordRequestFor import ResetPasswordConfirmForm from './components/Users/ResetPasswordConfirmForm' import ConfirmEmail from './components/Users/ConfirmEmail' import { SpeakerPage } from './components/Speakers/SpeakerPage' +import NewsletterSubscription from './components/Users/NewsletterSubscription' ReactDOM.render( @@ -43,6 +44,7 @@ ReactDOM.render( + diff --git a/app/styles/_components/VideoDebate/video_debate.sass b/app/styles/_components/VideoDebate/video_debate.sass index 216cc7823..fc9e63d4e 100644 --- a/app/styles/_components/VideoDebate/video_debate.sass +++ b/app/styles/_components/VideoDebate/video_debate.sass @@ -55,7 +55,8 @@ overflow-y: auto #col-video padding-bottom: 25px - max-width: 600px + max-width: 700px + width: 36% #col-debate background: rgb(246, 247, 250) From f219ef331e05bef4d7d23b47978e9a666a5d9126 Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Thu, 7 Dec 2017 16:04:12 +1100 Subject: [PATCH 2/6] Resizable video column + Bubble menu: show cross when adding statement --- app/assets/assets/locales/en/videoDebate.json | 7 ++--- app/assets/assets/locales/fr/videoDebate.json | 1 + app/components/Statements/StatementForm.jsx | 6 ++--- .../VideoDebate/ActionBubbleMenu.jsx | 26 ++++++++++++++----- app/state/video_debate/statements/effects.js | 3 +++ .../{ => VideoDebate}/action_bubble_menu.sass | 6 ++--- .../_components/VideoDebate/video_debate.sass | 3 ++- app/styles/_components/statements.sass | 2 +- app/styles/application.sass | 2 +- 9 files changed, 38 insertions(+), 18 deletions(-) rename app/styles/_components/{ => VideoDebate}/action_bubble_menu.sass (90%) diff --git a/app/assets/assets/locales/en/videoDebate.json b/app/assets/assets/locales/en/videoDebate.json index 3e5ea3f1d..7a1df7013 100644 --- a/app/assets/assets/locales/en/videoDebate.json +++ b/app/assets/assets/locales/en/videoDebate.json @@ -49,9 +49,10 @@ "textPlaceholder": "Type a raw transcript of what the speaker says", "noSpeakerTextPlaceholder": "Describe what you see or select a speaker", "text": "Text", - "add": "Add a statement", - "autoscroll_enable": "Enable autoscroll", - "autoscroll_disable": "Disable autoscroll", + "add": "Add a Statement", + "abortAdd": "Close Statement Form", + "autoscroll_enable": "Enable Autoscroll", + "autoscroll_disable": "Disable Autoscroll", "reverseTimeLock_lock": "Unlock time marker", "reverseTimeLock_unlock": "Lock time marker" }, diff --git a/app/assets/assets/locales/fr/videoDebate.json b/app/assets/assets/locales/fr/videoDebate.json index ec7ad4049..6372aa286 100644 --- a/app/assets/assets/locales/fr/videoDebate.json +++ b/app/assets/assets/locales/fr/videoDebate.json @@ -53,6 +53,7 @@ "noSpeakerTextPlaceholder": "Décrivez ce qui apparait à l'image ou ajoutez un intervenant", "text": "Le texte", "add": "Ajouter une citation", + "abortAdd": "Annuler l'ajout de citation", "autoscroll_enable": "Activer le scroll automatique", "autoscroll_disable": "Désactiver le scroll automatique", "reverseTimeLock_lock": "Déverrouiller la position", diff --git a/app/components/Statements/StatementForm.jsx b/app/components/Statements/StatementForm.jsx index ed30ca4f8..c863dbbbc 100644 --- a/app/components/Statements/StatementForm.jsx +++ b/app/components/Statements/StatementForm.jsx @@ -24,14 +24,14 @@ const validate = ({text, time}, {t}) => { return errors } -const SpeakersSelect = ({input, speakers}) => { +const SpeakersSelect = ({input, speakers, label}) => { return (