Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add react-helmet to put video titlte in title tag when watching it #98

Merged
merged 10 commits into from
Mar 15, 2018
4 changes: 4 additions & 0 deletions app/components/App/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react"
import { connect } from "react-redux"
import { I18nextProvider } from 'react-i18next'
import { Helmet } from 'react-helmet'

import i18n from '../../i18n/i18n'
import { FlashMessages } from "../Utils"
Expand All @@ -20,6 +21,9 @@ export default class App extends React.PureComponent {
return (
<I18nextProvider i18n={i18n}>
<div lang={this.props.locale}>
<Helmet>
<title>CaptainFact</title>
</Helmet>
<MainModalContainer/>
<div className="columns is-mobile is-gapless">
<Sidebar className="column is-narrow"/>
Expand Down
6 changes: 6 additions & 0 deletions app/components/VideoDebate/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react"
import { connect } from "react-redux"
import { translate } from 'react-i18next'
import { Helmet } from 'react-helmet'

import { ErrorView } from "../Utils"
import { isAuthenticated } from "../../state/users/current_user/selectors"
Expand All @@ -14,6 +15,8 @@ import { ColumnDebate } from './ColumnDebate'

@connect(state => ({
videoErrors: state.VideoDebate.video.errors,
isLoading: state.VideoDebate.video.isLoading,
videoTitle: state.VideoDebate.video.data.title,
authenticated: isAuthenticated(state),
}), {
joinVideoDebateChannel, joinCommentsChannel, joinStatementsChannel,
Expand Down Expand Up @@ -44,6 +47,9 @@ export class VideoDebate extends React.PureComponent {
return <ErrorView error={this.props.videoErrors}/>
return (
<div id="video-show" className="columns is-gapless">
<Helmet>
{!this.props.isLoading && <title>{this.props.videoTitle}</title>}
</Helmet>
<ColumnVideo view={this.props.route.view}/>
<ColumnDebate view={this.props.route.view} videoId={this.props.params.videoId}/>
</div>
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "captain-fact-frontend",
"version": "0.8.4",
"version": "0.8.5",
"private": true,
"scripts": {
"start": "brunch watch --server",
Expand Down Expand Up @@ -43,9 +43,10 @@
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-flip-move": "^3.0.1",
"react-helmet": "^5.2.0",
"react-i18next": "^7.4.0",
"react-markdown": "^3.2.2",
"react-player": "^1.2.1",
"react-player": "0.25.3",
"react-redux": "^5.0.7",
"react-router": "^3.0.1",
"react-select": "^1.2.1",
Expand Down