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

Release 0.9.3 #326

Merged
merged 30 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
29453a4
fix(package): update styled-icons to version 5.5.0
greenkeeper[bot] Dec 12, 2018
a312833
chore(package): update lockfile package-lock.json
greenkeeper[bot] Dec 12, 2018
d551cee
fix(package): update react-i18next to version 8.3.9
greenkeeper[bot] Dec 13, 2018
a7a8f9f
chore(package): update lockfile package-lock.json
greenkeeper[bot] Dec 13, 2018
5887784
fix(package): update react-apollo to version 2.3.3
greenkeeper[bot] Dec 13, 2018
bbdc986
chore(package): update lockfile package-lock.json
greenkeeper[bot] Dec 13, 2018
77e5a49
fix(package): update i18next to version 13.0.0
greenkeeper[bot] Dec 14, 2018
77c43cc
chore(package): update lockfile package-lock.json
greenkeeper[bot] Dec 14, 2018
22eacc7
fix(package): update core-js to version 2.6.1
greenkeeper[bot] Dec 18, 2018
98825a3
chore(package): update lockfile package-lock.json
greenkeeper[bot] Dec 18, 2018
9b559d8
chore(Videos): Improve error message when creation fails
Betree Dec 18, 2018
16193bc
fix(Modal): Close icon
Betree Dec 19, 2018
ab630e8
Merge pull request #319 from CaptainFact/fix/modal-close-icon
Betree Dec 19, 2018
f1f8034
fix(package): update react-player to version 1.8.0
greenkeeper[bot] Dec 19, 2018
ef6f29b
chore(package): update lockfile package-lock.json
greenkeeper[bot] Dec 19, 2018
97cc031
chore(Speaker): Don't try to translate title
Betree Dec 19, 2018
1eebc84
feat(MultiVideoProviders): Handle provider-specific shift offsets
Betree Dec 19, 2018
d0dc849
Merge pull request #321 from CaptainFact/chore/speaker-title-i18n
Betree Dec 19, 2018
5d1407c
Merge pull request #320 from CaptainFact/greenkeeper/react-player-1.8.0
Betree Dec 19, 2018
bbce5da
Merge pull request #318 from CaptainFact/chore/add-video-error-message
Betree Dec 19, 2018
b2c5491
Merge pull request #312 from CaptainFact/greenkeeper/styled-icons-5.5.0
Betree Dec 19, 2018
8261144
Merge pull request #315 from CaptainFact/greenkeeper/react-apollo-2.3.3
Betree Dec 19, 2018
14f536e
Merge pull request #316 from CaptainFact/greenkeeper/i18next-13.0.0
Betree Dec 19, 2018
dc46541
Merge pull request #314 from CaptainFact/greenkeeper/react-i18next-8.3.9
Betree Dec 19, 2018
ca9605d
Merge pull request #322 from CaptainFact/feat/shift-statements-per-pr…
Betree Dec 19, 2018
a367757
Merge pull request #317 from CaptainFact/greenkeeper/core-js-2.6.1
Betree Dec 19, 2018
88241c5
release: Bump version to 0.9.1
Betree Dec 20, 2018
3983b99
release: Bump version to 0.9.3
Betree Dec 20, 2018
ff7fac2
Merge branch 'master' into staging
Betree Dec 20, 2018
9225349
fix(Statement): Adjust focused statement calculation
Betree Dec 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/API/graphql_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export const VideosQuery = gql`
totalPages
entries {
hash_id: hashId
provider_id: providerId
provider
youtube_id: youtubeId
title
insertedAt
isPartner
Expand Down
10 changes: 10 additions & 0 deletions app/components/FormUtils/StyledLabel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import styled from 'styled-components'
import { fontSize, space } from 'styled-system'

const StyledLabel = styled.label`
${fontSize}
${space}
`

/** @component */
export default StyledLabel
15 changes: 13 additions & 2 deletions app/components/Modal/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@ import React from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router'
import classNames from 'classnames'
import styled from 'styled-components'

import { TimesCircle } from 'styled-icons/fa-regular/TimesCircle.cjs'

import { popModal } from '../../state/modals/reducer'
import { Icon } from '../Utils/Icon'
import Button from '../Utils/Button'

const CloseIcon = styled(TimesCircle)`
height: 1.5em;
width: 1.5em;
cursor: pointer;
&:hover {
opacity: 0.75;
}
`

const Modal = ({
helpLink,
Expand Down Expand Up @@ -35,7 +46,7 @@ const Modal = ({
<Icon name="question-circle" size="medium" />
</Link>
)}
<Button className="delete" onClick={handleCloseClick || popModal} />
<CloseIcon title="Close" onClick={handleCloseClick || popModal} />
</header>
)}
{overrideContentStructure ? (
Expand Down
24 changes: 1 addition & 23 deletions app/components/Speakers/SpeakerPreview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class SpeakerPreview extends React.PureComponent {
content={
<React.Fragment>
{this.renderName(speaker)}
<p className="subtitle">{this.getTitle()}</p>
<p className="subtitle">{speaker.title || '...'}</p>
</React.Fragment>
}
right={isAuthenticated && !withoutActions && this.renderActions()}
Expand Down Expand Up @@ -107,28 +107,6 @@ export class SpeakerPreview extends React.PureComponent {
)
}

getTitle() {
const { title, country } = this.props.speaker
// Only translate if title exists and is not user defined
if (!title) return '...'

let i18nTitle = ''
if (this.props.i18n.language === 'en')
// No need to translate title for english
i18nTitle = title
else {
// If unknown title, return raw title
const i18nTitleKey = `speaker.titles.${title}`
i18nTitle = this.props.t(i18nTitleKey)
if (i18nTitle === i18nTitleKey) return title
}
// Try to return title + nationality, otherwise fallback on translated title
return this.props.t('speaker.titleFormat', {
title: i18nTitle,
context: country
})
}

handleRemove() {
this.props.addModal({
Modal: ModalRemoveSpeaker,
Expand Down
4 changes: 2 additions & 2 deletions app/components/Statements/Statement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import StatementHeader from './StatementHeader'
@withNamespaces('videoDebate')
export default class Statement extends React.PureComponent {
render() {
const { statement, speaker, handleEdit, handleDelete } = this.props
const { statement, speaker, handleEdit, handleDelete, offset = 0 } = this.props

return (
<div>
<StatementHeader
statement={statement}
statementTime={statement.time + offset}
speaker={speaker}
handleEdit={handleEdit}
handleDelete={handleDelete}
Expand Down
8 changes: 5 additions & 3 deletions app/components/Statements/StatementContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { handleFormEffectResponse } from '../../lib/handle_effect_response'
import StatementComments from './StatementComments'
import { CommentForm } from '../Comments/CommentForm'
import Statement from './Statement'
import { getTimecodesOffset } from '../../lib/video_utils'

@connect(
(state, props) => ({
offset: state.VideoDebate.video.offset,
speaker: statementSelectors.getStatementSpeaker(state, props),
isFocused: statementSelectors.isStatementFocused(state, props),
scrollTo: state.VideoDebate.statements.scrollTo,
Expand All @@ -42,9 +44,7 @@ export default class StatementContainer extends React.PureComponent {

return (
<div
className={classNames('statement-container', {
'is-focused': isFocused
})}
className={classNames('statement-container', { 'is-focused': isFocused })}
ref="container"
>
<div className="card statement">
Expand Down Expand Up @@ -75,6 +75,7 @@ export default class StatementContainer extends React.PureComponent {
<StatementForm
form={`StatementForm-${statement.id}`}
initialValues={statement.toJS()}
offset={this.props.offset}
isBundled
handleAbort={() => this.setState({ isEditing: false })}
handleConfirm={s =>
Expand All @@ -94,6 +95,7 @@ export default class StatementContainer extends React.PureComponent {
speaker={speaker}
handleEdit={() => this.setState({ isEditing: true })}
handleDelete={() => this.setState({ isDeleting: true })}
offset={this.props.offset}
/>
)
}
Expand Down
35 changes: 26 additions & 9 deletions app/components/Statements/StatementForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export class StatementForm extends React.PureComponent {
constructor(props) {
super(props)
const lockedTime =
props.initialValues.time === undefined ? props.position : props.initialValues.time
props.initialValues.time === undefined
? props.position
: props.initialValues.time + props.offset

this.state = { lockedTime }
}

Expand All @@ -48,9 +51,11 @@ export class StatementForm extends React.PureComponent {
}

toggleLock() {
if (this.state.lockedTime === false)
if (this.state.lockedTime === false) {
this.setState({ lockedTime: this.props.position || 0 })
else this.setState({ lockedTime: false })
} else {
this.setState({ lockedTime: false })
}
}

moveTimeMarker(position) {
Expand All @@ -59,12 +64,23 @@ export class StatementForm extends React.PureComponent {
}

handleSubmit(statement) {
const currentTime =
this.state.lockedTime === false ? this.props.position : this.state.lockedTime
if (currentTime !== 0 && !currentTime)
statement.time = this.props.initialValues.time || 0
else statement.time = currentTime || 0
if (!statement.speaker_id) statement.speaker_id = null
const { position, initialValues, offset } = this.props
const { lockedTime } = this.state

// Get the best value for statement time and apply the reverse offset
// to use absolute timecode.
if (lockedTime !== false) {
statement.time = lockedTime - offset
} else if (position) {
statement.time = position - offset
} else {
statement.time = -offset
}

if (!statement.speaker_id) {
statement.speaker_id = null
}

this.props.handleConfirm(statement).then(
handleFormEffectResponse({
onSuccess: ({ id }) => this.props.setScrollTo({ id, __forceAutoScroll: true })
Expand All @@ -75,6 +91,7 @@ export class StatementForm extends React.PureComponent {
render() {
const {
position,
offset = 0,
handleSubmit,
valid,
speakers,
Expand Down
4 changes: 2 additions & 2 deletions app/components/Statements/StatementHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ReputationGuardTooltip from '../Utils/ReputationGuardTooltip'
export default withNamespaces('videoDebate')(
({
t,
statement,
statementTime,
speaker,
handleTimeClick,
handleShowHistory,
Expand All @@ -21,7 +21,7 @@ export default withNamespaces('videoDebate')(
}) => (
<header className="card-header">
<p className="card-header-title">
<TimeDisplay time={statement.time} handleClick={handleTimeClick} />
<TimeDisplay time={statementTime} handleClick={handleTimeClick} />
{speaker && speaker.picture && (
<img className="speaker-mini" src={speaker.picture} alt="" />
)}
Expand Down
6 changes: 4 additions & 2 deletions app/components/Statements/StatementsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import { FULLHD_WIDTH_THRESHOLD } from '../../constants'
@connect(
state => ({
statements: state.VideoDebate.statements.data,
statementFormSpeakerId: statementFormValueSelector(state, 'speaker_id')
statementFormSpeakerId: statementFormValueSelector(state, 'speaker_id'),
offset: state.VideoDebate.video.offset
}),
{ closeStatementForm, postStatement, setScrollTo }
)
Expand All @@ -34,11 +35,12 @@ export default class StatementsList extends React.PureComponent {
}

render() {
const { statementFormSpeakerId, statements } = this.props
const { statementFormSpeakerId, statements, offset } = this.props
return (
<div className="statements-list">
{statementFormSpeakerId !== undefined && (
<StatementForm
offset={offset}
initialValues={{ speaker_id: statementFormSpeakerId }}
enableReinitialize
keepDirtyOnReinitialize
Expand Down
44 changes: 44 additions & 0 deletions app/components/StyledUtils/Title.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styled from 'styled-components'
import { fontSize, space, themeGet } from 'styled-system'

export const StyledH1 = styled.h1`
font-size: ${themeGet('fontSizes.0')};
margin-bottom: ${themeGet('space.4')};
${fontSize}
${space}
`

export const StyledH2 = styled.h2`
font-size: ${themeGet('fontSizes.1')};
margin-bottom: ${themeGet('space.4')};
${fontSize}
${space}
`

export const StyledH3 = styled.h3`
font-size: ${themeGet('fontSizes.2')};
margin-bottom: ${themeGet('space.3')};
${fontSize}
${space}
`

export const StyledH4 = styled.h4`
font-size: ${themeGet('fontSizes.3')};
margin-bottom: ${themeGet('space.2')};
${fontSize}
${space}
`

export const StyledH5 = styled.h5`
font-size: ${themeGet('fontSizes.4')};
margin-bottom: ${themeGet('space.2')};
${fontSize}
${space}
`

export const StyledH6 = styled.h6`
font-size: ${themeGet('fontSizes.5')};
margin-bottom: ${themeGet('space.1')};
${fontSize}
${space}
`
9 changes: 5 additions & 4 deletions app/components/Videos/AddVideoForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ export class AddVideoForm extends React.PureComponent {
}

handleSubmit(video) {
const promise = this.props.postVideo(video)
return promise.then(action => {
if (!action.error) this.props.router.push(`/videos/${action.payload.hash_id}`)
else if (action.payload === 'unauthorized' && !this.props.isAuthenticated)
return this.props.postVideo(video).then(action => {
if (!action.error) {
this.props.router.push(`/videos/${action.payload.hash_id}`)
} else if (action.payload === 'unauthorized' && !this.props.isAuthenticated) {
this.props.router.push('/login')
}
})
}
}
Loading