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
|
---|---|---|---|---|---|---|---|---|---|---|
91bfaa931fe48715bb1501a0c2a9b4a81fa5b0a5 | client/app/bundles/course/assessment/submission/components/ScribingView/index.jsx | client/app/bundles/course/assessment/submission/components/ScribingView/index.jsx | import React from 'react';
import PropTypes from 'prop-types';
import scribingViewLoader from 'course/assessment/submission/loaders/ScribingViewLoader';
import ScribingToolbar from './ScribingToolbar';
import ScribingCanvas from './ScribingCanvas';
import style from './ScribingView.scss'; // eslint-disable-line no-unused-vars
import { submissionShape } from '../../propTypes';
const propTypes = {
answerId: PropTypes.number.isRequired,
submission: submissionShape,
};
const styles = {
canvasDiv: {
alignItems: 'center',
margin: 'auto',
},
};
export default class ScribingViewComponent extends React.Component {
componentWillMount() {
scribingViewLoader().then(() => {
this.forceUpdate();
});
}
render() {
const { answerId, submission } = this.props;
return answerId ? (
<div style={styles.canvasDiv}>
{submission.canUpdate ? <ScribingToolbar {...this.props} /> : null}
<ScribingCanvas {...this.props} />
</div>
) : null;
}
}
ScribingViewComponent.propTypes = propTypes;
| import React from 'react';
import PropTypes from 'prop-types';
import scribingViewLoader from 'course/assessment/submission/loaders/ScribingViewLoader';
import ScribingToolbar from './ScribingToolbar';
import ScribingCanvas from './ScribingCanvas';
import { submissionShape } from '../../propTypes';
const propTypes = {
answerId: PropTypes.number.isRequired,
submission: submissionShape,
};
const styles = {
canvasDiv: {
alignItems: 'center',
margin: 'auto',
},
};
export default class ScribingViewComponent extends React.Component {
componentWillMount() {
scribingViewLoader().then(() => {
this.forceUpdate();
});
}
render() {
const { answerId, submission } = this.props;
return answerId ? (
<div style={styles.canvasDiv}>
{submission.canUpdate ? (
<ScribingToolbar
key={`ScribingToolbar-${answerId}`}
{...this.props}
/>
) : null}
<ScribingCanvas key={`ScribingCanvas-${answerId}`} {...this.props} />
</div>
) : null;
}
}
ScribingViewComponent.propTypes = propTypes;
| Fix scribing question bug in autograded assessment | fix(ScribingViewComponent): Fix scribing question bug in autograded assessment
| JSX | mit | Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2 | ---
+++
@@ -3,7 +3,6 @@
import scribingViewLoader from 'course/assessment/submission/loaders/ScribingViewLoader';
import ScribingToolbar from './ScribingToolbar';
import ScribingCanvas from './ScribingCanvas';
-import style from './ScribingView.scss'; // eslint-disable-line no-unused-vars
import { submissionShape } from '../../propTypes';
const propTypes = {
@@ -29,8 +28,13 @@
const { answerId, submission } = this.props;
return answerId ? (
<div style={styles.canvasDiv}>
- {submission.canUpdate ? <ScribingToolbar {...this.props} /> : null}
- <ScribingCanvas {...this.props} />
+ {submission.canUpdate ? (
+ <ScribingToolbar
+ key={`ScribingToolbar-${answerId}`}
+ {...this.props}
+ />
+ ) : null}
+ <ScribingCanvas key={`ScribingCanvas-${answerId}`} {...this.props} />
</div>
) : null;
} |
b8f232a7aa9b0b100b9176f36a40424740779721 | client/components/Events/Event.jsx | client/components/Events/Event.jsx | import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import Moment from 'moment';
const Event = ({ eventName, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country }) => (
<li>
<Link
to={{ pathname:
'/events/' + eventName,
query: {
eventName,
description,
eventStartDateTime,
eventEndDateTime,
eventContractAddress,
price,
addressLine1,
addressLine2,
city,
state,
zipPostalCode,
country,
},
}}
><img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /></Link>
<h2><Link
to={{ pathname:
'/events/' + eventName,
query: {
eventName,
description,
eventStartDateTime,
eventEndDateTime,
eventContractAddress,
price,
addressLine1,
addressLine2,
city,
state,
zipPostalCode,
country,
},
}}
>{eventName}</Link></h2>
<p>Date: {Moment().format('MMMM Do YYYY, h:mm A')}</p>
<p>Price: {price}</p>
<p>City: {city}</p>
</li>
);
export default Event;
| import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import Moment from 'moment';
const Event = ({ eventName, description, eventStartDateTime, eventEndDateTime, eventContractAddress, price, addressLine1, addressLine2, city, state, zipPostalCode, country }) => (
<li>
<Link
to={{ pathname:
'/events/' + eventName,
query: {
eventName,
description,
eventStartDateTime,
eventEndDateTime,
eventContractAddress,
price,
addressLine1,
addressLine2,
city,
state,
zipPostalCode,
country,
},
}}
><img src="http://tctechcrunch2011.files.wordpress.com/2008/04/linux-penguin-small.png" /></Link>
<h2><Link
to={{ pathname:
'/events/' + eventName,
query: {
eventName,
description,
eventStartDateTime,
eventEndDateTime,
eventContractAddress,
price,
addressLine1,
addressLine2,
city,
state,
zipPostalCode,
country,
},
}}
>{eventName}</Link></h2>
<p>Date: {Moment().format('MMMM Do YYYY, h:mm A')}</p>
<p>Price: {price}</p>
<p>Location: {city + ', ' + state}</p>
</li>
);
export default Event;
| Change event listing to location instead of city | Change event listing to location instead of city
| JSX | mit | chrispicato/ticket-sherpa,chrispicato/ticket-sherpa | ---
+++
@@ -44,7 +44,7 @@
>{eventName}</Link></h2>
<p>Date: {Moment().format('MMMM Do YYYY, h:mm A')}</p>
<p>Price: {price}</p>
- <p>City: {city}</p>
+ <p>Location: {city + ', ' + state}</p>
</li>
);
|
049d68c94f38b1f59bd1d841a377c89cec3e2a07 | src/components/Button.jsx | src/components/Button.jsx | import React from 'react';
import './Button.css';
import Icon from 'react-icons-kit';
export default function Button(props) {
var buttonClass = 'Button';
switch (props.buttonType) {
case 'primary':
buttonClass = buttonClass + ' primary';
break;
case 'navbar-tab':
case 'navbar-tab-active':
buttonClass = buttonClass + ' navbar-tab';
if (props.buttonType === 'navbar-tab-active') {
buttonClass = buttonClass + ' navbar-tab-active';
}
break;
case 'editor-maplist-button':
case 'editor-maplist-button-selected':
buttonClass = buttonClass + ' editor-maplist-button';
if (props.buttonType === 'editor-maplist-button-selected') {
buttonClass = buttonClass + ' primary';
}
break;
case 'close-or-delete':
buttonClass = buttonClass + ' delete-button';
break;
default:
break;
}
if (props.inactive) {
buttonClass = buttonClass + ' inactive';
}
return (
<div
className={buttonClass}
id={props.id}
style={props.style}
onClick={props.handleClick} >
{props.icon ? <Icon size={'1.3em'} icon={props.icon} className="navbar-icon"/> : ''}
{props.buttonType == 'close-or-delete' ? 'x' : props.text}
</div>
);
}
| import React from 'react';
import './Button.css';
import Icon from 'react-icons-kit';
export default function Button(props) {
var buttonClass = 'Button';
switch (props.buttonType) {
case 'primary':
buttonClass = buttonClass + ' primary';
break;
case 'navbar-tab':
case 'navbar-tab-active':
buttonClass = buttonClass + ' navbar-tab';
if (props.buttonType === 'navbar-tab-active') {
buttonClass = buttonClass + ' navbar-tab-active';
}
break;
case 'editor-maplist-button':
case 'editor-maplist-button-selected':
buttonClass = buttonClass + ' editor-maplist-button';
if (props.buttonType === 'editor-maplist-button-selected') {
buttonClass = buttonClass + ' primary';
}
break;
case 'close-or-delete':
buttonClass = buttonClass + ' delete-button';
break;
default:
break;
}
if (props.inactive) {
buttonClass = buttonClass + ' inactive';
}
return (
<div
className={buttonClass}
id={props.id}
style={props.style}
onClick={props.inactive ? '' : props.handleClick} >
{props.icon ? <Icon size={'1.3em'} icon={props.icon} className="navbar-icon"/> : ''}
{props.buttonType == 'close-or-delete' ? 'x' : props.text}
</div>
);
}
| Disable ability to click inactive buttons | Disable ability to click inactive buttons
| JSX | mit | gaviarctica/forestry-game-frontend,gaviarctica/forestry-game-frontend | ---
+++
@@ -43,7 +43,7 @@
className={buttonClass}
id={props.id}
style={props.style}
- onClick={props.handleClick} >
+ onClick={props.inactive ? '' : props.handleClick} >
{props.icon ? <Icon size={'1.3em'} icon={props.icon} className="navbar-icon"/> : ''}
|
953e7fa2e1e9220a360950e1d4dee9ee9f679968 | src/specs/MyComponent.spec.jsx | src/specs/MyComponent.spec.jsx | import React from "react";
import MyComponent from "../components/MyComponent";
const LOREM = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
describe("MyComponent", function() {
let count = 0;
this.header(`## A Simple Component`); // Markdown.
before(() => {
// Runs when the Suite loads. Use this to host your component-under-test.
this.load( <MyComponent color="red"/> );
});
it("reload", () => {
count += 1;
this.load( <MyComponent color="red" text={`My Component ${ count }`} /> );
});
section("text", () => {
it("increment", () => {
count += 1;
this.props({ text: `My Component ${ count }` });
});
it("long", () => { this.props({ text: LOREM }) });
});
section("color", () => {
it("red", () => this.props({ color: "red" }));
it("green", () => this.props({ color: "green" }));
it("blue", () => this.props({ color: "blue" }));
});
});
| import React from "react";
import MyComponent from "../components/MyComponent";
const LOREM = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
describe("MyComponent", function() {
let count = 0;
this.header(`## A Simple Component`); // Markdown.
before(() => {
// Runs when the Suite loads. Use this to host your component-under-test.
this.load( <MyComponent /> );
});
it("reload", () => {
count += 1;
this.load( <MyComponent color="red" text={`My Component ${ count }`} /> );
});
section("text", () => {
it("increment", () => {
count += 1;
this.props({ text: `My Component ${ count }` });
});
it("long", () => { this.props({ text: LOREM }) });
});
section("color", () => {
it("red", () => this.props({ color: "red" }));
it("green", () => this.props({ color: "green" }));
it("blue", () => this.props({ color: "blue" }));
it("orange (error)", () => this.props({ color: "orange" }));
});
});
| Change default color of sample component. | Change default color of sample component.
| JSX | mit | philcockfield/ui-harness-sample | ---
+++
@@ -10,7 +10,7 @@
before(() => {
// Runs when the Suite loads. Use this to host your component-under-test.
- this.load( <MyComponent color="red"/> );
+ this.load( <MyComponent /> );
});
it("reload", () => {
@@ -30,5 +30,6 @@
it("red", () => this.props({ color: "red" }));
it("green", () => this.props({ color: "green" }));
it("blue", () => this.props({ color: "blue" }));
+ it("orange (error)", () => this.props({ color: "orange" }));
});
}); |
66c56b14ec5395ff7c0bbebcadf78e5e2eecb1c7 | client/components/dialog/DialogPart.jsx | client/components/dialog/DialogPart.jsx | var React = require('react/addons'),
PureRenderMixin = React.addons.PureRenderMixin
var DialogPart = React.createClass({
mixins: [PureRenderMixin],
propTypes: {
type: React.PropTypes.oneOf(['header', 'body', 'footer'])
},
render: function () {
return (
<div className={`dialog-${this.props.type}`}>
{this.props.children}
</div>
)
}
})
module.exports = DialogPart
| var cn = require('classnames')
var React = require('react/addons')
var PureRenderMixin = React.addons.PureRenderMixin
var DialogPart = React.createClass({
mixins: [PureRenderMixin],
propTypes: {
type: React.PropTypes.oneOf(['header', 'body', 'footer']).isRequired,
className: React.PropTypes.string
},
render: function () {
return (
<div className={cn(`dialog-${this.props.type}`, this.props.className)}>
{this.props.children}
</div>
)
}
})
module.exports = DialogPart
| Add className to dialog part | Add className to dialog part
| JSX | apache-2.0 | cesarandreu/bshed,cesarandreu/bshed | ---
+++
@@ -1,16 +1,18 @@
-var React = require('react/addons'),
- PureRenderMixin = React.addons.PureRenderMixin
+var cn = require('classnames')
+var React = require('react/addons')
+var PureRenderMixin = React.addons.PureRenderMixin
var DialogPart = React.createClass({
mixins: [PureRenderMixin],
propTypes: {
- type: React.PropTypes.oneOf(['header', 'body', 'footer'])
+ type: React.PropTypes.oneOf(['header', 'body', 'footer']).isRequired,
+ className: React.PropTypes.string
},
render: function () {
return (
- <div className={`dialog-${this.props.type}`}>
+ <div className={cn(`dialog-${this.props.type}`, this.props.className)}>
{this.props.children}
</div>
) |
7f45f304ee27433a0be791d4311660d9568b2349 | client/app/bundles/RentersRights/components/resources/ResourceIndexItem.jsx | client/app/bundles/RentersRights/components/resources/ResourceIndexItem.jsx | import React from 'react';
export default class ResourceIndexItem extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
organization,
phone,
email,
website,
region,
description,
address,
} = this.props.resource;
const homeSize = {fontSize: '2px'}; // for some reason is default to 750%
return (
<div>
<a href={website} target="_blank"><h3>{organization}</h3></a>
<p>{description}</p>
<p>Contact: </p>
<p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
<p><span style={homeSize}className="glyphicon glyphicon-home"></span> Address: {address}</p>
</div>
)
}
}
| import React from 'react';
export default class ResourceIndexItem extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
organization,
phone,
email,
website,
region,
description,
address,
} = this.props.resource;
const homeSize = {fontSize: '2px'}; // for some reason is default to 750%
return (
<div>
<a href={website} target="_blank">
<h3>{organization}</h3>
</a>
<p>{description}</p>
<p>Contact: </p>
<p>
<span className="glyphicon glyphicon-earphone">
</span> Phone: {phone}
</p>
<p>
<span style={homeSize}className="glyphicon glyphicon-home">
</span> Address: {address}
</p>
</div>
)
}
}
| Clean up resource index item render | Clean up resource index item render
| JSX | mit | codeforsanjose/renters-rights,codeforsanjose/renters-rights,codeforsanjose/renters-rights | ---
+++
@@ -19,11 +19,19 @@
return (
<div>
- <a href={website} target="_blank"><h3>{organization}</h3></a>
+ <a href={website} target="_blank">
+ <h3>{organization}</h3>
+ </a>
<p>{description}</p>
<p>Contact: </p>
- <p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
- <p><span style={homeSize}className="glyphicon glyphicon-home"></span> Address: {address}</p>
+ <p>
+ <span className="glyphicon glyphicon-earphone">
+ </span> Phone: {phone}
+ </p>
+ <p>
+ <span style={homeSize}className="glyphicon glyphicon-home">
+ </span> Address: {address}
+ </p>
</div>
)
} |
d1539efe596e9b957b37e5d76d302df21f2a3a7a | app/components/Caveats.jsx | app/components/Caveats.jsx | import React from 'react';
import GenericContent from './GenericContent';
export default class Caveats extends React.Component {
componentDidMount() {
const script = document.createElement("script");
script.src = "//cdn.jsdelivr.net/caniuse-embed/1.0.1/caniuse-embed.min.js";
document.body.appendChild(script);
}
render() {
const {mainClass, links, mark} = this.props.route;
return (
<GenericContent route={{mainClass, links, mark}}/>
);
}
}
| import React from 'react';
import GenericContent from './GenericContent';
export default class Caveats extends React.Component {
componentDidMount() {
const script = document.createElement("script");
script.id = "caniuse-embed";
script.src = "//cdn.jsdelivr.net/caniuse-embed/1.0.1/caniuse-embed.min.js";
const oldScript = document.getElementById("caniuse-embed");
if(oldScript) {
oldScript.parentNode.replaceChild(script, oldScript);
} else {
document.body.appendChild(script);
}
}
render() {
const {mainClass, links, mark} = this.props.route;
return (
<GenericContent route={{mainClass, links, mark}}/>
);
}
}
| Fix adding new <script> to execute caniuse embed on each load | fix(caveats-page): Fix adding new <script> to execute caniuse embed on each load
| JSX | mit | Velenir/workers-journey,Velenir/workers-journey | ---
+++
@@ -5,8 +5,16 @@
export default class Caveats extends React.Component {
componentDidMount() {
const script = document.createElement("script");
+ script.id = "caniuse-embed";
script.src = "//cdn.jsdelivr.net/caniuse-embed/1.0.1/caniuse-embed.min.js";
- document.body.appendChild(script);
+
+ const oldScript = document.getElementById("caniuse-embed");
+
+ if(oldScript) {
+ oldScript.parentNode.replaceChild(script, oldScript);
+ } else {
+ document.body.appendChild(script);
+ }
}
render() { |
bc886d86067ff138d512d6759a32b67c77607b72 | application/jsx/account/change-email.jsx | application/jsx/account/change-email.jsx | /** @jsx React.DOM */
define([
'react',
'models/change-email',
'templates/mixins/navigate'
], function(
React,
ChangeEmailModel,
NavigateMixin
) {
return React.createClass({
displayName : 'ChangeEmailModule',
mixins : [NavigateMixin],
handleSubmit : function(event) {
event.preventDefault();
var currentPassword = this.refs.current_password.getDOMNode().value.trim();
var newEmail = this.refs.email.getDOMNode().value.trim();
this.props.user.save({
current_password : currentPassword,
email : newEmail
});
},
render : function() {
return (
<form onSubmit={this.handleSubmit}>
<label htmlFor="current_password">Current password:</label>
<input type="password" name="current_password" ref="current_password" />
<label htmlFor="email">New email:</label>
<input type="text" name="email" ref="email" />
<input type="submit" value="Submit" />
<a href="/" onClick={this.navigate}>Back</a>
</form>
);
}
});
});
| /** @jsx React.DOM */
define([
'react',
'templates/mixins/navigate'
], function(
React,
NavigateMixin
) {
return React.createClass({
displayName : 'ChangeEmailModule',
mixins : [NavigateMixin],
handleSubmit : function(event) {
event.preventDefault();
var currentPassword = this.refs.current_password.getDOMNode().value.trim();
var newEmail = this.refs.email.getDOMNode().value.trim();
this.props.user.save({
current_password : currentPassword,
email : newEmail
});
},
render : function() {
return (
<form onSubmit={this.handleSubmit}>
<label htmlFor="current_password">Current password:</label>
<input type="password" name="current_password" ref="current_password" />
<label htmlFor="email">New email:</label>
<input type="text" name="email" ref="email" />
<input type="submit" value="Submit" />
<a href="/" onClick={this.navigate}>Back</a>
</form>
);
}
});
});
| Remove dependency on nonexistent file. | Remove dependency on nonexistent file.
| JSX | mit | dcpages/dcLibrary-Template,areida/spacesynter,dcpages/dcLibrary-Template,areida/spacesynter,areida/spacesynter,areida/spacesynter,areida/spacesynter | ---
+++
@@ -1,11 +1,9 @@
/** @jsx React.DOM */
define([
'react',
- 'models/change-email',
'templates/mixins/navigate'
], function(
React,
- ChangeEmailModel,
NavigateMixin
) {
|
44337117427bd1566d9aec4a8d423a8cc093f97b | kanban_app/app/index.jsx | kanban_app/app/index.jsx | import './main.css';
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import App from './containers/App.jsx';
import configureStore from './store/configureStore';
import storage from './libs/storage';
const APP_STORAGE = 'app';
const store = configureStore(storage.get(APP_STORAGE) || {});
store.subscribe(() => {
if(!storage.get('debug')) {
storage.set(APP_STORAGE, store.getState());
}
});
ReactDOM.render(
<Provider store={store}><App /></Provider>,
document.getElementById('app')
);
| import './main.css';
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import App from './containers/App.jsx';
import configureStore from './store/configureStore';
import storage from './libs/storage';
const APP_STORAGE = 'redux_kanban';
const store = configureStore(storage.get(APP_STORAGE) || {});
store.subscribe(() => {
if(!storage.get('debug')) {
storage.set(APP_STORAGE, store.getState());
}
});
ReactDOM.render(
<Provider store={store}><App /></Provider>,
document.getElementById('app')
);
| Use `redux_kanban` as app storage | Use `redux_kanban` as app storage
This way it doesn't conflict with other implementations so easily.
| JSX | mit | survivejs-demos/redux-demo,survivejs/redux-demo | ---
+++
@@ -7,7 +7,7 @@
import configureStore from './store/configureStore';
import storage from './libs/storage';
-const APP_STORAGE = 'app';
+const APP_STORAGE = 'redux_kanban';
const store = configureStore(storage.get(APP_STORAGE) || {});
|
e6eee46fdba507376b79e5c9ec8ce582c975b213 | src/shell/components/shell-view.jsx | src/shell/components/shell-view.jsx | var React = require('react'),
glimpse = require('glimpse');
module.exports = React.createClass({
_applicationAdded: function() {
this.forceUpdate();
},
componentDidMount: function() {
this._applicationAddedOn = glimpse.on('shell.application.added', this._applicationAdded);
},
componentWillUnmount: function() {
glimpse.off(this._applicationAddedOn);
},
render: function() {
return (
<div className="application-holder">
{this.props.applications}
</div>
);
}
});
| var React = require('react'),
glimpse = require('glimpse'),
EmitterMixin = require('../../lib/components/emitter-mixin.jsx');
module.exports = React.createClass({
mixins: [ EmitterMixin ],
componentDidMount: function() {
this.addListener('shell.application.added', this._applicationAdded);
},
render: function() {
return (
<div className="application-holder">
{this.props.applications}
</div>
);
},
_applicationAdded: function() {
this.forceUpdate();
}
});
| Switch shell view over to using event emitter mixin | Switch shell view over to using event emitter mixin
| JSX | unknown | avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype | ---
+++
@@ -1,15 +1,11 @@
var React = require('react'),
- glimpse = require('glimpse');
+ glimpse = require('glimpse'),
+ EmitterMixin = require('../../lib/components/emitter-mixin.jsx');
module.exports = React.createClass({
- _applicationAdded: function() {
- this.forceUpdate();
- },
+ mixins: [ EmitterMixin ],
componentDidMount: function() {
- this._applicationAddedOn = glimpse.on('shell.application.added', this._applicationAdded);
- },
- componentWillUnmount: function() {
- glimpse.off(this._applicationAddedOn);
+ this.addListener('shell.application.added', this._applicationAdded);
},
render: function() {
return (
@@ -17,5 +13,8 @@
{this.props.applications}
</div>
);
+ },
+ _applicationAdded: function() {
+ this.forceUpdate();
}
}); |
cae6acaa93ffc585cd58bb85ad3a6b11f4ce0011 | client/src/components/houseInventory.jsx | client/src/components/houseInventory.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import HouseInventoryList from './HouseInventoryList.jsx';
import Nav from './Nav.jsx';
import AddItem from './AddItem.jsx';
class HouseInventory extends React.Component {
constructor(props) {
super(props);
this.state = {
items: [],
houseId: 1, // dummy value for now, will use cookies in future
userId: 4
};
}
componentDidMount() {
this.getItems(this.updateItems.bind(this));
}
getItems(callback) {
axios.post('/inventory', { houseId: this.state.houseId })
.then(res => {
console.log('Successful GET request - house inventory items retrieved: ', res.data);
callback(res.data);
})
.catch(err => console.log('Unable to GET house inventory items: ', err));
}
updateItems(data) {
this.setState({
items: data
});
}
render() {
return (
<div>
<Nav />
<h1>House Inventory</h1>
<AddItem houseId={this.state.houseId}/>
<HouseInventoryList items={this.state.items} userId={this.state.userId} />
</div>
);
}
}
export default HouseInventory;
| import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import HouseInventoryList from './HouseInventoryList.jsx';
import Nav from './Nav.jsx';
import AddItem from './AddItem.jsx';
class HouseInventory extends React.Component {
constructor(props) {
super(props);
this.state = {
items: [],
houseId: 1, // dummy value for now, will use cookies in future
userId: 4,
page: 'inventory'
};
}
componentDidMount() {
this.getItems(this.updateItems.bind(this));
}
getItems(callback) {
axios.post('/inventory', { houseId: this.state.houseId })
.then(res => {
console.log('Successful GET request - house inventory items retrieved: ', res.data);
callback(res.data);
})
.catch(err => console.log('Unable to GET house inventory items: ', err));
}
updateItems(data) {
this.setState({
items: data
});
}
render() {
return (
<div>
<Nav page={this.state.page}/>
<h1>House Inventory</h1>
<AddItem houseId={this.state.houseId}/>
<HouseInventoryList items={this.state.items} userId={this.state.userId} />
</div>
);
}
}
export default HouseInventory;
| Add state to propogate to Nav bar | Add state to propogate to Nav bar
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -12,7 +12,8 @@
this.state = {
items: [],
houseId: 1, // dummy value for now, will use cookies in future
- userId: 4
+ userId: 4,
+ page: 'inventory'
};
}
@@ -38,7 +39,7 @@
render() {
return (
<div>
- <Nav />
+ <Nav page={this.state.page}/>
<h1>House Inventory</h1>
<AddItem houseId={this.state.houseId}/>
<HouseInventoryList items={this.state.items} userId={this.state.userId} /> |
bb28a3e59151ab4b869ce8fa19c7f5ce4d37f84c | src/request/components/request-view.jsx | src/request/components/request-view.jsx | var React = require('react'),
Session = require('./request-session-view.js'),
Filter = require('./request-filter-view.js'),
Entry = require('./request-entry-view.js');
module.exports = React.createClass({
render: function() {
return (
<div className="row">
<div className="col-md-2 request-session-holder-outter">
<Session />
</div>
<div className="col-md-7 request-entry-holder-outter">
<Entry />
</div>
<div className="col-md-3 request-filter-holder-outter">
<Filter />
</div>
</div>
);
}
});
| var React = require('react'),
Session = require('./request-session-view.js'),
Filter = require('./request-filter-view.js'),
Entry = require('./request-entry-view.js');
module.exports = React.createClass({
render: function() {
return (
<div className="row">
<div className="col-md-2 request-session-holder-outer">
<Session />
</div>
<div className="col-md-7 request-entry-holder-outer">
<Entry />
</div>
<div className="col-md-3 request-filter-holder-outer">
<Filter />
</div>
</div>
);
}
});
| Fix up typeo in class names | Fix up typeo in class names
| JSX | unknown | Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype | ---
+++
@@ -7,13 +7,13 @@
render: function() {
return (
<div className="row">
- <div className="col-md-2 request-session-holder-outter">
+ <div className="col-md-2 request-session-holder-outer">
<Session />
</div>
- <div className="col-md-7 request-entry-holder-outter">
+ <div className="col-md-7 request-entry-holder-outer">
<Entry />
</div>
- <div className="col-md-3 request-filter-holder-outter">
+ <div className="col-md-3 request-filter-holder-outer">
<Filter />
</div>
</div> |
4abaa7e137e60105f025b13e71a704705507ab0d | src/sentry/static/sentry/app/locale.jsx | src/sentry/static/sentry/app/locale.jsx | import Jed from 'jed';
const i18n = new Jed({
'domain' : 'sentry',
// This callback is called when a key is missing
'missing_key_callback' : function(key) {
// TODO(dcramer): this should log to Sentry
},
'locale_data' : {
// This is the domain key
'sentry' : {
// The empty string key is used as the configuration
// block for each domain
'' : {
// Domain name
'domain' : 'sentry',
// Language code
'lang' : 'en',
// Plural form function for language
'plural_forms' : 'nplurals=2; plural=(n != 1);'
},
}
}
});
export const gettext = i18n.gettext.bind(i18n);
export const ngettext = i18n.ngettext.bind(i18n);
export const t = i18n.gettext.bind(i18n);
export const tn = i18n.ngettext.bind(i18n);
export default i18n;
| import Jed from 'jed';
import { getTranslations } from './translations';
const i18n = new Jed({
'domain' : 'sentry',
// This callback is called when a key is missing
'missing_key_callback' : function(key) {
// TODO(dcramer): this should log to Sentry
},
'locale_data': {
// XXX: configure language here
'sentry': getTranslations('en')
}
});
export const gettext = i18n.gettext.bind(i18n);
export const ngettext = i18n.ngettext.bind(i18n);
export const t = i18n.gettext.bind(i18n);
export const tn = i18n.ngettext.bind(i18n);
export default i18n;
| Load translations in i18n module | Load translations in i18n module
| JSX | bsd-3-clause | JamesMura/sentry,mitsuhiko/sentry,ifduyue/sentry,jean/sentry,jean/sentry,daevaorn/sentry,looker/sentry,mvaled/sentry,ifduyue/sentry,gencer/sentry,JamesMura/sentry,jean/sentry,looker/sentry,JamesMura/sentry,ifduyue/sentry,gencer/sentry,daevaorn/sentry,ifduyue/sentry,mvaled/sentry,jean/sentry,JackDanger/sentry,gencer/sentry,mvaled/sentry,daevaorn/sentry,fotinakis/sentry,looker/sentry,daevaorn/sentry,BuildingLink/sentry,fotinakis/sentry,nicholasserra/sentry,beeftornado/sentry,BuildingLink/sentry,beeftornado/sentry,zenefits/sentry,JamesMura/sentry,mvaled/sentry,looker/sentry,looker/sentry,ifduyue/sentry,fotinakis/sentry,gencer/sentry,alexm92/sentry,mvaled/sentry,jean/sentry,zenefits/sentry,JackDanger/sentry,BuildingLink/sentry,zenefits/sentry,zenefits/sentry,beeftornado/sentry,nicholasserra/sentry,zenefits/sentry,alexm92/sentry,JackDanger/sentry,mitsuhiko/sentry,JamesMura/sentry,gencer/sentry,mvaled/sentry,alexm92/sentry,fotinakis/sentry,nicholasserra/sentry,BuildingLink/sentry,BuildingLink/sentry | ---
+++
@@ -1,4 +1,5 @@
import Jed from 'jed';
+import { getTranslations } from './translations';
const i18n = new Jed({
'domain' : 'sentry',
@@ -8,22 +9,9 @@
// TODO(dcramer): this should log to Sentry
},
- 'locale_data' : {
- // This is the domain key
- 'sentry' : {
- // The empty string key is used as the configuration
- // block for each domain
- '' : {
- // Domain name
- 'domain' : 'sentry',
-
- // Language code
- 'lang' : 'en',
-
- // Plural form function for language
- 'plural_forms' : 'nplurals=2; plural=(n != 1);'
- },
- }
+ 'locale_data': {
+ // XXX: configure language here
+ 'sentry': getTranslations('en')
}
});
|
ef7a27946d74666d2a2ed80dae371241359ce521 | app/app/components/navbar/NavLinks.jsx | app/app/components/navbar/NavLinks.jsx | import React from 'react';
import {Link} from 'react-router'
import auth from '../../utils/auth.jsx'
export default class NavLinks extends React.Component {
handleClick(e){
$('.active').removeClass('active')
e.target.className = 'active';
}
render(){
return (
<div>
<li onClick={this.handleClick.bind(this)}><Link to="/">Home</Link></li>
{if (auth.loggedIn()){}
<LoggedIn handleClick={this.handleClick} />
{}} else {}
<NotLoggedIn handleClick={this.handleClick} />
{}}
</div>
)
}
}
class NotLoggedIn extends React.Component {
render(){
return(
<div>
<li onClick={this.props.handleClick}><Link to="/users/new">Sign Up</Link></li>
<li onClick={this.props.handleClick}><Link to="/serfs/new">Become A Serf</Link></li>
<li onClick={this.props.handleClick}><Link to="/sessions/new">Log In</Link></li>
</div>
)
}
}
class LoggedIn extends React.Component {
render(){
return(
<div>
<li onClick={auth.logout()}><Link to="/">
Log Out</Link>
</li>
</div>
)
}
}
| import React from 'react';
import {Link} from 'react-router'
import auth from '../../utils/auth.jsx'
export default class NavLinks extends React.Component {
handleClick(e){
$('.active').removeClass('active')
e.target.className = 'active';
}
render(){
if (auth.loggedIn()){
return <LoggedIn handleClick={this.handleClick} />
} else {
return <NotLoggedIn handleClick={this.handleClick} />
}
}
}
class NotLoggedIn extends React.Component {
render(){
return(
<ul className="nav navbar-nav">
<li onClick={this.props.handleClick}><Link to="/">Home</Link></li>
<li onClick={this.props.handleClick}><Link to="/users/new">Sign Up</Link></li>
<li onClick={this.props.handleClick}><Link to="/serfs/new">Become A Serf</Link></li>
<li onClick={this.props.handleClick}><Link to="/sessions/new">Log In</Link></li>
</ul>
)
}
}
class LoggedIn extends React.Component {
render(){
return(
<ul className="nav navbar-nav">
<li onClick={this.handleClick}><Link to="/">Home</Link></li>
<li onClick={auth.logout}><Link to="/">
Log Out</Link>
</li>
</ul>
)
}
}
| Add proper formatting for nav links | Add proper formatting for nav links
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | ---
+++
@@ -8,27 +8,25 @@
e.target.className = 'active';
}
render(){
- return (
- <div>
- <li onClick={this.handleClick.bind(this)}><Link to="/">Home</Link></li>
- {if (auth.loggedIn()){}
- <LoggedIn handleClick={this.handleClick} />
- {}} else {}
- <NotLoggedIn handleClick={this.handleClick} />
- {}}
- </div>
- )
+ if (auth.loggedIn()){
+ return <LoggedIn handleClick={this.handleClick} />
+ } else {
+ return <NotLoggedIn handleClick={this.handleClick} />
+ }
}
-}
+}
+
+
class NotLoggedIn extends React.Component {
render(){
return(
- <div>
+ <ul className="nav navbar-nav">
+ <li onClick={this.props.handleClick}><Link to="/">Home</Link></li>
<li onClick={this.props.handleClick}><Link to="/users/new">Sign Up</Link></li>
<li onClick={this.props.handleClick}><Link to="/serfs/new">Become A Serf</Link></li>
<li onClick={this.props.handleClick}><Link to="/sessions/new">Log In</Link></li>
- </div>
+ </ul>
)
}
}
@@ -37,11 +35,12 @@
class LoggedIn extends React.Component {
render(){
return(
- <div>
- <li onClick={auth.logout()}><Link to="/">
+ <ul className="nav navbar-nav">
+ <li onClick={this.handleClick}><Link to="/">Home</Link></li>
+ <li onClick={auth.logout}><Link to="/">
Log Out</Link>
</li>
- </div>
+ </ul>
)
}
} |
0479a24758fa8318b40b37e7c9497b01faf242b0 | src/main/webapp/resources/js/pages/projects/linelist/components/TableControlPanel/TemplatesPanel/TemplatesPanel.jsx | src/main/webapp/resources/js/pages/projects/linelist/components/TableControlPanel/TemplatesPanel/TemplatesPanel.jsx | import React from "react";
import PropTypes from "prop-types";
import ImmutablePropTypes from "react-immutable-proptypes";
import { SaveTemplateModal } from "./SaveTemplateModal";
import { TemplateSelect } from "../../TemplateSelect/index";
/**
* This component is responsible for rendering all components that handle
* user interaction with selecting and saving templates.
*/
export class TemplatesPanel extends React.Component {
state = {
visible: false // If the save template modal is visible
};
closeModal = () => {
this.setState({ visible: false });
};
showSaveModal = () => {
this.setState({ visible: true });
};
constructor(props) {
super(props);
}
render() {
const { templates, current } = this.props;
const template =
typeof templates.get(current) === "undefined"
? undefined
: templates.get(current).toJS();
return (
<div
style={{
height: 75,
borderBottom: "1px solid rgba(189, 195, 199, 1.00)",
padding: "1rem"
}}
>
<TemplateSelect {...this.props} showSaveModal={this.showSaveModal} />
<SaveTemplateModal
template={template}
visible={this.state.visible}
onClose={this.closeModal}
{...this.props}
/>
</div>
);
}
}
TemplatesPanel.propTypes = {
current: PropTypes.number.isRequired,
saveTemplate: PropTypes.func.isRequired,
templates: ImmutablePropTypes.list.isRequired,
modified: PropTypes.object
};
| import React from "react";
import PropTypes from "prop-types";
import ImmutablePropTypes from "react-immutable-proptypes";
import { SaveTemplateModal } from "./SaveTemplateModal";
import { TemplateSelect } from "./TemplateSelect/TemplateSelect";
/**
* This component is responsible for rendering all components that handle
* user interaction with selecting and saving templates.
*/
export class TemplatesPanel extends React.Component {
state = {
visible: false // If the save template modal is visible
};
closeModal = () => {
this.setState({ visible: false });
};
showSaveModal = () => {
this.setState({ visible: true });
};
constructor(props) {
super(props);
}
render() {
const { templates, current } = this.props;
const template =
typeof templates.get(current) === "undefined"
? undefined
: templates.get(current).toJS();
return (
<div
style={{
height: 75,
borderBottom: "1px solid rgba(189, 195, 199, 1.00)",
padding: "1rem"
}}
>
<TemplateSelect {...this.props} showSaveModal={this.showSaveModal} />
<SaveTemplateModal
template={template}
visible={this.state.visible}
onClose={this.closeModal}
{...this.props}
/>
</div>
);
}
}
TemplatesPanel.propTypes = {
current: PropTypes.number.isRequired,
saveTemplate: PropTypes.func.isRequired,
templates: ImmutablePropTypes.list.isRequired,
modified: PropTypes.object
};
| Fix path to template select | Fix path to template select
| 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 | ---
+++
@@ -2,7 +2,7 @@
import PropTypes from "prop-types";
import ImmutablePropTypes from "react-immutable-proptypes";
import { SaveTemplateModal } from "./SaveTemplateModal";
-import { TemplateSelect } from "../../TemplateSelect/index";
+import { TemplateSelect } from "./TemplateSelect/TemplateSelect";
/**
* This component is responsible for rendering all components that handle |
c4b42e15b72408ce5b9c45c15f44c71c2393afc2 | src/components/Navigation/Navigation.jsx | src/components/Navigation/Navigation.jsx | import React, { Component } from "react";
import Button from "react-md/lib/Buttons";
import NavigationDrawer from "react-md/lib/NavigationDrawers";
import ToolbarActions from "../ToolbarActions/ToolbarActions";
import Footer from "../Footer/Footer";
import GetNavList from "./NavList";
import "./Navigation.scss";
class Navigation extends Component {
render() {
const { children, config } = this.props;
return (
<NavigationDrawer
toolbarThemeType="themed"
toolbarTitleMenu={<a ref="logo" href="/"><img src="/logos/logo.svg"/></a>}
toolbarActions={<ToolbarActions config={config} />}
desktopDrawerType={NavigationDrawer.DrawerTypes.FULL_HEIGHT}
navItems={GetNavList(config)}
>
<div className="main-container">
{children}
</div>
<Footer />
</NavigationDrawer>
);
}
}
export default Navigation;
| import React, { Component } from "react";
import Button from "react-md/lib/Buttons";
import NavigationDrawer from "react-md/lib/NavigationDrawers";
import ToolbarActions from "../ToolbarActions/ToolbarActions";
import Footer from "../Footer/Footer";
import GetNavList from "./NavList";
import "./Navigation.scss";
class Navigation extends Component {
render() {
const { children, config } = this.props;
return (
<NavigationDrawer
toolbarThemeType="themed"
toolbarTitleMenu={<a ref="logo" href="/"><img src="/logos/logo.svg"/></a>}
toolbarActions={<ToolbarActions config={config} />}
desktopDrawerType={NavigationDrawer.DrawerTypes.TEMPORARY}
navItems={GetNavList(config)}
>
<div className="main-container">
{children}
</div>
<Footer />
</NavigationDrawer>
);
}
}
export default Navigation;
| Fix drawer open by default | Fix drawer open by default
| JSX | mit | tadeuzagallo/verve-website | ---
+++
@@ -15,7 +15,7 @@
toolbarThemeType="themed"
toolbarTitleMenu={<a ref="logo" href="/"><img src="/logos/logo.svg"/></a>}
toolbarActions={<ToolbarActions config={config} />}
- desktopDrawerType={NavigationDrawer.DrawerTypes.FULL_HEIGHT}
+ desktopDrawerType={NavigationDrawer.DrawerTypes.TEMPORARY}
navItems={GetNavList(config)}
>
<div className="main-container"> |
998d6ba48e7ab3d03a19647fef3a71e4400ce48e | src/js/popup/components/Header.react.jsx | src/js/popup/components/Header.react.jsx | import React from 'react';
export default class Header extends React.Component {
/*
* Handle onClick event with header image. The current window will be changed to the fokus home page.
*/
static fokusTab() {
window.open('/src/html/home.html').focus();
}
constructor(props) {
super(props);
}
render() {
return (
<div className='fokus-link'>
<img src='/png/fokus_title_128.png' alt='fokus' onClick={Header.fokusTab} />
</div>
);
}
}
| import React from 'react';
export default class Header extends React.Component {
/*
* Handle onClick event with header image. The current window will be changed to the fokus home page.
*/
static fokusTab() {
window.open('/src/html/home.html').focus();
}
render() {
return (
<div className='fokus-link'>
<img src='/png/fokus_title_128.png' alt='fokus' onClick={Header.fokusTab} />
</div>
);
}
}
| Remove unnecessary constructor from Header | Remove unnecessary constructor from Header
| JSX | mit | williamgrosset/fokus,williamgrosset/fokus,williamgrosset/fokus | ---
+++
@@ -9,10 +9,6 @@
window.open('/src/html/home.html').focus();
}
- constructor(props) {
- super(props);
- }
-
render() {
return (
<div className='fokus-link'> |
5ba0cd68a8bf679be4eb6c7782787954b6a178d8 | src/pages/components/ParticipantEdit.jsx | src/pages/components/ParticipantEdit.jsx | import React from 'react';
import Container from '../../components/Container';
import Message from '../../containers/Message';
import ParticipantEditForm from '../../participants/containers/ParticipantEditForm';
const ParticipantEdit = () => (
<Container>
<h1><Message name="participants.changePersonalInformation" /></h1>
<ParticipantEditForm />
</Container>
);
ParticipantEdit.propTypes = {
};
export default ParticipantEdit;
| import Breadcrumb from 'reactstrap/lib/Breadcrumb';
import BreadcrumbItem from 'reactstrap/lib/BreadcrumbItem';
import React from 'react';
import Col from 'reactstrap/lib/Col';
import Row from 'reactstrap/lib/Row';
import Container from '../../components/Container';
import Link from '../../containers/Link';
import Message from '../../containers/Message';
import ParticipantEditForm from '../../participants/containers/ParticipantEditForm';
const ParticipantEdit = () => (
<Container>
<h1><Message name="participants.changePersonalInformation" /></h1>
<Row>
<Col md={{ offset: 3, size: 6 }}>
<ParticipantEditForm />
</Col>
</Row>
<Breadcrumb>
<BreadcrumbItem>
<Link to="participantHome">
<Message name="participants.home" />
</Link>
</BreadcrumbItem>
<BreadcrumbItem active>
<Message name="participants.changePersonalInformation" />
</BreadcrumbItem>
</Breadcrumb>
</Container>
);
ParticipantEdit.propTypes = {
};
export default ParticipantEdit;
| Make Participant edit page narrow | Make Participant edit page narrow
| JSX | mit | just-paja/improtresk-web,just-paja/improtresk-web | ---
+++
@@ -1,13 +1,32 @@
+import Breadcrumb from 'reactstrap/lib/Breadcrumb';
+import BreadcrumbItem from 'reactstrap/lib/BreadcrumbItem';
import React from 'react';
+import Col from 'reactstrap/lib/Col';
+import Row from 'reactstrap/lib/Row';
import Container from '../../components/Container';
+import Link from '../../containers/Link';
import Message from '../../containers/Message';
import ParticipantEditForm from '../../participants/containers/ParticipantEditForm';
const ParticipantEdit = () => (
<Container>
<h1><Message name="participants.changePersonalInformation" /></h1>
- <ParticipantEditForm />
+ <Row>
+ <Col md={{ offset: 3, size: 6 }}>
+ <ParticipantEditForm />
+ </Col>
+ </Row>
+ <Breadcrumb>
+ <BreadcrumbItem>
+ <Link to="participantHome">
+ <Message name="participants.home" />
+ </Link>
+ </BreadcrumbItem>
+ <BreadcrumbItem active>
+ <Message name="participants.changePersonalInformation" />
+ </BreadcrumbItem>
+ </Breadcrumb>
</Container>
);
|
b3ca399af2ebff09be7444851741df33ef4cd551 | src/react-chayns-tapp_portal/component/TappPortal.jsx | src/react-chayns-tapp_portal/component/TappPortal.jsx | import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
const TappPortal = ({ children, parent }) => createPortal(
children,
parent || document.getElementsByClassName('tapp')[0] || document.body,
);
TappPortal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
parent: PropTypes.instanceOf(Element),
};
export default TappPortal;
| import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
const defaultParent = document.getElementsByClassName('tapp')[0] || document.body;
let destroyed = false;
const TappPortal = ({ children, parent }) => {
const parentUsed = document.getElementsByClassName('tapp')[0] || document.body;
if (!parent && parentUsed !== defaultParent) {
destroyed = true;
}
if (!parent && destroyed) {
return null;
}
return createPortal(
children,
parent || parentUsed,
);
};
TappPortal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
parent: PropTypes.instanceOf(Element),
};
export default TappPortal;
| Fix bug that tappPortal renders into different dom nodes | :bug: Fix bug that tappPortal renders into different dom nodes
| JSX | mit | TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components | ---
+++
@@ -1,10 +1,25 @@
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
-const TappPortal = ({ children, parent }) => createPortal(
- children,
- parent || document.getElementsByClassName('tapp')[0] || document.body,
-);
+const defaultParent = document.getElementsByClassName('tapp')[0] || document.body;
+let destroyed = false;
+
+const TappPortal = ({ children, parent }) => {
+ const parentUsed = document.getElementsByClassName('tapp')[0] || document.body;
+
+ if (!parent && parentUsed !== defaultParent) {
+ destroyed = true;
+ }
+
+ if (!parent && destroyed) {
+ return null;
+ }
+
+ return createPortal(
+ children,
+ parent || parentUsed,
+ );
+};
TappPortal.propTypes = {
children: PropTypes.oneOfType([ |
2a688afb4cefe436c09e2e170129edb8631bc32e | src/components/ChartBench.jsx | src/components/ChartBench.jsx | import {HotKeys} from "react-hotkeys"
import Chart from "../containers/Chart"
import EditToolbar from "../containers/EditToolbar"
const ChartBench = ({
chordA,
chordB,
chordC,
chordD,
chordE,
chordF,
chordG,
moveLeft,
moveRight,
redo,
slug,
title,
undo,
width,
}) => (
<article style={{marginBottom: 60}}>
<h1 id={slug}>
<a href={"#" + slug} style={{textDecoration: "none"}} title="Anchor"></a>
{" "}
{title}
<small>
{" "}
</small>
</h1>
<EditToolbar chartSlug={slug} />
<HotKeys
handlers={{
chordA,
chordB,
chordC,
chordD,
chordE,
chordF,
chordG,
moveLeft,
moveRight,
redo,
undo,
}}
>
<Chart slug={slug} width={width} />
</HotKeys>
</article>
)
export default ChartBench
| import {HotKeys} from "react-hotkeys"
import Chart from "../containers/Chart"
import EditToolbar from "../containers/EditToolbar"
const ChartBench = ({
chordA,
chordB,
chordC,
chordD,
chordE,
chordF,
chordG,
moveLeft,
moveRight,
redo,
slug,
title,
undo,
width,
}) => (
<article style={{marginBottom: 60}}>
<h1 id={slug}>
<a href={"#" + slug} style={{textDecoration: "none"}} title="Anchor"></a>
{" "}
{title}
<small>
{" "}
</small>
</h1>
<HotKeys
handlers={{
chordA,
chordB,
chordC,
chordD,
chordE,
chordF,
chordG,
moveLeft,
moveRight,
redo,
undo,
}}
>
<EditToolbar chartSlug={slug} />
<Chart slug={slug} width={width} />
</HotKeys>
</article>
)
export default ChartBench
| Enable key shortcuts when toolbar is focused | Enable key shortcuts when toolbar is focused
| JSX | agpl-3.0 | openchordcharts/openchordcharts-sample-data,openchordcharts/openchordcharts-sample-data,openchordcharts/sample-data,openchordcharts/sample-data | ---
+++
@@ -29,7 +29,6 @@
{" "}
</small>
</h1>
- <EditToolbar chartSlug={slug} />
<HotKeys
handlers={{
chordA,
@@ -45,6 +44,7 @@
undo,
}}
>
+ <EditToolbar chartSlug={slug} />
<Chart slug={slug} width={width} />
</HotKeys>
</article> |
8976ccb8b75ae09b77bc84bd10c66fbcdbdebc5b | app/javascript/app/pages/sectors/sectors-component.jsx | app/javascript/app/pages/sectors/sectors-component.jsx | import React, { PureComponent } from 'react';
import sectorsScreenshot from 'assets/screenshots/sectors-screenshot';
import Teaser from 'components/teaser';
class Sectors extends PureComponent {
// eslint-disable-line react/prefer-stateless-function
render() {
return (
<Teaser
screenshot={sectorsScreenshot}
title="Explore the sectoral cuts"
description="Text to change: Check each the sectoral cuts lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
/>
);
}
}
export default Sectors;
| import React, { PureComponent } from 'react';
import sectorsScreenshot from 'assets/screenshots/sectors-screenshot';
import Teaser from 'components/teaser';
class Sectors extends PureComponent {
// eslint-disable-line react/prefer-stateless-function
render() {
return (
<Teaser
screenshot={sectorsScreenshot}
title="Explore Different Sectors"
description="A breakdown of historical greenhouse gas (GHG) emissions by economic sector. Explore by country and global shares, and use it to dive into future sector emissions projections."
/>
);
}
}
export default Sectors;
| Update content of sectoral sectors | Update content of sectoral sectors
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -8,8 +8,8 @@
return (
<Teaser
screenshot={sectorsScreenshot}
- title="Explore the sectoral cuts"
- description="Text to change: Check each the sectoral cuts lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
+ title="Explore Different Sectors"
+ description="A breakdown of historical greenhouse gas (GHG) emissions by economic sector. Explore by country and global shares, and use it to dive into future sector emissions projections."
/>
);
} |
89c4958b9c397c598f24d3dd91ec34c6347bcc55 | frontend/course-form.jsx | frontend/course-form.jsx | import React from 'react'
import ReactDOM from 'react-dom'
import KeywordInput from './components/keyword-input'
import TopicInput from './components/topic-input'
const element = document.getElementById('div_id_keywords');
let error = element.querySelector('#error_1_id_keywords');
let input = element.querySelector('#id_keywords');
let value = input.value || '';
// Create div and replace form input with div to put KeywordInput into
let div = document.createElement('div');
div.classList.add('keyword-select')
if (error) {
div.classList.add('is-invalid')
}
input.replaceWith(div);
ReactDOM.render(
<KeywordInput
value={value}
keywords={window.reactData.keywords}
/>,
div
);
const topicGuidesEl = document.getElementById('div_id_topic_guides');
const options = topicGuidesEl.querySelectorAll('option[selected]');
let values = [];
options.forEach( ({value, label}) => values.push( { value, label } ));
let topicGuideDiv = document.createElement('div');
topicGuidesEl.querySelector('#id_topic_guides').replaceWith(topicGuideDiv);
ReactDOM.render(
<TopicInput
value={values}
topics={window.reactData.topicGuides}
/>,
topicGuideDiv
);
| import React from 'react'
import ReactDOM from 'react-dom'
import KeywordInput from './components/keyword-input'
import TopicInput from './components/topic-input'
/*
* Replace keywords and topics form input with react components
*/
const element = document.getElementById('div_id_keywords');
let error = element.querySelector('#error_1_id_keywords');
let input = element.querySelector('#id_keywords');
let value = input.value || '';
// Create div and replace form input with div to put KeywordInput into
let div = document.createElement('div');
div.classList.add('keyword-select')
if (error) {
div.classList.add('is-invalid')
}
input.replaceWith(div);
ReactDOM.render(
<KeywordInput
value={value}
keywords={window.reactData.keywords}
/>,
div
);
const topicGuidesEl = document.getElementById('div_id_topic_guides');
const options = topicGuidesEl.querySelectorAll('option[selected]');
let values = [];
options.forEach( ({value, label}) => values.push( { value, label } ));
let topicGuideDiv = document.createElement('div');
topicGuidesEl.querySelector('#id_topic_guides').replaceWith(topicGuideDiv);
ReactDOM.render(
<TopicInput
value={values}
topics={window.reactData.topicGuides}
/>,
topicGuideDiv
);
| Add comment to explain the purpose of react view | Add comment to explain the purpose of react view
| JSX | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -2,6 +2,10 @@
import ReactDOM from 'react-dom'
import KeywordInput from './components/keyword-input'
import TopicInput from './components/topic-input'
+
+/*
+ * Replace keywords and topics form input with react components
+ */
const element = document.getElementById('div_id_keywords');
let error = element.querySelector('#error_1_id_keywords'); |
3f2facb52e98f7bee51829161ea89edf131209c8 | client/src/components/ChartContainer.jsx | client/src/components/ChartContainer.jsx | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchPlayers } from '../actions.js';
import BarChart from './BarChart.jsx';
export class ChartContainer extends Component {
constructor() {
super();
}
componentDidMount() {
const { getPlayers, currentTeam } = this.props;
getPlayers(currentTeam.team, currentTeam.position);
}
render() {
const { players } = this.props;
return (
<div>
{players ? <BarChart players={players} /> : <p>Loading</p>}
</div>
)
}
}
const mapStateToProps = (state) => {
return {
currentTeam: state.currentTeam,
players: state.displayedPlayers.players
}
}
const mapDispatchToProps = (dispatch) => {
return {
getPlayers: (team, position) => dispatch(fetchPlayers(team, position))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ChartContainer) | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchPlayers } from '../actions.js';
import BarChart from './BarChart.jsx';
export class ChartContainer extends Component {
constructor() {
super();
}
componentDidMount() {
const { getPlayers, currentTeam } = this.props;
getPlayers(currentTeam.team, currentTeam.position);
}
render() {
const { players } = this.props;
const barChart = (
<div className="ui container segment">
<BarChart players={players} />
</div>
)
const loadingChart = (
<div className="ui segment loading">
</div>
)
return players ? barChart : loadingChart;
}
}
const mapStateToProps = (state) => {
return {
currentTeam: state.currentTeam,
players: state.displayedPlayers.players
}
}
const mapDispatchToProps = (dispatch) => {
return {
getPlayers: (team, position) => dispatch(fetchPlayers(team, position))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ChartContainer) | Add loading chart when players not defined | Add loading chart when players not defined
| JSX | mit | smclendening/nfl-draft,smclendening/nfl-draft | ---
+++
@@ -16,11 +16,18 @@
render() {
const { players } = this.props;
- return (
- <div>
- {players ? <BarChart players={players} /> : <p>Loading</p>}
+ const barChart = (
+ <div className="ui container segment">
+ <BarChart players={players} />
</div>
)
+
+ const loadingChart = (
+ <div className="ui segment loading">
+ </div>
+ )
+
+ return players ? barChart : loadingChart;
}
}
|
e0a88466c82c3f3392aa13a44a9c6e837fedb928 | app/scripts/components/GameInstance.jsx | app/scripts/components/GameInstance.jsx | import React from 'react';
class GameInstance extends React.Component {
render() {
var status_num = Math.floor(Math.random() * 4);
var status = "panel";
var status_text = null;
switch (status_num) {
case 0: status += " panel-danger"; break;
case 1: status += " panel-success"; break;
case 2: status += " panel-info"; break;
case 3: status += " panel-warning"; break;
default: break;
}
switch (status_num) {
case 0: status_text = " Loss"; break;
case 1: status_text = " Win"; break;
case 2: status_text = " Your turn"; break;
case 3: status_text = " Waiting for opponent"; break;
default: break;
}
return (
<div className={status}>
<div className="panel-heading">
{status_text}
</div>
</div>
);
}
}
export default GameInstance;
| import React from 'react';
import { Button } from 'react-bootstrap';
class GameInstance extends React.Component {
render() {
var status_num = Math.floor(Math.random() * 4);
var status = "panel";
var status_text = null;
switch (status_num) {
case 0: status += " panel-danger"; break;
case 1: status += " panel-success"; break;
case 2: status += " panel-info"; break;
case 3: status += " panel-warning"; break;
default: break;
}
switch (status_num) {
case 0: status_text = " Loss"; break;
case 1: status_text = " Win"; break;
case 2: status_text = " Your turn"; break;
case 3: status_text = " Waiting for opponent"; break;
default: break;
}
return (
<Button block>
{status_text}
</Button>
);
}
}
export default GameInstance;
| Make game instance a button | Make game instance a button
| JSX | mit | gnidan/foodtastechess-client,gnidan/foodtastechess-client | ---
+++
@@ -1,4 +1,5 @@
import React from 'react';
+import { Button } from 'react-bootstrap';
class GameInstance extends React.Component {
render() {
@@ -21,11 +22,9 @@
}
return (
- <div className={status}>
- <div className="panel-heading">
- {status_text}
- </div>
- </div>
+ <Button block>
+ {status_text}
+ </Button>
);
}
} |
e4d57bb510f6c2f3dc281e2b451a57453c368d3b | imports/ui/NavBar.jsx | imports/ui/NavBar.jsx | import createReactClass from 'create-react-class'
import React from 'react'
import {Link, NavLink as RNavLink} from 'react-router-dom'
import {Collapse, Nav, NavItem, NavLink, Navbar, NavbarBrand, NavbarToggler} from 'reactstrap'
export default createReactClass({
displayName: 'NavBar',
getInitialState: () => ({
isOpen: false
}),
toggle () {
this.setState({
isOpen: !this.state.isOpen
})
},
close () {
this.setState({
isOpen: false
})
},
render () {
return (
<Navbar color='faded' light toggleable='md'>
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand tag={Link} to='/'>SpidChain</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav navbar className='ml-auto'>
<NavItem>
<NavLink tag={RNavLink} to='/' onClick={this.close}>Home</NavLink>
</NavItem>
<NavItem>
<NavLink tag={RNavLink} to='/addContact' onClick={this.close}>AddContact</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
)
}
})
| import createReactClass from 'create-react-class'
import React from 'react'
import {Link, NavLink as RNavLink} from 'react-router-dom'
import {Collapse, Nav, NavItem, NavLink, Navbar, NavbarBrand, NavbarToggler} from 'reactstrap'
export default createReactClass({
displayName: 'NavBar',
getInitialState: () => ({
isOpen: false
}),
toggle () {
this.setState({
isOpen: !this.state.isOpen
})
},
close () {
this.setState({
isOpen: false
})
},
render () {
return (
<Navbar color='faded' light toggleable='md'>
<NavbarToggler right onClick={this.toggle} />
<NavbarBrand tag={Link} to='/'>SpidChain</NavbarBrand>
<Collapse isOpen={this.state.isOpen} navbar>
<Nav navbar className='ml-auto'>
<NavItem>
<NavLink tag={RNavLink} exact to='/' onClick={this.close}>Home</NavLink>
</NavItem>
<NavItem>
<NavLink tag={RNavLink} exact to='/addContact' onClick={this.close}>AddContact</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
)
}
})
| Fix current route highlight in navbar menu | Fix current route highlight in navbar menu
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -30,10 +30,10 @@
<Collapse isOpen={this.state.isOpen} navbar>
<Nav navbar className='ml-auto'>
<NavItem>
- <NavLink tag={RNavLink} to='/' onClick={this.close}>Home</NavLink>
+ <NavLink tag={RNavLink} exact to='/' onClick={this.close}>Home</NavLink>
</NavItem>
<NavItem>
- <NavLink tag={RNavLink} to='/addContact' onClick={this.close}>AddContact</NavLink>
+ <NavLink tag={RNavLink} exact to='/addContact' onClick={this.close}>AddContact</NavLink>
</NavItem>
</Nav>
</Collapse> |
41408c82d88e6df19b57ccf324654ae107538b16 | client/components/Gauge.jsx | client/components/Gauge.jsx | import React, {Component, PropTypes} from 'react'
import 'plotly'
export default class Gauge extends Component {
constructor (props) {
super(props)
}
render () {
return (
<div>{this.props.range[0]}</div>
)
}
}
Gauge.propTypes = {
range: PropTypes.array
}
Gauge.defaultProps = {
range: [0, 1]
}
| import React, {Component, PropTypes} from 'react'
import 'plotly'
export default class Gauge extends Component {
constructor (props) {
super(props)
const {width, minorGrads, majorGrads} = this.props
this.node = this.getDOMNode()
// ToDo: scale according to width (use % instead of x/300)
this.innerRadius = Math.round(width*130/300)
this.outterRadius = Math.round(width*145/300)
this.majorGrads = majorGrads-1
this.minorGrads = minorGrads
this.majorGradLength = Math.round(width*16/300)
this.minorGradLength = Math.round(width*10/300)
this.gradMarginTop = Math.round(width*7/30)
this.majorGradColor = 'B0B0B0'
this.minorGradColor = '#D0D0D0'
this.majorGradTextColor = '6C6C6C'
this.majorGradsTextSize = 10
this.needleColor = '#416094'
this.needleTextOffset = Math.round(width*30/300)
this.needleTextSize = 8
}
render () {
return (
<div>{this.props.range[0]}</div>
)
}
}
Gauge.propTypes = {
range: PropTypes.array,
width: PropTypes.number,
majorGrads: PropTypes.number,
minorGrads: PropTypes.number
}
Gauge.defaultProps = {
range: [0, 1],
width: 300, // to be removed later
majorGrads: 5,
minorGrads: 10
}
| Add basic flat config & class attributes | Add basic flat config & class attributes
| JSX | mit | UVicFH/Telemetry-v2,UVicFH/Telemetry-v2 | ---
+++
@@ -4,6 +4,24 @@
export default class Gauge extends Component {
constructor (props) {
super(props)
+ const {width, minorGrads, majorGrads} = this.props
+ this.node = this.getDOMNode()
+
+ // ToDo: scale according to width (use % instead of x/300)
+ this.innerRadius = Math.round(width*130/300)
+ this.outterRadius = Math.round(width*145/300)
+ this.majorGrads = majorGrads-1
+ this.minorGrads = minorGrads
+ this.majorGradLength = Math.round(width*16/300)
+ this.minorGradLength = Math.round(width*10/300)
+ this.gradMarginTop = Math.round(width*7/30)
+ this.majorGradColor = 'B0B0B0'
+ this.minorGradColor = '#D0D0D0'
+ this.majorGradTextColor = '6C6C6C'
+ this.majorGradsTextSize = 10
+ this.needleColor = '#416094'
+ this.needleTextOffset = Math.round(width*30/300)
+ this.needleTextSize = 8
}
render () {
@@ -15,8 +33,14 @@
}
Gauge.propTypes = {
- range: PropTypes.array
+ range: PropTypes.array,
+ width: PropTypes.number,
+ majorGrads: PropTypes.number,
+ minorGrads: PropTypes.number
}
Gauge.defaultProps = {
- range: [0, 1]
+ range: [0, 1],
+ width: 300, // to be removed later
+ majorGrads: 5,
+ minorGrads: 10
} |
41026dad5fdc6c666012df1f5d8d333fb0f30f1c | client/map/MapWrapper.jsx | client/map/MapWrapper.jsx | import React, {Component, PropTypes} from 'react';
import GoogleMap from 'google-map-react';
import LocationMarkers from './MapMarkers';
Markers = new Mongo.Collection("markers");
export default class MapWrapper extends Component {
constructor(props) {
super(props);
}
createMapOptions() {
return{
minZoomOverride: true,
minZoom: 2,
}
}
render() {
return (
<div className="mapWrapper">
<GoogleMap
defaultCenter={this.props.center}
center={{lat: 35.3428366, lng: -119.1099741}}
defaultZoom={this.props.zoom}
options={this.createMapOptions}
bootstrapURLKeys={{
key: 'AIzaSyAh3cQ8hG1PN_ZLLC_GYP0zWhDSsYD4Mbk',
}}>
<LocationMarkers lat={35.3428366} lng={-119.1099741} text={'A'} />
</GoogleMap>
</div>
);
}
}
MapWrapper.propTypes = {
center: PropTypes.any,
zoom: PropTypes.number,
};
MapWrapper.defaultProps = {
center: {lat: 59.938043, lng: 30.337157},
zoom: 15,
};
| import React, {Component, PropTypes} from 'react';
import TrackerReact from 'meteor/ultimatejs:tracker-react';
import GoogleMap from 'google-map-react';
import LocationMarkers from './MapMarkers';
Markers = new Mongo.Collection("markers");
export default class MapWrapper extends TrackerReact(Component) {
constructor(props) {
super(props);
}
createMapOptions() {
return{
minZoomOverride: true,
minZoom: 2,
}
}
render() {
return (
<div className="mapWrapper">
<GoogleMap
defaultCenter={this.props.center}
center={{lat: 35.3428366, lng: -119.1099741}}
defaultZoom={this.props.zoom}
options={this.createMapOptions}
bootstrapURLKeys={{
key: 'AIzaSyAh3cQ8hG1PN_ZLLC_GYP0zWhDSsYD4Mbk',
}}>
<LocationMarkers lat={35.3428366} lng={-119.1099741} text={'A'} />
</GoogleMap>
</div>
);
}
}
MapWrapper.propTypes = {
center: PropTypes.any,
zoom: PropTypes.number,
};
MapWrapper.defaultProps = {
center: {lat: 59.938043, lng: 30.337157},
zoom: 15,
};
| Add TrackerReact to the project | Add TrackerReact to the project
| JSX | mit | reyvera/raceDay,reyvera/raceDay,reyvera/raceDay | ---
+++
@@ -1,11 +1,12 @@
import React, {Component, PropTypes} from 'react';
+import TrackerReact from 'meteor/ultimatejs:tracker-react';
import GoogleMap from 'google-map-react';
import LocationMarkers from './MapMarkers';
Markers = new Mongo.Collection("markers");
-export default class MapWrapper extends Component {
+export default class MapWrapper extends TrackerReact(Component) {
constructor(props) {
super(props);
} |
5e708d98f0fafe92469f9a434fc4c45a81bc0e61 | client/components/ChatClient.jsx | client/components/ChatClient.jsx | import React from 'react';
import sendChatMessage from './../actions';
import ChatMessagesDisplay from './ChatMessagesDisplay.jsx';
class ChatClient extends React.Component {
constructor(props) {
super(props);
this.state = {
store: props.store,
message: '',
user: props.username
};
}
render() {
return (
<div className="chat-client-container">
<ChatMessagesDisplay />
<form
onSubmit={(e) => {
e.preventDefault();
console.log('Message input on chat client: ', this.state.message);
// Form is not properly re rendering after setState
// Redux conflict? This is a problem with all app's forms
this.setState({ message: '' });
this.state.store.dispatch(sendChatMessage({
user: this.state.user,
message: this.state.message
})
);
}}
>
<input
type="text"
onChange={e => this.setState({ message: e.target.value })}
/>
</form>
</div>
);
}
}
export default ChatClient;
| import React from 'react';
import { sendChatMessage } from './../actions';
import ChatMessagesDisplay from './ChatMessagesDisplay.jsx';
class ChatClient extends React.Component {
constructor(props) {
super(props);
this.state = {
store: props.store,
message: '',
user: props.username
};
}
render() {
return (
<div className="chat-client-container">
<ChatMessagesDisplay />
<form
onSubmit={(e) => {
e.preventDefault();
console.log('Message input on chat client: ', this.state.message);
// Form is not properly re rendering after setState
// Redux conflict? This is a problem with all app's forms
this.setState({ message: '' });
const submitObj = {
user: this.state.user,
message: this.state.message
};
this.state.store.dispatch(sendChatMessage(submitObj));
}}
>
<input
type="text"
onChange={e => this.setState({ message: e.target.value })}
/>
</form>
</div>
);
}
}
export default ChatClient;
| Enable posting to slack from React component's input | Enable posting to slack from React component's input
| JSX | mit | enchanted-spotlight/Plato,enchanted-spotlight/Plato | ---
+++
@@ -1,5 +1,5 @@
import React from 'react';
-import sendChatMessage from './../actions';
+import { sendChatMessage } from './../actions';
import ChatMessagesDisplay from './ChatMessagesDisplay.jsx';
@@ -23,11 +23,11 @@
// Form is not properly re rendering after setState
// Redux conflict? This is a problem with all app's forms
this.setState({ message: '' });
- this.state.store.dispatch(sendChatMessage({
+ const submitObj = {
user: this.state.user,
message: this.state.message
- })
- );
+ };
+ this.state.store.dispatch(sendChatMessage(submitObj));
}}
>
<input |
aa6e7b7585795c84e416e74ac13cd219dcef2047 | event-handling/lib/dropdown-component.jsx | event-handling/lib/dropdown-component.jsx | 'use strict';
var ButtonDropdown = require('./button-dropdown-component.jsx'),
React = require('react');
module.exports = React.createClass({
render: function () {
return (
<div>
<ButtonDropdown />
</div>
);
}
});
| 'use strict';
/* eslint-disable no-unused-vars*/
var ButtonDropdown = require('./button-dropdown-component.jsx'),
/* eslint-enable no-unused-vars*/
React = require('react');
module.exports = React.createClass({
render: function () {
return (
<div>
<ButtonDropdown />
</div>
);
}
});
| Fix eslint error since, for some reason, it cannot detect when you've used a require'd component in the jsx. | Fix eslint error since, for some reason, it cannot detect when you've used a require'd component in the jsx.
| JSX | mit | zpratt/react-tdd-guide | ---
+++
@@ -1,6 +1,8 @@
'use strict';
+/* eslint-disable no-unused-vars*/
var ButtonDropdown = require('./button-dropdown-component.jsx'),
+/* eslint-enable no-unused-vars*/
React = require('react');
|
5a7a5a1dfcdff503bfcc09d24a7303649c7e3fad | frontend/src/components/home.jsx | frontend/src/components/home.jsx | import React from 'react';
const Home = (props) =>
<div className="content--wrapper">
<div className="content--header">
<div className="content--header-spacing" />
<div className="content--header-breadcrumbs">
<ul>
<li>Home</li>
</ul>
</div>
</div>
<div className="content">
<h1>Welcome at Flindt!</h1>
<p>Use the left navigation bar to check for open feedback requests or received feedback!</p>
</div>
</div>;
export default Home;
| import React from 'react';
const Home = (props) =>
<div className="content--wrapper">
<div className="content--header">
<div className="content--header-spacing" />
<div className="content--header-breadcrumbs">
<ul>
<li>Home</li>
</ul>
</div>
</div>
<div className="content">
<h1>Welcome at Flindt!</h1>
<p>Use the navigation bar to check for open feedback requests or received feedback!</p>
</div>
</div>;
export default Home;
| Fix left word because on mobile the nav isn't shown on the left side anymore | Fix left word because on mobile the nav isn't shown on the left side anymore
| JSX | agpl-3.0 | wearespindle/flindt,wearespindle/flindt,wearespindle/flindt | ---
+++
@@ -15,7 +15,7 @@
<div className="content">
<h1>Welcome at Flindt!</h1>
- <p>Use the left navigation bar to check for open feedback requests or received feedback!</p>
+ <p>Use the navigation bar to check for open feedback requests or received feedback!</p>
</div>
</div>;
|
9a94b20a1400cbeb095886749516224cd2a2d16b | src/containers/Posts.jsx | src/containers/Posts.jsx | import React from 'react'
import classNames from 'classnames'
import { asyncConnect } from 'redux-connect'
import Helmet from 'react-helmet'
import { Single } from './'
import {
Loading,
NotFound,
Pagination,
Post,
Summary
} from '../components'
import { changePost, fetchPosts } from '../actions/PostsActions'
export const Posts = ({
data,
entities,
isFetching,
isPopup,
itemsPerPage,
links,
meta: { totalItems },
page
}) => {
return (
<div>
<Helmet
title={ `Page ${page}` } />
<div className="posts">
{
(isFetching
? <Loading />
: (data[page]
? data[page].
map((item) => {
return entities.posts[item]
}).
map((item, key) => {
return (
<Summary data={ item } key={ key } />
)
})
: <NotFound />))
}
<Pagination
itemsPerPage={ itemsPerPage }
links={ links }
page={ page }
totalItems={ totalItems } />
</div>
</div>
)
}
export default asyncConnect([{
promise: ({ store: { dispatch, getState } }) => {
if (getState().posts.data[getState().posts.page]) {
return Promise.resolve()
}
return dispatch(fetchPosts(
getState().posts.page,
getState().posts.itemsPerPage
))
}
}], (state) => ({
...state.posts,
entities: state.entities
}))(Posts)
| import React from 'react'
import classNames from 'classnames'
import { asyncConnect } from 'redux-connect'
import Helmet from 'react-helmet'
import { Single } from './'
import {
Loading,
NotFound,
Pagination,
Post,
Summary
} from '../components'
import { changePost, fetchPosts } from '../actions/PostsActions'
export const Posts = ({
data,
entities,
isFetching,
isPopup,
itemsPerPage,
links,
meta: { totalItems },
page
}) => {
return (
<div>
<Helmet
title={ (page === 1
? 'Nomkhonwaan'
: `Page ${page}`) } />
<div className="posts">
{
(isFetching
? <Loading />
: (data[page]
? data[page].
map((item) => {
return entities.posts[item]
}).
map((item, key) => {
return (
<Summary data={ item } key={ key } />
)
})
: <NotFound />))
}
<Pagination
itemsPerPage={ itemsPerPage }
links={ links }
page={ page }
totalItems={ totalItems } />
</div>
</div>
)
}
export default asyncConnect([{
promise: ({ store: { dispatch, getState } }) => {
if (getState().posts.data[getState().posts.page]) {
return Promise.resolve()
}
return dispatch(fetchPosts(
getState().posts.page,
getState().posts.itemsPerPage
))
}
}], (state) => ({
...state.posts,
entities: state.entities
}))(Posts)
| Change page 1 title to same on home page | Change page 1 title to same on home page
| JSX | mit | nomkhonwaan/nomkhonwaan.github.io | ---
+++
@@ -26,7 +26,9 @@
return (
<div>
<Helmet
- title={ `Page ${page}` } />
+ title={ (page === 1
+ ? 'Nomkhonwaan'
+ : `Page ${page}`) } />
<div className="posts">
{
(isFetching |
5f5d29b7818005907a01b2013579efea5da90ea4 | src/components/elements/search-form.jsx | src/components/elements/search-form.jsx | import React from 'react';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
import classnames from 'classnames';
import { preventDefault } from '../../utils';
export default class SearchForm extends React.Component {
constructor(props) {
super(props);
this.state = {
isFocused: false
};
}
focusForm = () => {
this.setState({ isFocused: true });
};
blurForm = () => {
this.setState({ isFocused: false });
};
submitForm = () => {
const query = this.refs.searchQuery.value;
browserHistory.push(`/search?q=${encodeURIComponent(query)}`);
};
render() {
const formClasses = classnames({
'search-form-in-header': true,
'form-inline': true,
'focused': this.state.isFocused
});
return (
<form className={formClasses} action="/search" onSubmit={preventDefault(this.submitForm)}>
<input className="form-control" type="text" name="q" ref="searchQuery" defaultValue="" onFocus={this.focusForm} onBlur={this.blurForm}/>
<button className="btn btn-default" type="submit">
<i className="fa fa-search"></i>
</button>
</form>
);
}
}
| import React from 'react';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
import classnames from 'classnames';
import { preventDefault } from '../../utils';
export default class SearchForm extends React.Component {
constructor(props) {
super(props);
this.state = {
isFocused: false
};
}
refSearchQuery = (input) => {
this.searchQuery = input;
};
focusForm = () => {
this.setState({ isFocused: true });
};
blurForm = () => {
this.setState({ isFocused: false });
};
submitForm = () => {
const query = this.searchQuery.value;
browserHistory.push(`/search?q=${encodeURIComponent(query)}`);
};
render() {
const formClasses = classnames({
'search-form-in-header': true,
'form-inline': true,
'focused': this.state.isFocused
});
return (
<form className={formClasses} action="/search" onSubmit={preventDefault(this.submitForm)}>
<input className="form-control" type="text" name="q" ref={this.refSearchQuery} defaultValue="" onFocus={this.focusForm} onBlur={this.blurForm}/>
<button className="btn btn-default" type="submit">
<i className="fa fa-search"></i>
</button>
</form>
);
}
}
| Replace string ref with function in SearchForm | [no-string-refs] Replace string ref with function in SearchForm
| JSX | mit | clbn/freefeed-gamma,clbn/freefeed-gamma,clbn/freefeed-gamma | ---
+++
@@ -14,6 +14,10 @@
};
}
+ refSearchQuery = (input) => {
+ this.searchQuery = input;
+ };
+
focusForm = () => {
this.setState({ isFocused: true });
};
@@ -23,7 +27,7 @@
};
submitForm = () => {
- const query = this.refs.searchQuery.value;
+ const query = this.searchQuery.value;
browserHistory.push(`/search?q=${encodeURIComponent(query)}`);
};
@@ -36,7 +40,7 @@
return (
<form className={formClasses} action="/search" onSubmit={preventDefault(this.submitForm)}>
- <input className="form-control" type="text" name="q" ref="searchQuery" defaultValue="" onFocus={this.focusForm} onBlur={this.blurForm}/>
+ <input className="form-control" type="text" name="q" ref={this.refSearchQuery} defaultValue="" onFocus={this.focusForm} onBlur={this.blurForm}/>
<button className="btn btn-default" type="submit">
<i className="fa fa-search"></i>
</button> |
2a4290b888bd8a2275098203a61498a9b285a709 | src/client/components/MyInvestmentProjects/InvestmentProjectSummary.jsx | src/client/components/MyInvestmentProjects/InvestmentProjectSummary.jsx | import React from 'react'
import PropTypes from 'prop-types'
import { PURPLE, ORANGE, BLUE, YELLOW, GREEN } from 'govuk-colours'
import { connect } from 'react-redux'
import PieChart from '../PieChart'
import { ID as CHECK_INVESTMENTS_ID } from '../PersonalisedDashboard/state'
import { ID } from './state'
const segmentColours = [PURPLE, ORANGE, BLUE, YELLOW, GREEN]
const state2props = (state) => {
const { summary: unfilteredSummary } = state[CHECK_INVESTMENTS_ID]
const { summary } = state[ID]
const data = summary.length ? summary : unfilteredSummary
return {
summary:
data &&
data.map(({ label, value, ...rest }, index) => ({
...rest,
colour: segmentColours[index % segmentColours.length],
value,
id: label,
})),
}
}
const InvestmentProjectSummary = ({ summary = [] }) => (
<PieChart unit="Project" height={290} data={summary} />
)
InvestmentProjectSummary.propTypes = {
summary: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
value: PropTypes.number.isRequired,
link: PropTypes.string,
colour: PropTypes.string,
})
).isRequired,
}
export default connect(state2props)(InvestmentProjectSummary)
| import React from 'react'
import PropTypes from 'prop-types'
import { PURPLE, ORANGE, BLUE, YELLOW, GREEN } from 'govuk-colours'
import { connect } from 'react-redux'
import PieChart from '../PieChart'
import { ID as CHECK_INVESTMENTS_ID } from '../PersonalisedDashboard/state'
import { ID as INVESTMENT_PROJECTS_ID } from './state'
const segmentColours = [PURPLE, ORANGE, BLUE, YELLOW, GREEN]
const state2props = (state) => {
const { summary: unfilteredSummary } = state[CHECK_INVESTMENTS_ID]
const { summary: projectsSummary } = state[INVESTMENT_PROJECTS_ID]
const summaryData = projectsSummary.length
? projectsSummary
: unfilteredSummary
return {
summary: summaryData.map(({ label, value, ...rest }, index) => ({
...rest,
colour: segmentColours[index % segmentColours.length],
value,
id: label,
})),
}
}
const InvestmentProjectSummary = ({ summary = [] }) => (
<PieChart unit="Project" height={290} data={summary} />
)
InvestmentProjectSummary.propTypes = {
summary: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
value: PropTypes.number.isRequired,
link: PropTypes.string,
colour: PropTypes.string,
})
).isRequired,
}
export default connect(state2props)(InvestmentProjectSummary)
| Refactor for ease of readability | Refactor for ease of readability
| JSX | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -6,23 +6,23 @@
import PieChart from '../PieChart'
import { ID as CHECK_INVESTMENTS_ID } from '../PersonalisedDashboard/state'
-import { ID } from './state'
+import { ID as INVESTMENT_PROJECTS_ID } from './state'
const segmentColours = [PURPLE, ORANGE, BLUE, YELLOW, GREEN]
const state2props = (state) => {
const { summary: unfilteredSummary } = state[CHECK_INVESTMENTS_ID]
- const { summary } = state[ID]
- const data = summary.length ? summary : unfilteredSummary
+ const { summary: projectsSummary } = state[INVESTMENT_PROJECTS_ID]
+ const summaryData = projectsSummary.length
+ ? projectsSummary
+ : unfilteredSummary
return {
- summary:
- data &&
- data.map(({ label, value, ...rest }, index) => ({
- ...rest,
- colour: segmentColours[index % segmentColours.length],
- value,
- id: label,
- })),
+ summary: summaryData.map(({ label, value, ...rest }, index) => ({
+ ...rest,
+ colour: segmentColours[index % segmentColours.length],
+ value,
+ id: label,
+ })),
}
}
|
3e0666567296026c2537d111041810c728f14c4e | indico/modules/rb_new/client/js/setup.jsx | indico/modules/rb_new/client/js/setup.jsx | import ReactDOM from 'react-dom';
import React from 'react';
import {Provider} from 'react-redux';
import Overridable from 'indico/react/util/Overridable';
import setupUserMenu from 'indico/react/containers/UserMenu';
import App from './components/App';
import createRBStore, {history} from './store';
import {init} from './actions';
import {selectors as configSelectors} from './common/config';
import {selectors as userSelectors} from './common/user';
import 'semantic-ui-css/semantic.css';
import '../styles/main.scss';
export default function setup(overrides = {}, postReducers = []) {
document.addEventListener('DOMContentLoaded', () => {
const appContainer = document.getElementById('rb-app-container');
const store = createRBStore(overrides, postReducers);
store.dispatch(init());
setupUserMenu(
document.getElementById('indico-user-menu-container'), store,
userSelectors.getUserInfo, configSelectors.getLanguages
);
ReactDOM.render(
<Provider store={store}>
<Overridable id="App">
<App history={history} />
</Overridable>
</Provider>,
appContainer
);
});
}
| import ReactDOM from 'react-dom';
import React from 'react';
import {Provider} from 'react-redux';
import Overridable from 'indico/react/util/Overridable';
import setupUserMenu from 'indico/react/containers/UserMenu';
import App from './components/App';
import createRBStore, {history} from './store';
import {init} from './actions';
import {selectors as configSelectors} from './common/config';
import {selectors as userSelectors} from './common/user';
import {actions as roomsActions} from './common/rooms';
import 'semantic-ui-css/semantic.css';
import '../styles/main.scss';
export default function setup(overrides = {}, postReducers = []) {
document.addEventListener('DOMContentLoaded', () => {
const appContainer = document.getElementById('rb-app-container');
const store = createRBStore(overrides, postReducers);
let oldPath = history.location.pathname;
history.listen(({pathname: newPath}) => {
if (oldPath.startsWith('/admin') && !newPath.startsWith('/admin')) {
// user left the admin area so we need to reload some data that might have been changed
// TODO: add more things here once admins can change them (e.g. map areas)
store.dispatch(roomsActions.fetchEquipmentTypes());
store.dispatch(roomsActions.fetchRooms());
}
oldPath = newPath;
});
store.dispatch(init());
setupUserMenu(
document.getElementById('indico-user-menu-container'), store,
userSelectors.getUserInfo, configSelectors.getLanguages
);
ReactDOM.render(
<Provider store={store}>
<Overridable id="App">
<App history={history} />
</Overridable>
</Provider>,
appContainer
);
});
}
| Refresh data after leaving RB administration | Refresh data after leaving RB administration
| JSX | mit | mvidalgarcia/indico,OmeGak/indico,mvidalgarcia/indico,indico/indico,mic4ael/indico,DirkHoffmann/indico,indico/indico,ThiefMaster/indico,pferreir/indico,OmeGak/indico,OmeGak/indico,ThiefMaster/indico,indico/indico,mvidalgarcia/indico,pferreir/indico,mic4ael/indico,mic4ael/indico,DirkHoffmann/indico,pferreir/indico,ThiefMaster/indico,ThiefMaster/indico,mvidalgarcia/indico,pferreir/indico,mic4ael/indico,indico/indico,DirkHoffmann/indico,DirkHoffmann/indico,OmeGak/indico | ---
+++
@@ -10,6 +10,7 @@
import {init} from './actions';
import {selectors as configSelectors} from './common/config';
import {selectors as userSelectors} from './common/user';
+import {actions as roomsActions} from './common/rooms';
import 'semantic-ui-css/semantic.css';
import '../styles/main.scss';
@@ -19,6 +20,17 @@
document.addEventListener('DOMContentLoaded', () => {
const appContainer = document.getElementById('rb-app-container');
const store = createRBStore(overrides, postReducers);
+
+ let oldPath = history.location.pathname;
+ history.listen(({pathname: newPath}) => {
+ if (oldPath.startsWith('/admin') && !newPath.startsWith('/admin')) {
+ // user left the admin area so we need to reload some data that might have been changed
+ // TODO: add more things here once admins can change them (e.g. map areas)
+ store.dispatch(roomsActions.fetchEquipmentTypes());
+ store.dispatch(roomsActions.fetchRooms());
+ }
+ oldPath = newPath;
+ });
store.dispatch(init());
setupUserMenu( |
c3aaa2560aa0a339d23daed01d8a414783385baa | src/client/components/DeckBuilder.jsx | src/client/components/DeckBuilder.jsx | import React from 'react';
import Main from './Main';
import BigPane from './Main/BigPane';
import SmallPane from './Main/SmallPane';
import DeckCardList from '../containers/Card/deck-CardList';
import SearchCardBlockList from '../containers/Card/search-CardBlockList';
import CardBlockList from '../components/Card/CardBlockList';
// TODO remove placeholder name
const DeckBuilder = function DeckBuilder() {
return (
<div className='deck-builder-page -golden'>
<BigPane>
<SearchCardBlockList containerToAdd="deckbuilder"/>
</BigPane>
<SmallPane>
<DeckCardList
containerToAdd="deckbuilder"
categories={['creature&planeswalker', 'artefact&enchantment', 'land']}
/>
</SmallPane>
</div>
);
};
export default DeckBuilder;
| import React from 'react';
import Main from './Main';
import BigPane from './Main/BigPane';
import SmallPane from './Main/SmallPane';
import DeckCardList from '../containers/Card/deck-CardList';
import SearchCardBlockList from '../containers/Card/search-CardBlockList';
import CardBlockList from '../components/Card/CardBlockList';
// TODO remove placeholder name
const DeckBuilder = function DeckBuilder() {
return (
<div className='deck-builder-page -golden'>
<BigPane>
<SearchCardBlockList containerToAdd="deckbuilder"/>
</BigPane>
<SmallPane>
<DeckCardList
containerToAdd="deckbuilder"
categories={['creature&planeswalker', 'artefact&enchantment', 'sorcery&instant', 'land']}
/>
</SmallPane>
</div>
);
};
export default DeckBuilder;
| Add instant and sorcery display | Add instant and sorcery display
| JSX | agpl-3.0 | Narxem/crispy-magic-front,Narxem/crispy-magic-front | ---
+++
@@ -17,7 +17,7 @@
<SmallPane>
<DeckCardList
containerToAdd="deckbuilder"
- categories={['creature&planeswalker', 'artefact&enchantment', 'land']}
+ categories={['creature&planeswalker', 'artefact&enchantment', 'sorcery&instant', 'land']}
/>
</SmallPane>
</div> |
a466ba91c473f7259973c119aedf53903e2e3fbf | src/js/components/App.jsx | src/js/components/App.jsx | import Appconfig from '../appconfig';
import React from 'react';
import Router from 'react-router';
import { RouteHandler } from 'react-router';
import UserActions from '../actions/UserActions';
var App = React.createClass({
mixins: [Router.Navigation],
componentWillMount() {
if (!Appconfig.authRequired) return;
Appconfig.firebaseRef.onAuth((jsonUser) => {
if (jsonUser) {
UserActions.loggedIn(jsonUser);
this.transitionTo('index');
} else {
UserActions.loggedOut();
this.transitionTo('login');
}
});
},
render() {
return <RouteHandler />;
},
});
export default App;
| import Appconfig from '../appconfig';
import React from 'react';
import Router from 'react-router';
import { RouteHandler } from 'react-router';
import UserActions from '../actions/UserActions';
var App = React.createClass({
mixins: [Router.Navigation],
componentWillMount() {
if (!Appconfig.authRequired) return;
Appconfig.firebaseRef.onAuth((jsonUser) => {
if (jsonUser) {
UserActions.loggedIn(jsonUser);
setTimeout(() => {
this.transitionTo('index');
}, 0);
} else {
UserActions.loggedOut();
this.transitionTo('login');
}
});
},
render() {
return <RouteHandler />;
},
});
export default App;
| Fix race condition for transitions | Fix race condition for transitions
When redirecting back from a successful login, onAuth gets called twice,
once with `null` and once with valid user data, and both
`transitionTo`'s get called. Ensure the transition to `index` gets
called later by using `setTimeout`.
| JSX | mit | kentor/notejs-react,kentor/notejs-react,kentor/notejs-react | ---
+++
@@ -13,7 +13,9 @@
Appconfig.firebaseRef.onAuth((jsonUser) => {
if (jsonUser) {
UserActions.loggedIn(jsonUser);
- this.transitionTo('index');
+ setTimeout(() => {
+ this.transitionTo('index');
+ }, 0);
} else {
UserActions.loggedOut();
this.transitionTo('login'); |
660b99cf33a89eba9132760b3234a1fe846f958e | src/containers/NoAuthLandingPage/index.jsx | src/containers/NoAuthLandingPage/index.jsx | import React from 'react'
import { Link } from 'react-router-dom'
import {connect} from 'react-redux'
import { bindActionCreators } from 'redux'
import * as actionCreators from '../../actions/howItWorksActionCreators'
import css from './NoAuthLandingPage.scss'
import Hero from '../../components/Hero'
import NoAuthSubNavigation from '../../components/NoAuthSubNavigation'
import HowItWorks from '../../components/HowItWorks'
import MemberPreview from '../../components/MemberPreview'
import WhatsHappening from '../../components/WhatsHappening'
class NoAuthLandingPage extends React.Component {
renderHowItWorks() {
if (this.props.howItWorksVisible) {
return <HowItWorks />
}
}
render() {
return (
<div>
<Hero />
{this.renderHowItWorks()}
<NoAuthSubNavigation />
<WhatsHappening />
</div>
)
}
}
// this is taking the howItWorks portion of state and attaching it to the NoAuthLandingPage props
function mapStateToProps(state, routing) {
return Object.assign({}, state.howItWorks, routing)
}
// this is attaching our actions to the NoAuthLandingPage component
function mapDispatchToProps(dispatch) {
return bindActionCreators(actionCreators, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(NoAuthLandingPage) | import React from 'react'
import { Link } from 'react-router-dom'
import {connect} from 'react-redux'
import { bindActionCreators } from 'redux'
import * as actionCreators from '../../actions/howItWorksActionCreators'
import css from './NoAuthLandingPage.scss'
import Hero from '../../components/Hero'
import NoAuthSubNavigation from '../../components/NoAuthSubNavigation'
import HowItWorks from '../../components/HowItWorks'
import MemberPreview from '../../components/MemberPreview'
import WhatsHappening from '../../components/WhatsHappening'
class NoAuthLandingPage extends React.Component {
renderHowItWorks() {
if (this.props.howItWorksVisible) {
return <HowItWorks />
}
}
renderSubNavigationSelection() {
if (this.props.currentLandingPageComponent == "Whats Happening") {
return <WhatsHappening />
}
}
render() {
return (
<div>
<Hero />
{this.renderHowItWorks()}
<NoAuthSubNavigation />
{this.renderSubNavigationSelection()}
</div>
)
}
}
// this is taking the howItWorks portion of state and attaching it to the NoAuthLandingPage props
function mapStateToProps(state, routing) {
return Object.assign({}, state.howItWorks, state.noAuthSubNavigation, routing)
}
// this is attaching our actions to the NoAuthLandingPage component
function mapDispatchToProps(dispatch) {
return bindActionCreators(actionCreators, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(NoAuthLandingPage) | Bring in state of NoAuthSubNavigation to dynamnically render whats happening section user clicks tab | Bring in state of NoAuthSubNavigation to dynamnically render whats happening section user clicks tab
| JSX | mit | Code-For-Change/GivingWeb,Code-For-Change/GivingWeb | ---
+++
@@ -4,6 +4,7 @@
import { bindActionCreators } from 'redux'
import * as actionCreators from '../../actions/howItWorksActionCreators'
+
import css from './NoAuthLandingPage.scss'
@@ -20,6 +21,12 @@
return <HowItWorks />
}
}
+
+ renderSubNavigationSelection() {
+ if (this.props.currentLandingPageComponent == "Whats Happening") {
+ return <WhatsHappening />
+ }
+ }
render() {
@@ -28,7 +35,7 @@
<Hero />
{this.renderHowItWorks()}
<NoAuthSubNavigation />
- <WhatsHappening />
+ {this.renderSubNavigationSelection()}
</div>
)
}
@@ -36,7 +43,7 @@
// this is taking the howItWorks portion of state and attaching it to the NoAuthLandingPage props
function mapStateToProps(state, routing) {
- return Object.assign({}, state.howItWorks, routing)
+ return Object.assign({}, state.howItWorks, state.noAuthSubNavigation, routing)
}
// this is attaching our actions to the NoAuthLandingPage component |
51aee49d56497957a74ab5212faafb61e8c3dd63 | app/components/Thanks.jsx | app/components/Thanks.jsx | import React from 'react';
import { withRouter } from 'react-router';
const Thanks = React.createClass({
goBack() {
this.props.router.goBack();
},
render() {
return <div className="content-container">
<div className="thanks-container">
<div className="back-container">
<span
className="back-btn"
onTouchTap={this.goBack}
>
<img className="back-arrow" src={'./images/arrow.svg'} />
</span>
</div>
<h1 className="main-header">
Thanks for the request!
</h1>
<h2 className="second-header">
While you wait, take a look at the lyrics for <br />
<span className="lyrics-title">{this.props.requestedSong.songTitle}
</span>
</h2>
</div>
<div className="lyrics-container">
<h6 className="lyrics">
{this.props.lyrics}
</h6>
</div>
</div>;
}
});
export default withRouter(Thanks);
| import React from 'react';
import { withRouter } from 'react-router';
import CircularProgress from 'material-ui/CircularProgress';
const Thanks = React.createClass({
goBack() {
this.props.router.goBack();
},
render() {
return <div className="content-container">
<div className="thanks-container">
<div className="back-container">
<span
className="back-btn"
onTouchTap={this.goBack}
>
<img className="back-arrow" src={'./images/arrow.svg'} />
</span>
</div>
<h1 className="main-header">
Thanks for the request!
</h1>
<h2 className="second-header">
While you wait, take a look at the lyrics for <br />
<span className="lyrics-title">{this.props.requestedSong.songTitle}
</span>
</h2>
</div>
<div className="lyrics-container">
<h6 className="lyrics">
{this.props.lyrics}
</h6>
<div>
<CircularProgress/>
<h6>Loading lyrics...</h6>
</div>
</div>
</div>;
}
});
export default withRouter(Thanks);
| Add progress circle to thanks component | Add progress circle to thanks component
| JSX | mit | spanningtime/voque,spanningtime/voque | ---
+++
@@ -1,5 +1,7 @@
import React from 'react';
import { withRouter } from 'react-router';
+import CircularProgress from 'material-ui/CircularProgress';
+
const Thanks = React.createClass({
goBack() {
@@ -30,6 +32,10 @@
<h6 className="lyrics">
{this.props.lyrics}
</h6>
+ <div>
+ <CircularProgress/>
+ <h6>Loading lyrics...</h6>
+ </div>
</div>
</div>;
} |
fbaf842b7b41bab1bd997ccebe187a02b39d8c9c | src/code/moviepreview.jsx | src/code/moviepreview.jsx | /** @jsx React.DOM */
'use strict'
require("../css/moviepreview.css")
var React = require('react');
var $ = require('jquery');
module.exports = React.createClass({
displayName: 'MoviePreview',
getInitialState: function(){
return {
thumb: null
};
},
componentDidMount: function() {
var self = this;
$.getJSON('http://vimeo.com/api/v2/video/' + this.props.videoId + '.json').done(function(response){
self.setState({thumb: response[0].thumbnail_medium});
});
},
render: function(){
return (
<a className="moviepreview" href={'https://vimeo.com/' + this.props.videoId} style={{'backgroundImage': this.state.thumb ? 'url(' + this.state.thumb + ')' : ""}} target="_blank"><span>{this.props.name}</span></a>
)
}
}); | /** @jsx React.DOM */
'use strict'
require("../css/moviepreview.css")
var React = require('react');
var $ = require('jquery');
module.exports = React.createClass({
displayName: 'MoviePreview',
getInitialState: function(){
return {
thumb: null
};
},
componentDidMount: function() {
var self = this;
$.getJSON('//vimeo.com/api/v2/video/' + this.props.videoId + '.json').done(function(response){
self.setState({thumb: response[0].thumbnail_medium});
});
},
render: function(){
return (
<a className="moviepreview" href={'https://vimeo.com/' + this.props.videoId} style={{'backgroundImage': this.state.thumb ? 'url(' + this.state.thumb + ')' : ""}} target="_blank"><span>{this.props.name}</span></a>
)
}
}); | Use same protocol as host page | Use same protocol as host page
| JSX | mit | salicylic/movie-db-viewer,salicylic/movie-db-viewer | ---
+++
@@ -13,7 +13,7 @@
},
componentDidMount: function() {
var self = this;
- $.getJSON('http://vimeo.com/api/v2/video/' + this.props.videoId + '.json').done(function(response){
+ $.getJSON('//vimeo.com/api/v2/video/' + this.props.videoId + '.json').done(function(response){
self.setState({thumb: response[0].thumbnail_medium});
});
}, |
b68a5beec0d25ddc64c89067eb5d90380dfe225f | src/components/Header.jsx | src/components/Header.jsx | const React = window.React = require('react');
export default class Header extends React.Component {
constructor(props) {
super(props);
this.listenId = this.props.d.listenSession(() => {
this.forceUpdate();
});
}
componentWillUnmount() {
this.props.d.unlistenSession(this.listenId);
}
render() {
let networkBar;
console.log(this.props.network)
if (!this.props.network.isDefault) {
networkBar = <div className="so-back HeaderNetworkBarBack">
<div className="so-chunk HeaderNetworkBar">
<span>Horizon url: <strong>{this.props.network.horizonUrl}</strong></span>
<span>Network passphrase: <strong>{this.props.network.networkPassphrase}</strong></span>
</div>
</div>
}
return <div className="HeaderBackBack">
{networkBar}
<div className="so-back HeaderBack">
<div className="so-chunk Header">
<nav className="Header__nav">
<a className="Header__nav__item Header__nav__item--logo" href="#">StellarTerm</a>
<a className="Header__nav__item" href="#exchange">Exchange</a>
<a className="Header__nav__item" href="#markets">Markets</a>
<a className="Header__nav__item" href="#account">Account</a>
</nav>
</div>
</div>
</div>
}
}
| const React = window.React = require('react');
export default class Header extends React.Component {
constructor(props) {
super(props);
this.listenId = this.props.d.listenSession(() => {
this.forceUpdate();
});
}
componentWillUnmount() {
this.props.d.unlistenSession(this.listenId);
}
render() {
let networkBar;
console.log(this.props.network)
if (!this.props.network.isDefault) {
networkBar = <div className="so-back HeaderNetworkBarBack">
<div className="so-chunk">
<div className="HeaderNetworkBar">
<span>Horizon url: <strong>{this.props.network.horizonUrl}</strong></span>
<span>Network passphrase: <strong>{this.props.network.networkPassphrase}</strong></span>
</div>
</div>
</div>
}
return <div className="HeaderBackBack">
{networkBar}
<div className="so-back HeaderBack">
<div className="so-chunk Header">
<nav className="Header__nav">
<a className="Header__nav__item Header__nav__item--logo" href="#">StellarTerm</a>
<a className="Header__nav__item" href="#exchange">Exchange</a>
<a className="Header__nav__item" href="#markets">Markets</a>
<a className="Header__nav__item" href="#account">Account</a>
</nav>
</div>
</div>
</div>
}
}
| Fix awkward spacing in custom network header bar | Fix awkward spacing in custom network header bar
| JSX | apache-2.0 | irisli/stellarterm,irisli/stellarterm,irisli/stellarterm | ---
+++
@@ -15,9 +15,11 @@
console.log(this.props.network)
if (!this.props.network.isDefault) {
networkBar = <div className="so-back HeaderNetworkBarBack">
- <div className="so-chunk HeaderNetworkBar">
- <span>Horizon url: <strong>{this.props.network.horizonUrl}</strong></span>
- <span>Network passphrase: <strong>{this.props.network.networkPassphrase}</strong></span>
+ <div className="so-chunk">
+ <div className="HeaderNetworkBar">
+ <span>Horizon url: <strong>{this.props.network.horizonUrl}</strong></span>
+ <span>Network passphrase: <strong>{this.props.network.networkPassphrase}</strong></span>
+ </div>
</div>
</div>
} |
2bba73ee53dd56ee3b7df2b21894667ba7ab806d | 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>
);
}
} | Remove commas in Header class | Remove commas in Header class
| JSX | mit | renemonroy/es6-scaffold,renemonroy/es6-scaffold | ---
+++
@@ -12,7 +12,7 @@
export default class Header extends React.Component {
constructor(props) {
super(props);
- },
+ }
render() {
const { heading } = this.props,
{ ISContainer } = this.styles;
@@ -24,4 +24,4 @@
</header>
);
}
-};
+} |
c2134a37a0e85bcc3c9b626ccecb72f6b02c314b | client/activities/activity-back-button.jsx | client/activities/activity-back-button.jsx | import React from 'react'
import { connect } from 'react-redux'
import styled from 'styled-components'
import { goBack } from '../activities/action-creators'
import IconButton from '../material/icon-button.jsx'
import BackIcon from '../icons/material/baseline-arrow_back-24px.svg'
const BackButton = styled(IconButton)`
margin-right: 16px;
`
@connect(state => ({ activityOverlay: state.activityOverlay }))
export default class ActivityBackButton extends React.Component {
render() {
const { activityOverlay } = this.props
if (activityOverlay.history.size < 2) return null
return <BackButton icon={<BackIcon />} title='Click to go back' onClick={this.onBackClick} />
}
onBackClick = () => {
this.props.dispatch(goBack())
}
}
| import React from 'react'
import { connect } from 'react-redux'
import styled from 'styled-components'
import { goBack } from '../activities/action-creators'
import IconButton from '../material/icon-button.jsx'
import BackIcon from '../icons/material/baseline-arrow_back-24px.svg'
const BackButton = styled(IconButton)`
margin-right: 16px;
`
@connect(state => ({ activityOverlay: state.activityOverlay }))
export default class ActivityBackButton extends React.Component {
render() {
const { activityOverlay } = this.props
if (activityOverlay.history.size < 2) return null
return <BackButton icon={<BackIcon />} title='Back' onClick={this.onBackClick} />
}
onBackClick = () => {
this.props.dispatch(goBack())
}
}
| Simplify the title on the ActivityBackButton. This better matches the general pattern for titles (and works better for accessibility tools). | Simplify the title on the ActivityBackButton. This better matches the general pattern for titles (and works better for accessibility tools).
| JSX | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery | ---
+++
@@ -19,7 +19,7 @@
if (activityOverlay.history.size < 2) return null
- return <BackButton icon={<BackIcon />} title='Click to go back' onClick={this.onBackClick} />
+ return <BackButton icon={<BackIcon />} title='Back' onClick={this.onBackClick} />
}
onBackClick = () => { |
2d7a68938dba13f00b510acf7992fa7f4fe1f5f5 | imports/ui/components/FormMessage.jsx | imports/ui/components/FormMessage.jsx | import React from 'react';
import { Accounts } from 'meteor/accounts-base';
export class FormMessage extends React.Component {
render () {
let { message, type, className = "message", style = {} } = this.props;
return message ? (
<div style={ style }
className={[ className, type ].join(' ')}>{ message }</div>
) : null;
}
}
Accounts.ui.FormMessage = FormMessage;
| import React from 'react';
import { Accounts } from 'meteor/accounts-base';
export class FormMessage extends React.Component {
render () {
let { message, type, className = "message", style = {} } = this.props;
message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it
return message ? (
<div style={ style }
className={[ className, type ].join(' ')}>{ message }</div>
) : null;
}
}
Accounts.ui.FormMessage = FormMessage;
| Fix issue, when message is object | Fix issue, when message is object
I don`t now, what happend and in witch version of meteor. But I`ve had troubles with
meteor/std:accounts-ui
and
zetoff:accounts-material-ui
It`s fast simple fix, checked on meteor 1.4.1 and 1.4.2 | JSX | mit | studiointeract/accounts-ui | ---
+++
@@ -4,6 +4,7 @@
export class FormMessage extends React.Component {
render () {
let { message, type, className = "message", style = {} } = this.props;
+ message = _.isObject(message) ? message.message : message; // If message is object, then try to get message from it
return message ? (
<div style={ style }
className={[ className, type ].join(' ')}>{ message }</div> |
e672ff6016a02e98e3ff2c5834c9d079a6feaf7a | examples/panel/stories.jsx | examples/panel/stories.jsx | import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { PANEL } from '../../utilities/constants';
import Filtering from './filtering';
import FilteringLocked from './filtering-locked';
import FilteringError from './filtering-error';
storiesOf(PANEL, module)
.addDecorator((getStory) => (
<div className="slds-grid">
<div
className="slds-col--bump-left"
style={{ width: '420px' }}
>
{getStory()}
</div>
</div>
))
.add('Filters', () => <Filtering />)
.add('Filters Locked', () => <FilteringLocked />)
.add('Filters Error', () => <FilteringError />);
| import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { PANEL } from '../../utilities/constants';
import Filtering from './filtering';
import FilteringLocked from './filtering-locked';
import FilteringError from './filtering-error';
storiesOf(PANEL, module)
.addDecorator((getStory) => (
<div className="slds-grid" style={{ backgroundColor: '#ccc', padding: '20px' }}>
<div
className="slds-col--bump-left"
style={{ width: '420px' }}
>
{getStory()}
</div>
</div>
))
.add('Filters', () => <Filtering />)
.add('Filters Locked', () => <FilteringLocked />)
.add('Filters Error', () => <FilteringError />);
| Add styling to Panel story | Add styling to Panel story
| JSX | bsd-3-clause | salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react | ---
+++
@@ -8,7 +8,7 @@
storiesOf(PANEL, module)
.addDecorator((getStory) => (
- <div className="slds-grid">
+ <div className="slds-grid" style={{ backgroundColor: '#ccc', padding: '20px' }}>
<div
className="slds-col--bump-left"
style={{ width: '420px' }} |
60823e621a74ce4d8dd88e3838892491c9ec30df | lib/jsx/networkEventSubscribe.jsx | lib/jsx/networkEventSubscribe.jsx | /* global params, ActionDescriptor, stringIDToTypeID, executeAction, DialogModes */
// Expected params:
// - events: Array of strings representing event names
var i, actionDescriptor;
actionDescriptor = new ActionDescriptor();
actionDescriptor.putString(stringIDToTypeID("version"), "1.0.0");
for (i = 0; i < params.events.length; i++) {
actionDescriptor.putClass(stringIDToTypeID("eventIDAttr"), stringIDToTypeID(params.events[i]));
executeAction(stringIDToTypeID("networkEventSubscribe"), actionDescriptor, DialogModes.NO);
}
| /* global params, ActionDescriptor, stringIDToTypeID, executeAction, DialogModes */
// Expected params:
// - events: Array of strings representing event names
var i, actionDescriptor;
actionDescriptor = new ActionDescriptor();
//actionDescriptor.putString(stringIDToTypeID("version"), "1.0.0");
for (i = 0; i < params.events.length; i++) {
actionDescriptor.putClass(stringIDToTypeID("eventIDAttr"), stringIDToTypeID(params.events[i]));
executeAction(stringIDToTypeID("networkEventSubscribe"), actionDescriptor, DialogModes.NO);
}
| Use old version of the protocol | Use old version of the protocol
Until PS sends the imageChanged tag, must use the old version. | JSX | mit | camikazegreen/photoshop-scrambler,alesitalugo/generator-core,camikazegreen/photoshop-scrambler,jaredadobe/generator,adobe-photoshop/generator-core,codeorelse/generator-core,camikazegreen/photoshop-scrambler,kristjanmik/generator-assets,MikkoH/generator-core | ---
+++
@@ -5,7 +5,7 @@
var i, actionDescriptor;
actionDescriptor = new ActionDescriptor();
-actionDescriptor.putString(stringIDToTypeID("version"), "1.0.0");
+//actionDescriptor.putString(stringIDToTypeID("version"), "1.0.0");
for (i = 0; i < params.events.length; i++) {
actionDescriptor.putClass(stringIDToTypeID("eventIDAttr"), stringIDToTypeID(params.events[i]));
executeAction(stringIDToTypeID("networkEventSubscribe"), actionDescriptor, DialogModes.NO); |
492796fb963461050d7d953773455d29e34f1bf0 | src/js/refugee-map-borders-layer.jsx | src/js/refugee-map-borders-layer.jsx |
var React = require('react');
var d3 = require('d3');
var RefugeeMapBordersLayer = React.createClass({
getDefaultProps: function() {
return {subunitClass: 'subunit'}
},
componentDidMount: function() {
this.drawBorders();
},
drawBorders: function() {
var path = d3.geo.path().projection(this.props.projection);
var sel = d3.select(this.getDOMNode()).selectAll('.' + this.props.subunitClass)
.data(this.props.mapModel.featureData.features)
.enter()
.append('path')
.classed(this.props.subunitClass, true)
.attr("d", path);
if (this.props.onMouseOver) {
sel.on("mouseover", function(feature) {
this.props.onMouseOver(feature.properties.ADM0_A3);
}.bind(this));
}
if (this.props.onMouseOut) {
sel.on("mouseout", function(feature) {
this.props.onMouseOut(feature.properties.ADM0_A3);
}.bind(this));
}
return sel;
},
render: function() {
return <svg style={{width: this.props.width, height: this.props.height}}/>
}
});
module.exports = RefugeeMapBordersLayer;
|
var React = require('react');
var d3 = require('d3');
var RefugeeMapBordersLayer = React.createClass({
getDefaultProps: function() {
return {subunitClass: 'subunit'}
},
componentDidMount: function() {
},
onMouseOver: function(country) {
//console.log("over country" + country);
if (this.onMouseOver) {
this.props.onMouseOver(country);
}
},
onMouseOut: function(country) {
//console.log("out of country" + country);
if (this.onMouseOut) {
this.props.onMouseOut(country);
}
},
shouldComponentUpdate: function(nextProps, nextState) {
return false;
//return nextProps.highlightedCountry !== this.props.highlightedCountry;
},
getPaths: function() {
var path = d3.geo.path().projection(this.props.projection);
return this.props.mapModel.featureData.features.map(function(feature) {
return <path
className={this.props.subunitClass}
onMouseOver={this.onMouseOver.bind(this, feature.properties.ADM0_A3)}
onMouseOut={this.onMouseOut.bind(this, feature.properties.ADM0_A3)}
d={path(feature)} />
}.bind(this));
},
render: function() {
return (
<svg style={{width: this.props.width, height: this.props.height}}>
{this.getPaths()}
</svg>
)
}
});
module.exports = RefugeeMapBordersLayer;
| Move DOM management in borders layer to React from D3 | Move DOM management in borders layer to React from D3
| JSX | mit | lucified/lucify-refugees,lucified/lucify-refugees,lucified/lucify-refugees,lucified/lucify-refugees | ---
+++
@@ -6,42 +6,56 @@
var RefugeeMapBordersLayer = React.createClass({
- getDefaultProps: function() {
- return {subunitClass: 'subunit'}
- },
-
- componentDidMount: function() {
- this.drawBorders();
- },
-
- drawBorders: function() {
- var path = d3.geo.path().projection(this.props.projection);
-
- var sel = d3.select(this.getDOMNode()).selectAll('.' + this.props.subunitClass)
- .data(this.props.mapModel.featureData.features)
- .enter()
- .append('path')
- .classed(this.props.subunitClass, true)
- .attr("d", path);
-
- if (this.props.onMouseOver) {
- sel.on("mouseover", function(feature) {
- this.props.onMouseOver(feature.properties.ADM0_A3);
- }.bind(this));
- }
-
- if (this.props.onMouseOut) {
- sel.on("mouseout", function(feature) {
- this.props.onMouseOut(feature.properties.ADM0_A3);
- }.bind(this));
- }
- return sel;
- },
+ getDefaultProps: function() {
+ return {subunitClass: 'subunit'}
+ },
- render: function() {
- return <svg style={{width: this.props.width, height: this.props.height}}/>
- }
+ componentDidMount: function() {
+
+ },
+
+
+ onMouseOver: function(country) {
+ //console.log("over country" + country);
+ if (this.onMouseOver) {
+ this.props.onMouseOver(country);
+ }
+ },
+
+ onMouseOut: function(country) {
+ //console.log("out of country" + country);
+ if (this.onMouseOut) {
+ this.props.onMouseOut(country);
+ }
+ },
+
+
+ shouldComponentUpdate: function(nextProps, nextState) {
+ return false;
+ //return nextProps.highlightedCountry !== this.props.highlightedCountry;
+ },
+
+
+ getPaths: function() {
+ var path = d3.geo.path().projection(this.props.projection);
+
+ return this.props.mapModel.featureData.features.map(function(feature) {
+ return <path
+ className={this.props.subunitClass}
+ onMouseOver={this.onMouseOver.bind(this, feature.properties.ADM0_A3)}
+ onMouseOut={this.onMouseOut.bind(this, feature.properties.ADM0_A3)}
+ d={path(feature)} />
+ }.bind(this));
+ },
+
+ render: function() {
+ return (
+ <svg style={{width: this.props.width, height: this.props.height}}>
+ {this.getPaths()}
+ </svg>
+ )
+ }
});
|
211fcdb3305bf02ccc624c52c1168e47142c7dae | client/src/components/BeatSequencer/index.jsx | client/src/components/BeatSequencer/index.jsx | import React, { Component } from 'react';
import Sequence from './Sequence';
import PlayStopButton from './PlayStopButton'
/**
* logic of:
* - changing BPM
* - beat grouping
* - pass sounds to sequence
*/
class BeatSequencer extends Component {
constructor(props) {
super(props);
this.state = {
isPlaying: false
};
this.togglePlaying = this.togglePlaying.bind(this);
}
togglePlaying() {
const isPlaying = this.state.isPlaying;
this.setState({
isPlaying: !isPlaying
});
}
render() {
return (
<div className="beatSequencer">
<PlayStopButton
isPlaying={this.state.isPlaying}
handleClick={this.togglePlaying}
/>
<Sequence />
</div>
);
}
};
export default BeatSequencer;
| import React, { Component } from 'react';
import { Transport } from 'tone';
import Sequence from './Sequence';
import PlayStopButton from './PlayStopButton';
/**
* logic of:
* - changing BPM
* - beat grouping
* - pass sounds to sequence
*/
class BeatSequencer extends Component {
constructor(props) {
super(props);
this.state = {
isPlaying: false
};
this.togglePlaying = this.togglePlaying.bind(this);
}
togglePlaying() {
let isPlaying = this.state.isPlaying;
this.setState({
isPlaying: !isPlaying
});
isPlaying = this.state.isPlaying;
console.log('after setting state:', isPlaying);
console.log('Transport state', Transport.state);
if (Transport.state !== 'started') {
Transport.start();
} else {
Transport.stop();
}
}
render() {
return (
<div className="beatSequencer">
<PlayStopButton
isPlaying={this.state.isPlaying}
handleClick={this.togglePlaying}
/>
<Sequence isPlaying={this.state.isPlaying} />
</div>
);
}
}
export default BeatSequencer;
| Use Tone.Transport in main BeatSequencer & pass state to Sequence | Use Tone.Transport in main BeatSequencer & pass state to Sequence
| JSX | mit | NerdDiffer/reprise,NerdDiffer/reprise,NerdDiffer/reprise | ---
+++
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
+import { Transport } from 'tone';
import Sequence from './Sequence';
-import PlayStopButton from './PlayStopButton'
+import PlayStopButton from './PlayStopButton';
/**
* logic of:
@@ -20,11 +21,22 @@
}
togglePlaying() {
- const isPlaying = this.state.isPlaying;
+ let isPlaying = this.state.isPlaying;
this.setState({
isPlaying: !isPlaying
});
+
+ isPlaying = this.state.isPlaying;
+
+ console.log('after setting state:', isPlaying);
+ console.log('Transport state', Transport.state);
+
+ if (Transport.state !== 'started') {
+ Transport.start();
+ } else {
+ Transport.stop();
+ }
}
render() {
@@ -34,10 +46,10 @@
isPlaying={this.state.isPlaying}
handleClick={this.togglePlaying}
/>
- <Sequence />
+ <Sequence isPlaying={this.state.isPlaying} />
</div>
);
}
-};
+}
export default BeatSequencer; |
6ba0cb60ca8263a3fdac99d161333b1f78681a37 | common/components/forms/HiddenFormFields.jsx | common/components/forms/HiddenFormFields.jsx | // @flow
import React from "react";
import type { Dictionary, KeyValuePair } from "../types/Generics.jsx";
import _ from "lodash";
type DictionaryArgs = {|
sourceDict: Dictionary<string>,
|};
type SourceFieldsArgs<T> = {|
sourceObject: ?T,
fields: Dictionary<(T) => string>,
|};
type Props<T> = DictionaryArgs | SourceFieldsArgs<T>;
/**
* Render a list of hidden form fields based on an object
*/
class HiddenFormFields extends React.Component<Props> {
constructor(props: Props): void {
super(props);
}
render(): React$Node {
const nameValues: $ReadOnlyArray<KeyValuePair<string>> = this.props
.sourceDict
? _.entries(this.props.sourceDict)
: _.entries(
_.keys(this.props.fields).map(fieldName => [
fieldName,
this.props.fields[fieldName](this.props.sourceObject),
])
);
return (
<React.Fragment>
{nameValues.map((kvp: KeyValuePair<string>) =>
this._renderField(kvp[0], kvp[1])
)}
</React.Fragment>
);
}
_renderField(name: string, value: string): React$Node {
return (
<input type="hidden" key={name} id={name} name={name} value={value} />
);
}
}
export default HiddenFormFields;
| // @flow
import React from "react";
import type { Dictionary, KeyValuePair } from "../types/Generics.jsx";
import _ from "lodash";
type DictionaryArgs = {|
sourceDict: Dictionary<string>,
|};
type SourceFieldsArgs<T> = {|
sourceObject: ?T,
fields: Dictionary<(T) => string>,
|};
type Props<T> = DictionaryArgs | SourceFieldsArgs<T>;
/**
* Render a list of hidden form fields based on an object
*/
class HiddenFormFields extends React.Component<Props> {
constructor(props: Props): void {
super(props);
}
render(): React$Node {
const nameValues: $ReadOnlyArray<KeyValuePair<string>> = this.props
.sourceDict
? _.entries(this.props.sourceDict)
: _.keys(this.props.fields).map(fieldName => [
fieldName,
this.props.fields[fieldName](this.props.sourceObject),
]);
return (
<React.Fragment>
{nameValues.map((kvp: KeyValuePair<string>) =>
this._renderField(kvp[0], kvp[1])
)}
</React.Fragment>
);
}
_renderField(name: string, value: string): React$Node {
return (
<input type="hidden" key={name} id={name} name={name} value={value} />
);
}
}
export default HiddenFormFields;
| Fix LocationAutocomplete hidden form fields | Fix LocationAutocomplete hidden form fields
| JSX | mit | DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange | ---
+++
@@ -26,12 +26,10 @@
const nameValues: $ReadOnlyArray<KeyValuePair<string>> = this.props
.sourceDict
? _.entries(this.props.sourceDict)
- : _.entries(
- _.keys(this.props.fields).map(fieldName => [
- fieldName,
- this.props.fields[fieldName](this.props.sourceObject),
- ])
- );
+ : _.keys(this.props.fields).map(fieldName => [
+ fieldName,
+ this.props.fields[fieldName](this.props.sourceObject),
+ ]);
return (
<React.Fragment> |
f033ee417ec811bf2b06cbece9fa1fbf0a2dce56 | src/framework/box/Box.jsx | src/framework/box/Box.jsx |
import classNames from 'classnames';
import React from 'react';
import BaseBox from '../base/box/BaseBox.jsx';
const Box = props => {
const classes = classNames(Box.defaultProps.classes, props.classes);
const extendedProps = Object.assign({}, props, {
classes,
});
return (
<BaseBox
{...extendedProps}
/>
);
};
Box.propTypes = Object.assign({}, BaseBox.propTypes);
Box.defaultProps = {
classes: 'box',
};
export default Box;
|
import classNames from 'classnames/dedupe';
import React from 'react';
import BaseBox from '../base/box/BaseBox.jsx';
const Box = props => {
const classes = classNames(Box.defaultProps.classes, props.classes);
const extendedProps = Object.assign({}, props, {
classes,
});
return (
<BaseBox
{...extendedProps}
/>
);
};
Box.propTypes = Object.assign({}, BaseBox.propTypes);
Box.defaultProps = {
classes: 'box',
};
export default Box;
| Create box component - using classnames/dedupe to prevent classes added multiple times | [SDX-1041] Create box component
- using classnames/dedupe to prevent classes added multiple times
| JSX | mit | smaato/ui-framework | ---
+++
@@ -1,5 +1,5 @@
-import classNames from 'classnames';
+import classNames from 'classnames/dedupe';
import React from 'react';
import BaseBox from '../base/box/BaseBox.jsx'; |
dabd951399891ec8c2b0f73b89bea957c064ee29 | src/client/components/ProgressIndicator.jsx | src/client/components/ProgressIndicator.jsx | import React from 'react'
import LoadingBox from '@govuk-react/loading-box'
import styled from 'styled-components'
const StyledRoot = styled.div({
textAlign: 'center',
})
const StyledLoadingBox = styled(LoadingBox)({
height: '30px',
})
const ProgressIndicator = ({ message }) => (
<StyledRoot>
<StyledLoadingBox loading={true} />
{message && <p>{message}</p>}
</StyledRoot>
)
export default ProgressIndicator
| import React from 'react'
import LoadingBox from '@govuk-react/loading-box'
import { SPACING } from '@govuk-react/constants'
import styled from 'styled-components'
const StyledRoot = styled.div({
textAlign: 'center',
})
const StyledLoadingBox = styled(LoadingBox)({
height: SPACING.SCALE_5,
marginTop: SPACING.SCALE_5,
marginBottom: SPACING.SCALE_3,
})
const ProgressIndicator = ({ message }) => (
<StyledRoot>
<StyledLoadingBox loading={true} />
{message && <p>{message}</p>}
</StyledRoot>
)
export default ProgressIndicator
| Reposition the loading indicator slightly further down the page | Reposition the loading indicator slightly further down the page
| JSX | mit | uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -1,5 +1,6 @@
import React from 'react'
import LoadingBox from '@govuk-react/loading-box'
+import { SPACING } from '@govuk-react/constants'
import styled from 'styled-components'
const StyledRoot = styled.div({
@@ -7,7 +8,9 @@
})
const StyledLoadingBox = styled(LoadingBox)({
- height: '30px',
+ height: SPACING.SCALE_5,
+ marginTop: SPACING.SCALE_5,
+ marginBottom: SPACING.SCALE_3,
})
const ProgressIndicator = ({ message }) => ( |
ddfe4b6d45fd09775b064de0ab0bc186bcc2f944 | src/components/Layout/FilterInput/index.jsx | src/components/Layout/FilterInput/index.jsx | // @flow
import React, { Component } from 'react'
type Props = {
onEnter?: ?Function,
value: string,
}
class FilterInput extends Component<Props> {
onEnter = (string) => {
if (this.props.onEnter)
this.props.onEnter(string)
}
onKeyPress = (event) => {
if (event.key === 'Enter')
this.onEnter(event.target.value)
}
render = () => (
<input
aria-label="Filter input"
className="form-control float-right mt-3"
defaultValue={this.props.value}
onKeyPress={this.onKeyPress}
placeholder="Filter"
size="40"
type="text"
/>
)
}
export default FilterInput
| // @flow
import React, { Component } from 'react'
type Props = {
onEnter?: ?Function,
value: string,
}
type State = {
value: string,
}
class FilterInput extends Component<Props, State> {
constructor(props: Props) {
super(props)
this.state = {
value: props.value,
}
}
componentWillReceiveProps(nextProps) {
this.setState({ value: nextProps.value })
}
onChange = (event) => {
this.setState({ value: event.target.value })
}
onEnter = (string) => {
if (this.props.onEnter)
this.props.onEnter(string)
}
onKeyPress = (event) => {
if (event.key === 'Enter')
this.onEnter(event.target.value)
}
render = () => (
<input
aria-label="Filter input"
className="form-control float-right mt-3"
onChange={this.onChange}
onKeyPress={this.onKeyPress}
placeholder="Filter"
size="40"
type="text"
value={this.state.value}
/>
)
}
export default FilterInput
| Fix for a filter input bug | Fix for a filter input bug
| JSX | mit | emwalker/digraffe,emwalker/digraffe,emwalker/digraffe | ---
+++
@@ -6,7 +6,26 @@
value: string,
}
-class FilterInput extends Component<Props> {
+type State = {
+ value: string,
+}
+
+class FilterInput extends Component<Props, State> {
+ constructor(props: Props) {
+ super(props)
+ this.state = {
+ value: props.value,
+ }
+ }
+
+ componentWillReceiveProps(nextProps) {
+ this.setState({ value: nextProps.value })
+ }
+
+ onChange = (event) => {
+ this.setState({ value: event.target.value })
+ }
+
onEnter = (string) => {
if (this.props.onEnter)
this.props.onEnter(string)
@@ -21,11 +40,12 @@
<input
aria-label="Filter input"
className="form-control float-right mt-3"
- defaultValue={this.props.value}
+ onChange={this.onChange}
onKeyPress={this.onKeyPress}
placeholder="Filter"
size="40"
type="text"
+ value={this.state.value}
/>
)
} |
4b58bab78c9ba7ef7934837344c9d40e2aa079d1 | application/ui/components/resource.jsx | application/ui/components/resource.jsx | /** @jsx React.DOM */
'use strict';
var React = require('react');
var cx = require('react/lib/cx');
var Method = require('./method');
module.exports = React.createClass({
displayName : 'Resource',
propTypes : {
name : React.PropTypes.string.isRequired,
methods : React.PropTypes.array.isRequired
},
getMethodComponent : function(method)
{
return <Method key={method.name}
name={method.name}
synopsis={method.synopsis}
method={method.method}
uri={method.uri}
oauth={method.oauth}
params={method.params}
oauthStore={this.props.oauthStore}
/>;
},
render : function()
{
var panelClasses = cx({
'panel' : true,
'panel--moveup' : ! this.props.oAuthPanelHidden
});
return (
<div className={panelClasses}>
<div className='panel__header'>
<h2>{this.props.name}</h2>
</div>
{this.props.methods.map(this.getMethodComponent)}
</div>
);
}
});
| /** @jsx React.DOM */
'use strict';
var React = require('react');
var cx = require('react/lib/cx');
var Method = require('./method');
module.exports = React.createClass({
displayName : 'Resource',
propTypes : {
name : React.PropTypes.string.isRequired,
methods : React.PropTypes.array.isRequired
},
getMethodComponent : function(method)
{
return <Method key={method.name}
name={method.name}
synopsis={method.synopsis}
method={method.method}
uri={method.uri}
oauth={method.oauth}
params={method.params}
oauthStore={this.props.oauthStore}/>;
},
render : function()
{
var panelClasses = cx({
'panel' : true,
'panel--moveup' : ! this.props.oAuthPanelHidden
});
return (
<div className={panelClasses}>
<div className='panel__header'>
<h2>{this.props.name}</h2>
</div>
{this.props.methods.map(this.getMethodComponent)}
</div>
);
}
});
| Fix formatting that Sublime Text doesn't like. | Fix formatting that Sublime Text doesn't like.
| JSX | mit | synapsestudios/lively,synapsestudios/lively | ---
+++
@@ -23,8 +23,7 @@
uri={method.uri}
oauth={method.oauth}
params={method.params}
- oauthStore={this.props.oauthStore}
- />;
+ oauthStore={this.props.oauthStore}/>;
},
render : function() |
92848043417da1bea5e622e998a61c9d87ec4195 | src/js/components/happening-now/index.jsx | src/js/components/happening-now/index.jsx | import debug from "debug";
import React, { Component } from "react";
import Track from "../track";
const log = debug("schedule:components:happening-now");
export class HappeningNow extends Component {
updateCurrentSessions(props) {
const { getState } = props;
const { current, tracks, sessions } = getState();
this.setState({
sessions: current.sessions.
map(id => sessions[id]).
reduce((a, s) => null == a.find(ss => s.track === ss.track) ? [...a, s] : a, []).
slice(0, 3).
map(s => ({ ...tracks[s.track], sessions: [s] }))
});
}
componentWillMount() {
this.updateCurrentSessions(this.props);
}
componentWillReceiveProps(newProps) {
this.updateCurrentSessions(newProps);
}
render() {
const { sessions } = this.state;
return (
<div className="current-sessions">
{
sessions.map(t => {
return (
<div key={t.name} className="current-sessions__track">
<Track { ...t } />
</div>
);
})
}
</div>
);
}
}
export default HappeningNow;
| import debug from "debug";
import React, { Component } from "react";
import Track from "../track";
const log = debug("schedule:components:happening-now");
export class HappeningNow extends Component {
updateCurrentSessions(props) {
const { getState } = props;
const { current, tracks, sessions } = getState();
this.setState({
sessions: current.sessions.
map(id => sessions[id]).
reduce((a, s) => null == a.find(ss => s.track === ss.track) ? [...a, s] : a, []).
slice(0, 3).
map(s => ({ ...tracks[s.track], sessions: [s] }))
});
}
componentWillMount() {
this.updateCurrentSessions(this.props);
}
componentWillReceiveProps(newProps) {
this.updateCurrentSessions(newProps);
}
render() {
const { sessions } = this.state;
return (
<div className="current-sessions">
{
0 < sessions.length
? sessions.map(t => {
return (
<div key={t.name} className="current-sessions__track">
<Track { ...t } />
</div>
);
})
: <p>No sessions right now :-(</p>
}
</div>
);
}
}
export default HappeningNow;
| Add cure for empty current sessions page | Add cure for empty current sessions page
| JSX | mit | nikcorg/schedule,nikcorg/schedule,nikcorg/schedule | ---
+++
@@ -32,13 +32,15 @@
return (
<div className="current-sessions">
{
- sessions.map(t => {
+ 0 < sessions.length
+ ? sessions.map(t => {
return (
<div key={t.name} className="current-sessions__track">
<Track { ...t } />
</div>
);
})
+ : <p>No sessions right now :-(</p>
}
</div>
); |
181e7cd8c913a5250b9468a94bd8686e3b914620 | src/components/hptrack.jsx | src/components/hptrack.jsx | import React from 'react';
import HpBlock from './hpblock';
import Button from './button';
import helpers from '../utilities/helpers';
// import style from '../style/hptrack.css';
export default function HpTrack(props) {
const { calculateHp, setSelectedMonster } = props;
const blocks = props.monsters.map((monster, index) =>
<section key={monster.arrayIndex}>
<h2>
<Button event={() => {}}>Clear Monster</Button>
<Button
className="{style.btn}"
event={helpers.partialApply(setSelectedMonster, monster.arrayIndex)}
>
{monster.name}
</Button>
</h2>
<HpBlock
monster={monster}
monsterIndex={index}
calculateHp={calculateHp}
/>
</section>
);
return (
<div>
{blocks}
</div>
);
}
HpTrack.propTypes = {
calculateHp: React.PropTypes.func,
monsters: React.PropTypes.arrayOf(
React.PropTypes.shape({})
),
setSelectedMonster: React.PropTypes.func
};
| import React from 'react';
import HpBlock from './hpblock';
import Button from './button';
import ButtonClose from './button-close';
import helpers from '../utilities/helpers';
import style from '../style/hptrack.css';
export default function HpTrack(props) {
const { calculateHp, deleteMonster, setSelectedMonster } = props;
const blocks = props.monsters.map((monster, index) =>
<section key={monster.arrayIndex}>
<h2>
<Button
className={style.btn}
event={helpers.partialApply(setSelectedMonster, monster.arrayIndex)}
>
{monster.name}
</Button>
<ButtonClose event={() => deleteMonster(monster)} />
</h2>
<HpBlock
monster={monster}
monsterIndex={index}
calculateHp={calculateHp}
/>
</section>
);
return (
<div>
{blocks}
</div>
);
}
HpTrack.propTypes = {
calculateHp: React.PropTypes.func,
deleteMonster: React.PropTypes.func,
monsters: React.PropTypes.arrayOf(
React.PropTypes.shape({})
),
setSelectedMonster: React.PropTypes.func
};
| Add delete button and function | Add delete button and function
| JSX | mit | jkrayer/summoner,jkrayer/summoner | ---
+++
@@ -1,21 +1,22 @@
import React from 'react';
import HpBlock from './hpblock';
import Button from './button';
+import ButtonClose from './button-close';
import helpers from '../utilities/helpers';
-// import style from '../style/hptrack.css';
+import style from '../style/hptrack.css';
export default function HpTrack(props) {
- const { calculateHp, setSelectedMonster } = props;
+ const { calculateHp, deleteMonster, setSelectedMonster } = props;
const blocks = props.monsters.map((monster, index) =>
<section key={monster.arrayIndex}>
<h2>
- <Button event={() => {}}>Clear Monster</Button>
<Button
- className="{style.btn}"
+ className={style.btn}
event={helpers.partialApply(setSelectedMonster, monster.arrayIndex)}
>
{monster.name}
</Button>
+ <ButtonClose event={() => deleteMonster(monster)} />
</h2>
<HpBlock
monster={monster}
@@ -34,6 +35,7 @@
HpTrack.propTypes = {
calculateHp: React.PropTypes.func,
+ deleteMonster: React.PropTypes.func,
monsters: React.PropTypes.arrayOf(
React.PropTypes.shape({})
), |
c46983b8173a9a29d11f3d3481c34f803e54e9d5 | src/_app/player/components/player-status.jsx | src/_app/player/components/player-status.jsx | import React, { Component, PropTypes } from 'react';
class PlayerStatus extends Component {
render() {
const { activeSong } = this.props;
return (
<div className="player-status">
<div className="song-status">
<h4>{activeSong.title}</h4>
<p>{activeSong.url}</p>
</div>
</div>
);
}
}
PlayerStatus.propTypes = {
activeSong: PropTypes.object.isRequired
};
export default PlayerStatus;
| import React, { Component, PropTypes } from 'react';
class PlayerStatus extends Component {
render() {
const { activeSong } = this.props;
return (
<div className="player-status">
<div className="song-status">
<h4>{activeSong.title}</h4>
</div>
</div>
);
}
}
PlayerStatus.propTypes = {
activeSong: PropTypes.object.isRequired
};
export default PlayerStatus;
| Remove url from player status | Remove url from player status
| JSX | mit | yanglinz/reddio,yanglinz/reddio | ---
+++
@@ -7,7 +7,6 @@
<div className="player-status">
<div className="song-status">
<h4>{activeSong.title}</h4>
- <p>{activeSong.url}</p>
</div>
</div>
); |
19b0bd9dd7126aafaa8cf57d54b20b267c283b73 | infotv/frontend/src/overlay.jsx | infotv/frontend/src/overlay.jsx | import React from "react";
import moment from "moment";
import DatumManager from "./datum";
export default class OverlayComponent extends React.Component {
componentWillMount() {
this.clockUpdateTimer = setInterval(() => { this.forceUpdate(); }, 5000);
}
componentWillUnmount() {
clearInterval(this.clockUpdateTimer);
this.clockUpdateTimer = null;
}
renderWeather() {
const weather = DatumManager.getValue("weather");
if (!weather) return null;
let temperature;
let icon;
try {
temperature = weather.main.temp - 273.15;
} catch (problem) {
temperature = null;
}
try {
icon = weather.weather[0].icon;
icon = <img src={`http://openweathermap.org/img/w/${icon}.png`} alt="weather icon" />;
} catch (problem) {
icon = null;
}
return (<div className="weather">
<span>{temperature ? `${temperature.toLocaleString("fi", { maximumFractionDigits: 1 })}°C` : ""}</span>
<span>{icon}</span>
</div>);
}
render() {
const text = moment().format("HH:mm");
const weather = this.renderWeather();
return (<div id="quad">
<div className="clock">{text}</div>
{weather}
</div>);
}
}
| import React from "react";
import moment from "moment";
import _ from "lodash";
import DatumManager from "./datum";
export default class OverlayComponent extends React.Component {
componentWillMount() {
this.clockUpdateTimer = setInterval(() => { this.forceUpdate(); }, 5000);
}
componentWillUnmount() {
clearInterval(this.clockUpdateTimer);
this.clockUpdateTimer = null;
}
renderWeather() {
const weather = DatumManager.getValue("weather");
if (!weather) return null;
let temperature;
let icon;
try {
temperature = weather.main.temp - 273.15;
} catch (problem) {
temperature = null;
}
try {
icon = weather.weather[0].icon;
icon = <img src={`http://openweathermap.org/img/w/${icon}.png`} alt="weather icon" />;
} catch (problem) {
icon = null;
}
return (
<div className="weather">
<span>
{_.isFinite(temperature)
? `${temperature.toLocaleString("fi", { maximumFractionDigits: 1 })}°C`
: ""
}
</span>
<span>{icon}</span>
</div>
);
}
render() {
const text = moment().format("HH:mm");
const weather = this.renderWeather();
return (<div id="quad">
<div className="clock">{text}</div>
{weather}
</div>);
}
}
| Support weather with 0 degrees | Support weather with 0 degrees
| JSX | mit | kcsry/infotv,kcsry/infotv,kcsry/infotv | ---
+++
@@ -1,5 +1,6 @@
import React from "react";
import moment from "moment";
+import _ from "lodash";
import DatumManager from "./datum";
export default class OverlayComponent extends React.Component {
@@ -29,10 +30,17 @@
icon = null;
}
- return (<div className="weather">
- <span>{temperature ? `${temperature.toLocaleString("fi", { maximumFractionDigits: 1 })}°C` : ""}</span>
- <span>{icon}</span>
- </div>);
+ return (
+ <div className="weather">
+ <span>
+ {_.isFinite(temperature)
+ ? `${temperature.toLocaleString("fi", { maximumFractionDigits: 1 })}°C`
+ : ""
+ }
+ </span>
+ <span>{icon}</span>
+ </div>
+ );
}
render() { |
f7973351133797c8d4406e400c9fc6b04ae60e8c | docs/src/Examples/Demo/BasicDatePicker.jsx | docs/src/Examples/Demo/BasicDatePicker.jsx | import React, { Fragment, PureComponent } from 'react';
import { DatePicker } from 'material-ui-pickers';
import { FormControl } from 'material-ui';
export default class BasicDatePicker extends PureComponent {
state = {
selectedDate: new Date(),
}
handleDateChange = (date) => {
this.setState({ selectedDate: date });
}
render() {
const { selectedDate } = this.state;
return (
<Fragment>
<div className="picker">
<FormControl>
<DatePicker
label="Basic example"
value={selectedDate}
onChange={this.handleDateChange}
animateYearScrolling={false}
/>
</FormControl>
</div>
<div className="picker">
<DatePicker
label="Clearable"
clearable
disableFuture
maxDateMessage="Date must be less than today"
value={selectedDate}
onChange={this.handleDateChange}
animateYearScrolling={false}
/>
</div>
</Fragment>
);
}
}
| import React, { Fragment, PureComponent } from 'react';
import { DatePicker } from 'material-ui-pickers';
g;
export default class BasicDatePicker extends PureComponent {
state = {
selectedDate: new Date(),
}
handleDateChange = (date) => {
this.setState({ selectedDate: date });
}
render() {
const { selectedDate } = this.state;
return (
<Fragment>
<div className="picker">
<DatePicker
label="Basic example"
value={selectedDate}
onChange={this.handleDateChange}
animateYearScrolling={false}
/>
</div>
<div className="picker">
<DatePicker
label="Clearable"
clearable
disableFuture
maxDateMessage="Date must be less than today"
value={selectedDate}
onChange={this.handleDateChange}
animateYearScrolling={false}
/>
</div>
</Fragment>
);
}
}
| Remove testing fixture from DatePicker example | Remove testing fixture from DatePicker example
| JSX | mit | mbrookes/material-ui,callemall/material-ui,mbrookes/material-ui,dmtrKovalenko/material-ui-pickers,mui-org/material-ui,dmtrKovalenko/material-ui-pickers,callemall/material-ui,oliviertassinari/material-ui,oliviertassinari/material-ui,mui-org/material-ui,mui-org/material-ui,oliviertassinari/material-ui,mbrookes/material-ui,rscnt/material-ui,callemall/material-ui,rscnt/material-ui,callemall/material-ui,rscnt/material-ui | ---
+++
@@ -1,6 +1,7 @@
import React, { Fragment, PureComponent } from 'react';
import { DatePicker } from 'material-ui-pickers';
-import { FormControl } from 'material-ui';
+
+ g;
export default class BasicDatePicker extends PureComponent {
state = {
@@ -17,15 +18,12 @@
return (
<Fragment>
<div className="picker">
- <FormControl>
- <DatePicker
- label="Basic example"
- value={selectedDate}
- onChange={this.handleDateChange}
- animateYearScrolling={false}
- />
- </FormControl>
-
+ <DatePicker
+ label="Basic example"
+ value={selectedDate}
+ onChange={this.handleDateChange}
+ animateYearScrolling={false}
+ />
</div>
<div className="picker"> |
a85d1a36c508b416c1be6552f844458792175479 | ui/src/components/Toolbar/PagingButtons.jsx | ui/src/components/Toolbar/PagingButtons.jsx | import React from 'react';
import { FormattedMessage } from 'react-intl';
import { ButtonGroup, Button, AnchorButton } from "@blueprintjs/core";
import './PagingButtons.css';
export default class extends React.Component {
render() {
const { location: loc } = this.props;
if (this.props.pageNumber && this.props.pageNumber > 0 &&
this.props.pageTotal && this.props.pageTotal > 0) {
return (
<ButtonGroup className="PagingButtons" minimal={false} style={{float: 'left'}}>
<AnchorButton href={`${(loc.hash) ? loc.hash+'&' : '#'}page=${this.props.pageNumber-1}`} icon="arrow-left" disabled={this.props.pageNumber <= 1}/>
<Button disabled className="PagingText">
<FormattedMessage
id="document.paging"
defaultMessage="Page {pageNumber} of {pageTotal}"
values={{
pageNumber: this.props.pageNumber,
pageTotal: this.props.pageTotal
}}
/>
</Button>
<AnchorButton href={`${(loc.hash) ? loc.hash+'&' : '#'}page=${this.props.pageNumber+1}`} icon="arrow-right" disabled={this.props.pageNumber >= this.props.pageTotal}/>
</ButtonGroup>
);
} else {
return null
}
}
} | import React from 'react';
import { FormattedMessage } from 'react-intl';
import queryString from 'query-string';
import { ButtonGroup, Button, AnchorButton } from "@blueprintjs/core";
import './PagingButtons.css';
export default class extends React.Component {
render() {
const { pageNumber, pageTotal, location: loc } = this.props;
// Preserve exsting hash value while updating any existing value for 'page'
const parsedHash = queryString.parse(loc.hash);
if (parsedHash.page)
delete parsedHash.page
parsedHash.page = pageNumber-1;
const prevButtonLink = queryString.stringify(parsedHash);
parsedHash.page = pageNumber+1;
const nextButtonLink = queryString.stringify(parsedHash);
if (pageNumber && pageNumber > 0 &&
pageTotal && pageTotal > 0) {
return (
<ButtonGroup className="PagingButtons" minimal={false} style={{float: 'left'}}>
<AnchorButton href={`#${prevButtonLink}`} icon="arrow-left" disabled={pageNumber <= 1}/>
<Button disabled className="PagingText">
<FormattedMessage
id="document.paging"
defaultMessage="Page {pageNumber} of {pageTotal}"
values={{
pageNumber: pageNumber,
pageTotal: pageTotal
}}
/>
</Button>
<AnchorButton href={`#${nextButtonLink}`} icon="arrow-right" disabled={pageNumber >= pageTotal}/>
</ButtonGroup>
);
} else {
return null
}
}
} | Fix for paging buttons to preserve the hashpath | Fix for paging buttons to preserve the hashpath
| JSX | mit | alephdata/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph | ---
+++
@@ -1,28 +1,41 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
+import queryString from 'query-string';
import { ButtonGroup, Button, AnchorButton } from "@blueprintjs/core";
import './PagingButtons.css';
export default class extends React.Component {
render() {
- const { location: loc } = this.props;
- if (this.props.pageNumber && this.props.pageNumber > 0 &&
- this.props.pageTotal && this.props.pageTotal > 0) {
+ const { pageNumber, pageTotal, location: loc } = this.props;
+
+ // Preserve exsting hash value while updating any existing value for 'page'
+ const parsedHash = queryString.parse(loc.hash);
+ if (parsedHash.page)
+ delete parsedHash.page
+
+ parsedHash.page = pageNumber-1;
+ const prevButtonLink = queryString.stringify(parsedHash);
+
+ parsedHash.page = pageNumber+1;
+ const nextButtonLink = queryString.stringify(parsedHash);
+
+ if (pageNumber && pageNumber > 0 &&
+ pageTotal && pageTotal > 0) {
return (
<ButtonGroup className="PagingButtons" minimal={false} style={{float: 'left'}}>
- <AnchorButton href={`${(loc.hash) ? loc.hash+'&' : '#'}page=${this.props.pageNumber-1}`} icon="arrow-left" disabled={this.props.pageNumber <= 1}/>
+ <AnchorButton href={`#${prevButtonLink}`} icon="arrow-left" disabled={pageNumber <= 1}/>
<Button disabled className="PagingText">
<FormattedMessage
id="document.paging"
defaultMessage="Page {pageNumber} of {pageTotal}"
values={{
- pageNumber: this.props.pageNumber,
- pageTotal: this.props.pageTotal
+ pageNumber: pageNumber,
+ pageTotal: pageTotal
}}
/>
</Button>
- <AnchorButton href={`${(loc.hash) ? loc.hash+'&' : '#'}page=${this.props.pageNumber+1}`} icon="arrow-right" disabled={this.props.pageNumber >= this.props.pageTotal}/>
+ <AnchorButton href={`#${nextButtonLink}`} icon="arrow-right" disabled={pageNumber >= pageTotal}/>
</ButtonGroup>
);
} else { |
91b703a09b7d1252293b5525874c51dc011790e8 | react/frontpage/components/PromoBanner.jsx | react/frontpage/components/PromoBanner.jsx | // PromoBanner.jsx
// A carousel of various promotion related material (ie Show of the Month, Ticket Giveaways, ect)
import React from 'react';
// Open-Source Components
import Slider from 'react-slick';
// Common Components
import RectImage from '../../common/RectImage.jsx';
import { Link } from 'react-router';
// styling
require('./PromoBanner.scss');
var PromoBanner = React.createClass({
render: function() {
var settings = {
dots: true,
autoplay: true,
infinite: true,
fade: true,
autoplaySpeed: 5000
};
return (
<div className="promoBanner">
<Slider {...settings}>
<div>
<Link to="/shows/90">
<RectImage src="/img/sotm-mar17-nuindigo.png" aspectRatio={5}><div className="overlay" /></RectImage>
</Link>
</div>
<div>
<Link to="/shows/90">
<RectImage src="/img/sotm-feb2017.jpg" aspectRatio={5}><div className="overlay" /></RectImage>
</Link>
</div>
<div>
<Link to="/shows/90">
<RectImage src="/img/sotm_january_2017.png" aspectRatio={5}><div className="overlay" /></RectImage>
</Link>
</div>
</Slider>
</div>
);
}
});
export default PromoBanner; | // PromoBanner.jsx
// A carousel of various promotion related material (ie Show of the Month, Ticket Giveaways, ect)
import React from 'react';
// Open-Source Components
import Slider from 'react-slick';
// Common Components
import RectImage from '../../common/RectImage.jsx';
import { Link } from 'react-router';
// styling
require('./PromoBanner.scss');
// Promo Banner Data
const bannerData = [
{"img": "/img/sotm-mar17-nuindigo.png", "link": "/shows/90"},
{"img": "/img/sotm-feb2017.jpg", "link": "/shows/75"},
{"img": "/img/sotm_january_2017.png", "link": "/shows/83"}
];
var PromoBanner = React.createClass({
render: function() {
var settings = {
dots: true,
autoplay: true,
infinite: true,
fade: true,
autoplaySpeed: 5000
};
var banners = bannerData.map(function(banner) {
return (
<div>
<Link to={banner.link}>
<RectImage src={banner.img} aspectRatio={5}>
<div className="overlay" />
</RectImage>
</Link>
</div>
);
});
console.log(banners);
return (
<div className="promoBanner">
<Slider {...settings}>
{banners}
</Slider>
</div>
);
}
});
export default PromoBanner; | Move promo banner data into a hard coded JSON array | Move promo banner data into a hard coded JSON array
| JSX | agpl-3.0 | uclaradio/uclaradio,uclaradio/uclaradio,uclaradio/uclaradio | ---
+++
@@ -14,6 +14,13 @@
// styling
require('./PromoBanner.scss');
+// Promo Banner Data
+const bannerData = [
+ {"img": "/img/sotm-mar17-nuindigo.png", "link": "/shows/90"},
+ {"img": "/img/sotm-feb2017.jpg", "link": "/shows/75"},
+ {"img": "/img/sotm_january_2017.png", "link": "/shows/83"}
+];
+
var PromoBanner = React.createClass({
render: function() {
var settings = {
@@ -24,27 +31,23 @@
autoplaySpeed: 5000
};
+ var banners = bannerData.map(function(banner) {
+ return (
+ <div>
+ <Link to={banner.link}>
+ <RectImage src={banner.img} aspectRatio={5}>
+ <div className="overlay" />
+ </RectImage>
+ </Link>
+ </div>
+ );
+ });
+
+ console.log(banners);
return (
<div className="promoBanner">
<Slider {...settings}>
- <div>
- <Link to="/shows/90">
- <RectImage src="/img/sotm-mar17-nuindigo.png" aspectRatio={5}><div className="overlay" /></RectImage>
- </Link>
- </div>
-
- <div>
- <Link to="/shows/90">
- <RectImage src="/img/sotm-feb2017.jpg" aspectRatio={5}><div className="overlay" /></RectImage>
- </Link>
- </div>
-
- <div>
- <Link to="/shows/90">
- <RectImage src="/img/sotm_january_2017.png" aspectRatio={5}><div className="overlay" /></RectImage>
- </Link>
- </div>
-
+ {banners}
</Slider>
</div>
); |
0507371d6f8e1e8d0cdbcf114d8258e88f79ef4c | src/components/PrimalMultiplication.jsx | src/components/PrimalMultiplication.jsx | import React from 'react';
import MultiplicationTable from './MultiplicationTable.jsx';
import findPrimes from '../helpers/find-primes.js';
class PrimalMultiplication extends React.Component {
constructor(props) {
super(props);
this.state = {
primesLength: 10,
primes: findPrimes(10)
};
}
render() {
return (
<div className="primal-multiplication">
<MultiplicationTable primesLength={this.state.primesLength} primes={this.state.primes} />
</div>
);
}
}
export default PrimalMultiplication;
| import React from 'react';
import MultiplicationTable from './MultiplicationTable.jsx';
import findPrimes from '../helpers/find-primes.js';
class PrimalMultiplication extends React.Component {
constructor(props) {
super(props);
this.state = {
primesLength: props.initialPrimesLength,
primes: findPrimes(props.initialPrimesLength)
};
}
render() {
return (
<div className="primal-multiplication">
<MultiplicationTable primesLength={this.state.primesLength} primes={this.state.primes} />
</div>
);
}
}
PrimalMultiplication.defaultProps = {
initialPrimesLength: 10
};
export default PrimalMultiplication;
| Use defaultProps for component defaults | Use defaultProps for component defaults
| JSX | cc0-1.0 | acusti/primal-multiplication,acusti/primal-multiplication | ---
+++
@@ -6,8 +6,8 @@
constructor(props) {
super(props);
this.state = {
- primesLength: 10,
- primes: findPrimes(10)
+ primesLength: props.initialPrimesLength,
+ primes: findPrimes(props.initialPrimesLength)
};
}
@@ -20,4 +20,8 @@
}
}
+PrimalMultiplication.defaultProps = {
+ initialPrimesLength: 10
+};
+
export default PrimalMultiplication; |
bb50d49c524bc929f294c0ccf0f0fda3eb326d35 | src/containers/monitor.jsx | src/containers/monitor.jsx | const bindAll = require('lodash.bindall');
const React = require('react');
const MonitorComponent = require('../components/monitor/monitor.jsx');
class Monitor extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleDragEnd'
]);
}
handleDragEnd (_, {x, y}) {
this.props.onDragEnd(
this.props.id,
x,
y
);
}
render () {
return (
<MonitorComponent
{...this.props}
onDragEnd={this.handleDragEnd}
/>
);
}
}
Monitor.propTypes = MonitorComponent.propTypes;
module.exports = Monitor;
| const bindAll = require('lodash.bindall');
const React = require('react');
const MonitorComponent = require('../components/monitor/monitor.jsx');
class Monitor extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleDragEnd'
]);
}
handleDragEnd (e, {x, y}) {
this.props.onDragEnd(
this.props.id,
x,
y
);
}
render () {
return (
<MonitorComponent
{...this.props}
onDragEnd={this.handleDragEnd}
/>
);
}
}
Monitor.propTypes = MonitorComponent.propTypes;
module.exports = Monitor;
| Add name for unused event variable | Add name for unused event variable
| JSX | bsd-3-clause | cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui | ---
+++
@@ -10,7 +10,7 @@
'handleDragEnd'
]);
}
- handleDragEnd (_, {x, y}) {
+ handleDragEnd (e, {x, y}) {
this.props.onDragEnd(
this.props.id,
x, |
8353bcb2789ce8c595230c24baf5767809b74394 | imports/ui/containers/SearchShowsContainer.jsx | imports/ui/containers/SearchShowsContainer.jsx | import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import SearchShows from '../pages/SearchShows.jsx';
export default createContainer(() => {
const languagesSubscribe = Meteor.subscribe('languages.public');
const countriesSubscribe = TAPi18n.subscribe('countries.public');
const localitiesSubscribe = Meteor.subscribe('localities.public');
const administrativeAreasSubscribe = Meteor.subscribe('administrativeAreas.public');
const loading = !(localitiesSubscribe.ready() && countriesSubscribe.ready() && administrativeAreasSubscribe.ready() && languagesSubscribe.ready());
return {
loading,
};
}, SearchShows);
| import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/tap:i18n';
import { createContainer } from 'meteor/react-meteor-data';
import SearchShows from '../pages/SearchShows.jsx';
export default createContainer(() => {
const languagesSubscribe = Meteor.subscribe('languages.public');
const countriesSubscribe = TAPi18n.subscribe('countries.public');
const interestsSubscribe = TAPi18n.subscribe('interests.public');
const localitiesSubscribe = Meteor.subscribe('localities.public');
const administrativeAreasSubscribe = Meteor.subscribe('administrativeAreas.public');
const loading = !(localitiesSubscribe.ready() && countriesSubscribe.ready() && interestsSubscribe.ready() && administrativeAreasSubscribe.ready() && languagesSubscribe.ready());
return {
loading,
};
}, SearchShows);
| Fix interest filter on Show search. | Fix interest filter on Show search.
| JSX | mit | howlround/worldtheatremap,howlround/worldtheatremap | ---
+++
@@ -1,14 +1,16 @@
import { Meteor } from 'meteor/meteor';
+import { TAPi18n } from 'meteor/tap:i18n';
import { createContainer } from 'meteor/react-meteor-data';
import SearchShows from '../pages/SearchShows.jsx';
export default createContainer(() => {
const languagesSubscribe = Meteor.subscribe('languages.public');
const countriesSubscribe = TAPi18n.subscribe('countries.public');
+ const interestsSubscribe = TAPi18n.subscribe('interests.public');
const localitiesSubscribe = Meteor.subscribe('localities.public');
const administrativeAreasSubscribe = Meteor.subscribe('administrativeAreas.public');
- const loading = !(localitiesSubscribe.ready() && countriesSubscribe.ready() && administrativeAreasSubscribe.ready() && languagesSubscribe.ready());
+ const loading = !(localitiesSubscribe.ready() && countriesSubscribe.ready() && interestsSubscribe.ready() && administrativeAreasSubscribe.ready() && languagesSubscribe.ready());
return {
loading,
}; |
bc1b68fde45d0e64011574c694639d31c972f0a6 | src/client/components/nav/nav-menu.jsx | src/client/components/nav/nav-menu.jsx | import React, { PropTypes } from 'react';
// TODO add key
const NavMenuItem = ({ item }) => <a className='nav-butt' href={item.route}><li>{item.label}</li></a>;
// Route objects are used to create the items in the menu
NavMenuItem.propTypes = {
item: React.PropTypes.shape({
route: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
}).isRequired,
};
const NavMenu = ({ items }) => (
<div className='nav-menu-cont'>
<ul className='nav-menu'>
{items.map(item => <NavMenuItem item={item} />)}
</ul>
</div>
);
NavMenu.propTypes = {
items: React.PropTypes.arrayOf(NavMenuItem.propTypes.item).isRequired,
};
export default NavMenu;
| import React, { PropTypes } from 'react';
const NavMenuItem = ({ item }) => <a className='nav-butt' href={item.route}><li>{item.label}</li></a>;
// Route objects are used to create the items in the menu
NavMenuItem.propTypes = {
item: React.PropTypes.shape({
route: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
}).isRequired,
};
const NavMenu = ({ items }) => (
<div className='nav-menu-cont'>
<ul className='nav-menu'>
{items.map(item => <NavMenuItem key={item.label} item={item} />)}
</ul>
</div>
);
NavMenu.propTypes = {
items: React.PropTypes.arrayOf(NavMenuItem.propTypes.item).isRequired,
};
export default NavMenu;
| Add key to list iterations to fix warning | Add key to list iterations to fix warning
| JSX | agpl-3.0 | Narxem/crispy-magic-front,Narxem/crispy-magic-front | ---
+++
@@ -1,6 +1,5 @@
import React, { PropTypes } from 'react';
-// TODO add key
const NavMenuItem = ({ item }) => <a className='nav-butt' href={item.route}><li>{item.label}</li></a>;
// Route objects are used to create the items in the menu
@@ -14,7 +13,7 @@
const NavMenu = ({ items }) => (
<div className='nav-menu-cont'>
<ul className='nav-menu'>
- {items.map(item => <NavMenuItem item={item} />)}
+ {items.map(item => <NavMenuItem key={item.label} item={item} />)}
</ul>
</div>
); |
81a0f83ba2c04e6d2fab16c4341a4b3187fdeed7 | src/rooms/components/listItem.component.jsx | src/rooms/components/listItem.component.jsx | import React, { Component } from 'react';
import { Card, Button, Row, Col } from 'react-materialize';
import { Link } from 'react-router';
import { removeRoom } from '../actions/rooms.action';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
class ListItem extends Component {
handleClick(title) {
if (this.props.clickHandler) {
this.props.clickHandler(title);
}
}
removeRoomCall(title) {
removeRoom(title);
}
render() {
const title = this.props.title;
return (
<Link to={ 'furniture' }>
<Card
onClick={ () => { this.handleClick(title) } }
className='grey lighten-2'
title={ title }
textClassName='black-text'
>
<p >
description
</p>
<Row>
<Col offset='s8' >
<Button
onClick={() => {this.removeRoomCall(title)} }
>
Delete
</Button>
</Col>
</Row>
</Card>
</Link>
);
}
}
// export default ListItem;
// function mapStateToProps() {
// return { };
// }
function mapDispatchToProps(dispatch) {
return bindActionCreators({ removeRoom }, dispatch);
}
export default connect(null, mapDispatchToProps)(ListItem);
| import React, { Component } from 'react';
import { Card, Button, Row, Col } from 'react-materialize';
import { Link } from 'react-router';
import { removeRoom } from '../actions/rooms.action';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
class ListItem extends Component {
handleClick(title) {
if (this.props.clickHandler) {
this.props.clickHandler(title);
}
}
removeRoomCall(title) {
removeRoom(title);
}
render() {
const title = this.props.title;
return (
<Link to={ 'furniture' }>
<Card
onClick={ () => this.handleClick(title) }
className='grey lighten-2'
title={ title }
textClassName='black-text'
>
<p>
description
</p>
<Row>
<Col offset='s8' >
<Button
onClick={() => {this.removeRoomCall(title)} }
>
Delete
</Button>
</Col>
</Row>
</Card>
</Link>
);
}
}
// export default ListItem;
// function mapStateToProps() {
// return { };
// }
function mapDispatchToProps(dispatch) {
return bindActionCreators({ removeRoom }, dispatch);
}
export default connect(null, mapDispatchToProps)(ListItem);
| Refactor es2015 slightly for the benefit of babel | test: Refactor es2015 slightly for the benefit of babel
Babel was choking on the previous arrow function in the class.
| JSX | mit | Nailed-it/Designify,Nailed-it/Designify | ---
+++
@@ -16,24 +16,24 @@
}
render() {
-
+
const title = this.props.title;
return (
<Link to={ 'furniture' }>
<Card
- onClick={ () => { this.handleClick(title) } }
+ onClick={ () => this.handleClick(title) }
className='grey lighten-2'
title={ title }
textClassName='black-text'
>
- <p >
+ <p>
description
</p>
<Row>
<Col offset='s8' >
<Button
onClick={() => {this.removeRoomCall(title)} }
- >
+ >
Delete
</Button>
</Col> |
d3c357f38f62a419043b254dc687f4d9c44240a9 | docs/src/Examples/Localization/MomentLocalizationExample.jsx | docs/src/Examples/Localization/MomentLocalizationExample.jsx | import React from 'react';
import moment from 'moment';
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import MuiPickersUtilsProvider from 'material-ui-pickers/utils/MuiPickersUtilsProvider';
moment.locale('fr');
const App = () => (
<MuiPickersUtilsProvider
utils={MomentUtils}
moment={moment}
locale="fr"
>
...
</MuiPickersUtilsProvider>
);
export default App;
| import React from 'react';
import moment from 'moment';
import 'moment/locale/fr'; // this is the important bit, you have to import the locale your'e trying to use.
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import MuiPickersUtilsProvider from 'material-ui-pickers/utils/MuiPickersUtilsProvider';
moment.locale('fr');
const App = () => (
<MuiPickersUtilsProvider
utils={MomentUtils}
moment={moment}
locale="fr"
>
...
</MuiPickersUtilsProvider>
);
export default App;
| Add missing import in Moment locale example | Add missing import in Moment locale example
according to https://momentjs.com/docs/#/i18n/loading-into-browser/ locales have to be imported before being used. | JSX | mit | mbrookes/material-ui,dmtrKovalenko/material-ui-pickers,rscnt/material-ui,callemall/material-ui,mbrookes/material-ui,rscnt/material-ui,mui-org/material-ui,dmtrKovalenko/material-ui-pickers,callemall/material-ui,oliviertassinari/material-ui,oliviertassinari/material-ui,callemall/material-ui,oliviertassinari/material-ui,mbrookes/material-ui,mui-org/material-ui,callemall/material-ui,rscnt/material-ui,mui-org/material-ui | ---
+++
@@ -1,5 +1,6 @@
import React from 'react';
import moment from 'moment';
+import 'moment/locale/fr'; // this is the important bit, you have to import the locale your'e trying to use.
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import MuiPickersUtilsProvider from 'material-ui-pickers/utils/MuiPickersUtilsProvider';
|
eac4b7d63613ff4ce64f37cdebf6095f06f70ec8 | app/index.jsx | app/index.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import { Provider } from 'react-redux';
import './scss/main.scss';
import App from './components/App';
import configureStore from './store/configureStore';
import { load } from './modules/monod';
const appElement = document.getElementById('app');
const appVersion = appElement.getAttribute('data-app-version');
const store = configureStore();
store.dispatch(load(
window.location.pathname.slice(1),
window.location.hash.slice(1)
));
require('offline-plugin/runtime').install();
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<App version={appVersion} />
</Provider>
</AppContainer>,
appElement
);
if (module.hot) {
module.hot.accept('./components/App', () => {
const NextApp = require('./components/App').default; // eslint-disable-line global-require
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<NextApp version={appVersion} />
</Provider>
</AppContainer>,
appElement
);
});
}
| import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import { Provider } from 'react-redux';
import './scss/main.scss';
import App from './components/App';
import configureStore from './store/configureStore';
import { load } from './modules/monod';
const appElement = document.getElementById('app');
const appVersion = appElement.getAttribute('data-app-version');
const store = configureStore();
store.dispatch(load(
window.location.pathname.slice(1),
window.location.hash.slice(1)
));
/* eslint no-unused-expressions: 0, global-require: 0 */
'production' === process.env.NODE_ENV && require('offline-plugin/runtime').install();
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<App version={appVersion} />
</Provider>
</AppContainer>,
appElement
);
if (module.hot) {
module.hot.accept('./components/App', () => {
const NextApp = require('./components/App').default; // eslint-disable-line global-require
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<NextApp version={appVersion} />
</Provider>
</AppContainer>,
appElement
);
});
}
| Disable offline mode in dev | Disable offline mode in dev
| JSX | mit | PaulDebus/monod,PaulDebus/monod,TailorDev/monod,TailorDev/monod,PaulDebus/monod,TailorDev/monod | ---
+++
@@ -19,7 +19,8 @@
window.location.hash.slice(1)
));
-require('offline-plugin/runtime').install();
+/* eslint no-unused-expressions: 0, global-require: 0 */
+'production' === process.env.NODE_ENV && require('offline-plugin/runtime').install();
ReactDOM.render(
<AppContainer> |
5912592678bc8caeb6c345d0b0b2c7447e88d462 | examples/pages/counter-fluxible/Counter.jsx | examples/pages/counter-fluxible/Counter.jsx | import React from 'react';
import * as actions from './actions';
export default React.createClass({
contextTypes: {
executeAction: React.PropTypes.func.isRequired
},
propTypes: {
increment: React.PropTypes.func.isRequired,
value: React.PropTypes.number.isRequired
},
handleIncrement() {
this.props.increment();
},
render() {
return (
<div>
Counter Value: { this.props.value }
<div>
<button onClick={ this.handleIncrement }>
Increment
</button>
</div>
</div>
);
}
});
| import React from 'react';
export default React.createClass({
propTypes: {
increment: React.PropTypes.func.isRequired,
value: React.PropTypes.number.isRequired
},
handleIncrement() {
this.props.increment();
},
render() {
return (
<div>
Counter Value: { this.props.value }
<div>
<button onClick={ this.handleIncrement }>
Increment
</button>
</div>
</div>
);
}
});
| Remove dead code in fluxible example | Remove dead code in fluxible example
| JSX | apache-2.0 | jeffhandley/react-composition,jeffhandley/react-composite-pages | ---
+++
@@ -1,11 +1,6 @@
import React from 'react';
-import * as actions from './actions';
export default React.createClass({
- contextTypes: {
- executeAction: React.PropTypes.func.isRequired
- },
-
propTypes: {
increment: React.PropTypes.func.isRequired,
value: React.PropTypes.number.isRequired |
2b663d9817c8ba7dec6478bd34abc3c5202f15f4 | src/js/components/MemoryFieldComponent.jsx | src/js/components/MemoryFieldComponent.jsx | var React = require("react/addons");
var MemoryFieldComponent = React.createClass({
displayName: "MemoryFieldComponent",
propTypes: {
megabytes: React.PropTypes.number.isRequired
},
render() {
const megabytes = this.props.megabytes;
return (
<span title={`${megabytes}MB`}>{`${megabytes}MB`}</span>
);
}
});
module.exports = MemoryFieldComponent;
| var React = require("react/addons");
var MemoryFieldComponent = React.createClass({
displayName: "MemoryFieldComponent",
propTypes: {
megabytes: React.PropTypes.number.isRequired
},
render() {
// For a documentation of the different unit prefixes please refer to:
// https://en.wikipedia.org/wiki/Template:Quantities_of_bytes
const units = ["MB", "GB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
const factor = 1024;
const megabytes = this.props.megabytes;
let value = 0;
let index = 0;
if (megabytes > 0) {
index = Math.floor(Math.log(megabytes) / Math.log(factor));
value = Math.round(megabytes / Math.pow(factor, index));
}
console.log(value, index);
return (
<span title={`${megabytes}MB`}>{`${value}${units[index]}`}</span>
);
}
});
module.exports = MemoryFieldComponent;
| Add methods to round the memory value | Add methods to round the memory value
Impl. methods to round the memory and attach the correct unit, using JEDEC and IEC units.
| JSX | apache-2.0 | mesosphere/marathon-ui,cribalik/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui | ---
+++
@@ -6,9 +6,20 @@
megabytes: React.PropTypes.number.isRequired
},
render() {
+ // For a documentation of the different unit prefixes please refer to:
+ // https://en.wikipedia.org/wiki/Template:Quantities_of_bytes
+ const units = ["MB", "GB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
+ const factor = 1024;
const megabytes = this.props.megabytes;
+ let value = 0;
+ let index = 0;
+ if (megabytes > 0) {
+ index = Math.floor(Math.log(megabytes) / Math.log(factor));
+ value = Math.round(megabytes / Math.pow(factor, index));
+ }
+ console.log(value, index);
return (
- <span title={`${megabytes}MB`}>{`${megabytes}MB`}</span>
+ <span title={`${megabytes}MB`}>{`${value}${units[index]}`}</span>
);
}
}); |
70be51baf2773cbde02f61bb5784cdb31336ac18 | src/index.jsx | src/index.jsx | // Application entrypoint.
// Load up the application styles
require("../styles/application.scss");
// Render the top-level React component
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
ReactDOM.render(<App />, document.getElementById('react-root'));
| // Application entrypoint.
// Load up the application styles
require("../styles/application.scss");
// Render the top-level React component
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
import Nav from './Nav.jsx'
import Dashboard from './Dashboard.jsx'
import { Router, Route, hashHistory} from 'react-router';
ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={App} />
<Route path="/games" component={Nav} />
<Route path="/dashboard" component={Dashboard} />
</Router>), document.getElementById('react-root')
);
| Create second page // TODO url should be changed later | Create second page // TODO url should be changed later
| JSX | mit | shinmike/scortch,shinmike/scortch | ---
+++
@@ -7,5 +7,16 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
+import Nav from './Nav.jsx'
+import Dashboard from './Dashboard.jsx'
-ReactDOM.render(<App />, document.getElementById('react-root'));
+import { Router, Route, hashHistory} from 'react-router';
+
+
+ReactDOM.render((
+ <Router history={hashHistory}>
+ <Route path="/" component={App} />
+ <Route path="/games" component={Nav} />
+ <Route path="/dashboard" component={Dashboard} />
+ </Router>), document.getElementById('react-root')
+); |
4451fc5c4bcbe23817a8f3e3d95064dd29a16da6 | src/frontend/components/admin/GroupsList.jsx | src/frontend/components/admin/GroupsList.jsx | 'use strict';
import React from 'react';
import GroupListEntry from './GroupListEntry.jsx';
import AddGroupModalLauncher from './AddGroupModalLauncher.jsx';
export default ({ groups , editable, onSave }) => {
let groupEntries = groups.map( group => (<GroupListEntry group={group} onSave={onSave} />));
let addModalLauncher = editable ? <li><AddGroupModalLauncher onSave={onSave} /></li> : null;
return (
<ul>
{ groupEntries }
{ addModalLauncher }
</ul>
)
}
| 'use strict';
import React from 'react';
import GroupListEntry from './GroupListEntry.jsx';
import AddGroupModalLauncher from './AddGroupModalLauncher.jsx';
export default ({ groups , editable, onSave }) => {
let groupEntries = groups.map( group => (<GroupListEntry group={group} onSave={onSave} />));
let addModalLauncher = editable ? <li className="new"><AddGroupModalLauncher onSave={onSave} /></li> : null;
return (
<ul>
{ groupEntries }
{ addModalLauncher }
</ul>
)
}
| Add class of new to add group button on Admin page | Add class of new to add group button on Admin page
| JSX | agpl-3.0 | rabblerouser/core,rabblerouser/core,rabblerouser/core | ---
+++
@@ -5,7 +5,7 @@
export default ({ groups , editable, onSave }) => {
let groupEntries = groups.map( group => (<GroupListEntry group={group} onSave={onSave} />));
- let addModalLauncher = editable ? <li><AddGroupModalLauncher onSave={onSave} /></li> : null;
+ let addModalLauncher = editable ? <li className="new"><AddGroupModalLauncher onSave={onSave} /></li> : null;
return (
<ul> |
63c16df960c5556c39e549f4d1cdf10bbfb0d5df | src/main/webapp/resources/js/components/Header/main-navigation/components/GlobalSearch.jsx | src/main/webapp/resources/js/components/Header/main-navigation/components/GlobalSearch.jsx | import { Input, Menu } from "antd";
import React from "react";
import styled from "styled-components";
import { grey6 } from "../../../../styles/colors";
import { primaryColour, theme } from "../../../../utilities/theme-utilities";
import { setBaseUrl } from "../../../../utilities/url-utilities";
import { IconSearch } from "../../../icons/Icons";
const SearchForm = styled.form`
background-color: transparent;
color: ${theme === "dark" ? "#fff" : "#000"};
width: 300px;
margin-right: 15px;
.ant-input-prefix svg {
color: ${grey6};
font-size: 14px;
}
input {
border-bottom: 2px solid ${primaryColour};
}
`;
/**
* React component to render a global search input to the main navigation.
* @returns {JSX.Element}
* @constructor
*/
export function GlobalSearch() {
return (
<SearchForm method="get" action={setBaseUrl("/search")}>
<Input
name="query"
className="t-global-search"
prefix={<IconSearch />}
placeholder={i18n("nav.main.search")}
/>
</SearchForm>
);
}
| import { Input, Menu } from "antd";
import React from "react";
import styled from "styled-components";
import { grey6 } from "../../../../styles/colors";
import { primaryColour, theme } from "../../../../utilities/theme-utilities";
import { setBaseUrl } from "../../../../utilities/url-utilities";
import { IconSearch } from "../../../icons/Icons";
const SearchForm = styled.form`
background-color: transparent;
color: ${theme === "dark" ? "#fff" : "#000"};
width: 300px;
margin-right: 15px;
.ant-input-prefix svg {
color: ${grey6};
font-size: 14px;
}
.anticon-close-circle svg {
color: ${grey6};
}
input {
border-bottom: 2px solid ${primaryColour};
}
`;
/**
* React component to render a global search input to the main navigation.
* @returns {JSX.Element}
* @constructor
*/
export function GlobalSearch() {
return (
<SearchForm method="get" action={setBaseUrl("/search")}>
<Input
name="query"
allowClear
autoComplete="off"
className="t-global-search"
prefix={<IconSearch />}
placeholder={i18n("nav.main.search")}
/>
</SearchForm>
);
}
| Allow clear and no autocomplete for glabal search | Allow clear and no autocomplete for glabal search
| 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 | ---
+++
@@ -17,6 +17,10 @@
font-size: 14px;
}
+ .anticon-close-circle svg {
+ color: ${grey6};
+ }
+
input {
border-bottom: 2px solid ${primaryColour};
}
@@ -32,6 +36,8 @@
<SearchForm method="get" action={setBaseUrl("/search")}>
<Input
name="query"
+ allowClear
+ autoComplete="off"
className="t-global-search"
prefix={<IconSearch />}
placeholder={i18n("nav.main.search")} |
915e103e6d6301f54ac291c154f9fa75ac44cd22 | client/modules/core/components/header.jsx | client/modules/core/components/header.jsx | import React, { PropTypes } from 'react';
import LogInButtons from '/client/modules/accounts/containers/log_in_buttons.js';
import {
Arrow,
Dropdown,
DropdownMenu,
Fixed,
NavItem,
Space,
Toolbar
} from 'rebass';
const Header = ({isLoggedIn}) => (
<Fixed top left right zIndex={1}>
<Toolbar>
<NavItem href="/" children="Home" />
<Space auto />
<NavItem href="/polls" children="Polls" />
{ isLoggedIn && <NavItem href="/polls/new" children="New Poll" /> }
<LogInButtons />
</Toolbar>
</Fixed>
);
Header.propTypes = {};
export default Header;
| import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import LogInButtons from '/client/modules/accounts/containers/log_in_buttons.js';
import {
Arrow,
Dropdown,
DropdownMenu,
Fixed,
NavItem,
Space,
Toolbar
} from 'rebass';
const Header = ({isLoggedIn}) => (
<Fixed top left right zIndex={1}>
<Toolbar>
<NavItem to="/" is={Link} children="Home" />
<Space auto />
<NavItem to="/polls" is={Link} children="Polls" />
{ isLoggedIn && <NavItem to="/polls/new" is={Link} children="New Poll" /> }
<LogInButtons />
</Toolbar>
</Fixed>
);
Header.propTypes = {};
export default Header;
| Change NavItems to use react-router Links in Header | Change NavItems to use react-router Links in Header
| JSX | mit | thancock20/voting-app,thancock20/voting-app | ---
+++
@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react';
+import { Link } from 'react-router';
import LogInButtons from '/client/modules/accounts/containers/log_in_buttons.js';
import {
Arrow,
@@ -13,10 +14,10 @@
const Header = ({isLoggedIn}) => (
<Fixed top left right zIndex={1}>
<Toolbar>
- <NavItem href="/" children="Home" />
+ <NavItem to="/" is={Link} children="Home" />
<Space auto />
- <NavItem href="/polls" children="Polls" />
- { isLoggedIn && <NavItem href="/polls/new" children="New Poll" /> }
+ <NavItem to="/polls" is={Link} children="Polls" />
+ { isLoggedIn && <NavItem to="/polls/new" is={Link} children="New Poll" /> }
<LogInButtons />
</Toolbar>
</Fixed> |
4c8e24bea7a2ffffffdd1c9a358bd48ba5285452 | src/index.jsx | src/index.jsx | /** @jsx createElement */
import {createElement} from 'elliptical'
import ImpliedURL from './implied-url'
import SpecificURL from './specific-url'
const defaultProps = {
splitOn: /\s|,/,
label: 'URL',
limit: 1
}
function suppressWhen (input) {
return /^(h|ht|htt|https?|https?:|https?:\/|https?:\/\/|(https?:\/\/)?|\w*|\w+\.|\w+\.[a-z])$/.test(input)
}
function describe ({props}) {
return (
<placeholder
label={props.label}
arguments={props.phraseArguments || (props.phraseArguments ? [props.phraseArgument] : [props.label])}
suppressWhen={suppressWhen}>
<choice>
<ImpliedURL {...props} id={undefined} />
<SpecificURL {...props} id={undefined} />
</choice>
</placeholder>
)
}
export const URL = {defaultProps, describe}
| /** @jsx createElement */
import {createElement} from 'elliptical'
import ImpliedURL from './implied-url'
import SpecificURL from './specific-url'
const defaultProps = {
splitOn: /\s|,/,
label: 'URL',
limit: 1
}
function suppressWhen (input) {
return /^(h|ht|htt|https?|https?:|https?:\/|https?:\/\/|(https?:\/\/)?|\w*|\w+\.|\w+\.[a-z])$/.test(input)
}
function describe ({props}) {
return (
<placeholder
label={props.label}
arguments={props.phraseArguments || (props.phraseArguments ? [props.phraseArgument] : [props.label])}
suppressWhen={suppressWhen}>
<choice>
<ImpliedURL {...props} id={undefined} />
<SpecificURL {...props} id={undefined} />
</choice>
</placeholder>
)
}
export const URL = {defaultProps, describe, id: 'elliptical-url:URL'}
| Add an id to help with Lacona extension | Add an id to help with Lacona extension
| JSX | mit | brandonhorst/lacona-phrase-url,lacona/lacona-phrase-url | ---
+++
@@ -27,4 +27,4 @@
)
}
-export const URL = {defaultProps, describe}
+export const URL = {defaultProps, describe, id: 'elliptical-url:URL'} |
f15fc609349219e22f24d86daac0eebbb1e283fe | app/assets/javascripts/components/dashboard.js.jsx | app/assets/javascripts/components/dashboard.js.jsx | var MeasurementBox = React.createClass({
loadClientLocation: function() {
var path = "/locations/current";
$.ajax({
url: path,
dataType: 'json',
cache: true,
success: function(data) {
this.setState({client: data.id});
}.bind(this),
error: function(xhr, status, err) {
console.error(path, status, err.toString());
}.bind(this)
});
},
getInitialState: function() {
return {};
},
componentDidMount: function() {
this.loadClientLocation();
},
render: function() {
return (
<div className="MeasurementBox">
Client id is {this.state.client}.
</div>
);
}
});
| var MeasurementBox = React.createClass({
loadLocation: function(path, prop) {
var path = "/locations/current";
var state = new Object();
$.ajax({
url: path,
dataType: 'json',
cache: true,
success: function(data) {
state[prop] = data.id
this.setState(state);
}.bind(this),
error: function(xhr, status, err) {
console.error(path, status, err.toString());
}.bind(this)
});
},
loadClientLocation: function() {
this.loadLocation("/locations/current", 'client');
},
loadServerLocation: function() {
this.loadLocation("/locations/server", 'server');
},
getInitialState: function() {
return {};
},
componentDidMount: function() {
this.loadClientLocation();
this.loadServerLocation();
},
render: function() {
return (
<div className="MeasurementBox">
Client id is {this.state.client}.
Server id is {this.state.server}.
</div>
);
}
});
| Add Server ID to the dashboard | Add Server ID to the dashboard
| JSX | mit | zunda/ping,zunda/ping,zunda/ping | ---
+++
@@ -1,17 +1,25 @@
var MeasurementBox = React.createClass({
- loadClientLocation: function() {
+ loadLocation: function(path, prop) {
var path = "/locations/current";
+ var state = new Object();
$.ajax({
url: path,
dataType: 'json',
cache: true,
success: function(data) {
- this.setState({client: data.id});
+ state[prop] = data.id
+ this.setState(state);
}.bind(this),
error: function(xhr, status, err) {
console.error(path, status, err.toString());
}.bind(this)
});
+ },
+ loadClientLocation: function() {
+ this.loadLocation("/locations/current", 'client');
+ },
+ loadServerLocation: function() {
+ this.loadLocation("/locations/server", 'server');
},
getInitialState: function() {
@@ -19,11 +27,13 @@
},
componentDidMount: function() {
this.loadClientLocation();
+ this.loadServerLocation();
},
render: function() {
return (
<div className="MeasurementBox">
Client id is {this.state.client}.
+ Server id is {this.state.server}.
</div>
);
} |
7ed7805630cf9c2cddeddcbbcb7a513f1b3672e5 | scripts/apps/search/components/SelectBox.jsx | scripts/apps/search/components/SelectBox.jsx | import React from 'react';
import {isCheckAllowed} from '../helpers';
export class SelectBox extends React.Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
}
toggle(event) {
event.stopPropagation();
if (isCheckAllowed(this.props.item)) {
var selected = !this.props.item.selected;
this.props.onMultiSelect([this.props.item], selected);
}
}
render() {
if (this.props.item.selected) {
this.props.item.selected = isCheckAllowed(this.props.item);
}
return React.createElement(
'div',
{
className: 'selectbox',
title: isCheckAllowed(this.props.item) ? null : 'selection not allowed',
onClick: this.toggle
},
React.createElement(
'span', {
className: 'sd-checkbox' + (this.props.item.selected ? ' checked' : '')
}
)
);
}
}
SelectBox.propTypes = {
item: React.PropTypes.any,
onMultiSelect: React.PropTypes.func,
};
| import React from 'react';
import {isCheckAllowed} from '../helpers';
export class SelectBox extends React.Component {
constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
}
toggle(event) {
if (event && (event.ctrlKey || event.shiftKey)) {
return false;
}
event.stopPropagation();
if (isCheckAllowed(this.props.item)) {
var selected = !this.props.item.selected;
this.props.onMultiSelect([this.props.item], selected);
}
}
render() {
if (this.props.item.selected) {
this.props.item.selected = isCheckAllowed(this.props.item);
}
return React.createElement(
'div',
{
className: 'selectbox',
title: isCheckAllowed(this.props.item) ? null : 'selection not allowed',
onClick: this.toggle
},
React.createElement(
'span', {
className: 'sd-checkbox' + (this.props.item.selected ? ' checked' : '')
}
)
);
}
}
SelectBox.propTypes = {
item: React.PropTypes.any,
onMultiSelect: React.PropTypes.func,
};
| Fix for multiselect on key shortcut | [SDESK-390] fix(multiselect): Fix for multiselect on key shortcut | JSX | agpl-3.0 | petrjasek/superdesk-client-core,fritzSF/superdesk-client-core,jerome-poisson/superdesk-client-core,ioanpocol/superdesk-client-core,darconny/superdesk-client-core,petrjasek/superdesk-client-core,petrjasek/superdesk-client-core,pavlovicnemanja/superdesk-client-core,mdhaman/superdesk-client-core,gbbr/superdesk-client-core,thnkloud9/superdesk-client-core,darconny/superdesk-client-core,darconny/superdesk-client-core,marwoodandrew/superdesk-client-core,Aca-jov/superdesk-client-core,jerome-poisson/superdesk-client-core,mugurrus/superdesk-client-core,marwoodandrew/superdesk-client-core,superdesk/superdesk-client-core,ioanpocol/superdesk-client-core,mugurrus/superdesk-client-core,pavlovicnemanja/superdesk-client-core,petrjasek/superdesk-client-core,Aca-jov/superdesk-client-core,mdhaman/superdesk-client-core,Aca-jov/superdesk-client-core,Aca-jov/superdesk-client-core,thnkloud9/superdesk-client-core,marwoodandrew/superdesk-client-core,jerome-poisson/superdesk-client-core,jerome-poisson/superdesk-client-core,gbbr/superdesk-client-core,petrjasek/superdesk-client-core,pavlovicnemanja/superdesk-client-core,gbbr/superdesk-client-core,ioanpocol/superdesk-client-core,mugurrus/superdesk-client-core,superdesk/superdesk-client-core,fritzSF/superdesk-client-core,gbbr/superdesk-client-core,marwoodandrew/superdesk-client-core,thnkloud9/superdesk-client-core,superdesk/superdesk-client-core,thnkloud9/superdesk-client-core,mdhaman/superdesk-client-core,mugurrus/superdesk-client-core,pavlovicnemanja/superdesk-client-core,mdhaman/superdesk-client-core,superdesk/superdesk-client-core,darconny/superdesk-client-core,jerome-poisson/superdesk-client-core,superdesk/superdesk-client-core,fritzSF/superdesk-client-core,pavlovicnemanja/superdesk-client-core,marwoodandrew/superdesk-client-core,mdhaman/superdesk-client-core,ioanpocol/superdesk-client-core,ioanpocol/superdesk-client-core,fritzSF/superdesk-client-core | ---
+++
@@ -8,6 +8,10 @@
}
toggle(event) {
+ if (event && (event.ctrlKey || event.shiftKey)) {
+ return false;
+ }
+
event.stopPropagation();
if (isCheckAllowed(this.props.item)) {
var selected = !this.props.item.selected; |
eff50577de820a490225ded3a3791b078de238a0 | imports/ui/components/records/RecordsList.jsx | imports/ui/components/records/RecordsList.jsx | import React from 'react';
import { List } from 'material-ui/List';
import RecordItem from './RecordItem.jsx';
import EmptyRecordsList from './EmptyRecordsList.jsx';
import moment from 'moment';
/**
* Shows time records in a list.
*
* @prop {Object[]} records - the time records to be shown
* @prop {Object} records[].begin - the begin of the time record (a record time)
* @prop {Object} records[].end - the end of the time record (a record time)
*/
export default class RecordsList extends React.Component {
renderRecordsList() {
const { records } = this.props;
let displayDay;
return (
<List style={{ marginTop: '10px' }}>
{records.map((record, index) => {
// check if current record's day is the same of previous one to hide the day of the record
if (index > 0 &&
moment(record.begin).startOf('day').isSame(moment(records[index - 1]).startOf('day'))) {
displayDay = false;
} else {
displayDay = true;
}
return (<RecordItem key={index} record={record} displayDay={displayDay} />);
})}
</List>
);
}
render() {
const { records } = this.props;
return (
<div>
{
records.length > 0
? this.renderRecordsList()
: <EmptyRecordsList />
}
</div>
);
}
}
RecordsList.propTypes = {
records: React.PropTypes.array,
};
| import React from 'react';
import { List } from 'material-ui/List';
import RecordItem from './RecordItem.jsx';
import EmptyRecordsList from './EmptyRecordsList.jsx';
import moment from 'moment';
/**
* Shows time records in a list.
*
* @prop {Object[]} records - the time records to be shown
* @prop {Object} records[].begin - the begin of the time record (a record time)
* @prop {Object} records[].end - the end of the time record (a record time)
*/
export default class RecordsList extends React.Component {
renderRecordsList() {
const { records } = this.props;
let displayDay;
return (
<List style={{ marginTop: '10px' }}>
{records.map((record, index) => {
// check if current record's day is the same of previous one to hide the day of the record
if (index > 0 &&
moment(record.begin).startOf('day')
.isSame(moment(records[index - 1].begin).startOf('day'))) {
displayDay = false;
} else {
displayDay = true;
}
return (<RecordItem key={index} record={record} displayDay={displayDay} />);
})}
</List>
);
}
render() {
const { records } = this.props;
return (
<div>
{
records.length > 0
? this.renderRecordsList()
: <EmptyRecordsList />
}
</div>
);
}
}
RecordsList.propTypes = {
records: React.PropTypes.array,
};
| Fix bug on showing day of record on RecordItem | Fix bug on showing day of record on RecordItem
Signed-off-by: Felipe Milani <[email protected]>
| JSX | mit | fmilani/contatempo,fmilani/contatempo | ---
+++
@@ -21,7 +21,8 @@
{records.map((record, index) => {
// check if current record's day is the same of previous one to hide the day of the record
if (index > 0 &&
- moment(record.begin).startOf('day').isSame(moment(records[index - 1]).startOf('day'))) {
+ moment(record.begin).startOf('day')
+ .isSame(moment(records[index - 1].begin).startOf('day'))) {
displayDay = false;
} else {
displayDay = true; |
f3f0100cbbf494e6acc59188c4eedbc460473226 | src/Modules/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/Breadcrumbs.jsx | src/Modules/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/Breadcrumbs.jsx | import React, { PropTypes } from "react";
const maxItems = 4;
const Breadcrumbs = ({ items, onSelectedItem }) => {
function onClick(tabId) {
if (tabId)
onSelectedItem(tabId);
}
return (
<div className="breadcrumbs-container">
{items.length > maxItems &&
<span className="more"
title={items.map(i => i.name).join(" > ")}
onClick={() => onClick(0)} />}
{items.slice(Math.max(items.length - maxItems, 0)).map((item, i) => {
return (
<div key={item.id} onClick={() => onClick(item.tabId)}>
<span>{item.name}</span>
</div>);
})
}
</div>
);
};
Breadcrumbs.propTypes = {
items: PropTypes.array.isRequired,
onSelectedItem: PropTypes.func.isRequired
};
export default Breadcrumbs; | import React, { PropTypes } from "react";
const maxItems = 4;
const Breadcrumbs = ({ items, onSelectedItem }) => {
function onClick(tabId) {
if (tabId)
onSelectedItem(tabId);
}
return (
<div className="breadcrumbs-container">
{items.length > maxItems &&
<div>
<span className="more"
title={items.map(i => i.name).join(" > ")}
onClick={() => onClick(0)}> </span>
</div>}
{items.slice(Math.max(items.length - maxItems, 0)).map((item, i) => {
return (
<div key={item.id} onClick={() => onClick(item.tabId)}>
<span>{item.name}</span>
</div>);
})
}
</div>
);
};
Breadcrumbs.propTypes = {
items: PropTypes.array.isRequired,
onSelectedItem: PropTypes.func.isRequired
};
export default Breadcrumbs; | Fix the layout on breadcrumb on Safari | Fix the layout on breadcrumb on Safari
| JSX | mit | valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,RichardHowells/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Extensions,bdukes/Dnn.Platform,bdukes/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Extensions,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,RichardHowells/Dnn.Platform,EPTamminga/Dnn.Platform,mitchelsellers/Dnn.Platform,EPTamminga/Dnn.Platform,mitchelsellers/Dnn.Platform,robsiera/Dnn.Platform,bdukes/Dnn.Platform,valadas/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Extensions,RichardHowells/Dnn.Platform,RichardHowells/Dnn.Platform,EPTamminga/Dnn.Platform,nvisionative/Dnn.Platform,dnnsoftware/Dnn.Platform,robsiera/Dnn.Platform,nvisionative/Dnn.Platform | ---
+++
@@ -1,5 +1,4 @@
import React, { PropTypes } from "react";
-
const maxItems = 4;
const Breadcrumbs = ({ items, onSelectedItem }) => {
@@ -12,9 +11,11 @@
return (
<div className="breadcrumbs-container">
{items.length > maxItems &&
- <span className="more"
- title={items.map(i => i.name).join(" > ")}
- onClick={() => onClick(0)} />}
+ <div>
+ <span className="more"
+ title={items.map(i => i.name).join(" > ")}
+ onClick={() => onClick(0)}> </span>
+ </div>}
{items.slice(Math.max(items.length - maxItems, 0)).map((item, i) => {
|
de377608d9f18fd239e52d9357df67f0c228a509 | app/assets/javascripts/components/app.es6.jsx | app/assets/javascripts/components/app.es6.jsx | class App extends React.Component {
constructor(){
super();
this.state = {
possibleVenues: [],
midpoint: [],
detailsView: {},
lat: 40.705116,
lng: -74.00883,
choices: [
{
name: "freedomTower",
lat: 40.713230,
lng: -74.013367
},
{
name: "freedomTower",
lat: 40.759011,
lng: -73.9884472
}
]
}
}
componentDidMount(){
$.ajax({
url: "/users/1/events/1"
})
.done((response) => {
this.setState({possibleVenues: response})
})
}
render() {
const { choices, lat, lng, midpoint, possibleVenues, detailsView } = this.state
return (
<div className="app-container">
<MapView choices={choices} lat={lat} lng={lng} />
<div className="venue-list-container">
<VenueList venues={ possibleVenues } />
</div>
<div className="venue-details-container">
<VenueDetails details={detailsView}/>
</div>
</div>
)
}
}
| class App extends React.Component {
constructor(){
super();
this.state = {
possibleVenues: [],
midpoint: [],
detailsView: {},
lat: 40.705116,
lng: -74.00883,
choices: [
{
name: "freedomTower",
lat: 40.713230,
lng: -74.013367
},
{
name: "freedomTower",
lat: 40.759011,
lng: -73.9884472
}
]
this.handleClick = this.handleClick.bind(this);
}
}
componentDidMount(){
$.ajax({
url: "/users/1/events/1"
})
.done((response) => {
this.setState({possibleVenues: response})
})
}
render() {
const { choices, lat, lng, midpoint, possibleVenues, detailsView } = this.state
return (
<div className="app-container">
<MapView choices={choices} lat={lat} lng={lng} />
<div className="venue-list-container">
<VenueList venues={ possibleVenues } />
</div>
<div className="venue-details-container">
<VenueDetails details={detailsView}/>
</div>
</div>
)
}
}
| Add in handle click bind. | Add in handle click bind.
| JSX | mit | nyc-wolves-2016/FrienDiagram,nyc-wolves-2016/FrienDiagram,nyc-wolves-2016/FrienDiagram | ---
+++
@@ -19,6 +19,7 @@
lng: -73.9884472
}
]
+ this.handleClick = this.handleClick.bind(this);
}
}
|
582974be75ee4273ba64e11bc046e846e6db79d9 | components/elements/filter/FilterBar.jsx | components/elements/filter/FilterBar.jsx | import React, {Component, PropTypes} from 'react'
export default class FilterBar extends Component {
static propTypes = {
filters: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
props: PropTypes.any,
component: PropTypes.func
})),
onChange: PropTypes.func
}
static defaultProps = {
filters: []
}
handleFilterChange(filter, newValue) {
const {onChange} = this.props
onChange(filter.name, newValue)
}
render() {
const {filters} = this.props
return (
<section className="graph__filter">
<h5 className="t-only-screenreaders">Filter</h5>
<div className="row t-position">
{filters.filter(f => !f.props.hidden).map(filter => (
<div key={filter.name} className="col--fifth">
<filter.component {...filter.props} onChange={this.handleFilterChange.bind(this, filter)}/>
</div>
))}
</div>
</section>
)
}
}
| import React, {Component, PropTypes} from 'react'
export default class FilterBar extends Component {
static propTypes = {
filters: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
props: PropTypes.any,
component: PropTypes.func
})),
onChange: PropTypes.func
}
static defaultProps = {
filters: []
}
handleFilterChange(filter, newValue) {
const {onChange} = this.props
onChange(filter.name, newValue)
}
render() {
const {filters} = this.props
return (
<section className="graph__filter">
<h5 className="t-only-screenreaders">Filter</h5>
<div className="row t-position">
{filters.filter(f => !f.props.hidden).map(filter => (
<div key={filter.name} className="col--fifth" style={{position: 'static'}}>
<filter.component {...filter.props} onChange={this.handleFilterChange.bind(this, filter)}/>
</div>
))}
</div>
</section>
)
}
}
| Fix to correct the lightbox width of regionpicker | Fix to correct the lightbox width of regionpicker
| JSX | mit | bengler/imdikator,bengler/imdikator | ---
+++
@@ -27,7 +27,7 @@
<h5 className="t-only-screenreaders">Filter</h5>
<div className="row t-position">
{filters.filter(f => !f.props.hidden).map(filter => (
- <div key={filter.name} className="col--fifth">
+ <div key={filter.name} className="col--fifth" style={{position: 'static'}}>
<filter.component {...filter.props} onChange={this.handleFilterChange.bind(this, filter)}/>
</div>
))} |
3bd7467a24a9f5e6caf5c6916a2c20b4846e57d9 | app/assets/javascripts/components/trial.js.jsx | app/assets/javascripts/components/trial.js.jsx | class Trial extends React.Component {
render () {
return(
<td>
<a href={"https://clinicaltrials.gov/ct2/show/" + this.props.trial.nct_id}>{this.props.trial.brief_title}</a>
</td>
)
}
}
| class Trial extends React.Component {
render () {
return(
<td>
<a href={"https://clinicaltrials.gov/ct2/show/" + this.props.trial.nct_id}>{this.props.trial.brief_title}</a>
<div>
<ul>
<li>
<a href={"https://clinicaltrials.gov/ct2/show/" + this.props.trial.nct_id}>More info</a>
</li>
</ul>
</div>
</td>
)
}
}
| Add div with additional info in Trial component | Add div with additional info in Trial component
| JSX | mit | danmckeon/crconnect,danmckeon/crconnect,danmckeon/crconnect | ---
+++
@@ -3,6 +3,13 @@
return(
<td>
<a href={"https://clinicaltrials.gov/ct2/show/" + this.props.trial.nct_id}>{this.props.trial.brief_title}</a>
+ <div>
+ <ul>
+ <li>
+ <a href={"https://clinicaltrials.gov/ct2/show/" + this.props.trial.nct_id}>More info</a>
+ </li>
+ </ul>
+ </div>
</td>
)
} |
7c43b9d9e4cb9b46477429d55a1c65054f0d2dec | src/_shared/ModalDialog.jsx | src/_shared/ModalDialog.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { Dialog, DialogActions, DialogContent, Button, withStyles } from 'material-ui';
const styles = {
dialog: {
'&:first-child': {
padding: 0,
},
},
};
const ModalDialog = (props) => {
const {
children, classes, onAccept, onDismiss, ...other
} = props;
return (
<Dialog {...other}>
<DialogContent className={classes.dialog}>
{ children }
</DialogContent>
<DialogActions>
<Button color="primary" onClick={onDismiss}> Cancel </Button>
<Button color="primary" onClick={onAccept}> OK </Button>
</DialogActions>
</Dialog>
);
};
ModalDialog.propTypes = {
children: PropTypes.node.isRequired,
onAccept: PropTypes.func.isRequired,
onDismiss: PropTypes.func.isRequired,
classes: PropTypes.object.isRequired,
};
export default withStyles(styles, { name: 'MuiPickersModal' })(ModalDialog);
| import React from 'react';
import PropTypes from 'prop-types';
import { Dialog, DialogActions, DialogContent, Button, withStyles } from 'material-ui';
const styles = {
dialog: {
'&:first-child': {
padding: 0,
},
},
};
const ModalDialog = (props) => {
const {
children, classes, onAccept, onDismiss, ...other
} = props;
return (
<Dialog {...other}>
<DialogContent className={classes.dialog}>
{ children }
</DialogContent>
<DialogActions>
<Button color="primary" onClick={onDismiss} tabIndex={-1}> Cancel </Button>
<Button color="primary" onClick={onAccept}> OK </Button>
</DialogActions>
</Dialog>
);
};
ModalDialog.propTypes = {
children: PropTypes.node.isRequired,
onAccept: PropTypes.func.isRequired,
onDismiss: PropTypes.func.isRequired,
classes: PropTypes.object.isRequired,
};
export default withStyles(styles, { name: 'MuiPickersModal' })(ModalDialog);
| Update tabIndex on cancel button | Update tabIndex on cancel button | JSX | mit | dmtrKovalenko/material-ui-pickers,mui-org/material-ui,callemall/material-ui,rscnt/material-ui,mui-org/material-ui,oliviertassinari/material-ui,callemall/material-ui,mui-org/material-ui,mbrookes/material-ui,oliviertassinari/material-ui,dmtrKovalenko/material-ui-pickers,callemall/material-ui,rscnt/material-ui,mbrookes/material-ui,oliviertassinari/material-ui,callemall/material-ui,rscnt/material-ui,mbrookes/material-ui | ---
+++
@@ -22,7 +22,7 @@
</DialogContent>
<DialogActions>
- <Button color="primary" onClick={onDismiss}> Cancel </Button>
+ <Button color="primary" onClick={onDismiss} tabIndex={-1}> Cancel </Button>
<Button color="primary" onClick={onAccept}> OK </Button>
</DialogActions>
</Dialog> |
84248c019c1e4885820e4460df77fe332c98ffed | installer/frontend/components/bm-cluster-info.jsx | installer/frontend/components/bm-cluster-info.jsx | import React from 'react';
import { Input, Connect } from './ui';
import { TectonicLicense, licenseForm } from './tectonic-license';
import { ExperimentalFeatures } from './experimental-features';
import { CLUSTER_NAME } from '../cluster-config';
import { Form } from '../form';
import fields from '../fields';
const clusterInfoForm = new Form("BM_ClusterInfo", [
licenseForm,
fields[CLUSTER_NAME],
]);
export const BM_ClusterInfo = () => {
return (
<div>
<div className="row form-group">
<div className="col-xs-3">
<label htmlFor={CLUSTER_NAME}>Cluster Name</label>
</div>
<div className="col-xs-9">
<Connect field={CLUSTER_NAME}>
<Input placeholder="production" autoFocus="true" />
</Connect>
<p className="text-muted">Give this cluster a name that will help you identify it.</p>
</div>
</div>
<TectonicLicense />
<br />
<ExperimentalFeatures />
</div>
);
};
BM_ClusterInfo.canNavigateForward = clusterInfoForm.canNavigateForward;
| import React from 'react';
import { Input, Connect } from './ui';
import { TectonicLicense, licenseForm } from './tectonic-license';
import { ExperimentalFeatures } from './experimental-features';
import { CLUSTER_NAME } from '../cluster-config';
import { Form } from '../form';
import fields from '../fields';
const clusterInfoForm = new Form("BM_ClusterInfo", [
licenseForm,
fields[CLUSTER_NAME],
]);
export const BM_ClusterInfo = () => {
return (
<div>
<div className="row form-group">
<div className="col-xs-3">
<label htmlFor={CLUSTER_NAME}>Cluster Name</label>
</div>
<div className="col-xs-9">
<Connect field={CLUSTER_NAME}>
<Input placeholder="production" autoFocus="true" />
</Connect>
<p className="text-muted">Give this cluster a name that will help you identify it.</p>
</div>
</div>
<ExperimentalFeatures />
<TectonicLicense />
</div>
);
};
BM_ClusterInfo.canNavigateForward = clusterInfoForm.canNavigateForward;
| Make order of tectonic license & experimental features the same in baremetal & aws. | frontend: Make order of tectonic license & experimental features the same in baremetal & aws.
| JSX | apache-2.0 | cpanato/tectonic-installer,everett-toews/tectonic-installer,radhikapc/tectonic-installer,estroz/tectonic-installer,yifan-gu/tectonic-installer,ggreer/tectonic-installer,mrwacky42/tectonic-installer,squat/tectonic-installer,bison/tectonic-installer,AduroIdeja/tectonic-installer,yifan-gu/tectonic-installer,bison/tectonic-installer,kyoto/tectonic-installer,justaugustus/tectonic-installer,alexsomesan/tectonic-installer,joshrosso/tectonic-installer,lander2k2/tectonic-installer,rithujohn191/tectonic-installer,coreos/tectonic-installer,AduroIdeja/tectonic-installer,AduroIdeja/tectonic-installer,bison/tectonic-installer,mxinden/tectonic-installer,cpanato/tectonic-installer,mxinden/tectonic-installer,radhikapc/tectonic-installer,rithujohn191/tectonic-installer,s-urbaniak/tectonic-installer,colemickens/tectonic-installer,joshix/tectonic-installer,hhoover/tectonic-installer,mrwacky42/tectonic-installer,lander2k2/tectonic-installer,coreos/tectonic-installer,rithujohn191/tectonic-installer,hhoover/tectonic-installer,hhoover/tectonic-installer,erjohnso/tectonic-installer,radhikapc/tectonic-installer,kalmog/tectonic-installer,kyoto/tectonic-installer,kyoto/tectonic-installer,ggreer/tectonic-installer,mxinden/tectonic-installer,colemickens/tectonic-installer,erjohnso/tectonic-installer,enxebre/tectonic-installer,justaugustus/tectonic-installer,bison/tectonic-installer,coreos/tectonic-installer,estroz/tectonic-installer,metral/tectonic-installer,lander2k2/tectonic-installer,joshix/tectonic-installer,enxebre/tectonic-installer,erjohnso/tectonic-installer,kalmog/tectonic-installer,yifan-gu/tectonic-installer,zbwright/tectonic-installer,radhikapc/tectonic-installer,aknuds1/tectonic-installer,enxebre/tectonic-installer,AduroIdeja/tectonic-installer,kyoto/tectonic-installer,colemickens/tectonic-installer,metral/tectonic-installer,squat/tectonic-installer,coreos/tectonic-installer,cpanato/tectonic-installer,everett-toews/tectonic-installer,joshrosso/tectonic-installer,alexsomesan/tectonic-installer,kyoto/tectonic-installer,everett-toews/tectonic-installer,AduroIdeja/tectonic-installer,ggreer/tectonic-installer,squat/tectonic-installer,s-urbaniak/tectonic-installer,s-urbaniak/tectonic-installer,squat/tectonic-installer,joshix/tectonic-installer,metral/tectonic-installer,justaugustus/tectonic-installer,zbwright/tectonic-installer,rithujohn191/tectonic-installer,bsiegel/tectonic-installer,everett-toews/tectonic-installer,metral/tectonic-installer,bsiegel/tectonic-installer,justaugustus/tectonic-installer,derekhiggins/installer,joshix/tectonic-installer,alexsomesan/tectonic-installer,bsiegel/tectonic-installer,metral/tectonic-installer,justaugustus/tectonic-installer,kalmog/tectonic-installer,coreos/tectonic-installer,bsiegel/tectonic-installer,enxebre/tectonic-installer,erjohnso/tectonic-installer,s-urbaniak/tectonic-installer,mxinden/tectonic-installer,s-urbaniak/tectonic-installer,estroz/tectonic-installer,lander2k2/tectonic-installer,alexsomesan/tectonic-installer,colemickens/tectonic-installer,zbwright/tectonic-installer,zbwright/tectonic-installer,aknuds1/tectonic-installer,mrwacky42/tectonic-installer,aknuds1/tectonic-installer,rithujohn191/tectonic-installer,everett-toews/tectonic-installer,ggreer/tectonic-installer,joshrosso/tectonic-installer,yifan-gu/tectonic-installer,colemickens/tectonic-installer,joshix/tectonic-installer,joshrosso/tectonic-installer,derekhiggins/installer,aknuds1/tectonic-installer,joshrosso/tectonic-installer,aknuds1/tectonic-installer,zbwright/tectonic-installer,mrwacky42/tectonic-installer,hhoover/tectonic-installer,cpanato/tectonic-installer,bsiegel/tectonic-installer,mrwacky42/tectonic-installer,estroz/tectonic-installer,alexsomesan/tectonic-installer,enxebre/tectonic-installer,hhoover/tectonic-installer,yifan-gu/tectonic-installer | ---
+++
@@ -26,9 +26,8 @@
<p className="text-muted">Give this cluster a name that will help you identify it.</p>
</div>
</div>
+ <ExperimentalFeatures />
<TectonicLicense />
- <br />
- <ExperimentalFeatures />
</div>
);
}; |
fb7521c00db8cdf01f5ae94f01b4b9013a2eddd6 | client/auth/email-verification-notification.jsx | client/auth/email-verification-notification.jsx | import React from 'react'
import { makeServerUrl } from '../network/server-url'
import styled from 'styled-components'
import { grey800, colorTextPrimary } from '../styles/colors'
import { Body1Old } from '../styles/typography'
const VerifyEmail = styled.div`
height: 32px;
background-color: ${grey800};
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-shrink: 0;
`
const VerifyEmailText = styled(Body1Old)`
color: ${colorTextPrimary};
`
export default class ContentLayout extends React.Component {
render() {
const verifyEmailText = `Please verify your email to ensure everything works correctly. In case
you haven't received it yet,`
const verifyEmailLink = (
<a href={makeServerUrl('/send-verification-email')} target='_blank'>
get verification email.
</a>
)
return (
<VerifyEmail>
<VerifyEmailText>
{verifyEmailText} {verifyEmailLink}
</VerifyEmailText>
</VerifyEmail>
)
}
}
| import React from 'react'
import { makeServerUrl } from '../network/server-url'
import styled from 'styled-components'
import { grey800, colorTextPrimary } from '../styles/colors'
import { Body1Old } from '../styles/typography'
const VerifyEmail = styled.div`
height: 32px;
background-color: ${grey800};
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex-shrink: 0;
`
const VerifyEmailText = styled(Body1Old)`
color: ${colorTextPrimary};
`
export default class ContentLayout extends React.Component {
render() {
const verifyEmailText = `Your email is unverified! Check for an email from
ShieldBattery and click the enclosed link. If you don't see one, we can `
const verifyEmailLink = (
<a href={makeServerUrl('/send-verification-email')} target='_blank'>
send another.
</a>
)
return (
<VerifyEmail>
<VerifyEmailText>
{verifyEmailText} {verifyEmailLink}
</VerifyEmailText>
</VerifyEmail>
)
}
}
| Adjust the email verification text a bit. | Adjust the email verification text a bit.
| JSX | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery | ---
+++
@@ -21,11 +21,11 @@
export default class ContentLayout extends React.Component {
render() {
- const verifyEmailText = `Please verify your email to ensure everything works correctly. In case
- you haven't received it yet,`
+ const verifyEmailText = `Your email is unverified! Check for an email from
+ ShieldBattery and click the enclosed link. If you don't see one, we can `
const verifyEmailLink = (
<a href={makeServerUrl('/send-verification-email')} target='_blank'>
- get verification email.
+ send another.
</a>
)
|
222287d4b7b07c345b0aca88f5e605ec8935ba31 | ui/component/viewers/htmlViewer.jsx | ui/component/viewers/htmlViewer.jsx | // @flow
import React from 'react';
import { stopContextMenu } from 'util/context-menu';
type Props = {
source: string,
};
class HtmlViewer extends React.PureComponent<Props> {
render() {
const { source } = this.props;
return (
<div className="file-render__viewer" onContextMenu={stopContextMenu}>
{/* @if TARGET='app' */}
<iframe sandbox="" title={__('File preview')} src={`file://${source}`} />
{/* @endif */}
{/* @if TARGET='web' */}
<iframe sandbox="" title={__('File preview')} src={source} />
{/* @endif */}
</div>
);
}
}
export default HtmlViewer;
| // @flow
import * as React from 'react';
import { stopContextMenu } from 'util/context-menu';
type Props = {
source: string,
};
type State = {
loading: boolean,
};
class HtmlViewer extends React.PureComponent<Props, State> {
iframe: React.ElementRef<any>;
constructor(props: Props) {
super(props);
this.state = { loading: true };
this.iframe = React.createRef();
}
componentDidMount() {
const resize = () => {
const { scrollHeight, scrollWidth } = this.iframe.current.contentDocument.body;
this.iframe.current.style.height = `${scrollHeight}px`;
this.iframe.current.style.width = `${scrollWidth}px`;
};
this.iframe.current.onload = () => {
this.setState({ loading: false });
resize();
};
this.iframe.current.resize = () => resize();
}
render() {
const { source } = this.props;
const { loading } = this.state;
return (
<div className="file-render__viewer" onContextMenu={stopContextMenu}>
{loading && <div className="placeholder--text-document" />}
{/* @if TARGET='app' */}
<iframe ref={this.iframe} hidden={loading} sandbox="" title={__('File preview')} src={`file://${source}`} />
{/* @endif */}
{/* @if TARGET='web' */}
<iframe ref={this.iframe} hidden={loading} sandbox="" title={__('File preview')} src={source} />
{/* @endif */}
</div>
);
}
}
export default HtmlViewer;
| Fix sizing for html files and add loading indicator | Fix sizing for html files and add loading indicator
| JSX | mit | lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron | ---
+++
@@ -1,21 +1,47 @@
// @flow
-import React from 'react';
+import * as React from 'react';
import { stopContextMenu } from 'util/context-menu';
type Props = {
source: string,
};
-class HtmlViewer extends React.PureComponent<Props> {
+type State = {
+ loading: boolean,
+};
+
+class HtmlViewer extends React.PureComponent<Props, State> {
+ iframe: React.ElementRef<any>;
+ constructor(props: Props) {
+ super(props);
+ this.state = { loading: true };
+ this.iframe = React.createRef();
+ }
+
+ componentDidMount() {
+ const resize = () => {
+ const { scrollHeight, scrollWidth } = this.iframe.current.contentDocument.body;
+ this.iframe.current.style.height = `${scrollHeight}px`;
+ this.iframe.current.style.width = `${scrollWidth}px`;
+ };
+ this.iframe.current.onload = () => {
+ this.setState({ loading: false });
+ resize();
+ };
+ this.iframe.current.resize = () => resize();
+ }
+
render() {
const { source } = this.props;
+ const { loading } = this.state;
return (
<div className="file-render__viewer" onContextMenu={stopContextMenu}>
+ {loading && <div className="placeholder--text-document" />}
{/* @if TARGET='app' */}
- <iframe sandbox="" title={__('File preview')} src={`file://${source}`} />
+ <iframe ref={this.iframe} hidden={loading} sandbox="" title={__('File preview')} src={`file://${source}`} />
{/* @endif */}
{/* @if TARGET='web' */}
- <iframe sandbox="" title={__('File preview')} src={source} />
+ <iframe ref={this.iframe} hidden={loading} sandbox="" title={__('File preview')} src={source} />
{/* @endif */}
</div>
); |
9345e53c163cce1394c1aab8b0975d59838cfc57 | imports/ui/components/study_plan/AcadYrRow.jsx | imports/ui/components/study_plan/AcadYrRow.jsx | import React from 'react';
import SemModulesCardContainer from './SemModulesCardContainer.js';
import SemSpecialModulesCard from './SemSpecialModulesCard.jsx';
import Util from '../../../../api/util';
export default class AcadYrRow extends React.Component {
render() {
return (
<section className="activity-line-action">
<div className="time">
{this.props.acadYr}
</div>
<div className="cont">
<div className="cont-in">
<SemModulesCardContainer sem="Sem I" semesterIndex={this.props.semesterIndex[0]} plannerID={this.props.plannerID} />
<SemModulesCardContainer sem="Sem II" semesterIndex={this.props.semesterIndex[1]} plannerID={this.props.plannerID} />
<div className="col-md-4">
<SemSpecialModulesCard specialSem="Special Sem I" />
<SemSpecialModulesCard specialSem="Special Sem II" />
</div>
</div>
</div>
</section>
);
}
}
AcadYrRow.propTypes = {
semesterIndex: React.PropTypes.array,
acadYr: React.PropTypes.string,
plannerID: React.PropTypes.string
}
| import React from 'react';
import SemModulesCardContainer from './SemModulesCardContainer.js';
import SemSpecialModulesCard from './SemSpecialModulesCard.jsx';
export default class AcadYrRow extends React.Component {
render() {
return (
<section className="activity-line-action">
<div className="time">
{this.props.acadYr}
</div>
<div className="cont">
<div className="cont-in">
<SemModulesCardContainer sem="Sem I" semesterIndex={this.props.semesterIndex[0]} plannerID={this.props.plannerID} />
<SemModulesCardContainer sem="Sem II" semesterIndex={this.props.semesterIndex[1]} plannerID={this.props.plannerID} />
<div className="col-md-4">
<SemSpecialModulesCard specialSem="Special Sem I" />
<SemSpecialModulesCard specialSem="Special Sem II" />
</div>
</div>
</div>
</section>
);
}
}
AcadYrRow.propTypes = {
semesterIndex: React.PropTypes.array,
acadYr: React.PropTypes.string,
plannerID: React.PropTypes.string
}
| FIX bug with Util import | FIX bug with Util import
| JSX | mit | nus-mtp/nus-oracle,nus-mtp/nus-oracle | ---
+++
@@ -1,8 +1,6 @@
import React from 'react';
import SemModulesCardContainer from './SemModulesCardContainer.js';
import SemSpecialModulesCard from './SemSpecialModulesCard.jsx';
-
-import Util from '../../../../api/util';
export default class AcadYrRow extends React.Component {
render() { |
17cc28d3a2ac8f6cc13cf572840a0516c52fb647 | components/overlay/index.jsx | components/overlay/index.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import style from './style';
class Overlay extends React.Component {
static propTypes = {
active: React.PropTypes.bool,
className: React.PropTypes.string,
onClick: React.PropTypes.func,
opacity: React.PropTypes.number
};
static defaultProps = {
opacity: 0.5
};
componentDidMount () {
this.app = document.getElementById('react-toolbox-app') || document.body;
this.node = document.createElement('div');
this.app.appendChild(this.node);
this.handleRender();
}
componentDidUpdate () {
this.handleRender();
}
componentWillUnmount () {
ReactDOM.unmountComponentAtNode(this.node);
this.app.removeChild(this.node);
}
handleRender () {
let className = style.root;
let overlayStyle = {};
if (this.props.active) {
className += ` ${style.active}`;
if (this.props.opacity) overlayStyle.opacity = this.props.opacity;
}
if (this.props.className) className += ` ${className}`;
ReactDOM.render(
<div className={className}>
<div
className={style.overlay}
onClick={this.props.onClick}
style={overlayStyle}
/>
{this.props.children}
</div>
, this.node);
}
render () {
return React.DOM.noscript();
}
}
export default Overlay;
| import React from 'react';
import ReactDOM from 'react-dom';
import style from './style';
class Overlay extends React.Component {
static propTypes = {
active: React.PropTypes.bool,
className: React.PropTypes.string,
onClick: React.PropTypes.func,
opacity: React.PropTypes.number
};
static defaultProps = {
opacity: 0.5
};
componentDidMount () {
this.app = document.getElementById('react-toolbox-app') || document.body;
this.node = document.createElement('div');
this.node.setAttribute('data-react-toolbox', 'overlay');
this.app.appendChild(this.node);
this.handleRender();
}
componentDidUpdate () {
this.handleRender();
}
componentWillUnmount () {
ReactDOM.unmountComponentAtNode(this.node);
this.app.removeChild(this.node);
}
handleRender () {
let className = style.root;
const overlayStyle = {};
if (this.props.active) {
if (this.props.opacity > 0) className += ` ${style.active}`;
overlayStyle.opacity = this.props.opacity;
}
if (this.props.className) className += ` ${className}`;
ReactDOM.render(
<div className={className}>
<div
className={style.overlay}
onClick={this.props.onClick}
style={overlayStyle}
/>
{this.props.children}
</div>
, this.node);
}
render () {
return React.DOM.noscript();
}
}
export default Overlay;
| Set .active class only when component has a opacity > 0 | Set .active class only when component has a opacity > 0
| JSX | mit | rubenmoya/react-toolbox,DigitalRiver/react-atlas,jasonleibowitz/react-toolbox,soyjavi/react-toolbox,Magneticmagnum/react-atlas,jasonleibowitz/react-toolbox,react-toolbox/react-toolbox,showings/react-toolbox,rubenmoya/react-toolbox,rubenmoya/react-toolbox,soyjavi/react-toolbox,react-toolbox/react-toolbox,KerenChandran/react-toolbox,KerenChandran/react-toolbox,showings/react-toolbox,react-toolbox/react-toolbox | ---
+++
@@ -17,6 +17,7 @@
componentDidMount () {
this.app = document.getElementById('react-toolbox-app') || document.body;
this.node = document.createElement('div');
+ this.node.setAttribute('data-react-toolbox', 'overlay');
this.app.appendChild(this.node);
this.handleRender();
}
@@ -32,10 +33,11 @@
handleRender () {
let className = style.root;
- let overlayStyle = {};
+ const overlayStyle = {};
+
if (this.props.active) {
- className += ` ${style.active}`;
- if (this.props.opacity) overlayStyle.opacity = this.props.opacity;
+ if (this.props.opacity > 0) className += ` ${style.active}`;
+ overlayStyle.opacity = this.props.opacity;
}
if (this.props.className) className += ` ${className}`;
|
7e2a40cfd4c2201d6559b11d1e11b71250362a9a | app/components/elements/PercentageBar/index.jsx | app/components/elements/PercentageBar/index.jsx | import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import "./style.scss";
const maxWidth = 97;
const minWidth = 3;
class PercentageBar extends React.Component {
static propTypes = {
colorClass: PropTypes.string.isRequired,
value: PropTypes.number.isRequired,
maxValue: PropTypes.number.isRequired,
};
render() {
let percentage = Math.round(maxWidth * this.props.value / (this.props.maxValue || 1) + minWidth) + "%";
let styles = {
current: {
width: percentage,
},
};
let barClasses = classNames(["percentagebar", this.props.colorClass]);
return (<div className="percentagebar__container">
<span className={barClasses}>
<span className="percentagebar__current" style={styles.current}>
<span className="percentagebar__label">
{percentage} women
</span>
</span>
</span>
{this.props.children}
</div>);
}
}
export default PercentageBar;
| import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";
import "./style.scss";
class PercentageBar extends React.Component {
static propTypes = {
colorClass: PropTypes.string.isRequired,
value: PropTypes.number.isRequired,
maxValue: PropTypes.number.isRequired,
};
render() {
let percentage = Math.round((this.props.value / this.props.maxValue) * 100);
let styles = {
current: {
width: `${percentage}%`,
},
};
let barClasses = classNames(["percentagebar", this.props.colorClass]);
return (<div className="percentagebar__container">
<span className={barClasses}>
<span className="percentagebar__current" style={styles.current}>
<span className="percentagebar__label">
{percentage}% women
</span>
</span>
</span>
{this.props.children}
</div>);
}
}
export default PercentageBar;
| Fix PercentageBar giving slightly off values | Fix PercentageBar giving slightly off values
| JSX | mit | lifeonmarspt/care-international,lifeonmarspt/care-international | ---
+++
@@ -3,9 +3,6 @@
import classNames from "classnames";
import "./style.scss";
-
-const maxWidth = 97;
-const minWidth = 3;
class PercentageBar extends React.Component {
@@ -16,10 +13,10 @@
};
render() {
- let percentage = Math.round(maxWidth * this.props.value / (this.props.maxValue || 1) + minWidth) + "%";
+ let percentage = Math.round((this.props.value / this.props.maxValue) * 100);
let styles = {
current: {
- width: percentage,
+ width: `${percentage}%`,
},
};
@@ -29,7 +26,7 @@
<span className={barClasses}>
<span className="percentagebar__current" style={styles.current}>
<span className="percentagebar__label">
- {percentage} women
+ {percentage}% women
</span>
</span>
</span> |
00fb56ff99951708fc4b3988f69b2565cd023c6a | client/views/readouts/transmission_delay_readout.jsx | client/views/readouts/transmission_delay_readout.jsx | import Moment from "moment";
import "moment-duration-format";
import React from "react";
import ListeningView from "../listening_view.js";
class TransmissionDelayReadout extends ListeningView {
componentDidMount() {
super.componentDidMount();
window.setInterval(() => {this.forceUpdate();}, 1000);
}
render() {
const unixTime = this.state.data.length > 0 ? this.state.data[0].t : 0;
const time = Moment.unix(unixTime).utc();
const now = Moment().utc();
const delta = now.diff(time, "milliseconds");
const rangeAlarm = Math.abs(delta) > 30000;
const formatted = Moment.duration(delta, "milliseconds").format("HH:mm:ss", { trim: false });
return <span className={rangeAlarm ? "time-alarm" : ""}>{formatted}</span>;
}
}
export {TransmissionDelayReadout as default};
| import Moment from "moment";
import "moment-duration-format";
import React from "react";
import ListeningView from "../listening_view.js";
class TransmissionDelayReadout extends ListeningView {
componentDidMount() {
super.componentDidMount();
window.setInterval(() => {this.forceUpdate();}, 1000);
}
render() {
const unixTime = this.state.data ? this.state.data.t : 0;
const time = Moment.unix(unixTime).utc();
const now = Moment().utc();
const delta = now.diff(time, "milliseconds");
const rangeAlarm = Math.abs(delta) > 30000;
const formatted = Moment.duration(delta, "milliseconds").format("HH:mm:ss", { trim: false });
return <span className={rangeAlarm ? "time-alarm" : ""}>{formatted}</span>;
}
}
export {TransmissionDelayReadout as default};
| Remove crossfilter from microcharts, fix atmo means, and clarify ground time label. | Remove crossfilter from microcharts, fix atmo means, and clarify ground time label.
| JSX | mit | sensedata/space-telemetry,sensedata/space-telemetry | ---
+++
@@ -12,7 +12,7 @@
}
render() {
- const unixTime = this.state.data.length > 0 ? this.state.data[0].t : 0;
+ const unixTime = this.state.data ? this.state.data.t : 0;
const time = Moment.unix(unixTime).utc();
const now = Moment().utc();
const delta = now.diff(time, "milliseconds"); |
714aee31c750fab1e691d7ca15e90e32faa6475c | app/app/components/home/RegisteredUserHome.jsx | app/app/components/home/RegisteredUserHome.jsx | import React from 'react';
import {Link} from 'react-router'
import auth from '../../utils/auth.jsx'
export default class RegisteredUserHome extends React.Component {
componentWillMount() {
auth.getUser(localStorage.id).then((res) => {
console.log(res.data)
this.user = res.data.user
})
}
render(){
return(
<div className="starter-template">
<h1>Welcome Back, {this.user.first_name}</h1>
<p className="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
</div>
)
}
} | import React from 'react';
import {Link} from 'react-router'
import auth from '../../utils/auth.jsx'
export default class RegisteredUserHome extends React.Component {
// componentWillMount() {
// auth.getUser(localStorage.id).then((res) => {
// this.user = res.data.user
// })
// }
render(){
return(
<div className="starter-template">
<h1>Welcome Back, {this.props.user.first_name}</h1>
<p className="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
</div>
)
}
} | Update to include correct info when mounting component | Update to include correct info when mounting component
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | ---
+++
@@ -3,16 +3,15 @@
import auth from '../../utils/auth.jsx'
export default class RegisteredUserHome extends React.Component {
- componentWillMount() {
- auth.getUser(localStorage.id).then((res) => {
- console.log(res.data)
- this.user = res.data.user
- })
- }
+ // componentWillMount() {
+ // auth.getUser(localStorage.id).then((res) => {
+ // this.user = res.data.user
+ // })
+ // }
render(){
return(
<div className="starter-template">
- <h1>Welcome Back, {this.user.first_name}</h1>
+ <h1>Welcome Back, {this.props.user.first_name}</h1>
<p className="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
</div>
) |
6de799a572aebd9edbc7620333a9a78f2e8c5b52 | client/src/components/customer/CustomerNav.jsx | client/src/components/customer/CustomerNav.jsx | import React from 'react';
// nav bar
const CustomerNav = () => (
<div className="customer-nav-bar">
<ul id="dropdown1" className="dropdown-content">
<li><a href="/">home</a></li>
<li className="divider"></li>
<li><a href="../manager">manager</a></li>
</ul>
<nav>
<div className="nav-wrapper">
<ul className="nav-mobile hide-on-med-and-down">
<li><a className="dropdown-button" href="#!" data-activates="dropdown1">q.<i className="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
</div>
);
export default CustomerNav; | import React from 'react';
// nav bar
const CustomerNav = () => (
<div className="customer-nav-bar">
<ul id="dropdown1" className="dropdown-content">
<li><a href="/">home</a></li>
<li className="divider"></li>
<li><a href="/manager">manager</a></li>
</ul>
<nav>
<div className="nav-wrapper">
<ul className="nav-mobile hide-on-med-and-down">
<li><a className="dropdown-button" href="#!" data-activates="dropdown1">q.<i className="material-icons right">arrow_drop_down</i></a></li>
</ul>
</div>
</nav>
</div>
);
export default CustomerNav; | Fix bug in navbar manager button redirecting to wrong page | Fix bug in navbar manager button redirecting to wrong page
| JSX | mit | Lynne-Daniels/q-dot | ---
+++
@@ -6,7 +6,7 @@
<ul id="dropdown1" className="dropdown-content">
<li><a href="/">home</a></li>
<li className="divider"></li>
- <li><a href="../manager">manager</a></li>
+ <li><a href="/manager">manager</a></li>
</ul>
<nav>
<div className="nav-wrapper"> |
ce97c5fbb0b484a6cbcde8e9841cc0572e682cbf | src/modules/content/components/searchResult.jsx | src/modules/content/components/searchResult.jsx | import ReactPlayer from 'react-player';
require('../styles/search.scss');
class SearchResult extends React.Component {
constructor(props) {
super(props);
}
render() {
const result = this.props.result;
return (
<div className="col-sm-4">
<div className="card">
{result.type == "Online-Video" ?
<ReactPlayer url={result.url} className="card-img-top"
youtubeConfig={{preload: true}} playing={false}
controls={true}/> :
<img className="card-img-top" src={result.image}
alt="Card image cap"/> }
<div className="card-block">
<h4 className="card-title">{result.title}</h4>
<p className="card-text">{result.description}</p>
{ (result.download) ?
<button type="button" className="btn btn-secondary">
<a href={ result.download } target="_blank">Slides</a>
</button> : '' }
<p>
<small className="text-muted">
via {result.source} | {new Date(result.creationDate).toLocaleDateString("de-DE")}
</small>
</p>
</div>
</div>
</div>
);
}
}
export default SearchResult;
| import ReactPlayer from 'react-player';
require('../styles/search.scss');
class SearchResult extends React.Component {
constructor(props) {
super(props);
}
render() {
const attributes = this.props.result.attributes;
return (
<div className="col-sm-4">
<div className="card">
{attributes.type == "Online-Video" ?
<ReactPlayer url={attributes.url} className="card-img-top"
youtubeConfig={{preload: true}} playing={false}
controls={true}/> :
<img className="card-img-top" src={attributes.image}
alt="Card image cap"/> }
<div className="card-block">
<h4 className="card-title">{attributes.title}</h4>
<p className="card-text">{attributes.description}</p>
{ (attributes.download) ?
<button type="button" className="btn btn-secondary">
<a href={ attributes.download } target="_blank">Slides</a>
</button> : '' }
<p>
<small className="text-muted">
via {attributes.source} | {new Date(attributes.creationDate).toLocaleDateString("de-DE")}
</small>
</p>
</div>
</div>
</div>
);
}
}
export default SearchResult;
| Fix attributes not being displayed | Fix attributes not being displayed
| JSX | agpl-3.0 | schul-cloud/schulcloud-client,schul-cloud/schulcloud-client,schul-cloud/schulcloud-client | ---
+++
@@ -7,26 +7,26 @@
}
render() {
- const result = this.props.result;
+ const attributes = this.props.result.attributes;
return (
<div className="col-sm-4">
<div className="card">
- {result.type == "Online-Video" ?
- <ReactPlayer url={result.url} className="card-img-top"
+ {attributes.type == "Online-Video" ?
+ <ReactPlayer url={attributes.url} className="card-img-top"
youtubeConfig={{preload: true}} playing={false}
controls={true}/> :
- <img className="card-img-top" src={result.image}
+ <img className="card-img-top" src={attributes.image}
alt="Card image cap"/> }
<div className="card-block">
- <h4 className="card-title">{result.title}</h4>
- <p className="card-text">{result.description}</p>
- { (result.download) ?
+ <h4 className="card-title">{attributes.title}</h4>
+ <p className="card-text">{attributes.description}</p>
+ { (attributes.download) ?
<button type="button" className="btn btn-secondary">
- <a href={ result.download } target="_blank">Slides</a>
+ <a href={ attributes.download } target="_blank">Slides</a>
</button> : '' }
<p>
<small className="text-muted">
- via {result.source} | {new Date(result.creationDate).toLocaleDateString("de-DE")}
+ via {attributes.source} | {new Date(attributes.creationDate).toLocaleDateString("de-DE")}
</small>
</p>
</div> |
8a21c4f071175306e8a9845417ed7d37743491ba | app/javascript/app/components/footer/bottom-bar/bottom-bar-component.jsx | app/javascript/app/components/footer/bottom-bar/bottom-bar-component.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import cx from 'classnames';
import layout from 'styles/layout.scss';
import styles from './bottom-bar-styles.scss';
const BottomBar = ({ className }) => (
<div className={styles.container}>
<div className={cx(layout.content, styles.bottomBar, className)}>
<div>
<Link className={styles.text} to="/about/permissions">
Permissions & Licensing
</Link>
</div>
<div>
<span className={styles.text}>
Climate Watch © 2017 Powered by Resource Watch
</span>
</div>
</div>
</div>
);
BottomBar.propTypes = {
className: PropTypes.string
};
export default BottomBar;
| import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import cx from 'classnames';
import layout from 'styles/layout.scss';
import styles from './bottom-bar-styles.scss';
const BottomBar = ({ className }) => (
<div className={styles.container}>
<div className={cx(layout.content, styles.bottomBar, className)}>
<div>
<Link className={styles.text} to="/about/permissions">
Permissions & Licensing
</Link>
</div>
<div>
<span className={styles.text}>
Climate Watch © {new Date().getFullYear()} Powered by Resource Watch
</span>
</div>
</div>
</div>
);
BottomBar.propTypes = {
className: PropTypes.string
};
export default BottomBar;
| Include current year in footer | Include current year in footer
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -16,7 +16,7 @@
</div>
<div>
<span className={styles.text}>
- Climate Watch © 2017 Powered by Resource Watch
+ Climate Watch © {new Date().getFullYear()} Powered by Resource Watch
</span>
</div>
</div> |
f09997aeeaeef82f37efe8d4582062df9acb598e | client/public/js/components/status_run_idle.jsx | client/public/js/components/status_run_idle.jsx | import React from 'react';
import Button from './button';
function StatusRunIdle(props) {
return (
<div className="status-run-idle">
<p>
This simulation might take about <span className="time">6 hours</span>.
</p>
<p>
We'll send you an email at {props.email} when you run this
workflow, and another when it's done.
</p>
<Button
type="form"
onClick={props.clickRun}
disabled={props.fetchingData}
>
Run Workflow
</Button>
</div>
);
}
StatusRunIdle.propTypes = {
clickRun: React.PropTypes.func.isRequired,
email: React.PropTypes.string.isRequired,
fetchingData: React.PropTypes.bool.isRequired,
};
export default StatusRunIdle;
| import React from 'react';
import Button from './button';
function StatusRunIdle(props) {
return (
<div className="status-run-idle">
<p>
This simulation might take about <span className="time">6 hours</span>.
</p>
<p>
We'll send you an email at {props.email} when you run this
workflow, and another when it's done.
</p>
<Button
type="form"
onClick={props.clickRun}
disabled={props.fetchingData}
>
Run Workflow
</Button>
</div>
);
}
StatusRunIdle.defaultProps = {
fetchingData: false,
};
StatusRunIdle.propTypes = {
clickRun: React.PropTypes.func.isRequired,
email: React.PropTypes.string.isRequired,
fetchingData: React.PropTypes.bool,
};
export default StatusRunIdle;
| Fix missing proptype in statusrunidle | Fix missing proptype in statusrunidle
| JSX | apache-2.0 | Autodesk/molecular-simulation-tools,Autodesk/molecular-design-applications,Autodesk/molecular-simulation-tools,Autodesk/molecular-design-applications,Autodesk/molecular-simulation-tools,Autodesk/molecular-design-applications | ---
+++
@@ -22,10 +22,14 @@
);
}
+StatusRunIdle.defaultProps = {
+ fetchingData: false,
+};
+
StatusRunIdle.propTypes = {
clickRun: React.PropTypes.func.isRequired,
email: React.PropTypes.string.isRequired,
- fetchingData: React.PropTypes.bool.isRequired,
+ fetchingData: React.PropTypes.bool,
};
export default StatusRunIdle; |
9a698e83806e64c15f3c7fdffe3382ede446244c | app/views/emails/best-of-digest/post-comment.jsx | app/views/emails/best-of-digest/post-comment.jsx | import React from 'react';
import classnames from 'classnames';
import PieceOfText from './piece-of-text';
import UserName from './user-name';
export default class PostComment extends React.Component {
renderBody() {
const authorAndButtons = (
<span>
{' -'}
<UserName user={this.props.createdBy} me={this.props.me}/>
</span>
);
return (
<div className="comment-body">
<PieceOfText
text={this.props.body}
/>
{authorAndButtons}
</div>
);
}
render() {
const className = classnames({
'comment': true,
'highlighted': false,
'omit-bubble': false,
'is-hidden': false,
'highlight-from-url': false,
'my-comment': false
});
return (
<div
className={className}
data-author={this.props.createdBy.username}
>
{this.renderBody()}
</div>
);
}
}
| import React from 'react';
import classnames from 'classnames';
import PieceOfText from './piece-of-text';
import UserName from './user-name';
export default class PostComment extends React.Component {
renderBody() {
let authorAndButtons = '';
if (!this.props.hideType) {
authorAndButtons = (
<span>
{' -'}
<UserName user={this.props.createdBy} me={this.props.me}/>
</span>
);
}
return (
<div className="comment-body">
<PieceOfText
text={this.props.body}
/>
{authorAndButtons}
</div>
);
}
render() {
const className = classnames({
'comment': true,
'highlighted': false,
'omit-bubble': false,
'is-hidden': false,
'highlight-from-url': false,
'my-comment': false
});
return (
<div className={className}>
{this.renderBody()}
</div>
);
}
}
| Fix hidden comment display in bestOf email. | Fix hidden comment display in bestOf email.
| JSX | mit | FreeFeed/freefeed-server,FreeFeed/freefeed-server | ---
+++
@@ -7,12 +7,15 @@
export default class PostComment extends React.Component {
renderBody() {
- const authorAndButtons = (
- <span>
- {' -'}
- <UserName user={this.props.createdBy} me={this.props.me}/>
- </span>
- );
+ let authorAndButtons = '';
+ if (!this.props.hideType) {
+ authorAndButtons = (
+ <span>
+ {' -'}
+ <UserName user={this.props.createdBy} me={this.props.me}/>
+ </span>
+ );
+ }
return (
<div className="comment-body">
@@ -36,10 +39,7 @@
return (
- <div
- className={className}
- data-author={this.props.createdBy.username}
- >
+ <div className={className}>
{this.renderBody()}
</div>
); |
8ce46bd12c4221b5c42e18b76fa2b251aad0936f | frontend/components/trade/incoming_trade_item.jsx | frontend/components/trade/incoming_trade_item.jsx | import React from 'react';
import { Link } from 'react-router';
const IncomingTradeItem = (props) => {
const trade = props.trade;
return (
<div className="trade-item">
<div className="trade-info">
<Link to={`/items/${trade.requester.item.id}`}>
{trade.requester.item.name}
</Link> for <Link to={`/${trade.receiver.id}/garage`}>
{trade.receiver.name}
</Link>'s <Link to={`/items/${trade.receiver.item.id}`}>
{trade.receiver.item.name}
</Link>
</div>
<div className="trade-info">
<button
className="primary-button trade-button nice"
onClick={props.updateTrade}>
Accept
</button>
<button
className="primary-button trade-button mean"
onClick={props.destroyTrade}>
Remove
</button>
</div>
</div>
);
};
export default IncomingTradeItem; | import React from 'react';
import { Link } from 'react-router';
const IncomingTradeItem = (props) => {
const trade = props.trade;
return (
<div className="trade-item">
<div className="trade-info">
<Link to={`/${trade.requester.id}/garage`}>
{trade.requester.name}'s
</Link> <Link to={`/items/${trade.requester.item.id}`}>
{trade.requester.item.name}
</Link> for your <Link to={`/items/${trade.receiver.item.id}`}>
{trade.receiver.item.name}
</Link>
</div>
<div className="trade-info">
<button
className="primary-button trade-button nice"
onClick={props.updateTrade}>
Accept
</button>
<button
className="primary-button trade-button mean"
onClick={props.destroyTrade}>
Remove
</button>
</div>
</div>
);
};
export default IncomingTradeItem; | Fix wording of incoming trade request | Fix wording of incoming trade request
| JSX | mit | PGilbertSchmitt/SwappingApp,PGilbertSchmitt/SwappingApp,PGilbertSchmitt/SwappingApp | ---
+++
@@ -6,12 +6,12 @@
return (
<div className="trade-item">
<div className="trade-info">
- <Link to={`/items/${trade.requester.item.id}`}>
- {trade.requester.item.name}
- </Link> for <Link to={`/${trade.receiver.id}/garage`}>
- {trade.receiver.name}
- </Link>'s <Link to={`/items/${trade.receiver.item.id}`}>
- {trade.receiver.item.name}
+ <Link to={`/${trade.requester.id}/garage`}>
+ {trade.requester.name}'s
+ </Link> <Link to={`/items/${trade.requester.item.id}`}>
+ {trade.requester.item.name}
+ </Link> for your <Link to={`/items/${trade.receiver.item.id}`}>
+ {trade.receiver.item.name}
</Link>
</div>
|
f09d9e86e676db545d0d08773176914e1f1f5b87 | src/cred/location_input.jsx | src/cred/location_input.jsx | import React from 'react';
import InputWrap from './input_wrap';
import Icon from '../icon/icon';
export default class LocationInput extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
const { onClick, tabIndex, value } = this.props;
const { focused } = this.state;
const limitedValue = value.length > 23 ?
`${value.substr(0,20)}...` : value;
return (
<InputWrap name="location" isValid={true} icon={<Icon name="location" />} focused={focused}>
<input type="button"
name="location"
className="auth0-lock-input auth0-lock-input-location"
value={limitedValue}
onFocus={::this.handleFocus}
onBlur={::this.handleBlur}
onKeyDown={::this.handleKeyDown}
onClick={onClick}
tabIndex={tabIndex} />
<Icon name="arrow" />
</InputWrap>
);
}
handleFocus() {
this.setState({focused: true});
}
handleBlur() {
this.setState({focused: false});
}
handleKeyDown(e) {
e.preventDefault();
if (e.key === "ArrowDown") {
return this.props.onClick();
}
if (e.keyCode >= 65 && e.keyCode <= 90) {
return this.props.onClick(String.fromCharCode(e.keyCode).toLowerCase());
}
}
}
// TODO: specify propTypes
| import React from 'react';
import InputWrap from './input_wrap';
import Icon from '../icon/icon';
export default class LocationInput extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
const { onClick, tabIndex, value } = this.props;
const { focused } = this.state;
const limitedValue = value.length > 23 ?
`${value.substr(0,20)}...` : value;
return (
<InputWrap name="location" isValid={true} icon={<Icon name="location" />} focused={focused}>
<input type="button"
name="location"
className="auth0-lock-input auth0-lock-input-location"
value={limitedValue}
onFocus={::this.handleFocus}
onBlur={::this.handleBlur}
onKeyDown={::this.handleKeyDown}
onClick={onClick}
tabIndex={tabIndex} />
<Icon name="arrow" />
</InputWrap>
);
}
handleFocus() {
this.setState({focused: true});
}
handleBlur() {
this.setState({focused: false});
}
handleKeyDown(e) {
if (e.key !== "Tab") {
e.preventDefault();
}
if (e.key === "ArrowDown") {
return this.props.onClick();
}
if (e.keyCode >= 65 && e.keyCode <= 90) {
return this.props.onClick(String.fromCharCode(e.keyCode).toLowerCase());
}
}
}
// TODO: specify propTypes
| Fix location input tab navigation | Fix location input tab navigation
| JSX | mit | mike-casas/lock,auth0/lock-passwordless,auth0/lock-passwordless,auth0/lock-passwordless,mike-casas/lock,mike-casas/lock | ---
+++
@@ -40,7 +40,10 @@
}
handleKeyDown(e) {
- e.preventDefault();
+ if (e.key !== "Tab") {
+ e.preventDefault();
+ }
+
if (e.key === "ArrowDown") {
return this.props.onClick();
} |
de4173d6480e7f5ffbc97861ec21e4626c287ffc | apps/authentication/static/js/components/App.jsx | apps/authentication/static/js/components/App.jsx | var React = require('react');
var Login = require('./Login.jsx');
var Register = require('./Register.jsx');
var App = React.createClass({
render: function () {
return (
<div>
<hgroup>
<h1>MicroAuth</h1>
<h3>Authentication service for microserv</h3>
</hgroup>
<div className="split-page left">
<Login />
</div>
<div className="split-page right">
<Register />
</div>
<div className="clearfix"></div>
</div>
)
}
});
module.exports = App; | var React = require('react');
var Login = require('./Login.jsx');
var Register = require('./Register.jsx');
var App = React.createClass({
getInitialState: function() {
return {
hideLogin: false,
hideRegistration: true
};
},
switchView: function() {
this.setState({
hideLogin: !this.state.hideLogin,
hideRegistration: !this.state.hideRegistration
});
},
render: function () {
return (
<div>
<hgroup>
<h1>MicroAuth</h1>
<h3>Authentication service for microserv</h3>
</hgroup>
<div className="" hidden={this.state.hideLogin}>
<Login />
</div>
<div className="" hidden={this.state.hideRegistration}>
<Register />
</div>
<div className="clearfix"></div>
<hgroup>
<h3 onClick={this.switchView} hidden={this.state.hideLogin}>
Need an account? Click here to sign up.
</h3>
<h3 onClick={this.switchView} hidden={this.state.hideRegistration}>
Already have an account? Click here to log in.
</h3>
</hgroup>
</div>
)
}
});
module.exports = App; | Make the app look nice. | Make the app look nice.
| JSX | mit | microserv/microauth,microserv/microauth,microserv/microauth | ---
+++
@@ -4,6 +4,20 @@
var Register = require('./Register.jsx');
var App = React.createClass({
+ getInitialState: function() {
+ return {
+ hideLogin: false,
+ hideRegistration: true
+ };
+ },
+
+ switchView: function() {
+ this.setState({
+ hideLogin: !this.state.hideLogin,
+ hideRegistration: !this.state.hideRegistration
+ });
+ },
+
render: function () {
return (
<div>
@@ -11,13 +25,21 @@
<h1>MicroAuth</h1>
<h3>Authentication service for microserv</h3>
</hgroup>
- <div className="split-page left">
+ <div className="" hidden={this.state.hideLogin}>
<Login />
</div>
- <div className="split-page right">
+ <div className="" hidden={this.state.hideRegistration}>
<Register />
</div>
<div className="clearfix"></div>
+ <hgroup>
+ <h3 onClick={this.switchView} hidden={this.state.hideLogin}>
+ Need an account? Click here to sign up.
+ </h3>
+ <h3 onClick={this.switchView} hidden={this.state.hideRegistration}>
+ Already have an account? Click here to log in.
+ </h3>
+ </hgroup>
</div>
)
} |
a9c10cc2ee4ad8591307a8935349e9bd42066377 | app/assets/javascripts/components/ui/list.js.jsx | app/assets/javascripts/components/ui/list.js.jsx | var ListItem = React.createClass({
render() {
return <li>{this.props.children}</li>
}
})
var List = React.createClass({
statics: {
Item: ListItem
},
propTypes: {
type: React.PropTypes.oneOf(['inline', 'piped']).isRequired
},
render() {
var type = this.props.type
var cs = React.addons.classSet({
'list-reset': true,
'list--inline': type === 'inline',
'list--piped': type === 'piped'
})
return <ul className={cs}>{this.props.children}</ul>
}
})
module.exports = List
| var ListItem = React.createClass({
render() {
return <li>{this.props.children}</li>
}
})
var List = React.createClass({
statics: {
Item: ListItem
},
propTypes: {
type: React.PropTypes.oneOf(['inline', 'piped']).isRequired
},
render() {
var type = this.props.type
var cs = React.addons.classSet({
'list-reset mb0': true,
'list--inline': type === 'inline',
'list--piped': type === 'piped'
})
return <ul className={cs}>{this.props.children}</ul>
}
})
module.exports = List
| Remove margin bottom on Lists. | Remove margin bottom on Lists.
| JSX | agpl-3.0 | lachlanjc/meta,assemblymade/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta,assemblymade/meta,lachlanjc/meta | ---
+++
@@ -17,7 +17,7 @@
render() {
var type = this.props.type
var cs = React.addons.classSet({
- 'list-reset': true,
+ 'list-reset mb0': true,
'list--inline': type === 'inline',
'list--piped': type === 'piped'
}) |
1d50eddf8c59d6fc49babe502c551cf1167a3580 | src/views/HomeView/index.jsx | src/views/HomeView/index.jsx | import React from 'react';
import './index.scss';
export default class HomeView extends React.Component {
render() {
return (
<div className="container text-center">
<h1>Welcome to the React Redux Starter Kit</h1>
</div>
);
}
}
| import React from 'react';
import './index.scss';
export default class HomeView extends React.Component {
render() {
return (
<div className="container text-center">
<a href ="/auth/login/facebook">Log in</a>
</div>
);
}
}
| Add log in link to logged out home | Add log in link to logged out home
This will help people log in.
| JSX | mit | lencioni/gift-thing,lencioni/gift-thing | ---
+++
@@ -1,11 +1,12 @@
import React from 'react';
+
import './index.scss';
export default class HomeView extends React.Component {
render() {
return (
<div className="container text-center">
- <h1>Welcome to the React Redux Starter Kit</h1>
+ <a href ="/auth/login/facebook">Log in</a>
</div>
);
} |
aebdcb75c6e104acb1fb605937e26571661c0764 | src/specs/css-loader.spec.jsx | src/specs/css-loader.spec.jsx | import React from 'react';
import { lorem } from './util';
import './css-loader.css';
class CssSample extends React.Component {
render() {
return (
<div className="css-sample">
<p>{ lorem(50) }</p>
<p>{ lorem(50) }</p>
</div>
);
}
}
describe('CSS', function() {
this.header(`## CSS via webpack css-loader.`);
before(() => {
this
.component( <CssSample/> );
});
});
| import React from 'react';
import { lorem } from './util';
const IS_BROWSER = typeof(window) !== 'undefined';
if (IS_BROWSER) {
require('./css-loader.css');
}
class CssSample extends React.Component {
render() {
return (
<div className="css-sample">
<p>{ lorem(50) }</p>
<p>{ lorem(50) }</p>
</div>
);
}
}
describe('CSS', function() {
this.header(`## CSS via webpack css-loader.`);
before(() => {
this
.component( <CssSample/> );
});
});
| Add switch to only import CSS when in browser. | Hack: Add switch to only import CSS when in browser.
This prevents compile errors when spec JS is parsed on server. Would
be nice to figure out a better way to handle this in the future.
JS is parsed on the server so that a copy of the specs are available in
memory. This is to allow for `it.server` (yet to be implemented).
| JSX | mit | philcockfield/ui-harness,philcockfield/ui-harness,philcockfield/ui-harness | ---
+++
@@ -1,6 +1,12 @@
import React from 'react';
import { lorem } from './util';
-import './css-loader.css';
+
+
+const IS_BROWSER = typeof(window) !== 'undefined';
+if (IS_BROWSER) {
+ require('./css-loader.css');
+}
+
class CssSample extends React.Component { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.