commit
stringlengths 40
40
| old_file
stringlengths 4
150
| new_file
stringlengths 4
150
| old_contents
stringlengths 0
3.26k
| new_contents
stringlengths 1
4.43k
| subject
stringlengths 15
501
| message
stringlengths 15
4.06k
| lang
stringclasses 4
values | license
stringclasses 13
values | repos
stringlengths 5
91.5k
| diff
stringlengths 0
4.35k
|
---|---|---|---|---|---|---|---|---|---|---|
ccd27d39d9edd25bd8a709c297385d2797470478 | src/components/subs-list.jsx | src/components/subs-list.jsx | import React from 'react';
import throbber16 from '../../assets/images/throbber-16.gif';
import {tileUserListFactory, WITH_MUTUALS} from './tile-user-list';
const TileList = tileUserListFactory({type: WITH_MUTUALS});
export default (props) => {
const title = props.title || "No title";
if (props.isPending) {
return (
<div>
<h3>
<span>{title} </span>
<span className="comment-throbber">
<img width="16" height="16" src={throbber16}/>
</span>
</h3>
</div>
);
}
if (props.errorString) {
return (
<div>
<h3><span>{title}</span></h3>
<span className="error-string">{props.errorString}</span>
</div>
);
}
const sections = props.listSections.filter(s => s.users.length > 0);
const showTitles = !!props.showSectionsTitles || (sections.length > 1);
return (
<div>
<h3><span>{title}</span></h3>
{sections.map(s => [
(showTitles && s.title) ? <h4 className="tile-list-subheader">{s.title}</h4> : false,
<TileList users={s.users}/>
])}
</div>
);
};
| import React from 'react';
import throbber16 from '../../assets/images/throbber-16.gif';
import {tileUserListFactory, WITH_MUTUALS} from './tile-user-list';
const TileList = tileUserListFactory({type: WITH_MUTUALS});
export default (props) => {
const title = props.title || "No title";
if (props.isPending) {
return (
<div>
<h3>
<span>{title} </span>
<span className="comment-throbber">
<img width="16" height="16" src={throbber16}/>
</span>
</h3>
</div>
);
}
if (props.errorString) {
return (
<div>
<h3><span>{title}</span></h3>
<span className="error-string">{props.errorString}</span>
</div>
);
}
const sections = props.listSections.filter(s => s.users.length > 0);
const showTitles = !!props.showSectionsTitles || (sections.length > 1);
return (
<div>
<h3><span>{title}</span></h3>
{sections.map(s => [
(showTitles && s.title) ? <h4 className="tile-list-subheader">{s.title}</h4> : false,
<TileList users={s.users}/>
])}
{!sections.length ? <div>Nobody's here!</div> : ''}
</div>
);
};
| Add a message for empty TileList | Add a message for empty TileList
| JSX | mit | kadmil/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client | ---
+++
@@ -43,6 +43,8 @@
<TileList users={s.users}/>
])}
+ {!sections.length ? <div>Nobody's here!</div> : ''}
+
</div>
);
}; |
18c2dbb4f8b147fcfcb371cbfccc7ce328ea57e1 | src/js/components/Logout.jsx | src/js/components/Logout.jsx | import React from 'react';
import Router from 'react-router';
import UserActions from '../actions/UserActions';
var Logout = React.createClass({
mixins: [Router.Navigation],
componentWillMount() {
UserActions.logout();
this.transitionTo('login');
},
render() {
return <div></div>;
},
});
export default Logout;
| import React from 'react';
import Router from 'react-router';
import UserActions from '../actions/UserActions';
var Logout = React.createClass({
mixins: [Router.Navigation],
componentWillMount() {
UserActions.logout();
this.transitionTo('login');
},
render() {
return null;
},
});
export default Logout;
| Return `null` instead of empty `div` in the logout route. | Return `null` instead of empty `div` in the logout route.
Makes more sense.
| JSX | mit | kentor/notejs-react,kentor/notejs-react,kentor/notejs-react | ---
+++
@@ -11,7 +11,7 @@
},
render() {
- return <div></div>;
+ return null;
},
});
|
ddd098b61b9de74800ee4771ce55aad44d7dbfc0 | frontend/src/components/getStarted/StagingBanner.jsx | frontend/src/components/getStarted/StagingBanner.jsx | import React from 'react';
export default class StagingBanner extends React.Component {
render() {
return (
<div className="stagingBanner">
<div className="container">
<h1>Warning! This is our bleeding-edge staging environment, and therefore performance, accuracy and reliability of the API cannot be guaranteed. For our stable, supported API please go to
<a href={"https://uclapi.com"}>
uclapi.com
</a>
</h1>
</div>
</div>
)
}
}
| import React from 'react';
export default class StagingBanner extends React.Component {
render() {
return (
<div className="stagingBanner">
<div className="container">
<h1>Warning! This is our bleeding-edge staging environment, and therefore performance, accuracy and reliability of the API cannot be guaranteed. For our stable, supported API please go to <a href={"https://uclapi.com"}>uclapi.com</a></h1>
</div>
</div>
)
}
}
| Update spacing to test deployment script | Update spacing to test deployment script
| JSX | mit | uclapi/uclapi,uclapi/uclapi,uclapi/uclapi,uclapi/uclapi | ---
+++
@@ -7,11 +7,7 @@
return (
<div className="stagingBanner">
<div className="container">
- <h1>Warning! This is our bleeding-edge staging environment, and therefore performance, accuracy and reliability of the API cannot be guaranteed. For our stable, supported API please go to
- <a href={"https://uclapi.com"}>
- uclapi.com
- </a>
- </h1>
+ <h1>Warning! This is our bleeding-edge staging environment, and therefore performance, accuracy and reliability of the API cannot be guaranteed. For our stable, supported API please go to <a href={"https://uclapi.com"}>uclapi.com</a></h1>
</div>
</div>
) |
89bf495a5901554a99e9c8af2f7e49e9a1a9758c | app/classifier/custom-sign-in-prompt.jsx | app/classifier/custom-sign-in-prompt.jsx | import React from 'react';
const PROMPT_CUSTOM_SIGN_IN_EVERY = 5;
export default class CustomSignInPrompt extends React.Component {
constructor(props) {
super(props);
this.hide = this.hide.bind(this);
this.state = {
hidden: true,
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.classificationsThisSession % PROMPT_CUSTOM_SIGN_IN_EVERY === 0) {
this.setState({ hidden: false });
}
}
hide() {
this.setState({ hidden: true });
}
render() {
if (!this.state.hidden) {
return (
<div className="classify-announcement-banner custom-sign-in-banner">
<span>
<i className="fa fa-exclamation-circle" aria-hidden="true"></i>{' '}
{this.props.children}
</span>
<button type="button" className="secret-button" onClick={this.hide}>
x
</button>
</div>);
}
return (null);
}
}
CustomSignInPrompt.propTypes = {
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.node).isRequired,
React.PropTypes.node.isRequired,
]),
classificationsThisSession: React.PropTypes.number.isRequired,
};
CustomSignInPrompt.defaultProps = {
children: null,
classificationsThisSession: 0,
};
| import React from 'react';
const PROMPT_CUSTOM_SIGN_IN_EVERY = 5;
export default class CustomSignInPrompt extends React.Component {
constructor(props) {
super(props);
this.hide = this.hide.bind(this);
this.state = {
hidden: true,
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.classificationsThisSession % PROMPT_CUSTOM_SIGN_IN_EVERY === 0) {
this.setState({ hidden: false });
}
}
hide() {
this.setState({ hidden: true });
}
render() {
if (!this.state.hidden) {
return (
<div className="classifier-announcement-banner custom-sign-in-banner">
<span>
<i className="fa fa-exclamation-circle" aria-hidden="true"></i>{' '}
{this.props.children}
</span>
<button type="button" className="secret-button" onClick={this.hide}>
x
</button>
</div>);
}
return (null);
}
}
CustomSignInPrompt.propTypes = {
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.node).isRequired,
React.PropTypes.node.isRequired,
]),
classificationsThisSession: React.PropTypes.number.isRequired,
};
CustomSignInPrompt.defaultProps = {
children: null,
classificationsThisSession: 0,
};
| Fix class name to match change | Fix class name to match change
| JSX | apache-2.0 | jelliotartz/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,zooniverse/Panoptes-Front-End,amyrebecca/Panoptes-Front-End | ---
+++
@@ -24,7 +24,7 @@
render() {
if (!this.state.hidden) {
return (
- <div className="classify-announcement-banner custom-sign-in-banner">
+ <div className="classifier-announcement-banner custom-sign-in-banner">
<span>
<i className="fa fa-exclamation-circle" aria-hidden="true"></i>{' '}
{this.props.children} |
8b422546fe4d0e87c4968b388e4d21075d810192 | src/app/components/simple-selectable-list/SimpleSelectableList.jsx | src/app/components/simple-selectable-list/SimpleSelectableList.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import SimpleSelectableListItem from './SimpleSelectableListItem';
const propTypes = {
rows: PropTypes.arrayOf(PropTypes.shape({
title: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
details: PropTypes.arrayOf(PropTypes.string)
})).isRequired,
}
export default class SimpleSelectableList extends Component {
constructor(props) {
super(props);
//this.bindItemClick = this.bindItemClick.bind(this);
}
render() {
return (
<ul className="list list--neutral simple-select-list">
{this.props.rows.length ?
this.props.rows.map(row => {
return (
<SimpleSelectableListItem key={row.id} {...row} />
)
})
: <p>Nothing to show</p>
}
</ul>
)
}
}
SimpleSelectableList.propTypes = propTypes; | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import SimpleSelectableListItem from './SimpleSelectableListItem';
const propTypes = {
rows: PropTypes.arrayOf(PropTypes.shape({
title: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
details: PropTypes.arrayOf(PropTypes.string)
})).isRequired,
showLoadingState: PropTypes.bool
}
export default class SimpleSelectableList extends Component {
constructor(props) {
super(props);
//this.bindItemClick = this.bindItemClick.bind(this);
}
render() {
const showLoadingState = this.props.showLoadingState;
const hasRows = this.props.rows.length;
return (
<ul className="list list--neutral simple-select-list">
{ hasRows ?
this.props.rows.map(row => {
return (
<SimpleSelectableListItem key={row.id} {...row} />
)
}) : null
}
{ showLoadingState && <span className="margin-top--1 loader loader--dark"/> }
{ !hasRows && !showLoadingState ? <p>Nothing to show</p> : "" }
</ul>
)
}
}
SimpleSelectableList.propTypes = propTypes; | Add loader to show laoding state | Add loader to show laoding state
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
-
import SimpleSelectableListItem from './SimpleSelectableListItem';
@@ -11,7 +10,7 @@
url: PropTypes.string.isRequired,
details: PropTypes.arrayOf(PropTypes.string)
})).isRequired,
-
+ showLoadingState: PropTypes.bool
}
export default class SimpleSelectableList extends Component {
@@ -22,18 +21,19 @@
}
render() {
+ const showLoadingState = this.props.showLoadingState;
+ const hasRows = this.props.rows.length;
return (
<ul className="list list--neutral simple-select-list">
- {this.props.rows.length ?
-
- this.props.rows.map(row => {
- return (
- <SimpleSelectableListItem key={row.id} {...row} />
- )
- })
-
- : <p>Nothing to show</p>
+ { hasRows ?
+ this.props.rows.map(row => {
+ return (
+ <SimpleSelectableListItem key={row.id} {...row} />
+ )
+ }) : null
}
+ { showLoadingState && <span className="margin-top--1 loader loader--dark"/> }
+ { !hasRows && !showLoadingState ? <p>Nothing to show</p> : "" }
</ul>
)
} |
cba964807ffd8019d4698065790a008243f67ce1 | client/components/layouts.main/index.jsx | client/components/layouts.main/index.jsx | import Navigations from '../navigations/index.jsx';
const Layout = ({content = () => null }) => (
<div>
<header>
<h1>Mantra Voice</h1>
<Navigations />
</header>
<div>
{content()}
</div>
<footer>
<small>Mantra is an application architecture for Meteor.</small>
</footer>
</div>
);
export default Layout;
| import Navigations from '../navigations/index.jsx';
const Layout = ({content = () => null }) => (
<div>
<header>
<h1>Mantra Voice</h1>
<Navigations />
</header>
<div>
{content()}
</div>
<footer>
<small>Built with <a href='https://github.com/kadirahq/mantra'>Mantra</a> & Meteor.</small>
</footer>
</div>
);
export default Layout;
| Add Kadira link to footer | Add Kadira link to footer
| JSX | mit | LikeJasper/mantra-plus,warehouseman/meteor-mantra-kickstarter,hacksong2016/angel,ShockiTV/mantra-test,markoshust/mantra-sample-blog-app,mantrajs/meteor-mantra-kickstarter,warehouseman/meteor-mantra-kickstarter,mantrajs/mantra-sample-blog-app,mantrajs/mantra-dialogue,Entropy03/jianwei,wmzhai/mantra-demo,worldwidejamie/silicon-basement,TheAncientGoat/mantra-sample-blog-coffee,warehouseman/meteor-mantra-kickstarter | ---
+++
@@ -12,7 +12,7 @@
</div>
<footer>
- <small>Mantra is an application architecture for Meteor.</small>
+ <small>Built with <a href='https://github.com/kadirahq/mantra'>Mantra</a> & Meteor.</small>
</footer>
</div>
); |
92a729e9c8794d1a521335d59fcd1bbd45a8738a | src/components/languagechooser/languagechooser.jsx | src/components/languagechooser/languagechooser.jsx | const bindAll = require('lodash.bindall');
const classNames = require('classnames');
const PropTypes = require('prop-types');
const React = require('react');
const jar = require('../../lib/jar.js');
const languages = require('scratch-l10n').default;
const Form = require('../forms/form.jsx');
const Select = require('../forms/select.jsx');
require('./languagechooser.scss');
/**
* Footer dropdown menu that allows one to change their language.
*/
class LanguageChooser extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleSetLanguage'
]);
}
handleSetLanguage (name, value) {
jar.set('scratchlanguage', value);
window.location.reload();
}
render () {
const languageOptions = Object.keys(this.props.languages).map(value => ({
value: value,
label: this.props.languages[value].name
}));
return (
<Form className={classNames('language-chooser', this.props.className)}>
<Select
required
name="language"
options={languageOptions}
value={this.props.locale}
onChange={this.handleSetLanguage}
/>
</Form>
);
}
}
LanguageChooser.propTypes = {
className: PropTypes.string,
languages: PropTypes.object, // eslint-disable-line react/forbid-prop-types
locale: PropTypes.string
};
LanguageChooser.defaultProps = {
languages: languages,
locale: 'en'
};
module.exports = LanguageChooser;
| const bindAll = require('lodash.bindall');
const classNames = require('classnames');
const PropTypes = require('prop-types');
const React = require('react');
const jar = require('../../lib/jar.js');
const languages = require('scratch-l10n').default;
const Form = require('../forms/form.jsx');
const Select = require('../forms/select.jsx');
require('./languagechooser.scss');
/**
* Footer dropdown menu that allows one to change their language.
*/
class LanguageChooser extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleSetLanguage'
]);
}
handleSetLanguage (name, value) {
jar.set('scratchlanguage', value, {domain: `.${window.location.hostname}`});
window.location.reload();
}
render () {
const languageOptions = Object.keys(this.props.languages).map(value => ({
value: value,
label: this.props.languages[value].name
}));
return (
<Form className={classNames('language-chooser', this.props.className)}>
<Select
required
name="language"
options={languageOptions}
value={this.props.locale}
onChange={this.handleSetLanguage}
/>
</Form>
);
}
}
LanguageChooser.propTypes = {
className: PropTypes.string,
languages: PropTypes.object, // eslint-disable-line react/forbid-prop-types
locale: PropTypes.string
};
LanguageChooser.defaultProps = {
languages: languages,
locale: 'en'
};
module.exports = LanguageChooser;
| Set language cookie domain to allow for cross-domain cookies | Set language cookie domain to allow for cross-domain cookies
Add leading `.` to the current hostname for the language cookie domain.
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -21,7 +21,7 @@
]);
}
handleSetLanguage (name, value) {
- jar.set('scratchlanguage', value);
+ jar.set('scratchlanguage', value, {domain: `.${window.location.hostname}`});
window.location.reload();
}
render () { |
b414003f1534a1bde43e6ed8f108d56a03a73442 | lib/assets/javascripts/views/relative_timestamp.js.jsx | lib/assets/javascripts/views/relative_timestamp.js.jsx | /** @jsx React.DOM */
Drop.Views.RelativeTimestamp = React.createClass({
resetInterval: function () {
this.setState({
interval: setInterval(this.forceUpdate.bind(this), 1000)
});
},
clearInterval: function () {
clearInterval(this.state.interval);
},
componentDidMount: function () {
this.resetInterval();
},
componentWillUnmount: function () {
this.clearInterval();
},
componentWillReceiveProps: function (props) {
if (this.props.milliseconds !== props.milliseconds) {
this.resetInterval();
}
},
render: function () {
return <span title={Drop.Helpers.formatDateTime(this.props.milliseconds)}>{Drop.Helpers.formatRelativeTime(this.props.milliseconds)}</span>;
}
});
| /** @jsx React.DOM */
Drop.Views.RelativeTimestamp = React.createClass({
getInitialState: function () {
return {};
},
resetInterval: function () {
this.clearInterval();
var updateEvery = function (n) {
this.setState({
interval: setInterval(this.forceUpdate.bind(this), n)
});
}.bind(this);
var delta = Date.now() - this.props.milliseconds;
if (delta < 60000) { // less than 1 minute ago
updateEvery(2000); // update in 2 seconds
} else if (delta < 3600000) { // less than 1 hour ago
updateEvery(30000); // update in 30 seconds
} else if (delta < 86400000) { // less than 1 day ago
updateEvery(1800000); // update in 30 minutes
} else if (delta < 2678400000) { // 31 days ago
updateEvery(43200000); // update in 12 hours
} else {
updateEvery(2419000000); // update in 28 days
}
},
clearInterval: function () {
clearInterval(this.state.interval);
},
componentDidMount: function () {
this.resetInterval();
},
componentWillUnmount: function () {
this.clearInterval();
},
componentWillReceiveProps: function (props) {
if (this.props.milliseconds !== props.milliseconds) {
this.resetInterval();
}
},
render: function () {
return <span title={Drop.Helpers.formatDateTime(this.props.milliseconds)}>{Drop.Helpers.formatRelativeTime(this.props.milliseconds)}</span>;
}
});
| Optimize re-render interval for timestamps | Optimize re-render interval for timestamps
| JSX | bsd-3-clause | cupcake/files-web,cupcake/files-web | ---
+++
@@ -1,10 +1,31 @@
/** @jsx React.DOM */
Drop.Views.RelativeTimestamp = React.createClass({
+ getInitialState: function () {
+ return {};
+ },
+
resetInterval: function () {
- this.setState({
- interval: setInterval(this.forceUpdate.bind(this), 1000)
- });
+ this.clearInterval();
+
+ var updateEvery = function (n) {
+ this.setState({
+ interval: setInterval(this.forceUpdate.bind(this), n)
+ });
+ }.bind(this);
+
+ var delta = Date.now() - this.props.milliseconds;
+ if (delta < 60000) { // less than 1 minute ago
+ updateEvery(2000); // update in 2 seconds
+ } else if (delta < 3600000) { // less than 1 hour ago
+ updateEvery(30000); // update in 30 seconds
+ } else if (delta < 86400000) { // less than 1 day ago
+ updateEvery(1800000); // update in 30 minutes
+ } else if (delta < 2678400000) { // 31 days ago
+ updateEvery(43200000); // update in 12 hours
+ } else {
+ updateEvery(2419000000); // update in 28 days
+ }
},
clearInterval: function () { |
608ea5a4a414b2e35cca0d22e603f1d6f44ce65e | src/components/user-name.jsx | src/components/user-name.jsx | import React from 'react'
import {Link} from 'react-router'
import {connect} from 'react-redux'
import {preventDefault} from '../utils'
const DisplayOption = ({user, me, preferences}) => {
if (user.username === me && preferences.useYou) {
return <span>You</span>
}
switch (preferences.displayOption) {
case 1: {
return <span>{user.screenName}</span>
}
case 2: {
return <span>{user.screenName} ({user.username})</span>
}
case 3: {
return <span>{user.username}</span>
}
}
return <span>{user.screenName}</span>
}
const UserName = (props) => (
<Link to={`/${props.user.username}`} className={`user-name-info ${props.className}`}>
{props.display ? (
<span>{props.display}</span>
) : (
<DisplayOption
user={props.user}
me={props.me}
preferences={props.frontendPreferences.displayNames}/>
)}
</Link>
)
const mapStateToProps = (state) => {
return {
me: state.user.username,
frontendPreferences: state.user.frontendPreferences
}
}
export default connect(mapStateToProps)(UserName)
| import React from 'react'
import {Link} from 'react-router'
import {connect} from 'react-redux'
import {preventDefault} from '../utils'
const DisplayOption = ({user, me, preferences}) => {
if (user.username === me && preferences.useYou) {
return <span>You</span>
}
if (user.screenName === user.username) {
return <span>{user.screenName}</span>
}
switch (preferences.displayOption) {
case 1: {
return <span>{user.screenName}</span>
}
case 2: {
return <span>{user.screenName} ({user.username})</span>
}
case 3: {
return <span>{user.username}</span>
}
}
return <span>{user.screenName}</span>
}
const UserName = (props) => (
<Link to={`/${props.user.username}`} className={`user-name-info ${props.className}`}>
{props.display ? (
<span>{props.display}</span>
) : (
<DisplayOption
user={props.user}
me={props.me}
preferences={props.frontendPreferences.displayNames}/>
)}
</Link>
)
const mapStateToProps = (state) => {
return {
me: state.user.username,
frontendPreferences: state.user.frontendPreferences
}
}
export default connect(mapStateToProps)(UserName)
| Add special case (display name = username) to UserName | Add special case (display name = username) to UserName
| JSX | mit | davidmz/freefeed-react-client,kadmil/freefeed-react-client,clbn/freefeed-gamma,FreeFeed/freefeed-html-react,clbn/freefeed-gamma,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,ujenjt/freefeed-react-client,kadmil/freefeed-react-client,FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,davidmz/freefeed-react-client,clbn/freefeed-gamma,ujenjt/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-html-react,FreeFeed/freefeed-react-client,ujenjt/freefeed-react-client | ---
+++
@@ -6,6 +6,10 @@
const DisplayOption = ({user, me, preferences}) => {
if (user.username === me && preferences.useYou) {
return <span>You</span>
+ }
+
+ if (user.screenName === user.username) {
+ return <span>{user.screenName}</span>
}
switch (preferences.displayOption) { |
2134b88f3ef4812b8664a0b93e60c282eb5da554 | app/javascript/packs/agendum_note/agendum_note_list.jsx | app/javascript/packs/agendum_note/agendum_note_list.jsx | import React, { Component } from 'react';
// Controls
import AgendumNote from './agendum_note';
/*
* Create a list of agendum Notes.
*/
export default class AgendumNoteList extends Component {
constructor(props) {
super(props);
this.state = this.getInitialState(props.notes);
}
getInitialState(notes) {
notes = notes.slice();
// Add an empty note for the 'new note' interface
notes.push({});
return { notes: notes };
}
handleNewNote = (note) => {
// Get a copy of the notes array
var notes = this.state.notes.slice();
// Remove the last one (empty note)
notes.splice(-1, 1);
// Add the newly created note
notes.push(note);
// Update state
this.setState(this.getInitialState(notes));
}
handleDeletedNote = (note) => {
var notes = this.state.notes.slice();
notes.splice(notes.indexOf(note), 1);
this.setState({ notes: notes });
}
render() {
return(
<ul className="collection">
{
this.state.notes.map(note => {
return (
<AgendumNote
key={note.id || 'new'}
note={note}
meetingID={this.props.meetingID}
agendumID={this.props.agendumID}
handleNewNote={this.handleNewNote}
handleDeletedNote={this.handleDeletedNote} />
)
})
}
</ul>
);
}
}
| import React, { Component } from 'react';
// Controls
import AgendumNote from './agendum_note';
/*
* Create a list of agendum Notes.
*/
export default class AgendumNoteList extends Component {
constructor(props) {
super(props);
this.state = this.getInitialState(props.notes);
}
getInitialState(notes) {
notes = notes ? notes.slice() : [];
// Add an empty note for the 'new note' interface
notes.push({});
return { notes: notes };
}
handleNewNote = (note) => {
// Get a copy of the notes array
var notes = this.state.notes.slice();
// Remove the last one (empty note)
notes.splice(-1, 1);
// Add the newly created note
notes.push(note);
// Update state
this.setState(this.getInitialState(notes));
}
handleDeletedNote = (note) => {
var notes = this.state.notes.slice();
notes.splice(notes.indexOf(note), 1);
this.setState({ notes: notes });
}
render() {
return(
<ul className="collection">
{
this.state.notes.map(note => {
return (
<AgendumNote
key={note.id || 'new'}
note={note}
meetingID={this.props.meetingID}
agendumID={this.props.agendumID}
handleNewNote={this.handleNewNote}
handleDeletedNote={this.handleDeletedNote} />
)
})
}
</ul>
);
}
}
| Fix new agendum not showing without page reload. | Fix new agendum not showing without page reload.
| JSX | mit | robyparr/adjourn,robyparr/adjourn,robyparr/adjourn | ---
+++
@@ -13,7 +13,7 @@
}
getInitialState(notes) {
- notes = notes.slice();
+ notes = notes ? notes.slice() : [];
// Add an empty note for the 'new note' interface
notes.push({}); |
bf1c6b91b36b636164710ae68a8378268570fce2 | src/core/error_screen.jsx | src/core/error_screen.jsx | import React from 'react';
import Screen from './screen';
import * as l from './index';
export default class ErrorScreen extends Screen {
constructor() {
super("error");
}
render() {
return ErrorPane;
}
}
const ErrorPane = ({t}) => (
<div className="auth0-lock-error-pane">
<p>{t("unrecoverableError")}</p>
</div>
);
ErrorPane.propTypes = {
t: React.PropTypes.func.isRequired
};
| import React from 'react';
import Screen from './screen';
import * as l from './index';
export default class ErrorScreen extends Screen {
constructor() {
super("error");
}
render() {
return ErrorPane;
}
}
const ErrorPane = ({i18n}) => (
<div className="auth0-lock-error-pane">
<p>{i18n.html("unrecoverableError")}</p>
</div>
);
ErrorPane.propTypes = {
t: React.PropTypes.func.isRequired
};
| Use i18n prop instead of t in Error screen | Use i18n prop instead of t in Error screen
| JSX | mit | mike-casas/lock,mike-casas/lock,mike-casas/lock | ---
+++
@@ -14,9 +14,9 @@
}
-const ErrorPane = ({t}) => (
+const ErrorPane = ({i18n}) => (
<div className="auth0-lock-error-pane">
- <p>{t("unrecoverableError")}</p>
+ <p>{i18n.html("unrecoverableError")}</p>
</div>
);
|
1f41ea9bf63e6abe4f359ee98d3ee96d11cd93c6 | indico/web/client/js/react/components/ClipboardButton.jsx | indico/web/client/js/react/components/ClipboardButton.jsx | // This file is part of Indico.
// Copyright (C) 2002 - 2020 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.
import React, {useState} from 'react';
import PropTypes from 'prop-types';
import {Popup, Icon} from 'semantic-ui-react';
import {Translate} from 'indico/react/i18n';
import {useTimeout} from 'indico/react/hooks';
export default function ClipboardButton({text, successText}) {
const [copied, setCopied] = useState(false);
useTimeout(() => setCopied(false), copied ? 2000 : null);
const handleOpen = async () => {
await navigator.clipboard.writeText(text);
setCopied(true);
};
const handleClose = () => {
setCopied(false);
};
return (
<Popup
on="click"
position="bottom center"
trigger={
<Icon
style={copied ? {} : {cursor: 'pointer'}}
disabled={copied}
name="linkify"
onClick={copied ? null : handleOpen}
/>
}
open={copied}
onClose={handleClose}
content={successText || Translate.string('Text copied')}
/>
);
}
ClipboardButton.propTypes = {
text: PropTypes.string.isRequired,
successText: PropTypes.string,
};
ClipboardButton.defaultProps = {
successText: null,
};
| // This file is part of Indico.
// Copyright (C) 2002 - 2020 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.
import React, {useState} from 'react';
import PropTypes from 'prop-types';
import {Popup, Button} from 'semantic-ui-react';
import {Translate} from 'indico/react/i18n';
import {useTimeout} from 'indico/react/hooks';
export default function ClipboardButton({text, successText}) {
const [copied, setCopied] = useState(false);
useTimeout(() => setCopied(false), copied ? 2000 : null);
const handleOpen = async () => {
await navigator.clipboard.writeText(text);
setCopied(true);
};
const handleClose = () => {
setCopied(false);
};
return (
<Popup
on="click"
position="bottom center"
trigger={
<Button
basic
type="button"
icon="linkify"
onClick={handleOpen}
style={copied ? {} : {cursor: 'pointer'}}
disabled={copied}
circular
/>
}
open={copied}
onClose={handleClose}
content={successText || Translate.string('Text copied')}
/>
);
}
ClipboardButton.propTypes = {
text: PropTypes.string.isRequired,
successText: PropTypes.string,
};
ClipboardButton.defaultProps = {
successText: null,
};
| Fix the copy link icon | Fix the copy link icon
| JSX | mit | mic4ael/indico,DirkHoffmann/indico,ThiefMaster/indico,mic4ael/indico,pferreir/indico,ThiefMaster/indico,indico/indico,indico/indico,pferreir/indico,mic4ael/indico,DirkHoffmann/indico,DirkHoffmann/indico,DirkHoffmann/indico,mic4ael/indico,ThiefMaster/indico,pferreir/indico,indico/indico,pferreir/indico,ThiefMaster/indico,indico/indico | ---
+++
@@ -7,7 +7,7 @@
import React, {useState} from 'react';
import PropTypes from 'prop-types';
-import {Popup, Icon} from 'semantic-ui-react';
+import {Popup, Button} from 'semantic-ui-react';
import {Translate} from 'indico/react/i18n';
import {useTimeout} from 'indico/react/hooks';
@@ -29,11 +29,14 @@
on="click"
position="bottom center"
trigger={
- <Icon
+ <Button
+ basic
+ type="button"
+ icon="linkify"
+ onClick={handleOpen}
style={copied ? {} : {cursor: 'pointer'}}
disabled={copied}
- name="linkify"
- onClick={copied ? null : handleOpen}
+ circular
/>
}
open={copied} |
1f0fb1125a74072191c237dd2255636c71dc298e | lib/common/Image.jsx | lib/common/Image.jsx | import React, { Component, PropTypes } from 'react';
export default class Image extends Component {
static propTypes = {
imgStyle: PropTypes.objectOf(
PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
).isRequired,
isBlurred: PropTypes.bool.isRequired,
blurAmount: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]).isRequired,
};
getStyle() {
const { imgStyle, isBlurred, blurAmount } = this.props;
console.log(isBlurred, blurAmount);
if (isBlurred) {
return {
...imgStyle,
filter: `blur(${blurAmount})`,
};
}
return imgStyle;
}
render() {
const { alt, image } = this.props;
return (
<img
alt={alt}
style={this.getStyle()}
src={image.url}
/>
);
}
}
| import React, { Component, PropTypes } from 'react';
export default class Image extends Component {
static propTypes = {
alt: PropTypes.string.isRequired,
image: PropTypes.shape({
url: PropTypes.string.isRequired,
width: PropTypes.number.isRequired,
}).isRequired,
imgStyle: PropTypes.objectOf(
PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
).isRequired,
isBlurred: PropTypes.bool.isRequired,
blurAmount: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]).isRequired,
};
getStyle() {
const { imgStyle, isBlurred, blurAmount } = this.props;
if (isBlurred) {
return {
...imgStyle,
filter: `blur(${blurAmount})`,
};
}
return imgStyle;
}
render() {
const { alt, image } = this.props;
return (
<img
alt={alt}
style={this.getStyle()}
src={image.url}
/>
);
}
}
| Update PropTypes and remove console.log | Update PropTypes and remove console.log
| JSX | mit | benox3/react-pic | ---
+++
@@ -2,6 +2,11 @@
export default class Image extends Component {
static propTypes = {
+ alt: PropTypes.string.isRequired,
+ image: PropTypes.shape({
+ url: PropTypes.string.isRequired,
+ width: PropTypes.number.isRequired,
+ }).isRequired,
imgStyle: PropTypes.objectOf(
PropTypes.oneOfType([
PropTypes.string,
@@ -17,7 +22,6 @@
getStyle() {
const { imgStyle, isBlurred, blurAmount } = this.props;
- console.log(isBlurred, blurAmount);
if (isBlurred) {
return {
...imgStyle, |
4b02838fe77e93de3177ebaa901ec7102f07d56a | src/components/Widget/Weather/WidgetWeather.jsx | src/components/Widget/Weather/WidgetWeather.jsx | import React, { Component } from 'react';
import Widget from '../Widget.jsx';
import './WidgetWeather.scss';
class WidgetWeather extends Component {
render() {
return (
<div>
<Widget module="Weather" parameters={this.props.parameters}>
<p className="basic">
<span className="temperature">
{this.props.parameters.temperature}
<i className={`icon icon-degrees-${this.props.parameters.temperatureUnit}`} />
</span>
<i className={`icon icon-${this.props.parameters.iconClass}`} />
</p>
<p className="forecast">
{this.props.parameters.forecast}
</p>
<p className="rain-probability">
<i className="icon icon-umbrella" />
<span className="percentage">30%</span>
</p>
</Widget>
</div>
)
}
}
export default WidgetWeather;
| import React, { Component } from 'react';
import Widget from '../Widget.jsx';
import './WidgetWeather.scss';
class WidgetWeather extends Component {
render() {
return (
<div>
<Widget module="Weather" parameters={this.props.parameters}>
<p className="basic">
<span className="temperature">
{this.props.parameters.temperature}
<i className={`icon icon-degrees-${this.props.parameters.temperatureUnit}`} />
</span>
<i className={`icon icon-${this.props.parameters.iconClass}`} />
</p>
<p className="forecast">
{this.props.parameters.forecast}
</p>
<p className="rain-probability">
<i className="icon icon-umbrella" />
<span className="percentage">{this.props.parameters.percentage}</span>
</p>
</Widget>
</div>
)
}
}
export default WidgetWeather;
| Fix hardcoded value in Weather widget percentage. | Fix hardcoded value in Weather widget percentage.
| JSX | mit | NazarenoL/smart-mirror-front,NazarenoL/smart-mirror-front | ---
+++
@@ -19,7 +19,7 @@
</p>
<p className="rain-probability">
<i className="icon icon-umbrella" />
- <span className="percentage">30%</span>
+ <span className="percentage">{this.props.parameters.percentage}</span>
</p>
</Widget>
</div> |
dd779e1523a9762b50c4a3dd757edce531a940b4 | ditto/static/flux-chat/js/components/ShowStatus.jsx | ditto/static/flux-chat/js/components/ShowStatus.jsx | var React = require('react');
var ChatConstants = require('../constants/ChatConstants');
var ShowStatus = React.createClass({
propTypes: {
code: React.PropTypes.oneOf([
'online',
'away',
'chat',
'dnd',
'xa',
'offline'
]).isRequired,
message: React.PropTypes.string,
},
render () {
var style = {
width: 15,
height: 15,
borderRadius: '50%',
display: 'inline-block',
};
var statusText;
if (this.props.code == 'offline') {
style.border = '1px solid grey';
statusText = 'Offline';
} else if (this.props.code == 'online') {
style.backgroundColor = 'green';
statusText = 'Online';
} else if (this.props.code == 'away' || this.props.code == 'xa') {
style.backgroundColor = 'yellow';
} else {
style.backgroundColor = 'red';
}
statusText = statusText || ChatConstants.chatStatus[code];
return (
<span>
<i style={style}></i>
<span className="sr-only">{statusText}</span>
{this.props.message ? <em>{this.props.message}</em> : null}
</span>
);
}
});
module.exports = ShowStatus;
| var React = require('react');
var ChatConstants = require('../constants/ChatConstants');
var ShowStatus = React.createClass({
propTypes: {
code: React.PropTypes.oneOf([
'online',
'away',
'chat',
'dnd',
'xa',
'offline'
]).isRequired,
message: React.PropTypes.string,
},
render () {
var style = {
width: 15,
height: 15,
borderRadius: '50%',
display: 'inline-block',
};
var statusText;
if (this.props.code == 'offline') {
style.border = '1px solid grey';
statusText = 'Offline';
} else if (this.props.code == 'online') {
style.backgroundColor = 'green';
statusText = 'Online';
} else if (this.props.code == 'away' || this.props.code == 'xa') {
style.backgroundColor = 'yellow';
} else {
style.backgroundColor = 'red';
}
statusText = statusText || ChatConstants.chatStatus[this.props.code];
return (
<span>
<i key={this.props.code} style={style}></i>
<span className="sr-only">{statusText}</span>
{this.props.message ? <em>{this.props.message}</em> : null}
</span>
);
}
});
module.exports = ShowStatus;
| Fix user's status shown on message thread accordion | Fix user's status shown on message thread accordion
| JSX | bsd-3-clause | Kvoti/ditto,Kvoti/ditto,Kvoti/ditto,Kvoti/ditto,Kvoti/ditto | ---
+++
@@ -33,10 +33,10 @@
} else {
style.backgroundColor = 'red';
}
- statusText = statusText || ChatConstants.chatStatus[code];
+ statusText = statusText || ChatConstants.chatStatus[this.props.code];
return (
<span>
- <i style={style}></i>
+ <i key={this.props.code} style={style}></i>
<span className="sr-only">{statusText}</span>
{this.props.message ? <em>{this.props.message}</em> : null}
</span> |
948ee1c3eb10780e9548f8135d3095ca7acc8f9a | client_side/components/radio_station.jsx | client_side/components/radio_station.jsx | var React = require('react');
/**
* A component for single station item.
*
* This is a "dumb" React component.
*
* These options must be passed to the component:
* - id
* - name
* - isPlaying
*/
module.exports = React.createClass({
propTypes: {
id: React.PropTypes.string.isRequired,
name: React.PropTypes.string.isRequired,
isPlaying: React.PropTypes.bool.isRequired
},
handleClick: function() {
this.props.clickHandler(this);
},
getGlyphClasses: function() {
var classes = 'glyphicon';
if (this.props.isPlaying) {
classes += ' glyphicon-stop';
} else {
classes += ' glyphicon-play';
}
return classes + ' pull-right';
},
getLinkClasses: function() {
var classes = 'list-group-item';
if (this.props.isPlaying) {
classes += ' active';
}
return classes + ' radio-station';
},
render: function() {
return (
<a className={this.getLinkClasses()} onClick={this.handleClick}>
{this.props.name} <span className={this.getGlyphClasses()}></span>
</a>
);
}
});
| var React = require('react');
/**
* A component for single station item.
*
* This is a "dumb" React component.
*
* These options must be passed to the component:
* - id
* - name
* - isPlaying
*/
module.exports = React.createClass({
propTypes: {
id: React.PropTypes.string.isRequired,
name: React.PropTypes.string.isRequired,
isPlaying: React.PropTypes.bool.isRequired,
clickHandler: React.PropTypes.func.isRequired
},
handleClick: function() {
this.props.clickHandler(this);
},
getGlyphClasses: function() {
var classes = 'glyphicon';
if (this.props.isPlaying) {
classes += ' glyphicon-stop';
} else {
classes += ' glyphicon-play';
}
return classes + ' pull-right';
},
getLinkClasses: function() {
var classes = 'list-group-item';
if (this.props.isPlaying) {
classes += ' active';
}
return classes + ' radio-station';
},
render: function() {
return (
<a className={this.getLinkClasses()} onClick={this.handleClick}>
{this.props.name} <span className={this.getGlyphClasses()}></span>
</a>
);
}
});
| Add missed prop definition to RadioStation component | Add missed prop definition to RadioStation component
| JSX | apache-2.0 | JustBlackBird/bluethroat,JustBlackBird/bluethroat,JustBlackBird/bluethroat | ---
+++
@@ -14,7 +14,8 @@
propTypes: {
id: React.PropTypes.string.isRequired,
name: React.PropTypes.string.isRequired,
- isPlaying: React.PropTypes.bool.isRequired
+ isPlaying: React.PropTypes.bool.isRequired,
+ clickHandler: React.PropTypes.func.isRequired
},
handleClick: function() { |
f95d539026c10c737ad321443af3659591c0d45e | src/javascript/app_2/App/Components/Elements/money.jsx | src/javascript/app_2/App/Components/Elements/money.jsx | import PropTypes from 'prop-types';
import React from 'react';
import { formatMoney } from '../../../../_common/base/currency_base';
const Money = ({
amount,
currency,
is_formatted = true,
}) => (
<React.Fragment>
<span className={`symbols ${(currency || 'USD').toLowerCase()}`} />
{is_formatted ? formatMoney(currency, amount, true) : amount}
</React.Fragment>
);
Money.propTypes = {
amount: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]),
currency : PropTypes.string,
is_formatted: PropTypes.bool,
};
export default Money;
| import PropTypes from 'prop-types';
import React from 'react';
import { formatMoney } from '../../../../_common/base/currency_base';
const Money = ({
amount,
currency = 'USD',
has_sign,
is_formatted = true,
}) => {
let sign = '';
if (+amount && (amount < 0 || has_sign)) {
sign = amount > 0 ? '+' : '-';
}
const abs_value = Math.abs(amount);
const final_amount = is_formatted ? formatMoney(currency, abs_value, true) : abs_value;
return (
<React.Fragment>
{sign}
<span className={`symbols ${currency.toLowerCase()}`} />
{final_amount}
</React.Fragment>
);
};
Money.propTypes = {
amount: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
]),
currency : PropTypes.string,
has_sign : PropTypes.bool,
is_formatted: PropTypes.bool,
};
export default Money;
| Extend the Money component to display number sign | Extend the Money component to display number sign
| JSX | apache-2.0 | 4p00rv/binary-static,binary-com/binary-static,kellybinary/binary-static,ashkanx/binary-static,ashkanx/binary-static,kellybinary/binary-static,4p00rv/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,binary-com/binary-static,4p00rv/binary-static,binary-com/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,binary-static-deployed/binary-static | ---
+++
@@ -4,14 +4,26 @@
const Money = ({
amount,
- currency,
+ currency = 'USD',
+ has_sign,
is_formatted = true,
-}) => (
- <React.Fragment>
- <span className={`symbols ${(currency || 'USD').toLowerCase()}`} />
- {is_formatted ? formatMoney(currency, amount, true) : amount}
- </React.Fragment>
-);
+}) => {
+ let sign = '';
+ if (+amount && (amount < 0 || has_sign)) {
+ sign = amount > 0 ? '+' : '-';
+ }
+
+ const abs_value = Math.abs(amount);
+ const final_amount = is_formatted ? formatMoney(currency, abs_value, true) : abs_value;
+
+ return (
+ <React.Fragment>
+ {sign}
+ <span className={`symbols ${currency.toLowerCase()}`} />
+ {final_amount}
+ </React.Fragment>
+ );
+};
Money.propTypes = {
amount: PropTypes.oneOfType([
@@ -19,6 +31,7 @@
PropTypes.string,
]),
currency : PropTypes.string,
+ has_sign : PropTypes.bool,
is_formatted: PropTypes.bool,
};
|
056999f7459aa6ab82fd5de3e64e727f7faca13f | ui/src/main.jsx | ui/src/main.jsx | /* @flow weak */
import App from './app.jsx';
import React from 'react';
import ReactDOM from 'react-dom';
document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(<App history={true}/>, document.getElementById('app-main'));
});
| /* @flow weak */
import App from './app.jsx';
import React from 'react';
import ReactDOM from 'react-dom';
import Rollbar from 'rollbar-browser';
document.addEventListener('DOMContentLoaded', () => {
startRollbar();
ReactDOM.render(<App history={true}/>, document.getElementById('app-main'));
});
function startRollbar() {
const {hostname, protocol, port} = window.location;
const portString = port === '' ? '' : `:${port}`;
const environment = `${protocol}//${hostname}${portString}`;
window.rollbar = Rollbar.init({
accessToken: "de42c0395e924afba679510bd16908a6",
captureUncaught: true,
captureUnhandledRejections: false,
payload: {
environment: environment
}
});
} | Add rollbar to report JS errors | Add rollbar to report JS errors
| JSX | mit | mit-teaching-systems-lab/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,kesiena115/threeflows,mit-teaching-systems-lab/threeflows,mit-teaching-systems-lab/threeflows,kesiena115/threeflows | ---
+++
@@ -2,7 +2,26 @@
import App from './app.jsx';
import React from 'react';
import ReactDOM from 'react-dom';
+import Rollbar from 'rollbar-browser';
+
document.addEventListener('DOMContentLoaded', () => {
+ startRollbar();
ReactDOM.render(<App history={true}/>, document.getElementById('app-main'));
});
+
+
+function startRollbar() {
+ const {hostname, protocol, port} = window.location;
+ const portString = port === '' ? '' : `:${port}`;
+ const environment = `${protocol}//${hostname}${portString}`;
+
+ window.rollbar = Rollbar.init({
+ accessToken: "de42c0395e924afba679510bd16908a6",
+ captureUncaught: true,
+ captureUnhandledRejections: false,
+ payload: {
+ environment: environment
+ }
+ });
+} |
aca988a16b4b5412e6bc7559a1822834c3af8fd7 | app/assets/javascripts/components/components/drawer.jsx | app/assets/javascripts/components/components/drawer.jsx | import PureRenderMixin from 'react-addons-pure-render-mixin';
const Drawer = React.createClass({
mixins: [PureRenderMixin],
render () {
return (
<div style={{ width: '280px', flex: '0', boxSizing: 'border-box', background: '#454b5e', margin: '10px', marginRight: '0', padding: '0', display: 'flex', flexDirection: 'column' }}>
{this.props.children}
</div>
);
}
});
export default Drawer;
| import PureRenderMixin from 'react-addons-pure-render-mixin';
const Drawer = React.createClass({
mixins: [PureRenderMixin],
render () {
return (
<div style={{ width: '280px', flex: '0 0 auto', boxSizing: 'border-box', background: '#454b5e', margin: '10px', marginRight: '0', padding: '0', display: 'flex', flexDirection: 'column' }}>
{this.props.children}
</div>
);
}
});
export default Drawer;
| Fix for Drawer growing horizontally | Fix for Drawer growing horizontally
| JSX | agpl-3.0 | Ryanaka/mastodon,3846masa/mastodon,esetomo/mastodon,8796n/mastodon,ykzts/mastodon,rainyday/mastodon,Nyoho/mastodon,Gargron/mastodon,MastodonCloud/mastodon,kirakiratter/mastodon,anon5r/mastonon,mhffdq/mastodon,NS-Kazuki/mastodon,primenumber/mastodon,h3zjp/mastodon,narabo/mastodon,tri-star/mastodon,pso2club/mastodon,h3zjp/mastodon,masto-donte-com-br/mastodon,moeism/mastodon,lindwurm/mastodon,musashino205/mastodon,lindwurm/mastodon,havicon/mastodon,infinimatix/infinimatix.net,tcitworld/mastodon,TootCat/mastodon,ikuradon/mastodon,hugogameiro/mastodon,koteitan/googoldon,rekif/mastodon,anon5r/mastonon,kazh98/social.arnip.org,dwango/mastodon,riku6460/chikuwagoddon,lynlynlynx/mastodon,tootsuite/mastodon,cobodo/mastodon,haleyashleypraesent/ProjectPrionosuchus,ineffyble/mastodon,masto-donte-com-br/mastodon,infinimatix/infinimatix.net,lynlynlynx/mastodon,TootCat/mastodon,thor-the-norseman/mastodon,h-izumi/mastodon,WitchesTown/mastodon,HogeTatu/mastodon,Toootim/mastodon,honpya/taketodon,Toootim/mastodon,Kyon0000/mastodon,pfm-eyesightjp/mastodon,nonoz/mastodon,YuyaYokosuka/mastodon_animeclub,cybrespace/mastodon,narabo/mastodon,MitarashiDango/mastodon,dissolve/mastodon,clworld/mastodon,robotstart/mastodon,kagucho/mastodon,codl/mastodon,salvadorpla/mastodon,imas/mastodon,pinfort/mastodon,mecab/mastodon,Craftodon/Craftodon,vahnj/mastodon,gol-cha/mastodon,alarky/mastodon,Chronister/mastodon,YuyaYokosuka/mastodon_animeclub,verniy6462/mastodon,NS-Kazuki/mastodon,saggel/mastodon,librize/mastodon,hyuki0000/mastodon,gol-cha/mastodon,mecab/mastodon,kazh98/social.arnip.org,Nyoho/mastodon,verniy6462/mastodon,riku6460/chikuwagoddon,vahnj/mastodon,kibousoft/mastodon,tateisu/mastodon,tri-star/mastodon,mhffdq/mastodon,koba-lab/mastodon,tootcafe/mastodon,danhunsaker/mastodon,salvadorpla/mastodon,vahnj/mastodon,pointlessone/mastodon,mosaxiv/mastodon,ykzts/mastodon,ebihara99999/mastodon,imas/mastodon,koteitan/googoldon,musashino205/mastodon,pinfort/mastodon,unarist/mastodon,mstdn-jp/mastodon,sylph-sin-tyaku/mastodon,increments/mastodon,Chronister/mastodon,dissolve/mastodon,clworld/mastodon,glitch-soc/mastodon,Kyon0000/mastodon,cybrespace/mastodon,heropunch/mastodon-ce,maa123/mastodon,codl/mastodon,summoners-riftodon/mastodon,pso2club/mastodon,KnzkDev/mastodon,rekif/mastodon,ms2sato/mastodon,jukper/mastodon,TheInventrix/mastodon,sinsoku/mastodon,yi0713/mastodon,3846masa/mastodon,KnzkDev/mastodon,glitch-soc/mastodon,tootsuite/mastodon,rekif/mastodon,verniy6462/mastodon,Gargron/mastodon,kibousoft/mastodon,maa123/mastodon,imomix/mastodon,blackle/mastodon,blackle/mastodon,sylph-sin-tyaku/mastodon,pso2club/mastodon,tateisu/mastodon,dissolve/mastodon,nonoz/mastodon,Ryanaka/mastodon,KnzkDev/mastodon,theoria24/mastodon,gol-cha/mastodon,dunn/mastodon,esetomo/mastodon,honpya/taketodon,bureaucracy/mastodon,honpya/taketodon,ykzts/mastodon,nonoz/mastodon,dwango/mastodon,librize/mastodon,abcang/mastodon,pointlessone/mastodon,summoners-riftodon/mastodon,ineffyble/mastodon,salvadorpla/mastodon,h3zjp/mastodon,maa123/mastodon,Kyon0000/mastodon,ikuradon/mastodon,gol-cha/mastodon,h3zjp/mastodon,rainyday/mastodon,cybrespace/mastodon,yi0713/mastodon,SerCom-KC/mastodon,librize/mastodon,infinimatix/infinimatix.net,pso2club/mastodon,yi0713/mastodon,mosaxiv/mastodon,jukper/mastodon,dwango/mastodon,Monappy/mastodon,Monappy/mastodon,moeism/mastodon,Kirishima21/mastodon,NS-Kazuki/mastodon,lindwurm/mastodon,mimumemo/mastodon,PlantsNetwork/mastodon,developer-mstdn18/mstdn18,palon7/mastodon,nclm/mastodon,haleyashleypraesent/ProjectPrionosuchus,d6rkaiz/mastodon,masarakki/mastodon,hugogameiro/mastodon,ambition-vietnam/mastodon,sylph-sin-tyaku/mastodon,pfm-eyesightjp/mastodon,foozmeat/mastodon,kibousoft/mastodon,TheInventrix/mastodon,sinsoku/mastodon,unarist/mastodon,TheInventrix/mastodon,masarakki/mastodon,anon5r/mastonon,d6rkaiz/mastodon,8796n/mastodon,ebihara99999/mastodon,tootcafe/mastodon,pixiv/mastodon,blackle/mastodon,developer-mstdn18/mstdn18,mstdn-jp/mastodon,Kirishima21/mastodon,Nyoho/mastodon,SerCom-KC/mastodon,res-ac/mstdn.res.ac,Chronister/mastodon,abcang/mastodon,cobodo/mastodon,Monappy/mastodon,unarist/mastodon,yukimochi/mastodon,danhunsaker/mastodon,foozmeat/mastodon,mstdn-jp/mastodon,palon7/mastodon,hugogameiro/mastodon,SerCom-KC/mastodon,Chronister/mastodon,unarist/mastodon,cobodo/mastodon,d6rkaiz/mastodon,ashfurrow/mastodon,tootcafe/mastodon,ykzts/mastodon,sylph-sin-tyaku/mastodon,kibousoft/mastodon,MastodonCloud/mastodon,pixiv/mastodon,im-in-space/mastodon,RobertRence/Mastodon,anon5r/mastonon,clworld/mastodon,ebihara99999/mastodon,rutan/mastodon,ambition-vietnam/mastodon,mimumemo/mastodon,increments/mastodon,nclm/mastodon,musashino205/mastodon,masarakki/mastodon,TheInventrix/mastodon,moeism/mastodon,increments/mastodon,thor-the-norseman/mastodon,tri-star/mastodon,vahnj/mastodon,Ryanaka/mastodon,res-ac/mstdn.res.ac,thor-the-norseman/mastodon,thnkrs/mastodon,Toootim/mastodon,esetomo/mastodon,developer-mstdn18/mstdn18,kagucho/mastodon,TheInventrix/mastodon,alimony/mastodon,h-izumi/mastodon,5thfloor/ichiji-social,ashfurrow/mastodon,mhffdq/mastodon,pfm-eyesightjp/mastodon,rainyday/mastodon,increments/mastodon,saggel/mastodon,im-in-space/mastodon,nonoz/mastodon,res-ac/mstdn.res.ac,hyuki0000/mastodon,PlantsNetwork/mastodon,5thfloor/ichiji-social,3846masa/mastodon,tootcafe/mastodon,PlantsNetwork/mastodon,YuyaYokosuka/mastodon_animeclub,pointlessone/mastodon,YuyaYokosuka/mastodon_animeclub,blackle/mastodon,alarky/mastodon,ikuradon/mastodon,TootCat/mastodon,ashfurrow/mastodon,narabo/mastodon,Toootim/mastodon,dwango/mastodon,palon7/mastodon,heropunch/mastodon-ce,ambition-vietnam/mastodon,tateisu/mastodon,foozmeat/mastodon,musashino205/mastodon,kazh98/social.arnip.org,WitchesTown/mastodon,Kirishima21/mastodon,Craftodon/Craftodon,primenumber/mastodon,jukper/mastodon,rainyday/mastodon,mecab/mastodon,pfm-eyesightjp/mastodon,alimony/mastodon,imomix/mastodon,lynlynlynx/mastodon,bureaucracy/mastodon,im-in-space/mastodon,koba-lab/mastodon,haleyashleypraesent/ProjectPrionosuchus,ambition-vietnam/mastodon,ashfurrow/mastodon,primenumber/mastodon,rutan/mastodon,Nyoho/mastodon,tootsuite/mastodon,abcang/mastodon,havicon/mastodon,Arukas/mastodon,pinfort/mastodon,bureaucracy/mastodon,HogeTatu/mastodon,mstdn-jp/mastodon,kirakiratter/mastodon,koteitan/googoldon,koteitan/googoldon,verniy6462/mastodon,SerCom-KC/mastodon,KnzkDev/mastodon,lindwurm/mastodon,RobertRence/Mastodon,8796n/mastodon,dunn/mastodon,masto-donte-com-br/mastodon,pinfort/mastodon,mecab/mastodon,imomix/mastodon,MastodonCloud/mastodon,theoria24/mastodon,koba-lab/mastodon,imomix/mastodon,primenumber/mastodon,tri-star/mastodon,codl/mastodon,MitarashiDango/mastodon,yukimochi/mastodon,lynlynlynx/mastodon,tateisu/mastodon,3846masa/mastodon,Gargron/mastodon,havicon/mastodon,honpya/taketodon,rutan/mastodon,mosaxiv/mastodon,alarky/mastodon,5thfloor/ichiji-social,narabo/mastodon,tcitworld/mastodon,haleyashleypraesent/ProjectPrionosuchus,hugogameiro/mastodon,sinsoku/mastodon,mimumemo/mastodon,masto-donte-com-br/mastodon,alarky/mastodon,ebihara99999/mastodon,res-ac/mstdn.res.ac,pixiv/mastodon,palon7/mastodon,WitchesTown/mastodon,corzntin/mastodon,saggel/mastodon,Monappy/mastodon,corzntin/mastodon,alimony/mastodon,HogeTatu/mastodon,maa123/mastodon,kirakiratter/mastodon,corzntin/mastodon,heropunch/mastodon-ce,corzntin/mastodon,summoners-riftodon/mastodon,kirakiratter/mastodon,glitch-soc/mastodon,5thfloor/ichiji-social,Ryanaka/mastodon,NS-Kazuki/mastodon,ms2sato/mastodon,thnkrs/mastodon,mhffdq/mastodon,codl/mastodon,yi0713/mastodon,dunn/mastodon,amazedkoumei/mastodon,kagucho/mastodon,hyuki0000/mastodon,yukimochi/mastodon,rutan/mastodon,robotstart/mastodon,mimumemo/mastodon,riku6460/chikuwagoddon,mosaxiv/mastodon,Craftodon/Craftodon,RobertRence/Mastodon,TootCat/mastodon,WitchesTown/mastodon,cobodo/mastodon,im-in-space/mastodon,clworld/mastodon,foozmeat/mastodon,hyuki0000/mastodon,glitch-soc/mastodon,dunn/mastodon,thnkrs/mastodon,ms2sato/mastodon,Kirishima21/mastodon,imas/mastodon,Arukas/mastodon,pixiv/mastodon,Arukas/mastodon,danhunsaker/mastodon,h-izumi/mastodon,Craftodon/Craftodon,esetomo/mastodon,salvadorpla/mastodon,koba-lab/mastodon,kazh98/social.arnip.org,theoria24/mastodon,tcitworld/mastodon,d6rkaiz/mastodon,h-izumi/mastodon,danhunsaker/mastodon,tootsuite/mastodon,vahnj/mastodon,ineffyble/mastodon,PlantsNetwork/mastodon,MitarashiDango/mastodon,RobertRence/Mastodon,amazedkoumei/mastodon,robotstart/mastodon,theoria24/mastodon,rekif/mastodon,amazedkoumei/mastodon,nclm/mastodon,masarakki/mastodon,imas/mastodon,summoners-riftodon/mastodon,abcang/mastodon,yukimochi/mastodon,MastodonCloud/mastodon,pointlessone/mastodon,riku6460/chikuwagoddon,kagucho/mastodon,MitarashiDango/mastodon,Arukas/mastodon,ikuradon/mastodon,amazedkoumei/mastodon,cybrespace/mastodon | ---
+++
@@ -6,7 +6,7 @@
render () {
return (
- <div style={{ width: '280px', flex: '0', boxSizing: 'border-box', background: '#454b5e', margin: '10px', marginRight: '0', padding: '0', display: 'flex', flexDirection: 'column' }}>
+ <div style={{ width: '280px', flex: '0 0 auto', boxSizing: 'border-box', background: '#454b5e', margin: '10px', marginRight: '0', padding: '0', display: 'flex', flexDirection: 'column' }}>
{this.props.children}
</div>
); |
38c100482799d1381b6b4c645f45ccb0c7b514de | app/javascript/packs/agendum_note/agendum_note_list.jsx | app/javascript/packs/agendum_note/agendum_note_list.jsx | import React, { Component } from 'react';
// Controls
import AgendumNote from './agendum_note';
/*
* Create a list of agendum Notes.
*/
export default class AgendumNoteList extends Component {
constructor(props) {
super(props);
this.state = this.getInitialState(props.notes);
}
getInitialState(notes) {
notes = notes ? notes.slice() : [];
// Add an empty note for the 'new note' interface
notes.push({});
return { notes: notes };
}
handleNewNote = (note) => {
// Get a copy of the notes array
var notes = this.state.notes.slice();
// Remove the last one (empty note)
notes.splice(-1, 1);
// Add the newly created note
notes.push(note);
// Update state
this.setState(this.getInitialState(notes));
}
handleDeletedNote = (note) => {
var notes = this.state.notes.slice();
notes.splice(notes.indexOf(note), 1);
this.setState({ notes: notes });
}
render() {
return(
<ul className="collection">
{
this.state.notes.map(note => {
return (
<AgendumNote
key={note.id || 'new'}
note={note}
meetingID={this.props.meetingID}
agendumID={this.props.agendumID}
handleNewNote={this.handleNewNote}
handleDeletedNote={this.handleDeletedNote} />
)
})
}
</ul>
);
}
}
| import React, { Component } from 'react';
// Controls
import AgendumNote from './agendum_note';
/*
* Create a list of agendum Notes.
*/
export default class AgendumNoteList extends Component {
constructor(props) {
super(props);
this.state = this.getInitialState(props.notes);
}
getInitialState(notes) {
notes = notes ? notes.slice() : [];
// Add an empty note for the 'new note' interface
notes.push({});
return { notes: notes };
}
handleNewNote = (note) => {
// Get a copy of the notes array
var notes = this.state.notes.slice();
// Remove the last one (empty note)
notes.splice(-1, 1);
// Add the newly created note
notes.push(note);
// Update state
this.setState(this.getInitialState(notes));
}
handleDeletedNote = (note) => {
var notes = this.state.notes.slice();
notes.splice(notes.indexOf(note), 1);
this.setState({ notes: notes });
}
render() {
return(
<ul className="collection">
{
this.state.notes.map(note => {
return (
<AgendumNote
key={note.id || new Date()}
note={note}
meetingID={this.props.meetingID}
agendumID={this.props.agendumID}
handleNewNote={this.handleNewNote}
handleDeletedNote={this.handleDeletedNote} />
)
})
}
</ul>
);
}
}
| Fix new notes bug. ~/Projects/adjourn Adding a new note resulted in the new "add new note" field having the text from the previously added new note. | Fix new notes bug. ~/Projects/adjourn
Adding a new note resulted in the new "add new note"
field having the text from the previously added new
note.
| JSX | mit | robyparr/adjourn,robyparr/adjourn,robyparr/adjourn | ---
+++
@@ -49,7 +49,7 @@
this.state.notes.map(note => {
return (
<AgendumNote
- key={note.id || 'new'}
+ key={note.id || new Date()}
note={note}
meetingID={this.props.meetingID}
agendumID={this.props.agendumID} |
f8c9fece931f3a9a0be96a318a45aea16da23be1 | app/scripts/components/views/teacher-dashboard-view.jsx | app/scripts/components/views/teacher-dashboard-view.jsx | import React from 'react';
import {ButtonLink} from 'react-router-bootstrap';
import {PageHeader, ListGroup, ListGroupItem} from 'react-bootstrap';
/**
* Shown to the teacher upon logging in; contains a list of classes.
*/
let TeacherDashboardView = React.createClass({
render: function() {
return (
<div className="hero-unit">
<PageHeader>
Hi, <strong>Neel</strong>!
</PageHeader>
<ListGroup>
<ListGroupItem>
{/* TODO(neel): STOPSHIP use React Router Bootstrap to get a
linked item */}
<ButtonLink to="class-dashboard"
params={{ classId: 1636 }}>
Cool School Fall 2015
</ButtonLink>
</ListGroupItem>
</ListGroup>
</div>
);
}
});
export default TeacherDashboardView;
| import React from 'react';
import {ListGroupItemLink} from 'react-router-bootstrap';
import {PageHeader, ListGroup, ListGroupItem} from 'react-bootstrap';
/**
* Shown to the teacher upon logging in; contains a list of classes.
*/
let TeacherDashboardView = React.createClass({
render: function() {
return (
<div className="hero-unit">
<PageHeader>
Hi, <strong>Neel</strong>!
</PageHeader>
<ListGroup>
<ListGroupItemLink
to="class-dashboard"
params={{ classId: 1636 }}>
Cool School Fall 2015
</ListGroupItemLink>
</ListGroup>
</div>
);
}
});
export default TeacherDashboardView;
| Make list items use ListGroupItemLink | Make list items use ListGroupItemLink
| JSX | mit | DigitalLiteracyProject/class,DigitalLiteracyProject/class | ---
+++
@@ -1,5 +1,5 @@
import React from 'react';
-import {ButtonLink} from 'react-router-bootstrap';
+import {ListGroupItemLink} from 'react-router-bootstrap';
import {PageHeader, ListGroup, ListGroupItem} from 'react-bootstrap';
/**
@@ -15,14 +15,11 @@
</PageHeader>
<ListGroup>
- <ListGroupItem>
- {/* TODO(neel): STOPSHIP use React Router Bootstrap to get a
- linked item */}
- <ButtonLink to="class-dashboard"
- params={{ classId: 1636 }}>
- Cool School Fall 2015
- </ButtonLink>
- </ListGroupItem>
+ <ListGroupItemLink
+ to="class-dashboard"
+ params={{ classId: 1636 }}>
+ Cool School Fall 2015
+ </ListGroupItemLink>
</ListGroup>
</div>
); |
75473a59f39dafb3c6c873c10efb34e8b35bd1e5 | app/assets/javascripts/App.js.jsx | app/assets/javascripts/App.js.jsx | //= require_self
//= require_tree ./App
App = {};
App.setPath = function(path){
history.pushState({}, document.title, path);
$(window).trigger('pushstate');
};
App.router = function(path){
if (path === '/') return <HomePage />
if (path === '/tweet-box') return <TweetBox />
return <div>Page Not Found</div>
}
$(function(){
React.render(<MainComponent />, document.body);
}); | //= require_self
//= require_tree ./App
App = {};
App.request = function(method, path, data){
return new Promise(function(resolve, reject){
var request = $.ajax({
url: path,
method: method,
data: data,
dataType: "json"
});
request.done(function(serverData){
resolve(serverData)
});
request.fail(function(serverData){
reject(serverData)
});
});
};
App.goto = function(path){
history.pushState({}, document.title, path);
$(window).trigger('pushstate');
};
App.router = function(path){
if (path === '/') return <HomePage />
if (path === '/tweet-box') return <TweetBox />
return <div>Page Not Found</div>
}
App.router = function(path){
if (path === '/') return <HomePage />;
if (path === '/tweet-box') return <TweetBox />;
if (path.match(/^\/questions\/(\d+)$/)) return <QuestionShowPage question_id={RegExp.$1} />;
return(
<h1>Page Not Found</h1>
)
};
$(function(){
React.render(<MainComponent />, document.body);
}); | Update router and ajax button for SPA | Update router and ajax button for SPA
| JSX | mit | acoravos/veritas,acoravos/veritas,acoravos/veritas | ---
+++
@@ -3,7 +3,26 @@
App = {};
-App.setPath = function(path){
+App.request = function(method, path, data){
+ return new Promise(function(resolve, reject){
+ var request = $.ajax({
+ url: path,
+ method: method,
+ data: data,
+ dataType: "json"
+ });
+
+ request.done(function(serverData){
+ resolve(serverData)
+ });
+
+ request.fail(function(serverData){
+ reject(serverData)
+ });
+ });
+};
+
+App.goto = function(path){
history.pushState({}, document.title, path);
$(window).trigger('pushstate');
};
@@ -15,6 +34,15 @@
return <div>Page Not Found</div>
}
+App.router = function(path){
+ if (path === '/') return <HomePage />;
+ if (path === '/tweet-box') return <TweetBox />;
+if (path.match(/^\/questions\/(\d+)$/)) return <QuestionShowPage question_id={RegExp.$1} />;
+ return(
+ <h1>Page Not Found</h1>
+ )
+};
+
$(function(){
React.render(<MainComponent />, document.body);
}); |
251f7bf59d4bb66dece956172be79732dbcfc65d | src/views/splash/beta/middle-banner.jsx | src/views/splash/beta/middle-banner.jsx | const FormattedMessage = require('react-intl').FormattedMessage;
const injectIntl = require('react-intl').injectIntl;
const React = require('react');
const FlexRow = require('../../../components/flex-row/flex-row.jsx');
const TitleBanner = require('../../../components/title-banner/title-banner.jsx');
require('./middle-banner.scss');
const MiddleBanner = () => (
<TitleBanner className="beta-middle-banner">
<FlexRow>
<a
className="call-to-action button"
href="https://beta.scratch.mit.edu/"
>Call to Action</a>
</FlexRow>
</TitleBanner>
);
export default MiddleBanner;
| const FormattedMessage = require('react-intl').FormattedMessage;
const injectIntl = require('react-intl').injectIntl;
const React = require('react');
const FlexRow = require('../../../components/flex-row/flex-row.jsx');
const TitleBanner = require('../../../components/title-banner/title-banner.jsx');
require('./middle-banner.scss');
const MiddleBanner = () => (
<TitleBanner className="beta-middle-banner">
<FlexRow className="beta-middle-container column">
<h2 className="beta-header">The Next Generation of Scratch</h2>
<h3 className="beta-copy">Try out the beta version of Scratch 3.0</h3>
<a
className="beta-try-it button"
href="https://beta.scratch.mit.edu/"
>Try it!</a>
</FlexRow>
</TitleBanner>
);
export default MiddleBanner;
| Add middle banner in progress copy | Add middle banner in progress copy
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -9,11 +9,13 @@
const MiddleBanner = () => (
<TitleBanner className="beta-middle-banner">
- <FlexRow>
+ <FlexRow className="beta-middle-container column">
+ <h2 className="beta-header">The Next Generation of Scratch</h2>
+ <h3 className="beta-copy">Try out the beta version of Scratch 3.0</h3>
<a
- className="call-to-action button"
+ className="beta-try-it button"
href="https://beta.scratch.mit.edu/"
- >Call to Action</a>
+ >Try it!</a>
</FlexRow>
</TitleBanner>
); |
dec267c11c289d8a80058e365779575d227759e0 | features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/devportal/source/src/app/components/Apis/Details/ApiConsole/SwaggerUI.jsx | features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/devportal/source/src/app/components/Apis/Details/ApiConsole/SwaggerUI.jsx | import React from 'react';
import PropTypes from 'prop-types';
import 'swagger-ui/dist/swagger-ui.css';
import SwaggerUILib from './PatchedSwaggerUIReact';
const disableAuthorizeAndInfoPlugin = function () {
return {
wrapComponents: {
info: () => () => null,
},
};
};
/**
*
* @class SwaggerUI
* @extends {Component}
*/
const SwaggerUI = (props) => {
const { spec, accessTokenProvider, authorizationHeader, api } = props;
const componentProps = {
spec,
validatorUrl: null,
docExpansion: 'list',
defaultModelsExpandDepth: 0,
requestInterceptor: (req) => {
const { url } = req;
const patternToCheck = api.context + '/*';
req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider();
if (url.endsWith(patternToCheck)) {
req.url = url.substring(0, url.length - 2);
}
return req;
},
presets: [disableAuthorizeAndInfoPlugin],
plugins: null,
};
return <SwaggerUILib {...componentProps} />;
};
SwaggerUI.propTypes = {
spec: PropTypes.shape({}).isRequired,
};
export default SwaggerUI;
| import React from 'react';
import PropTypes from 'prop-types';
import 'swagger-ui/dist/swagger-ui.css';
import SwaggerUILib from './PatchedSwaggerUIReact';
const disableAuthorizeAndInfoPlugin = function () {
return {
wrapComponents: {
info: () => () => null,
},
};
};
/**
*
* @class SwaggerUI
* @extends {Component}
*/
const SwaggerUI = (props) => {
const { spec, accessTokenProvider, authorizationHeader, api } = props;
const componentProps = {
spec,
validatorUrl: null,
docExpansion: 'list',
defaultModelsExpandDepth: 0,
requestInterceptor: (req) => {
const { url } = req;
const patternToCheck = api.context + '/*';
req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider();
if (url.endsWith(patternToCheck)) {
req.url = url.substring(0, url.length - 2);
} else if (url.includes('/*?')) {
const splitTokens = url.split('/*?');
req.url = splitTokens.length > 1 ? splitTokens[0] + '?' + splitTokens[1] : splitTokens[0];
}
return req;
},
presets: [disableAuthorizeAndInfoPlugin],
plugins: null,
};
return <SwaggerUILib {...componentProps} />;
};
SwaggerUI.propTypes = {
spec: PropTypes.shape({}).isRequired,
};
export default SwaggerUI;
| Remove /* from url with query parameters. | Remove /* from url with query parameters.
| JSX | apache-2.0 | tharindu1st/carbon-apimgt,ruks/carbon-apimgt,nuwand/carbon-apimgt,ruks/carbon-apimgt,ruks/carbon-apimgt,Rajith90/carbon-apimgt,malinthaprasan/carbon-apimgt,Rajith90/carbon-apimgt,chamindias/carbon-apimgt,tharikaGitHub/carbon-apimgt,praminda/carbon-apimgt,tharikaGitHub/carbon-apimgt,chamilaadhi/carbon-apimgt,Rajith90/carbon-apimgt,praminda/carbon-apimgt,fazlan-nazeem/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,bhathiya/carbon-apimgt,tharindu1st/carbon-apimgt,bhathiya/carbon-apimgt,isharac/carbon-apimgt,praminda/carbon-apimgt,uvindra/carbon-apimgt,wso2/carbon-apimgt,isharac/carbon-apimgt,harsha89/carbon-apimgt,Rajith90/carbon-apimgt,fazlan-nazeem/carbon-apimgt,malinthaprasan/carbon-apimgt,wso2/carbon-apimgt,ruks/carbon-apimgt,jaadds/carbon-apimgt,uvindra/carbon-apimgt,chamilaadhi/carbon-apimgt,fazlan-nazeem/carbon-apimgt,harsha89/carbon-apimgt,nuwand/carbon-apimgt,malinthaprasan/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,prasa7/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,nuwand/carbon-apimgt,bhathiya/carbon-apimgt,tharindu1st/carbon-apimgt,malinthaprasan/carbon-apimgt,chamindias/carbon-apimgt,jaadds/carbon-apimgt,isharac/carbon-apimgt,chamindias/carbon-apimgt,tharikaGitHub/carbon-apimgt,chamilaadhi/carbon-apimgt,tharindu1st/carbon-apimgt,harsha89/carbon-apimgt,wso2/carbon-apimgt,fazlan-nazeem/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,prasa7/carbon-apimgt,jaadds/carbon-apimgt,isharac/carbon-apimgt,uvindra/carbon-apimgt,uvindra/carbon-apimgt,prasa7/carbon-apimgt,harsha89/carbon-apimgt,jaadds/carbon-apimgt,tharikaGitHub/carbon-apimgt,chamilaadhi/carbon-apimgt,nuwand/carbon-apimgt,bhathiya/carbon-apimgt,chamindias/carbon-apimgt,prasa7/carbon-apimgt,wso2/carbon-apimgt | ---
+++
@@ -29,6 +29,9 @@
req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider();
if (url.endsWith(patternToCheck)) {
req.url = url.substring(0, url.length - 2);
+ } else if (url.includes('/*?')) {
+ const splitTokens = url.split('/*?');
+ req.url = splitTokens.length > 1 ? splitTokens[0] + '?' + splitTokens[1] : splitTokens[0];
}
return req;
}, |
d51d2be60cc163c8b4f8989c046e20786aa3b1f0 | src/components/SightingList.jsx | src/components/SightingList.jsx | import React from 'react';
const SightingList = props => {
console.log(props);
return (
<div>
<h1>Sighting List</h1>
{props.sightings.map(s => (
<ul>
<li>{s.scientificName}</li>
<li>
Count:
{s.count}
</li>
<li>
Sex:
{s.sex}
</li>
<li>
Lat:
{s.lat}
</li>
<li>
Long:
{s.lon}
</li>
</ul>
))}
</div>
);
};
export default SightingList;
| import React from 'react';
// import { Card, CardMedia, CardTitle, CardText } from 'material-ui/Card';
// import styled from 'styled-components';
// const Img = styled.img`
// margin:
// `
const SightingList = props => {
console.log(props);
return (
<div>
<h1>Sighting List</h1>
{props.sightings.map(s => (
<ul>
<li>{s.scientificName}</li>
<li>
Count:
{s.count}
</li>
<li>
Sex:
{s.sex}
</li>
<li>
Lat:
{s.lat}
</li>
<li>
Long:
{s.lon}
</li>
<li>
<img src={s.photoURL} alt={s.scientificName} width="300px" />
</li>
</ul>
))}
</div>
);
};
export default SightingList;
| Add images on profile page per user sighting list | Add images on profile page per user sighting list
| JSX | mit | omarcodex/butterfly-pinner,omarcodex/butterfly-pinner | ---
+++
@@ -1,4 +1,9 @@
import React from 'react';
+// import { Card, CardMedia, CardTitle, CardText } from 'material-ui/Card';
+// import styled from 'styled-components';
+// const Img = styled.img`
+// margin:
+// `
const SightingList = props => {
console.log(props);
@@ -24,6 +29,9 @@
Long:
{s.lon}
</li>
+ <li>
+ <img src={s.photoURL} alt={s.scientificName} width="300px" />
+ </li>
</ul>
))}
</div> |
5d42f6a6f71a04e6a21f1fb026a940560fb34ba0 | src/components/Link/index.jsx | src/components/Link/index.jsx | import { Link as GatsbyLink } from "gatsby"
import React from "react"
import { linkColor } from "../../utils/styles"
const styles = {
backgroundImage: `linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 1px, ${linkColor} 1px, ${linkColor} 2px, rgba(0, 0, 0, 0) 2px)`,
borderRadius: "0.3em",
color: linkColor,
code: {
textShadow: "none",
},
}
const domainPattern = new RegExp(/^https?:\/\/(?!jbhannah\.net)/)
const Link = ({ to, href, ...props }) => {
if (to) {
return <GatsbyLink css={styles} to={to} {...props} />
}
if (domainPattern.test(href)) {
props.rel = "noopener"
props.target = "_blank"
}
return <a css={styles} href={href} {...props} />
}
export default Link
| import { Link as GatsbyLink } from "gatsby"
import React from "react"
import { linkColor } from "../../utils/styles"
const styles = {
backgroundImage: `linear-gradient(to top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0) 1px, ${linkColor} 1px, ${linkColor} 2px, rgba(0, 0, 0, 0) 2px)`,
borderRadius: "0.3em",
color: linkColor,
code: {
textShadow: "none",
},
}
const domainPattern = new RegExp(/^https?:\/\/(?!jbhannah\.net)/)
const Link = ({ to, href, ...props }) => {
if (to) {
return <GatsbyLink css={styles} to={to} {...props} />
}
if (domainPattern.test(href)) {
if (props.hasOwnProperty("rel")) {
props.rel += " noopener"
} else {
props.rel = "noopener"
}
props.target = "_blank"
}
return <a css={styles} href={href} {...props} />
}
export default Link
| Add noopener to existing rel on external links | Add noopener to existing rel on external links
| JSX | mit | jbhannah/jbhannah.net,jbhannah/jbhannah.net | ---
+++
@@ -19,7 +19,11 @@
}
if (domainPattern.test(href)) {
- props.rel = "noopener"
+ if (props.hasOwnProperty("rel")) {
+ props.rel += " noopener"
+ } else {
+ props.rel = "noopener"
+ }
props.target = "_blank"
}
|
a60bbf267789d1e3e9f4efca77ee61767bc3f86f | src/renderer/containers/app.jsx | src/renderer/containers/app.jsx | import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import 'semantic-ui-css/semantic.css';
import 'semantic-ui-css/semantic';
import './app.css';
class AppContainer extends Component {
static propTypes = {
dispatch: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
route: PropTypes.object.isRequired,
routeParams: PropTypes.object.isRequired,
location: PropTypes.shape({
pathname: PropTypes.string.isRequired,
}),
children: PropTypes.node,
queryResult: PropTypes.object,
};
static contextTypes = {
history: PropTypes.object.isRequired,
};
componentDidMount() {
// wait a bit more until remove the splash screen
setTimeout(() => document.getElementById('loading').remove(), 2000);
}
render() {
const { children } = this.props;
return (
<div className="ui">
{children}
</div>
);
}
}
function mapStateToProps(state) {
return {
queryResult: state.queryResult,
};
}
export default connect(mapStateToProps)(AppContainer);
| import React, { Component, PropTypes } from 'react';
import 'semantic-ui-css/semantic.css';
import 'semantic-ui-css/semantic';
import './app.css';
export default class AppContainer extends Component {
static propTypes = {
history: PropTypes.object.isRequired,
route: PropTypes.object.isRequired,
routeParams: PropTypes.object.isRequired,
location: PropTypes.shape({
pathname: PropTypes.string.isRequired,
}),
children: PropTypes.node,
};
static contextTypes = {
history: PropTypes.object.isRequired,
};
componentDidMount() {
// wait a bit more until remove the splash screen
setTimeout(() => document.getElementById('loading').remove(), 2000);
}
render() {
const { children } = this.props;
return (
<div className="ui">
{children}
</div>
);
}
}
| Remove not used Redux connect | Remove not used Redux connect | JSX | mit | sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui,sqlectron/sqlectron-gui | ---
+++
@@ -1,5 +1,4 @@
import React, { Component, PropTypes } from 'react';
-import { connect } from 'react-redux';
import 'semantic-ui-css/semantic.css';
@@ -7,9 +6,8 @@
import './app.css';
-class AppContainer extends Component {
+export default class AppContainer extends Component {
static propTypes = {
- dispatch: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
route: PropTypes.object.isRequired,
routeParams: PropTypes.object.isRequired,
@@ -17,7 +15,6 @@
pathname: PropTypes.string.isRequired,
}),
children: PropTypes.node,
- queryResult: PropTypes.object,
};
static contextTypes = {
@@ -39,11 +36,3 @@
);
}
}
-
-function mapStateToProps(state) {
- return {
- queryResult: state.queryResult,
- };
-}
-
-export default connect(mapStateToProps)(AppContainer); |
987e5853c183d519a811cfe2fd0e381ee3aae5d0 | src/main/webapp/resources/js/pages/projects/linelist/components/Table/renderers/IconCellRenderer.jsx | src/main/webapp/resources/js/pages/projects/linelist/components/Table/renderers/IconCellRenderer.jsx | import React from "react";
import PropTypes from "prop-types";
import { Icon, Tooltip } from "antd";
function LockedIcon() {
return (
<Tooltip title={i18n("project.samples.locked-title")} placement="right">
<Icon type="lock" theme="twoTone" />
</Tooltip>
);
}
export class IconCellRenderer extends React.Component {
static propTypes = {
data: PropTypes.object.isRequired
};
constructor(props) {
super(props);
}
render() {
const { owner } = this.props.data;
return !JSON.parse(owner) ? <LockedIcon /> : null;
}
}
| /**
* @file Display a column for icons based on specific data from the entry.
*/
import React from "react";
import PropTypes from "prop-types";
import { Tooltip } from "antd";
import { blue6 } from "../../../../../../styles/colors";
function LockedIcon() {
return (
<Tooltip title={i18n("project.samples.locked-title")} placement="right">
<div><i className="fas fa-lock" style={{color: blue6}}/></div>
</Tooltip>
);
}
export class IconCellRenderer extends React.Component {
static propTypes = {
data: PropTypes.object.isRequired
};
constructor(props) {
super(props);
}
render() {
const { owner } = this.props.data;
return !JSON.parse(owner) ? <LockedIcon /> : null;
}
}
| Update file comments and icon | Update file comments and icon
| JSX | apache-2.0 | phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida | ---
+++
@@ -1,12 +1,16 @@
+/**
+ * @file Display a column for icons based on specific data from the entry.
+ */
import React from "react";
import PropTypes from "prop-types";
-import { Icon, Tooltip } from "antd";
+import { Tooltip } from "antd";
+import { blue6 } from "../../../../../../styles/colors";
function LockedIcon() {
return (
<Tooltip title={i18n("project.samples.locked-title")} placement="right">
- <Icon type="lock" theme="twoTone" />
+ <div><i className="fas fa-lock" style={{color: blue6}}/></div>
</Tooltip>
);
} |
97aa4a53b1cf5a1c2bb41ecb4b98422a4817e0a8 | client/index.jsx | client/index.jsx | import React from 'react'
import {render} from 'react-dom'
import Router from './router.jsx';
render(
Router,
document.getElementById('app')
); | import React from 'react'
import {render} from 'react-dom'
import Router from './router.jsx';
import 'babel-polyfill';
render(
Router,
document.getElementById('app')
);
| Add polyfill to support IE11 | Add polyfill to support IE11 | JSX | apache-2.0 | spolnik/JAlgoArena-UI,spolnik/JAlgoArena-UI,spolnik/JAlgoArena-UI | ---
+++
@@ -1,6 +1,7 @@
import React from 'react'
import {render} from 'react-dom'
import Router from './router.jsx';
+import 'babel-polyfill';
render(
Router, |
b6eab5c9a0f574dcf9e20e7624ec5912d9c19c5c | ui/src/components/EntityScreen/Entity.jsx | ui/src/components/EntityScreen/Entity.jsx | import { Link } from 'react-router-dom';
import React, { Component } from 'react';
import Schema from 'src/components/common/Schema';
import getPath from 'src/util/getPath';
class Label extends Component {
render() {
const { icon = false } = this.props;
let { title, name, file_name, schema } = this.props.entity;
// title = toString(title);
// name = toString(name);
// file_name = toString(file_name);
// if (!short && title && file_name && title !== file_name) {
// return (
// <span className="entity-label" title={title}>
// <span className="title">{title} </span>
// <span className="file-name">{file_name}</span>
// </span>
// );
// }
return (
<span className="entity-label" title={ title || name }>
{icon && (
<Schema.Icon schema={schema} />
)}
{ title || name || file_name }
</span>
);
}
}
class EntityLink extends Component {
render() {
const { entity, className, icon, short } = this.props;
return (
<Link to={getPath(entity.links.ui)} className={className}>
<Label entity={entity} icon={icon} short={short} />
</Link>
);
}
}
class Entity {
static Label = Label;
static Link = EntityLink;
}
export default Entity;
| import { Link } from 'react-router-dom';
import React, { Component } from 'react';
import Schema from 'src/components/common/Schema';
import getPath from 'src/util/getPath';
class Label extends Component {
render() {
const { icon = false } = this.props;
let { title, name, file_name, schema } = this.props.entity;
return (
<span className="entity-label" title={ title || name }>
{icon && (
<Schema.Icon schema={schema} />
)}
{ title || name || file_name }
</span>
);
}
}
class EntityLink extends Component {
render() {
const { entity, className, icon, short } = this.props;
return (
<Link to={getPath(entity.links.ui)} className={className}>
<Label entity={entity} icon={icon} short={short} />
</Link>
);
}
}
class Entity {
static Label = Label;
static Link = EntityLink;
}
export default Entity;
| Remove ugly entity name stuff, need to do this better. | Remove ugly entity name stuff, need to do this better.
| JSX | mit | alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,pudo/aleph,pudo/aleph | ---
+++
@@ -9,17 +9,6 @@
render() {
const { icon = false } = this.props;
let { title, name, file_name, schema } = this.props.entity;
- // title = toString(title);
- // name = toString(name);
- // file_name = toString(file_name);
- // if (!short && title && file_name && title !== file_name) {
- // return (
- // <span className="entity-label" title={title}>
- // <span className="title">{title} </span>
- // <span className="file-name">{file_name}</span>
- // </span>
- // );
- // }
return (
<span className="entity-label" title={ title || name }> |
bb38602428d7bd5b6368afb62f11a70ec635f631 | src/views/landmarks/Header.jsx | src/views/landmarks/Header.jsx | import * as React from 'react';
import {NavLink} from 'react-router-dom';
class Header extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div className="header clearfix">
<nav>
<ul className="nav nav-pills float-right">
<li className="nav-item">
<NavLink
exact
className="nav-link"
activeClassName="active"
to="/"
>
{'Home'}
</NavLink>
</li>
<li className="nav-item">
<NavLink
className="nav-link"
activeClassName="active"
to="/about"
>
{'About'}
</NavLink>
</li>
<li className="nav-item">
<NavLink
className="nav-link"
activeClassName="active"
to="/contact"
>
{'Contact'}
</NavLink>
</li>
</ul>
</nav>
<h3 className="text-muted">{'Star My Github Repo!'}</h3>
</div>
);
}
}
export default Header;
| import * as React from 'react';
import {NavLink} from 'react-router-dom';
class Header extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<div className="header clearfix">
<nav>
<ul className="nav nav-pills float-right">
<li className="nav-item">
<NavLink
exact
className="nav-link"
activeClassName="active"
to="/"
>
{'Home'}
</NavLink>
</li>
<li className="nav-item">
<NavLink
className="nav-link"
activeClassName="active"
to="/about"
>
{'About'}
</NavLink>
</li>
<li className="nav-item">
<NavLink
className="nav-link"
activeClassName="active"
to="/contact"
>
{'Contact'}
</NavLink>
</li>
</ul>
</nav>
<h3 className="text-muted">{'Star My Github Repo!'}</h3>
</div>
);
}
}
export default Header;
| Fix issue with activeClassNave not working because component was changed to a PureComponent. | Fix issue with activeClassNave not working because component was changed to a PureComponent.
| JSX | mit | codeBelt/hapi-react-hot-loader-example,codeBelt/hapi-react-hot-loader-example | ---
+++
@@ -1,7 +1,7 @@
import * as React from 'react';
import {NavLink} from 'react-router-dom';
-class Header extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
+class Header extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return ( |
30f1ddbdde7acfb574e9ef4688fb310252676dea | js/ClientApp.jsx | js/ClientApp.jsx | /* global React ReactDOM */
const React = require('react')
const ReactDOM = require('react-dom')
const Landing = require('./Landing')
const Search = require('./Search')
const ReactRouter = require('react-router')
{ /* destructuring es6 feature*/ }
const { Router, Route, hashHistory } = ReactRouter
{ /* line 11-13, equivalent to line 8 */ }
// const Router = ReactRouter.Router
// const Route = ReactRouter.Route
// const hashHistory = ReactRouter.hashHistory
const App = () => {
return (
<Router history={hashHistory}>
<Route path='/' component={Landing} />
<Route path='/search' component={Search} />
</Router>
)
}
ReactDOM.render(<App />, document.getElementById('app'))
| /* global React ReactDOM */
const React = require('react')
const ReactDOM = require('react-dom')
const Landing = require('./Landing')
const Search = require('./Search')
const Layout = require('./Layout')
const ReactRouter = require('react-router')
{ /* destructuring es6 feature*/ }
const { Router, Route, IndexRoute, hashHistory } = ReactRouter
{ /* line 11-13, equivalent to line 8 */ }
// const Router = ReactRouter.Router
// const Route = ReactRouter.Route
// const hashHistory = ReactRouter.hashHistory
const App = () => {
return (
<Router history={hashHistory}>
<Route path='/' component={Layout}>
<IndexRoute component={Landing} />
<Route path='/search' component={Search} />
</Route>
</Router>
)
}
ReactDOM.render(<App />, document.getElementById('app'))
| Add index route to landing page and Nest Routes to pass Layout as props | Add index route to landing page and Nest Routes to pass Layout as props
| JSX | mit | aramay/react-intro-v1,aramay/react-intro-v1 | ---
+++
@@ -3,11 +3,12 @@
const ReactDOM = require('react-dom')
const Landing = require('./Landing')
const Search = require('./Search')
+const Layout = require('./Layout')
const ReactRouter = require('react-router')
{ /* destructuring es6 feature*/ }
-const { Router, Route, hashHistory } = ReactRouter
+const { Router, Route, IndexRoute, hashHistory } = ReactRouter
{ /* line 11-13, equivalent to line 8 */ }
// const Router = ReactRouter.Router
@@ -17,8 +18,10 @@
const App = () => {
return (
<Router history={hashHistory}>
- <Route path='/' component={Landing} />
- <Route path='/search' component={Search} />
+ <Route path='/' component={Layout}>
+ <IndexRoute component={Landing} />
+ <Route path='/search' component={Search} />
+ </Route>
</Router>
)
} |
c3999717f5ece3498ce571b4512ced089333952a | static/app/index.jsx | static/app/index.jsx | console.log("Hello World!");
| import React from 'react';
import {render} from 'react-dom';
class App extends React.Component {
render () {
return <p> Hello React Component!</p>;
}
}
render(<App/>, document.getElementById('app'));
| Create sample react component to test it out | Create sample react component to test it out
| JSX | mit | FarmRadioHangar/fessboxconfig,FarmRadioHangar/fessboxconfig | ---
+++
@@ -1 +1,9 @@
-console.log("Hello World!");
+import React from 'react';
+import {render} from 'react-dom';
+
+class App extends React.Component {
+ render () {
+ return <p> Hello React Component!</p>;
+ }
+}
+render(<App/>, document.getElementById('app')); |
b5b9d18175d5f32082f2a413d3b873b4c53ca0e9 | src/client/components/HardRedirect/index.jsx | src/client/components/HardRedirect/index.jsx | import { useEffect } from 'react'
import { connect } from 'react-redux'
import { HARD_REDIRECT } from '../../actions'
/**
* @function HardRedirect
* @description When rendered, it will change {window.location.href} to the
* value of {to}. This is meant to be used in cases when there's a need to
* redirect to a different Express page, not to a different route within the
* React application. For that you should use {react-router-dom.Redirect}.
* @param {Object} props
* @param {string} props.to - The URL to redirect to
* @param {any} props.when - The redirect will only happen when this expression
* is truthy
* @example
* <HardRedirect to="/foo" when={shouldRedirect} />
*/
export default connect()(({ to, when, dispatch, children = null }) => {
useEffect(() => {
when && dispatch({ type: HARD_REDIRECT, to })
}, [to, when])
return children
})
| import { useEffect } from 'react'
import { connect } from 'react-redux'
import { HARD_REDIRECT } from '../../actions'
/**
* @function HardRedirect
* @description When rendered, it will change {window.location.href} to the
* value of {to}. This is meant to be used in cases when there's a need to
* redirect to a different Express page, not to a different route within the
* React application. For that you should use {react-router-dom.Redirect}.
* @param {Object} props
* @param {string} props.to - The URL to redirect to
* @param {any} props.when - The redirect will only happen when this expression
* is truthy
* @param {(redirect: (to: string) => any) => React.ReactNode} props.children - A
* function which will be passed the redirect function as its only argument.
* Calling that function will result in the hard redirection.
* @example
* <HardRedirect to="/foo" when={shouldRedirect} />
*/
export default connect()(({ to, when, dispatch, children = null }) => {
useEffect(() => {
when && dispatch({ type: HARD_REDIRECT, to })
}, [to, when])
return typeof children === 'function'
? children((to) => dispatch({ type: HARD_REDIRECT, to }))
: children
})
| Update HardRedirect to take a function as children | Update HardRedirect to take a function as children
This will allow the hard redirect function to be called imperatively.
| JSX | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -13,6 +13,9 @@
* @param {string} props.to - The URL to redirect to
* @param {any} props.when - The redirect will only happen when this expression
* is truthy
+ * @param {(redirect: (to: string) => any) => React.ReactNode} props.children - A
+ * function which will be passed the redirect function as its only argument.
+ * Calling that function will result in the hard redirection.
* @example
* <HardRedirect to="/foo" when={shouldRedirect} />
*/
@@ -20,5 +23,7 @@
useEffect(() => {
when && dispatch({ type: HARD_REDIRECT, to })
}, [to, when])
- return children
+ return typeof children === 'function'
+ ? children((to) => dispatch({ type: HARD_REDIRECT, to }))
+ : children
}) |
372354613f9461116f5e71ee33994c1bbe292a60 | src/containers/Root/Root.prod.jsx | src/containers/Root/Root.prod.jsx | import React from 'react'
import createBrowserHistory from 'history/lib/createBrowserHistory' // have no idea which api version this will work in. fuck rackt.
import useScroll from 'scroll-behavior/lib/useSimpleScroll'
import { Provider } from 'react-redux'
import configureStore from 'store/configureStore'
import configureRoutes from './configureRoutes'
const browserHistory = useScroll(createBrowserHistory())()
export default (
<Provider store={ configureStore(browserHistory) }>
{ configureRoutes(browserHistory) }
</Provider>
)
| import React from 'react'
import createBrowserHistory from 'history/lib/createBrowserHistory' // have no idea which api version this will work in. fuck rackt.
import useScroll from 'scroll-behavior/lib/useSimpleScroll'
import { Provider } from 'react-redux'
import configureStore from 'store/configureStore'
import configureRoutes from './configureRoutes'
const browserHistory = useScroll(createBrowserHistory)()
export default (
<Provider store={ configureStore(browserHistory) }>
{ configureRoutes(browserHistory) }
</Provider>
)
| Fix incorrect usage of enhancer function 'useScroll' on 'createHistory.' | Fix incorrect usage of enhancer function 'useScroll' on 'createHistory.'
Accidentally executed createHistory -> createHistory() before passing it
into useScroll().
| JSX | mit | sunyang713/sabor-website,sunyang713/sabor-website | ---
+++
@@ -5,7 +5,7 @@
import configureStore from 'store/configureStore'
import configureRoutes from './configureRoutes'
-const browserHistory = useScroll(createBrowserHistory())()
+const browserHistory = useScroll(createBrowserHistory)()
export default (
<Provider store={ configureStore(browserHistory) }> |
974d989332643a45393a1d18589f82aaced7a200 | src/components/MoveModal.spec.jsx | src/components/MoveModal.spec.jsx | import React from 'react'
import { render, fireEvent, configure } from '@testing-library/react'
import MoveModal from './MoveModal'
import CozyClient, { CozyProvider } from 'cozy-client'
import useInstanceSettings from 'hooks/useInstanceSettings'
import AppLike from '../../test/AppLike'
configure({ testIdAttribute: 'data-test-id' })
jest.mock('hooks/useInstanceSettings', () => jest.fn())
describe('MoveModal', () => {
const setup = () => {
const client = new CozyClient()
client.stackClient.fetchJSON = jest.fn()
const root = render(
<AppLike>
<CozyProvider client={client}>
<MoveModal />
</CozyProvider>
</AppLike>
)
return { root, client }
}
it('should send a delete request and hide itself on close', () => {
useInstanceSettings.mockReturnValue({
data: {
moved_from: 'source.cozy.tools'
}
})
const { client, root } = setup()
expect(
root.getByText(
'The move of your data from source.cozy.tools has been successful.'
)
).toBeTruthy()
const closeBtn = root.getByTestId('modal-close-button-0')
fireEvent.click(closeBtn)
expect(client.getStackClient().fetchJSON).toHaveBeenCalledWith(
'DELETE',
'/settings/instance/moved_from'
)
expect(root.queryByRole('document').style.opacity).toBe('0')
})
})
| import React from 'react'
import { render, fireEvent, configure } from '@testing-library/react'
import MoveModal from './MoveModal'
import CozyClient, { CozyProvider } from 'cozy-client'
import useInstanceSettings from 'hooks/useInstanceSettings'
import AppLike from '../../test/AppLike'
configure({ testIdAttribute: 'data-test-id' })
jest.mock('hooks/useInstanceSettings', () => jest.fn())
describe('MoveModal', () => {
const setup = () => {
const client = new CozyClient()
client.stackClient.fetchJSON = jest.fn()
const root = render(
<AppLike>
<CozyProvider client={client}>
<MoveModal />
</CozyProvider>
</AppLike>
)
return { root, client }
}
it('should send a delete request and hide itself on close', () => {
useInstanceSettings.mockReturnValue({
data: {
moved_from: 'source.cozy.tools'
}
})
const { client, root } = setup()
expect(
root.getByText(
'The move of your data from source.cozy.tools has been successful.'
)
).toBeTruthy()
const closeBtn = root.getByTestId('modal-close-button-0')
fireEvent.click(closeBtn)
expect(client.getStackClient().fetchJSON).toHaveBeenCalledWith(
'DELETE',
'/settings/instance/moved_from'
)
const dialogPaper = root.queryByRole('none')
expect(dialogPaper.style.opacity).toBe('0')
})
})
| Update MoveModal test after upgrade to muiv4 | test: Update MoveModal test after upgrade to muiv4
The dialog paper changes roles to none when hidden, and when shown, uses
the presentation role.
| JSX | agpl-3.0 | cozy/cozy-home,cozy/cozy-home,cozy/cozy-home | ---
+++
@@ -43,6 +43,7 @@
'DELETE',
'/settings/instance/moved_from'
)
- expect(root.queryByRole('document').style.opacity).toBe('0')
+ const dialogPaper = root.queryByRole('none')
+ expect(dialogPaper.style.opacity).toBe('0')
})
}) |
cf515d0700ed4dff8cab1e5d86fbc123b3ee0307 | src/js/components/MenuItemComponent.jsx | src/js/components/MenuItemComponent.jsx | import React from "react/addons";
import Util from "../helpers/Util";
var MenuItemComponent = React.createClass({
"displayName": "MenuItemComponent",
propTypes: {
children: React.PropTypes.node,
className: React.PropTypes.string,
id: React.PropTypes.string,
name: React.PropTypes.string,
selected: React.PropTypes.bool,
value: React.PropTypes.string.isRequired
},
getInitialState: function () {
return {
id: "menu-item-" + Util.getUniqueId(),
};
},
shouldComponentUpdate: function (newProps) {
return this.props.selected !== newProps.selected;
},
render: function () {
var {
children,
className,
name,
value,
selected
} = this.props;
var {id} = this.state;
return (
<li role="menu-item" className={className}>
<input id={id} type="radio" name={name} value={value}
checked={selected}
readOnly />
<label htmlFor={id}>
{children}
</label>
</li>
);
}
});
export default MenuItemComponent;
| import React from "react/addons";
import Util from "../helpers/Util";
var MenuItemComponent = React.createClass({
"displayName": "MenuItemComponent",
propTypes: {
children: React.PropTypes.node,
className: React.PropTypes.string,
id: React.PropTypes.string,
name: React.PropTypes.string,
selected: React.PropTypes.bool,
value: React.PropTypes.string.isRequired
},
getInitialState: function () {
return {
id: "menu-item-" + Util.getUniqueId()
};
},
render: function () {
var {
children,
className,
name,
value,
selected
} = this.props;
var {id} = this.state;
return (
<li role="menu-item" className={className}>
<input id={id} type="radio" name={name} value={value}
checked={selected}
readOnly />
<label htmlFor={id}>
{children}
</label>
</li>
);
}
});
export default MenuItemComponent;
| Fix app modal error highlighting issue | Fix app modal error highlighting issue
Remove the shouldComponent check as it prevents rendering on class name
change and is unnecessary.
Closes mesosphere/marathon#3436
| JSX | apache-2.0 | mesosphere/marathon-ui,cribalik/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui | ---
+++
@@ -15,12 +15,8 @@
getInitialState: function () {
return {
- id: "menu-item-" + Util.getUniqueId(),
+ id: "menu-item-" + Util.getUniqueId()
};
- },
-
- shouldComponentUpdate: function (newProps) {
- return this.props.selected !== newProps.selected;
},
render: function () { |
b80917769e2c532edcecb5298ae9fce3f00f58c7 | src/ui/components/FileList.jsx | src/ui/components/FileList.jsx | import { h } from 'preact';
import FileListItem from 'components/FileListItem';
import Center from 'components/Center';
import { GATEWAY_URL } from '../../electron/constants';
import { Button } from 'preact-photon';
import { shell, ipcRenderer } from 'electron';
const FileList = ({ files, synced, boxPath }) => {
if (files.length < 1 && !synced) {
return (
<Center>Syncing…</Center>
);
}
if (files.length < 1) {
return (
<Center>
<p>Drag a file into your Partyshare folder to begin</p>
<Button
onClick={() => {
shell.openItem(boxPath);
ipcRenderer.send('hide');
}}
>
Reveal Folder
</Button>
</Center>
);
}
return (
<ul className="file_list">
{files.map((file) => <FileListItem file={file} url={`${GATEWAY_URL}/${file.hash}`} />)}
</ul>
);
};
export default FileList;
| import { h } from 'preact';
import FileListItem from 'components/FileListItem';
import Center from 'components/Center';
import { GATEWAY_URL } from '../../electron/constants';
import { Button } from 'preact-photon';
import { shell, ipcRenderer } from 'electron';
const FileList = ({ files, synced, boxPath }) => {
if (files.length < 1 && !synced) {
return (
<Center>Syncing…</Center>
);
}
if (files.length < 1) {
return (
<Center>
<p>Drag a file into your Partyshare folder to begin</p>
<Button
onClick={() => {
shell.openItem(boxPath);
ipcRenderer.send('hide');
}}
>
Reveal Folder
</Button>
</Center>
);
}
files = files.sort((a, b) => new Date(b.stats.ctime) - new Date(a.stats.ctime));
return (
<ul className="file_list">
{files.map((file) => <FileListItem file={file} url={`${GATEWAY_URL}/${file.hash}`} />)}
</ul>
);
};
export default FileList;
| Sort by the most recent added file | Sort by the most recent added file
| JSX | mit | BusterLabs/Partyshare,BusterLabs/Partyshare | ---
+++
@@ -28,6 +28,8 @@
);
}
+ files = files.sort((a, b) => new Date(b.stats.ctime) - new Date(a.stats.ctime));
+
return (
<ul className="file_list">
{files.map((file) => <FileListItem file={file} url={`${GATEWAY_URL}/${file.hash}`} />)} |
577f645c6e33f96002f93607e7d6fc5e25bc6ca7 | Hello-React/public/app.jsx | Hello-React/public/app.jsx | ReactDOM.render(
<h1>Hello via React</h1>,
document.getElementById("app")
);
| var Greeter = React.createClass({
getDefaultProps: function () {
return {
name: 'you',
message: 'This is from the component'
};
},
render: function () {
var name = this.props.name,
message = this.props.message;
return (
<div>
<h1>Hello to {name} from React Component</h1>
<p>{message}</p>
</div>
);
}
});
var firstName = "Julian";
ReactDOM.render(
<Greeter name={firstName} message="Updated Message"/>,
document.getElementById("app")
);
| Add parameters to first React component | Add parameters to first React component
| JSX | mit | JulianNicholls/Complete-React-Web-App,JulianNicholls/Complete-React-Web-App | ---
+++
@@ -1,4 +1,26 @@
+var Greeter = React.createClass({
+ getDefaultProps: function () {
+ return {
+ name: 'you',
+ message: 'This is from the component'
+ };
+ },
+ render: function () {
+ var name = this.props.name,
+ message = this.props.message;
+
+ return (
+ <div>
+ <h1>Hello to {name} from React Component</h1>
+ <p>{message}</p>
+ </div>
+ );
+ }
+});
+
+var firstName = "Julian";
+
ReactDOM.render(
- <h1>Hello via React</h1>,
+ <Greeter name={firstName} message="Updated Message"/>,
document.getElementById("app")
); |
d1153994c9f38e0abeb84d745f17435b1aee0d69 | packages/lesswrong/components/sequences/SequenceTooltip.jsx | packages/lesswrong/components/sequences/SequenceTooltip.jsx | import React from 'react';
import { Components, registerComponent, } from 'meteor/vulcan:core';
import { withStyles } from '@material-ui/core/styles';
import { truncate } from '../../lib/editor/ellipsize';
const SEQUENCE_DESCRIPTION_TRUNCATION_LENGTH = 750;
const styles = theme => ({
sequenceDescriptionHighlight: {
},
});
const SequenceTooltip = ({ sequence, classes }) => {
const { CalendarDate, ContentItemBody } = Components;
const truncatedDescription = truncate(sequence.contents && sequence.contents.htmlHighlight, SEQUENCE_DESCRIPTION_TRUNCATION_LENGTH);
return <div>
<div>{sequence.title}</div>
<div>by {sequence.user.displayName}</div>
<div>Created <CalendarDate date={sequence.createdAt}/></div>
<ContentItemBody
className={classes.sequenceDescriptionHighlight}
dangerouslySetInnerHTML={{__html: truncatedDescription}}/>
</div>;
}
registerComponent('SequenceTooltip', SequenceTooltip, withStyles(styles, { name: "SequenceTooltip" })); | import React from 'react';
import { Components, registerComponent, } from 'meteor/vulcan:core';
import { withStyles } from '@material-ui/core/styles';
import { truncate } from '../../lib/editor/ellipsize';
const SEQUENCE_DESCRIPTION_TRUNCATION_LENGTH = 750;
const styles = theme => ({
sequenceDescriptionHighlight: {
},
});
const SequenceTooltip = ({ sequence, classes }) => {
const { CalendarDate, ContentItemBody } = Components;
const truncatedDescription = truncate(sequence.contents && sequence.contents.htmlHighlight, SEQUENCE_DESCRIPTION_TRUNCATION_LENGTH);
return <div>
{ /*<div>Created <CalendarDate date={sequence.createdAt}/></div>*/ }
{ /* TODO: Show a date here. We can't use sequence.createdAt because it's often
very mismatched with the dates of the posts; ideally we'd say something like
"15 posts from Dec 2010-Feb 2011". */ }
<ContentItemBody
className={classes.sequenceDescriptionHighlight}
dangerouslySetInnerHTML={{__html: truncatedDescription}}/>
</div>;
}
registerComponent('SequenceTooltip', SequenceTooltip, withStyles(styles, { name: "SequenceTooltip" })); | Hide sequence-creation date (it's the post dates you want), title and author (they're already on the grid item) | Hide sequence-creation date (it's the post dates you want), title and author (they're already on the grid item)
| JSX | mit | Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2 | ---
+++
@@ -16,9 +16,10 @@
const truncatedDescription = truncate(sequence.contents && sequence.contents.htmlHighlight, SEQUENCE_DESCRIPTION_TRUNCATION_LENGTH);
return <div>
- <div>{sequence.title}</div>
- <div>by {sequence.user.displayName}</div>
- <div>Created <CalendarDate date={sequence.createdAt}/></div>
+ { /*<div>Created <CalendarDate date={sequence.createdAt}/></div>*/ }
+ { /* TODO: Show a date here. We can't use sequence.createdAt because it's often
+ very mismatched with the dates of the posts; ideally we'd say something like
+ "15 posts from Dec 2010-Feb 2011". */ }
<ContentItemBody
className={classes.sequenceDescriptionHighlight} |
b8880086c6a401eeebd17af7158eab78c6b905b6 | src/js/myapp.jsx | src/js/myapp.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import App from './app';
import Data from '../../../data/monsters';
ReactDOM.render(<App allMonsters={Data} />, document.getElementById('mountpoint'));
| import React from 'react';
import ReactDOM from 'react-dom';
import App from './app';
import Data from '../../../data/monsters';
import "../css/style";
ReactDOM.render(<App allMonsters={Data} />, document.getElementById('mountpoint'));
| Add ref to style for webpack | Add ref to style for webpack
| JSX | mit | jkrayer/summoner,jkrayer/summoner | ---
+++
@@ -3,4 +3,6 @@
import App from './app';
import Data from '../../../data/monsters';
+import "../css/style";
+
ReactDOM.render(<App allMonsters={Data} />, document.getElementById('mountpoint')); |
e86ce5cf0621d00ff5981500af1b38e18e155f21 | client/homebrew/pages/printPage/printPage.jsx | client/homebrew/pages/printPage/printPage.jsx | const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
const cx = require('classnames');
const Markdown = require('naturalcrit/markdown.js');
const PrintPage = createClass({
getDefaultProps : function() {
return {
query : {},
brew : {
text : '',
}
};
},
getInitialState : function() {
return {
brewText : this.props.brew.text
};
},
componentDidMount : function() {
if(this.props.query.local){
this.setState({ brewText: localStorage.getItem(this.props.query.local) });
}
if(this.props.query.dialog) window.print();
},
renderPages : function(){
return _.map(this.state.brewText.split('\\page'), (page, index)=>{
return <div
className='phb'
id={`p${index + 1}`}
dangerouslySetInnerHTML={{ __html: Markdown.render(page) }}
key={index} />;
});
},
render : function(){
return <div>
{this.renderPages()}
</div>;
}
});
module.exports = PrintPage;
| const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
const cx = require('classnames');
const Markdown = require('naturalcrit/markdown.js');
const PrintPage = createClass({
getDefaultProps : function() {
return {
query : {},
brew : {
text : '',
}
};
},
getInitialState : function() {
return {
brewText : this.props.brew.text
};
},
componentDidMount : function() {
if(this.props.query.local){
this.setState((prevState, prevProps) => ({
brewText: localStorage.getItem(prevProps.query.local)
}));
}
if(this.props.query.dialog) window.print();
},
renderPages : function(){
return _.map(this.state.brewText.split('\\page'), (page, index)=>{
return <div
className='phb'
id={`p${index + 1}`}
dangerouslySetInnerHTML={{ __html: Markdown.render(page) }}
key={index} />;
});
},
render : function(){
return <div>
{this.renderPages()}
</div>;
}
});
module.exports = PrintPage;
| Fix potentially inconsistent React state update | PrintPage: Fix potentially inconsistent React state update
| JSX | mit | calculuschild/homebrewery,stolksdorf/homebrewery,calculuschild/homebrewery | ---
+++
@@ -22,7 +22,9 @@
componentDidMount : function() {
if(this.props.query.local){
- this.setState({ brewText: localStorage.getItem(this.props.query.local) });
+ this.setState((prevState, prevProps) => ({
+ brewText: localStorage.getItem(prevProps.query.local)
+ }));
}
if(this.props.query.dialog) window.print(); |
ab7c5859e5e131ea18d898064320c382372a6c95 | src/components/side-panel/add-swatches/AddSwatchesPanel.jsx | src/components/side-panel/add-swatches/AddSwatchesPanel.jsx | // @flow
import React from 'react';
import AddSwatchForm from './AddSwatchForm';
import Palette from './Palette';
import type { PaletteType } from '../../../redux/modules/palettes';
type Props = {
palettes: Array<PaletteType>,
addNewSwatch: Function,
deleteSwatches: Function
}
const AddSwatchesPanel = (props: Props): React$Element<any> => {
const palettes = props.palettes.map((palette, i) =>
<Palette
{...palette}
addNewSwatch={props.addNewSwatch}
key={`palette${i}`}
/>);
return (
<div>
<p>Enter a valid RGB, hex or CSS to add a swatch</p>
<AddSwatchForm addNewSwatch={props.addNewSwatch} />
<p>Or choose from some pre made palettes</p>
{palettes}
<hr />
<button
className="btn"
id="delete-all"
onClick={props.deleteSwatches}
>
Delete all
</button>
</div>
);
};
export default AddSwatchesPanel;
| // @flow
import React from 'react';
import AddSwatchForm from './AddSwatchForm';
import Palette from './Palette';
import type { PaletteType } from '../../../redux/modules/palettes';
type Props = {
palettes: Array<PaletteType>,
addNewSwatch: Function,
deleteSwatches: Function
}
const AddSwatchesPanel = (props: Props): React$Element<any> => (
<div>
<p>Enter a valid RGB, hex or CSS to add a swatch</p>
<AddSwatchForm addNewSwatch={props.addNewSwatch} />
<p>Or choose from some pre made palettes</p>
{props.palettes.map((palette, i) =>
<Palette
{...palette}
addNewSwatch={props.addNewSwatch}
key={`palette${i}`}
/>)}
<hr />
<button
className="btn"
id="delete-all"
onClick={props.deleteSwatches}
>
Delete all
</button>
</div>
);
export default AddSwatchesPanel;
| Move palette mapping inside return | [Refactor] Move palette mapping inside return
| JSX | isc | eddyerburgh/palette-picker,eddyerburgh/palette-picker | ---
+++
@@ -11,29 +11,26 @@
deleteSwatches: Function
}
-const AddSwatchesPanel = (props: Props): React$Element<any> => {
- const palettes = props.palettes.map((palette, i) =>
- <Palette
- {...palette}
- addNewSwatch={props.addNewSwatch}
- key={`palette${i}`}
- />);
- return (
- <div>
- <p>Enter a valid RGB, hex or CSS to add a swatch</p>
- <AddSwatchForm addNewSwatch={props.addNewSwatch} />
- <p>Or choose from some pre made palettes</p>
- {palettes}
- <hr />
- <button
- className="btn"
- id="delete-all"
- onClick={props.deleteSwatches}
- >
+const AddSwatchesPanel = (props: Props): React$Element<any> => (
+ <div>
+ <p>Enter a valid RGB, hex or CSS to add a swatch</p>
+ <AddSwatchForm addNewSwatch={props.addNewSwatch} />
+ <p>Or choose from some pre made palettes</p>
+ {props.palettes.map((palette, i) =>
+ <Palette
+ {...palette}
+ addNewSwatch={props.addNewSwatch}
+ key={`palette${i}`}
+ />)}
+ <hr />
+ <button
+ className="btn"
+ id="delete-all"
+ onClick={props.deleteSwatches}
+ >
Delete all
</button>
- </div>
- );
-};
+ </div>
+);
export default AddSwatchesPanel; |
d73b7508bc82352f2a78b0627d606fcddeff4fc7 | src/views/splash/splash.jsx | src/views/splash/splash.jsx | var React = require('react');
var Api = require('../../mixins/api.jsx');
var Session = require('../../mixins/session.jsx');
var Activity = require('../../components/activity/activity.jsx');
var Box = require('../../components/box/box.jsx');
var Carousel = require('../../components/carousel/carousel.jsx');
var Intro = require('../../components/intro/intro.jsx');
var News = require('../../components/news/news.jsx');
require('./splash.scss');
var View = React.createClass({
mixins: [
Api,
Session
],
getInitialState: function () {
return {
projectCount: 10569070,
activity: [],
news: [],
featured: require('./featured.json')
};
},
componentDidMount: function () {
// @todo API request for News
// @todo API request for Activity
// @todo API request for Featured
},
render: function () {
var loggedIn = !!this.state.session.token;
return (
<div className="inner">
{loggedIn ? [
<div className="splash-header">
<Activity />
<News />
</div>
] : [
<Intro projectCount={this.state.projectCount} key="intro"/>
]}
{this.state.featured.map(function (set) {
return (
<Box
key={set.title}
className="featured"
title={set.title}>
<Carousel items={set.items} />
</Box>
);
})}
</div>
);
}
});
React.render(<View />, document.getElementById('view'));
| var React = require('react');
var Api = require('../../mixins/api.jsx');
var Session = require('../../mixins/session.jsx');
var Activity = require('../../components/activity/activity.jsx');
var Box = require('../../components/box/box.jsx');
var Carousel = require('../../components/carousel/carousel.jsx');
var Intro = require('../../components/intro/intro.jsx');
var News = require('../../components/news/news.jsx');
require('./splash.scss');
var View = React.createClass({
mixins: [
Api,
Session
],
getInitialState: function () {
return {
projectCount: 10569070,
activity: [],
news: [],
featured: require('./featured.json')
};
},
componentDidMount: function () {
// @todo API request for News
// @todo API request for Activity
// @todo API request for Featured
},
render: function () {
var loggedIn = !!this.state.session.token;
return (
<div className="inner">
{loggedIn ? [
<div key="header" className="splash-header">
<Activity />
<News />
</div>
] : [
<Intro projectCount={this.state.projectCount} key="intro"/>
]}
{this.state.featured.map(function (set) {
return (
<Box
key={set.title}
className="featured"
title={set.title}>
<Carousel items={set.items} />
</Box>
);
})}
</div>
);
}
});
React.render(<View />, document.getElementById('view'));
| Add missing key, heed React warning | Add missing key, heed React warning
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -34,7 +34,7 @@
return (
<div className="inner">
{loggedIn ? [
- <div className="splash-header">
+ <div key="header" className="splash-header">
<Activity />
<News />
</div> |
808ad6932749b5d48ad2d8f0e049dc80d56d8170 | components/about.jsx | components/about.jsx | /** @jsx React.DOM */
About = React.createClass({
render: function() {
return (
<div>
<img src="images/inspectocat.png" className="octocat" />
<h1>Github Release Watch</h1>
<h4>Github Release Watch checks your favourite Github repositories every day to see if any new tags or releases have been added.</h4>
<h4>If they have, it sends you an email, making sure that you stay in the loop!</h4>
<p className="text-center">
<button type="button" className="btn btn-lg btn-primary text-center" onClick={Login.login}>
{this.props.loggingIn ? 'Logging in...' : 'Login with Github'}
</button>
</p>
</div>
)
}
});
| /** @jsx React.DOM */
About = React.createClass({
render: function() {
return (
<div>
<img src="images/inspectocat.png" className="octocat" />
<h1>Github Release Watch</h1>
<h4>Github Release Watch checks your favourite Github repositories for any new tags or releases.</h4>
<h4>If they have, it sends you an email, making sure that you stay in the loop!</h4>
<p className="text-center">
<button type="button" className="btn btn-lg btn-primary text-center" onClick={Login.login}>
{this.props.loggingIn ? 'Logging in...' : 'Login with Github'}
</button>
</p>
</div>
)
}
});
| Clean up welcome page a bit | Clean up welcome page a bit | JSX | mit | mystor/gh-release-watch,doctaweeks/gh-release-watch,doctaweeks/gh-release-watch,mystor/gh-release-watch | ---
+++
@@ -7,7 +7,7 @@
<img src="images/inspectocat.png" className="octocat" />
<h1>Github Release Watch</h1>
- <h4>Github Release Watch checks your favourite Github repositories every day to see if any new tags or releases have been added.</h4>
+ <h4>Github Release Watch checks your favourite Github repositories for any new tags or releases.</h4>
<h4>If they have, it sends you an email, making sure that you stay in the loop!</h4>
<p className="text-center"> |
549daced6e7d09a857af4d56ae31676cc47ee197 | app/react/app/app.jsx | app/react/app/app.jsx | import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import configureStore from './configureStore';
import Routes from './router';
import Tabbar from './views/Tabbar';
import './stylesheets/app.sass';
// Track errors in production env
if (process.env.NODE_ENV === 'production') {
Raven.config('https://[email protected]/152218').install()
}
// remove 200ms delay on mobile click
import FastClick from 'fastclick'
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body);
}, false);
}
let store = configureStore()
// Render it to DOM
ReactDOM.render(
<Provider store={ store }>
<Routes />
</Provider>,
document.getElementById('root')
);
| import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import configureStore from './configureStore';
import Routes from './router';
import Tabbar from './views/Tabbar';
import './stylesheets/app.sass';
// Track errors in production env
if (process.env.NODE_ENV === 'production') {
Raven.config('https://[email protected]/152218').install()
}
let store = configureStore()
// Render it to DOM
ReactDOM.render(
<Provider store={ store }>
<Routes />
</Provider>,
document.getElementById('root')
);
| Remove clickdelay, it makes it worse | Remove clickdelay, it makes it worse
| JSX | mit | sping/abcd-epic-fussball,sping/abcd-epic-fussball,sping/abcd-epic-fussball | ---
+++
@@ -13,14 +13,6 @@
Raven.config('https://[email protected]/152218').install()
}
-// remove 200ms delay on mobile click
-import FastClick from 'fastclick'
-if ('addEventListener' in document) {
- document.addEventListener('DOMContentLoaded', function() {
- FastClick.attach(document.body);
- }, false);
-}
-
let store = configureStore()
// Render it to DOM |
811c9cb47d6251b7116c9f6407fd47f5f3d85994 | src/web/components/userEntry.jsx | src/web/components/userEntry.jsx | import Col from 'react-bootstrap/lib/Col';
import React, { PropTypes } from 'react';
import Row from 'react-bootstrap/lib/Row';
import Well from 'react-bootstrap/lib/Well';
import Login from './login';
import Signup from './signup';
const UserEntry = ({
login,
onLoginChange,
onLoginSubmit,
onSignupChange,
onSignupSubmit,
signup,
}) => (
<Row>
<Col md={6}>
<h2>Už jsem zaregistrovaný</h2>
<Well>
<Login
form="login"
onChange={onLoginChange}
onSubmit={onLoginSubmit}
{...login}
/>
</Well>
</Col>
<Col md={6}>
<h2>Registrace</h2>
<Signup
form="signup"
onChange={onSignupChange}
onSubmit={onSignupSubmit}
{...signup}
/>
</Col>
</Row>
);
UserEntry.propTypes = {
login: PropTypes.object,
onLoginChange: PropTypes.func.isRequired,
onLoginSubmit: PropTypes.func.isRequired,
onSignupChange: PropTypes.func.isRequired,
onSignupSubmit: PropTypes.func.isRequired,
signup: PropTypes.object,
};
UserEntry.defaultProps = {
login: null,
signup: null,
};
export default UserEntry;
| import Col from 'react-bootstrap/lib/Col';
import React, { PropTypes } from 'react';
import Row from 'react-bootstrap/lib/Row';
import Well from 'react-bootstrap/lib/Well';
import Login from './login';
import Signup from './signup';
const UserEntry = ({
login,
onLoginChange,
onLoginSubmit,
onSignupChange,
onSignupSubmit,
signup,
}) => {
const disabled = !!(login.loading || signup.loading);
return (
<Row>
<Col md={6}>
<h2>Už jsem zaregistrovaný</h2>
<Well>
<Login
disabled={disabled}
form="login"
onChange={onLoginChange}
onSubmit={onLoginSubmit}
{...login}
/>
</Well>
</Col>
<Col md={6}>
<h2>Registrace</h2>
<Signup
disabled={disabled}
form="signup"
onChange={onSignupChange}
onSubmit={onSignupSubmit}
{...signup}
/>
</Col>
</Row>
);
};
UserEntry.propTypes = {
login: PropTypes.object,
onLoginChange: PropTypes.func.isRequired,
onLoginSubmit: PropTypes.func.isRequired,
onSignupChange: PropTypes.func.isRequired,
onSignupSubmit: PropTypes.func.isRequired,
signup: PropTypes.object,
};
UserEntry.defaultProps = {
login: null,
signup: null,
};
export default UserEntry;
| Disable user entry on load | Disable user entry on load
| JSX | mit | just-paja/improtresk-web,just-paja/improtresk-web | ---
+++
@@ -15,30 +15,35 @@
onSignupChange,
onSignupSubmit,
signup,
-}) => (
- <Row>
- <Col md={6}>
- <h2>Už jsem zaregistrovaný</h2>
- <Well>
- <Login
- form="login"
- onChange={onLoginChange}
- onSubmit={onLoginSubmit}
- {...login}
+}) => {
+ const disabled = !!(login.loading || signup.loading);
+ return (
+ <Row>
+ <Col md={6}>
+ <h2>Už jsem zaregistrovaný</h2>
+ <Well>
+ <Login
+ disabled={disabled}
+ form="login"
+ onChange={onLoginChange}
+ onSubmit={onLoginSubmit}
+ {...login}
+ />
+ </Well>
+ </Col>
+ <Col md={6}>
+ <h2>Registrace</h2>
+ <Signup
+ disabled={disabled}
+ form="signup"
+ onChange={onSignupChange}
+ onSubmit={onSignupSubmit}
+ {...signup}
/>
- </Well>
- </Col>
- <Col md={6}>
- <h2>Registrace</h2>
- <Signup
- form="signup"
- onChange={onSignupChange}
- onSubmit={onSignupSubmit}
- {...signup}
- />
- </Col>
- </Row>
-);
+ </Col>
+ </Row>
+ );
+};
UserEntry.propTypes = {
login: PropTypes.object, |
f5479d81fdbf72a95fcc42b6131b6702fa6a1f94 | js/dispatcher.jsx | js/dispatcher.jsx | let operationList = [];
let linkList = [];
let count = 0;
let observer = null;
function emitChange() {
observer(operationList, linkList);
}
export function observe(o) {
if (observer) {
throw new Error('Multiple observers not implemented.');
}
observer = o;
emitChange();
}
export function addOperation(opType, opColor) {
// Do sth.
operationList.push({ x:210, y:10, opType:opType, opColor:opColor });
emitChange();
count++;
}
export function moveOperation(index, pos) {
operationList[index]=pos;
emitChange();
}
export function addLink(index_a, index_b) {
if (index_a != index_b) {
linkList.push({ a: index_a, b: index_b });
emitChange();
}
}
| let operationList = [];
let linkList = [];
let count = 0;
let observer = null;
function emitChange() {
observer(operationList, linkList);
}
export function observe(o) {
if (observer) {
throw new Error('Multiple observers not implemented.');
}
observer = o;
emitChange();
}
export function addOperation(opType, opColor) {
// Do sth.
operationList.push({ x:210, y:10, opType:opType, opColor:opColor });
emitChange();
count++;
}
export function moveOperation(index, pos) {
operationList[index]=pos;
emitChange();
}
function canAddLink(index_a, index_b) {
if (index_a != index_b) {
for (let i = 0; i < linkList.length; i++) {
let a = linkList[i].a;
let b = linkList[i].b;
if (a === index_a && b === index_b) {
return false;
}
}
return true;
}
return false;
}
export function addLink(index_a, index_b) {
if (canAddLink(index_a, index_b)) {
linkList.push({ a: index_a, b: index_b });
emitChange();
} else {
console.log("Cannot add link!");
}
}
| Add one simple constraint while adding link. | Add one simple constraint while adding link.
| JSX | mit | ReactExperiment/Paint,ReactExperiment/Paint | ---
+++
@@ -27,9 +27,25 @@
emitChange();
}
+function canAddLink(index_a, index_b) {
+ if (index_a != index_b) {
+ for (let i = 0; i < linkList.length; i++) {
+ let a = linkList[i].a;
+ let b = linkList[i].b;
+ if (a === index_a && b === index_b) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
export function addLink(index_a, index_b) {
- if (index_a != index_b) {
+ if (canAddLink(index_a, index_b)) {
linkList.push({ a: index_a, b: index_b });
emitChange();
+ } else {
+ console.log("Cannot add link!");
}
} |
184cb351c646f725d7eeefe2c323290311f71951 | app/components/Container.jsx | app/components/Container.jsx | import React from 'react';
import $ from 'jquery';
import Title from './Title.jsx';
import UserEntry from './UserEntry.jsx';
import UrbanDictionaryListing from './UrbanDictionaryListing.jsx';
export default class Container extends React.Component {
render() {
return (
<div className="container">
<Title
title="Talk Teen"
subtitle="Communicate with the incomprehensible"
/>
<UserEntry
onTranslate={this.translate}
/>
<div className="vspace">
{
this.state.listings.map(function(listing) {
return (
<UrbanDictionaryListing key={listing.defid} listing={listing} />
);
}, this)
}
</div>
</div>
);
}
state = {
listings: []
}
translate = (text) => {
var key = this.props.mashapeKey;
$.ajax({
url: this.props.url,
dataType: 'json',
type: 'GET',
data: {
'term': text
},
beforeSend: function(xhr) {
xhr.setRequestHeader('X-Mashape-Key', key);
},
success: function(data) {
this.setState({listings: data.list});
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
}.bind(this)
});
}
};
| import React from 'react';
import $ from 'jquery';
import Title from './Title.jsx';
import UserEntry from './UserEntry.jsx';
import UrbanDictionaryListing from './UrbanDictionaryListing.jsx';
export default class Container extends React.Component {
render() {
return (
<div className="container">
<Title
title="Talk Teen"
subtitle="Communicate with the incomprehensible"
/>
<UserEntry
onTranslate={this.translate}
/>
<div className="vspace">
{
this.state.listings.map(function(listing) {
return (
<UrbanDictionaryListing key={listing.defid} listing={listing} />
);
}, this)
}
</div>
</div>
);
}
state = {
listings: []
}
translate = (text) => {
$.ajax({
url: this.props.url,
dataType: 'json',
type: 'GET',
data: {
'term': text
},
beforeSend: function(xhr) {
xhr.setRequestHeader('X-Mashape-Key', this.props.mashapeKey);
}.bind(this),
success: function(data) {
this.setState({listings: data.list});
}.bind(this),
error: function(xhr, status, err) {
console.error(this.props.url, status, err.toString());
}.bind(this)
});
}
};
| Remove temp var for key | Remove temp var for key
| JSX | mit | hoop33/talk-teen,hoop33/talk-teen | ---
+++
@@ -31,7 +31,6 @@
listings: []
}
translate = (text) => {
- var key = this.props.mashapeKey;
$.ajax({
url: this.props.url,
dataType: 'json',
@@ -40,8 +39,8 @@
'term': text
},
beforeSend: function(xhr) {
- xhr.setRequestHeader('X-Mashape-Key', key);
- },
+ xhr.setRequestHeader('X-Mashape-Key', this.props.mashapeKey);
+ }.bind(this),
success: function(data) {
this.setState({listings: data.list});
}.bind(this), |
506f68356046a685fb1e0209a81fdaea4a95c392 | src/app.jsx | src/app.jsx | var React = require("react");
var App = React.createClass({
getInitialState(){
return {
isActive: "true",
id: 0
}
},
getDefaultProps(){
return {
text: 'this is a default prop',
number: 0
}
},
propTypes: {
text: React.PropTypes.string,
number: React.PropTypes.number.isRequired
},
update(e) {
this.setState({isActive: e.target.value})
},
render(){
return (
<div>
<h1>Hello world</h1>
<Binder text={this.state.isActive} update={this.update} />
<Binder text={this.state.isActive} update={this.update} />
<Binder text={this.state.isActive} update={this.update} />
<Binder text={this.state.isActive} update={this.update} />
</div>
)
}
});
var Binder = React.createClass({
render(){
return (
<div>
<h3>{this.props.text}</h3>
<input type="text" onChange={this.props.update} />
</div>
)
}
});
React.render(<App number={5}/>, document.getElementById("example")); | var React = require("react");
var App = React.createClass({
getInitialState(){
return {
id: 0,
first:"first",
second:"second",
third:"third",
fourth:"fourth"
}
},
getDefaultProps(){
return {
text: 'this is a default prop',
number: 0
}
},
propTypes: {
text: React.PropTypes.string,
number: React.PropTypes.number.isRequired
},
update(e) {
this.setState({
first: this.refs.first.refs.inp.getDOMNode().value,
second: this.refs.second.refs.inp.getDOMNode().value,
third: this.refs.third.refs.inp.getDOMNode().value,
fourth: this.refs.fourth.refs.inp.getDOMNode().value
})
},
render(){
return (
<div>
<Binder ref="first" update={this.update} />
<label>{this.state.first}</label>
<Binder ref="second" update={this.update} />
<label>{this.state.second}</label>
<Binder ref="third" update={this.update} />
<label>{this.state.third}</label>
<Binder ref="fourth" update={this.update} />
<label>{this.state.fourth}</label>
</div>
)
}
});
var Binder = React.createClass({
render(){
return (
<div>
<input ref="inp" type="text" onChange={this.props.update} />
</div>
)
}
});
React.render(<App number={5}/>, document.getElementById("example")); | Use refs to access components | Use refs to access components
| JSX | mit | vandosant/infohound,vandosant/infohound | ---
+++
@@ -3,8 +3,11 @@
var App = React.createClass({
getInitialState(){
return {
- isActive: "true",
- id: 0
+ id: 0,
+ first:"first",
+ second:"second",
+ third:"third",
+ fourth:"fourth"
}
},
getDefaultProps(){
@@ -18,16 +21,24 @@
number: React.PropTypes.number.isRequired
},
update(e) {
- this.setState({isActive: e.target.value})
+ this.setState({
+ first: this.refs.first.refs.inp.getDOMNode().value,
+ second: this.refs.second.refs.inp.getDOMNode().value,
+ third: this.refs.third.refs.inp.getDOMNode().value,
+ fourth: this.refs.fourth.refs.inp.getDOMNode().value
+ })
},
render(){
return (
<div>
- <h1>Hello world</h1>
- <Binder text={this.state.isActive} update={this.update} />
- <Binder text={this.state.isActive} update={this.update} />
- <Binder text={this.state.isActive} update={this.update} />
- <Binder text={this.state.isActive} update={this.update} />
+ <Binder ref="first" update={this.update} />
+ <label>{this.state.first}</label>
+ <Binder ref="second" update={this.update} />
+ <label>{this.state.second}</label>
+ <Binder ref="third" update={this.update} />
+ <label>{this.state.third}</label>
+ <Binder ref="fourth" update={this.update} />
+ <label>{this.state.fourth}</label>
</div>
)
}
@@ -37,8 +48,7 @@
render(){
return (
<div>
- <h3>{this.props.text}</h3>
- <input type="text" onChange={this.props.update} />
+ <input ref="inp" type="text" onChange={this.props.update} />
</div>
)
} |
26b14f0472a70d56e3e39c78f740aa99faa3e66e | app/components/ListingItem/ListingItem.jsx | app/components/ListingItem/ListingItem.jsx | 'use strict';
import './_ListingItem.scss';
import React from 'react';
import classnames from 'classnames';
import moment from 'moment';
import { COMMENTS_CLICK } from '../../constants/AppConstants';
var { PropTypes } = React;
class ListingItem extends React.Component {
constructor(...args) {
super(...args);
this.state = {
isSelected: false
};
}
toggleSelected() {
this.setState({
isSelected: !this.state.isSelected
});
}
isSelected() {
return this.state.isSelected;
}
getClassName() {
return classnames({
'listing-item': true,
'-selected': this.isSelected()
});
}
render() {
var item = this.props.item;
var timeFromNow = moment(new Date(item.ctime * 1000)).fromNow();
return (
<article className={this.getClassName()}>
<h2>
<a rel="nofollow" href={item.url}>
{item.title}
</a>
</h2>
<p>
{item.up} up and {item.down} down,
posted by {item.username} {timeFromNow}
with <a href={'/#/comments/'+this.props.item.id}>{item.comments} comments</a>
</p>
</article>
);
}
}
ListingItem.propTypes = {
item: PropTypes.object.isRequired
};
export default ListingItem;
| 'use strict';
import './_ListingItem.scss';
import React from 'react';
import Router from 'react-router';
import classnames from 'classnames';
import moment from 'moment';
let { PropTypes } = React;
let { Link } = Router;
class ListingItem extends React.Component {
getClassName() {
return classnames('listing-item');
}
render() {
var item = this.props.item;
var timeFromNow = moment(new Date(item.ctime * 1000)).fromNow();
return (
<article className={this.getClassName()}>
<h2>
<a rel="nofollow" href={item.url}>
{item.title}
</a>
</h2>
<p>
<span>{item.up} up and {item.down} down,</span>
<span>posted by {item.username} {timeFromNow}</span>
<span>with </span>
<Link to="comments" params={{newsId: this.props.item.id}}>
{item.comments} comments
</Link>
</p>
</article>
);
}
}
ListingItem.propTypes = {
item: PropTypes.object.isRequired
};
export default ListingItem;
| Use <Link/> for building anchors | Use <Link/> for building anchors
| JSX | mit | badsyntax/echojs-mobile-client,badsyntax/echojs-mobile-client,badsyntax/echojs-mobile-client,badsyntax/echojs-mobile-client | ---
+++
@@ -3,37 +3,17 @@
import './_ListingItem.scss';
import React from 'react';
+import Router from 'react-router';
import classnames from 'classnames';
import moment from 'moment';
-import { COMMENTS_CLICK } from '../../constants/AppConstants';
-
-var { PropTypes } = React;
+let { PropTypes } = React;
+let { Link } = Router;
class ListingItem extends React.Component {
- constructor(...args) {
- super(...args);
- this.state = {
- isSelected: false
- };
- }
-
- toggleSelected() {
- this.setState({
- isSelected: !this.state.isSelected
- });
- }
-
- isSelected() {
- return this.state.isSelected;
- }
-
getClassName() {
- return classnames({
- 'listing-item': true,
- '-selected': this.isSelected()
- });
+ return classnames('listing-item');
}
render() {
@@ -47,9 +27,12 @@
</a>
</h2>
<p>
- {item.up} up and {item.down} down,
- posted by {item.username} {timeFromNow}
- with <a href={'/#/comments/'+this.props.item.id}>{item.comments} comments</a>
+ <span>{item.up} up and {item.down} down,</span>
+ <span>posted by {item.username} {timeFromNow}</span>
+ <span>with </span>
+ <Link to="comments" params={{newsId: this.props.item.id}}>
+ {item.comments} comments
+ </Link>
</p>
</article>
); |
655b1f3f346d5b4b3d41f7f98f2126e8af61fb89 | test/AppLike.jsx | test/AppLike.jsx | import React from 'react'
import { createStore } from 'redux'
import CozyClient, { CozyProvider } from 'cozy-client'
import { Provider as ReduxProvider } from 'react-redux'
import PropTypes from 'prop-types'
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
import I18n from 'cozy-ui/transpiled/react/I18n'
import enLocale from '../src/locales/en.json'
const fakeDefaultReduxState = {
apps: [{ slug: 'drive', links: { related: '' } }],
konnectors: {}
}
const reduxStore = createStore(() => fakeDefaultReduxState)
const defaultClient = new CozyClient({})
class AppLike extends React.Component {
constructor(props, context) {
super(props, context)
}
getChildContext() {
return {
store: this.props.store
}
}
render() {
return (
<BreakpointsProvider>
<CozyProvider client={this.props.client || defaultClient}>
<ReduxProvider store={this.props.store}>
<I18n dictRequire={() => enLocale} lang="en">
{this.props.children}
</I18n>
</ReduxProvider>
</CozyProvider>
</BreakpointsProvider>
)
}
}
AppLike.childContextTypes = {
store: PropTypes.object.isRequired
}
AppLike.defaultProps = {
store: reduxStore
}
export default AppLike
| import React from 'react'
import { createStore } from 'redux'
import { CozyProvider } from 'cozy-client'
import { createMockClient } from 'cozy-client/dist/mock'
import { Provider as ReduxProvider } from 'react-redux'
import PropTypes from 'prop-types'
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
import I18n from 'cozy-ui/transpiled/react/I18n'
import enLocale from '../src/locales/en.json'
const fakeDefaultReduxState = {
apps: [{ slug: 'drive', links: { related: '' } }],
konnectors: {}
}
const reduxStore = createStore(() => fakeDefaultReduxState)
const defaultClient = createMockClient({})
class AppLike extends React.Component {
constructor(props, context) {
super(props, context)
}
getChildContext() {
return {
store: this.props.store
}
}
render() {
return (
<BreakpointsProvider>
<CozyProvider client={this.props.client || defaultClient}>
<ReduxProvider store={this.props.store}>
<I18n dictRequire={() => enLocale} lang="en">
{this.props.children}
</I18n>
</ReduxProvider>
</CozyProvider>
</BreakpointsProvider>
)
}
}
AppLike.childContextTypes = {
store: PropTypes.object.isRequired
}
AppLike.defaultProps = {
store: reduxStore
}
export default AppLike
| Use a mock client so that fetchJSON is mocked | test: Use a mock client so that fetchJSON is mocked
Prevents "Unhandled rejection errors: fetch is not defined"
| JSX | agpl-3.0 | cozy/cozy-home,cozy/cozy-home,cozy/cozy-home | ---
+++
@@ -1,6 +1,7 @@
import React from 'react'
import { createStore } from 'redux'
-import CozyClient, { CozyProvider } from 'cozy-client'
+import { CozyProvider } from 'cozy-client'
+import { createMockClient } from 'cozy-client/dist/mock'
import { Provider as ReduxProvider } from 'react-redux'
import PropTypes from 'prop-types'
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
@@ -13,7 +14,7 @@
}
const reduxStore = createStore(() => fakeDefaultReduxState)
-const defaultClient = new CozyClient({})
+const defaultClient = createMockClient({})
class AppLike extends React.Component {
constructor(props, context) { |
6905704f4f13196549ef458817341b27f19eb941 | src/containers/monitor-list.jsx | src/containers/monitor-list.jsx | import bindAll from 'lodash.bindall';
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {moveMonitorRect} from '../reducers/monitor-layout';
import MonitorListComponent from '../components/monitor-list/monitor-list.jsx';
class MonitorList extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleMonitorChange'
]);
}
handleMonitorChange (id, x, y) { // eslint-disable-line no-unused-vars
this.props.moveMonitorRect(id, x, y);
}
render () {
return (
<MonitorListComponent
onMonitorChange={this.handleMonitorChange}
{...this.props}
/>
);
}
}
MonitorList.propTypes = {
moveMonitorRect: PropTypes.func.isRequired
};
const mapStateToProps = state => ({
monitors: state.monitors
});
const mapDispatchToProps = dispatch => ({
moveMonitorRect: (id, x, y) => dispatch(moveMonitorRect(id, x, y))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(MonitorList);
| import bindAll from 'lodash.bindall';
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import {moveMonitorRect} from '../reducers/monitor-layout';
import errorBoundaryHOC from '../lib/error-boundary-hoc.jsx';
import MonitorListComponent from '../components/monitor-list/monitor-list.jsx';
class MonitorList extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleMonitorChange'
]);
}
handleMonitorChange (id, x, y) { // eslint-disable-line no-unused-vars
this.props.moveMonitorRect(id, x, y);
}
render () {
return (
<MonitorListComponent
onMonitorChange={this.handleMonitorChange}
{...this.props}
/>
);
}
}
MonitorList.propTypes = {
moveMonitorRect: PropTypes.func.isRequired
};
const mapStateToProps = state => ({
monitors: state.monitors
});
const mapDispatchToProps = dispatch => ({
moveMonitorRect: (id, x, y) => dispatch(moveMonitorRect(id, x, y))
});
export default errorBoundaryHOC('Monitors')(
connect(
mapStateToProps,
mapDispatchToProps
)(MonitorList)
);
| Add an error boundary for monitors, now that they do a lot. | Add an error boundary for monitors, now that they do a lot.
| JSX | bsd-3-clause | LLK/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui | ---
+++
@@ -4,6 +4,8 @@
import {connect} from 'react-redux';
import {moveMonitorRect} from '../reducers/monitor-layout';
+
+import errorBoundaryHOC from '../lib/error-boundary-hoc.jsx';
import MonitorListComponent from '../components/monitor-list/monitor-list.jsx';
@@ -37,7 +39,9 @@
moveMonitorRect: (id, x, y) => dispatch(moveMonitorRect(id, x, y))
});
-export default connect(
- mapStateToProps,
- mapDispatchToProps
-)(MonitorList);
+export default errorBoundaryHOC('Monitors')(
+ connect(
+ mapStateToProps,
+ mapDispatchToProps
+ )(MonitorList)
+); |
9574c9285183f84fd930e8e8ffce32853d371b11 | ui/src/components/common/ClipboardInput.jsx | ui/src/components/common/ClipboardInput.jsx | import React, { useState, useCallback, useRef } from 'react';
import { Button, InputGroup, Tooltip } from '@blueprintjs/core';
import { FormattedMessage } from 'react-intl';
export default function ClipboardInput(props) {
const inputRef = useRef(null);
const titles = [
<FormattedMessage
id="clipboard.copy.before"
defaultMessage="Copy to clipboard"
/>, <FormattedMessage
id="clipboard.copy.after"
defaultMessage="Copied to clipboard!"
/>,
];
const [title, setTitle] = useState(0);
return (
<InputGroup
inputRef={inputRef}
leftIcon={props.icon}
id={props.id}
readOnly
value={props.value}
rightElement={(
<Tooltip content={titles[title]}>
<Button
onClick={useCallback(
() => {
inputRef.current.select();
document.execCommand('copy');
setTitle(1);
},
[titles],
)}
icon="clipboard"
minimal
/>
</Tooltip>
)}
/>
);
}
| import React, { useState, useCallback, useRef } from 'react';
import { Button, InputGroup, Tooltip } from '@blueprintjs/core';
import { FormattedMessage } from 'react-intl';
export default function ClipboardInput(props) {
const inputRef = useRef(null);
const titles = [
<FormattedMessage
id="clipboard.copy.before"
defaultMessage="Copy to clipboard"
/>, <FormattedMessage
id="clipboard.copy.after"
defaultMessage="Copied to clipboard!"
/>,
];
const [title, setTitle] = useState(0);
return (
<InputGroup
inputRef={inputRef}
leftIcon={props.icon}
id={props.id}
readOnly
value={props.value}
rightElement={(
<Tooltip content={titles[title]}>
<Button
onClick={() => {
inputRef.current.select();
document.execCommand('copy');
setTitle(1);
}}
icon="clipboard"
minimal
/>
</Tooltip>
)}
/>
);
}
| Remove use of useCallback in clipboard | Remove use of useCallback in clipboard
| JSX | mit | pudo/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph | ---
+++
@@ -26,14 +26,11 @@
rightElement={(
<Tooltip content={titles[title]}>
<Button
- onClick={useCallback(
- () => {
+ onClick={() => {
inputRef.current.select();
document.execCommand('copy');
setTitle(1);
- },
- [titles],
- )}
+ }}
icon="clipboard"
minimal
/> |
9ff495a270b4d0aef058fa4c785fd7ba30017066 | src/components/Github/Loading.jsx | src/components/Github/Loading.jsx | import React, { View, Text } from 'react-native';
export default () => {
return (
<View>
<Text>
Loading items...
</Text>
</View>
);
};
| import React, { View, Text } from 'react-native';
export default () => {
return (
<View style={styles.container}>
<Text>
Logout ...
</Text>
</View>
);
};
const styles = {
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
}; | Add logout screen as component | Add logout screen as component
| JSX | mit | jseminck/react-native-github-feed,jseminck/react-native-github-feed,jseminck/react-native-github-feed | ---
+++
@@ -2,10 +2,18 @@
export default () => {
return (
- <View>
+ <View style={styles.container}>
<Text>
- Loading items...
+ Logout ...
</Text>
</View>
);
};
+
+const styles = {
+ container: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center'
+ }
+}; |
b85dc80b42a104a9fb15c10f471912556241dfc1 | client/src/components/Header.jsx | client/src/components/Header.jsx | import React from 'react';
class Header extends React.Component {
constructor (props) {
super(props);
}
render() {
return (
<div>
<div className="page-header text-center">
<h1>FoodQuest</h1>
<small>the go-to app for Adventurous Eaters</small>
</div>
</div>
);
}
}
export default Header; | import React from 'react';
class Header extends React.Component {
constructor (props) {
super(props);
}
render() {
return (
<div>
<div className="page-header text-center">
<h1 className='text-shadow'>FoodQuest</h1>
<small>the go-to app for Adventurous Eaters</small>
</div>
</div>
);
}
}
export default Header; | Edit h1 tag to add className text-shadow | Edit h1 tag to add className text-shadow
| JSX | mit | Sibilant-Siblings/sibilant-siblings,Sibilant-Siblings/sibilant-siblings | ---
+++
@@ -9,8 +9,10 @@
return (
<div>
<div className="page-header text-center">
- <h1>FoodQuest</h1>
- <small>the go-to app for Adventurous Eaters</small>
+
+ <h1 className='text-shadow'>FoodQuest</h1>
+ <small>the go-to app for Adventurous Eaters</small>
+
</div>
</div>
); |
2ca40fce2d7129673442cba0d7b8f09c59386697 | assets-server/components/shared/header.jsx | assets-server/components/shared/header.jsx | import React from 'react/addons';
import InlineStyles from 'react-style';
const inlineStyles = InlineStyles.create({
ISContainer : {
padding : '8px 0 0 0',
maxWidth : '1218px',
margin : '0 auto'
}
});
export default class Header extends React.Component {
constructor(props) {
super(props);
}
render() {
const { heading } = this.props,
{ ISContainer } = this.styles;
return (
<header {...this.props}>
<div className="container" styles={[ISContainer]}>
<h2>{heading}</h2>
</div>
</header>
);
}
} | import React from 'react/addons';
import InlineStyles from 'react-style';
const inlineStyles = InlineStyles.create({
ISContainer : {
padding : '8px 0 0 0',
maxWidth : '1218px',
margin : '0 auto'
}
});
export default class Header extends React.Component {
constructor(props) {
super(props);
}
render() {
const { heading } = this.props,
{ ISContainer } = this.styles;
return (
<header {...this.props}>
<div className="container" styles={[ISContainer]}>
<h2>{heading}</h2>
</div>
</header>
);
}
} | Add spaces between methods of Header class | Add spaces between methods of Header class
| JSX | mit | renemonroy/es6-scaffold,renemonroy/es6-scaffold | ---
+++
@@ -10,9 +10,11 @@
});
export default class Header extends React.Component {
+
constructor(props) {
super(props);
}
+
render() {
const { heading } = this.props,
{ ISContainer } = this.styles;
@@ -24,4 +26,5 @@
</header>
);
}
+
} |
b9320ee416a723c32a044c94284b6703f3f2ba04 | client/components/SpeechView.jsx | client/components/SpeechView.jsx | import React from 'react';
import RecordingView from './RecordingView.jsx';
import SpeechAnalytics from './SpeechAnalytics.jsx';
export default class SpeechView extends React.Component {
constructor(props) {
super(props);
this.state = {
visibleAnalytics: false,
value: '',
};
}
analyzeText = () => {
this.setState({
visibleAnalytics: true,
});
}
resetText = () => {
this.setState({
visibleAnalytics: false,
value: '',
});
}
handleChange = (e) => {
this.state.value = e.target.value;
}
render() {
return (
<div id='speech-input'>
<h1 id='speech-input-title'>Speech Analyzer</h1>
<RecordingView />
</div>
)
}
}
| import React from 'react';
import RecordingView from './RecordingView.jsx';
export default function SpeechView() {
return (
<div id="speech-input">
<h1 id="speech-input-title">Speech Analyzer</h1>
<RecordingView />
</div>
);
}
| Address linter errors and clean up unnecessary code | Address linter errors and clean up unnecessary code
| JSX | mit | alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor | ---
+++
@@ -1,40 +1,11 @@
import React from 'react';
import RecordingView from './RecordingView.jsx';
-import SpeechAnalytics from './SpeechAnalytics.jsx';
-export default class SpeechView extends React.Component {
-
- constructor(props) {
- super(props);
- this.state = {
- visibleAnalytics: false,
- value: '',
- };
- }
-
- analyzeText = () => {
- this.setState({
- visibleAnalytics: true,
- });
- }
-
- resetText = () => {
- this.setState({
- visibleAnalytics: false,
- value: '',
- });
- }
-
- handleChange = (e) => {
- this.state.value = e.target.value;
- }
-
- render() {
- return (
- <div id='speech-input'>
- <h1 id='speech-input-title'>Speech Analyzer</h1>
- <RecordingView />
- </div>
- )
- }
+export default function SpeechView() {
+ return (
+ <div id="speech-input">
+ <h1 id="speech-input-title">Speech Analyzer</h1>
+ <RecordingView />
+ </div>
+ );
} |
c087d8c4784654e19d35ac7e54ee1bd9881ed488 | docs/src/examples/date_range.jsx | docs/src/examples/date_range.jsx | var React = require("react");
var DatePicker = require("react-datepicker");
var moment = require("moment");
var DateRange = React.createClass({
displayName: "DateRange",
getInitialState: function() {
return {
startDate: moment("2014-02-08"),
endDate: moment("2014-02-10")
};
},
handleChange: function(date) {
this.setState({
startDate: date
});
},
render: function() {
return <div className="row">
<pre className="column example__code">
<code className="jsx">
{"<DatePicker"}<br />
{"selected={this.state.startDate}"}<br />
{"startDate={this.state.startDate}"}<br />
{"endDate={this.state.endDate} />"}
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
startDate={this.state.startDate}
endDate={this.state.endDate} />
</div>
</div>;
}
});
module.exports = DateRange;
| var React = require("react");
var DatePicker = require("react-datepicker");
var moment = require("moment");
var DateRange = React.createClass({
displayName: "DateRange",
getInitialState: function() {
return {
startDate: moment("2014-02-08"),
endDate: moment("2014-02-10")
};
},
handleChange: function({ startDate, endDate }) {
startDate = startDate || this.state.startDate;
endDate = endDate || this.state.endDate;
if (startDate.isAfter(endDate)) {
var temp = startDate;
startDate = endDate;
endDate = temp;
}
this.setState({ startDate, endDate });
},
handleChangeStart: function(startDate) {
this.handleChange({ startDate });
},
handleChangeEnd: function(endDate) {
this.handleChange({ endDate });
},
render: function() {
return <div className="row">
<pre className="column example__code">
<code className="jsx">
{"<DatePicker"}<br />
{"selected={this.state.startDate}"}<br />
{"startDate={this.state.startDate}"}<br />
{"endDate={this.state.endDate}"}<br />
{"onChange={this.handleChangeStart} />"}<br />
{"<DatePicker"}<br />
{"selected={this.state.endDate}"}<br />
{"startDate={this.state.startDate}"}<br />
{"endDate={this.state.endDate}"}<br />
{"onChange={this.handleChangeEnd} />"}<br />
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
startDate={this.state.startDate}
endDate={this.state.endDate}
onChange={this.handleChangeStart} />
<DatePicker
selected={this.state.endDate}
startDate={this.state.startDate}
endDate={this.state.endDate}
onChange={this.handleChangeEnd} />
</div>
</div>;
}
});
module.exports = DateRange;
| Make date range selection example more realistic | Make date range selection example more realistic
| JSX | mit | lmenus/react-datepicker,marketplacer/react-datepicker,mitchrosu/react-datepicker,Hacker0x01/react-datepicker,flexport/react-datepicker,mitchrosu/react-datepicker,bekerov/react-datepicker-roco,lmenus/react-datepicker,sss0791/react-datepicker,BrunoAlcides/react-datepicker,Hacker0x01/react-datepicker,Hacker0x01/react-datepicker,marketplacer/react-datepicker,BrunoAlcides/react-datepicker,flexport/react-datepicker,mitchrosu/react-datepicker,flexport/react-datepicker,lmenus/react-datepicker,bekerov/react-datepicker-roco,marketplacer/react-datepicker,bekerov/react-datepicker-roco,BrunoAlcides/react-datepicker | ---
+++
@@ -12,10 +12,25 @@
};
},
- handleChange: function(date) {
- this.setState({
- startDate: date
- });
+ handleChange: function({ startDate, endDate }) {
+ startDate = startDate || this.state.startDate;
+ endDate = endDate || this.state.endDate;
+
+ if (startDate.isAfter(endDate)) {
+ var temp = startDate;
+ startDate = endDate;
+ endDate = temp;
+ }
+
+ this.setState({ startDate, endDate });
+ },
+
+ handleChangeStart: function(startDate) {
+ this.handleChange({ startDate });
+ },
+
+ handleChangeEnd: function(endDate) {
+ this.handleChange({ endDate });
},
render: function() {
@@ -25,14 +40,26 @@
{"<DatePicker"}<br />
{"selected={this.state.startDate}"}<br />
{"startDate={this.state.startDate}"}<br />
- {"endDate={this.state.endDate} />"}
+ {"endDate={this.state.endDate}"}<br />
+ {"onChange={this.handleChangeStart} />"}<br />
+ {"<DatePicker"}<br />
+ {"selected={this.state.endDate}"}<br />
+ {"startDate={this.state.startDate}"}<br />
+ {"endDate={this.state.endDate}"}<br />
+ {"onChange={this.handleChangeEnd} />"}<br />
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
startDate={this.state.startDate}
- endDate={this.state.endDate} />
+ endDate={this.state.endDate}
+ onChange={this.handleChangeStart} />
+ <DatePicker
+ selected={this.state.endDate}
+ startDate={this.state.startDate}
+ endDate={this.state.endDate}
+ onChange={this.handleChangeEnd} />
</div>
</div>;
} |
475dfcea734ed939225abc864ffc5b97dd2c91e5 | app/app/components/Main.jsx | app/app/components/Main.jsx | import React from 'react'
import Nav from './navbar/Nav.jsx';
import helpers from '../utils/helpers.jsx'
export default class Main extends React.Component {
render(){
return (
<div>
<Nav />
<div className="container">{this.props.children}</div>
</div>
)
}
} | import React from 'react'
import Nav from './navbar/Nav.jsx';
import helpers from '../utils/helpers.jsx'
export default class Main extends React.Component {
render(){
return (
<div>
<Nav />
<div className="container">{this.props.children}</div>
</div>
)
}
}
| Add new routes for new task | Add new routes for new task
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | |
e68e43d3b06bb01d07e10b2ceaefb875e89d7505 | imports/ui/ShowDID.jsx | imports/ui/ShowDID.jsx | import createReactClass from 'create-react-class'
import QRCode from 'qrcode.react'
import React from 'react'
import {Button, Modal, ModalBody, ModalHeader} from 'reactstrap'
const ShowDID = createReactClass({
getInitialState: () => ({modal: false}),
toggle: function () {
this.setState({
modal: !this.state.modal
})
},
render: function () {
const did = `did:btcr:${this.props.did}`
return (
<div>
<Button color='primary' onClick={this.toggle} block> Show DID </Button>
<Modal isOpen={this.state.modal} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
{did}
</ModalHeader>
<ModalBody>
<div className='d-flex justify-content-center'>
<QRCode value={did} size={256} className='mx-auto' />
</div>
</ModalBody>
</Modal>
</div>
)
}
})
export default ShowDID
| import createReactClass from 'create-react-class'
import QRCode from 'qrcode.react'
import React from 'react'
import {Button, Modal, ModalBody, ModalHeader} from 'reactstrap'
import ShowTruncatedText from '/imports/ui/ShowTruncatedText'
const ShowDID = createReactClass({
getInitialState: () => ({modal: false}),
toggle: function () {
this.setState({
modal: !this.state.modal
})
},
render: function () {
const did = `did:btcr:${this.props.did}`
return (
<div>
<Button color='primary' onClick={this.toggle} block> Show DID </Button>
<Modal isOpen={this.state.modal} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
<ShowTruncatedText text={did} />
</ModalHeader>
<ModalBody>
<div className='d-flex justify-content-center'>
<QRCode value={did} size={256} className='mx-auto' />
</div>
</ModalBody>
</Modal>
</div>
)
}
})
export default ShowDID
| Use truncated text to show the DID | Use truncated text to show the DID
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -2,6 +2,7 @@
import QRCode from 'qrcode.react'
import React from 'react'
import {Button, Modal, ModalBody, ModalHeader} from 'reactstrap'
+import ShowTruncatedText from '/imports/ui/ShowTruncatedText'
const ShowDID = createReactClass({
@@ -20,7 +21,7 @@
<Button color='primary' onClick={this.toggle} block> Show DID </Button>
<Modal isOpen={this.state.modal} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
- {did}
+ <ShowTruncatedText text={did} />
</ModalHeader>
<ModalBody>
<div className='d-flex justify-content-center'> |
a6de62ee42835164a95aded7fe165de393d97657 | frontend/src/visualizations/components/LineAreaBarChart.jsx | frontend/src/visualizations/components/LineAreaBarChart.jsx | import React, { Component, PropTypes } from "react";
import CardRenderer from "./CardRenderer.jsx";
import LegendHeader from "./LegendHeader.jsx";
import ChartTooltip from "./ChartTooltip.jsx";
import _ from "underscore";
import cx from "classnames";
export default class LineAreaBarChart extends Component {
static propTypes = {
series: PropTypes.array.isRequired,
onAddSeries: PropTypes.func,
extraActions: PropTypes.node
};
getHoverClasses() {
const { hovered } = this.props;
if (hovered != null && hovered.seriesIndex != null) {
let seriesClasses = _.range(0,5).filter(n => n !== hovered.seriesIndex).map(n => "mute-"+n);
let axisClasses =
hovered.axisIndex === 0 ? "mute-yr" :
hovered.axisIndex === 1 ? "mute-yl" :
null;
return seriesClasses.concat(axisClasses);
} else {
return null;
}
}
render() {
let { series, hovered, onAddSeries, extraActions } = this.props;
return (
<div className={cx("flex flex-full flex-column p1", this.getHoverClasses())}>
<LegendHeader series={series} onAddSeries={onAddSeries} extraActions={extraActions} hovered={hovered} onHoverChange={this.props.onHoverChange} />
<CardRenderer className="flex-full" {...this.props} />
<ChartTooltip series={series} hovered={hovered} />
</div>
);
}
}
| import React, { Component, PropTypes } from "react";
import CardRenderer from "./CardRenderer.jsx";
import LegendHeader from "./LegendHeader.jsx";
import ChartTooltip from "./ChartTooltip.jsx";
import _ from "underscore";
import cx from "classnames";
export default class LineAreaBarChart extends Component {
static propTypes = {
series: PropTypes.array.isRequired,
onAddSeries: PropTypes.func,
extraActions: PropTypes.node,
isDashboard: PropTypes.bool
};
getHoverClasses() {
const { hovered } = this.props;
if (hovered != null && hovered.seriesIndex != null) {
let seriesClasses = _.range(0,5).filter(n => n !== hovered.seriesIndex).map(n => "mute-"+n);
let axisClasses =
hovered.axisIndex === 0 ? "mute-yr" :
hovered.axisIndex === 1 ? "mute-yl" :
null;
return seriesClasses.concat(axisClasses);
} else {
return null;
}
}
render() {
let { series, hovered, isDashboard, onAddSeries, extraActions } = this.props;
return (
<div className={cx("flex flex-full flex-column p1", this.getHoverClasses())}>
{ isDashboard && <LegendHeader series={series} onAddSeries={onAddSeries} extraActions={extraActions} hovered={hovered} onHoverChange={this.props.onHoverChange} /> }
<CardRenderer className="flex-full" {...this.props} />
<ChartTooltip series={series} hovered={hovered} />
</div>
);
}
}
| Disable legend header outside of dashboard | Disable legend header outside of dashboard
| JSX | agpl-3.0 | blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase,blueoceanideas/metabase | ---
+++
@@ -11,7 +11,8 @@
static propTypes = {
series: PropTypes.array.isRequired,
onAddSeries: PropTypes.func,
- extraActions: PropTypes.node
+ extraActions: PropTypes.node,
+ isDashboard: PropTypes.bool
};
getHoverClasses() {
@@ -29,10 +30,10 @@
}
render() {
- let { series, hovered, onAddSeries, extraActions } = this.props;
+ let { series, hovered, isDashboard, onAddSeries, extraActions } = this.props;
return (
<div className={cx("flex flex-full flex-column p1", this.getHoverClasses())}>
- <LegendHeader series={series} onAddSeries={onAddSeries} extraActions={extraActions} hovered={hovered} onHoverChange={this.props.onHoverChange} />
+ { isDashboard && <LegendHeader series={series} onAddSeries={onAddSeries} extraActions={extraActions} hovered={hovered} onHoverChange={this.props.onHoverChange} /> }
<CardRenderer className="flex-full" {...this.props} />
<ChartTooltip series={series} hovered={hovered} />
</div> |
a8fb56e48aedcee8d7e23a578283da7bb5321455 | test/components/settings/admin_user_list.spec.jsx | test/components/settings/admin_user_list.spec.jsx | import React from 'react';
import { shallow } from 'enzyme';
import '../../testHelper';
import AdminUserList from '../../../app/assets/javascripts/components/settings/admin_users_list.jsx';
describe('AdminUserList', () => {
it('renders a List component with correct elements', () => {
const expectedAdminUsers = [{ id: 1, username: 'testUser', real_name: 'real name', permissions: 3 }];
const wrapper = shallow(<AdminUserList adminUsers={expectedAdminUsers} />);
const renderedUsers = wrapper
.find('List')
.first()
.props()
.elements.map((elem) => {
return elem.props.user;
});
expect(renderedUsers).to.eql(expectedAdminUsers);
});
it('renders the correct empty message', () => {
const expectedAdminUsers = [];
const wrapper = shallow(<AdminUserList adminUsers={expectedAdminUsers} />);
const list = wrapper.find('List').first();
const renderedUsers = list
.props()
.elements.map((elem) => {
return elem.props.user;
});
expect(renderedUsers).to.eql([]);
expect(list.props().none_message).to.equal('no admin users');
});
});
| import React from 'react';
import { Provider } from 'react-redux';
import { render } from 'enzyme';
import '../../testHelper';
import AdminUserList from '../../../app/assets/javascripts/components/settings/admin_users_list.jsx';
describe('AdminUserList', () => {
it('renders a List component with correct elements', () => {
const expectedAdminUsers = [{ id: 1, username: 'testUser', real_name: 'real name', permissions: 3 }];
const renderedList = render(
<Provider store={reduxStore}>
<AdminUserList adminUsers={expectedAdminUsers} />
</Provider>
);
expect(renderedList.find('td.user__username').text()).to.eq('testUser');
});
});
| Fix jest tests to work with new List component | Fix jest tests to work with new List component
This rewrites the first test of the admins list to work with the new List. It removes the second, because it was testing the situation of zero admins... which should never be rendered anyway since the settings view requires (super) admin permissions to view.
| JSX | mit | WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ---
+++
@@ -1,5 +1,6 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { Provider } from 'react-redux';
+import { render } from 'enzyme';
import '../../testHelper';
import AdminUserList from '../../../app/assets/javascripts/components/settings/admin_users_list.jsx';
@@ -7,30 +8,12 @@
describe('AdminUserList', () => {
it('renders a List component with correct elements', () => {
const expectedAdminUsers = [{ id: 1, username: 'testUser', real_name: 'real name', permissions: 3 }];
- const wrapper = shallow(<AdminUserList adminUsers={expectedAdminUsers} />);
+ const renderedList = render(
+ <Provider store={reduxStore}>
+ <AdminUserList adminUsers={expectedAdminUsers} />
+ </Provider>
+ );
- const renderedUsers = wrapper
- .find('List')
- .first()
- .props()
- .elements.map((elem) => {
- return elem.props.user;
- });
-
- expect(renderedUsers).to.eql(expectedAdminUsers);
- });
-
- it('renders the correct empty message', () => {
- const expectedAdminUsers = [];
- const wrapper = shallow(<AdminUserList adminUsers={expectedAdminUsers} />);
- const list = wrapper.find('List').first();
- const renderedUsers = list
- .props()
- .elements.map((elem) => {
- return elem.props.user;
- });
-
- expect(renderedUsers).to.eql([]);
- expect(list.props().none_message).to.equal('no admin users');
+ expect(renderedList.find('td.user__username').text()).to.eq('testUser');
});
}); |
15521d57e3d216190f9152510b656a9fce7bbb69 | src/components/templates/DetailsTemplate/DetailsTemplate.jsx | src/components/templates/DetailsTemplate/DetailsTemplate.jsx | /*
Copyright (C) 2017 Cloudbase Solutions SRL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// @flow
import * as React from 'react'
import styled from 'styled-components'
const Wrapper = styled.div`
min-width: 1100px;
`
const PageHeader = styled.div``
const ContentHeader = styled.div``
const Content = styled.div`
margin: 32px 0;
`
type Props = {
pageHeaderComponent: React.Node,
contentHeaderComponent: React.Node,
contentComponent: React.Node,
}
const DetailsTemplate = (props: Props) => {
return (
<Wrapper>
<PageHeader>{props.pageHeaderComponent}</PageHeader>
<ContentHeader>{props.contentHeaderComponent}</ContentHeader>
<Content>{props.contentComponent}</Content>
</Wrapper>
)
}
export default DetailsTemplate
| /*
Copyright (C) 2017 Cloudbase Solutions SRL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// @flow
import * as React from 'react'
import styled from 'styled-components'
const Wrapper = styled.div`
min-width: 1100px;
`
const PageHeader = styled.div``
const ContentHeader = styled.div``
const Content = styled.div`
padding: 32px 0;
`
type Props = {
pageHeaderComponent: React.Node,
contentHeaderComponent: React.Node,
contentComponent: React.Node,
}
const DetailsTemplate = (props: Props) => {
return (
<Wrapper>
<PageHeader>{props.pageHeaderComponent}</PageHeader>
<ContentHeader>{props.contentHeaderComponent}</ContentHeader>
<Content>{props.contentComponent}</Content>
</Wrapper>
)
}
export default DetailsTemplate
| Fix missing details pages bottom margin on Safari | Fix missing details pages bottom margin on Safari
| JSX | agpl-3.0 | aznashwan/coriolis-web,aznashwan/coriolis-web | ---
+++
@@ -23,7 +23,7 @@
const PageHeader = styled.div``
const ContentHeader = styled.div``
const Content = styled.div`
- margin: 32px 0;
+ padding: 32px 0;
`
type Props = {
pageHeaderComponent: React.Node, |
b1689a2b20e389e7732eabb539afe5cf00ccc487 | client/src/components/UserList.jsx | client/src/components/UserList.jsx | import React from 'react';
import { Link } from 'react-router-dom';
const UserList = (props) => {
if (props.clicked) {
return (
<div>
<div>Continue as: </div>
{props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks}><Link to="/inventory">{user}</Link></div>))}
<div>or <Link to="/users">go back</Link> and select a different user.</div>
</div>
);
} else {
return (
<div>
<div>or <Link to="/users">go back</Link> and select a different user.</div>
</div>
);
}
};
export default UserList;
| import React from 'react';
import { Link } from 'react-router-dom';
const UserList = (props) => {
if (props.clicked) {
return (
<div>
<div>Continue as: </div>
{props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks.bind(this)}><Link to="/inventory">{user}</Link></div>))}
<div>or <Link to="/users">go back</Link> and select a different user.</div>
</div>
);
} else {
return (
<div>
<div>or <Link to="/users">go back</Link> and select a different user.</div>
</div>
);
}
};
export default UserList;
| Add this binding to onClick function passInCooks | Add this binding to onClick function passInCooks
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -6,7 +6,7 @@
return (
<div>
<div>Continue as: </div>
- {props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks}><Link to="/inventory">{user}</Link></div>))}
+ {props.addUser.map((user)=>(<div key={user} onClick={props.passInCooks.bind(this)}><Link to="/inventory">{user}</Link></div>))}
<div>or <Link to="/users">go back</Link> and select a different user.</div>
</div>
); |
d2e63a40d26ede4bfa3f1b51e6d66f0160e106e9 | src/app/components/selectable-box/SelectableBoxController.jsx | src/app/components/selectable-box/SelectableBoxController.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import SelectableBoxItem from './SelectableBoxItem';
const propTypes = {
heading: PropTypes.string.isRequired,
items: PropTypes.array,
activeItem: PropTypes.object,
handleItemClick: PropTypes.func,
isUpdating: PropTypes.bool
}
export default class SelectableBoxController extends Component {
constructor(props) {
super(props);
this.bindItemClick = this.bindItemClick.bind(this);
}
componentDidMount() {
debugger;
}
bindItemClick(itemProps) {
this.props.handleItemClick(itemProps);
}
renderList() {
return (
<ul className="selectable-box__list">
{
this.props.items.map((item, index) => {
return (
<SelectableBoxItem
key={index}
{...item}
isSelected={this.props.activeItem && item.id === this.props.activeItem.id}
handleClick={this.bindItemClick}
/>
)
})
}
</ul>
)
}
render() {
return (
<div className="selectable-box">
<h2 className="selectable-box__heading">
Name
{ this.props.isUpdating && <span className="selectable-box__status loader"/> }
</h2>
{ this.renderList() }
</div>
)
}
}
SelectableBoxController.propTypes = propTypes; | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import SelectableBoxItem from './SelectableBoxItem';
const propTypes = {
heading: PropTypes.string.isRequired,
items: PropTypes.array,
activeItem: PropTypes.object,
handleItemClick: PropTypes.func,
isUpdating: PropTypes.bool
}
export default class SelectableBoxController extends Component {
constructor(props) {
super(props);
this.bindItemClick = this.bindItemClick.bind(this);
}
bindItemClick(itemProps) {
this.props.handleItemClick(itemProps);
}
renderList() {
return (
<ul className="selectable-box__list">
{
this.props.items.map((item, index) => {
return (
<SelectableBoxItem
key={index}
{...item}
isSelected={this.props.activeItem && item.id === this.props.activeItem.id}
handleClick={this.bindItemClick}
/>
)
})
}
</ul>
)
}
render() {
return (
<div className="selectable-box">
<h2 className="selectable-box__heading">
Name
{ this.props.isUpdating && <span className="selectable-box__status loader"/> }
</h2>
{ this.renderList() }
</div>
)
}
}
SelectableBoxController.propTypes = propTypes; | Remove debugger on mount of selectabl box controller | Remove debugger on mount of selectabl box controller
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -16,10 +16,6 @@
super(props);
this.bindItemClick = this.bindItemClick.bind(this);
- }
-
- componentDidMount() {
- debugger;
}
bindItemClick(itemProps) { |
30efb3f8ad16d41591c722f428ccf8e9c109473a | react-component-template/index.jsx | react-component-template/index.jsx | import React, {PropTypes, Component} from 'react'
const namespace = '{{camelName}}'
export default class {{PascalName}} extends Component {
render () {
return (<div className={namespace}>
<h1 className={`${namespace}-title`}>{this.props.name} component</h1>
<img src={`//${this.props.name}.jpg.to`} />
</div>)
}
}
{{PascalName}}.propTypes = {
name: PropTypes.string.isRequired
}
| import React, {PropTypes, Component} from 'react'
import {addons} from 'react/addons'
const {shouldComponentUpdate} = addons.PureRenderMixin
const namespace = '{{camelName}}'
export default class {{PascalName}} extends Component {
// use the pure-render mixin without the mixin. This allows us to use es6
// classes and avoid "magic" code
shouldComponentUpdate (...args) {
return shouldComponentUpdate.apply(this, args)
}
render () {
return (<div className={namespace}>
<h1 className={`${namespace}-title`}>{this.props.name} component</h1>
<img src={`//${this.props.name}.jpg.to`} />
</div>)
}
}
{{PascalName}}.propTypes = {
name: PropTypes.string.isRequired
}
| Add pureRender to react template | Add pureRender to react template | JSX | mit | Techwraith/ribcage-gen,Techwraith/ribcage-gen,cstumph/ribcage-gen,tedbreen/ribcage-gen,cstumph/ribcage-gen | ---
+++
@@ -1,7 +1,15 @@
import React, {PropTypes, Component} from 'react'
+import {addons} from 'react/addons'
+const {shouldComponentUpdate} = addons.PureRenderMixin
const namespace = '{{camelName}}'
export default class {{PascalName}} extends Component {
+ // use the pure-render mixin without the mixin. This allows us to use es6
+ // classes and avoid "magic" code
+ shouldComponentUpdate (...args) {
+ return shouldComponentUpdate.apply(this, args)
+ }
+
render () {
return (<div className={namespace}>
<h1 className={`${namespace}-title`}>{this.props.name} component</h1> |
598dd90c5b4f9bcd927c4c535d6f23ed66717f60 | app/scripts/components/Editor/FontSize.jsx | app/scripts/components/Editor/FontSize.jsx | import React from 'react'
export default class FontSize extends React.Component {
render() {
<div className="font-size">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 800 600" enable-background="new 0 0 800 600">
<g>
<rect x="316" y="240" width="24" height="96" fill="white"/>
</g>
<g>
<rect x="280" y="234" width="96" height="24" fill="white"/>
</g>
<g>
<g>
<rect x="430" y="162" width="24" height="174" fill="white"/>
</g>
<g>
<rect x="358" y="156" width="168" height="24" fill="white"/>
</g>
</g>
</svg>
</div>
}
}
| import React from 'react'
export default class FontSize extends React.Component {
render() {
return (
<div className="font-size">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 800 600" enable-background="new 0 0 800 600">
<g>
<rect x="316" y="240" width="24" height="96" fill="white"/>
</g>
<g>
<rect x="280" y="234" width="96" height="24" fill="white"/>
</g>
<g>
<g>
<rect x="430" y="162" width="24" height="174" fill="white"/>
</g>
<g>
<rect x="358" y="156" width="168" height="24" fill="white"/>
</g>
</g>
</svg>
</div>
)
}
}
| Fix React component render method. | Fix React component render method.
| JSX | agpl-3.0 | nossas/bonde-client,nossas/bonde-client,nossas/bonde-client | ---
+++
@@ -2,24 +2,26 @@
export default class FontSize extends React.Component {
render() {
- <div className="font-size">
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 800 600" enable-background="new 0 0 800 600">
- <g>
- <rect x="316" y="240" width="24" height="96" fill="white"/>
- </g>
- <g>
- <rect x="280" y="234" width="96" height="24" fill="white"/>
- </g>
- <g>
+ return (
+ <div className="font-size">
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 800 600" enable-background="new 0 0 800 600">
<g>
- <rect x="430" y="162" width="24" height="174" fill="white"/>
+ <rect x="316" y="240" width="24" height="96" fill="white"/>
</g>
<g>
- <rect x="358" y="156" width="168" height="24" fill="white"/>
+ <rect x="280" y="234" width="96" height="24" fill="white"/>
</g>
- </g>
- </svg>
- </div>
+ <g>
+ <g>
+ <rect x="430" y="162" width="24" height="174" fill="white"/>
+ </g>
+ <g>
+ <rect x="358" y="156" width="168" height="24" fill="white"/>
+ </g>
+ </g>
+ </svg>
+ </div>
+ )
}
} |
9b0789bf58473fe0f8dbd0dc9d54f4ba44ff8894 | client/material/icon-button.jsx | client/material/icon-button.jsx | import React from 'react'
import classnames from 'classnames'
import Button from './button.jsx'
import styles from './button.css'
// A button that displays just an SVG icon
export default class IconButton extends React.Component {
static propTypes = {
icon: React.PropTypes.element.isRequired,
};
render() {
const { className, icon } = this.props
const classes = classnames(styles.iconButton, className)
return (
<Button {...this.props} className={classes} label={icon} />
)
}
}
| import React from 'react'
import classnames from 'classnames'
import Button from './button.jsx'
import styles from './button.css'
// A button that displays just an SVG icon
export default class IconButton extends React.Component {
static propTypes = {
icon: React.PropTypes.element.isRequired,
};
render() {
const { className, icon, ...otherProps } = this.props
const classes = classnames(styles.iconButton, className)
return (
<Button {...otherProps} className={classes} label={icon} />
)
}
}
| Fix props being passed to Button's dom element by IconButton. | Fix props being passed to Button's dom element by IconButton.
| JSX | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery | ---
+++
@@ -10,10 +10,10 @@
};
render() {
- const { className, icon } = this.props
+ const { className, icon, ...otherProps } = this.props
const classes = classnames(styles.iconButton, className)
return (
- <Button {...this.props} className={classes} label={icon} />
+ <Button {...otherProps} className={classes} label={icon} />
)
}
} |
f5207cc0ffa63364eb763aab9d60c3c6431a3904 | imports/ui/components/sidebar_menu/PanelProfile.jsx | imports/ui/components/sidebar_menu/PanelProfile.jsx | import React from 'react';
import PanelHeader from '../common/PanelHeader.jsx'
import Nestable from '../common/Nestable.jsx'
import PanelListItem from '../common/PanelListItem.jsx'
import ModulesCardContainer from './ModulesCardContainer.js'
import ProfileDetailsContainer from './ProfileDetailsContainer.jsx'
import InlineEdit from 'react-edit-inline';
import * as constants from '../common/Constants.js';
export default class PanelProfile extends React.Component {
constructor(){
super();
}
datachanged(data){
console.log(data);
}
render() {
return (
<nav className="side-menu-addl">
<PanelHeader title="User Profile" icon="font-icon font-icon-user" />
<ul className="side-menu-addl-list">
<PanelListItem type="header" text="Tan Seat Chu" isEditable={false}/>
<PanelListItem type="" text={ Meteor.user().username } isEditable={false}/>
<ModulesCardContainer studentID="" listType="Exempted"/>
<ModulesCardContainer studentID="" listType="Waived" />
<PanelListItem type="header" text="Previous Education" isEditable={false}/>
<ProfileDetailsContainer studentInfoType="PrevEdu"/>
<PanelListItem type="header" text="Academic Cohort" isEditable={false}/>
<ProfileDetailsContainer studentInfoType="AcadCohort"/>
<PanelListItem type="header" text="Change Password" isEditable={false}/>
</ul>
</nav>
);
}
}
| import React from 'react';
import PanelHeader from '../common/PanelHeader.jsx'
import Nestable from '../common/Nestable.jsx'
import PanelListItem from '../common/PanelListItem.jsx'
import ModulesCardContainer from './ModulesCardContainer.js'
import ProfileDetailsContainer from './ProfileDetailsContainer.jsx'
import InlineEdit from 'react-edit-inline';
import * as constants from '../common/Constants.js';
export default class PanelProfile extends React.Component {
constructor(){
super();
}
datachanged(data){
console.log(data);
}
render() {
return (
<nav className="side-menu-addl">
<PanelHeader title="User Profile" icon="font-icon font-icon-user" />
<ul className="side-menu-addl-list">
<PanelListItem type="header" text="E-mail" isEditable={false}/>
<PanelListItem type="" text={ Meteor.user().username ? Meteor.user().username : "" } isEditable={false}/>
<ModulesCardContainer studentID="" listType="Exempted"/>
<ModulesCardContainer studentID="" listType="Waived" />
<PanelListItem type="header" text="Previous Education" isEditable={false}/>
<ProfileDetailsContainer studentInfoType="PrevEdu"/>
<PanelListItem type="header" text="Academic Cohort" isEditable={false}/>
<ProfileDetailsContainer studentInfoType="AcadCohort"/>
<PanelListItem type="header" text="Change Password" isEditable={false}/>
</ul>
</nav>
);
}
}
| FIX check if user is logged in before displaying email address | FIX check if user is logged in before displaying email address
| JSX | mit | nus-mtp/nus-oracle,nus-mtp/nus-oracle | ---
+++
@@ -21,8 +21,8 @@
<nav className="side-menu-addl">
<PanelHeader title="User Profile" icon="font-icon font-icon-user" />
<ul className="side-menu-addl-list">
- <PanelListItem type="header" text="Tan Seat Chu" isEditable={false}/>
- <PanelListItem type="" text={ Meteor.user().username } isEditable={false}/>
+ <PanelListItem type="header" text="E-mail" isEditable={false}/>
+ <PanelListItem type="" text={ Meteor.user().username ? Meteor.user().username : "" } isEditable={false}/>
<ModulesCardContainer studentID="" listType="Exempted"/>
<ModulesCardContainer studentID="" listType="Waived" />
<PanelListItem type="header" text="Previous Education" isEditable={false}/> |
7248a75f480bb43ebaa8083f730af00cfa915003 | src/components/Nav.jsx | src/components/Nav.jsx | import React from 'react'
import classNames from 'classnames'
import { connect } from 'react-redux'
import { onClickMenuButton } from '../actions/NavActions'
export const Nav = ({ dispatch, isExpanded, menuItems }) => {
return (
<nav className="layout-nav">
<ul className={ classNames(
'menu-list',
{ 'expanded': isExpanded }
) }>
{
menuItems.map((item, key) => {
return (
<li className="menu-item" key={ key }>
<a href={ item.href }>
<i className={ item.iconClass }></i> { item.title }
</a>
</li>
)
})
}
</ul>
<button className="btn-toggle" onClick={ () => {
dispatch(onClickMenuButton(isExpanded))
} }>
<i className="fa fa-fw fa-bars"></i> Menu
</button>
</nav>
)
}
export default connect(
(state) => ({
...state.nav
})
)(Nav) | import React from 'react'
import classNames from 'classnames'
import { connect } from 'react-redux'
import { onClickMenuButton } from '../actions/NavActions'
export const Nav = ({ dispatch, isExpanded, menuItems }) => {
return (
<nav className="layout-nav">
<ul className={ classNames(
'menu-list',
{ 'expanded': isExpanded }
) }>
{
menuItems.map((item, key) => {
return (
<li className="menu-item" key={ key }>
<a className={ classNames({ 'actived': (item.title === 'Home') }) } href={ item.href }>
<i className={ item.iconClass }></i> { item.title }
</a>
</li>
)
})
}
</ul>
<button className="btn-toggle" onClick={ () => {
dispatch(onClickMenuButton(isExpanded))
} }>
<i className="fa fa-fw fa-bars"></i> Menu
</button>
</nav>
)
}
export default connect(
(state) => ({
...state.nav
})
)(Nav) | Set default `actived` to `Home` item | Set default `actived` to `Home` item
| JSX | mit | nomkhonwaan/nomkhonwaan.github.io | ---
+++
@@ -15,7 +15,7 @@
menuItems.map((item, key) => {
return (
<li className="menu-item" key={ key }>
- <a href={ item.href }>
+ <a className={ classNames({ 'actived': (item.title === 'Home') }) } href={ item.href }>
<i className={ item.iconClass }></i> { item.title }
</a>
</li> |
03addfe7913127ea80c1ef314a67c1df2f24926e | client/src/containers/App.jsx | client/src/containers/App.jsx | import React, { PureComponent } from 'react';
import { IndexLink } from 'react-router';
import { LinkContainer } from 'react-router-bootstrap';
import Nav from 'react-bootstrap/lib/Nav';
import Navbar from 'react-bootstrap/lib/Navbar';
import NavItem from 'react-bootstrap/lib/NavItem';
import { Socket } from 'phoenix';
export default class App extends PureComponent {
componentDidMount() {
const socket = new Socket('/socket', {
params: { token: window.userToken || null }
});
socket.connect();
const channel = socket.channel('worker:lobby', {});
channel.join()
.receive('error', () => {
console.log('Connection error');
});
}
render() {
const styles = require('./App.scss');
return (
<div className={styles.app}>
<Navbar fixedTop>
<Navbar.Header>
<Navbar.Brand>
<IndexLink to="/" activeStyle={{ color: '#33e0ff' }}>
<div className={styles.brand}/>
<span>Microcrawler</span>
</IndexLink>
</Navbar.Brand>
<Navbar.Toggle/>
</Navbar.Header>
<Navbar.Collapse>
<Nav navbar>
<LinkContainer to="/">
<NavItem>Home</NavItem>
</LinkContainer>
</Nav>
</Navbar.Collapse>
</Navbar>
</div>
);
}
}
| import React, { PureComponent } from 'react';
import { IndexLink } from 'react-router';
import { LinkContainer } from 'react-router-bootstrap';
import Nav from 'react-bootstrap/lib/Nav';
import Navbar from 'react-bootstrap/lib/Navbar';
import NavItem from 'react-bootstrap/lib/NavItem';
import { Socket } from 'phoenix';
export default class App extends PureComponent {
componentDidMount() {
const socket = new Socket('/socket', {
params: { token: window.userToken || null },
logger: (kind, msg, data) => {
console.log(`${kind}: ${msg}`, data);
}
});
socket.connect();
const channel = socket.channel('worker:lobby', {});
channel.join()
.receive('error', () => {
console.log('Connection error');
});
}
render() {
const styles = require('./App.scss');
return (
<div className={styles.app}>
<Navbar fixedTop>
<Navbar.Header>
<Navbar.Brand>
<IndexLink to="/" activeStyle={{ color: '#33e0ff' }}>
<div className={styles.brand}/>
<span>Microcrawler</span>
</IndexLink>
</Navbar.Brand>
<Navbar.Toggle/>
</Navbar.Header>
<Navbar.Collapse>
<Nav navbar>
<LinkContainer to="/">
<NavItem>Home</NavItem>
</LinkContainer>
</Nav>
</Navbar.Collapse>
</Navbar>
</div>
);
}
}
| Use logger for logging websocket communication | Use logger for logging websocket communication
| JSX | mit | korczis/microcrawler-webapp,ApolloCrawler/microcrawler-webapp,korczis/microcrawler-webapp,bossek/microcrawler-webapp,ApolloCrawler/microcrawler-webapp,bossek/microcrawler-webapp,korczis/microcrawler-webapp,ApolloCrawler/microcrawler-webapp,bossek/microcrawler-webapp | ---
+++
@@ -12,10 +12,12 @@
export default class App extends PureComponent {
componentDidMount() {
const socket = new Socket('/socket', {
- params: { token: window.userToken || null }
+ params: { token: window.userToken || null },
+ logger: (kind, msg, data) => {
+ console.log(`${kind}: ${msg}`, data);
+ }
});
socket.connect();
-
const channel = socket.channel('worker:lobby', {});
channel.join() |
2c9d5b837c3b15a1853f4edfb66d4fe7b1cffaa0 | src/app/views/preview/PreviewController.jsx | src/app/views/preview/PreviewController.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Iframe from '../../components/iframe/Iframe';
const propTypes = {};
export class PreviewController extends Component {
constructor(props) {
super(props);
this.state = {};
}
render () {
return (
<div className="preview">
<Iframe/>
</div>
)
}
}
PreviewController.propTypes = propTypes;
export default PreviewController; | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import collections from '../../utilities/api-clients/collections';
import notifications from '../../utilities/notifications';
import { updateSelectedPreviewPage, addPreviewCollection, removeSelectedPreviewPage } from '../../config/actions';
import Iframe from '../../components/iframe/Iframe';
const propTypes = {
selectedPageUri: PropTypes.string,
routeParams: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired
};
export class PreviewController extends Component {
constructor(props) {
super(props);
}
componentWillMount() {
this.fetchCollectionAndPages(this.props.routeParams.collectionID)
// check if there is a previewable page in the route and update selected preview page state in redux
const previewPageURL = new URL(window.location.href).searchParams.get("url")
if (previewPageURL) {
this.props.dispatch(updateSelectedPreviewPage(previewPageURL));
}
}
componentWillUnmount() {
this.props.dispatch(removeSelectedPreviewPage());
}
fetchCollectionAndPages(collectionID) {
collections.get(collectionID).then(collection => {
const pages = [...collection.inProgress, ...collection.complete, ...collection.reviewed];
const collectionPreview = {collectionID, name: collection.name, pages};
this.props.dispatch(addPreviewCollection(collectionPreview));
}).catch(error => {
const notification = {
type: "warning",
message: "There was an error getting data about the selected collection. Please try refreshing the page",
isDismissable: true
};
notifications.add(notification);
console.error(`Error fetching ${collectionID}:\n`, error);
});
}
render () {
return (
<div className="preview">
<Iframe path={this.props.selectedPageUri || "/"}/>
</div>
)
}
}
PreviewController.propTypes = propTypes;
export function mapStateToProps(state) {
return {
selectedPageUri: state.state.preview.selectedPage
}
}
export default connect(mapStateToProps)(PreviewController); | Update to fetch colelction data, and handle page changes | Update to fetch colelction data, and handle page changes
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -1,21 +1,58 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
+
+import collections from '../../utilities/api-clients/collections';
+import notifications from '../../utilities/notifications';
+import { updateSelectedPreviewPage, addPreviewCollection, removeSelectedPreviewPage } from '../../config/actions';
import Iframe from '../../components/iframe/Iframe';
-const propTypes = {};
+const propTypes = {
+ selectedPageUri: PropTypes.string,
+ routeParams: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired
+};
export class PreviewController extends Component {
constructor(props) {
super(props);
-
- this.state = {};
}
+ componentWillMount() {
+ this.fetchCollectionAndPages(this.props.routeParams.collectionID)
+
+ // check if there is a previewable page in the route and update selected preview page state in redux
+ const previewPageURL = new URL(window.location.href).searchParams.get("url")
+ if (previewPageURL) {
+ this.props.dispatch(updateSelectedPreviewPage(previewPageURL));
+ }
+ }
+
+ componentWillUnmount() {
+ this.props.dispatch(removeSelectedPreviewPage());
+ }
+
+ fetchCollectionAndPages(collectionID) {
+ collections.get(collectionID).then(collection => {
+ const pages = [...collection.inProgress, ...collection.complete, ...collection.reviewed];
+ const collectionPreview = {collectionID, name: collection.name, pages};
+ this.props.dispatch(addPreviewCollection(collectionPreview));
+ }).catch(error => {
+ const notification = {
+ type: "warning",
+ message: "There was an error getting data about the selected collection. Please try refreshing the page",
+ isDismissable: true
+ };
+ notifications.add(notification);
+ console.error(`Error fetching ${collectionID}:\n`, error);
+ });
+ }
+
render () {
return (
<div className="preview">
- <Iframe/>
+ <Iframe path={this.props.selectedPageUri || "/"}/>
</div>
)
}
@@ -23,4 +60,10 @@
PreviewController.propTypes = propTypes;
-export default PreviewController;
+export function mapStateToProps(state) {
+ return {
+ selectedPageUri: state.state.preview.selectedPage
+ }
+}
+
+export default connect(mapStateToProps)(PreviewController); |
5faea22fa10996b541a785693aacd77394c33ed9 | src/app/login/LoginForm.jsx | src/app/login/LoginForm.jsx | import React, { Component } from 'react';
import Input from '../components/Input'
export default class LoginForm extends Component {
constructor(props) {
super(props);
}
render() {
const inputs = this.props.formData.inputs;
return (
<div className="grid grid--justify-center">
<div className="grid__col-4">
<h1>Login</h1>
<form className="form" onSubmit={this.props.formData.onSubmit}>
{
inputs.map((input, index) => {
let error = this.props.formData.error.inputID === input.id ? this.props.formData.error.message : false;
return <Input key={index} {...input} error={error} />
})
}
<button type="submit" className="btn btn--primary margin-top--1">Log in</button>
</form>
</div>
</div>
)
}
}
| import React, { Component } from 'react';
import Input from '../components/Input'
export default class LoginForm extends Component {
constructor(props) {
super(props);
}
render() {
const inputs = this.props.formData.inputs;
return (
<div className="grid grid--justify-center">
<div className="grid__col-3">
<h1>Login</h1>
<form className="form" onSubmit={this.props.formData.onSubmit}>
{
inputs.map((input, index) => {
let error = this.props.formData.error.inputID === input.id ? this.props.formData.error.message : false;
return <Input key={index} {...input} error={error} />
})
}
<button type="submit" className="btn btn--primary margin-top--1">Log in</button>
</form>
</div>
</div>
)
}
}
| Reduce width of login form | Reduce width of login form
Former-commit-id: a785c93477d60bcd484b689789e532f8b3a6f271
Former-commit-id: 5a1649b0c7a587d5fed9738bafc0433e2218df89
Former-commit-id: dbcaa743a85a4e2f6208e6295ed5d01a0677807e | JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -14,7 +14,7 @@
return (
<div className="grid grid--justify-center">
- <div className="grid__col-4">
+ <div className="grid__col-3">
<h1>Login</h1>
<form className="form" onSubmit={this.props.formData.onSubmit}> |
a667feff14a5177fea3c2daeb3e301520eddcbc3 | frontend/components/dashboard/Notification.jsx | frontend/components/dashboard/Notification.jsx | import React from 'react'
import PropTypes from 'prop-types'
import Card from './Card'
class Notification extends React.Component {
state = { dismissed: this.props.dismissed }
componentDidUpdate(prevProps) {
if (prevProps.dismissed !== this.props.dismissed) {
this.setState({ dismissed: this.props.dismissed })
}
}
render() {
return (
<Card className={`notification ${this.props.level} ${this.state.dismissed ? "dismissed" : ''}`}>
<div className="d-flex justify-content-between align-items-start">
<div className="mr-4">
{ this.props.children }
</div>
{
this.props.dismissable &&
<button type="button" className="close" onClick={() => { this.setState({ dismissed: true })}} aria-label="Close">
<span aria-hidden="true">×</span>
</button>
}
</div>
</Card>
);
}
}
Notification.propTypes = {
dismissed: PropTypes.bool,
dismissable: PropTypes.bool,
level: PropTypes.oneOf(['success', 'warning', 'error'])
}
Notification.defaultProps = {
dismissed: false,
dismissable: true,
level: 'success'
}
export default Notification
| import React from 'react'
import PropTypes from 'prop-types'
import Card from './Card'
class Notification extends React.Component {
state = { dismissed: this.props.dismissed }
componentDidUpdate(prevProps) {
if (prevProps.dismissed !== this.props.dismissed) {
this.setState({ dismissed: this.props.dismissed })
}
}
render() {
return (
<Card className={`notification ${this.props.level} ${this.state.dismissed ? "dismissed" : ''}`}>
<div className="d-flex justify-content-between align-items-start">
<div className="mr-4">
{ this.props.children }
</div>
{
this.props.dismissable &&
<button type="button" class="btn-close" onClick={() => { this.setState({ dismissed: true })}} aria-label="Close"></button>
}
</div>
</Card>
);
}
}
Notification.propTypes = {
dismissed: PropTypes.bool,
dismissable: PropTypes.bool,
level: PropTypes.oneOf(['success', 'warning', 'error'])
}
Notification.defaultProps = {
dismissed: false,
dismissable: true,
level: 'success'
}
export default Notification
| Fix close button for dismissable notifications | Fix close button for dismissable notifications
| JSX | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -20,9 +20,7 @@
</div>
{
this.props.dismissable &&
- <button type="button" className="close" onClick={() => { this.setState({ dismissed: true })}} aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
+ <button type="button" class="btn-close" onClick={() => { this.setState({ dismissed: true })}} aria-label="Close"></button>
}
</div>
</Card> |
a9e128d4a60ffc4641f4436a4d5f98a77a191683 | src/components/note_edit/section_add_bar.jsx | src/components/note_edit/section_add_bar.jsx | "use strict";
var React = require('react')
module.exports = React.createClass({
displayName: 'NoteSectionAddBar',
render: function () {
var handles = require('./section_handles.jsx')
return (
<div id="section-add-bar-container">
<div id="citation-edit-bar" style={{ overflow: "auto" }}>
<h4>
Add section
{' '}
<a title="Drag new sections to the area below in order to add to this note."
data-toggle="tooltip"
href="">
<i className="fa fa-question-circle" />
</a>
</h4>
<handles.CitationHandle />
<handles.TextHandle />
<handles.NoteReferenceHandle />
</div>
</div>
)
}
});
| "use strict";
var React = require('react')
module.exports = React.createClass({
displayName: 'NoteSectionAddBar',
getInitialState: function () {
return { sticky: false }
},
componentDidMount: function () {
window.addEventListener('scroll', this.handleScroll);
this.handleScroll();
},
componentDidUnmount: function () {
window.removeEventListener('scroll', this.handleScroll);
},
handleScroll: function () {
var el = React.findDOMNode(this)
, offsetTop = el.getBoundingClientRect().top
if (offsetTop < 0) {
this.setState({ sticky: true });
} else {
this.setState({ sticky: false });
}
},
render: function () {
var handles = require('./section_handles.jsx')
return (
<div id="section-add-bar-container">
<div id="citation-edit-bar"
className={this.state.sticky ? 'sticky' : ''}
style={{ overflow: "auto" }} >
<h4>
Add section
{' '}
<a title="Drag new sections to the area below in order to add to this note."
data-toggle="tooltip"
href="">
<i className="fa fa-question-circle" />
</a>
</h4>
<handles.CitationHandle />
<handles.TextHandle />
<handles.NoteReferenceHandle />
</div>
</div>
)
}
});
| Make section add bar sticky | Make section add bar sticky
| JSX | agpl-3.0 | editorsnotes/editorsnotes-renderer | ---
+++
@@ -4,12 +4,35 @@
module.exports = React.createClass({
displayName: 'NoteSectionAddBar',
+ getInitialState: function () {
+ return { sticky: false }
+ },
+ componentDidMount: function () {
+ window.addEventListener('scroll', this.handleScroll);
+ this.handleScroll();
+ },
+ componentDidUnmount: function () {
+ window.removeEventListener('scroll', this.handleScroll);
+ },
+ handleScroll: function () {
+ var el = React.findDOMNode(this)
+ , offsetTop = el.getBoundingClientRect().top
+
+ if (offsetTop < 0) {
+ this.setState({ sticky: true });
+ } else {
+ this.setState({ sticky: false });
+ }
+
+ },
render: function () {
var handles = require('./section_handles.jsx')
return (
<div id="section-add-bar-container">
- <div id="citation-edit-bar" style={{ overflow: "auto" }}>
+ <div id="citation-edit-bar"
+ className={this.state.sticky ? 'sticky' : ''}
+ style={{ overflow: "auto" }} >
<h4>
Add section
{' '} |
e2f94aaad5cdc2257893d341edea9e2d118965e9 | client/src/views/HomeView/index.jsx | client/src/views/HomeView/index.jsx | import React, { Component } from 'react';
export default class Home extends Component {
render() {
return (
<div>
<h1>home view</h1>
</div>
);
}
}
| import React, { Component } from 'react';
import CustomizationWidget from '../../components/CustomizationWidget';
export default class HomeView extends Component {
render() {
return (
<div>
<h1>home view</h1>
<CustomizationWidget />
</div>
);
}
}
| Use CustomizationWidget inside of HomeView | Use CustomizationWidget inside of HomeView
| JSX | mit | marlonbernardes/coding-stickers,marlonbernardes/coding-stickers | ---
+++
@@ -1,11 +1,13 @@
import React, { Component } from 'react';
+import CustomizationWidget from '../../components/CustomizationWidget';
-export default class Home extends Component {
+export default class HomeView extends Component {
render() {
return (
<div>
<h1>home view</h1>
+ <CustomizationWidget />
</div>
);
} |
b6d4384a3f3d49079c0c372fcccd67366111f75f | src/components/Experience.jsx | src/components/Experience.jsx | import classNames from 'classnames';
import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';
import Company from '../Company';
import bulma from '../bulma.scss';
function formatDate(date) {
return moment(date).format('MMM YYYY');
}
export default class Experience extends React.Component {
static propTypes = {
exp: PropTypes.shape({
startDate: PropTypes.instanceOf(Date).isRequired,
endDate: PropTypes.instanceOf(Date),
wasInHouse: PropTypes.bool.isRequired,
job: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
company: PropTypes.instanceOf(Company).isRequired,
description: PropTypes.string.isRequired,
})
}
render() {
const { exp } = this.props;
console.log(exp);
const startDate = formatDate(exp.startDate);
const endDate = exp.endDate ? formatDate(exp.endDate) : 'Present';
const connector = exp.wasInHouse ? 'at' : 'for';
return (
<div className={bulma.columns}>
<p className={bulma.column}>{startDate}–{endDate}</p>
<div className={classNames(bulma.column, bulma['is-two-thirds'])}>
<p>{exp.job} {connector} <a href={exp.company.url}>{exp.company.name}</a>.</p>
<p className={bulma.subtitle}>{exp.description}</p>
</div>
</div>
);
}
}
| import classNames from 'classnames';
import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';
import Company from '../Company';
import bulma from '../bulma.scss';
function formatDate(date) {
return moment(date).format('MMM YYYY');
}
export default class Experience extends React.Component {
static propTypes = {
exp: PropTypes.shape({
startDate: PropTypes.instanceOf(Date).isRequired,
endDate: PropTypes.instanceOf(Date),
wasInHouse: PropTypes.bool.isRequired,
job: PropTypes.string.isRequired,
company: PropTypes.instanceOf(Company).isRequired,
description: PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
]).isRequired,
})
}
render() {
const { exp } = this.props;
const startDate = formatDate(exp.startDate);
const endDate = exp.endDate ? formatDate(exp.endDate) : 'Present';
const connector = exp.wasInHouse ? 'at' : 'for';
return (
<div className={bulma.columns}>
<p className={bulma.column}>{startDate}–{endDate}</p>
<div className={classNames(bulma.column, bulma['is-two-thirds'])}>
<p>{exp.job} {connector} <a href={exp.company.url}>{exp.company.name}</a>.</p>
<p className={bulma.subtitle}>{exp.description}</p>
</div>
</div>
);
}
}
| Fix up some PropType errors | Fix up some PropType errors
| JSX | mit | VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website | ---
+++
@@ -16,14 +16,15 @@
endDate: PropTypes.instanceOf(Date),
wasInHouse: PropTypes.bool.isRequired,
job: PropTypes.string.isRequired,
- url: PropTypes.string.isRequired,
company: PropTypes.instanceOf(Company).isRequired,
- description: PropTypes.string.isRequired,
+ description: PropTypes.oneOfType([
+ PropTypes.string,
+ PropTypes.element,
+ ]).isRequired,
})
}
render() {
const { exp } = this.props;
- console.log(exp);
const startDate = formatDate(exp.startDate);
const endDate = exp.endDate ? formatDate(exp.endDate) : 'Present';
const connector = exp.wasInHouse ? 'at' : 'for'; |
bb67ab59c21189431b2ca8685c7329bd6cc489ba | src/client/components/Logo/Logo.jsx | src/client/components/Logo/Logo.jsx | import React, { Component } from "react";
import classNames from 'classnames';
import Velocity from 'velocity-animate';
class Logo extends Component {
constructor(props) {
super(props);
this.displayName = 'Logo';
this.scrollUp = this.scrollUp.bind(this)
}
render() {
const { isFullsize, loadingMessage } = this.props;
const logoClasses = classNames("logo", {"logo-fullsize": isFullsize});
const statusClasses = classNames("status", {
"status-active": !!loadingMessage
})
return (
<div>
<div id="logo" ref="logo" onClick={this.scrollUp}>
<img src='./logo.png' className={logoClasses}/>
</div>
<div id="status" className={statusClasses}>
{this.createStatusText(loadingMessage)}
</div>
</div>
)
}
scrollUp() {
const {isFullsize, scrollPage} = this.props
if (!isFullsize) {
scrollPage({mainPage:true})
}
}
// triggerLogoDropdownAnimation(logo) {
// // TODO: logo animation on APP_INIT?
// console.log("triggerLogoDropdownAnimation()", logo)
// Velocity(logo, {opacity: 1, top: "+10px"}, {duration: 1000})
// }
createStatusText(text) {
if (text) {
return <span className="status-content">{text}</span>
}
}
}
export default Logo;
| import React, { Component } from "react";
import classNames from 'classnames';
import Velocity from 'velocity-animate';
class Logo extends Component {
constructor(props) {
super(props);
this.displayName = 'Logo';
this.scrollUp = this.scrollUp.bind(this)
}
render() {
const { isFullsize, statusMessage } = this.props;
const logoClasses = classNames("logo", {"logo-fullsize": isFullsize});
return (
<div
id="logo" ref="logo"
className={statusMessage ? "logo-rotating" : ""}
onClick={this.scrollUp}
>
<img src='./logo.png' className={logoClasses}/>
</div>
)
}
scrollUp() {
const {isFullsize, scrollPage} = this.props
if (!isFullsize) {
scrollPage({mainPage:true})
}
}
}
export default Logo;
| Remove status message from logo | Remove status message from logo
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -11,23 +11,17 @@
}
render() {
- const { isFullsize, loadingMessage } = this.props;
+ const { isFullsize, statusMessage } = this.props;
const logoClasses = classNames("logo", {"logo-fullsize": isFullsize});
- const statusClasses = classNames("status", {
- "status-active": !!loadingMessage
- })
- return (
-
- <div>
- <div id="logo" ref="logo" onClick={this.scrollUp}>
- <img src='./logo.png' className={logoClasses}/>
- </div>
- <div id="status" className={statusClasses}>
- {this.createStatusText(loadingMessage)}
- </div>
-
- </div>
+ return (
+ <div
+ id="logo" ref="logo"
+ className={statusMessage ? "logo-rotating" : ""}
+ onClick={this.scrollUp}
+ >
+ <img src='./logo.png' className={logoClasses}/>
+ </div>
)
}
@@ -37,20 +31,6 @@
scrollPage({mainPage:true})
}
}
-
- // triggerLogoDropdownAnimation(logo) {
- // // TODO: logo animation on APP_INIT?
- // console.log("triggerLogoDropdownAnimation()", logo)
- // Velocity(logo, {opacity: 1, top: "+10px"}, {duration: 1000})
-
- // }
-
- createStatusText(text) {
- if (text) {
- return <span className="status-content">{text}</span>
- }
-
- }
}
export default Logo; |
92634c70da31701e4af08dd149ba267af6162e84 | src/components/Text.jsx | src/components/Text.jsx | import React from "react";
import ReactCSS from "reactcss";
export default class Text extends ReactCSS.Component {
displayName = "Text";
static propTypes = {
children: React.PropTypes.node,
color: React.PropTypes.string,
fontSize: React.PropTypes.number
};
classes () {
return {
"default": {
span: {
fontSize: 12
}
},
"color": {
span: {
color: this.props.color
}
},
"fontSize": {
span: {
fontSize: this.props.fontSize
}
}
};
}
styles () {
return this.css({
"color": !!this.props.color,
"fontSize": !!this.props.fontSize
});
}
render () {
return (
<span style={this.styles().span}>
{this.props.children}
</span>
);
}
};
| import React from "react";
import ReactCSS from "reactcss";
export default class Text extends ReactCSS.Component {
displayName = "Text";
static propTypes = {
children: React.PropTypes.node,
color: React.PropTypes.string,
fontSize: React.PropTypes.number
};
classes () {
return {
"default": {
Text: {
fontSize: 12
}
},
"color": {
Text: {
color: this.props.color
}
},
"fontSize": {
Text: {
fontSize: this.props.fontSize
}
}
};
}
styles () {
return this.css({
"color": !!this.props.color,
"fontSize": !!this.props.fontSize
});
}
render () {
return (
<span style={this.styles().Text}>
{this.props.children}
</span>
);
}
};
| Rename style for text span | Rename style for text span
| JSX | mit | signal/sprinkles-ui,signal/sprinkles-ui | ---
+++
@@ -13,17 +13,17 @@
classes () {
return {
"default": {
- span: {
+ Text: {
fontSize: 12
}
},
"color": {
- span: {
+ Text: {
color: this.props.color
}
},
"fontSize": {
- span: {
+ Text: {
fontSize: this.props.fontSize
}
}
@@ -39,7 +39,7 @@
render () {
return (
- <span style={this.styles().span}>
+ <span style={this.styles().Text}>
{this.props.children}
</span>
); |
19afaad06ca29b2bd9aeb632a789711ab0e5c053 | src/SidebarMenuHeader.jsx | src/SidebarMenuHeader.jsx | import React from 'react';
const propTypes = {
title: React.PropTypes.string,
};
const SidebarMenuHeader = ({ title }) => (
<li className="header">
{title}
</li>
);
SidebarMenuHeader.propTypes = propTypes;
export default SidebarMenuHeader;
| import React from 'react';
import classNames from 'classnames';
const propTypes = {
children: React.PropTypes.node,
className: React.PropTypes.string,
};
const SidebarMenuHeader = ({
children,
className,
}) => {
const classes = {
header: true,
};
return (
<li className={classNames(className, classes)}>
{children}
</li>
);
};
SidebarMenuHeader.propTypes = propTypes;
export default SidebarMenuHeader;
| Remove title prop in favor of children | Remove title prop in favor of children
| JSX | mit | react-admin-lte/react-admin-lte,react-admin-lte/react-admin-lte,jonmpqts/reactjs-admin-lte | ---
+++
@@ -1,14 +1,25 @@
import React from 'react';
+import classNames from 'classnames';
const propTypes = {
- title: React.PropTypes.string,
+ children: React.PropTypes.node,
+ className: React.PropTypes.string,
};
-const SidebarMenuHeader = ({ title }) => (
- <li className="header">
- {title}
- </li>
-);
+const SidebarMenuHeader = ({
+ children,
+ className,
+}) => {
+ const classes = {
+ header: true,
+ };
+
+ return (
+ <li className={classNames(className, classes)}>
+ {children}
+ </li>
+ );
+};
SidebarMenuHeader.propTypes = propTypes;
|
d0f7537137a2360ba494c0c902b1f35fd636b9cd | src/client/components/Logo/Logo.jsx | src/client/components/Logo/Logo.jsx | import React, { Component } from "react";
import classNames from 'classnames';
import Velocity from 'velocity-animate';
class Logo extends Component {
constructor(props) {
super(props);
this.displayName = 'Logo';
}
componentDidMount() {
this.triggerLogoDropdownAnimation(this.refs.logoImg)
}
render() {
const { isFullsize, loadingText, expandHeader} = this.props;
const logoClasses = classNames("logo", {"logo-fullsize": isFullsize});
const text = !isFullsize ? <span>{loadingText}</span> : "" // create action for logo toggle, changes isFullsize, changes text
return (
<div id="logo" ref="logo" className="logo-fullsize">
<img ref="logoImg" src='./logo.png' className={logoClasses} onClick={expandHeader}/>
{text}
</div>
)
}
triggerLogoDropdownAnimation(logo) {
console.log("triggerLogoDropdownAnimation()", logo)
Velocity(logo, {opacity: 1, top: "+10px"}, {duration: 1000})
}
}
export default Logo;
| import React, { Component } from "react";
import classNames from 'classnames';
import Velocity from 'velocity-animate';
class Logo extends Component {
constructor(props) {
super(props);
this.displayName = 'Logo';
this.onHeaderExpand = this.onHeaderExpand.bind(this)
}
componentDidMount() {
this.triggerLogoDropdownAnimation(this.refs.logoImg)
}
render() {
const { isFullsize, loadingText } = this.props;
const logoClasses = classNames("logo", {"logo-fullsize": isFullsize});
const text = !isFullsize ? <span>{loadingText}</span> : "" // create action for logo toggle, changes isFullsize, changes text
return (
<div id="logo" ref="logo" className="logo-fullsize">
<img ref="logoImg" src='./logo.png' className={logoClasses} onClick={this.onHeaderExpand}/>
{text}
</div>
)
}
onHeaderExpand() {
const {isFullsize, expandHeader} = this.props
if (!isFullsize) {
expandHeader()
}
}
triggerLogoDropdownAnimation(logo) {
console.log("triggerLogoDropdownAnimation()", logo)
Velocity(logo, {opacity: 1, top: "+10px"}, {duration: 1000})
}
}
export default Logo;
| Fix logo click expanding when on main page | Fix logo click expanding when on main page
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -7,6 +7,7 @@
constructor(props) {
super(props);
this.displayName = 'Logo';
+ this.onHeaderExpand = this.onHeaderExpand.bind(this)
}
componentDidMount() {
@@ -14,17 +15,24 @@
}
render() {
- const { isFullsize, loadingText, expandHeader} = this.props;
+ const { isFullsize, loadingText } = this.props;
const logoClasses = classNames("logo", {"logo-fullsize": isFullsize});
const text = !isFullsize ? <span>{loadingText}</span> : "" // create action for logo toggle, changes isFullsize, changes text
return (
<div id="logo" ref="logo" className="logo-fullsize">
- <img ref="logoImg" src='./logo.png' className={logoClasses} onClick={expandHeader}/>
+ <img ref="logoImg" src='./logo.png' className={logoClasses} onClick={this.onHeaderExpand}/>
{text}
</div>
)
+ }
+
+ onHeaderExpand() {
+ const {isFullsize, expandHeader} = this.props
+ if (!isFullsize) {
+ expandHeader()
+ }
}
triggerLogoDropdownAnimation(logo) { |
5ddcc0e9557fe2e27867a4f642f5c1cd93487f19 | client/src/components/Event/EventDetails.jsx | client/src/components/Event/EventDetails.jsx | import React from 'react';
import ReactDOM from 'react-dom';
class EventDetails extends React.Component {
constructor(props) {
super(props);
this.state = {}
}
componentWillMount() {
}
render () {
return (
<div>
<h1> {this.props.eventTitle} </h1>
<h3> {this.props.eventDate} </h3>
<p> {this.props.eventDescription}</p>
{/* <h3> What to bring </h3>
<ul>
{
this.props.whatToBring.map(function(item, i){
return (<li key={i}> {item} </li>)
})
}
</ul> */}
</div>
)
}
}
export default EventDetails; | import React from 'react';
import ReactDOM from 'react-dom';
class EventDetails extends React.Component {
constructor(props) {
super(props);
this.state = {}
}
render () {
const days = {
0: 'Sunday',
1: 'Monday',
2: 'Tuesday',
3: 'Wednesday',
4: 'Thursday',
5: 'Friday',
6: 'Saturday',
};
const months = {
0: 'January',
1: 'February',
2: 'March',
3: 'April',
4: 'May',
5: 'June',
6: 'July',
7: 'August',
8: 'September',
9: 'October',
10: 'November',
11: 'December',
};
let eventDate = new Date(this.props.eventDate);
return (
<div>
<h1> {this.props.eventTitle} </h1>
<h3> {days[eventDate.getDay()]}, {months[eventDate.getMonth()]} {eventDate.getDate()}, {eventDate.getFullYear()} </h3>
<p> {this.props.eventDescription}</p>
{/* <h3> What to bring </h3>
<ul>
{
this.props.whatToBring.map(function(item, i){
return (<li key={i}> {item} </li>)
})
}
</ul> */}
</div>
)
}
}
export default EventDetails; | Refactor date in event label | Refactor date in event label
| JSX | mit | Teertoday/teer | ---
+++
@@ -7,15 +7,36 @@
this.state = {}
}
- componentWillMount() {
+ render () {
+ const days = {
+ 0: 'Sunday',
+ 1: 'Monday',
+ 2: 'Tuesday',
+ 3: 'Wednesday',
+ 4: 'Thursday',
+ 5: 'Friday',
+ 6: 'Saturday',
+ };
+ const months = {
+ 0: 'January',
+ 1: 'February',
+ 2: 'March',
+ 3: 'April',
+ 4: 'May',
+ 5: 'June',
+ 6: 'July',
+ 7: 'August',
+ 8: 'September',
+ 9: 'October',
+ 10: 'November',
+ 11: 'December',
+ };
+ let eventDate = new Date(this.props.eventDate);
- }
-
- render () {
return (
<div>
<h1> {this.props.eventTitle} </h1>
- <h3> {this.props.eventDate} </h3>
+ <h3> {days[eventDate.getDay()]}, {months[eventDate.getMonth()]} {eventDate.getDate()}, {eventDate.getFullYear()} </h3>
<p> {this.props.eventDescription}</p>
{/* <h3> What to bring </h3> |
16564ce7c114265ac88b9254529bb4411818dc83 | app/assets/javascripts/components/LayoutComponents/Sidebar.js.jsx | app/assets/javascripts/components/LayoutComponents/Sidebar.js.jsx | var Sidebar = React.createClass({
render: function(){
return (
<div id="m_menu" className="ui floating sidebar vertical menu inverted">
<a href="/issues/new" className="item m_item">
<i className="plus icon"></i>
Submit an Issue
</a>
<a href="/dashboard" className="item m_item">
<i className="home icon"></i>
Dashboard
</a>
<a href="/discover" className="item m_item">
<i className="search icon"></i>
Discover
</a>
<a href="/profile" className="item m_item">
<i className="user icon"></i>
My Profile
</a>
<a href="/team" className="item m_item">
<i className="ellipsis vertical icon"></i>
About Us
</a>
<a href="/users/sign_out" className="item m_item">
<i className="sign out icon"></i>
Logout
</a>
</div>
)
}
})
| var Sidebar = React.createClass({
render: function(){
return (
<div id="m_menu" className="ui floating sidebar vertical menu inverted">
<a href="/issues/new" className="item m_item">
<i className="plus icon"></i>
Submit an Issue
</a>
<a href="/dashboard" className="item m_item">
<i className="home icon"></i>
Dashboard
</a>
<a href="/discover" className="item m_item">
<i className="search icon"></i>
Discover
</a>
<a href="/profile" className="item m_item">
<i className="user icon"></i>
My Profile
</a>
<a href="/team" className="item m_item">
<i className="ellipsis vertical icon"></i>
About Us
</a>
<a href="/users/sign_out" data-method="delete" className="item m_item">
<i className="sign out icon"></i>
Logout
</a>
</div>
)
}
})
| Fix bug on the sidebar logout bug | Fix bug on the sidebar logout bug
| JSX | mit | TimCannady/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter | ---
+++
@@ -28,7 +28,7 @@
About Us
</a>
- <a href="/users/sign_out" className="item m_item">
+ <a href="/users/sign_out" data-method="delete" className="item m_item">
<i className="sign out icon"></i>
Logout
</a> |
1305c813759af89087223961643dc987f33991aa | app/scripts/components/home/home.jsx | app/scripts/components/home/home.jsx | import React from 'react';
import { Link } from 'react-router-dom';
import Countdown from './countdown.jsx';
import State from './state.jsx';
import Quote from './quote.jsx';
export default function Home() {
return (
<>
<div className="wrapper text">
<h2 className="home-title color-primary">Welcome</h2>
This site was developed a while back using React, for the purpose of learning and testing new features and acquiring basic
knowledge about Webpack, Babel, Node and other web development technologies. More information about me can be found under
the <Link to="/about">about</Link> tab, or feel free to follow the social links at the bottom of the page.
<br />
<br />
<a href="https://github.com/benct/tomlin-web/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer">
Version 2.7.4
</a>
</div>
<hr />
<State />
<hr />
<Countdown day={3} month={8} year={2019} hour={13} title="Countdown to something..." />
<hr />
<Quote />
</>
);
}
| import React from 'react';
import { Link } from 'react-router-dom';
import Countdown from './countdown.jsx';
import State from './state.jsx';
import Quote from './quote.jsx';
export default function Home() {
return (
<>
<div className="wrapper text">
<h2 className="home-title color-primary mbm">Welcome</h2>
This site was developed a while back using React, for the purpose of learning and testing new features and acquiring basic
knowledge about Webpack, Babel, Node and other web development technologies. More information about me can be found under
the <Link to="/about">about</Link> tab, or feel free to follow the social links at the bottom of the page.
<br />
<br />
<a href="https://github.com/benct/tomlin-web/blob/master/CHANGELOG.md" target="_blank" rel="noopener noreferrer">
Version 2.7.4
</a>
</div>
<hr />
<State />
<hr />
<Countdown day={3} month={8} year={2019} hour={13} title="Countdown to something..." />
<hr />
<Quote />
</>
);
}
| Add margin under welcome text | Add margin under welcome text
| JSX | mit | benct/tomlin-web,benct/tomlin-web | ---
+++
@@ -9,7 +9,7 @@
return (
<>
<div className="wrapper text">
- <h2 className="home-title color-primary">Welcome</h2>
+ <h2 className="home-title color-primary mbm">Welcome</h2>
This site was developed a while back using React, for the purpose of learning and testing new features and acquiring basic
knowledge about Webpack, Babel, Node and other web development technologies. More information about me can be found under
the <Link to="/about">about</Link> tab, or feel free to follow the social links at the bottom of the page. |
adba2cb7b7bbc8fa7341a01419f7fc808b272da6 | src/js/components/next-up/index.jsx | src/js/components/next-up/index.jsx | import debug from "debug";
import React, { Component } from "react";
import Session from "../session";
const log = debug("schedule:components:next-up");
export class NextUp extends Component {
render() {
const { getState } = this.props;
const { days, time: { today, now } } = getState();
let currentDay = Object.keys(days).filter(d => today <= new Date(d)).shift();
let tracks = Object.keys(days[currentDay].tracks).map(name => ({ name, sessions: days[currentDay].tracks[name] }));
let nextSessions = tracks.map(t => {
return {
...t,
next: t.sessions.filter(s => now <= s.start).shift()
};
});
return (
<div className="next-up">
{
nextSessions.map(t => {
return (
<div className="next-up__session">
<h2>Track: {t.name}</h2>
<Session session={t.next} />
</div>
);
})
}
</div>
);
}
}
export default NextUp;
| import debug from "debug";
import React, { Component } from "react";
import Session from "../session";
const log = debug("schedule:components:next-up");
export class NextUp extends Component {
render() {
const { getState } = this.props;
const { days, time: { today, now } } = getState();
let currentDay = Object.keys(days).filter(d => today <= new Date(d)).shift();
let tracks = Object.keys(days[currentDay].tracks).map(name => ({ name, sessions: days[currentDay].tracks[name] }));
let nextSessions = tracks.map(t => {
return {
...t,
sessions: [t.sessions.filter(s => now <= s.start).shift()]
};
}).
sort((a, b) => {
return Number(a.sessions[0].start) - Number(b.sessions[0].start);
});
return (
<div className="next-up">
{
nextSessions.map(t => {
return (
<div className="next-up__session">
<h2>Track: {t.name}</h2>
<Session session={t.next} />
</div>
);
})
}
</div>
);
}
}
export default NextUp;
| Fix sort upcoming on start time | Fix sort upcoming on start time
| JSX | mit | nikcorg/schedule,orangecms/schedule,orangecms/schedule,nikcorg/schedule,orangecms/schedule,nikcorg/schedule | ---
+++
@@ -15,8 +15,11 @@
let nextSessions = tracks.map(t => {
return {
...t,
- next: t.sessions.filter(s => now <= s.start).shift()
+ sessions: [t.sessions.filter(s => now <= s.start).shift()]
};
+ }).
+ sort((a, b) => {
+ return Number(a.sessions[0].start) - Number(b.sessions[0].start);
});
return ( |
a5ee1ea5d2fa3a6eb54a45b505adfc7ca25494f9 | src/pages/home.jsx | src/pages/home.jsx | import React from 'react';
import Header from '../components/header.jsx';
export default class Home extends React.Component {
constructor(props) {
super(props);
this.onClickButton = this.onClickButton.bind(this);
this.state = {
name: props.name,
counter: 0
};
}
onClickButton () {
this.setState({ counter: this.state.counter += 1 });
}
render () {
return (
<html>
<head>
<title>Example of isomorphic App in ES6.</title>
{
React.DOM.script({dangerouslySetInnerHTML: {
__html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';'
}})
}
</head>
<body>
<Header name={this.props.name} />
<main>
<button onClick={this.onClickButton}>Click ME!!!</button>
<span> {this.state.counter} Clicks</span>
<p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p>
</main>
<script src='./js/app.js'></script>
</body>
</html>
);
}
};
| import React from 'react';
import Header from '../components/header.jsx';
export default class Home extends React.Component {
constructor(props) {
super(props);
this.onClickButton = this.onClickButton.bind(this);
this.state = {
name: props.name,
counter: 0
};
}
onClickButton () {
this.setState({ counter: this.state.counter += 1 });
}
render () {
return (
<html>
<head>
<title>Example of isomorphic App in ES6.</title>
</head>
<body>
<Header name={this.props.name} />
<main>
<button onClick={this.onClickButton}>Click ME!!!</button>
<span> {this.state.counter} Clicks</span>
<p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p>
</main>
{
React.DOM.script({dangerouslySetInnerHTML: {
__html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';'
}})
}
<script src='./js/app.js'></script>
</body>
</html>
);
}
};
| Set state in HTML body instead of head | Set state in HTML body instead of head
| JSX | mit | Juan1ll0/es6-react-server-side-render,Juan1ll0/es6-react-server-side-render | ---
+++
@@ -22,11 +22,6 @@
<html>
<head>
<title>Example of isomorphic App in ES6.</title>
- {
- React.DOM.script({dangerouslySetInnerHTML: {
- __html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';'
- }})
- }
</head>
<body>
<Header name={this.props.name} />
@@ -35,6 +30,11 @@
<span> {this.state.counter} Clicks</span>
<p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p>
</main>
+ {
+ React.DOM.script({dangerouslySetInnerHTML: {
+ __html: 'var APP_PROPS = ' + JSON.stringify(this.state) + ';'
+ }})
+ }
<script src='./js/app.js'></script>
</body>
</html> |
21b44ac9f00d58c07a0134448bf7defd6b58f90b | React-Weather/app/components/Nav.jsx | React-Weather/app/components/Nav.jsx | var React = require('react');
var {Link} = require('react-router');
var Nav = React.createClass({
render: function () {
return (
<div>
<h2>Nav Component</h2>
<Link to="/">Get Weather</Link>
<Link to="/about">About</Link>
<Link to="/examples">Examples</Link>
</div>
)
}
});
module.exports = Nav;
| var React = require('react');
var {Link, IndexLink} = require('react-router');
var Nav = React.createClass({
render: function () {
return (
<div>
<h2>Nav Component</h2>
<IndexLink to="/" activeClassName="active" activeStyle={{fontWeight: 'bold'}}>Get Weather</IndexLink>
<Link to="/about" activeClassName="active" activeStyle={{fontWeight: 'bold'}}>About</Link>
<Link to="/examples" activeClassName="active" activeStyle={{fontWeight: 'bold'}}>Examples</Link>
</div>
)
}
});
module.exports = Nav;
| Add active class to active link. | Add active class to active link.
Fix active setting with IndexLink
| JSX | mit | JulianNicholls/Complete-React-Web-App,JulianNicholls/Complete-React-Web-App | ---
+++
@@ -1,15 +1,15 @@
var React = require('react');
-var {Link} = require('react-router');
+var {Link, IndexLink} = require('react-router');
var Nav = React.createClass({
render: function () {
return (
<div>
<h2>Nav Component</h2>
- <Link to="/">Get Weather</Link>
- <Link to="/about">About</Link>
- <Link to="/examples">Examples</Link>
+ <IndexLink to="/" activeClassName="active" activeStyle={{fontWeight: 'bold'}}>Get Weather</IndexLink>
+ <Link to="/about" activeClassName="active" activeStyle={{fontWeight: 'bold'}}>About</Link>
+ <Link to="/examples" activeClassName="active" activeStyle={{fontWeight: 'bold'}}>Examples</Link>
</div>
)
} |
f8aff4672f97934689e99f35a9ba3f9bbcc39fd6 | installer/frontend/components/reset-button.jsx | installer/frontend/components/reset-button.jsx | import React from 'react';
export const ResetButton = () => <button onClick={() => {
// eslint-disable-next-line no-alert
(window.config.devMode || window.confirm('Do you really want to start over?')) && window.reset();
}} className="btn btn-link">
Start Over
</button>;
| import React from 'react';
export const ResetButton = () => <button onClick={() => {
// eslint-disable-next-line no-alert
(window.config.devMode || window.confirm('Do you really want to start over?')) && window.reset();
}} className="btn btn-link">
<i className="fa fa-refresh"></i> Start Over
</button>;
| Add refresh icon to "start over" link. | frontend: Add refresh icon to "start over" link.
| JSX | apache-2.0 | yifan-gu/tectonic-installer,estroz/tectonic-installer,rithujohn191/tectonic-installer,metral/tectonic-installer,kans/tectonic-installer,hhoover/tectonic-installer,joshix/tectonic-installer,rithujohn191/tectonic-installer,ggreer/tectonic-installer,cpanato/tectonic-installer,everett-toews/tectonic-installer,colemickens/tectonic-installer,zbwright/tectonic-installer,rithujohn191/tectonic-installer,ggreer/tectonic-installer,squat/tectonic-installer,coreos/tectonic-installer,radhikapc/tectonic-installer,cpanato/tectonic-installer,yifan-gu/tectonic-installer,mrwacky42/tectonic-installer,kalmog/tectonic-installer,aknuds1/tectonic-installer,enxebre/tectonic-installer,mxinden/tectonic-installer,lander2k2/tectonic-installer,alexsomesan/tectonic-installer,kyoto/tectonic-installer,joshix/tectonic-installer,erjohnso/tectonic-installer,joshrosso/tectonic-installer,kyoto/tectonic-installer,zbwright/tectonic-installer,erjohnso/tectonic-installer,cpanato/tectonic-installer,justaugustus/tectonic-installer,joshix/tectonic-installer,hhoover/tectonic-installer,mxinden/tectonic-installer,alexsomesan/tectonic-installer,alexsomesan/tectonic-installer,metral/tectonic-installer,ggreer/tectonic-installer,AduroIdeja/tectonic-installer,mxinden/tectonic-installer,kans/tectonic-installer,estroz/tectonic-installer,kalmog/tectonic-installer,colemickens/tectonic-installer,coreos/tectonic-installer,estroz/tectonic-installer,rithujohn191/tectonic-installer,bsiegel/tectonic-installer,radhikapc/tectonic-installer,zbwright/tectonic-installer,s-urbaniak/tectonic-installer,colemickens/tectonic-installer,bsiegel/tectonic-installer,joshix/tectonic-installer,mrwacky42/tectonic-installer,kans/tectonic-installer,AduroIdeja/tectonic-installer,bsiegel/tectonic-installer,metral/tectonic-installer,pst/tectonic-installer,everett-toews/tectonic-installer,metral/tectonic-installer,aknuds1/tectonic-installer,justaugustus/tectonic-installer,joshrosso/tectonic-installer,radhikapc/tectonic-installer,squat/tectonic-installer,joshrosso/tectonic-installer,aknuds1/tectonic-installer,yifan-gu/tectonic-installer,s-urbaniak/tectonic-installer,s-urbaniak/tectonic-installer,mrwacky42/tectonic-installer,everett-toews/tectonic-installer,AduroIdeja/tectonic-installer,aknuds1/tectonic-installer,enxebre/tectonic-installer,kyoto/tectonic-installer,pst/tectonic-installer,enxebre/tectonic-installer,justaugustus/tectonic-installer,zbwright/tectonic-installer,AduroIdeja/tectonic-installer,bison/tectonic-installer,bsiegel/tectonic-installer,mrwacky42/tectonic-installer,pst/tectonic-installer,erjohnso/tectonic-installer,s-urbaniak/tectonic-installer,lblackstone/tectonic-installer,cpanato/tectonic-installer,zbwright/tectonic-installer,coreos/tectonic-installer,kyoto/tectonic-installer,justaugustus/tectonic-installer,pst/tectonic-installer,joshix/tectonic-installer,AduroIdeja/tectonic-installer,everett-toews/tectonic-installer,squat/tectonic-installer,mxinden/tectonic-installer,kalmog/tectonic-installer,lander2k2/tectonic-installer,kyoto/tectonic-installer,everett-toews/tectonic-installer,squat/tectonic-installer,yifan-gu/tectonic-installer,estroz/tectonic-installer,radhikapc/tectonic-installer,hhoover/tectonic-installer,bison/tectonic-installer,yifan-gu/tectonic-installer,aknuds1/tectonic-installer,derekhiggins/installer,alexsomesan/tectonic-installer,hhoover/tectonic-installer,alexsomesan/tectonic-installer,enxebre/tectonic-installer,colemickens/tectonic-installer,metral/tectonic-installer,mrwacky42/tectonic-installer,lblackstone/tectonic-installer,colemickens/tectonic-installer,hhoover/tectonic-installer,joshrosso/tectonic-installer,ggreer/tectonic-installer,derekhiggins/installer,bison/tectonic-installer,bsiegel/tectonic-installer,coreos/tectonic-installer,lblackstone/tectonic-installer,coreos/tectonic-installer,rithujohn191/tectonic-installer,bison/tectonic-installer,justaugustus/tectonic-installer,lander2k2/tectonic-installer,joshrosso/tectonic-installer,lander2k2/tectonic-installer,lblackstone/tectonic-installer,kans/tectonic-installer,enxebre/tectonic-installer,s-urbaniak/tectonic-installer,erjohnso/tectonic-installer | ---
+++
@@ -4,5 +4,5 @@
// eslint-disable-next-line no-alert
(window.config.devMode || window.confirm('Do you really want to start over?')) && window.reset();
}} className="btn btn-link">
- Start Over
+ <i className="fa fa-refresh"></i> Start Over
</button>; |
d8d4cec87a1dd3f3e0edc25a80bf63f74c7a4c15 | app/assets/javascripts/components/Stock.es6.jsx | app/assets/javascripts/components/Stock.es6.jsx | class Stock extends React.Component {
constructor() {
super()
}
render() {
return(
<li>
<h2>{this.props.symbol}</h2>
<h3>{this.props.name}</h3>
<span>{this.props.change} | </span>
<span>{this.props.high} | </span>
<span>{this.props.low} | </span>
<span>${this.props.current}</span>
<span>{link_to "add", stocks}</span>
</li>
)
}
}
| class Stock extends React.Component {
constructor() {
super()
}
render() {
let showStock='stocks/'+ this.props.symbol
return(
<li>
<h2>{this.props.symbol}</h2>
<span><h3>{this.props.name}</h3></span>
<span>{this.props.change} | </span>
<span>{this.props.high} | </span>
<span>{this.props.low} | </span>
<span>${this.props.current} | </span>
<span><a href={showStock}>add</a></span>
</li>
)
}
}
| Add link to page to buy shares | Add link to page to buy shares
| JSX | mit | nyc-otters-2017/MapYourStocks,nyc-otters-2017/MapYourStocks,nyc-otters-2017/MapYourStocks | ---
+++
@@ -5,16 +5,16 @@
render() {
+ let showStock='stocks/'+ this.props.symbol
return(
<li>
<h2>{this.props.symbol}</h2>
- <h3>{this.props.name}</h3>
+ <span><h3>{this.props.name}</h3></span>
<span>{this.props.change} | </span>
<span>{this.props.high} | </span>
<span>{this.props.low} | </span>
- <span>${this.props.current}</span>
- <span>{link_to "add", stocks}</span>
-
+ <span>${this.props.current} | </span>
+ <span><a href={showStock}>add</a></span>
</li>
)
} |
89a3a73ed692c459ce3c593e92e5a86cf71d8999 | client/app/bundles/HelloWorld/containers/__tests__/LandingPageContainer.test.jsx | client/app/bundles/HelloWorld/containers/__tests__/LandingPageContainer.test.jsx | import React from 'react';
import { shallow } from 'enzyme';
import LandingPageContainer from '../LandingPageContainer.jsx';
import $ from 'jquery'
import LandingPage from '../../components/progress_reports/landing_page.jsx'
import LoadingIndicator from '../../components/shared/loading_indicator.jsx'
jest.mock('jquery', () => {
return {
get: jest.fn()
}
});
describe('LandingPageContainer container', () => {
it('should return LoadingIndicator component if loading', () => {
const wrapper = shallow(<LandingPageContainer />);
wrapper.setState({loading: true});
expect(wrapper.find(LoadingIndicator).exists()).toBe(true);
});
it('should return LandingPage with flag', () => {
const wrapper = shallow(<LandingPageContainer />);
wrapper.setState({flag: 'bosco', loading: false});
expect(wrapper.find(LandingPage).exists()).toBe(true);
expect(wrapper.find(LandingPage).props().flag).toBe('bosco');
});
it('should send get request on componentDidMount', () => {
const wrapper = shallow(<LandingPageContainer />);
wrapper.instance().componentDidMount();
expect($.get.mock.calls).toHaveLength(1);
expect($.get.mock.calls[0][0]).toBe('/current_user_json');
});
});
| import React from 'react';
import { shallow } from 'enzyme';
import LandingPageContainer from '../LandingPageContainer.jsx';
import $ from 'jquery'
import LandingPage from '../../components/progress_reports/landing_page.jsx'
import LoadingIndicator from '../../components/shared/loading_indicator.jsx'
// This is a mock. We want to simulate a flag we set elsewhere.
document.getElementById = () => { return { getAttribute: () => 'beta' } };
jest.mock('jquery', () => {
return {
get: jest.fn()
}
});
describe('LandingPageContainer container', () => {
it('should render LandingPage component', () => {
const wrapper = shallow(<LandingPageContainer />);
expect(wrapper.find(LandingPage).exists()).toBe(true);
expect(wrapper.find(LandingPage).props().flag).toBe('beta');
});
});
| Fix a Jest suite for LandingPageContainer | Fix a Jest suite for LandingPageContainer
| JSX | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | ---
+++
@@ -7,6 +7,9 @@
import LandingPage from '../../components/progress_reports/landing_page.jsx'
import LoadingIndicator from '../../components/shared/loading_indicator.jsx'
+// This is a mock. We want to simulate a flag we set elsewhere.
+document.getElementById = () => { return { getAttribute: () => 'beta' } };
+
jest.mock('jquery', () => {
return {
get: jest.fn()
@@ -15,25 +18,10 @@
describe('LandingPageContainer container', () => {
-
- it('should return LoadingIndicator component if loading', () => {
+ it('should render LandingPage component', () => {
const wrapper = shallow(<LandingPageContainer />);
- wrapper.setState({loading: true});
- expect(wrapper.find(LoadingIndicator).exists()).toBe(true);
- });
-
- it('should return LandingPage with flag', () => {
- const wrapper = shallow(<LandingPageContainer />);
- wrapper.setState({flag: 'bosco', loading: false});
expect(wrapper.find(LandingPage).exists()).toBe(true);
- expect(wrapper.find(LandingPage).props().flag).toBe('bosco');
- });
-
- it('should send get request on componentDidMount', () => {
- const wrapper = shallow(<LandingPageContainer />);
- wrapper.instance().componentDidMount();
- expect($.get.mock.calls).toHaveLength(1);
- expect($.get.mock.calls[0][0]).toBe('/current_user_json');
+ expect(wrapper.find(LandingPage).props().flag).toBe('beta');
});
}); |
fab7e2e67a5591c298db7a0290cc5dc16999a8dc | app/assets/javascripts/lesson_planner/unit_templates_manager/unit_template_profile/unit_template_profile_assign_button.jsx | app/assets/javascripts/lesson_planner/unit_templates_manager/unit_template_profile/unit_template_profile_assign_button.jsx | EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
<button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to everyone, with no due dates</button>
<button className='button-green full-width' onClick={this.props.actions.customAssign}>Pick specific students and due dates</button>
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
}); | EC.UnitTemplateProfileAssignButton = React.createClass({
propTypes: {
data: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
},
propsSpecificComponent: function () {
if (this.props.data.non_authenticated) {
return <button className='button-green full-width' onClick={this.props.actions.signUp}>Sign Up</button>
} else if (!this.props.data.firstAssignButtonClicked) {
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
<button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to Everyone</button>
<button className='button-green full-width' onClick={this.props.actions.customAssign}>Assign to Specific Students and Set Due Dates</button>
</span>)
}
},
render: function () {
return (
<div>
{this.propsSpecificComponent()}
<p className="time"><i className='fa fa-clock-o'></i>Estimated Time: {this.props.data.model.time} mins</p>
</div>
)
}
}); | Change the copy on the assign all button. | Change the copy on the assign all button. | JSX | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | ---
+++
@@ -11,8 +11,8 @@
return <button className='button-green full-width' onClick={this.props.actions.clickAssignButton}>Assign to Your Class</button>
} else {
return (<span>
- <button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to everyone, with no due dates</button>
- <button className='button-green full-width' onClick={this.props.actions.customAssign}>Pick specific students and due dates</button>
+ <button className='button-green full-width' onClick={this.props.actions.fastAssign}>Assign to Everyone</button>
+ <button className='button-green full-width' onClick={this.props.actions.customAssign}>Assign to Specific Students and Set Due Dates</button>
</span>)
}
}, |
7ae4280d266fa551b6f7003d3790f709b7cdc0aa | app/components/pages/Resume.jsx | app/components/pages/Resume.jsx | import React from 'react';
import HeaderSection from '../organisms/HeaderSection';
export default React.createClass({
render() {
return (
<div>
<HeaderSection/>
(Resumé page)
</div>
);
},
});
| import React from 'react';
import HeaderSection from '../organisms/HeaderSection';
export default React.createClass({
render() {
return (
<div>
<HeaderSection/>
Coming soon...
</div>
);
},
});
| Change resumé page to show "Coming soon..." | Change resumé page to show "Coming soon..."
| JSX | mit | amcsi/szeremi,amcsi/szeremi | ---
+++
@@ -7,7 +7,8 @@
return (
<div>
<HeaderSection/>
- (Resumé page)
+
+ Coming soon...
</div>
);
}, |
9c38ddcc626e9f6ffe0cdba44d74e2fb212bf325 | client/src/index.jsx | client/src/index.jsx | import 'aframe';
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, browserHistory } from 'react-router';
import App from './components/App.js';
import Home from './components/Home.js';
ReactDOM.render((
<Router history={browserHistory}>
<Route path="/" component={App} >
</Route>
</Router>
), document.querySelector('.scene-container')); | import 'aframe';
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, browserHistory } from 'react-router';
import App from './components/App.js';
import Home from './components/Home.js';
import Main from './components/Main.js';
ReactDOM.render((
<Router history={browserHistory}>
<Route path="/" component={App} >
</Route>
<Route path="/main" component={Main} >
</Route>
</Router>
), document.querySelector('.scene-container')); | Add new route for main component | Add new route for main component
| JSX | mit | francoabaroa/happi,francoabaroa/happi | ---
+++
@@ -6,10 +6,13 @@
import App from './components/App.js';
import Home from './components/Home.js';
+import Main from './components/Main.js';
ReactDOM.render((
<Router history={browserHistory}>
<Route path="/" component={App} >
</Route>
+ <Route path="/main" component={Main} >
+ </Route>
</Router>
), document.querySelector('.scene-container')); |
a853a4602a9f4e29751edb293288f0c1cfb48c89 | app/react/components/profile-card/profile-card.jsx | app/react/components/profile-card/profile-card.jsx | import React from 'react';
var profileCard = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
links: React.PropTypes.array,
image: React.PropTypes.string
},
getDefaultProps() {
return {
name: ``,
title: ``,
image: `/assets/img/placeholder.jpg`,
links: []
};
},
render() {
return (
<div className="profile-card row flex-items-xs-center" id={this.props.name.replace(/\W/g, `-`)}>
<div className="col-xs-6 col-xs-push-3 col-sm-3 col-sm-push-0 col-xl-2">
<div className="text-xs-center">
<img className="profile-card--image circle" src={this.props.image}/>
</div>
</div>
<div className="col-sm-9 col-xl-8">
<h3 className="mb-0 profile-card--name">{this.props.name}</h3>
<p className="profile-card--title">{this.props.title}</p>
<p className="mb-1 profile-card--links">{this.props.links.map((link)=>{ return <span className="profile-card--link">{link}</span>; })}</p>
<p>{this.props.children}</p>
</div>
</div>
);
}
});
export default profileCard;
| import React from 'react';
export default class ProfileCard extends React.Component {
render() {
return (
<div className="profile-card row flex-items-xs-center" id={this.props.name.replace(/\W/g, `-`)}>
<div className="col-xs-6 col-xs-push-3 col-sm-3 col-sm-push-0 col-xl-2">
<div className="text-xs-center">
<img className="profile-card--image circle" src={this.props.image}/>
</div>
</div>
<div className="col-sm-9 col-xl-8">
<h3 className="mb-0 profile-card--name">{this.props.name}</h3>
<p className="profile-card--title">{this.props.title}</p>
<p className="mb-1 profile-card--links">{this.props.links.map((link)=>{ return <span className="profile-card--link">{link}</span>; })}</p>
<p>{this.props.children}</p>
</div>
</div>
);
}
}
ProfileCard.propTypes = {
name: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
links: React.PropTypes.array,
image: React.PropTypes.string
};
ProfileCard.defaultProps = {
name: ``,
title: ``,
image: `/assets/img/placeholder.jpg`,
links: []
};
| Make changes for es6 migrations | ProfileCard: Make changes for es6 migrations
See #613
| JSX | mpl-2.0 | mozilla/science.mozilla.org,mozilla/science.mozilla.org | ---
+++
@@ -1,21 +1,9 @@
import React from 'react';
-var profileCard = React.createClass({
- propTypes: {
- name: React.PropTypes.string.isRequired,
- title: React.PropTypes.string,
- links: React.PropTypes.array,
- image: React.PropTypes.string
- },
- getDefaultProps() {
- return {
- name: ``,
- title: ``,
- image: `/assets/img/placeholder.jpg`,
- links: []
- };
- },
+export default class ProfileCard extends React.Component {
+
render() {
+
return (
<div className="profile-card row flex-items-xs-center" id={this.props.name.replace(/\W/g, `-`)}>
<div className="col-xs-6 col-xs-push-3 col-sm-3 col-sm-push-0 col-xl-2">
@@ -32,6 +20,18 @@
</div>
);
}
-});
+}
-export default profileCard;
+ProfileCard.propTypes = {
+ name: React.PropTypes.string.isRequired,
+ title: React.PropTypes.string,
+ links: React.PropTypes.array,
+ image: React.PropTypes.string
+};
+
+ProfileCard.defaultProps = {
+ name: ``,
+ title: ``,
+ image: `/assets/img/placeholder.jpg`,
+ links: []
+}; |
a60f2221f04fd46de36bd7a8397deb54e66940a3 | app/scripts/views/about.jsx | app/scripts/views/about.jsx | import React from 'react';
export default function About() {
return (
<div className="text">There's really not that much interesting here...<br/>This site is developed using <a href="https://facebook.github.io/react/" target="_blank">React</a> in conjunction with <a href="https://webpack.github.io/" target="_blank">Webpack</a>, <a href="https://babeljs.io/" target="_blank">Babel</a> and <a href="https://www.npmjs.com/" target="_blank">Node/NPM</a>, for the purpose of learning and testing it out. For more information about me, feel free to follow the social links at the bottom of the page.</div>
);
} | import React from 'react';
export default function About() {
return (
<div className="text">
There's really not that much interesting here...<br/>This site is developed
using <a href="https://facebook.github.io/react/" target="_blank">React</a> in conjunction
with <a href="https://webpack.github.io/" target="_blank">Webpack</a>, <a href="https://babeljs.io/" target="_blank">Babel</a>
and <a href="https://www.npmjs.com/" target="_blank">Node/NPM</a>, for the purpose of learning
and testing it out. For more information about me, feel free to follow the social links
at the bottom of the page.<br/><br/>Ben Tomlin © 2017
</div>
);
} | Add copyright notice and refactor text slightly | Add copyright notice and refactor text slightly
| JSX | mit | benct/tomlin-web,benct/tomlin-web | ---
+++
@@ -2,6 +2,13 @@
export default function About() {
return (
- <div className="text">There's really not that much interesting here...<br/>This site is developed using <a href="https://facebook.github.io/react/" target="_blank">React</a> in conjunction with <a href="https://webpack.github.io/" target="_blank">Webpack</a>, <a href="https://babeljs.io/" target="_blank">Babel</a> and <a href="https://www.npmjs.com/" target="_blank">Node/NPM</a>, for the purpose of learning and testing it out. For more information about me, feel free to follow the social links at the bottom of the page.</div>
+ <div className="text">
+ There's really not that much interesting here...<br/>This site is developed
+ using <a href="https://facebook.github.io/react/" target="_blank">React</a> in conjunction
+ with <a href="https://webpack.github.io/" target="_blank">Webpack</a>, <a href="https://babeljs.io/" target="_blank">Babel</a>
+ and <a href="https://www.npmjs.com/" target="_blank">Node/NPM</a>, for the purpose of learning
+ and testing it out. For more information about me, feel free to follow the social links
+ at the bottom of the page.<br/><br/>Ben Tomlin © 2017
+ </div>
);
} |
0733a5dde44e5b0c87ae2d65a6afe2eacfa848be | src/views/preview/extension-chip.jsx | src/views/preview/extension-chip.jsx | const classNames = require('classnames');
const React = require('react');
const PropTypes = require('prop-types');
require('./extension-chip.scss');
const ExtensionChip = props => (
<div className={classNames('extension-chip', {'has-status': props.hasStatus})}>
<img
className="extension-title"
src={props.iconSrc}
/>
<div className="extension-content">
<span>{props.extensionName}</span>
{props.hasStatus && (
<div className="extension-status">
Needs Connection
</div>
)}
</div>
</div>
);
ExtensionChip.propTypes = {
extensionName: PropTypes.string,
hasStatus: PropTypes.boolean,
iconSrc: PropTypes.string
};
module.exports = ExtensionChip;
| const classNames = require('classnames');
const React = require('react');
const PropTypes = require('prop-types');
require('./extension-chip.scss');
const ExtensionChip = props => (
<div className={classNames('extension-chip', {'has-status': props.hasStatus})}>
<img
className="extension-icon"
src={props.iconSrc}
/>
<div className="extension-content">
<span>{props.extensionName}</span>
{props.hasStatus && (
<div className="extension-status">
Needs Connection
</div>
)}
</div>
</div>
);
ExtensionChip.propTypes = {
extensionName: PropTypes.string,
hasStatus: PropTypes.boolean,
iconSrc: PropTypes.string
};
module.exports = ExtensionChip;
| Fix class name for extension icon | Fix class name for extension icon
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -6,7 +6,7 @@
const ExtensionChip = props => (
<div className={classNames('extension-chip', {'has-status': props.hasStatus})}>
<img
- className="extension-title"
+ className="extension-icon"
src={props.iconSrc}
/>
<div className="extension-content"> |
47e53a6590391642be7dfef266771f096971c6d8 | client/app/js/task_card.jsx | client/app/js/task_card.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import {Card, CardTitle, CardText} from 'material-ui/Card';
export default class Column extends React.Component {
constructor(props) {
super(props);
this.state={};
}
render () {
return <Card className="task">
<CardTitle title={this.props.name} subtitle="Story tag" />
<CardText className="task-text">
{this.props.desc}
</CardText>
</Card>
}
}
| import React from 'react';
import ReactDOM from 'react-dom';
import {Card, CardTitle, CardActions, CardText} from 'material-ui/Card';
import IconButton from 'material-ui/IconButton';
import EditIcon from 'material-ui/svg-icons/editor/mode-edit';
import PrevIcon from 'material-ui/svg-icons/navigation/chevron-left';
import NextIcon from 'material-ui/svg-icons/navigation/chevron-right';
import { Grid, Row, Col } from 'react-bootstrap';
const styles = {
small_icon: {
width: 20,
height: 20
},
small_button: {
width: 20,
height: 20,
padding: 0
}
}
export default class Column extends React.Component {
constructor(props) {
super(props);
this.state={};
}
render () {
return <Card className="task">
<CardTitle title={this.props.name} subtitle="Story tag" />
<CardText className="task-text">
{this.props.desc}
</CardText>
<CardActions>
<Grid fluid={true}>
<Row className="show-grid">
<Col lg={4} >
<IconButton tooltip="Edit Task" style={styles.small_button}
iconStyle={styles.small_icon}
tooltipPosition="top-center">
<EditIcon />
</IconButton>
</Col>
<Col lg={8} >
<div className="pull-right">
<IconButton tooltip="Move To Previous Column" style={styles.small_button}
iconStyle={styles.small_icon}
tooltipPosition="top-center">
<PrevIcon />
</IconButton>
<IconButton tooltip="Move To Next Column" style={styles.small_button}
iconStyle={styles.small_icon}
tooltipPosition="top-center">
<NextIcon />
</IconButton>
</div>
</Col>
</Row>
</Grid>
</CardActions>
</Card>
}
}
| Add edit and nav buttons on task card | Add edit and nav buttons on task card
| JSX | mit | mafigit/Komorebi,mafigit/Komorebi,mafigit/Komorebi,mbbh/Komorebi,kmerz/Komorebi,kmerz/Komorebi,mbbh/Komorebi,mbbh/Komorebi,kmerz/Komorebi,mafigit/Komorebi,mbbh/Komorebi,kmerz/Komorebi | ---
+++
@@ -1,6 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import {Card, CardTitle, CardText} from 'material-ui/Card';
+import {Card, CardTitle, CardActions, CardText} from 'material-ui/Card';
+import IconButton from 'material-ui/IconButton';
+import EditIcon from 'material-ui/svg-icons/editor/mode-edit';
+import PrevIcon from 'material-ui/svg-icons/navigation/chevron-left';
+import NextIcon from 'material-ui/svg-icons/navigation/chevron-right';
+import { Grid, Row, Col } from 'react-bootstrap';
+
+const styles = {
+ small_icon: {
+ width: 20,
+ height: 20
+ },
+ small_button: {
+ width: 20,
+ height: 20,
+ padding: 0
+ }
+}
export default class Column extends React.Component {
constructor(props) {
@@ -14,6 +31,33 @@
<CardText className="task-text">
{this.props.desc}
</CardText>
+ <CardActions>
+ <Grid fluid={true}>
+ <Row className="show-grid">
+ <Col lg={4} >
+ <IconButton tooltip="Edit Task" style={styles.small_button}
+ iconStyle={styles.small_icon}
+ tooltipPosition="top-center">
+ <EditIcon />
+ </IconButton>
+ </Col>
+ <Col lg={8} >
+ <div className="pull-right">
+ <IconButton tooltip="Move To Previous Column" style={styles.small_button}
+ iconStyle={styles.small_icon}
+ tooltipPosition="top-center">
+ <PrevIcon />
+ </IconButton>
+ <IconButton tooltip="Move To Next Column" style={styles.small_button}
+ iconStyle={styles.small_icon}
+ tooltipPosition="top-center">
+ <NextIcon />
+ </IconButton>
+ </div>
+ </Col>
+ </Row>
+ </Grid>
+ </CardActions>
</Card>
}
} |
961dcc0bd1b2a434439a98bba7e2ab6175c9951f | index.jsx | index.jsx | 'use strict'
let ReactDOM = require('react-dom');
let React = require('react');
let FlightTable = require('./flight-table');
let data = [
{
icao: "471f7f",
flight: "WZZ7HP",
squawk: "6212",
altitude: "3200",
speed: "175",
distance: "11.6",
track: "48",
msgs: "768",
age: "0"
},
{
icao: "3c6752",
flight: "EWG7Y",
squawk: "0460",
altitude: "39025",
speed: "399",
distance: "96.2",
track: "49",
msgs: "868",
age: "0"
}
];
ReactDOM.render(
<FlightTable data={data} />,
document.getElementById('content')
);
| 'use strict'
let wsUrl = 'ws://192.168.0.12:8888';
let webSocket = new WebSocket(wsUrl, ['binary', 'base64']);
let translateMessage = message => {
return {
icao: message.hex_ident,
flight: message.callsign,
squawk: message.squawk,
altitude: message.altitude,
speed: message.ground_speed,
distance: '',
track: message.track
}
};
webSocket.onmessage = evt => {
let reader = new FileReader();
reader.onloadend = () => {
let messages = reader.result.split('\n');
messages.slice(0,-1).forEach((message, index) => messages[index] = translateMessage(parseSbs1Message(message)));
flightTableComponent.setState({data: messages});
};
reader.readAsText(evt.data);
}
let ReactDOM = require('react-dom');
let React = require('react');
let FlightTable = require('./flight-table');
let flightTableComponent = ReactDOM.render(
<FlightTable />,
document.getElementById('content')
);
| Implement a prototype loading data from websocket and rendering it in a table | Implement a prototype loading data from websocket and rendering it in a table
| JSX | mit | Mchl/dump1090-react-client,Mchl/dump1090-react-client | ---
+++
@@ -1,36 +1,44 @@
'use strict'
+
+let wsUrl = 'ws://192.168.0.12:8888';
+
+let webSocket = new WebSocket(wsUrl, ['binary', 'base64']);
+
+let translateMessage = message => {
+ return {
+ icao: message.hex_ident,
+ flight: message.callsign,
+ squawk: message.squawk,
+ altitude: message.altitude,
+ speed: message.ground_speed,
+ distance: '',
+ track: message.track
+ }
+};
+
+
+
+webSocket.onmessage = evt => {
+ let reader = new FileReader();
+
+ reader.onloadend = () => {
+ let messages = reader.result.split('\n');
+ messages.slice(0,-1).forEach((message, index) => messages[index] = translateMessage(parseSbs1Message(message)));
+
+ flightTableComponent.setState({data: messages});
+ };
+
+
+ reader.readAsText(evt.data);
+}
let ReactDOM = require('react-dom');
let React = require('react');
let FlightTable = require('./flight-table');
-let data = [
- {
- icao: "471f7f",
- flight: "WZZ7HP",
- squawk: "6212",
- altitude: "3200",
- speed: "175",
- distance: "11.6",
- track: "48",
- msgs: "768",
- age: "0"
- },
- {
- icao: "3c6752",
- flight: "EWG7Y",
- squawk: "0460",
- altitude: "39025",
- speed: "399",
- distance: "96.2",
- track: "49",
- msgs: "868",
- age: "0"
- }
-];
-ReactDOM.render(
- <FlightTable data={data} />,
+let flightTableComponent = ReactDOM.render(
+ <FlightTable />,
document.getElementById('content')
);
|
a19b2efc9d418557892c3bb018a4d7b11230cb72 | docs/src/Demo/Examples/BasicUsage.jsx | docs/src/Demo/Examples/BasicUsage.jsx | import React, { Fragment, Component } from 'react';
import moment from 'moment';
import { Typography } from 'material-ui';
import { TimePicker, DatePicker } from 'material-ui-pickers';
export default class BasicUsage extends Component {
state = {
selectedDate: moment(),
}
handleDateChange = (date) => {
this.setState({ selectedDate: date });
}
render() {
const { selectedDate } = this.state;
return (
<Fragment>
<div className="picker">
<Typography variant="headline" align="center" gutterBottom>
Date picker
</Typography>
<DatePicker
keyboard
clearable
maxDateMessage="Date must be less than today"
value={selectedDate}
onChange={this.handleDateChange}
animateYearScrolling={false}
/>
</div>
<div className="picker">
<Typography variant="headline" align="center" gutterBottom>
Time picker
</Typography>
<TimePicker
keyboard
mask={[/\d/, /\d/, ':', /\d/, /\d/, ' ', /a|p/i, 'M']}
placeholder="08:00 AM"
value={selectedDate}
onChange={this.handleDateChange}
/>
</div>
</Fragment>
);
}
}
| import React, { Fragment, Component } from 'react';
import moment from 'moment';
import { Typography } from 'material-ui';
import { TimePicker, DatePicker } from 'material-ui-pickers';
export default class BasicUsage extends Component {
state = {
selectedDate: moment(),
}
handleDateChange = (date) => {
this.setState({ selectedDate: date });
}
render() {
const { selectedDate } = this.state;
return (
<Fragment>
<div className="picker">
<Typography variant="headline" align="center" gutterBottom>
Date picker
</Typography>
<DatePicker
keyboard
clearable
label="Choose a date"
helperText="Possible manual entry via keyboard"
maxDateMessage="Date must be less than today"
value={selectedDate}
onChange={this.handleDateChange}
animateYearScrolling={false}
/>
</div>
<div className="picker">
<Typography variant="headline" align="center" gutterBottom>
Time picker
</Typography>
<TimePicker
keyboard
mask={[/\d/, /\d/, ':', /\d/, /\d/, ' ', /a|p/i, 'M']}
placeholder="08:00 AM"
value={selectedDate}
onChange={this.handleDateChange}
/>
</div>
</Fragment>
);
}
}
| Add label to date picker in basic usage | Add label to date picker in basic usage
| JSX | mit | mbrookes/material-ui,rscnt/material-ui,callemall/material-ui,oliviertassinari/material-ui,mui-org/material-ui,dmtrKovalenko/material-ui-pickers,callemall/material-ui,mui-org/material-ui,mbrookes/material-ui,rscnt/material-ui,mui-org/material-ui,callemall/material-ui,mbrookes/material-ui,oliviertassinari/material-ui,callemall/material-ui,oliviertassinari/material-ui,dmtrKovalenko/material-ui-pickers,rscnt/material-ui | ---
+++
@@ -25,6 +25,8 @@
<DatePicker
keyboard
clearable
+ label="Choose a date"
+ helperText="Possible manual entry via keyboard"
maxDateMessage="Date must be less than today"
value={selectedDate}
onChange={this.handleDateChange} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.