Skip to content

Commit

Permalink
Merge pull request #563 from ustwo/bug/fix-all-the-errors
Browse files Browse the repository at this point in the history
fix: going through the app and fixing React errors / warnings
  • Loading branch information
Daniel Demmel committed Jun 5, 2017
2 parents e544eb7 + e49fafa commit 711daf6
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/app/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ const App = React.createClass({
this.getViewportDimensions();

/* Get dimensions of viewport to calculte mousePosition and scrollPosition (for example) */
window.addEventListener('scroll', this.getDocumentScrollPosition.bind(this), false);
window.addEventListener('scroll', this.getDocumentScrollPosition, false);
/* Get new dimensions when device orientationchange etc */
window.addEventListener('resize', this.getViewportDimensions.bind(this), false);
window.addEventListener('resize', this.getViewportDimensions, false);

Store.on('change', this.onChangeStore);

Expand Down
6 changes: 4 additions & 2 deletions src/app/components/events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const PageEvents = React.createClass({
className="events-list"
featured={index === 0}
data={eventData}
key={eventData.slug}
/>
);
});
Expand All @@ -139,11 +140,12 @@ const PageEvents = React.createClass({
let output, events;
if (archivedEvents) {
if (archivedEvents.length) {
events = archivedEvents.map((archivedEventData, index) => {
events = archivedEvents.map(archivedEventData => {
return (
<ArchivedEventsListItem
className='archived-events-list'
data={archivedEventData}
key={archivedEventData.slug}
/>
);
});
Expand Down Expand Up @@ -182,7 +184,7 @@ const PageEvents = React.createClass({
archivedEventsPaginationTotal,
currentPage,
footer,
documentScrollPosition,
documentScrollPosition,
viewportDimensions } = this.props;
const classes = classnames('page-events', this.props.className, {
loading: isLoadingInitialEvents || isLoadingStudioEvents
Expand Down
1 change: 0 additions & 1 deletion src/app/components/hero/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class Hero extends Component {
if (this.props.showDownIndicator) {
indicator = (
<DownIndicator
ref="downIndicator"
onClick={this.onClickDownIndicator}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/join-us/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const PageJoinUs = React.createClass({
aria-selected={studioSlug === selectedStudioSlug}
className={`tab ${studioSlug} ${studioSlug === selectedStudioSlug ? 'active' : ''}`}
ref={(ref) => studioSlug === selectedStudioSlug ? this.activeTab = ref : ''}
onClick={this.handleClick.bind(this)}
onClick={this.handleClick}
style={studioSelectedColor}>
<a
href={uri}
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/loader-wrapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ class LoaderWrapper extends Component {

componentWillReceiveProps(nextProps) {
if (nextProps.loaded) {
setTimeout(() => {
this.hideTimeout = window.setTimeout(() => {
this.setState({ hide: true });
}.bind(this), 500);
}
}

componentWillUnmount() {
window.clearTimeout(this.hideTimeout);
}

render() {
const { currentPage, homeLoaderShown, loaded, viewportDimensions } = this.props;

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/navigation-overlay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const NavigationOverlay = React.createClass({
hovered: slug === this.state.hoveredItem
})
return (
<div className={classes}></div>
<div className={classes} key={link.id}></div>
);
});
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/related-content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export default class RelatedContent extends React.Component {
renderItem(data) {
let item;
if(data.type === 'post') {
item = <div className="related-content-item"><BlogPostListItem data={data} /></div>;
item = <div className="related-content-item" key={data.id}><BlogPostListItem data={data} /></div>;
} else {
let image = get(data, '_embedded.wp:attachment.1');
item = <div className="related-content-item"><WorkItem data={data} image={image} /></div>;
item = <div className="related-content-item" key={data.id}><WorkItem data={data} image={image} /></div>;
}
return item;
}
Expand Down
18 changes: 8 additions & 10 deletions src/app/components/studio-contact/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import kebabCase from 'lodash/string/kebabCase';

import StudioClock from 'app/components/studio-clock';

const phoneNumbers = {
'Sydney': '+61 2 8188 3900',
'London': '+44 (0)20 7613 0433',
'New York': '+1 212-518-4900',
'Malmö': '+46 (0)40-330480'
};

const StudioContact = React.createClass({
getInitialState: function() {
var date = moment();
Expand All @@ -22,12 +15,17 @@ const StudioContact = React.createClass({
componentDidMount: function() {
this.startClock();
},
componentWillUnmount: function() {
this.stopClock();
},
startClock: function() {
var self = this;
window.setInterval(function () {
self.setState({ date: moment() });
this.clockInterval = window.setInterval(function () {
this.setState({ date: moment() });
}.bind(this), 60000);
},
stopClock() {
window.clearInterval(this.clockInterval);
},
onClick() {
this.props.onClick && this.props.onClick();
},
Expand Down
6 changes: 2 additions & 4 deletions src/app/components/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ class Video extends Component {
src={src}
width="1280"
height="720"
frameborder="0"
frameBorder="0"
title="Video"
webkitallowfullscreen
mozallowfullscreen
allowfullscreen>
allowFullScreen>
</iframe>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/work-process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class WorkProcess extends Component {

const workProcess = data.map(item => {
return (
<div className={`work-process-item ${kebabCase(item.title)}`}>
<div className={`work-process-item ${kebabCase(item.title)}`} key={item.name}>
<img src={item.image} alt={`${item.title} icon`} />
<h2 onClick={() => goToCapability(item.name)}>{item.title}</h2>
<p>{item.text}</p>
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/work/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class PageWork extends Component {

renderWhatWeDo() {
const { isMobile } = this.props;
const workIntroExtra = workData.intro.extra.map(item => <p className="work-intro-extra">{item}</p>);

const workIntroExtra = workData.intro.extra.map(item => <p className="work-intro-extra" key={item}>{item}</p>);

return (
<div className="work-whatwedo-wrapper">
Expand Down

0 comments on commit 711daf6

Please sign in to comment.