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
|
---|---|---|---|---|---|---|---|---|---|---|
93ea0ce82a8542db58bc48984cd601b9d11f56a8 | src/components/App/App.jsx | src/components/App/App.jsx | import React from 'react';
import ModifierList from '../ModifierList';
import EventLightList from '../EventLightList';
import EventDetailsList from '../EventDetailsList';
import TestArea from '../TestArea';
const App = () => (
<div>
<h1>Keyboard</h1>
<h2>Active Modifiers</h2>
<p>Determined using <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState" title="'KeyboardEvent.getModifierState()' on MDN"><code>KeyboardEvent.getModifierState()</code></a>. Press any key to determine the state of all modifiers. When the page loses focus the state of each modifier key is invalidated.</p>
<ModifierList />
<h2>Triggered Events</h2>
<TestArea />
<p>Event listeners on the window object show when these events are fired. Each light will flash green for 100ms after it has been pressed. It will then turn grey and fade out. You may notice that not all keys trigger a keypress event.</p>
<EventLightList />
<h2>Latest Events</h2>
<TestArea />
<p>Observe the order and details of each keyboard event captured by the window. Shows the nine latest keyboard events with the most recent at the top.</p>
<EventDetailsList />
</div>
);
export default App;
| import React from 'react';
import ModifierList from '../ModifierList';
import EventLightList from '../EventLightList';
import EventDetailsList from '../EventDetailsList';
import TestArea from '../TestArea';
const App = () => (
<div>
<h1>Keyboard</h1>
<h2>Active Modifiers</h2>
<TestArea />
<p>Determined using <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState" title="'KeyboardEvent.getModifierState()' on MDN"><code>KeyboardEvent.getModifierState()</code></a>. Press any key to determine the state of all modifiers. When the page loses focus the state of each modifier key is invalidated.</p>
<ModifierList />
<h2>Triggered Events</h2>
<TestArea />
<p>Event listeners on the window object show when these events are fired. Each light will flash green for 100ms after it has been pressed. It will then turn grey and fade out. You may notice that not all keys trigger a keypress event.</p>
<EventLightList />
<h2>Latest Events</h2>
<TestArea />
<p>Observe the order and details of each keyboard event captured by the window. Shows the nine latest keyboard events with the most recent at the top.</p>
<EventDetailsList />
</div>
);
export default App;
| Add test area to active modifiers section | Add test area to active modifiers section
| JSX | mit | j-/keyboard,j-/keyboard | ---
+++
@@ -9,6 +9,7 @@
<h1>Keyboard</h1>
<h2>Active Modifiers</h2>
+ <TestArea />
<p>Determined using <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState" title="'KeyboardEvent.getModifierState()' on MDN"><code>KeyboardEvent.getModifierState()</code></a>. Press any key to determine the state of all modifiers. When the page loses focus the state of each modifier key is invalidated.</p>
<ModifierList />
|
bfd14a115a2fb3b5d0f581488326bf6aa0580b42 | src/views/preview/studio-list.jsx | src/views/preview/studio-list.jsx | const React = require('react');
const PropTypes = require('prop-types');
const FormattedMessage = require('react-intl').FormattedMessage;
const FlexRow = require('../../components/flex-row/flex-row.jsx');
const ThumbnailColumn = require('../../components/thumbnailcolumn/thumbnailcolumn.jsx');
const projectShape = require('./projectshape.jsx').projectShape;
const StudioList = props => {
const studios = props.studios;
if (studios.length === 0) return null;
return (
<FlexRow className="studio-list">
<div className="list-title">
<FormattedMessage id="general.studios" />
</div>
{studios.length === 0 ? (
// TODO: style remix invitation
<FormattedMessage id="addToStudio.inviteUser" />
) : (
<ThumbnailColumn
cards
showAvatar
itemType="studio"
items={studios.slice(0, 5)}
showFavorites={false}
showLoves={false}
showViews={false}
/>
)}
</FlexRow>
);
};
StudioList.propTypes = {
studios: PropTypes.arrayOf(projectShape)
};
module.exports = StudioList;
| const React = require('react');
const PropTypes = require('prop-types');
const FormattedMessage = require('react-intl').FormattedMessage;
const FlexRow = require('../../components/flex-row/flex-row.jsx');
const ThumbnailColumn = require('../../components/thumbnailcolumn/thumbnailcolumn.jsx');
const projectShape = require('./projectshape.jsx').projectShape;
const StudioList = props => {
const studios = props.studios;
if (studios.length === 0) return null;
return (
<FlexRow className="studio-list">
<div className="list-title">
<FormattedMessage id="general.studios" />
</div>
{studios.length === 0 ? (
// TODO: style remix invitation
<FormattedMessage id="addToStudio.inviteUser" />
) : (
<ThumbnailColumn
cards
showAvatar
itemType="studios"
items={studios.slice(0, 5)}
showFavorites={false}
showLoves={false}
showViews={false}
/>
)}
</FlexRow>
);
};
StudioList.propTypes = {
studios: PropTypes.arrayOf(projectShape)
};
module.exports = StudioList;
| Fix the studio links to use the correct URL | Fix the studio links to use the correct URL
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -20,7 +20,7 @@
<ThumbnailColumn
cards
showAvatar
- itemType="studio"
+ itemType="studios"
items={studios.slice(0, 5)}
showFavorites={false}
showLoves={false} |
642b93b66bac9dc9f4d9e54c20824adef7d046e8 | src/client/modules/Contacts/ContactDocuments/ContactDocuments.jsx | src/client/modules/Contacts/ContactDocuments/ContactDocuments.jsx | import React from 'react'
import styled from 'styled-components'
import { SPACING } from '@govuk-react/constants'
import { typography } from '@govuk-react/lib'
import ContactResource from '../../../components/Resource/Contact'
import { NewWindowLink } from '../../../components'
const StyledSectionHeader = styled('div')`
${typography.font({ size: 24, weight: 'bold' })};
margin-bottom: ${SPACING.SCALE_4};
`
const ContactDocuments = ({ contactId, archivedDocumentPath }) => {
return (
<ContactResource id={contactId}>
{(contact) => (
<>
<StyledSectionHeader data-test="document-heading">
Documents
</StyledSectionHeader>
{contact.archivedDocumentsUrlPath ? (
<NewWindowLink
href={archivedDocumentPath + contact.archivedDocumentsUrlPath}
data-test="document-link"
>
View files and documents
</NewWindowLink>
) : (
<p data-test="no-documents-message">
There are no files or documents
</p>
)}
</>
)}
</ContactResource>
)
}
export default ContactDocuments
| import React from 'react'
import ContactResource from '../../../components/Resource/Contact'
import DocumentsSection from '../../../components/DocumentsSection'
const ContactDocuments = ({ contactId, archivedDocumentPath }) => {
return (
<ContactResource id={contactId}>
{(contact) => (
<DocumentsSection
fileBrowserRoot={archivedDocumentPath}
documentPath={contact.archivedDocumentsUrlPath}
/>
)}
</ContactResource>
)
}
export default ContactDocuments
| Rewrite contact documents page to use new component | Rewrite contact documents page to use new component
| JSX | mit | uktrade/data-hub-fe-beta2,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-frontend,uktrade/data-hub-fe-beta2 | ---
+++
@@ -1,37 +1,16 @@
import React from 'react'
-import styled from 'styled-components'
-import { SPACING } from '@govuk-react/constants'
-import { typography } from '@govuk-react/lib'
import ContactResource from '../../../components/Resource/Contact'
-import { NewWindowLink } from '../../../components'
-
-const StyledSectionHeader = styled('div')`
- ${typography.font({ size: 24, weight: 'bold' })};
- margin-bottom: ${SPACING.SCALE_4};
-`
+import DocumentsSection from '../../../components/DocumentsSection'
const ContactDocuments = ({ contactId, archivedDocumentPath }) => {
return (
<ContactResource id={contactId}>
{(contact) => (
- <>
- <StyledSectionHeader data-test="document-heading">
- Documents
- </StyledSectionHeader>
- {contact.archivedDocumentsUrlPath ? (
- <NewWindowLink
- href={archivedDocumentPath + contact.archivedDocumentsUrlPath}
- data-test="document-link"
- >
- View files and documents
- </NewWindowLink>
- ) : (
- <p data-test="no-documents-message">
- There are no files or documents
- </p>
- )}
- </>
+ <DocumentsSection
+ fileBrowserRoot={archivedDocumentPath}
+ documentPath={contact.archivedDocumentsUrlPath}
+ />
)}
</ContactResource>
) |
420d2d183149b35da4ec2a5aa8a15a8b41e348ff | source/assets/javascripts/_components/modal.jsx | source/assets/javascripts/_components/modal.jsx | var Modal = React.createClass({
hijriDateString: function () {
if (this.props.day && this.props.day.hijri) {
var day = this.props.day.hijri;
return day.date.toString() + " " + HijriDate.getMonthName(day.month) + " " + day.year.toString() + "H";
}
},
gregorianDateString: function () {
if (this.props.day && this.props.day.gregorian) {
var day = this.props.day.gregorian;
return day.date.toString() + " " + Date.getMonthName(day.month) + " " + day.year.toString() + "AD";
}
},
render: function () {
return (
<div className="modal" id={this.props.modalId}>
<input className="modal-state" id="modal-checkbox" type="checkbox" />
<div className="modal-window">
<div className="modal-inner">
<label className="modal-close" htmlFor="modal-checkbox"></label>
<h3>{this.hijriDateString()}</h3>
<h4>{this.gregorianDateString()}</h4>
<MiqaatList day={this.props.day} miqaats={this.props.miqaats} />
</div>
</div>
</div>
);
}
});
| var Modal = React.createClass({
hijriDateString: function () {
if (this.props.day && this.props.day.hijri) {
var day = this.props.day.hijri;
return day.date.toString() + " " + HijriDate.getMonthName(day.month) + " " + day.year.toString() + "H";
}
},
gregorianDateString: function () {
if (this.props.day && this.props.day.gregorian) {
var day = this.props.day.gregorian;
return day.date.toString() + " " + Date.getMonthName(day.month) + " " + day.year.toString() + "AD";
}
},
render: function () {
return (
<div className="modal" id={this.props.modalId}>
<input className="modal-state" id="modal-checkbox" type="checkbox" />
<div className="modal-window">
<div className="modal-inner">
<label className="modal-close" htmlFor="modal-checkbox"></label>
<h3>{this.hijriDateString()}</h3>
<h4>{this.gregorianDateString()}</h4>
<MiqaatList {...this.props} />
</div>
</div>
</div>
);
}
});
| Use spread attributes to transfer properties. | Use spread attributes to transfer properties. | JSX | mit | mygulamali/mumineen_calendar_js,mygulamali/mumineen_calendar_js,mygulamali/mumineen_calendar_js,mygulamali/mumineen_calendar_js | ---
+++
@@ -20,7 +20,7 @@
<label className="modal-close" htmlFor="modal-checkbox"></label>
<h3>{this.hijriDateString()}</h3>
<h4>{this.gregorianDateString()}</h4>
- <MiqaatList day={this.props.day} miqaats={this.props.miqaats} />
+ <MiqaatList {...this.props} />
</div>
</div>
</div> |
f9747548e02769b525ea0b6ce1930698c7a7adac | app/assets/javascripts/components/trial.js.jsx | app/assets/javascripts/components/trial.js.jsx | class Trial extends React.Component {
constructor() {
super()
this._toggleDiv = this._toggleDiv.bind(this)
}
_toggleDiv() {
$(`#${this.props.trial.id}`).slideToggle()
}
render() {
const briefTitle = this.props.trial.brief_title;
const studyId = this.props.trial.id;
const recruitingStatus = this.props.trial.overall_status;
const contactName = this.props.trial.overall_contact_name;
const contactPhone = this.props.trial.overall_contact_phone;
const contactEmail = this.props.trial.overall_contact_email;
return (
<td>
<a onClick={this._toggleDiv} className="trial-buttons" >{briefTitle}</a>
<div className="trial-details" id={studyId}>
<ul>
<li>Currently {recruitingStatus}</li>
<li>
Contact info: <br/>
{contactName} <br/>
{contactPhone} {contactEmail}
</li>
<li>
<a href={`https://clinicaltrials.gov/ct2/show/${this.props.trial.nct_id}`}>More info</a>
</li>
</ul>
</div>
</td>
)
}
}
| class Trial extends React.Component {
constructor() {
super()
this._toggleDiv = this._toggleDiv.bind(this)
}
_toggleDiv() {
$(`#${this.props.trial.id}`).slideToggle()
}
checkContact() {
const contactName = this.props.trial.overall_contact_name;
const contactPhone = this.props.trial.overall_contact_phone;
const contactEmail = this.props.trial.overall_contact_email;
if (contactName !== "") {
return (
<li>
Contact info: <br/>
{contactName} <br/>
{contactPhone} {contactEmail}
</li>
)
}
}
render() {
const briefTitle = this.props.trial.brief_title;
const studyId = this.props.trial.id;
const recruitingStatus = this.props.trial.overall_status;
return (
<td>
<a onClick={this._toggleDiv} className="trial-buttons" >{briefTitle}</a>
<div className="trial-details" id={studyId}>
<ul>
<li>
Currently {recruitingStatus}
</li>
{this.checkContact()}
<li>
<a href={`https://clinicaltrials.gov/ct2/show/${this.props.trial.nct_id}`}>More info</a>
</li>
</ul>
</div>
</td>
)
}
}
| Add logic for conditionally displaying contact info | Add logic for conditionally displaying contact info
| JSX | mit | danmckeon/crconnect,danmckeon/crconnect,danmckeon/crconnect | ---
+++
@@ -8,25 +8,36 @@
$(`#${this.props.trial.id}`).slideToggle()
}
+ checkContact() {
+ const contactName = this.props.trial.overall_contact_name;
+ const contactPhone = this.props.trial.overall_contact_phone;
+ const contactEmail = this.props.trial.overall_contact_email;
+
+ if (contactName !== "") {
+ return (
+ <li>
+ Contact info: <br/>
+ {contactName} <br/>
+ {contactPhone} {contactEmail}
+ </li>
+ )
+ }
+ }
+
render() {
const briefTitle = this.props.trial.brief_title;
const studyId = this.props.trial.id;
const recruitingStatus = this.props.trial.overall_status;
- const contactName = this.props.trial.overall_contact_name;
- const contactPhone = this.props.trial.overall_contact_phone;
- const contactEmail = this.props.trial.overall_contact_email;
return (
<td>
<a onClick={this._toggleDiv} className="trial-buttons" >{briefTitle}</a>
<div className="trial-details" id={studyId}>
<ul>
- <li>Currently {recruitingStatus}</li>
<li>
- Contact info: <br/>
- {contactName} <br/>
- {contactPhone} {contactEmail}
+ Currently {recruitingStatus}
</li>
+ {this.checkContact()}
<li>
<a href={`https://clinicaltrials.gov/ct2/show/${this.props.trial.nct_id}`}>More info</a>
</li> |
34e30557bee3b4f54c8bbf5313bbd493a5c60d08 | src/components/home.jsx | src/components/home.jsx | /**
* Home
*
* Home page with list of cats. Extends CatPage
*/
import { connect } from 'react-redux';
import { push } from 'redux-router';
import CatPage from './cat-page';
const title = 'All categories';
const subtitle = 'Click on your favourite cat to see all the images';
function onCatClick(e, cat) {
return push({ pathname: '/' + cat.breed });
}
function mapStateToProps(state) {
const { items: breeds, isFetching, error } = state.cats || { breeds: [], isFetching: true};
const { browser } = state;
let cats = breeds.map(breed => Object.assign(
{}, breed.cats[0], { breed: breed.subreddit, name: breed.name }
));
return {
cats, title,
subtitle, isFetching,
error, browser
};
}
export default connect(mapStateToProps, { onCatClick })(CatPage);
| /**
* Home
*
* Home page with list of cats. Extends CatPage
*/
import { connect } from 'react-redux';
import { push } from 'redux-router';
import CatPage from './cat-page';
const title = 'All categories';
const subtitle = 'Click on your favourite cat to see all the images';
function onCatClick(e, cat) {
return push({ pathname: cat.breed });
}
function mapStateToProps(state) {
const { items: breeds, isFetching, error } = state.cats || { breeds: [], isFetching: true};
const { browser } = state;
let cats = breeds.map(breed => Object.assign(
{}, breed.cats[0], { breed: breed.subreddit, name: breed.name }
));
return {
cats, title,
subtitle, isFetching,
error, browser
};
}
export default connect(mapStateToProps, { onCatClick })(CatPage);
| Fix cat breed page href | Fix cat breed page href
| JSX | mit | mariolamacchia/react-exercise,mariolamacchia/react-exercise | ---
+++
@@ -11,7 +11,7 @@
const subtitle = 'Click on your favourite cat to see all the images';
function onCatClick(e, cat) {
- return push({ pathname: '/' + cat.breed });
+ return push({ pathname: cat.breed });
}
function mapStateToProps(state) { |
6ec570b03767e0308c4e6e7e715ac8b25b3c7a7f | client/main/main.jsx | client/main/main.jsx | require('./main.styl');
import { Router, Route, hashHistory, IndexRoute } from 'react-router'
import Book from '../book/book.jsx'
import Library from '../library/library.jsx'
import Nav from '../nav/nav.jsx'
import Profile from '../profile/profile.jsx'
import Storage from '../storage/storage.jsx'
render((
<Router history={hashHistory}>
<Route path="/" component={Nav}>
<IndexRoute component={Library}/>
<Route path="/storage" component={Storage}>
<Route path="/storage/:bookId" component={Book}/>
</Route>
<Route path="/profile" component={Profile}/>
</Route>
</Router>
), document.getElementById('app'))
| require('./main.styl');
import { render } from 'react-dom'
import { Router, Route, hashHistory, IndexRoute } from 'react-router'
import Book from '../book/book.jsx'
import Library from '../library/library.jsx'
import Nav from '../nav/nav.jsx'
import Profile from '../profile/profile.jsx'
import Storage from '../storage/storage.jsx'
render((
<Router history={hashHistory}>
<Route path="/" component={Nav}>
<IndexRoute component={Library}/>
<Route path="/storage" component={Storage}>
<Route path="/storage/:bookId" component={Book}/>
</Route>
<Route path="/profile" component={Profile}/>
</Route>
</Router>
), document.getElementById('app'))
| Revert "rm import { render } from 'react-dom'" | Revert "rm import { render } from 'react-dom'"
This reverts commit a2705afe1bc8a0e60349d5a0b3f62004b856e8ce.
| JSX | mit | bookangeles/hackathon,bookangeles/hackathon | ---
+++
@@ -1,5 +1,6 @@
require('./main.styl');
+import { render } from 'react-dom'
import { Router, Route, hashHistory, IndexRoute } from 'react-router'
import Book from '../book/book.jsx'
import Library from '../library/library.jsx' |
40240bf3005e7dd84a5751ea1f6239a3d6d6e520 | app/scripts/components/navigation.jsx | app/scripts/components/navigation.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
export default function Navigation({ loggedIn, showMenu, hideMenu, hideHome, simple }) {
return (
<nav className={simple ? "wrapper centerify" : "menu-wrap"} style={{left: (showMenu ? '0px' : '100%')}} onClick={hideMenu}>
<ul className={`unselectable menu ${simple ? '' : 'menu-full'}`} style={{opacity: (showMenu ? 1 : 0)}}>
{ hideHome ? null : <li><Link to="/">Home</Link></li> }
<li><Link to="/files">Files</Link></li>
<li><Link to="/links">Links</Link></li>
<li><Link to="/finn">FINN</Link></li>
{ loggedIn ?
<li><Link to="/logout">Logout</Link></li> :
<li><Link to="/login">Login</Link></li> }
</ul>
</nav>
);
}
Navigation.propTypes = {
showMenu: PropTypes.bool.isRequired,
hideMenu: PropTypes.func,
hideHome: PropTypes.bool,
simple: PropTypes.bool,
loggedIn: PropTypes.bool
}; | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
export default function Navigation({ loggedIn, showMenu, hideMenu, hideHome, simple }) {
return (
<nav className={simple ? "wrapper centerify" : "menu-wrap"} style={{left: (showMenu ? '0px' : '100%')}} onClick={hideMenu}>
<ul className={`unselectable menu ${simple ? '' : 'menu-full'}`} style={{opacity: (showMenu ? 1 : 0)}}>
{ hideHome ? null : <li><Link to="/">Home</Link></li> }
<li><Link to="/files">Files</Link></li>
<li><Link to="/finn">FINN</Link></li>
{ loggedIn ?
<li><Link to="/logout">Logout</Link></li> :
<li><Link to="/login">Login</Link></li> }
</ul>
</nav>
);
}
Navigation.propTypes = {
showMenu: PropTypes.bool.isRequired,
hideMenu: PropTypes.func,
hideHome: PropTypes.bool,
simple: PropTypes.bool,
loggedIn: PropTypes.bool
}; | Remove link to invalid route | Remove link to invalid route
| JSX | mit | benct/tomlin-web,benct/tomlin-web | ---
+++
@@ -8,7 +8,6 @@
<ul className={`unselectable menu ${simple ? '' : 'menu-full'}`} style={{opacity: (showMenu ? 1 : 0)}}>
{ hideHome ? null : <li><Link to="/">Home</Link></li> }
<li><Link to="/files">Files</Link></li>
- <li><Link to="/links">Links</Link></li>
<li><Link to="/finn">FINN</Link></li>
{ loggedIn ?
<li><Link to="/logout">Logout</Link></li> : |
28383c405ded46195fc4a7b6cf09a6d1c0c76009 | src/app/stores/port-store.jsx | src/app/stores/port-store.jsx | var EventEmitter = require('events').EventEmitter;
var DashDispatcher = require('../dispatcher/dash-dispatcher');
var ActionTypes = require('../constants/action-types');
var available = [];
var loading = true;
var opening = false;
var selected = '';
var PortStore = new EventEmitter();
PortStore.emitChange = function() {
this.emit('change');
}
PortStore.addChangeListener = function(listener) {
this.on('change', listener);
}
PortStore.removeChangeListener = function(listener) {
this.removeListener('change', listener);
}
PortStore.getAvailable = function() {
return available;
};
PortStore.isLoading = function() {
return loading;
};
PortStore.isOpening = function() {
return opening;
};
PortStore.getSelected = function() {
return selected;
};
DashDispatcher.register(function(action) {
switch (action.type) {
case ActionTypes.SELECT_PORT:
selected = action.selection;
opening = true;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_LIST:
loading = false;
available = action.ports;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_OPEN:
opening = false;
PortStore.emitChange();
break;
}
});
module.exports = PortStore;
| var EventEmitter = require('events').EventEmitter;
var DashDispatcher = require('../dispatcher/dash-dispatcher');
var ActionTypes = require('../constants/action-types');
var _available = [];
var _loading = true;
var _opening = false;
var _selected = '';
var PortStore = new EventEmitter();
PortStore.emitChange = function() {
this.emit('change');
}
PortStore.addChangeListener = function(listener) {
this.on('change', listener);
}
PortStore.removeChangeListener = function(listener) {
this.removeListener('change', listener);
}
PortStore.getAvailable = function() {
return _available;
};
PortStore.isLoading = function() {
return _loading;
};
PortStore.isOpening = function() {
return _opening;
};
PortStore.getSelected = function() {
return _selected;
};
DashDispatcher.register(function(action) {
switch (action.type) {
case ActionTypes.SELECT_PORT:
_selected = action.selection;
_opening = true;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_LIST:
_loading = false;
_available = action.ports;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_OPEN:
_opening = false;
PortStore.emitChange();
break;
}
});
module.exports = PortStore;
| Add _ tails to special store variables | Add _ tails to special store variables
| JSX | mit | ErnWong/pigeon-dash,ErnWong/pigeon-dash | ---
+++
@@ -2,10 +2,10 @@
var DashDispatcher = require('../dispatcher/dash-dispatcher');
var ActionTypes = require('../constants/action-types');
-var available = [];
-var loading = true;
-var opening = false;
-var selected = '';
+var _available = [];
+var _loading = true;
+var _opening = false;
+var _selected = '';
var PortStore = new EventEmitter();
@@ -19,32 +19,32 @@
this.removeListener('change', listener);
}
PortStore.getAvailable = function() {
- return available;
+ return _available;
};
PortStore.isLoading = function() {
- return loading;
+ return _loading;
};
PortStore.isOpening = function() {
- return opening;
+ return _opening;
};
PortStore.getSelected = function() {
- return selected;
+ return _selected;
};
DashDispatcher.register(function(action) {
switch (action.type) {
case ActionTypes.SELECT_PORT:
- selected = action.selection;
- opening = true;
+ _selected = action.selection;
+ _opening = true;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_LIST:
- loading = false;
- available = action.ports;
+ _loading = false;
+ _available = action.ports;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_OPEN:
- opening = false;
+ _opening = false;
PortStore.emitChange();
break;
} |
4d7d0e495020a43e57458de18ff150bbdcc1d6a3 | src/mb/routes.jsx | src/mb/routes.jsx | import React from 'react';
import { IndexRoute, Route } from 'react-router';
import App from './containers/App';
import HomePage from './containers/HomePage';
import MoviePage from './containers/MoviePage';
export function configRoutes() {
return (
<Route path="/" component={App}>
<IndexRoute component={HomePage} />
<Route path="/:movieId" component={MoviePage} />
</Route>
);
}
| import React from 'react';
import { IndexRoute, Route } from 'react-router';
import App from './containers/App';
import HomePage from './containers/HomePage';
import MoviePage from './containers/MoviePage';
import SearchPage from './containers/SearchPage';
export function configRoutes() {
return (
<Route path="/" component={App}>
<IndexRoute component={HomePage} />
<Route path="/search" component={SearchPage} />
<Route path="/:movieId" component={MoviePage} />
</Route>
);
}
| Add search route in routers.js | Add search route in routers.js
| JSX | mit | NJU-SAP/movie-board,NJU-SAP/movie-board | ---
+++
@@ -4,11 +4,13 @@
import App from './containers/App';
import HomePage from './containers/HomePage';
import MoviePage from './containers/MoviePage';
+import SearchPage from './containers/SearchPage';
export function configRoutes() {
return (
<Route path="/" component={App}>
<IndexRoute component={HomePage} />
+ <Route path="/search" component={SearchPage} />
<Route path="/:movieId" component={MoviePage} />
</Route>
); |
0eccb2a2114ba27d7fc9f484df9286743c52848f | src/components/Sidebar.jsx | src/components/Sidebar.jsx | import React, {PropTypes} from "react";
import DatePicker from "react-date-picker";
import Moment from "moment";
import Fluxxor from "fluxxor";
const FluxMixin = Fluxxor.FluxMixin(React);
const Sidebar = React.createClass({
mixins: [FluxMixin],
/*getInitialState() {
return {date: this.props.date};
},*/
handleDateChange(s, m) {
const flux = this.getFlux();
const date = m.toDate();
//this.setState({date: m});
flux.actions.search.changeDate(date);
flux.actions.search.changePaginate(0, this.props.paginate.limit);
flux.actions.history.load(date, this.props.query);
},
render() {
return (
<div className="sidebar">
<div className="datepicker">
<DatePicker
onChange={this.handleDateChange}
date={this.props.date}
maxDate={Moment()}
monthFormat="MMM" />
</div>
</div>
);
}
});
export default Sidebar; | import React, {PropTypes} from "react";
import DatePicker from "react-date-picker";
import Moment from "moment";
import Fluxxor from "fluxxor";
const FluxMixin = Fluxxor.FluxMixin(React);
const Sidebar = React.createClass({
mixins: [FluxMixin],
/*getInitialState() {
return {date: this.props.date};
},*/
handleDateChange(s, m) {
const flux = this.getFlux();
let date = m.toDate();
//this.setState({date: m});
if (m.isSame(this.props.date, "day")) {
date = 0;
}
flux.actions.search.changeDate(date);
flux.actions.search.changePaginate(0, this.props.paginate.limit);
flux.actions.history.load(date, this.props.query);
},
render() {
return (
<div className="sidebar">
<div className="datepicker">
<DatePicker
onChange={this.handleDateChange}
date={this.props.date}
maxDate={Moment()}
monthFormat="MMM" />
</div>
</div>
);
}
});
export default Sidebar; | Add the ability to show all history by unsetting the date | Add the ability to show all history by unsetting the date
It is fired by clicking on the same date as the current date.
It is basically toggling the range filter.
| JSX | mit | MrSaints/historyx,MrSaints/historyx | ---
+++
@@ -14,8 +14,11 @@
handleDateChange(s, m) {
const flux = this.getFlux();
- const date = m.toDate();
+ let date = m.toDate();
//this.setState({date: m});
+ if (m.isSame(this.props.date, "day")) {
+ date = 0;
+ }
flux.actions.search.changeDate(date);
flux.actions.search.changePaginate(0, this.props.paginate.limit);
flux.actions.history.load(date, this.props.query); |
677f728e85a0ad5487aa42403becaa4340685c80 | src/client/containers/ThreadPanel.jsx | src/client/containers/ThreadPanel.jsx | import React, { Component } from "react";
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import Thread from "../components/Thread";
// Actions
import { closeThread } from '../actions/ThreadActions';
class ThreadPanel extends Component {
render() {
const { closeThread, status, thread } = this.props;
return (
<div className="page page-thread">
<Thread
closeThread={closeThread}
thread={thread} isActive={thread.isActive}
isFetching={thread.isFetching} threadID={status.threadID}
/>
</div>
)
}
}
function mapStateToProps({ status, thread }) {
return {
status,
thread
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators({
closeThread
}, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(ThreadPanel)
| import React, { Component } from "react";
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import Thread from "../components/Thread";
import ThreadControls from "../components/ThreadControls";
// Actions
import { closeThread } from '../actions/ThreadActions';
class ThreadPanel extends Component {
render() {
const { closeThread, status, thread } = this.props;
return (
<div className="page page-thread">
<Thread
closeThread={closeThread}
thread={thread} isActive={thread.isActive}
isFetching={thread.isFetching} threadID={status.threadID}
/>
<ThreadControls
closeThread={closeThread}
thread={thread} status={status}
/>
</div>
)
}
}
function mapStateToProps({ status, thread }) {
return {
status,
thread
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators({
closeThread
}, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(ThreadPanel)
| Add initial thread controls to thread container | Add initial thread controls to thread container
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -3,6 +3,7 @@
import { connect } from 'react-redux';
import Thread from "../components/Thread";
+import ThreadControls from "../components/ThreadControls";
// Actions
import { closeThread } from '../actions/ThreadActions';
@@ -18,6 +19,11 @@
thread={thread} isActive={thread.isActive}
isFetching={thread.isFetching} threadID={status.threadID}
+ />
+ <ThreadControls
+ closeThread={closeThread}
+
+ thread={thread} status={status}
/>
</div>
) |
0742f02e92ff2f29c0b956288a5baed103e7c980 | src/client/components/ThreadPost/ThreadPost.jsx | src/client/components/ThreadPost/ThreadPost.jsx | import React from 'react';
import {
createMediaIfExists
} from './Media'
export default function ({post, children}) {
const { id, title, date, imgsrc, comment, ext } = post
const SRC = imgsrc
const ID = 'post-media-' + id
return (
<div id={"p"+id} className='thread-post'>
<div className='thread-post-info'>
{() => {if (title) return <span className='thread-post-title'>{title}</span>}}
{children}
<span className='thread-post-number'>No.{id}</span>
<span className='thread-post-backlink'></span>
<span className='mdi mdi-dots-vertical thread-post-options'></span>
</div>
{createMediaIfExists(ID, SRC, ext)}
<blockquote dangerouslySetInnerHTML={{__html: comment}}/>
</div>
)
}
| import React from 'react';
import uuid from 'uuid'
import {
createMediaIfExists
} from './Media'
export default function ({post, children}) {
const { id, title, date, imgsrc, comment, ext, references } = post
const SRC = imgsrc
const ID = 'post-media-' + id
return (
<div id={"p"+id} className='thread-post'>
<div className='thread-post-info'>
{() => {if (title) return <span className='thread-post-title'>{title}</span>}}
{children}
<span className='thread-post-number'>No.{id}</span>
<span className='thread-post-backlink'>{renderRefs(references)}</span>
<span className='mdi mdi-dots-vertical thread-post-options'></span>
</div>
{createMediaIfExists(ID, SRC, ext)}
<blockquote dangerouslySetInnerHTML={{__html: comment}}/>
</div>
)
}
function renderRefs(refs) {
if (refs)
return refs.map( ref =>
<a
href={`#p${ref}`}
className="quotelink refered"
key={uuid.v4()}
>{`>>${ref}`}</a>);
} | Add backrefs to thread posts; check who refered | Add backrefs to thread posts; check who refered
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -1,10 +1,11 @@
import React from 'react';
+import uuid from 'uuid'
import {
createMediaIfExists
} from './Media'
export default function ({post, children}) {
- const { id, title, date, imgsrc, comment, ext } = post
+ const { id, title, date, imgsrc, comment, ext, references } = post
const SRC = imgsrc
const ID = 'post-media-' + id
@@ -15,7 +16,7 @@
{() => {if (title) return <span className='thread-post-title'>{title}</span>}}
{children}
<span className='thread-post-number'>No.{id}</span>
- <span className='thread-post-backlink'></span>
+ <span className='thread-post-backlink'>{renderRefs(references)}</span>
<span className='mdi mdi-dots-vertical thread-post-options'></span>
</div>
{createMediaIfExists(ID, SRC, ext)}
@@ -25,3 +26,13 @@
}
+function renderRefs(refs) {
+ if (refs)
+ return refs.map( ref =>
+ <a
+ href={`#p${ref}`}
+ className="quotelink refered"
+ key={uuid.v4()}
+ >{`>>${ref}`}</a>);
+
+} |
89f07c130823feae97e725a66f1563e3f3456ded | client/components/index.jsx | client/components/index.jsx | var React = require('react');
var ReactDOM = require('react-dom');
var sharedb = require('sharedb/lib/client');
var App = require('./App.jsx');
var Init = require('./initdoc');
// Open WebSocket connection to ShareDB server
connection = new sharedb.Connection(new WebSocket('ws://' + window.location.host));
// Expose to index.html
window.renderApp = function () {
//Init();
ReactDOM.render(<App />, document.querySelector('#app'));
};
| var React = require('react');
var ReactDOM = require('react-dom');
var sharedb = require('sharedb/lib/client');
var App = require('./App.jsx');
var Init = require('./initdoc');
// Open WebSocket connection to ShareDB server
connection = new sharedb.Connection(new WebSocket('wss://' + window.location.host));
// Expose to index.html
window.renderApp = function () {
//Init();
ReactDOM.render(<App />, document.querySelector('#app'));
};
| Change to a secure WS connection | Change to a secure WS connection
| JSX | mit | venugos/sharegeom,venugos/sharegeom | ---
+++
@@ -6,7 +6,7 @@
// Open WebSocket connection to ShareDB server
-connection = new sharedb.Connection(new WebSocket('ws://' + window.location.host));
+connection = new sharedb.Connection(new WebSocket('wss://' + window.location.host));
// Expose to index.html
window.renderApp = function () { |
abb41c4c11228513a4262c774468ea2eebe717f1 | src/field/password/password_pane.jsx | src/field/password/password_pane.jsx | import React from 'react';
import PasswordInput from '../../ui/input/password_input';
import * as c from '../index';
import { swap, updateEntity } from '../../store/index';
import * as l from '../../lock/index';
import { setPassword } from '../password';
export default class PasswordPane extends React.Component {
handleChange(e) {
const { lock, onChange, policy } = this.props;
if (onChange) {
// TODO: are we using this?
onChange(e)
} else {
swap(updateEntity, "lock", l.id(lock), setPassword, e.target.value, policy);
}
}
render() {
const { lock, placeholder, policy } = this.props;
return (
<PasswordInput
value={c.password(lock)}
isValid={!c.isFieldVisiblyInvalid(lock, "password")}
onChange={::this.handleChange}
placeholder={placeholder}
disabled={l.submitting(lock)}
policy={policy}
/>
);
}
}
PasswordPane.propTypes = {
lock: React.PropTypes.object.isRequired,
onChange: React.PropTypes.func,
placeholder: React.PropTypes.string.isRequired,
policy: React.PropTypes.string
};
| import React from 'react';
import PasswordInput from '../../ui/input/password_input';
import * as c from '../index';
import { swap, updateEntity } from '../../store/index';
import * as l from '../../lock/index';
import { setPassword } from '../password';
export default class PasswordPane extends React.Component {
handleChange(e) {
const { lock, policy } = this.props;
swap(updateEntity, "lock", l.id(lock), setPassword, e.target.value, policy);
}
render() {
const { lock, placeholder, policy } = this.props;
return (
<PasswordInput
value={c.password(lock)}
isValid={!c.isFieldVisiblyInvalid(lock, "password")}
onChange={::this.handleChange}
placeholder={placeholder}
disabled={l.submitting(lock)}
policy={policy}
/>
);
}
}
PasswordPane.propTypes = {
lock: React.PropTypes.object.isRequired,
onChange: React.PropTypes.func,
placeholder: React.PropTypes.string.isRequired,
policy: React.PropTypes.string
};
| Remove dead code from PasswordPane | Remove dead code from PasswordPane
| JSX | mit | mike-casas/lock,mike-casas/lock,mike-casas/lock | ---
+++
@@ -8,13 +8,8 @@
export default class PasswordPane extends React.Component {
handleChange(e) {
- const { lock, onChange, policy } = this.props;
- if (onChange) {
- // TODO: are we using this?
- onChange(e)
- } else {
- swap(updateEntity, "lock", l.id(lock), setPassword, e.target.value, policy);
- }
+ const { lock, policy } = this.props;
+ swap(updateEntity, "lock", l.id(lock), setPassword, e.target.value, policy);
}
render() { |
bb99df4b9247b274e6765bd3ad277039cfaf28ad | src/components/InstructionsEditor.jsx | src/components/InstructionsEditor.jsx | import React from 'react';
import PropTypes from 'prop-types';
import {t} from 'i18next';
import bindAll from 'lodash/bindAll';
export default class InstructionsEditor extends React.Component {
constructor() {
super();
bindAll(this, '_handleCancelEditing', '_handleSaveChanges', '_ref');
}
_handleCancelEditing() {
this.props.onCancelEditing();
}
_handleSaveChanges() {
const newValue = this.editor.value.trim();
this.props.onSaveChanges(this.props.projectKey, newValue);
}
_ref(editorElement) {
this.editor = editorElement;
}
render() {
return (
<div className="instructions-editor">
<div className="instructions-editor__menu">
<button
className="instructions-editor__menu-button"
onClick={this._handleSaveChanges}
>
{t('workspace.components.instructions.save')}
</button>
<button
className="instructions-editor__menu-button"
onClick={this._handleCancelEditing}
>
{t('workspace.components.instructions.cancel')}
</button>
</div>
<div className="instructions-editor__input">
<textarea
defaultValue={this.props.instructions}
ref={this._ref}
/>
</div>
<div className="instructions-editor__footer">
Styling with Markdown is supported
</div>
</div>
);
}
}
InstructionsEditor.propTypes = {
instructions: PropTypes.string.isRequired,
projectKey: PropTypes.string.isRequired,
onCancelEditing: PropTypes.func.isRequired,
onSaveChanges: PropTypes.func.isRequired,
};
| import React from 'react';
import PropTypes from 'prop-types';
import {t} from 'i18next';
import bindAll from 'lodash/bindAll';
export default class InstructionsEditor extends React.Component {
constructor() {
super();
bindAll(this, '_handleCancelEditing', '_handleSaveChanges', '_ref');
}
_handleCancelEditing() {
this.props.onCancelEditing();
}
_handleSaveChanges() {
const newValue = this._editor.value.trim();
this.props.onSaveChanges(this.props.projectKey, newValue);
}
_ref(editorElement) {
this._editor = editorElement;
}
render() {
return (
<div className="instructions-editor">
<div className="instructions-editor__menu">
<button
className="instructions-editor__menu-button"
onClick={this._handleSaveChanges}
>
{t('workspace.components.instructions.save')}
</button>
<button
className="instructions-editor__menu-button"
onClick={this._handleCancelEditing}
>
{t('workspace.components.instructions.cancel')}
</button>
</div>
<div className="instructions-editor__input">
<textarea
defaultValue={this.props.instructions}
ref={this._ref}
/>
</div>
<div className="instructions-editor__footer">
Styling with Markdown is supported
</div>
</div>
);
}
}
InstructionsEditor.propTypes = {
instructions: PropTypes.string.isRequired,
projectKey: PropTypes.string.isRequired,
onCancelEditing: PropTypes.func.isRequired,
onSaveChanges: PropTypes.func.isRequired,
};
| Add _ prefix to this.editor to signify privateness | Add _ prefix to this.editor to signify privateness
| JSX | mit | jwang1919/popcode,jwang1919/popcode,outoftime/learnpad,popcodeorg/popcode,popcodeorg/popcode,popcodeorg/popcode,outoftime/learnpad,jwang1919/popcode,jwang1919/popcode,popcodeorg/popcode | ---
+++
@@ -14,12 +14,12 @@
}
_handleSaveChanges() {
- const newValue = this.editor.value.trim();
+ const newValue = this._editor.value.trim();
this.props.onSaveChanges(this.props.projectKey, newValue);
}
_ref(editorElement) {
- this.editor = editorElement;
+ this._editor = editorElement;
}
render() { |
cdb140b96832497bcf526614bbadcd1988fb2182 | docs/themes/theme-custom/theme/Prototyper/download-button.jsx | docs/themes/theme-custom/theme/Prototyper/download-button.jsx | import React from 'react';
import RasaButton from '../RasaButton';
import PrototyperContext from './context';
const DownloadButton = (props) => {
const prototyperContext = React.useContext(PrototyperContext);
return (
<RasaButton
onClick={prototyperContext.downloadProject}
disabled={!prototyperContext.hasTrained || !!prototyperContext.isTraining}
{...props}
>
Download project
</RasaButton>
);
};
export default DownloadButton;
| import React from 'react';
import RasaButton from '../RasaButton';
import PrototyperContext from './context';
const DownloadButton = (props) => {
const prototyperContext = React.useContext(PrototyperContext);
return (
<RasaButton
onClick={prototyperContext.downloadProject}
disabled={prototyperContext.chatState !== "ready" && prototyperContext.chatState !== "needs_to_be_retrained"}
{...props}
>
Download project
</RasaButton>
);
};
export default DownloadButton;
| Fix download button in docs | Fix download button in docs
| JSX | apache-2.0 | RasaHQ/rasa_nlu,RasaHQ/rasa_nlu,RasaHQ/rasa_nlu | ---
+++
@@ -9,7 +9,7 @@
return (
<RasaButton
onClick={prototyperContext.downloadProject}
- disabled={!prototyperContext.hasTrained || !!prototyperContext.isTraining}
+ disabled={prototyperContext.chatState !== "ready" && prototyperContext.chatState !== "needs_to_be_retrained"}
{...props}
>
Download project |
c4976de16496c7b7b3f62cb91cead8e48f291ae7 | src/index.jsx | src/index.jsx | import React from 'react';
import { render } from 'react-dom';
import { Route, Router, IndexRoute, hashHistory } from 'react-router';
// Material UI.
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import muiThemeConfig from './theme';
// Root Component.
import App from './app.jsx';
// Child Components
import Weather from './components/Weather';
import './index.scss';
injectTapEventPlugin();
const muiTheme = getMuiTheme(muiThemeConfig);
render(
<MuiThemeProvider muiTheme={ muiTheme }>
<Router history={ hashHistory }>
<Route path="/" component={ App }>
<IndexRoute component={ Weather } />
</Route>
</Router>
</MuiThemeProvider>,
document.querySelector("#app")
);
| import React from 'react';
import { render } from 'react-dom';
import { Route, Router, IndexRoute, hashHistory } from 'react-router';
// Material UI.
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import muiThemeConfig from './theme';
// Root Component.
import App from './app.jsx';
// Child Components
import Weather from './components/Weather';
import Examples from './components/Examples';
import About from './components/About';
import './index.scss';
injectTapEventPlugin();
const muiTheme = getMuiTheme(muiThemeConfig);
render(
<MuiThemeProvider muiTheme={ muiTheme }>
<Router history={ hashHistory }>
<Route path="/" component={ App }>
<IndexRoute component={ Weather } />
<Route path="/about" component={ About } />
<Route path="/examples" component={ Examples } />
</Route>
</Router>
</MuiThemeProvider>,
document.querySelector("#app")
);
| Add about and examples routes | Add about and examples routes
| JSX | mit | juanhenriquez/react-weather-app,juanhenriquez/react-weather-app | ---
+++
@@ -13,6 +13,8 @@
// Child Components
import Weather from './components/Weather';
+import Examples from './components/Examples';
+import About from './components/About';
import './index.scss';
@@ -25,6 +27,8 @@
<Router history={ hashHistory }>
<Route path="/" component={ App }>
<IndexRoute component={ Weather } />
+ <Route path="/about" component={ About } />
+ <Route path="/examples" component={ Examples } />
</Route>
</Router>
</MuiThemeProvider>, |
7b00693693428197b1a5fc78ccee4f09af420fe4 | lib/client/media/Media.jsx | lib/client/media/Media.jsx | import React from 'react';
import { connect } from 'react-redux';
import { fetchMedia } from './MediaActions';
import Card from '../components/Card';
class Media extends React.Component {
componentDidMount() {
this.props.dispatch(fetchMedia(this.props.params.mediaId));
}
render() {
if (this.props.isFetching === true) {
return <div>Loading...</div>;
} else if (!this.props.data) {
return null;
}
return <Card data={this.props.data} mode="large" />;
}
}
Media.propTypes = {
dispatch: React.PropTypes.func,
params: React.PropTypes.object,
data: React.PropTypes.object,
isFetching: React.PropTypes.bool,
};
export default connect(({ media }) => media)(Media);
| import React from 'react';
import { connect } from 'react-redux';
import { goBack } from 'react-router-redux';
import { fetchMedia } from './MediaActions';
import Card from '../components/Card';
class Media extends React.Component {
constructor(props) {
super(props);
this.goBack = this.goBack.bind(this);
}
componentDidMount() {
this.props.dispatch(fetchMedia(this.props.params.mediaId));
}
goBack(e) {
e.preventDefault();
this.props.dispatch(goBack());
}
render() {
if (this.props.isFetching === true) {
return <div>Loading...</div>;
} else if (!this.props.data) {
return null;
}
let headerCss;
let headerContent;
if (this.props.error) {
headerCss = 'bg-danger';
headerContent = `Error while retrieving: ${this.props.error}`;
} else if (!this.props.data) {
headerCss = 'bg-warning';
headerContent = 'Nothing found.';
} else {
headerCss = 'dn';
}
return (
<div>
<div className="mb15">
<a href="#" onClick={this.goBack}>< Back</a>
</div>
<div className={`p15 ${headerCss}`}>
{headerContent}
</div>
<Card data={this.props.data} mode="large" />
</div>
);
}
}
Media.propTypes = {
dispatch: React.PropTypes.func,
error: React.PropTypes.string,
params: React.PropTypes.object,
data: React.PropTypes.object,
isFetching: React.PropTypes.bool,
};
export default connect(({ media }) => media)(Media);
| Add back button on medias/:id screen | Add back button on medias/:id screen
| JSX | mit | dbrugne/ftp-nanny,dbrugne/ftp-nanny | ---
+++
@@ -1,11 +1,20 @@
import React from 'react';
import { connect } from 'react-redux';
+import { goBack } from 'react-router-redux';
import { fetchMedia } from './MediaActions';
import Card from '../components/Card';
class Media extends React.Component {
+ constructor(props) {
+ super(props);
+ this.goBack = this.goBack.bind(this);
+ }
componentDidMount() {
this.props.dispatch(fetchMedia(this.props.params.mediaId));
+ }
+ goBack(e) {
+ e.preventDefault();
+ this.props.dispatch(goBack());
}
render() {
if (this.props.isFetching === true) {
@@ -14,12 +23,35 @@
return null;
}
- return <Card data={this.props.data} mode="large" />;
+ let headerCss;
+ let headerContent;
+ if (this.props.error) {
+ headerCss = 'bg-danger';
+ headerContent = `Error while retrieving: ${this.props.error}`;
+ } else if (!this.props.data) {
+ headerCss = 'bg-warning';
+ headerContent = 'Nothing found.';
+ } else {
+ headerCss = 'dn';
+ }
+
+ return (
+ <div>
+ <div className="mb15">
+ <a href="#" onClick={this.goBack}>< Back</a>
+ </div>
+ <div className={`p15 ${headerCss}`}>
+ {headerContent}
+ </div>
+ <Card data={this.props.data} mode="large" />
+ </div>
+ );
}
}
Media.propTypes = {
dispatch: React.PropTypes.func,
+ error: React.PropTypes.string,
params: React.PropTypes.object,
data: React.PropTypes.object,
isFetching: React.PropTypes.bool, |
3c947d1358dedddda6068c27295e8c0e803712ae | BaragonUI/app/components/status/StatusPage.jsx | BaragonUI/app/components/status/StatusPage.jsx | import React from 'react';
import { connect } from 'react-redux';
import { browserHistory } from 'react-router';
import rootComponent from '../../rootComponent';
import { refresh } from '../../actions/ui/status';
import WorkerStatus from './WorkerStatus';
import PendingRequests from './PendingRequests';
import RequestSearch from './RequestSearch';
const navigateToRequest = (requestId) => {
browserHistory.push(`/requests/${requestId}`);
};
const StatusPage = ({status, workers, queuedRequests}) => {
return (
<div>
<div className="row">
<WorkerStatus
workerLag={status.workerLagMs}
elbWorkerLag={status.elbWorkerLagMs}
zookeeperState={status.zookeeperState}
workers={workers}
/>
<PendingRequests
queuedRequests={queuedRequests}
/>
</div>
<div className="row">
<RequestSearch
onSearch={navigateToRequest}
/>
</div>
</div>
);
};
StatusPage.propTypes = {
status: React.PropTypes.object,
workers: React.PropTypes.array,
queuedRequests: React.PropTypes.array
};
export default connect((state) => ({
status: state.api.status.data,
workers: state.api.workers.data,
queuedRequests: state.api.queuedRequests.data
}))(rootComponent(StatusPage, refresh));
| import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import rootComponent from '../../rootComponent';
import { refresh } from '../../actions/ui/status';
import WorkerStatus from './WorkerStatus';
import PendingRequests from './PendingRequests';
import RequestSearch from './RequestSearch';
const navigateToRequest = (router) => (requestId) => {
router.push(`/requests/${requestId}`);
};
const StatusPage = ({status, workers, queuedRequests, router}) => {
return (
<div>
<div className="row">
<WorkerStatus
workerLag={status.workerLagMs}
elbWorkerLag={status.elbWorkerLagMs}
zookeeperState={status.zookeeperState}
workers={workers}
/>
<PendingRequests
queuedRequests={queuedRequests}
/>
</div>
<div className="row">
<RequestSearch
onSearch={navigateToRequest(router)}
/>
</div>
</div>
);
};
StatusPage.propTypes = {
status: React.PropTypes.object,
workers: React.PropTypes.array,
queuedRequests: React.PropTypes.array,
router: React.PropTypes.object,
};
export default withRouter(connect((state, ownProps) => ({
status: state.api.status.data,
workers: state.api.workers.data,
queuedRequests: state.api.queuedRequests.data,
router: ownProps.router,
}))(rootComponent(StatusPage, refresh)));
| Use react-router rather than browserHistory | Use react-router rather than browserHistory
Move to using react-router rather than directly modifying the
`browserHistory` object. This way is just a little bit neater.
| JSX | apache-2.0 | HubSpot/Baragon,HubSpot/Baragon,HubSpot/Baragon | ---
+++
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
-import { browserHistory } from 'react-router';
+import { withRouter } from 'react-router';
import rootComponent from '../../rootComponent';
import { refresh } from '../../actions/ui/status';
@@ -8,11 +8,11 @@
import PendingRequests from './PendingRequests';
import RequestSearch from './RequestSearch';
-const navigateToRequest = (requestId) => {
- browserHistory.push(`/requests/${requestId}`);
+const navigateToRequest = (router) => (requestId) => {
+ router.push(`/requests/${requestId}`);
};
-const StatusPage = ({status, workers, queuedRequests}) => {
+const StatusPage = ({status, workers, queuedRequests, router}) => {
return (
<div>
<div className="row">
@@ -28,7 +28,7 @@
</div>
<div className="row">
<RequestSearch
- onSearch={navigateToRequest}
+ onSearch={navigateToRequest(router)}
/>
</div>
</div>
@@ -38,11 +38,13 @@
StatusPage.propTypes = {
status: React.PropTypes.object,
workers: React.PropTypes.array,
- queuedRequests: React.PropTypes.array
+ queuedRequests: React.PropTypes.array,
+ router: React.PropTypes.object,
};
-export default connect((state) => ({
+export default withRouter(connect((state, ownProps) => ({
status: state.api.status.data,
workers: state.api.workers.data,
- queuedRequests: state.api.queuedRequests.data
-}))(rootComponent(StatusPage, refresh));
+ queuedRequests: state.api.queuedRequests.data,
+ router: ownProps.router,
+}))(rootComponent(StatusPage, refresh))); |
7f9360c57d2df824e443c7f2e44b6a21c5d04fc2 | app/components/templates/Slidedeck.jsx | app/components/templates/Slidedeck.jsx | /* eslint one-var: 0 */
import React from 'react';
import BaseTemplate from './Base';
import Reveal from 'reveal.js';
import '../../scss/reveal.css';
import '../../scss/reveal-theme.css';
/**
* Slidedeck template
*/
export default class Slidedeck extends BaseTemplate {
getDefaultData() {
return {};
}
componentDidMount() {
Reveal.initialize({
embedded: true,
fragments: false,
slideNumber: true,
progress: false,
help: false,
});
}
render() {
const sections = [];
let itemsInSection = [];
this.props.content.forEach((c) => {
if ('preview-loader' === c.key) {
return;
}
if (c.props && '---' === c.props.chunk[0].markup) {
if (itemsInSection.length > 0) {
sections.push(itemsInSection);
itemsInSection = [];
}
} else {
itemsInSection.push(c);
}
});
sections.push(itemsInSection);
return (
<div className="reveal">
<div className="slides">
{sections.map((section, index) =>
<section key={`section-${index}`}>
{section}
</section>
)}
</div>
</div>
);
}
}
| /* eslint one-var: 0 */
import React from 'react';
import BaseTemplate from './Base';
import Reveal from 'reveal.js';
import '../../scss/reveal.css';
import '../../scss/reveal-theme.css';
/**
* Slidedeck template
*/
export default class Slidedeck extends BaseTemplate {
getDefaultData() {
return {
transition: 'zoom',
};
}
componentDidMount() {
Reveal.initialize({
embedded: true,
fragments: false,
slideNumber: true,
progress: false,
help: false,
margin: 0,
});
}
render() {
const data = this.getData();
const sections = [];
let itemsInSection = [];
this.props.content.forEach((c) => {
if ('preview-loader' === c.key) {
return;
}
if (c.props && '---' === c.props.chunk[0].markup) {
if (itemsInSection.length > 0) {
sections.push(itemsInSection);
itemsInSection = [];
}
} else {
itemsInSection.push(c);
}
});
sections.push(itemsInSection);
return (
<div className="reveal">
<div className="slides">
{sections.map((section, index) =>
<section key={`section-${index}`} data-transition={data.transition}>
{section}
</section>
)}
</div>
</div>
);
}
}
| Add transition config in YAML front matter | Add transition config in YAML front matter
| JSX | mit | PaulDebus/monod,PaulDebus/monod,TailorDev/monod,TailorDev/monod,PaulDebus/monod,TailorDev/monod | ---
+++
@@ -12,7 +12,9 @@
export default class Slidedeck extends BaseTemplate {
getDefaultData() {
- return {};
+ return {
+ transition: 'zoom',
+ };
}
componentDidMount() {
@@ -22,10 +24,13 @@
slideNumber: true,
progress: false,
help: false,
+ margin: 0,
});
}
render() {
+ const data = this.getData();
+
const sections = [];
let itemsInSection = [];
this.props.content.forEach((c) => {
@@ -48,7 +53,7 @@
<div className="reveal">
<div className="slides">
{sections.map((section, index) =>
- <section key={`section-${index}`}>
+ <section key={`section-${index}`} data-transition={data.transition}>
{section}
</section>
)} |
0dda71a1d96729abea9cdeef07f25f7f96c7b28c | client/ui/Home.jsx | client/ui/Home.jsx | import React from 'react'
import {Col, Container, Row} from 'reactstrap'
import {connect} from 'react-redux'
import Icon from 'assets/spidchain-icon'
import ShowQRCode from 'ui/ShowQRCode'
import Balance from 'ui/Balance'
const Home = ({did, wallet}) => {
return <Container fluid>
<Row className='mt-3'>
<Col md='6' className='mx-auto'>
<Icon className='w-75 d-block mx-auto mt-3' alt='SpidChain icon' />
</Col>
</Row>
<Row className='mt-3'>
<Col md='6' className='mx-auto'>
<ShowQRCode content={wallet.receivingAddress}>
<Balance />
</ShowQRCode>
</Col>
</Row>
<Row className='mt-3'>
<Col md='6' className='mx-auto'>
<ShowQRCode content={did.did} >
Show DID
</ShowQRCode>
</Col>
</Row>
</Container>
}
export default connect(s => s)(Home)
| import React from 'react'
import {Col, Container, Row} from 'reactstrap'
import {connect} from 'react-redux'
import Icon from 'assets/spidchain-icon'
import ShowQRCode from 'ui/ShowQRCode'
import Balance from 'ui/Balance'
const Home = ({did, wallet}) => {
return <Container fluid>
<Row className='mt-3'>
<Col sm='6' className='mx-auto'>
<Icon className='w-75 d-block mx-auto mt-3' alt='SpidChain icon' />
</Col>
</Row>
<Row className='mt-3'>
<Col sm='6' className='mx-auto'>
<ShowQRCode content={wallet.receivingAddress}>
<Balance />
</ShowQRCode>
</Col>
</Row>
<Row className='mt-3'>
<Col sm='6' className='mx-auto'>
<ShowQRCode content={did.did} >
Show DID
</ShowQRCode>
</Col>
</Row>
</Container>
}
export default connect(s => s)(Home)
| Change resposive transition point in the home screen | Change resposive transition point in the home screen
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -9,19 +9,19 @@
const Home = ({did, wallet}) => {
return <Container fluid>
<Row className='mt-3'>
- <Col md='6' className='mx-auto'>
+ <Col sm='6' className='mx-auto'>
<Icon className='w-75 d-block mx-auto mt-3' alt='SpidChain icon' />
</Col>
</Row>
<Row className='mt-3'>
- <Col md='6' className='mx-auto'>
+ <Col sm='6' className='mx-auto'>
<ShowQRCode content={wallet.receivingAddress}>
<Balance />
</ShowQRCode>
</Col>
</Row>
<Row className='mt-3'>
- <Col md='6' className='mx-auto'>
+ <Col sm='6' className='mx-auto'>
<ShowQRCode content={did.did} >
Show DID
</ShowQRCode> |
250283e222eaf22283fd0d37fca00f195fba19c7 | lib/steps_components/options/OptionsStep.jsx | lib/steps_components/options/OptionsStep.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Option from './Option';
import OptionElement from './OptionElement';
import Options from './Options';
import OptionsStepContainer from './OptionsStepContainer';
class OptionsStep extends Component {
onOptionClick = ({ value }) => {
const { triggerNextStep } = this.props;
triggerNextStep({ value });
};
renderOption = option => {
const { bubbleOptionStyle, step } = this.props;
const { user } = step;
const { value, label } = option;
return (
<Option key={value} className="rsc-os-option">
<OptionElement
className="rsc-os-option-element"
style={bubbleOptionStyle}
user={user}
onClick={() => this.onOptionClick({ value })}
>
{label}
</OptionElement>
</Option>
);
};
render() {
const { step } = this.props;
const { options } = step;
return (
<OptionsStepContainer className="rsc-os">
<Options className="rsc-os-options">
{Object.values(options).map(this.renderOption)}
</Options>
</OptionsStepContainer>
);
}
}
OptionsStep.propTypes = {
bubbleOptionStyle: PropTypes.objectOf(PropTypes.any).isRequired,
step: PropTypes.objectOf(PropTypes.any).isRequired,
triggerNextStep: PropTypes.func.isRequired
};
export default OptionsStep;
| import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Option from './Option';
import OptionElement from './OptionElement';
import Options from './Options';
import OptionsStepContainer from './OptionsStepContainer';
class OptionsStep extends Component {
onOptionClick = ({ value }) => {
const { triggerNextStep } = this.props;
triggerNextStep({ value });
};
renderOption = option => {
const { bubbleOptionStyle, step } = this.props;
const { user } = step;
const { value, label } = option;
return (
<Option key={value} className="rsc-os-option">
<OptionElement
className="rsc-os-option-element"
style={bubbleOptionStyle}
user={user}
onClick={() => this.onOptionClick({ value })}
>
{label}
</OptionElement>
</Option>
);
};
render() {
const { step } = this.props;
const { options } = step;
return (
<OptionsStepContainer className="rsc-os">
<Options className="rsc-os-options">
{Object.keys(options).map(key => {
return options[key];
}).map(this.renderOption)}
</Options>
</OptionsStepContainer>
);
}
}
OptionsStep.propTypes = {
bubbleOptionStyle: PropTypes.objectOf(PropTypes.any).isRequired,
step: PropTypes.objectOf(PropTypes.any).isRequired,
triggerNextStep: PropTypes.func.isRequired
};
export default OptionsStep;
| Use object keys instead of values to support more browsers. | Use object keys instead of values to support more browsers.
| JSX | mit | LucasBassetti/react-simple-chatbot,LucasBassetti/react-simple-chatbot | ---
+++
@@ -38,7 +38,9 @@
return (
<OptionsStepContainer className="rsc-os">
<Options className="rsc-os-options">
- {Object.values(options).map(this.renderOption)}
+ {Object.keys(options).map(key => {
+ return options[key];
+ }).map(this.renderOption)}
</Options>
</OptionsStepContainer>
); |
0294560193d8052d5a8f9e11d547fdea7a41ec9a | web/static/js/components/high_contrast_button.jsx | web/static/js/components/high_contrast_button.jsx | import React from "react"
import PropTypes from "prop-types"
import cx from "classnames"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/high_contrast_button.css"
const HighContrastButton = props => {
const { actions, userOptions, className } = props
const wrapperClasses = cx(className, styles.wrapper)
return (
<div className={wrapperClasses}>
<button className="ui basic compact icon button" type="button" onClick={actions.toggleHighContrastOn}>
<div className="ui toggle checkbox">
<input type="checkbox" name="public" checked={userOptions.highContrastOn} />
<label><i className="ui low vision icon" /> High Contrast</label>
</div>
</button>
</div>
)
}
HighContrastButton.propTypes = {
actions: PropTypes.object.isRequired,
userOptions: AppPropTypes.userOptions.isRequired,
className: PropTypes.string,
}
HighContrastButton.defaultProps = {
className: "",
}
export default HighContrastButton
| import React from "react"
import PropTypes from "prop-types"
import cx from "classnames"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/high_contrast_button.css"
const HighContrastButton = props => {
const { actions, userOptions, className } = props
const wrapperClasses = cx(className, styles.wrapper)
return (
<div className={wrapperClasses}>
<button className="ui basic compact icon button" type="button" onClick={actions.toggleHighContrastOn}>
<div className="ui toggle checkbox">
<input type="checkbox" name="public" checked={userOptions.highContrastOn} readOnly />
<label><i className="ui low vision icon" /> High Contrast</label>
</div>
</button>
</div>
)
}
HighContrastButton.propTypes = {
actions: PropTypes.object.isRequired,
userOptions: AppPropTypes.userOptions.isRequired,
className: PropTypes.string,
}
HighContrastButton.defaultProps = {
className: "",
}
export default HighContrastButton
| Add readOnly attr to controlled checkbox in HighContastButton | Add readOnly attr to controlled checkbox in HighContastButton
| JSX | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | ---
+++
@@ -13,7 +13,7 @@
<div className={wrapperClasses}>
<button className="ui basic compact icon button" type="button" onClick={actions.toggleHighContrastOn}>
<div className="ui toggle checkbox">
- <input type="checkbox" name="public" checked={userOptions.highContrastOn} />
+ <input type="checkbox" name="public" checked={userOptions.highContrastOn} readOnly />
<label><i className="ui low vision icon" /> High Contrast</label>
</div>
</button> |
6980a834e2659c2cabb5d236f4384bed785e7ec5 | src/routes/ProjectList.jsx | src/routes/ProjectList.jsx | import React from 'react';
import { Helmet } from 'react-helmet';
import projects from 'projects';
import ProjectTile from 'components/ProjectTile';
import bulma from 'bulma.scss';
import style from './ProjectList.scss';
const ProjectList = () => {
const tiles = projects.map(project =>
<ProjectTile slide='x' className={style.tile} key={project.slug} project={project} />
);
return (
<React.Fragment>
<Helmet>
<title>Projects — David Minnerly</title>
</Helmet>
<div className={bulma.section}>
<div className={bulma.container}>
{tiles}
</div>
</div>
</React.Fragment>
);
};
export default ProjectList;
| import React from 'react';
import { Helmet } from 'react-helmet';
import projects from 'projects';
import ProjectTile from 'components/ProjectTile';
import bulma from 'bulma.scss';
import style from './ProjectList.scss';
const ProjectList = () => {
const tiles = projects.map(project =>
<ProjectTile slide='x' className={style.tile} key={project.slug} project={project} />
);
return (
<React.Fragment>
<Helmet>
<title>Projects — David Minnerly</title>
</Helmet>
<div className={bulma.section}>
<div className={bulma.container}>
<h1>Projects</h1>
{tiles}
</div>
</div>
</React.Fragment>
);
};
export default ProjectList;
| Add title to project list | Add title to project list
| JSX | mit | VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website | ---
+++
@@ -18,6 +18,8 @@
<div className={bulma.section}>
<div className={bulma.container}>
+ <h1>Projects</h1>
+
{tiles}
</div>
</div> |
7e4d6339752acbb11d99bcc34781c38e35e9a8d6 | pages/cv/lastUpdate.jsx | pages/cv/lastUpdate.jsx | import React, {Fragment} from 'react'
import {format} from 'date-fns'
import {Section, P, Button} from '../../components'
const printHandler = ev => {
ev.preventDefault()
window && window.print()
}
const LastUpdate = ({timestamp}) => {
const DATE_FORMAT = 'LLLL io, YYYY'
const date = format(new Date(timestamp), DATE_FORMAT)
return (
<Section
customCss={{
color: '#bdc3c7',
margin: '1.5rem 0',
display: 'flex',
justifyContent: 'space-between'
}}
>
<P customCss={{margin: 0, '@media print': {marginTop: '.75rem'}}}>
Last update: {date}
</P>
<Button
name="print"
onClick={printHandler}
customCss={{
background: 'none',
border: 'none',
cursor: 'pointer',
padding: 0,
fontSize: 'inherit',
color: 'inherit',
textDecoration: 'underline',
'@media print': {
display: 'none'
}
}}
>
Print (to pdf)
</Button>
</Section>
)
}
export default LastUpdate
| import React, {Fragment} from 'react'
import {format} from 'date-fns'
import {Section, P, Button} from '../../components'
const printHandler = ev => {
ev.preventDefault()
window && window.print()
}
const LastUpdate = ({timestamp}) => {
const DATE_FORMAT = 'LLLL do, YYYY'
const date = format(new Date(timestamp), DATE_FORMAT)
return (
<Section
customCss={{
color: '#bdc3c7',
margin: '1.5rem 0',
display: 'flex',
justifyContent: 'space-between'
}}
>
<P customCss={{margin: 0, '@media print': {marginTop: '.75rem'}}}>
Last update: {date}
</P>
<Button
name="print"
onClick={printHandler}
customCss={{
background: 'none',
border: 'none',
cursor: 'pointer',
padding: 0,
fontSize: 'inherit',
color: 'inherit',
textDecoration: 'underline',
'@media print': {
display: 'none'
}
}}
>
Print (to pdf)
</Button>
</Section>
)
}
export default LastUpdate
| Fix last update format error. | Fix last update format error.
| JSX | mit | andreiconstantinescu/constantinescu.io | ---
+++
@@ -8,7 +8,7 @@
}
const LastUpdate = ({timestamp}) => {
- const DATE_FORMAT = 'LLLL io, YYYY'
+ const DATE_FORMAT = 'LLLL do, YYYY'
const date = format(new Date(timestamp), DATE_FORMAT)
return ( |
3bfb9a14b5785c14b112a3986aa0a653d3639b93 | src/server/view/home.jsx | src/server/view/home.jsx | import React, { PropTypes } from 'react';
import { renderToString } from 'react-dom/server';
class HelloMessage extends React.PureComponent {
static defaultProps = {
Application: <p>Missing Application :(</p>,
applicationName: '',
preloadedState: JSON.stringify({}),
payload: {},
}
static PropTypes = {
Application: PropTypes.element.isRequired,
applicationName: PropTypes.string.isRequired,
preloadedState: PropTypes.string.isRequired,
payload: PropTypes.object.isRequired,
}
render() {
const { payload, Application, applicationName, preloadedState } = this.props;
Application.preloadedState = preloadedState;
return (
<html lang="en">
<head>
<title>{payload.title}</title>
</head>
<body>
<h3>{applicationName}</h3>
<div id="app-body" dangerouslySetInnerHTML={{ __html: renderToString(<Application />) }} />
<script dangerouslySetInnerHTML={{ __html: `window.PRELOADED_STATE=${JSON.stringify(preloadedState)};` }} />
<script src="/static/commons.js" />
<script src={`/static/${applicationName.toLowerCase()}.js`} />
</body>
</html>
);
}
}
export default HelloMessage;
| import React, { PropTypes } from 'react';
import { renderToString } from 'react-dom/server';
class HelloMessage extends React.PureComponent {
static defaultProps = {
Application: <p>Missing Application :(</p>,
applicationName: '',
preloadedState: JSON.stringify({}),
payload: {},
}
static PropTypes = {
Application: PropTypes.element.isRequired,
applicationName: PropTypes.string.isRequired,
preloadedState: PropTypes.string.isRequired,
payload: PropTypes.object.isRequired,
}
render() {
const { payload, Application, applicationName, preloadedState } = this.props;
Application.preloadedState = preloadedState;
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{payload.title}</title>
<meta name="description" content={payload.description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href={`/static/css/${applicationName.toLowerCase()}.css`} />{/* Application CSS */}
</head>
<body>
<h3>{applicationName}</h3>
<div id="app-body" dangerouslySetInnerHTML={{ __html: renderToString(<Application />) }} /> {/* Server-Side-Rendering of Application */}
<script dangerouslySetInnerHTML={{ __html: `window.PRELOADED_STATE=${JSON.stringify(preloadedState)};` }} /> {/* Preloaded State of Application */}
<script src="/static/commons.js" /> {/* Just common JS */}
<script src={`/static/${applicationName.toLowerCase()}.js`} /> {/* React Application */}
</body>
</html>
);
}
}
export default HelloMessage;
| Add new <meta> tags, title, description, viewport. Add stylesheet and comment the code. | Add new <meta> tags, title, description, viewport. Add stylesheet and comment the code.
| JSX | mit | eddyw/mern-workflow | ---
+++
@@ -20,14 +20,19 @@
return (
<html lang="en">
<head>
+ <meta charSet="utf-8" />
+ <meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{payload.title}</title>
+ <meta name="description" content={payload.description} />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="stylesheet" href={`/static/css/${applicationName.toLowerCase()}.css`} />{/* Application CSS */}
</head>
<body>
<h3>{applicationName}</h3>
- <div id="app-body" dangerouslySetInnerHTML={{ __html: renderToString(<Application />) }} />
- <script dangerouslySetInnerHTML={{ __html: `window.PRELOADED_STATE=${JSON.stringify(preloadedState)};` }} />
- <script src="/static/commons.js" />
- <script src={`/static/${applicationName.toLowerCase()}.js`} />
+ <div id="app-body" dangerouslySetInnerHTML={{ __html: renderToString(<Application />) }} /> {/* Server-Side-Rendering of Application */}
+ <script dangerouslySetInnerHTML={{ __html: `window.PRELOADED_STATE=${JSON.stringify(preloadedState)};` }} /> {/* Preloaded State of Application */}
+ <script src="/static/commons.js" /> {/* Just common JS */}
+ <script src={`/static/${applicationName.toLowerCase()}.js`} /> {/* React Application */}
</body>
</html>
); |
08b0c5cc6a39f4fd28bafc5fd158900b1e584fd5 | client/sections/profile/components/Description.jsx | client/sections/profile/components/Description.jsx | import React, { Component } from 'react';
class Description extends Component {
render() {
const { description, updateDescription } = this.props;
return (
<div className="profile-section">
<div className="profile-title">About Me</div>
<div
contentEditable="true"
className="description"
ref="description"
onKeyUp={() => {
updateDescription(this.refs.description.innerText);
}}
>
{description}
</div>
</div>
);
}
}
export default Description;
| import React, { Component } from 'react';
class Description extends Component {
render() {
const { description, updateDescription } = this.props;
return (
<div className="profile-section">
<div className="profile-title">About Me</div>
<div
contentEditable="true"
className="description"
ref="description"
onKeyUp={() => {
updateDescription(this.refs.description.innerText);
console.log(this.refs.description.innerText);
}}
onKeyDown={(e) => {
if (this.refs.description.innerText.length > 100 && e.which !== 8) {
e.preventDefault();
}
}}
onPaste={(e) => {
if (this.refs.description.innerText.length > 100) {
e.preventDefault();
}
}}
>
{description}
</div>
</div>
);
}
}
export default Description;
| Add character limit to description | Add character limit to description
| JSX | mit | VictoriousResistance/iDioma,VictoriousResistance/iDioma | ---
+++
@@ -14,6 +14,17 @@
ref="description"
onKeyUp={() => {
updateDescription(this.refs.description.innerText);
+ console.log(this.refs.description.innerText);
+ }}
+ onKeyDown={(e) => {
+ if (this.refs.description.innerText.length > 100 && e.which !== 8) {
+ e.preventDefault();
+ }
+ }}
+ onPaste={(e) => {
+ if (this.refs.description.innerText.length > 100) {
+ e.preventDefault();
+ }
}}
>
{description} |
ee0fd11e0c430e038739cc32379adca7a037c998 | src/utils/ChromeAPI.jsx | src/utils/ChromeAPI.jsx | export function searchHistory(q = "", d = 0, e = false, m = 0) {
let params = {
text: q,
maxResults: m,
startTime: d
};
if (e) {
params["endTime"] = e;
}
return new Promise((resolve, reject) => {
chrome.history.search(params, (h) => {
//console.table(h);
resolve(h);
});
});
};
export function getVisits(u) {
return new Promise((resolve, reject) => {
chrome.history.getVisits({url: u}, (v) => {
//console.table(v);
resolve(v);
});
});
}; | export function searchHistory(q = "", d = 0, e = false, m = 0) {
let params = {
text: q,
maxResults: m,
startTime: d
};
if (e) {
params["endTime"] = e;
}
return new Promise((resolve, reject) => {
chrome.history.search(params, (h) => {
//console.table(h);
resolve(h);
});
});
};
export function getVisits(u) {
return new Promise((resolve, reject) => {
chrome.history.getVisits({url: u}, (v) => {
//console.table(v);
resolve(v);
});
});
};
export function deleteUrl(u) {
return new Promise((resolve, reject) => {
chrome.history.deleteUrl({url: u}, () => {
resolve();
});
});
}; | Add Chrome deleteUrl API method | Add Chrome deleteUrl API method
| JSX | mit | MrSaints/historyx,MrSaints/historyx | ---
+++
@@ -23,3 +23,11 @@
});
});
};
+
+export function deleteUrl(u) {
+ return new Promise((resolve, reject) => {
+ chrome.history.deleteUrl({url: u}, () => {
+ resolve();
+ });
+ });
+}; |
dadb6c16a90f355213ed929442104b09d84aacf5 | templates/javascript.jsx | templates/javascript.jsx | import React, { PropTypes } from 'react'
/*
const ThisClass = ( props ) => (
<ThisClass key={ props.foo } />
)
// or:
*/
export default class ThisClass extends React.Component {
constructor(props) {
super(props)
//this.bindInstanceMethods( 'methodName1', 'methodName2' )
//this.state = {}
}
bindInstanceMethods( ...methods ) {
methods.forEach(
( method ) => this[ method ] = this[ method ].bind( this )
)
}
/*
// https://facebook.github.io/react/docs/component-specs.html
componentWillMount() { }
componentDidMount() { }
componentWillReceiveProps( nextProps ) { }
shouldComponentUpdate( nextProps, nextState ) { return false }
componentWillUpdate( nextProps, nextState ) { }
componentDidUpdate( prevProps, prevState ) { }
componentWillUnmount() { }
*/
// Consider hitting m-r in Vim to set bookmark
render() {
return (
<div>
</div>
)
}
}
/*
ThisClass.propTypes = {
initialValue: PropTypes.number,
type: PropTypes.oneOf( ['enum1', 'enum2'] )
}
*/
// ThisClass.defaultProps = { initialValue: 0 }
| import React, { PropTypes } from 'react'
/*
const ThisClass = (props) => (
<ThisClass key={props.foo} />
)
// or:
*/
export default class ThisClass extends React.Component {
constructor (props) {
super(props)
this.bindInstanceMethods('methodName1', 'methodName2')
// this.state = {}
}
bindInstanceMethods (...methods) {
methods.forEach((method) => { this[method] = this[method].bind(this) })
}
// https://facebook.github.io/react/docs/component-specs.html
componentWillMount () { }
componentDidMount () { }
componentWillReceiveProps (nextProps) { }
shouldComponentUpdate (nextProps, nextState) { return false }
componentWillUpdate (nextProps, nextState) { }
componentDidUpdate (prevProps, prevState) { }
componentWillUnmount () { }
// Consider hitting m-r in Vim to set bookmark
render () {
return (
<div>
</div>
)
}
}
ThisClass.propTypes = {
string: PropTypes.string.isRequired,
initialValue: PropTypes.number,
type: PropTypes.oneOf(['enum1', 'enum2'])
}
ThisClass.defaultProps = {
initialValue: 0
}
| Fix syntax issues in JSX template to reconcile Standard | Fix syntax issues in JSX template to reconcile Standard
| JSX | unlicense | chris-kobrzak/js-dev-vim-setup | ---
+++
@@ -1,40 +1,36 @@
import React, { PropTypes } from 'react'
/*
-const ThisClass = ( props ) => (
- <ThisClass key={ props.foo } />
+const ThisClass = (props) => (
+ <ThisClass key={props.foo} />
)
// or:
*/
export default class ThisClass extends React.Component {
- constructor(props) {
+ constructor (props) {
super(props)
- //this.bindInstanceMethods( 'methodName1', 'methodName2' )
+ this.bindInstanceMethods('methodName1', 'methodName2')
- //this.state = {}
+ // this.state = {}
}
- bindInstanceMethods( ...methods ) {
- methods.forEach(
- ( method ) => this[ method ] = this[ method ].bind( this )
- )
+ bindInstanceMethods (...methods) {
+ methods.forEach((method) => { this[method] = this[method].bind(this) })
}
- /*
// https://facebook.github.io/react/docs/component-specs.html
- componentWillMount() { }
- componentDidMount() { }
- componentWillReceiveProps( nextProps ) { }
- shouldComponentUpdate( nextProps, nextState ) { return false }
- componentWillUpdate( nextProps, nextState ) { }
- componentDidUpdate( prevProps, prevState ) { }
- componentWillUnmount() { }
- */
+ componentWillMount () { }
+ componentDidMount () { }
+ componentWillReceiveProps (nextProps) { }
+ shouldComponentUpdate (nextProps, nextState) { return false }
+ componentWillUpdate (nextProps, nextState) { }
+ componentDidUpdate (prevProps, prevState) { }
+ componentWillUnmount () { }
// Consider hitting m-r in Vim to set bookmark
- render() {
+ render () {
return (
<div>
</div>
@@ -42,10 +38,11 @@
}
}
-/*
ThisClass.propTypes = {
+ string: PropTypes.string.isRequired,
initialValue: PropTypes.number,
- type: PropTypes.oneOf( ['enum1', 'enum2'] )
+ type: PropTypes.oneOf(['enum1', 'enum2'])
}
-*/
-// ThisClass.defaultProps = { initialValue: 0 }
+ThisClass.defaultProps = {
+ initialValue: 0
+} |
7c1d328cd7b0947874e673b1875302c2c15f732b | src/components/connection-modal/device-tile.jsx | src/components/connection-modal/device-tile.jsx | import {FormattedMessage} from 'react-intl';
import PropTypes from 'prop-types';
import React from 'react';
import bindAll from 'lodash.bindall';
import Box from '../box/box.jsx';
import styles from './connection-modal.css';
class DeviceTile extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleConnecting'
]);
}
handleConnecting () {
this.props.onConnecting(this.props.peripheralId);
}
render () {
return (
<Box className={styles.deviceTile}>
<Box>
<span>{this.props.name}</span>
<Box className={styles.deviceTileWidgets}>
<span className={styles.signalStrengthText}>{this.props.rssi}</span>
<button
onClick={this.handleConnecting}
>
<FormattedMessage
defaultMessage="connect"
description=""
id="gui.connection.connect"
/>
</button>
</Box>
</Box>
</Box>
);
}
}
DeviceTile.propTypes = {
name: PropTypes.string,
onConnecting: PropTypes.func,
peripheralId: PropTypes.string,
rssi: PropTypes.number
};
export default DeviceTile;
| import {FormattedMessage} from 'react-intl';
import PropTypes from 'prop-types';
import React from 'react';
import bindAll from 'lodash.bindall';
import Box from '../box/box.jsx';
import styles from './connection-modal.css';
class DeviceTile extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleConnecting'
]);
}
handleConnecting () {
this.props.onConnecting(this.props.peripheralId);
}
render () {
return (
<Box className={styles.deviceTile}>
<Box>
<span>{this.props.name}</span>
<Box className={styles.deviceTileWidgets}>
<span className={styles.signalStrengthText}>{this.props.rssi}</span>
<button
onClick={this.handleConnecting}
>
<FormattedMessage
defaultMessage="Connect"
description="Button to start connecting to a specific device"
id="gui.connection.connect"
/>
</button>
</Box>
</Box>
</Box>
);
}
}
DeviceTile.propTypes = {
name: PropTypes.string,
onConnecting: PropTypes.func,
peripheralId: PropTypes.string,
rssi: PropTypes.number
};
export default DeviceTile;
| Fix more formatted message descriptions | Fix more formatted message descriptions
| JSX | bsd-3-clause | cwillisf/scratch-gui,LLK/scratch-gui,cwillisf/scratch-gui,cwillisf/scratch-gui,LLK/scratch-gui | ---
+++
@@ -27,8 +27,8 @@
onClick={this.handleConnecting}
>
<FormattedMessage
- defaultMessage="connect"
- description=""
+ defaultMessage="Connect"
+ description="Button to start connecting to a specific device"
id="gui.connection.connect"
/>
</button> |
c6de6bc5b3b0822b6a052b30397d8187024ec5da | src/app/stores/port-store.jsx | src/app/stores/port-store.jsx | var EventEmitter = require('events').EventEmitter;
var socket = require('../socket');
var DashDispatcher = require('../dispatcher/dash-dispatcher');
var ActionTypes = require('../constants/action-types');
var available = [];
var loading = true;
var opening = false;
var selected = '';
var PortStore = new EventEmitter();
PortStore.emitChange = function() {
this.emit('change');
}
PortStore.addChangeListener = function(listener) {
this.on('change', listener);
}
PortStore.removeChangeListener = function(listener) {
this.removeListener('change', listener);
}
PortStore.getAvailable = function() {
return available;
};
PortStore.isLoading = function() {
return loading;
};
PortStore.isOpening = function() {
return opening;
};
PortStore.getSelected = function() {
return selected;
};
DashDispatcher.register(function(action) {
switch (action.type) {
case ActionTypes.SELECT_PORT:
selected = action.selection;
opening = true;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_LIST:
loading = false;
available = action.ports;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_OPEN:
opening = false;
PortStore.emitChange();
break;
}
});
module.exports = PortStore;
| var EventEmitter = require('events').EventEmitter;
var DashDispatcher = require('../dispatcher/dash-dispatcher');
var ActionTypes = require('../constants/action-types');
var available = [];
var loading = true;
var opening = false;
var selected = '';
var PortStore = new EventEmitter();
PortStore.emitChange = function() {
this.emit('change');
}
PortStore.addChangeListener = function(listener) {
this.on('change', listener);
}
PortStore.removeChangeListener = function(listener) {
this.removeListener('change', listener);
}
PortStore.getAvailable = function() {
return available;
};
PortStore.isLoading = function() {
return loading;
};
PortStore.isOpening = function() {
return opening;
};
PortStore.getSelected = function() {
return selected;
};
DashDispatcher.register(function(action) {
switch (action.type) {
case ActionTypes.SELECT_PORT:
selected = action.selection;
opening = true;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_LIST:
loading = false;
available = action.ports;
PortStore.emitChange();
break;
case ActionTypes.RECEIVE_PORT_OPEN:
opening = false;
PortStore.emitChange();
break;
}
});
module.exports = PortStore;
| Remove socket module require (now uses server util) | Remove socket module require (now uses server util)
| JSX | mit | ErnWong/pigeon-dash,ErnWong/pigeon-dash | ---
+++
@@ -1,5 +1,4 @@
var EventEmitter = require('events').EventEmitter;
-var socket = require('../socket');
var DashDispatcher = require('../dispatcher/dash-dispatcher');
var ActionTypes = require('../constants/action-types');
|
e388bcd2060c6f667e7a5e3298a9cafa04568906 | client/src/components/HowItWorks.jsx | client/src/components/HowItWorks.jsx | import React from 'react'
import { Link } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import {connect} from 'react-redux'
import * as actionCreators from '../actions/howItWorksActionCreators'
import css from './HowItWorks.scss'
class HowItWorks extends React.Component {
render() {
return (
<div className="how-it-works">
<div className="button-wrapper">
<button><i className="fa fa-times" aria-hidden="true"></i></button>
</div>
</div>
)
}
}
// this is taking the howItWorks portion of state and attaching it to the HowItWork's props
function mapStateToProps(state, routing) {
return Object.assign({}, state.howItWorks, routing)
}
// this is attaching our actions to the HowItWork's component
function mapDispatchToProps(dispatch) {
return bindActionCreators(actionCreators, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(HowItWorks) | import React from 'react'
import { Link } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import {connect} from 'react-redux'
import * as actionCreators from '../actions/howItWorksActionCreators'
import css from './HowItWorks.scss'
class HowItWorks extends React.Component {
render() {
return (
<div className="how-it-works">
<div className="button-wrapper">
<button onClick={this.props.toggleHowItWorks}><i className="fa fa-times" aria-hidden="true"></i></button>
</div>
</div>
)
}
}
// this is taking the howItWorks portion of state and attaching it to the HowItWork's props
function mapStateToProps(state, routing) {
return Object.assign({}, state.howItWorks, routing)
}
// this is attaching our actions to the HowItWork's component
function mapDispatchToProps(dispatch) {
return bindActionCreators(actionCreators, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(HowItWorks) | Add onclick to change visibility of howItWorks in state to close button | Add onclick to change visibility of howItWorks in state to close button
| JSX | mit | Code-For-Change/GivingWeb,Code-For-Change/GivingWeb | ---
+++
@@ -12,7 +12,7 @@
return (
<div className="how-it-works">
<div className="button-wrapper">
- <button><i className="fa fa-times" aria-hidden="true"></i></button>
+ <button onClick={this.props.toggleHowItWorks}><i className="fa fa-times" aria-hidden="true"></i></button>
</div>
</div>
) |
4f5225f72a811610c57e5a477242b8fda3bcd054 | src/app/views/preview/PreviewController.jsx | src/app/views/preview/PreviewController.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Iframe from '../../components/iframe/Iframe';
const propTypes = {};
export class PreviewController extends Component {
constructor(props) {
super(props);
this.state = {};
}
render () {
return (
<div className="preview">
<Iframe/>
</div>
)
}
}
PreviewController.propTypes = propTypes;
export default PreviewController; | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import collections from '../../utilities/api-clients/collections';
import notifications from '../../utilities/notifications';
import { updateSelectedPreviewPage, addPreviewCollection, removeSelectedPreviewPage } from '../../config/actions';
import Iframe from '../../components/iframe/Iframe';
const propTypes = {
selectedPageUri: PropTypes.string,
routeParams: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired
};
export class PreviewController extends Component {
constructor(props) {
super(props);
}
componentWillMount() {
this.fetchCollectionAndPages(this.props.routeParams.collectionID)
// check if there is a previewable page in the route and update selected preview page state in redux
const previewPageURL = new URL(window.location.href).searchParams.get("url")
if (previewPageURL) {
this.props.dispatch(updateSelectedPreviewPage(previewPageURL));
}
}
componentWillUnmount() {
this.props.dispatch(removeSelectedPreviewPage());
}
fetchCollectionAndPages(collectionID) {
collections.get(collectionID).then(collection => {
const pages = [...collection.inProgress, ...collection.complete, ...collection.reviewed];
const collectionPreview = {collectionID, name: collection.name, pages};
this.props.dispatch(addPreviewCollection(collectionPreview));
}).catch(error => {
const notification = {
type: "warning",
message: "There was an error getting data about the selected collection. Please try refreshing the page",
isDismissable: true
};
notifications.add(notification);
console.error(`Error fetching ${collectionID}:\n`, error);
});
}
render () {
return (
<div className="preview">
<Iframe path={this.props.selectedPageUri || "/"}/>
</div>
)
}
}
PreviewController.propTypes = propTypes;
export function mapStateToProps(state) {
return {
selectedPageUri: state.state.preview.selectedPage
}
}
export default connect(mapStateToProps)(PreviewController); | Update to fetch colelction data, and handle page changes | Update to fetch colelction data, and handle page changes
Former-commit-id: 5cf9a2d069ed3446efafe3b1db24becddbeed0a3
Former-commit-id: 1c9641d1c8476948cb50b31637733fe7d58dec15
Former-commit-id: d62b4d3883ce160b2efc9615560f4b19f98a1ad5 | JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -1,21 +1,58 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
+
+import collections from '../../utilities/api-clients/collections';
+import notifications from '../../utilities/notifications';
+import { updateSelectedPreviewPage, addPreviewCollection, removeSelectedPreviewPage } from '../../config/actions';
import Iframe from '../../components/iframe/Iframe';
-const propTypes = {};
+const propTypes = {
+ selectedPageUri: PropTypes.string,
+ routeParams: PropTypes.object.isRequired,
+ dispatch: PropTypes.func.isRequired
+};
export class PreviewController extends Component {
constructor(props) {
super(props);
-
- this.state = {};
}
+ componentWillMount() {
+ this.fetchCollectionAndPages(this.props.routeParams.collectionID)
+
+ // check if there is a previewable page in the route and update selected preview page state in redux
+ const previewPageURL = new URL(window.location.href).searchParams.get("url")
+ if (previewPageURL) {
+ this.props.dispatch(updateSelectedPreviewPage(previewPageURL));
+ }
+ }
+
+ componentWillUnmount() {
+ this.props.dispatch(removeSelectedPreviewPage());
+ }
+
+ fetchCollectionAndPages(collectionID) {
+ collections.get(collectionID).then(collection => {
+ const pages = [...collection.inProgress, ...collection.complete, ...collection.reviewed];
+ const collectionPreview = {collectionID, name: collection.name, pages};
+ this.props.dispatch(addPreviewCollection(collectionPreview));
+ }).catch(error => {
+ const notification = {
+ type: "warning",
+ message: "There was an error getting data about the selected collection. Please try refreshing the page",
+ isDismissable: true
+ };
+ notifications.add(notification);
+ console.error(`Error fetching ${collectionID}:\n`, error);
+ });
+ }
+
render () {
return (
<div className="preview">
- <Iframe/>
+ <Iframe path={this.props.selectedPageUri || "/"}/>
</div>
)
}
@@ -23,4 +60,10 @@
PreviewController.propTypes = propTypes;
-export default PreviewController;
+export function mapStateToProps(state) {
+ return {
+ selectedPageUri: state.state.preview.selectedPage
+ }
+}
+
+export default connect(mapStateToProps)(PreviewController); |
d1f7804a5a94d46f3db02b4cab802af8d1c4e92e | packages/lesswrong/components/search/SearchAutoComplete.jsx | packages/lesswrong/components/search/SearchAutoComplete.jsx | import React from 'react';
import { registerComponent, Components, getSetting } from 'meteor/vulcan:core'
import { InstantSearch, Configure } from 'react-instantsearch-dom';
import { connectAutoComplete } from 'react-instantsearch/connectors';
import Autosuggest from 'react-autosuggest';
const SearchAutoComplete = connectAutoComplete(
({ hits, currentRefinement, refine, clickAction, placeholder, renderSuggestion, hitsPerPage=7, indexName }) =>
{
const algoliaAppId = getSetting('algolia.appId')
const algoliaSearchKey = getSetting('algolia.searchKey')
const onSuggestionSelected = (event, { suggestion }) => {
event.preventDefault();
event.stopPropagation();
clickAction(suggestion._id)
}
return <InstantSearch
indexName={indexName}
appId={algoliaAppId}
apiKey={algoliaSearchKey}
>
<div className="posts-search-auto-complete">
<Autosuggest
suggestions={hits}
onSuggestionSelected={(event, {suggestion}) => {
event.preventDefault();
event.stopPropagation();
onSuggestionSelected(suggestion);
}}
onSuggestionsFetchRequested={({ value }) => refine(value)}
onSuggestionsClearRequested={() => refine('')}
getSuggestionValue={hit => hit.title}
renderSuggestion={renderSuggestion}
inputProps={{
placeholder: placeholder,
value: currentRefinement,
onChange: () => {},
}}
highlightFirstSuggestion
/>
<Configure hitsPerPage={hitsPerPage} />
</div>
</InstantSearch>
}
);
registerComponent("SearchAutoComplete", SearchAutoComplete);
| import React from 'react';
import { registerComponent, Components, getSetting } from 'meteor/vulcan:core'
import { InstantSearch, Configure } from 'react-instantsearch-dom';
import { connectAutoComplete } from 'react-instantsearch/connectors';
import Autosuggest from 'react-autosuggest';
const SearchAutoComplete = ({ hits, currentRefinement, refine, clickAction, placeholder, renderSuggestion, hitsPerPage=7, indexName }) => {
const algoliaAppId = getSetting('algolia.appId')
const algoliaSearchKey = getSetting('algolia.searchKey')
const onSuggestionSelected = (event, { suggestion }) => {
event.preventDefault();
event.stopPropagation();
clickAction(suggestion._id)
}
return <InstantSearch
indexName={indexName}
appId={algoliaAppId}
apiKey={algoliaSearchKey}
>
<div className="posts-search-auto-complete">
<Autosuggest
suggestions={hits}
onSuggestionSelected={(event, {suggestion}) => {
event.preventDefault();
event.stopPropagation();
onSuggestionSelected(suggestion);
}}
onSuggestionsFetchRequested={({ value }) => refine(value)}
onSuggestionsClearRequested={() => refine('')}
getSuggestionValue={hit => hit.title}
renderSuggestion={renderSuggestion}
inputProps={{
placeholder: placeholder,
value: currentRefinement,
onChange: () => {},
}}
highlightFirstSuggestion
/>
<Configure hitsPerPage={hitsPerPage} />
</div>
</InstantSearch>
}
registerComponent("SearchAutoComplete", SearchAutoComplete, connectAutoComplete);
| Make connectAutoComplete use registerComponent HoC handling | Make connectAutoComplete use registerComponent HoC handling
| JSX | mit | Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2 | ---
+++
@@ -4,45 +4,42 @@
import { connectAutoComplete } from 'react-instantsearch/connectors';
import Autosuggest from 'react-autosuggest';
-const SearchAutoComplete = connectAutoComplete(
- ({ hits, currentRefinement, refine, clickAction, placeholder, renderSuggestion, hitsPerPage=7, indexName }) =>
- {
- const algoliaAppId = getSetting('algolia.appId')
- const algoliaSearchKey = getSetting('algolia.searchKey')
-
- const onSuggestionSelected = (event, { suggestion }) => {
- event.preventDefault();
- event.stopPropagation();
- clickAction(suggestion._id)
- }
- return <InstantSearch
- indexName={indexName}
- appId={algoliaAppId}
- apiKey={algoliaSearchKey}
- >
- <div className="posts-search-auto-complete">
- <Autosuggest
- suggestions={hits}
- onSuggestionSelected={(event, {suggestion}) => {
- event.preventDefault();
- event.stopPropagation();
- onSuggestionSelected(suggestion);
- }}
- onSuggestionsFetchRequested={({ value }) => refine(value)}
- onSuggestionsClearRequested={() => refine('')}
- getSuggestionValue={hit => hit.title}
- renderSuggestion={renderSuggestion}
- inputProps={{
- placeholder: placeholder,
- value: currentRefinement,
- onChange: () => {},
- }}
- highlightFirstSuggestion
- />
- <Configure hitsPerPage={hitsPerPage} />
- </div>
- </InstantSearch>
+const SearchAutoComplete = ({ hits, currentRefinement, refine, clickAction, placeholder, renderSuggestion, hitsPerPage=7, indexName }) => {
+ const algoliaAppId = getSetting('algolia.appId')
+ const algoliaSearchKey = getSetting('algolia.searchKey')
+
+ const onSuggestionSelected = (event, { suggestion }) => {
+ event.preventDefault();
+ event.stopPropagation();
+ clickAction(suggestion._id)
}
-);
+ return <InstantSearch
+ indexName={indexName}
+ appId={algoliaAppId}
+ apiKey={algoliaSearchKey}
+ >
+ <div className="posts-search-auto-complete">
+ <Autosuggest
+ suggestions={hits}
+ onSuggestionSelected={(event, {suggestion}) => {
+ event.preventDefault();
+ event.stopPropagation();
+ onSuggestionSelected(suggestion);
+ }}
+ onSuggestionsFetchRequested={({ value }) => refine(value)}
+ onSuggestionsClearRequested={() => refine('')}
+ getSuggestionValue={hit => hit.title}
+ renderSuggestion={renderSuggestion}
+ inputProps={{
+ placeholder: placeholder,
+ value: currentRefinement,
+ onChange: () => {},
+ }}
+ highlightFirstSuggestion
+ />
+ <Configure hitsPerPage={hitsPerPage} />
+ </div>
+ </InstantSearch>
+}
-registerComponent("SearchAutoComplete", SearchAutoComplete);
+registerComponent("SearchAutoComplete", SearchAutoComplete, connectAutoComplete); |
028fbe5b927964905586961d9b9d5666227a8fdb | test/index.jsx | test/index.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import Test from './Test';
const render = (Component) => {
ReactDOM.render(
<AppContainer>
<Component />
</AppContainer>,
document.getElementById('react-container'),
);
};
render(Test);
if (module.hot) {
module.hot.accept('./Test', () => { render(Test); });
}
| import React, { StrictMode } from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import Test from './Test';
const render = (Component) => {
ReactDOM.render(
<StrictMode>
<AppContainer>
<Component />
</AppContainer>
</StrictMode>,
document.getElementById('react-container'),
);
};
render(Test);
if (module.hot) {
module.hot.accept('./Test', () => { render(Test); });
}
| Enable StrictMode in test suite | Enable StrictMode in test suite
| JSX | mit | wojtekmaj/react-pdf,wojtekmaj/react-pdf,wojtekmaj/react-pdf | ---
+++
@@ -1,13 +1,15 @@
-import React from 'react';
+import React, { StrictMode } from 'react';
import ReactDOM from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import Test from './Test';
const render = (Component) => {
ReactDOM.render(
- <AppContainer>
- <Component />
- </AppContainer>,
+ <StrictMode>
+ <AppContainer>
+ <Component />
+ </AppContainer>
+ </StrictMode>,
document.getElementById('react-container'),
);
}; |
8d7524a2508b097ac1b5f2880798711c885b89e6 | app/components/App.jsx | app/components/App.jsx | "use strict";
var React = require('react');
var Router = require('react-router');
var DocumentTitle = require('react-document-title');
var RouteHandler = Router.RouteHandler;
var Link = Router.Link;
var data = require('../public/data/places');
var title = "Some places in Italy";
var App = React.createClass({
getDefaultProps: function () {
return { places: data };
},
render: function () {
var links = this.props.places.map(function (place) {
return (
<li key={"place-" + place.id}>
<Link to="place" params={{ id: place.id }}>{place.name}</Link>
</li>
);
});
return (
<DocumentTitle title={ title }>
<div className="app">
<h1>{ title }</h1>
<ul className="master">
{ links }
</ul>
<div className="detail">
<RouteHandler />
</div>
</div>
</DocumentTitle>
);
}
});
module.exports = App; | "use strict";
var React = require('react');
var Router = require('react-router');
var DocumentTitle = require('react-document-title');
var RouteHandler = Router.RouteHandler;
var Link = Router.Link;
var data = require('../public/data/places');
var title = "Some places in Italy";
var App = React.createClass({
getDefaultProps: function () {
return { places: data };
},
render: function () {
var links = this.props.places.map(function (place) {
return (
<li key={"place-" + place.id}>
<Link to="place" params={{ id: place.id }}>{place.name}</Link>
</li>
);
});
return (
<DocumentTitle title={ title }>
<div className="app">
<h1>{ title }</h1>
<ul className="master">
{ links }
<Link to="index"><small>(back to index)</small></Link>
</ul>
<div className="detail">
<RouteHandler />
</div>
</div>
</DocumentTitle>
);
}
});
module.exports = App; | Add "back to index" link | Add "back to index" link
| JSX | mit | elfinxx/isomorphic500,jxnblk/isomorphic500,jeffhandley/oredev-sessions,geekyme/isomorphic-react-template,dmitrif/isomorphic500,w01fgang/isomorphic500,davedx/isomorphic-react-template,ryankanno/isomorphic500,pheadra/isomorphic500,saitodisse/isomorphic500,jmfurlott/isomorphic500,veeracs/isomorphic500,devypt/isomorphic500,gpbl/isomorphic500,fustic/isomorphic500,beeva-davidgarcia/isomorphic500,davedx/isomorphic-react-template,jonathanconway/MovieBrowser,geekyme/isomorphic-react-template | ---
+++
@@ -30,6 +30,7 @@
<h1>{ title }</h1>
<ul className="master">
{ links }
+ <Link to="index"><small>(back to index)</small></Link>
</ul>
<div className="detail">
<RouteHandler /> |
531867b3d6a469b604e2d60946b95bd3d5f6e254 | src/components/user-feed.jsx | src/components/user-feed.jsx | import React from 'react'
import {Link} from 'react-router'
import PaginatedView from './paginated-view'
import Feed from './feed'
export default props => (
<div>
{props.viewUser.blocked ? (
<div className="box-body">
<p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p>
<p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p>
</div>
) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed ? (
<div className="box-body">
<p><b>{props.viewUser.screenName}</b> has a private feed.</p>
</div>
) : (
<PaginatedView>
<Feed {...props} isInUserFeed={true}/>
</PaginatedView>
)}
</div>
)
| import React from 'react'
import {Link} from 'react-router'
import PaginatedView from './paginated-view'
import Feed from './feed'
export default props => (
<div>
{props.viewUser.blocked ? (
<div className="box-body">
<p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p>
<p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p>
</div>
) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed && !props.viewUser.isItMe ? (
<div className="box-body">
<p><b>{props.viewUser.screenName}</b> has a private feed.</p>
</div>
) : (
<PaginatedView>
<Feed {...props} isInUserFeed={true}/>
</PaginatedView>
)}
</div>
)
| Fix user's own private feed | Fix user's own private feed
Before: user is shown "user has a private feed" for their own feed.
After: user is shown the feed contents.
| JSX | mit | FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,FreeFeed/freefeed-html-react,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,FreeFeed/freefeed-html-react,FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,davidmz/freefeed-react-client | ---
+++
@@ -11,7 +11,7 @@
<p>You have blocked <b>{props.viewUser.screenName}</b>, so all of their posts and comments are invisible to you.</p>
<p><a onClick={()=>props.userActions.unban({username: props.viewUser.username, id: props.viewUser.id})}>Un-block</a></p>
</div>
- ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed ? (
+ ) : props.viewUser.isPrivate === '1' && !props.viewUser.subscribed && !props.viewUser.isItMe ? (
<div className="box-body">
<p><b>{props.viewUser.screenName}</b> has a private feed.</p>
</div> |
c3febf7b9d2c815d7fe4021fdf27599623652098 | client/apps/hello_world_graphql/components/home.jsx | client/apps/hello_world_graphql/components/home.jsx | import React from 'react';
import PropTypes from 'prop-types';
import gql from 'graphql-tag';
import { useQuery } from '@apollo/react-hooks';
import DeepLink from './deep_link';
import assets from '../libs/assets';
export const GET_WELCOME = gql`
query {
welcomeMessage @client
}
`;
const Home = ({ settings }) => {
const { loading, error, data } = useQuery(GET_WELCOME);
if (loading) return 'Loading...';
if (error) return `Error! ${error.message}`;
const img = assets('./images/atomicjolt.jpg');
if (settings.deep_link_settings) {
return (
<DeepLink
deepLinkSettings={settings.deep_link_settings}
/>
);
}
return (
<div>
<img src={img} alt="Atomic Jolt Logo" />
<p>
{data.welcomeMessage}
</p>
<p>
by
<a href="http://www.atomicjolt.com">Atomic Jolt</a>
</p>
</div>
);
};
Home.propTypes = {
settings: PropTypes.shape({
deep_link_settings: PropTypes.object,
}).isRequired,
};
export default Home;
| import React from 'react';
import PropTypes from 'prop-types';
import gql from 'graphql-tag';
import { useQuery } from '@apollo/react-hooks';
import { withSettings } from 'atomic-fuel/libs/components/settings';
import DeepLink from './deep_link';
import assets from '../libs/assets';
export const GET_WELCOME = gql`
query {
welcomeMessage @client
}
`;
const Home = ({ settings }) => {
const { loading, error, data } = useQuery(GET_WELCOME);
if (loading) return 'Loading...';
if (error) return `Error! ${error.message}`;
const img = assets('./images/atomicjolt.jpg');
if (settings.deep_link_settings) {
return (
<DeepLink
deepLinkSettings={settings.deep_link_settings}
/>
);
}
return (
<div>
<img src={img} alt="Atomic Jolt Logo" />
<p>
{data.welcomeMessage}
</p>
<p>
by
<a href="http://www.atomicjolt.com">Atomic Jolt</a>
</p>
</div>
);
};
Home.propTypes = {
settings: PropTypes.shape({
deep_link_settings: PropTypes.object,
}).isRequired,
};
export default withSettings(Home);
| Add settings to Home component | Add settings to Home component
| JSX | mit | atomicjolt/lti_starter_app,atomicjolt/adhesion,atomicjolt/lti_starter_app,atomicjolt/adhesion,atomicjolt/lti_starter_app,atomicjolt/adhesion,atomicjolt/lti_starter_app,atomicjolt/adhesion | ---
+++
@@ -2,6 +2,7 @@
import PropTypes from 'prop-types';
import gql from 'graphql-tag';
import { useQuery } from '@apollo/react-hooks';
+import { withSettings } from 'atomic-fuel/libs/components/settings';
import DeepLink from './deep_link';
@@ -50,4 +51,4 @@
}).isRequired,
};
-export default Home;
+export default withSettings(Home); |
63ca7562ca53e91ee20b87ca3ee44326940dd98a | src/js/monsterlist.jsx | src/js/monsterlist.jsx | var MonsterList = React.createClass({
propTypes: {
allMonsters: React.PropTypes.array.isRequired,
onToggleMonster: React.PropTypes.func.isRequired
},
render: function () {
var self = this;
var theMonsters = this.props.allMonsters.map(function (monster, i){
var icon = monster.selected ? '-' : '+';
return (
<li key={i}>{monster.name}<button type="button" onClick={self.props.onToggleMonster.bind(null, i)}>{icon}</button></li>
);
});
return (
<div id="monster-list">
<ul>
{theMonsters}
</ul>
</div>
);
}
});
| var MonsterList = React.createClass({
propTypes: {
allMonsters: React.PropTypes.array.isRequired,
onToggleMonster: React.PropTypes.func.isRequired
},
render: function () {
var self = this;
var theMonsters = this.props.allMonsters.map(function (monster, i){
var icon = monster.selected ? '-' : '+';
return (
<li key={i} onClick={self.props.onToggleMonster.bind(null, i)}><button type="button" className="button-reset"><span className="ctrl-icon">{icon}</span>{monster.name}</button></li>
);
});
return (
<div id="monster-list">
<ul className="list-reset">
{theMonsters}
</ul>
</div>
);
}
});
| Refactor UI for look and function | Refactor UI for look and function
| JSX | mit | jkrayer/summoner,jkrayer/summoner | ---
+++
@@ -8,12 +8,12 @@
var theMonsters = this.props.allMonsters.map(function (monster, i){
var icon = monster.selected ? '-' : '+';
return (
- <li key={i}>{monster.name}<button type="button" onClick={self.props.onToggleMonster.bind(null, i)}>{icon}</button></li>
+ <li key={i} onClick={self.props.onToggleMonster.bind(null, i)}><button type="button" className="button-reset"><span className="ctrl-icon">{icon}</span>{monster.name}</button></li>
);
});
return (
<div id="monster-list">
- <ul>
+ <ul className="list-reset">
{theMonsters}
</ul>
</div> |
6da2ff184e41e14f3b945c038c5f030a74fd200c | app/webpack/taxa/show/components/leaders.jsx | app/webpack/taxa/show/components/leaders.jsx | import React, { PropTypes } from "react";
import { Row, Col } from "react-bootstrap";
import TopObserverContainer from "../containers/top_observer_container";
import TopIdentifierContainer from "../containers/top_identifier_container";
import NumSpeciesContainer from "../containers/num_species_container";
import LastObservationContainer from "../containers/last_observation_container";
import NumObservationsContainer from "../containers/num_observations_container";
const Leaders = ( { taxon } ) => {
let optional = <NumObservationsContainer />;
if ( taxon.rank_level > 10 ) {
if ( taxon.complete_species_count ) {
optional = <NumSpeciesContainer />;
} else {
optional = <LastObservationContainer />;
}
}
return (
<div className="Leaders">
<Row>
<Col xs={6}>
<TopObserverContainer />
</Col>
<Col xs={6}>
<TopIdentifierContainer />
</Col>
</Row>
<Row>
<Col xs={6}>
{ optional }
</Col>
<Col xs={6}>
<NumObservationsContainer />
</Col>
</Row>
</div>
);
};
Leaders.propTypes = {
taxon: PropTypes.object
};
export default Leaders;
| import React, { PropTypes } from "react";
import { Row, Col } from "react-bootstrap";
import TopObserverContainer from "../containers/top_observer_container";
import TopIdentifierContainer from "../containers/top_identifier_container";
import NumSpeciesContainer from "../containers/num_species_container";
import LastObservationContainer from "../containers/last_observation_container";
import NumObservationsContainer from "../containers/num_observations_container";
const Leaders = ( { taxon } ) => {
let optional = <LastObservationContainer />;
if ( taxon.rank_level > 10 && taxon.complete_species_count ) {
optional = <NumSpeciesContainer />;
}
return (
<div className="Leaders">
<Row>
<Col xs={6}>
<TopObserverContainer />
</Col>
<Col xs={6}>
<TopIdentifierContainer />
</Col>
</Row>
<Row>
<Col xs={6}>
{ optional }
</Col>
<Col xs={6}>
<NumObservationsContainer />
</Col>
</Row>
</div>
);
};
Leaders.propTypes = {
taxon: PropTypes.object
};
export default Leaders;
| Remove duplicate total obs from taxon detail. | Remove duplicate total obs from taxon detail.
| JSX | mit | pleary/inaturalist,pleary/inaturalist,inaturalist/inaturalist,pleary/inaturalist,calonso-conabio/inaturalist,pleary/inaturalist,pleary/inaturalist,calonso-conabio/inaturalist,inaturalist/inaturalist,calonso-conabio/inaturalist,inaturalist/inaturalist,inaturalist/inaturalist,calonso-conabio/inaturalist,inaturalist/inaturalist,calonso-conabio/inaturalist | ---
+++
@@ -7,13 +7,9 @@
import NumObservationsContainer from "../containers/num_observations_container";
const Leaders = ( { taxon } ) => {
- let optional = <NumObservationsContainer />;
- if ( taxon.rank_level > 10 ) {
- if ( taxon.complete_species_count ) {
- optional = <NumSpeciesContainer />;
- } else {
- optional = <LastObservationContainer />;
- }
+ let optional = <LastObservationContainer />;
+ if ( taxon.rank_level > 10 && taxon.complete_species_count ) {
+ optional = <NumSpeciesContainer />;
}
return (
<div className="Leaders"> |
01817b117dade2b0f584192e37ad5caf66f177c4 | src/main.jsx | src/main.jsx | import 'babel-polyfill'
import './styles/main'
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import { Router, hashHistory } from 'react-router'
import cozy from 'cozy-client-js'
import 'cozy-bar'
import { I18n } from './lib/I18n'
import photosApp from './reducers'
import { indexFilesByDate } from './actions/mango'
import AppRoute from './components/AppRoute'
const context = window.context
const lang = document.documentElement.getAttribute('lang') || 'en'
const loggerMiddleware = createLogger()
const store = createStore(
photosApp,
applyMiddleware(
thunkMiddleware,
loggerMiddleware
)
)
document.addEventListener('DOMContentLoaded', () => {
const applicationElement = document.querySelector('[role=application]')
cozy.init({
cozyURL: `//${applicationElement.dataset.cozyStack}`,
token: applicationElement.dataset.token
})
cozy.bar.init({
appName: 'Photos'
})
// create/get mango index for files by date
store.dispatch(indexFilesByDate())
render((
<I18n context={context} lang={lang}>
<Provider store={store}>
<Router history={hashHistory} routes={AppRoute} />
</Provider>
</I18n>
), applicationElement)
})
| import 'babel-polyfill'
import './styles/main'
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, applyMiddleware } from 'redux'
import thunkMiddleware from 'redux-thunk'
import createLogger from 'redux-logger'
import { Router, hashHistory } from 'react-router'
import cozy from 'cozy-client-js'
import 'cozy-bar'
import { I18n } from './lib/I18n'
import photosApp from './reducers'
import { indexFilesByDate } from './actions/mango'
import AppRoute from './components/AppRoute'
const context = window.context
const lang = document.documentElement.getAttribute('lang') || 'en'
const loggerMiddleware = createLogger()
const store = createStore(
photosApp,
applyMiddleware(
thunkMiddleware,
loggerMiddleware
)
)
document.addEventListener('DOMContentLoaded', () => {
const applicationElement = document.querySelector('[role=application]')
cozy.init({
cozyURL: `//${applicationElement.dataset.cozyStack}`,
token: applicationElement.dataset.token
})
cozy.bar.init({
appName: 'Photos'
})
// create/get mango index for files by date
store.dispatch(indexFilesByDate())
render((
<I18n context={context} lang={lang}>
<Provider store={store}>
<Router history={hashHistory} routes={AppRoute} />
</Provider>
</I18n>
), applicationElement)
})
| Fix linting by removing empty line | [styles] Fix linting by removing empty line
| JSX | agpl-3.0 | y-lohse/cozy-files-v3,y-lohse/cozy-drive,enguerran/cozy-drive,cozy/cozy-files-v3,y-lohse/cozy-drive,enguerran/cozy-files-v3,nono/cozy-files-v3,enguerran/cozy-files-v3,enguerran/cozy-drive,cozy/cozy-files-v3,goldoraf/cozy-photos-v3,enguerran/cozy-drive,nono/cozy-files-v3,goldoraf/cozy-drive,y-lohse/cozy-drive,cozy/cozy-files-v3,goldoraf/cozy-drive,nono/cozy-files-v3,y-lohse/cozy-files-v3,nono/cozy-photos-v3,y-lohse/cozy-files-v3,goldoraf/cozy-photos-v3,enguerran/cozy-drive,cozy/cozy-photos-v3,enguerran/cozy-files-v3,y-lohse/cozy-drive,cozy/cozy-photos-v3,goldoraf/cozy-drive,nono/cozy-files-v3,goldoraf/cozy-drive,y-lohse/cozy-photos-v3,enguerran/cozy-files-v3,cozy/cozy-files-v3,y-lohse/cozy-photos-v3,nono/cozy-photos-v3 | ---
+++
@@ -16,7 +16,6 @@
import photosApp from './reducers'
import { indexFilesByDate } from './actions/mango'
import AppRoute from './components/AppRoute'
-
const context = window.context
const lang = document.documentElement.getAttribute('lang') || 'en' |
6a169882c6ddb58ac0266c26088c575563a0368c | src/components/App/index.jsx | src/components/App/index.jsx | import React, { Component } from 'react';
import logo from './logo.svg';
import './style.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
Snake will move here soon :)
</p>
<div>
Travis-CI -> Auto deploy to Heroku and Surge - v14
</div>
</div>
);
}
}
export default App;
| import React, { Component } from 'react';
import logo from './logo.svg';
import './style.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro">
Snake will move here soon :)
</p>
<div>
Hello world!
</div>
</div>
);
}
}
export default App;
| Add auto deployment functionality for Heroku and Surge | Add auto deployment functionality for Heroku and Surge
| JSX | mit | tokgozmusa/snake-react,tokgozmusa/snake-react,tokgozmusa/snake-react | ---
+++
@@ -14,7 +14,7 @@
Snake will move here soon :)
</p>
<div>
- Travis-CI -> Auto deploy to Heroku and Surge - v14
+ Hello world!
</div>
</div>
); |
6e90066ae27b4425063b3dcb9b8a2efd62fc488f | src/modules/Header/components/Title/Title.jsx | src/modules/Header/components/Title/Title.jsx | import './Title.styles';
import React, { Component, PropTypes } from 'react';
import cx from 'classnames'
import { Tooltip, IconCircle } from '~/components';
import {bindMembersToClass} from '~/utils/react'
const i = window.appSettings.icons
class Title extends Component {
constructor(props) {
super(props);
this.state = {
hovering: false
}
bindMembersToClass(this, 'handleMouseLeave', 'handleMouseEnter');
}
render () {
const {
className,
children,
onTitleClick,
onCompose,
onRefresh
} = this.props;
const titleClass = cx('Title', className, {
'Title--hovering': this.state.hovering
})
return (
<div className={titleClass}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}>
<div className='Title__icon Title__icon--left'>
<Tooltip content="Board Info" position="left">
<IconCircle
name={i.navbarInfo}
onClick={onCompose} />
</Tooltip>
</div>
<button
className='button'
onClick={onTitleClick}>
{children}
</button>
<div className='Title__icon Title__icon--right'>
<Tooltip content="View Archive" position="right">
<IconCircle
name={i.navbarArchive}
onClick={onRefresh} />
</Tooltip>
</div>
</div>
)
}
handleMouseEnter() {
this.setState({
hovering: true
});
}
handleMouseLeave() {
this.setState({
hovering: false
});
}
}
Title.displayName = 'Title';
export default Title;
| import './Title.styles';
import React, { Component, PropTypes } from 'react';
import cx from 'classnames'
import { Tooltip, IconCircle } from '~/components';
import {bindMembersToClass} from '~/utils/react'
const i = window.appSettings.icons
class Title extends Component {
constructor(props) {
super(props);
this.state = {
hovering: false
}
bindMembersToClass(this, 'handleMouseLeave', 'handleMouseEnter');
}
render () {
const {
className,
children,
onTitleClick,
onCompose,
onRefresh
} = this.props;
const titleClass = cx('Title', className, {
'Title--hovering': this.state.hovering
})
return (
<div className={titleClass}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}>
<button
className='button'
onClick={onTitleClick}>
{children}
</button>
</div>
)
}
handleMouseEnter() {
this.setState({
hovering: true
});
}
handleMouseLeave() {
this.setState({
hovering: false
});
}
}
Title.displayName = 'Title';
export default Title;
| Remove side buttons from title | refactor(Header): Remove side buttons from title
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -33,25 +33,11 @@
<div className={titleClass}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}>
- <div className='Title__icon Title__icon--left'>
- <Tooltip content="Board Info" position="left">
- <IconCircle
- name={i.navbarInfo}
- onClick={onCompose} />
- </Tooltip>
- </div>
<button
className='button'
onClick={onTitleClick}>
{children}
</button>
- <div className='Title__icon Title__icon--right'>
- <Tooltip content="View Archive" position="right">
- <IconCircle
- name={i.navbarArchive}
- onClick={onRefresh} />
- </Tooltip>
- </div>
</div>
)
} |
179722b1efc8bc238ddb0606c1310c2f817919bb | web/component/nag-data-collection.jsx | web/component/nag-data-collection.jsx | // @flow
import React from 'react';
import Nag from 'component/common/nag';
import I18nMessage from 'component/i18nMessage';
import Button from 'component/button';
import useIsMobile from 'effects/use-is-mobile';
type Props = {
onClose: () => void,
};
export default function NagDegradedPerformance(props: Props) {
const { onClose } = props;
const isMobile = useIsMobile();
return (
<React.Fragment>
{isMobile ? (
<Nag
message={
<I18nMessage
tokens={{
more_information: (
<Button button="link" label={__('more')} href="https://lbry.com/faq/privacy-and-data" />
),
}}
>
lbry.tv collects usage information for itself and third parties (%more_information%).
</I18nMessage>
}
actionText={__('OK')}
onClick={onClose}
/>
) : (
<Nag
message={
<I18nMessage
tokens={{
more_information: (
<Button button="link" label={__('more')} href="https://lbry.com/faq/privacy-and-data" />
),
}}
>
lbry.tv collects usage information for itself and third parties (%more_information%). Want control over
this and more?
</I18nMessage>
}
actionText={__('Get The App')}
href="https://lbry.com/get"
onClose={onClose}
/>
)}
</React.Fragment>
);
}
| // @flow
import React from 'react';
import Nag from 'component/common/nag';
import I18nMessage from 'component/i18nMessage';
import Button from 'component/button';
import useIsMobile from 'effects/use-is-mobile';
type Props = {
onClose: () => void,
};
export default function NagDegradedPerformance(props: Props) {
const { onClose } = props;
const isMobile = useIsMobile();
return (
<React.Fragment>
{isMobile ? (
<Nag
message={
<I18nMessage
tokens={{
more_information: (
<Button button="link" label={__('more')} href="https://lbry.com/faq/privacy-and-data" />
),
}}
>
lbry.tv collects usage information for itself only (%more_information%).
</I18nMessage>
}
actionText={__('OK')}
onClick={onClose}
/>
) : (
<Nag
message={
<I18nMessage
tokens={{
more_information: (
<Button button="link" label={__('more')} href="https://lbry.com/faq/privacy-and-data" />
),
}}
>
lbry.tv collects usage information for itself and third parties (%more_information%). Want control over
this and more?
</I18nMessage>
}
actionText={__('Get The App')}
href="https://lbry.com/get"
onClose={onClose}
/>
)}
</React.Fragment>
);
}
| Update message about third party sharing | Update message about third party sharing | JSX | mit | lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron | ---
+++
@@ -25,7 +25,7 @@
),
}}
>
- lbry.tv collects usage information for itself and third parties (%more_information%).
+ lbry.tv collects usage information for itself only (%more_information%).
</I18nMessage>
}
actionText={__('OK')} |
8490e5854c4b667d7e8be758d293512db2e710a0 | src/components/Session/AddTrustFromDirectory.jsx | src/components/Session/AddTrustFromDirectory.jsx | const React = window.React = require('react');
import AssetCard from '../AssetCard.jsx';
import AddTrustFromDirectoryRow from './AddTrustFromDirectoryRow.jsx';
import directory from '../../directory';
import _ from 'lodash';
export default class AddTrustFromDirectory extends React.Component {
constructor(props) {
super(props);
}
render() {
let asset = new StellarSdk.Asset('USD', 'GBZ3P4Z53Z7ZHATW6KCA2OXEBWKQGN2433WMSMKF7OJXWFJL4JT6NG4V');
return <div className="so-back">
<div className="island">
<div className="island__header">
Add trust from known anchors
</div>
<div className="island__paddedContent">
<p>This is a list of anchors from the Stellar community. Note: StellarTerm does not endorse any of these anchors.</p>
</div>
<div className="AddTrustFromDirectory">
<AddTrustFromDirectoryRow d={this.props.d} asset={asset}></AddTrustFromDirectoryRow>
</div>
</div>
</div>
}
}
| const React = window.React = require('react');
import AssetCard from '../AssetCard.jsx';
import AddTrustFromDirectoryRow from './AddTrustFromDirectoryRow.jsx';
import directory from '../../directory';
import _ from 'lodash';
export default class AddTrustFromDirectory extends React.Component {
constructor(props) {
super(props);
}
render() {
let rows = [];
_.each(directory.getAllSources(), source => {
_.each(source.assets, assetObj => {
let asset = new StellarSdk.Asset(assetObj.code, assetObj.issuer);
const key = assetObj.code + assetObj.issuer;
rows.push(<AddTrustFromDirectoryRow key={key} d={this.props.d} asset={asset}></AddTrustFromDirectoryRow>);
})
})
return <div className="so-back">
<div className="island">
<div className="island__header">
Add trust from known anchors
</div>
<div className="island__paddedContent">
<p>This is a list of anchors from the Stellar community. Note: StellarTerm does not endorse any of these anchors.</p>
</div>
<div className="AddTrustFromDirectory">
{rows}
</div>
</div>
</div>
}
}
| Implement pulling data from directory in adding trust | Implement pulling data from directory in adding trust
| JSX | apache-2.0 | irisli/stellarterm,irisli/stellarterm,irisli/stellarterm | ---
+++
@@ -9,7 +9,14 @@
super(props);
}
render() {
- let asset = new StellarSdk.Asset('USD', 'GBZ3P4Z53Z7ZHATW6KCA2OXEBWKQGN2433WMSMKF7OJXWFJL4JT6NG4V');
+ let rows = [];
+ _.each(directory.getAllSources(), source => {
+ _.each(source.assets, assetObj => {
+ let asset = new StellarSdk.Asset(assetObj.code, assetObj.issuer);
+ const key = assetObj.code + assetObj.issuer;
+ rows.push(<AddTrustFromDirectoryRow key={key} d={this.props.d} asset={asset}></AddTrustFromDirectoryRow>);
+ })
+ })
return <div className="so-back">
<div className="island">
<div className="island__header">
@@ -19,7 +26,7 @@
<p>This is a list of anchors from the Stellar community. Note: StellarTerm does not endorse any of these anchors.</p>
</div>
<div className="AddTrustFromDirectory">
- <AddTrustFromDirectoryRow d={this.props.d} asset={asset}></AddTrustFromDirectoryRow>
+ {rows}
</div>
</div>
</div> |
d02fccdd343817cb5dfbdc12de69377c2b07edc0 | src/ModalContainer/index.jsx | src/ModalContainer/index.jsx | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import * as styles from './styles';
export default class ModalContaner extends Component {
static propTypes = {
children: PropTypes.node,
onOverlayClick: PropTypes.func.isRequired,
};
componentDidUpdate(prevProps) {
const html = document.body.parentNode;
if (prevProps.children && !this.props.children) {
// Disapeared
this.rightOffset = 0;
html.style.borderRight = null;
html.style.overflow = null;
} else if (!prevProps.children && this.props.children) {
// Appeared
const prevTotalWidth = html.offsetWidth;
html.style.overflow = 'hidden';
const nextTotalWidth = html.offsetWidth;
const rightOffset = Math.max(0, nextTotalWidth - prevTotalWidth);
html.style.borderRight = `${rightOffset}px solid transparent`
}
}
stopPropogation = e => e.stopPropagation();
render() {
const { children, onOverlayClick } = this.props;
if (!children) return null;
return (
<div
style={styles.overlay}
onClick={onOverlayClick}
>
<div
key="content"
style={styles.modal}
onClick={this.stopPropogation}
>
{children}
</div>
</div>
);
}
};
| import React, { Component } from 'react';
import PropTypes from 'prop-types';
import * as styles from './styles';
export default class ModalContainer extends Component {
static propTypes = {
children: PropTypes.node,
onOverlayClick: PropTypes.func.isRequired,
};
componentDidUpdate(prevProps) {
const html = document.body.parentNode;
if (prevProps.children && !this.props.children) {
// Disapeared
this.rightOffset = 0;
html.style.borderRight = null;
html.style.overflow = null;
} else if (!prevProps.children && this.props.children) {
// Appeared
const prevTotalWidth = html.offsetWidth;
html.style.overflow = 'hidden';
const nextTotalWidth = html.offsetWidth;
const rightOffset = Math.max(0, nextTotalWidth - prevTotalWidth);
html.style.borderRight = `${rightOffset}px solid transparent`
}
}
stopPropogation = e => e.stopPropagation();
render() {
const { children, onOverlayClick } = this.props;
if (!children) return null;
return (
<div
style={styles.overlay}
onClick={onOverlayClick}
>
<div
key="content"
style={styles.modal}
onClick={this.stopPropogation}
>
{children}
</div>
</div>
);
}
};
| Rename class to remove spelling mistake. | Rename class to remove spelling mistake.
Should have no impact as it is the default export.
| JSX | mit | andykog/mobx-devtools,mobxjs/mobx-react-devtools,mweststrate/mobservable-react-devtools,andykog/mobx-devtools | ---
+++
@@ -2,7 +2,7 @@
import PropTypes from 'prop-types';
import * as styles from './styles';
-export default class ModalContaner extends Component {
+export default class ModalContainer extends Component {
static propTypes = {
children: PropTypes.node, |
b65c4104b4d8e0d8e60053b459378672c16ff13e | internal_packages/composer-emojis/lib/emoji-picker.jsx | internal_packages/composer-emojis/lib/emoji-picker.jsx | import {React} from 'nylas-exports'
import EmojiActions from './emoji-actions'
const emoji = require('node-emoji');
class EmojiPicker extends React.Component {
static displayName = "EmojiPicker";
static propTypes = {
emojiOptions: React.PropTypes.array,
selectedEmoji: React.PropTypes.string,
};
constructor(props) {
super(props);
this.state = {};
}
componentDidUpdate() {
const selectedButton = React.findDOMNode(this).querySelector(".emoji-option");
if (selectedButton) {
selectedButton.scrollIntoViewIfNeeded();
}
}
onMouseDown(emojiChar) {
EmojiActions.selectEmoji({emojiChar});
}
render() {
const emojis = [];
let emojiIndex = this.props.emojiOptions.indexOf(this.props.selectedEmoji);
if (emojiIndex === -1) emojiIndex = 0;
if (this.props.emojiOptions) {
this.props.emojiOptions.forEach((emojiOption, i) => {
const emojiChar = emoji.get(emojiOption);
const emojiClass = emojiIndex === i ? "btn btn-icon emoji-option" : "btn btn-icon";
emojis.push(<button key={emojiChar} onMouseDown={() => this.onMouseDown(emojiChar)} className={emojiClass}>{emojiChar} :{emojiOption}:</button>);
emojis.push(<br key={emojiChar+" br"} />);
})
}
return (
<div className="emoji-picker">
{emojis}
</div>
);
}
}
export default EmojiPicker;
| import {React} from 'nylas-exports'
import EmojiActions from './emoji-actions'
const emoji = require('node-emoji');
class EmojiPicker extends React.Component {
static displayName = "EmojiPicker";
static propTypes = {
emojiOptions: React.PropTypes.array,
selectedEmoji: React.PropTypes.string,
};
constructor(props) {
super(props);
this.state = {};
}
componentDidUpdate() {
const selectedButton = React.findDOMNode(this).querySelector(".emoji-option");
if (selectedButton) {
selectedButton.scrollIntoViewIfNeeded();
}
}
onMouseDown(emojiChar) {
EmojiActions.selectEmoji({emojiChar});
}
render() {
const emojis = [];
let emojiIndex = this.props.emojiOptions.indexOf(this.props.selectedEmoji);
if (emojiIndex === -1) emojiIndex = 0;
if (this.props.emojiOptions) {
this.props.emojiOptions.forEach((emojiOption, i) => {
const emojiChar = emoji.get(emojiOption);
const emojiClass = emojiIndex === i ? "btn btn-icon emoji-option" : "btn btn-icon";
emojis.push(<button key={emojiChar} onMouseDown={() => this.onMouseDown(emojiChar)} className={emojiClass}>{emojiChar} :{emojiOption}:</button>);
emojis.push(<br key={emojiChar + " br"} />);
})
}
return (
<div className="emoji-picker">
{emojis}
</div>
);
}
}
export default EmojiPicker;
| Fix lint failure from spacing | lint(emoji): Fix lint failure from spacing
| JSX | mit | nylas-mail-lives/nylas-mail,simonft/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,nirmit/nylas-mail,nirmit/nylas-mail,nylas-mail-lives/nylas-mail,nirmit/nylas-mail,nylas-mail-lives/nylas-mail,simonft/nylas-mail,nylas/nylas-mail,nylas/nylas-mail,nylas-mail-lives/nylas-mail,nirmit/nylas-mail,simonft/nylas-mail,nylas/nylas-mail,nylas/nylas-mail,nirmit/nylas-mail,simonft/nylas-mail,nylas/nylas-mail | ---
+++
@@ -34,7 +34,7 @@
const emojiChar = emoji.get(emojiOption);
const emojiClass = emojiIndex === i ? "btn btn-icon emoji-option" : "btn btn-icon";
emojis.push(<button key={emojiChar} onMouseDown={() => this.onMouseDown(emojiChar)} className={emojiClass}>{emojiChar} :{emojiOption}:</button>);
- emojis.push(<br key={emojiChar+" br"} />);
+ emojis.push(<br key={emojiChar + " br"} />);
})
}
return ( |
7dabfba02ec748e09e18904435f5092d7bb5001a | lib/components/input-email/InputEmail.jsx | lib/components/input-email/InputEmail.jsx | import validate from './validations';
import Input from '../input/Input';
export default class InputEmail extends Input {
static defaultProps = {
validate: validate
};
constructor(props) {
super(props);
}
}
| import React from 'react';
import classnames from 'classnames';
import validate from './validations';
import Input from '../input/Input';
import FieldComponent from '../FieldComponent';
export default class InputEmail extends FieldComponent {
static defaultProps = {
validate: validate
};
getValue() {
return this.refs[this.name].getValue();
}
setValidationMessages(messages: string[]) {
this.refs[this.name].setValidationMessages(messages);
}
render() {
const className = classnames('InputEmail', this.props.className);
return (
<Input className={className}
ref={this.name}
{...this.props}
validate={(value) => validate(value, this.props.maxDecimalPlaces, this.props.min)} />
);
}
}
| Make inputemail component as controlled component | Make inputemail component as controlled component
| JSX | mit | drioemgaoin/react-responsive-form,drioemgaoin/react-responsive-form | ---
+++
@@ -1,12 +1,31 @@
+import React from 'react';
+import classnames from 'classnames';
+
import validate from './validations';
import Input from '../input/Input';
-export default class InputEmail extends Input {
+import FieldComponent from '../FieldComponent';
+
+export default class InputEmail extends FieldComponent {
static defaultProps = {
validate: validate
};
- constructor(props) {
- super(props);
+ getValue() {
+ return this.refs[this.name].getValue();
+ }
+
+ setValidationMessages(messages: string[]) {
+ this.refs[this.name].setValidationMessages(messages);
+ }
+
+ render() {
+ const className = classnames('InputEmail', this.props.className);
+ return (
+ <Input className={className}
+ ref={this.name}
+ {...this.props}
+ validate={(value) => validate(value, this.props.maxDecimalPlaces, this.props.min)} />
+ );
}
} |
abdcfec66a83eb906e9bd5280c394445f7abf135 | src/sentry/static/sentry/app/utils/deviceNameMapper.jsx | src/sentry/static/sentry/app/utils/deviceNameMapper.jsx | import iOSDeviceList from 'ios-device-list';
export default function(model) {
const modelIdentifier = model.split(' ')[0];
const modelId = model.split(' ').splice(1).join(' ');
const modelName = iOSDeviceList.generationByIdentifier(modelIdentifier);
return modelName === undefined ? model : modelName + ' ' + modelId;
}
| import iOSDeviceList from 'ios-device-list';
export default function(model) {
if (!model) {
return null;
}
const modelIdentifier = model.split(' ')[0];
const modelId = model.split(' ').splice(1).join(' ');
const modelName = iOSDeviceList.generationByIdentifier(modelIdentifier);
return modelName === undefined ? model : modelName + ' ' + modelId;
}
| Make the device mapper work with null and undefined | Make the device mapper work with null and undefined
| JSX | bsd-3-clause | JackDanger/sentry,jean/sentry,ifduyue/sentry,beeftornado/sentry,ifduyue/sentry,BuildingLink/sentry,zenefits/sentry,mvaled/sentry,zenefits/sentry,JackDanger/sentry,gencer/sentry,zenefits/sentry,mvaled/sentry,looker/sentry,looker/sentry,JamesMura/sentry,gencer/sentry,JamesMura/sentry,ifduyue/sentry,BuildingLink/sentry,BuildingLink/sentry,jean/sentry,gencer/sentry,zenefits/sentry,looker/sentry,gencer/sentry,jean/sentry,looker/sentry,jean/sentry,mvaled/sentry,beeftornado/sentry,JamesMura/sentry,beeftornado/sentry,BuildingLink/sentry,ifduyue/sentry,JackDanger/sentry,zenefits/sentry,gencer/sentry,ifduyue/sentry,mvaled/sentry,JamesMura/sentry,jean/sentry,looker/sentry,JamesMura/sentry,mvaled/sentry,BuildingLink/sentry,mvaled/sentry | ---
+++
@@ -1,8 +1,11 @@
import iOSDeviceList from 'ios-device-list';
export default function(model) {
- const modelIdentifier = model.split(' ')[0];
- const modelId = model.split(' ').splice(1).join(' ');
- const modelName = iOSDeviceList.generationByIdentifier(modelIdentifier);
- return modelName === undefined ? model : modelName + ' ' + modelId;
+ if (!model) {
+ return null;
+ }
+ const modelIdentifier = model.split(' ')[0];
+ const modelId = model.split(' ').splice(1).join(' ');
+ const modelName = iOSDeviceList.generationByIdentifier(modelIdentifier);
+ return modelName === undefined ? model : modelName + ' ' + modelId;
} |
d7b162603bf2cd1b5ff390c83a6320bfa238ab64 | frontend/registrar_client/registrar_client.jsx | frontend/registrar_client/registrar_client.jsx | const io = require('socket.io-client'),
config = require('./config.js');
const UnichatRegistrarClient = {
_registrarUrl: null,
_socket: null,
init(registrarUrl) {
this._registrarUrl = registrarUrl;
this._socket = io.connect(this._registrarUrl, {'forceNew': true});
this._socket.on('connect', () => {
console.log('Connected');
this._socket.emit('client-hello');
});
this._socket.on('disconnect', () => {
console.log('Registrar disconnected');
});
},
};
UnichatRegistrarClient.init(config.REGISTRAR_URL);
| const io = require('socket.io-client'),
config = require('./config.js');
const UnichatRegistrarClient = {
_registrarUrl: null,
_socket: null,
init(registrarUrl) {
this._registrarUrl = registrarUrl;
this._socket = io.connect(this._registrarUrl, {'forceNew': true});
this._socket.on('connect', () => {
console.log('Connected');
this._socket.emit('client-hello');
});
this._socket.on('disconnect', () => {
console.log('Registrar disconnected');
});
this._socket.on('server-hello', () => {
let _form = {
email: '[email protected]',
sex: 1,
password: 'password',
password_confirmation: 'password',
UniversityId: 1
};
this.register(_form);
});
this._socket.on('server-register', (data) => {
console.log('Registration complete: ' + data.message);
});
},
register(form) {
console.log('Registering...');
this._socket.emit('register', form);
},
},
};
UnichatRegistrarClient.init(config.REGISTRAR_URL);
| Add initial register client function and listener | Add initial register client function and listener
| JSX | mit | dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet | ---
+++
@@ -14,6 +14,24 @@
this._socket.on('disconnect', () => {
console.log('Registrar disconnected');
});
+ this._socket.on('server-hello', () => {
+ let _form = {
+ email: '[email protected]',
+ sex: 1,
+ password: 'password',
+ password_confirmation: 'password',
+ UniversityId: 1
+ };
+ this.register(_form);
+ });
+ this._socket.on('server-register', (data) => {
+ console.log('Registration complete: ' + data.message);
+ });
+ },
+ register(form) {
+ console.log('Registering...');
+ this._socket.emit('register', form);
+ },
},
};
|
0b7c45683f39e72277774f2a77a050a37224c1bf | src/components/Footer.jsx | src/components/Footer.jsx | import React from 'react';
import { Link } from 'react-router';
export default function Footer() {
return (
<div className="block footer">
<div className="wrap">
<div className="footer-nav">
<Link to="/">Home</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link>
</div>
<small className="text-center">
© {new Date().getFullYear()}, Andrew Wang
</small>
</div>
</div>
);
}
| import React from 'react';
import { Link } from 'react-router';
import Icon from './Icons';
import iconPaths from '../data/iconPaths';
export default function Footer() {
return (
<div className="block footer">
<div className="wrap">
<div className="footer-nav">
<Link to="/">Home</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link>
</nav>
<div className="social">
{/* <a href="https://www.linkedin.com/in/andrew-wang-02573868">
<Icon className="icon" icon={iconPaths.linkedin} />
</a> */}
<a href="https://github.com/emyarod">
<Icon className="icon" icon={iconPaths.github} />
</a>
<a href="http://codepen.io/emyarod/">
<Icon className="icon" icon={iconPaths.codepen} />
</a>
</div>
<small className="text-center">
© {new Date().getFullYear()}, Andrew Wang
</small>
</div>
</div>
);
}
| Add social icons to footer | Add social icons to footer
| JSX | mit | emyarod/afw,emyarod/afw | ---
+++
@@ -1,5 +1,7 @@
import React from 'react';
import { Link } from 'react-router';
+import Icon from './Icons';
+import iconPaths from '../data/iconPaths';
export default function Footer() {
return (
@@ -9,6 +11,17 @@
<Link to="/">Home</Link>
<Link to="/portfolio">Portfolio</Link>
<Link to="/contact">Contact</Link>
+ </nav>
+ <div className="social">
+ {/* <a href="https://www.linkedin.com/in/andrew-wang-02573868">
+ <Icon className="icon" icon={iconPaths.linkedin} />
+ </a> */}
+ <a href="https://github.com/emyarod">
+ <Icon className="icon" icon={iconPaths.github} />
+ </a>
+ <a href="http://codepen.io/emyarod/">
+ <Icon className="icon" icon={iconPaths.codepen} />
+ </a>
</div>
<small className="text-center">
© {new Date().getFullYear()}, Andrew Wang |
3019f9bd99e0841ff7e5c067d6fbf2a77191831a | app/routes/confirm/containers/SubmissionConfirmPanel.jsx | app/routes/confirm/containers/SubmissionConfirmPanel.jsx | import EditItemPanel from "../../shared/components/EditItemPanel"
import { connect } from "react-redux"
import { num, numSelected } from "../../../modules/submissions/selectors"
const mapStateToProps = (state) => ({
title: `${numSelected(state)}/${num(state)}`,
iconPath: "http://placehold.it/48x48",
subtitle: "Submissions Selected"
})
export default connect(mapStateToProps, null)(EditItemPanel)
| import ItemPanel from "../../shared/components/ItemPanel"
import { connect } from "react-redux"
import { num, numSelected } from "../../../modules/submissions/selectors"
const mapStateToProps = (state) => ({
title: `${numSelected(state)}/${num(state)}`,
imagePath: "http://placehold.it/48x48",
subtitle: "Submissions Selected"
})
export default connect(mapStateToProps, null)(ItemPanel)
| Remove edit button from submission confirm panel | Remove edit button from submission confirm panel
| JSX | mit | education/classroom-desktop,education/classroom-desktop,education/classroom-desktop,education/classroom-desktop | ---
+++
@@ -1,11 +1,11 @@
-import EditItemPanel from "../../shared/components/EditItemPanel"
+import ItemPanel from "../../shared/components/ItemPanel"
import { connect } from "react-redux"
import { num, numSelected } from "../../../modules/submissions/selectors"
const mapStateToProps = (state) => ({
title: `${numSelected(state)}/${num(state)}`,
- iconPath: "http://placehold.it/48x48",
+ imagePath: "http://placehold.it/48x48",
subtitle: "Submissions Selected"
})
-export default connect(mapStateToProps, null)(EditItemPanel)
+export default connect(mapStateToProps, null)(ItemPanel) |
d1a1038fad1bee7c34eeb585a5d067f2ca73d320 | client/app/app.jsx | client/app/app.jsx | App = React.createClass({
mixins: [ReactMeteorData],
getMeteorData() {
return {
submissions: Submissions.find({}).fetch(),
};
},
renderSubmissions() {
console.log('test it');
return this.data.submissions.map((submission) => {
return <Submission key={submission._id} submission={submission} />;
});
},
handleSubmit(event) {
event.preventDefault();
},
render() {
console.log(this.props);
return (
<div className="container">
<header>
<h1>Submissions</h1>
<form className='new-submission' onSubmit={this.handleSubmit} >
<input
type="text"
ref="textInput"
placeholder="Type to add new tasks" />
</form>
</header>
<ul>
{this.renderSubmissions()}
</ul>
</div>
);
},
});
| App = React.createClass({
mixins: [ReactMeteorData],
getMeteorData() {
return {
submissions: Submissions.find({}).fetch(),
};
},
renderSubmissions() {
console.log('test it');
return this.data.submissions.map((submission) => {
return <Submission key={submission._id} submission={submission} />;
});
},
handleSubmit(event) {
event.preventDefault();
// Pull text from field
var text = React.findDOMNode(this.refs.textInput).value.trim();
Submissions.insert({
text: text,
createdAt: new Date(),
});
// Clear form
React.findDOMNode(this.refs.textInput).value = '';
},
render() {
console.log(this.props);
return (
<div className="container">
<header>
<h1>Submissions</h1>
<form className='new-submission' onSubmit={this.handleSubmit} >
<input
type="text"
ref="textInput"
placeholder="Type to add new tasks" />
</form>
</header>
<ul>
{this.renderSubmissions()}
</ul>
</div>
// <News />
);
},
});
| Connect input to add new entries | Connect input to add new entries
| JSX | mit | MattReisman/newc,MattReisman/newc | ---
+++
@@ -16,6 +16,16 @@
handleSubmit(event) {
event.preventDefault();
+
+ // Pull text from field
+ var text = React.findDOMNode(this.refs.textInput).value.trim();
+ Submissions.insert({
+ text: text,
+ createdAt: new Date(),
+ });
+
+ // Clear form
+ React.findDOMNode(this.refs.textInput).value = '';
},
render() {
@@ -36,6 +46,7 @@
{this.renderSubmissions()}
</ul>
</div>
+// <News />
);
},
}); |
e3616072a75c09b23ad957b0d6cd1ff7a10abecf | app/assets/javascripts/components/dashboard.js.jsx | app/assets/javascripts/components/dashboard.js.jsx | class Dashboard extends React.Component {
// Receives the props being passed down from the App component.
constructor(props) {
super(props)
this.waterOne = this.props.waterOne
this.state = {
waterEvents: ''
}
}
render() {
console.log('Dashboard Rendered')
let sortedArr = _.sortBy(this.props.plants, 'updated_at', function(n) {
return n;
})
return (
<div className="wrapper">
{
sortedArr.map((value, index) => {
this.props.water.map((item, i) => {
if (item.plant_id == value.id) {
this.state.waterEvents = item
}
})
return (
<Card
key={value.id}
waterOne={this.waterOne}
data={value}
water={this.state.waterEvents} />
)
})
}
</div>
)
}
componentDidMount() {
console.log("Dashboard Mounted")
}
};
| class Dashboard extends React.Component {
// Receives the props being passed down from the App component.
constructor(props) {
super(props)
this.waterOne = this.props.waterOne
this.state = {
waterEvents: ''
}
}
render() {
console.log('Dashboard Rendered')
let sortedArr = _.sortBy(this.props.plants, 'updated_at', function(n) {
return n;
})
if (this.props.plants.length < 1){
return (
<div className="wrapper">
<div className="card">
<a href="/plants/">
<header className="plant-header">
<img className="plant-image" src="/favicon.ico"/>
<div className="plant-head">
<div className="plant-nickname">Example</div>
<div className="plant-common">Placeholder Card</div>
</div>
</header>
<div className="plant-content">
<div className="plant-details">Add plants of your own to view their information!</div>
</div>
</a>
<input
type="button"
value={"Water"}
className="card-button" />
</div>
</div>
)
}
else {
return (
<div className="wrapper">
{
sortedArr.map((value, index) => {
this.props.water.map((item, i) => {
if (item.plant_id == value.id) {
this.state.waterEvents = item
}
})
return (
<Card
key={value.id}
waterOne={this.waterOne}
data={value}
water={this.state.waterEvents} />
)
})
}
</div>
)
}
}
componentDidMount() {
console.log("Dashboard Mounted")
}
};
| Use example card in dashboard if user has no plants saved | Use example card in dashboard if user has no plants saved
| JSX | mit | Plantia/app,Plantia/app,Plantia/app | ---
+++
@@ -14,28 +14,53 @@
let sortedArr = _.sortBy(this.props.plants, 'updated_at', function(n) {
return n;
})
- return (
+ if (this.props.plants.length < 1){
+ return (
<div className="wrapper">
- {
- sortedArr.map((value, index) => {
- this.props.water.map((item, i) => {
- if (item.plant_id == value.id) {
- this.state.waterEvents = item
- }
+ <div className="card">
+ <a href="/plants/">
+ <header className="plant-header">
+ <img className="plant-image" src="/favicon.ico"/>
+ <div className="plant-head">
+ <div className="plant-nickname">Example</div>
+ <div className="plant-common">Placeholder Card</div>
+ </div>
+ </header>
+ <div className="plant-content">
+ <div className="plant-details">Add plants of your own to view their information!</div>
+ </div>
+ </a>
+ <input
+ type="button"
+ value={"Water"}
+ className="card-button" />
+ </div>
+ </div>
+ )
+ }
+ else {
+ return (
+ <div className="wrapper">
+ {
+ sortedArr.map((value, index) => {
+ this.props.water.map((item, i) => {
+ if (item.plant_id == value.id) {
+ this.state.waterEvents = item
+ }
+ })
+
+ return (
+ <Card
+ key={value.id}
+ waterOne={this.waterOne}
+ data={value}
+ water={this.state.waterEvents} />
+ )
})
-
- return (
- <Card
- key={value.id}
- waterOne={this.waterOne}
- data={value}
- water={this.state.waterEvents} />
- )
- })
- }
-
- </div>
- )
+ }
+ </div>
+ )
+ }
}
componentDidMount() { |
d1cced842fbfbd32e1bca5229440cc9314de5afc | client/components/TextView.jsx | client/components/TextView.jsx | import React from 'react';
import InputForm from './InputForm.jsx';
import TextAnalytics from './TextAnalytics.jsx';
export default class TextView extends React.Component {
constructor(props) {
super(props);
this.state = {
visibleAnalytics: false,
value: '',
};
}
analyzeText = () => {
this.setState({
visibleAnalytics: true,
});
}
resetText = () => {
this.setState({
visibleAnalytics: false,
value: '',
});
}
onChange = (e) => {
this.setState({
value: e.target.value,
});
}
render() {
let analytics = this.state.visibleAnalytics ? <TextAnalytics text={this.state.value}/> : '';
return (
<div>
<div id='text-input'>
<h1 id='text-input-title'>Text Analyzer</h1>
<br/>
<InputForm text={this.state.value} onChange={this.onChange}/>
<button onClick={this.analyzeText}>Analyze</button>
<button onClick={this.resetText}>Reset</button>
<div>{analytics}</div>
</div>
</div>
);
}
}
| import React from 'react';
import InputForm from './InputForm.jsx';
import TextAnalytics from './TextAnalytics.jsx';
export default class TextView extends React.Component {
constructor(props) {
super(props);
this.state = {
visibleAnalytics: false,
value: '',
};
}
analyzeText = () => {
this.setState({
visibleAnalytics: true,
});
}
resetText = () => {
this.setState({
visibleAnalytics: false,
value: '',
});
}
onChange = (e) => {
this.setState({
value: e.target.value,
});
}
render() {
let analytics = this.state.visibleAnalytics ? <TextAnalytics text={this.state.value}/> : '';
return (
<div>
<div id='text-input'>
<h1 id='text-input-title'>Text Analyzer</h1>
<br/>
<InputForm text={this.state.value} onChange={this.onChange}/>
<button onClick={this.analyzeText}>Analyze</button>
<button onClick={this.resetText}>Reset</button>
<div>{analytics}</div>
</div>
</div>
);
}
}
| Fix indentation in render call | Fix indentation in render call
| JSX | mit | nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor | ---
+++
@@ -26,7 +26,7 @@
}
onChange = (e) => {
- this.setState({
+ this.setState({
value: e.target.value,
});
}
@@ -39,9 +39,9 @@
<h1 id='text-input-title'>Text Analyzer</h1>
<br/>
<InputForm text={this.state.value} onChange={this.onChange}/>
- <button onClick={this.analyzeText}>Analyze</button>
- <button onClick={this.resetText}>Reset</button>
- <div>{analytics}</div>
+ <button onClick={this.analyzeText}>Analyze</button>
+ <button onClick={this.resetText}>Reset</button>
+ <div>{analytics}</div>
</div>
</div>
); |
8d873d46a0034476e763035d981615c719f32a98 | client/main.jsx | client/main.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import App from './components/App.jsx';
import Game from './components/Game.jsx';
import About from './components/About.jsx';
import { browserHistory, Router, Route, Redirect } from 'react-router';
require('./../public/main.css');
// import 'bootstrap/dist/css/bootstrap.css';
const Main = (
<Router history={browserHistory}>
<Redirect from="/" to="/play" />
<Route path="/" component={App}>
<Route path="about" component={About} />
<Route path="play" component={Game} />
</Route>
</Router>
);
ReactDOM.render(Main, document.getElementById('main'));
| import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import App from './components/App.jsx';
import Game from './components/Game.jsx';
import About from './components/About.jsx';
import { browserHistory, hashHistory, Router, Route, Redirect } from 'react-router';
require('./../public/main.css');
const Main = (
<Router history={hashHistory}>
<Redirect from="/" to="/play" />
<Route path="/" component={App}>
<Route path="about" component={About} />
<Route path="play" component={Game} />
</Route>
</Router>
);
ReactDOM.render(Main, document.getElementById('main'));
| Update router to use hashHistory | Update router to use hashHistory
| JSX | mit | OrderlyPhoenix/OrderlyPhoenix,OrderlyPhoenix/OrderlyPhoenix | ---
+++
@@ -4,13 +4,11 @@
import App from './components/App.jsx';
import Game from './components/Game.jsx';
import About from './components/About.jsx';
-import { browserHistory, Router, Route, Redirect } from 'react-router';
+import { browserHistory, hashHistory, Router, Route, Redirect } from 'react-router';
require('./../public/main.css');
-// import 'bootstrap/dist/css/bootstrap.css';
-
const Main = (
- <Router history={browserHistory}>
+ <Router history={hashHistory}>
<Redirect from="/" to="/play" />
<Route path="/" component={App}>
<Route path="about" component={About} /> |
fe16fb493dd2c6f077861b4870849ae04c7ef5f9 | web/static/js/components/idea.jsx | web/static/js/components/idea.jsx | import React from "react"
import classNames from "classnames"
import IdeaEditForm from "./idea_edit_form"
import IdeaLiveEditContent from "./idea_live_edit_content"
import IdeaReadOnlyContent from "./idea_read_only_content"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea.css"
const Idea = props => {
const { idea, currentUser, retroChannel, stage } = props
const classes = classNames(styles.index, {
[styles.highlighted]: idea.isHighlighted,
})
const userIsEditing = idea.editing && idea.editorToken === currentUser.token
let content
if (userIsEditing) {
content = (<IdeaEditForm
idea={idea}
retroChannel={retroChannel}
currentUser={currentUser}
stage={stage}
/>)
} else if (idea.liveEditText) {
content = <IdeaLiveEditContent idea={idea} />
} else {
content = <IdeaReadOnlyContent {...props} />
}
return (
<li className={classes} title={idea.body} key={idea.id}>
{ content }
</li>
)
}
Idea.propTypes = {
idea: AppPropTypes.idea.isRequired,
retroChannel: AppPropTypes.retroChannel.isRequired,
currentUser: AppPropTypes.user.isRequired,
stage: AppPropTypes.stage.isRequired,
}
export default Idea
| import React, { Component } from "react"
import classNames from "classnames"
import IdeaEditForm from "./idea_edit_form"
import IdeaLiveEditContent from "./idea_live_edit_content"
import IdeaReadOnlyContent from "./idea_read_only_content"
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea.css"
export default class Idea extends Component {
render() {
const { idea, currentUser, retroChannel, stage } = this.props
const classes = classNames(styles.index, {
[styles.highlighted]: idea.isHighlighted,
})
const userIsEditing = idea.editing && idea.editorToken === currentUser.token
let content
if (userIsEditing) {
content = (<IdeaEditForm
idea={idea}
retroChannel={retroChannel}
currentUser={currentUser}
stage={stage}
/>)
} else if (idea.liveEditText) {
content = <IdeaLiveEditContent idea={idea} />
} else {
content = <IdeaReadOnlyContent {...this.props} />
}
return (
<li className={classes} title={idea.body} key={idea.id}>
{ content }
</li>
)
}
}
Idea.propTypes = {
idea: AppPropTypes.idea.isRequired,
retroChannel: AppPropTypes.retroChannel.isRequired,
currentUser: AppPropTypes.user.isRequired,
stage: AppPropTypes.stage.isRequired,
}
| Refactor <Idea> to classical component | Refactor <Idea> to classical component
- will allow it to be rendered inside a flip component
| JSX | mit | samdec11/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro | ---
+++
@@ -1,4 +1,4 @@
-import React from "react"
+import React, { Component } from "react"
import classNames from "classnames"
import IdeaEditForm from "./idea_edit_form"
@@ -7,33 +7,35 @@
import * as AppPropTypes from "../prop_types"
import styles from "./css_modules/idea.css"
-const Idea = props => {
- const { idea, currentUser, retroChannel, stage } = props
- const classes = classNames(styles.index, {
- [styles.highlighted]: idea.isHighlighted,
- })
+export default class Idea extends Component {
+ render() {
+ const { idea, currentUser, retroChannel, stage } = this.props
+ const classes = classNames(styles.index, {
+ [styles.highlighted]: idea.isHighlighted,
+ })
- const userIsEditing = idea.editing && idea.editorToken === currentUser.token
+ const userIsEditing = idea.editing && idea.editorToken === currentUser.token
- let content
- if (userIsEditing) {
- content = (<IdeaEditForm
- idea={idea}
- retroChannel={retroChannel}
- currentUser={currentUser}
- stage={stage}
- />)
- } else if (idea.liveEditText) {
- content = <IdeaLiveEditContent idea={idea} />
- } else {
- content = <IdeaReadOnlyContent {...props} />
+ let content
+ if (userIsEditing) {
+ content = (<IdeaEditForm
+ idea={idea}
+ retroChannel={retroChannel}
+ currentUser={currentUser}
+ stage={stage}
+ />)
+ } else if (idea.liveEditText) {
+ content = <IdeaLiveEditContent idea={idea} />
+ } else {
+ content = <IdeaReadOnlyContent {...this.props} />
+ }
+
+ return (
+ <li className={classes} title={idea.body} key={idea.id}>
+ { content }
+ </li>
+ )
}
-
- return (
- <li className={classes} title={idea.body} key={idea.id}>
- { content }
- </li>
- )
}
Idea.propTypes = {
@@ -43,4 +45,3 @@
stage: AppPropTypes.stage.isRequired,
}
-export default Idea |
5e9798c255a32e40d7b201c5f7f48964916e0dab | src/sentry/static/sentry/app/components/dropdownButton.jsx | src/sentry/static/sentry/app/components/dropdownButton.jsx | import PropTypes from 'prop-types';
import React from 'react';
import styled from 'react-emotion';
import Button from './buttons/button';
import InlineSvg from './inlineSvg';
const DropdownButton = ({isOpen, children}) => {
return (
<StyledButton isOpen={isOpen}>
<StyledChevronDown />
{children}
</StyledButton>
);
};
DropdownButton.propTypes = {
isOpen: PropTypes.bool,
};
const StyledChevronDown = styled(props => (
<InlineSvg src="icon-chevron-down" {...props} />
))`
margin-right: 0.5em;
`;
const StyledButton = styled(props => <Button {...props} />)`
border-bottom-right-radius: ${p => (p.isOpen ? 0 : p.theme.borderRadius)};
border-bottom-left-radius: ${p => (p.isOpen ? 0 : p.theme.borderRadius)};
position: relative;
z-index; 1;
box-shadow: none;
&, &:hover { border-bottom-color: ${p =>
p.isOpen ? 'transparent' : p.theme.borderDark};}
`;
export default DropdownButton;
| import PropTypes from 'prop-types';
import React from 'react';
import styled from 'react-emotion';
import Button from './buttons/button';
import InlineSvg from './inlineSvg';
const DropdownButton = ({isOpen, children}) => {
return (
<StyledButton isOpen={isOpen}>
<StyledChevronDown />
{children}
</StyledButton>
);
};
DropdownButton.propTypes = {
isOpen: PropTypes.bool,
};
const StyledChevronDown = styled(props => (
<InlineSvg src="icon-chevron-down" {...props} />
))`
margin-right: 0.5em;
`;
const StyledButton = styled(props => <Button {...props} />)`
border-bottom-right-radius: ${p => (p.isOpen ? 0 : p.theme.borderRadius)};
border-bottom-left-radius: ${p => (p.isOpen ? 0 : p.theme.borderRadius)};
position: relative;
z-index: 1;
box-shadow: none;
&, &:hover { border-bottom-color: ${p =>
p.isOpen ? 'transparent' : p.theme.borderDark};}
`;
export default DropdownButton;
| Fix css syntax error in dropdown button component | fix(ui): Fix css syntax error in dropdown button component
| JSX | bsd-3-clause | beeftornado/sentry,mvaled/sentry,ifduyue/sentry,beeftornado/sentry,ifduyue/sentry,mvaled/sentry,ifduyue/sentry,mvaled/sentry,looker/sentry,looker/sentry,mvaled/sentry,mvaled/sentry,looker/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,looker/sentry,ifduyue/sentry,beeftornado/sentry | ---
+++
@@ -27,7 +27,7 @@
border-bottom-right-radius: ${p => (p.isOpen ? 0 : p.theme.borderRadius)};
border-bottom-left-radius: ${p => (p.isOpen ? 0 : p.theme.borderRadius)};
position: relative;
- z-index; 1;
+ z-index: 1;
box-shadow: none;
&, &:hover { border-bottom-color: ${p => |
8cfe89b02bdfeedc0203cacdfe8908a93661df5c | views/components/Date.jsx | views/components/Date.jsx | 'use babel';
import React from 'react';
import Moment from 'moment';
export default class Date extends React.Component {
render() {
return <div className="date">
<div className="calendar">
<div className="day">{Moment().date()}</div>
<div className="my">
<div className="month">{Moment().format('MMM')}</div>
<div className="year">{Moment().year()}</div>
</div>
</div>
<div className="today">{Moment().format('dddd')}</div>
</div>;
}
}
| 'use babel';
import React from 'react';
import Moment from 'moment';
export default class Date extends React.Component {
constructor() {
super();
this.state = { day: '',
month: '',
year: '',
weekday: ''
};
}
componentWillMount() {
this.setDate();
}
componentDidMount() {
window.setInterval(function () {
if (this.state.day !== Moment.date()) {
this.setDate();
}
}.bind(this), 1000);
}
setDate() {
this.setState({
day: Moment().date(),
month: Moment().format('MMM'),
year: Moment().year(),
weekday: Moment().format('dddd')
});
}
render() {
return <div className="date">
<div className="calendar">
<div className="day">{this.state.day}</div>
<div className="my">
<div className="month">{this.state.month}</div>
<div className="year">{this.state.year}</div>
</div>
</div>
<div className="today">{this.state.weekday}</div>
</div>;
}
}
| Move date info to state | Move date info to state
| JSX | mit | jdebarochez/todometer,jdebarochez/todometer,cassidoo/todometer,cassidoo/todometer | ---
+++
@@ -4,16 +4,46 @@
import Moment from 'moment';
export default class Date extends React.Component {
+ constructor() {
+ super();
+ this.state = { day: '',
+ month: '',
+ year: '',
+ weekday: ''
+ };
+ }
+
+ componentWillMount() {
+ this.setDate();
+ }
+
+ componentDidMount() {
+ window.setInterval(function () {
+ if (this.state.day !== Moment.date()) {
+ this.setDate();
+ }
+ }.bind(this), 1000);
+ }
+
+ setDate() {
+ this.setState({
+ day: Moment().date(),
+ month: Moment().format('MMM'),
+ year: Moment().year(),
+ weekday: Moment().format('dddd')
+ });
+ }
+
render() {
return <div className="date">
<div className="calendar">
- <div className="day">{Moment().date()}</div>
+ <div className="day">{this.state.day}</div>
<div className="my">
- <div className="month">{Moment().format('MMM')}</div>
- <div className="year">{Moment().year()}</div>
+ <div className="month">{this.state.month}</div>
+ <div className="year">{this.state.year}</div>
</div>
</div>
- <div className="today">{Moment().format('dddd')}</div>
+ <div className="today">{this.state.weekday}</div>
</div>;
}
} |
de6bc441e500a338ad57ff0d14befd38908ce4e6 | src/components/list.jsx | src/components/list.jsx | import React, { Component, PropTypes } from 'react';
export default class List extends Component {
static propTypes = {
className: PropTypes.string,
Item: PropTypes.func.isRequired,
items: PropTypes.arrayOf(
PropTypes.shape({ id: PropTypes.number.isRequired })
).isRequired,
onSelect: PropTypes.func.isRequired
};
static defaultProps = {
className: 'list'
};
render() {
const { className, Item, items, onSelect } = this.props;
return <ul className={className}>
{items.map(item =>
<li key={item.id}>
<Item {...item} onSelect={() => { onSelect({ id: item.id }); }} />
</li>
)}
</ul>;
}
}
| import React, { Component, PropTypes } from 'react';
export default class List extends Component {
static propTypes = {
className: PropTypes.string,
Item: PropTypes.func.isRequired,
items: PropTypes.arrayOf(
// TODO: create an interface for Item
PropTypes.shape({ id: PropTypes.number.isRequired })
).isRequired,
onSelect: PropTypes.func.isRequired
};
static defaultProps = {
className: 'list'
};
render() {
const { className, Item, items, onSelect } = this.props;
return <ul className={className}>
{items.map(item =>
<li key={item.id}>
<Item {...item} onSelect={() => { onSelect({ id: item.id }); }} />
</li>
)}
</ul>;
}
}
| Add TODO to create an interface for Item | Add TODO to create an interface for Item
| JSX | mit | NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet,NiGhTTraX/react-test-buffet | ---
+++
@@ -6,6 +6,7 @@
className: PropTypes.string,
Item: PropTypes.func.isRequired,
items: PropTypes.arrayOf(
+ // TODO: create an interface for Item
PropTypes.shape({ id: PropTypes.number.isRequired })
).isRequired,
onSelect: PropTypes.func.isRequired |
b51b36d66fe80df3e8c023f823c79efdf296df3c | app/assets/javascripts/mixins/event.js.jsx | app/assets/javascripts/mixins/event.js.jsx | (function() {
var EventMixin = {
timestamp: function(story) {
return moment(story || this.props.story.created).format("ddd, hA")
},
subjectMap: {
Discussion: function(discussion) {
return 'a discussion';
},
Post: function(post) {
return 'a new blog post'
},
Task: function(task) {
if (task) {
return "#" + task.number + " " + task.title;
}
},
Wip: function(wip) {
if (wip) {
return "#" + task.number + " " + task.title;
}
}
},
verbMap: {
'Award': 'awarded',
'Close': 'closed ',
'Comment': 'commented on ',
'Post': 'published ',
'Start': 'started '
}
};
if (typeof module !== 'undefined') {
module.exports = EventMixin;
}
window.EventMixin = EventMixin;
})();
| (function() {
var EventMixin = {
timestamp: function(story) {
return moment(story || this.props.story.created).format("ddd, hA")
},
subjectMap: {
Discussion: function(discussion) {
return 'a discussion';
},
Post: function(post) {
return 'a new blog post'
},
Task: function(task) {
if (task) {
return "#" + task.number + " " + task.title;
}
},
Wip: function(wip) {
if (wip) {
return "#" + wip.number + " " + wip.title;
}
}
},
verbMap: {
'Award': 'awarded',
'Close': 'closed ',
'Comment': 'commented on ',
'Post': 'published ',
'Start': 'started '
}
};
if (typeof module !== 'undefined') {
module.exports = EventMixin;
}
window.EventMixin = EventMixin;
})();
| Fix typo in event mixin (how was that ever working?) | Fix typo in event mixin (how was that ever working?)
| JSX | agpl-3.0 | lachlanjc/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta,assemblymade/meta,lachlanjc/meta,assemblymade/meta,assemblymade/meta | ---
+++
@@ -20,7 +20,7 @@
},
Wip: function(wip) {
if (wip) {
- return "#" + task.number + " " + task.title;
+ return "#" + wip.number + " " + wip.title;
}
}
}, |
86d475c80051c0485c28b6e546d76f1a3ce35678 | src/components/Main.jsx | src/components/Main.jsx | import React from 'react'
import styles from './main.css'
const Main = (props) => (
<div className={styles.main} {...props} />
)
export default Main
| import React from 'react'
import styles from './Main.css'
const Main = (props) => (
<div className={styles.main} {...props} />
)
export default Main
| Refactor react-router and redux logic | Refactor react-router and redux logic
| JSX | mit | Snapflixapp/webpack-react-app,Snapflixapp/webpack-react-app | ---
+++
@@ -1,5 +1,5 @@
import React from 'react'
-import styles from './main.css'
+import styles from './Main.css'
const Main = (props) => (
<div className={styles.main} {...props} /> |
1a9760ce362df207f2113c775b84bdd0cfe571e9 | client/sections/conversations/components/Conversations.jsx | client/sections/conversations/components/Conversations.jsx | import React from 'react';
import Rooms from './Rooms.jsx';
import Messages from './Messages.jsx';
import Input from './Input.jsx';
import Button from './Button.jsx';
import VideoRequestButton from './VideoRequestButton.jsx';
// FIXME add handleOnVideo
// current room will always be the first object in rooms (i.e. rooms[0])
const Conversations = ({ user, rooms, inputText, handleRoomChange, handleTextInput, handleOnSend, handleVideoRequestClick }) => {
const currRoom = rooms[0] || { id: 0, messages: [], users: [] };
const msgTemplate = {
roomId: currRoom.id,
from: { firstName: user.firstName, lastName: user.lastName },
body: '',
};
return (
<div className="chatapp">
<div>
<Rooms rooms={rooms} currentRoom={currRoom} handleRoomChange={handleRoomChange} />
</div>
<div>
<div>
<Messages messages={currRoom.messages} />
</div>
<Input msgTemplate={msgTemplate} inputText={inputText} handleOnSend={handleOnSend} handleTextInput={handleTextInput} />
<Button msgTemplate={msgTemplate} inputText={inputText} handleOnSend={handleOnSend} />
<VideoRequestButton handleVideoRequestClick={handleVideoRequestClick} otherId={rooms[0].users[0].id} />
</div>
</div>
);
};
export default Conversations;
| import React from 'react';
import Rooms from './Rooms.jsx';
import Messages from './Messages.jsx';
import Input from './Input.jsx';
import Button from './Button.jsx';
import VideoRequestButton from './VideoRequestButton.jsx';
// FIXME add handleOnVideo
// current room will always be the first object in rooms (i.e. rooms[0])
const Conversations = ({ user, rooms, inputText, handleRoomChange, handleTextInput, handleOnSend, handleVideoRequestClick }) => {
const currRoom = rooms[0] || { id: 0, messages: [], users: [] };
const msgTemplate = {
roomId: currRoom.id,
from: { firstName: user.firstName, lastName: user.lastName },
body: '',
};
return (
<div className="chatapp">
<div>
<Rooms rooms={rooms} currentRoom={currRoom} handleRoomChange={handleRoomChange} />
</div>
<div>
<div>
<Messages messages={currRoom.messages} />
</div>
<Input msgTemplate={msgTemplate} inputText={inputText} handleOnSend={handleOnSend} handleTextInput={handleTextInput} />
<Button msgTemplate={msgTemplate} inputText={inputText} handleOnSend={handleOnSend} />
<VideoRequestButton handleVideoRequestClick={handleVideoRequestClick} otherId={rooms[0].users[0].id} />
</div>
<div id="video">
placeholder for video component. id is "video"
</div>
</div>
);
};
export default Conversations;
| Add placeholder div for video component | Add placeholder div for video component
| JSX | mit | VictoriousResistance/iDioma,VictoriousResistance/iDioma | ---
+++
@@ -28,6 +28,9 @@
<Button msgTemplate={msgTemplate} inputText={inputText} handleOnSend={handleOnSend} />
<VideoRequestButton handleVideoRequestClick={handleVideoRequestClick} otherId={rooms[0].users[0].id} />
</div>
+ <div id="video">
+ placeholder for video component. id is "video"
+ </div>
</div>
);
}; |
c2f9d044c52471f1b546f5356d4a964fceb8c0c2 | UIText/index.jsx | UIText/index.jsx | import UIView from '../UIView';
import React from 'react';
class UIText extends UIView {
componentDidMount() {
this.rescale();
}
componentDidUpdate() {
this.rescale();
}
render() {
return (
<span className='ui-text'>{this.props.text}</span>
);
}
rescale() {
let node = React.findDOMNode(this);
let nodeBox = node.getBoundingClientRect();
let fontSize = window.getComputedStyle(node).fontSize;
let parentBox = window.getBoundingClientRect(node.parentNode);
let optimizeForWidth = Math.floor((parseInt(fontSize, 10) / nodeBox.right - nodeBox.left) * (parentBox.right - parentBox.left));
let optimizeForHeight = Math.floor((parseInt(fontSize, 10) / nodeBox.bottom - nodeBox.top) * (parentBox.bottom - parentBox.top));
node.style.fontSize = Math.min(this.props.maxSize, optimizeForHeight, optimizeForWidth);
}
}
UIText.defaultProps = {
maxSize: Number.MAX_VALUE
};
UIText.propTypes = {
maxSize: React.PropTypes.number,
text: React.PropTypes.string
};
export default UIText;
// 50px
// 20px, 10px
| import UIView from '../UIView';
import React from 'react';
class UIText extends UIView {
componentDidMount() {
this.rescale();
}
componentDidUpdate() {
this.rescale();
}
render() {
return (
<span className='ui-text'>{this.props.text}</span>
);
}
rescale() {
let node = React.findDOMNode(this);
let container = node.parentNode;
let fontSize = parseInt(window.getComputedStyle(node).fontSize, 10);
// needs to take container inner padding into account, which is why we're using client<Dimension>
let optimizeForWidth = Math.floor((fontSize / node.offsetWidth) * container.clientWidth);
let optimizeForHeight = Math.floor((fontSize / node.offsetHeight) * container.clientHeight);
node.style.fontSize = Math.min(this.props.maxSize, optimizeForHeight, optimizeForWidth);
}
}
UIText.defaultProps = {
maxSize: Number.MAX_VALUE
};
UIText.propTypes = {
maxSize: React.PropTypes.number,
text: React.PropTypes.string
};
export default UIText;
// 50px
// 20px, 10px
| Update to UIText for greater precision | Update to UIText for greater precision
| JSX | mit | enigma-io/boundless,enigma-io/boundless,enigma-io/boundless | ---
+++
@@ -18,12 +18,12 @@
rescale() {
let node = React.findDOMNode(this);
- let nodeBox = node.getBoundingClientRect();
- let fontSize = window.getComputedStyle(node).fontSize;
- let parentBox = window.getBoundingClientRect(node.parentNode);
+ let container = node.parentNode;
+ let fontSize = parseInt(window.getComputedStyle(node).fontSize, 10);
- let optimizeForWidth = Math.floor((parseInt(fontSize, 10) / nodeBox.right - nodeBox.left) * (parentBox.right - parentBox.left));
- let optimizeForHeight = Math.floor((parseInt(fontSize, 10) / nodeBox.bottom - nodeBox.top) * (parentBox.bottom - parentBox.top));
+ // needs to take container inner padding into account, which is why we're using client<Dimension>
+ let optimizeForWidth = Math.floor((fontSize / node.offsetWidth) * container.clientWidth);
+ let optimizeForHeight = Math.floor((fontSize / node.offsetHeight) * container.clientHeight);
node.style.fontSize = Math.min(this.props.maxSize, optimizeForHeight, optimizeForWidth);
} |
17647db069209cc8b91f0a6494c7c5a0bd3283de | src/components/form-utils.jsx | src/components/form-utils.jsx | import React from 'react';
// Helpers for use with react-final-form-hooks
export function RadioInput({ field, value, ...additionalProps }) {
const props = { ...field.input, checked: field.input.value === value, value, ...additionalProps };
return <input type="radio" {...props} />;
}
export function CheckboxInput({ field, ...additionalProps }) {
const props = { ...field.input, checked: field.input.value, ...additionalProps };
return <input type="checkbox" {...props} />;
}
export function groupErrClass(field, whenTouched = false, baseClass = 'form-group') {
return (
baseClass +
(field.meta.error !== undefined && (!whenTouched || field.meta.touched) ? ' has-error' : '')
);
}
export function errorMessage(field, whenTouched = false) {
return (
field.meta.error !== undefined &&
(!whenTouched || field.meta.touched) && <p className="help-block">{field.meta.error}</p>
);
}
export function shouldBe(test, message = '') {
return test ? undefined : message;
}
| import React, { useCallback } from 'react';
import { without } from 'lodash';
// Helpers for use with react-final-form-hooks
export function RadioInput({ field, value, ...additionalProps }) {
const props = { ...field.input, checked: field.input.value === value, value, ...additionalProps };
return <input type="radio" {...props} />;
}
export function CheckboxInput({ field, ...additionalProps }) {
const props = { ...field.input, checked: field.input.value, ...additionalProps };
return <input type="checkbox" {...props} />;
}
/**
* The field.input.value is array, the checked checkbox means the given value is
* in this array.
*/
export function CheckboxInputMulti({ field, value, ...additionalProps }) {
const checked = field.input.value.includes(value);
const onChange = useCallback(() => {
const vals = field.input.value;
if (vals.includes(value)) {
field.input.onChange(without(vals, value));
} else {
field.input.onChange([...vals, value]);
}
}, [field.input, value]);
const props = { ...field.input, checked, value, onChange, ...additionalProps };
return <input type="checkbox" {...props} />;
}
export function groupErrClass(field, whenTouched = false, baseClass = 'form-group') {
return (
baseClass +
(field.meta.error !== undefined && (!whenTouched || field.meta.touched) ? ' has-error' : '')
);
}
export function errorMessage(field, whenTouched = false) {
return (
field.meta.error !== undefined &&
(!whenTouched || field.meta.touched) && <p className="help-block">{field.meta.error}</p>
);
}
export function shouldBe(test, message = '') {
return test ? undefined : message;
}
| Add component to handle checkbox that selects subset from values | Add component to handle checkbox that selects subset from values | JSX | mit | FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client | ---
+++
@@ -1,4 +1,5 @@
-import React from 'react';
+import React, { useCallback } from 'react';
+import { without } from 'lodash';
// Helpers for use with react-final-form-hooks
@@ -9,6 +10,24 @@
export function CheckboxInput({ field, ...additionalProps }) {
const props = { ...field.input, checked: field.input.value, ...additionalProps };
+ return <input type="checkbox" {...props} />;
+}
+
+/**
+ * The field.input.value is array, the checked checkbox means the given value is
+ * in this array.
+ */
+export function CheckboxInputMulti({ field, value, ...additionalProps }) {
+ const checked = field.input.value.includes(value);
+ const onChange = useCallback(() => {
+ const vals = field.input.value;
+ if (vals.includes(value)) {
+ field.input.onChange(without(vals, value));
+ } else {
+ field.input.onChange([...vals, value]);
+ }
+ }, [field.input, value]);
+ const props = { ...field.input, checked, value, onChange, ...additionalProps };
return <input type="checkbox" {...props} />;
}
|
800dc7a6a19fa73b95968afb6d54f73007cafd36 | src/drive/web/modules/drive/Toolbar/components/MoreMenu.spec.jsx | src/drive/web/modules/drive/Toolbar/components/MoreMenu.spec.jsx | import React from 'react'
import { mount } from 'enzyme'
import { act } from 'react-dom/test-utils'
import { ActionMenuItem } from 'cozy-ui/transpiled/react/ActionMenu'
import { setupFolderContent, mockCozyClientRequestQuery } from 'test/setup'
import { downloadFiles } from 'drive/web/modules/actions/utils'
import MoreMenu from 'drive/web/modules/drive/Toolbar/components/MoreMenu'
import AppLike from 'test/components/AppLike'
import { MoreButton } from 'components/Button'
jest.mock('drive/web/modules/actions/utils', () => ({
downloadFiles: jest.fn().mockResolvedValue()
}))
const sleep = duration => new Promise(resolve => setTimeout(resolve, duration))
mockCozyClientRequestQuery()
describe('MoreMenu', () => {
const setup = async () => {
const folderId = 'directory-foobar0'
const { client, store } = await setupFolderContent({
folderId
})
const root = mount(
<AppLike client={client} store={store}>
<MoreMenu
isDisabled={false}
canCreateFolder={false}
canUpload={false}
/>
</AppLike>
)
await sleep(1)
// Open the menu
act(() => {
root
.find(MoreButton)
.props()
.onClick()
})
root.update()
return { root, store, client }
}
describe('DownloadButton', () => {
it('should work', async () => {
const { root } = await setup()
const actionMenuItem = root.findWhere(node => {
return (
node.type() === ActionMenuItem && node.text() == 'Download folder'
)
})
actionMenuItem.props().onClick()
await sleep(0)
expect(downloadFiles).toHaveBeenCalled()
})
})
})
| import React from 'react'
import { render, fireEvent, configure } from '@testing-library/react'
import { setupFolderContent, mockCozyClientRequestQuery } from 'test/setup'
import { downloadFiles } from 'drive/web/modules/actions/utils'
import MoreMenu from './MoreMenu'
import AppLike from 'test/components/AppLike'
jest.mock('drive/web/modules/actions/utils', () => ({
downloadFiles: jest.fn().mockResolvedValue()
}))
mockCozyClientRequestQuery()
configure({ testIdAttribute: 'data-test-id' })
describe('MoreMenu', () => {
const setup = async () => {
const folderId = 'directory-foobar0'
const { client, store } = await setupFolderContent({
folderId
})
const result = render(
<AppLike client={client} store={store}>
<MoreMenu
isDisabled={false}
canCreateFolder={false}
canUpload={false}
/>
</AppLike>
)
const { getByTestId } = result
fireEvent.click(getByTestId('more-button'))
return { ...result, store, client }
}
describe('DownloadButton', () => {
it('should work', async () => {
const { getByText } = await setup()
fireEvent.click(getByText('Download folder'))
expect(downloadFiles).toHaveBeenCalled()
})
})
})
| Switch test to react testing lib | test: Switch test to react testing lib
| JSX | agpl-3.0 | nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3,nono/cozy-files-v3 | ---
+++
@@ -1,20 +1,17 @@
import React from 'react'
-import { mount } from 'enzyme'
-import { act } from 'react-dom/test-utils'
-import { ActionMenuItem } from 'cozy-ui/transpiled/react/ActionMenu'
+import { render, fireEvent, configure } from '@testing-library/react'
import { setupFolderContent, mockCozyClientRequestQuery } from 'test/setup'
import { downloadFiles } from 'drive/web/modules/actions/utils'
-import MoreMenu from 'drive/web/modules/drive/Toolbar/components/MoreMenu'
+import MoreMenu from './MoreMenu'
import AppLike from 'test/components/AppLike'
-import { MoreButton } from 'components/Button'
jest.mock('drive/web/modules/actions/utils', () => ({
downloadFiles: jest.fn().mockResolvedValue()
}))
-const sleep = duration => new Promise(resolve => setTimeout(resolve, duration))
+mockCozyClientRequestQuery()
-mockCozyClientRequestQuery()
+configure({ testIdAttribute: 'data-test-id' })
describe('MoreMenu', () => {
const setup = async () => {
@@ -23,7 +20,7 @@
folderId
})
- const root = mount(
+ const result = render(
<AppLike client={client} store={store}>
<MoreMenu
isDisabled={false}
@@ -33,31 +30,17 @@
</AppLike>
)
- await sleep(1)
+ const { getByTestId } = result
+ fireEvent.click(getByTestId('more-button'))
- // Open the menu
- act(() => {
- root
- .find(MoreButton)
- .props()
- .onClick()
- })
- root.update()
-
- return { root, store, client }
+ return { ...result, store, client }
}
describe('DownloadButton', () => {
it('should work', async () => {
- const { root } = await setup()
+ const { getByText } = await setup()
- const actionMenuItem = root.findWhere(node => {
- return (
- node.type() === ActionMenuItem && node.text() == 'Download folder'
- )
- })
- actionMenuItem.props().onClick()
- await sleep(0)
+ fireEvent.click(getByText('Download folder'))
expect(downloadFiles).toHaveBeenCalled()
})
}) |
28da72f4dc1c2167636053bf734f466dff9bd4b8 | src/components/game/current-game-title.jsx | src/components/game/current-game-title.jsx | // @flow
import {h} from 'preact'
import {connect} from 'preact-redux'
import {translate} from 'react-i18next'
import {GameStage} from '../../game-stage'
import style from '../titles.css'
import type {GameState} from '../../reducer/current-game'
import type {T} from '../../types'
function DisconnectedCurrentGameTitle({title}) {
return <h1 className={style.title}>{title}</h1>
}
function computeTitle(currentGame: GameState, t: T): string {
if (currentGame == null) {
return ''
} else if (currentGame.stage === GameStage.waitingBid || currentGame.stage === GameStage.waitingWin) {
const {currentRound, rounds} = (currentGame: any) // If not type cast this, flow will throw error
return t('Round {{currentRound}} of {{rounds}}', {currentRound, rounds})
} else if (currentGame.stage === GameStage.ended) {
return t('Game over')
} else {
return ''
}
}
function mapStateToProps(state, {t}) {
return {
title: computeTitle(state.currentGame, t)
}
}
export const CurrentGameTitle = translate()(connect(mapStateToProps)(DisconnectedCurrentGameTitle))
| // @flow
import {h} from 'preact'
import {connect} from 'preact-redux'
import {translate} from 'react-i18next'
import {gameTitleSelector} from '../../selectors/game-title'
import style from '../titles.css'
function DisconnectedCurrentGameTitle({title}) {
return <h1 className={style.title}>{title}</h1>
}
function mapStateToProps(state, {t}) {
return {
title: gameTitleSelector(state, t)
}
}
export const CurrentGameTitle = translate()(connect(mapStateToProps)(DisconnectedCurrentGameTitle))
| Use game title selector in current game title component | Use game title selector in current game title component
| JSX | mit | Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc | ---
+++
@@ -2,32 +2,16 @@
import {h} from 'preact'
import {connect} from 'preact-redux'
import {translate} from 'react-i18next'
-import {GameStage} from '../../game-stage'
+import {gameTitleSelector} from '../../selectors/game-title'
import style from '../titles.css'
-
-import type {GameState} from '../../reducer/current-game'
-import type {T} from '../../types'
function DisconnectedCurrentGameTitle({title}) {
return <h1 className={style.title}>{title}</h1>
}
-function computeTitle(currentGame: GameState, t: T): string {
- if (currentGame == null) {
- return ''
- } else if (currentGame.stage === GameStage.waitingBid || currentGame.stage === GameStage.waitingWin) {
- const {currentRound, rounds} = (currentGame: any) // If not type cast this, flow will throw error
- return t('Round {{currentRound}} of {{rounds}}', {currentRound, rounds})
- } else if (currentGame.stage === GameStage.ended) {
- return t('Game over')
- } else {
- return ''
- }
-}
-
function mapStateToProps(state, {t}) {
return {
- title: computeTitle(state.currentGame, t)
+ title: gameTitleSelector(state, t)
}
}
|
3514ee4db7ab037e340d1c30075623547e283523 | app/assets/javascripts/components/timeline/TrainingModules/ModuleRow/ModuleStatus/ExerciseButton.jsx | app/assets/javascripts/components/timeline/TrainingModules/ModuleRow/ModuleStatus/ExerciseButton.jsx | import React from 'react';
import PropTypes from 'prop-types';
export const ExerciseButton = ({
block_id, course, flags, isComplete, isExercise, slug,
complete, fetchExercises, incomplete
}) => {
let button = (
<button className="button small left dark" disabled>
Mark Complete
</button>
);
if (isComplete && isExercise) {
if (flags.marked_complete) {
const onClick = () => incomplete(block_id, slug).then(() => fetchExercises(course.id));
button = (
<button className="button small left" onClick={onClick}>
Mark Incomplete
</button>
);
} else {
const onClick = () => complete(block_id, slug).then(() => fetchExercises(course.id));
button = (
<button className="button small left dark" onClick={onClick}>
Mark Complete
</button>
);
}
}
return button;
};
ExerciseButton.propTypes = {
block_id: PropTypes.number.isRequired,
course: PropTypes.shape({
id: PropTypes.number.isRequired
}).isRequired,
flags: PropTypes.shape({
marked_complete: PropTypes.bool
}),
isComplete: PropTypes.bool.isRequired,
isExercise: PropTypes.bool.isRequired,
slug: PropTypes.string.isRequired,
complete: PropTypes.func.isRequired,
incomplete: PropTypes.func.isRequired,
};
export default ExerciseButton;
| import React from 'react';
import PropTypes from 'prop-types';
export const ExerciseButton = ({
block_id, course, flags, isComplete, isExercise, slug,
complete, fetchExercises, incomplete
}) => {
let button = (
<button className="button small left dark" disabled>
Mark Complete
</button>
);
if (isComplete && isExercise) {
if (flags.marked_complete) {
const onClick = () => incomplete(block_id, slug).then(() => fetchExercises(course.id));
button = (
<div>
Status: Complete!
<button className="button small left" onClick={onClick}>
Mark Incomplete
</button>
</div>
);
} else {
const onClick = () => complete(block_id, slug).then(() => fetchExercises(course.id));
button = (
<button className="button small left dark" onClick={onClick}>
Mark Complete
</button>
);
}
}
return button;
};
ExerciseButton.propTypes = {
block_id: PropTypes.number.isRequired,
course: PropTypes.shape({
id: PropTypes.number.isRequired
}).isRequired,
flags: PropTypes.shape({
marked_complete: PropTypes.bool
}),
isComplete: PropTypes.bool.isRequired,
isExercise: PropTypes.bool.isRequired,
slug: PropTypes.string.isRequired,
complete: PropTypes.func.isRequired,
incomplete: PropTypes.func.isRequired,
};
export default ExerciseButton;
| Make exercise 'Complete' state more explicit | Make exercise 'Complete' state more explicit
| JSX | mit | WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ---
+++
@@ -15,9 +15,12 @@
if (flags.marked_complete) {
const onClick = () => incomplete(block_id, slug).then(() => fetchExercises(course.id));
button = (
- <button className="button small left" onClick={onClick}>
- Mark Incomplete
- </button>
+ <div>
+ Status: Complete!
+ <button className="button small left" onClick={onClick}>
+ Mark Incomplete
+ </button>
+ </div>
);
} else {
const onClick = () => complete(block_id, slug).then(() => fetchExercises(course.id)); |
01d06b54d89a3104aa29d07bbeff3e7be59d61ea | src/public/views/header.jsx | src/public/views/header.jsx | 'use strict';
import React from 'react';
import WebHeader from './components/header/webHeader.jsx'
import MobileHeader from './components/header/mobileHeader.jsx'
import SecurityBanner from './components/header/securityBanner.jsx'
import AnnounceBanner from './components/header/announceBanner.jsx'
class Header extends React.Component {
renderSecurityMessage() {
return
//return (
// <div className='inline'>
// <p>
// 2017-05-09. BU nodes under attack. As temporary countermeasure please disable Xthin.
// </p>
// <p>
// To disable it add <i>use-thinblock=0</i> to your bitcoin.conf or use the command line flag <i>-use-thinblocks=0</i>.
// </p>
// </div>
//)
}
renderAnnounceMessage() {
return
//return (
// <div className='inline-block'>
// <p> BU x.y.z. has been just released, plese fetch it from the download section</p>
// </div>
//)
}
render() {
return (
<div>
<WebHeader />
<MobileHeader />
<div className='banner'></div>
<SecurityBanner message={ this.renderSecurityMessage() }/>
<AnnounceBanner message={ this.renderAnnounceMessage() }/>
</div>
);
}
};
export default Header
| 'use strict';
import React from 'react';
import WebHeader from './components/header/webHeader.jsx'
import MobileHeader from './components/header/mobileHeader.jsx'
import SecurityBanner from './components/header/securityBanner.jsx'
import AnnounceBanner from './components/header/announceBanner.jsx'
class Header extends React.Component {
renderSecurityMessage() {
return
//return (
// <div className='inline'>
// <p>
// 2017-05-09. BU nodes under attack. As temporary countermeasure please disable Xthin.
// </p>
// <p>
// To disable it add <i>use-thinblock=0</i> to your bitcoin.conf or use the command line flag <i>-use-thinblocks=0</i>.
// </p>
// </div>
//)
}
renderAnnounceMessage() {
//return
return (
<div className='inline-block'>
<p> BU 1.0.2.0 has been released, please update your node as soon as possible. </p>
</div>
)
}
render() {
return (
<div>
<WebHeader />
<MobileHeader />
<div className='banner'></div>
<SecurityBanner message={ this.renderSecurityMessage() }/>
<AnnounceBanner message={ this.renderAnnounceMessage() }/>
</div>
);
}
};
export default Header
| Add announcement about release of BU 1.0.2.0 | Add announcement about release of BU 1.0.2.0
| JSX | mit | gandrewstone/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,gandrewstone/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb,BitcoinUnlimited/BitcoinUnlimitedWeb | ---
+++
@@ -22,12 +22,12 @@
}
renderAnnounceMessage() {
- return
- //return (
- // <div className='inline-block'>
- // <p> BU x.y.z. has been just released, plese fetch it from the download section</p>
- // </div>
- //)
+ //return
+ return (
+ <div className='inline-block'>
+ <p> BU 1.0.2.0 has been released, please update your node as soon as possible. </p>
+ </div>
+ )
}
render() { |
d431b1cf3c7f39088897ab7176d5c1f5b9facc0b | packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx | packages/vulcan-accounts/imports/ui/components/ResetPassword.jsx | import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { intlShape } from 'meteor/vulcan:i18n';
import { STATES } from '../../helpers.js';
class AccountsResetPassword extends PureComponent {
componentDidMount() {
const token = this.props.params.token;
Accounts._loginButtonsSession.set('resetPasswordToken', token);
}
render() {
if (!this.props.currentUser) {
return (
<Components.AccountsLoginForm
formState={ STATES.PASSWORD_CHANGE }
/>
);
} else {
return (
<div className='password-reset-form'>
<div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!</div>
</div>
);
}
}
}
AccountsResetPassword.contextTypes = {
intl: intlShape
}
AccountsResetPassword.propsTypes = {
currentUser: PropTypes.object,
params: PropTypes.object,
};
AccountsResetPassword.displayName = 'AccountsResetPassword';
registerComponent('AccountsResetPassword', AccountsResetPassword, withCurrentUser);
| import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { intlShape } from 'meteor/vulcan:i18n';
import { STATES } from '../../helpers.js';
class AccountsResetPassword extends PureComponent {
componentDidMount() {
const token = this.props.params.token;
Accounts._loginButtonsSession.set('resetPasswordToken', token);
}
render() {
if (!this.props.currentUser) {
return (
<Components.AccountsLoginForm
formState={ STATES.PASSWORD_CHANGE }
/>
);
} else {
return (
<div className='password-reset-form'>
<div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}</div>
</div>
);
}
}
}
AccountsResetPassword.contextTypes = {
intl: intlShape
}
AccountsResetPassword.propsTypes = {
currentUser: PropTypes.object,
params: PropTypes.object,
};
AccountsResetPassword.displayName = 'AccountsResetPassword';
registerComponent('AccountsResetPassword', AccountsResetPassword, withCurrentUser);
| Remove extra punctuation from reset-password confirmation | Remove extra punctuation from reset-password confirmation
There's already a period. I think an exclamation mark is
over-enthusiastic, but maybe people like resetting their passwords.
| JSX | mit | Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope | ---
+++
@@ -20,7 +20,7 @@
} else {
return (
<div className='password-reset-form'>
- <div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}!</div>
+ <div>{this.context.intl.formatMessage({id: 'accounts.info_password_changed'})}</div>
</div>
);
} |
86a4b27bf20665eb5ed0253b6ef2f9728da7e2e0 | src/components/geolocalizer/geolocalizer.jsx | src/components/geolocalizer/geolocalizer.jsx | import React from 'react';
//import ReactDOM from 'react-dom';
var Geolocalizer = React.createClass ({
render: function () {
return (
<button className="ktg-btn--geolocalizer">
</button>
);
}
});
module.exports = Geolocalizer;
| import React from 'react';
var Geolocalizer = React.createClass ({
getInitialState: function () {
return {
latitude: '0',
longitude: '0'
};
},
geolocalizeMe: function () {
var success = function (position) {
this.setState({latitude: position.coords.latitude});
this.setState({longitude: position.coords.longitude});
}.bind(this);
var error = function () {
console.log('sorry you have and error with ' + error);
}.bind(this);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success, error);
} else {
error('geolocalization is not supported by browser');
}
},
render: function () {
return (
<button type='button' className="ktg-btn--geolocalizer" onClick={this.geolocalizeMe}>
</button>
);
}
});
module.exports = Geolocalizer;
| Add events and Html5 geolocalization when user click button | Add events and Html5 geolocalization when user click button
| JSX | apache-2.0 | swcraftersclm/katangapp-frontend,swcraftersclm/katangapp-frontend,swcraftersclm/katangapp-frontend | ---
+++
@@ -1,11 +1,30 @@
import React from 'react';
-//import ReactDOM from 'react-dom';
var Geolocalizer = React.createClass ({
+ getInitialState: function () {
+ return {
+ latitude: '0',
+ longitude: '0'
+ };
+ },
+ geolocalizeMe: function () {
+ var success = function (position) {
+ this.setState({latitude: position.coords.latitude});
+ this.setState({longitude: position.coords.longitude});
+ }.bind(this);
+ var error = function () {
+ console.log('sorry you have and error with ' + error);
+ }.bind(this);
+ if (navigator.geolocation) {
+ navigator.geolocation.getCurrentPosition(success, error);
+ } else {
+ error('geolocalization is not supported by browser');
+ }
+ },
render: function () {
return (
- <button className="ktg-btn--geolocalizer">
- </button>
+ <button type='button' className="ktg-btn--geolocalizer" onClick={this.geolocalizeMe}>
+ </button>
);
}
}); |
24b62bc13ce037fe29c70769d233ee2d83a7eb39 | features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/devportal/source/src/app/components/Apis/Details/ApiConsole/SwaggerUI.jsx | features/apimgt/org.wso2.carbon.apimgt.store.feature/src/main/resources/devportal/source/src/app/components/Apis/Details/ApiConsole/SwaggerUI.jsx | import React from 'react';
import PropTypes from 'prop-types';
import 'swagger-ui/dist/swagger-ui.css';
import SwaggerUILib from './PatchedSwaggerUIReact';
const disableAuthorizeAndInfoPlugin = function () {
return {
wrapComponents: {
info: () => () => null,
},
};
};
/**
*
* @class SwaggerUI
* @extends {Component}
*/
const SwaggerUI = (props) => {
const { spec, accessTokenProvider, authorizationHeader, api } = props;
const componentProps = {
spec,
validatorUrl: null,
docExpansion: 'list',
defaultModelsExpandDepth: 0,
requestInterceptor: (req) => {
const { url } = req;
const patternToCheck = api.context + '/*';
req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider();
if (url.endsWith(patternToCheck)) {
req.url = url.substring(url.length - 1, 0);
}
return req;
},
presets: [disableAuthorizeAndInfoPlugin],
plugins: null,
};
return <SwaggerUILib {...componentProps} />;
};
SwaggerUI.propTypes = {
spec: PropTypes.shape({}).isRequired,
};
export default SwaggerUI;
| import React from 'react';
import PropTypes from 'prop-types';
import 'swagger-ui/dist/swagger-ui.css';
import SwaggerUILib from './PatchedSwaggerUIReact';
const disableAuthorizeAndInfoPlugin = function () {
return {
wrapComponents: {
info: () => () => null,
},
};
};
/**
*
* @class SwaggerUI
* @extends {Component}
*/
const SwaggerUI = (props) => {
const { spec, accessTokenProvider, authorizationHeader, api } = props;
const componentProps = {
spec,
validatorUrl: null,
docExpansion: 'list',
defaultModelsExpandDepth: 0,
requestInterceptor: (req) => {
const { url } = req;
const patternToCheck = api.context + '/*';
req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider();
if (url.endsWith(patternToCheck)) {
req.url = url.substring(0, url.length - 2);
}
return req;
},
presets: [disableAuthorizeAndInfoPlugin],
plugins: null,
};
return <SwaggerUILib {...componentProps} />;
};
SwaggerUI.propTypes = {
spec: PropTypes.shape({}).isRequired,
};
export default SwaggerUI;
| Remove /* from the url. | Remove /* from the url.
| JSX | apache-2.0 | fazlan-nazeem/carbon-apimgt,nuwand/carbon-apimgt,isharac/carbon-apimgt,wso2/carbon-apimgt,tharikaGitHub/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,uvindra/carbon-apimgt,chamilaadhi/carbon-apimgt,harsha89/carbon-apimgt,isharac/carbon-apimgt,nuwand/carbon-apimgt,tharikaGitHub/carbon-apimgt,chamilaadhi/carbon-apimgt,uvindra/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,chamindias/carbon-apimgt,malinthaprasan/carbon-apimgt,jaadds/carbon-apimgt,fazlan-nazeem/carbon-apimgt,Rajith90/carbon-apimgt,Rajith90/carbon-apimgt,praminda/carbon-apimgt,bhathiya/carbon-apimgt,jaadds/carbon-apimgt,malinthaprasan/carbon-apimgt,prasa7/carbon-apimgt,Rajith90/carbon-apimgt,ruks/carbon-apimgt,tharikaGitHub/carbon-apimgt,isharac/carbon-apimgt,wso2/carbon-apimgt,uvindra/carbon-apimgt,fazlan-nazeem/carbon-apimgt,chamilaadhi/carbon-apimgt,wso2/carbon-apimgt,praminda/carbon-apimgt,chamindias/carbon-apimgt,chamilaadhi/carbon-apimgt,malinthaprasan/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,chamindias/carbon-apimgt,nuwand/carbon-apimgt,ruks/carbon-apimgt,tharindu1st/carbon-apimgt,ruks/carbon-apimgt,nuwand/carbon-apimgt,praminda/carbon-apimgt,jaadds/carbon-apimgt,sanjeewa-malalgoda/carbon-apimgt,harsha89/carbon-apimgt,bhathiya/carbon-apimgt,harsha89/carbon-apimgt,uvindra/carbon-apimgt,wso2/carbon-apimgt,bhathiya/carbon-apimgt,tharindu1st/carbon-apimgt,malinthaprasan/carbon-apimgt,tharikaGitHub/carbon-apimgt,jaadds/carbon-apimgt,isharac/carbon-apimgt,tharindu1st/carbon-apimgt,Rajith90/carbon-apimgt,bhathiya/carbon-apimgt,prasa7/carbon-apimgt,prasa7/carbon-apimgt,harsha89/carbon-apimgt,chamindias/carbon-apimgt,prasa7/carbon-apimgt,ruks/carbon-apimgt,fazlan-nazeem/carbon-apimgt,tharindu1st/carbon-apimgt | ---
+++
@@ -28,7 +28,7 @@
const patternToCheck = api.context + '/*';
req.headers[authorizationHeader] = 'Bearer ' + accessTokenProvider();
if (url.endsWith(patternToCheck)) {
- req.url = url.substring(url.length - 1, 0);
+ req.url = url.substring(0, url.length - 2);
}
return req;
}, |
4807d09fb503f30ca890973e56b421b37e4ce529 | src/reactGUI/initDOM.jsx | src/reactGUI/initDOM.jsx | const ReactDOM = require('./ReactDOM-shim');
const LiterallyCanvasModel = require('../core/LiterallyCanvas');
const LiterallyCanvasReactComponent = require('./LiterallyCanvas');
function init(el, opts) {
const originalClassName = el.className
const lc = new LiterallyCanvasModel(opts)
ReactDOM.render(<LiterallyCanvasReactComponent lc={lc} />, el);
lc.teardown = function() {
lc._teardown();
for (var i=0; i<el.children.length; i++) {
el.removeChild(el.children[i]);
}
el.className = originalClassName;
};
return lc;
}
module.exports = init;
| const React = require('./React-shim');
const ReactDOM = require('./ReactDOM-shim');
const LiterallyCanvasModel = require('../core/LiterallyCanvas');
const LiterallyCanvasReactComponent = require('./LiterallyCanvas');
function init(el, opts) {
const originalClassName = el.className
const lc = new LiterallyCanvasModel(opts)
ReactDOM.render(<LiterallyCanvasReactComponent lc={lc} />, el);
lc.teardown = function() {
lc._teardown();
for (var i=0; i<el.children.length; i++) {
el.removeChild(el.children[i]);
}
el.className = originalClassName;
};
return lc;
}
module.exports = init;
| Fix a potential problem if user never explicitly imports React | Fix a potential problem if user never explicitly imports React
| JSX | bsd-2-clause | irskep/literallycanvas,literallycanvas/literallycanvas | ---
+++
@@ -1,3 +1,4 @@
+const React = require('./React-shim');
const ReactDOM = require('./ReactDOM-shim');
const LiterallyCanvasModel = require('../core/LiterallyCanvas');
const LiterallyCanvasReactComponent = require('./LiterallyCanvas'); |
79a0ced1fa81d045274a35e174cd428222ff809b | components/react/Form/SelectorV2/Option.jsx | components/react/Form/SelectorV2/Option.jsx | import React from 'react';
import cx from 'classnames';
import styles from './selector_v2.css';
class Option extends React.Component {
onClick(e) {
const { onClick, id, isActive } = this.props;
!isActive && onClick && onClick(id);
e.stopPropagation();
return false;
}
render() {
const { value, isActive, className } = this.props;
const optionClass = cx(
styles.option,
isActive && styles['option-active'],
className
);
console.log('optionClass');
console.log(optionClass);
return (
<div
onClick={this.onClick.bind(this)}
className={optionClass}>
<div className={styles['option-wrapper']}>
{value}
</div>
</div>
);
}
}
export default Option;
| import React from 'react';
import cx from 'classnames';
import styles from './selector_v2.css';
class Option extends React.Component {
onClick(e) {
const { onClick, id, isActive } = this.props;
!isActive && onClick && onClick(id);
e.stopPropagation();
return false;
}
render() {
const { value, isActive, className } = this.props;
const optionClass = cx(
styles.option,
isActive && styles['option-active'],
className
);
return (
<div
onClick={this.onClick.bind(this)}
className={optionClass}>
<div className={styles['option-wrapper']}>
{value}
</div>
</div>
);
}
}
export default Option;
| Remove console. Sorry about it | WHAT: Remove console. Sorry about it
WHY:
* XXXXX
HOW:
* NOTHING TO SAY
| JSX | mit | ecmadao/light-ui,ecmadao/light-ui | ---
+++
@@ -17,8 +17,6 @@
isActive && styles['option-active'],
className
);
- console.log('optionClass');
- console.log(optionClass);
return (
<div
onClick={this.onClick.bind(this)} |
e634142fb93450bed1f5706e7c163af714f0f126 | src/javascript/components/BenchmarkModeBadge.jsx | src/javascript/components/BenchmarkModeBadge.jsx | import React, { Component } from 'react';
import Badge from 'react-bootstrap/lib/Badge'
import Tooltip from 'react-bootstrap/lib/Tooltip'
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'
// A badge showing the benchmark mode with a tooltip explaining it
export default class BenchmarkModeBadge extends Component {
static propTypes = {
name: React.PropTypes.string.isRequired,
tooltip: React.PropTypes.string.isRequired,
};
render() {
const {name, tooltip} = this.props;
const tooltipComponent = <Tooltip id="tooltip">
{ tooltip }
</Tooltip>;
return (
<OverlayTrigger placement="top" overlay={ tooltipComponent }>
<Badge bsStyle="default">
{ name }
</Badge>
</OverlayTrigger>
);
}
}
export function createBadge(benchmarkMode) {
switch (benchmarkMode) {
case 'thrpt':
return <BenchmarkModeBadge name="Throughput" tooltip="The higher the bars, the better." />
case 'avgt':
return <BenchmarkModeBadge name="AverageTime" tooltip="The lower the bars, the better." />
case 'sample':
return <BenchmarkModeBadge name="SamplingTime" tooltip="The lower the bars, the better." />
case 'ss':
return <BenchmarkModeBadge name="SingleShot" tooltip="The lower the bars, the better." />
default:
return <BenchmarkModeBadge name={ benchmarkMode } tooltip="Nothing to say..." />
}
}
| import React, { Component } from 'react';
import Badge from 'react-bootstrap/lib/Badge'
import Tooltip from 'react-bootstrap/lib/Tooltip'
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'
// A badge showing the benchmark mode with a tooltip explaining it
export default class BenchmarkModeBadge extends Component {
static propTypes = {
name: React.PropTypes.string.isRequired,
tooltip: React.PropTypes.string.isRequired,
};
render() {
const {name, tooltip} = this.props;
const tooltipComponent = <Tooltip id="tooltip">
{ tooltip }
</Tooltip>;
return (
<OverlayTrigger placement="top" overlay={ tooltipComponent }>
<Badge bsStyle="default">
{ name }
</Badge>
</OverlayTrigger>
);
}
}
export function createBadge(benchmarkMode) {
if (!benchmarkMode) {
return null;
}
switch (benchmarkMode) {
case 'thrpt':
return <BenchmarkModeBadge key={ benchmarkMode } name="Throughput" tooltip="The higher the bars, the better." />
case 'avgt':
return <BenchmarkModeBadge key={ benchmarkMode } name="AverageTime" tooltip="The lower the bars, the better." />
case 'sample':
return <BenchmarkModeBadge key={ benchmarkMode } name="SamplingTime" tooltip="The lower the bars, the better." />
case 'ss':
return <BenchmarkModeBadge key={ benchmarkMode } name="SingleShot" tooltip="The lower the bars, the better." />
default:
return <BenchmarkModeBadge key={ benchmarkMode } name={ benchmarkMode } tooltip="Nothing to say..." />
}
}
| Fix warnings on chart pages | Fix warnings on chart pages | JSX | agpl-3.0 | jzillmann/jmh-visualizer,jzillmann/jmh-visualizer | ---
+++
@@ -30,17 +30,20 @@
}
export function createBadge(benchmarkMode) {
+ if (!benchmarkMode) {
+ return null;
+ }
switch (benchmarkMode) {
case 'thrpt':
- return <BenchmarkModeBadge name="Throughput" tooltip="The higher the bars, the better." />
+ return <BenchmarkModeBadge key={ benchmarkMode } name="Throughput" tooltip="The higher the bars, the better." />
case 'avgt':
- return <BenchmarkModeBadge name="AverageTime" tooltip="The lower the bars, the better." />
+ return <BenchmarkModeBadge key={ benchmarkMode } name="AverageTime" tooltip="The lower the bars, the better." />
case 'sample':
- return <BenchmarkModeBadge name="SamplingTime" tooltip="The lower the bars, the better." />
+ return <BenchmarkModeBadge key={ benchmarkMode } name="SamplingTime" tooltip="The lower the bars, the better." />
case 'ss':
- return <BenchmarkModeBadge name="SingleShot" tooltip="The lower the bars, the better." />
+ return <BenchmarkModeBadge key={ benchmarkMode } name="SingleShot" tooltip="The lower the bars, the better." />
default:
- return <BenchmarkModeBadge name={ benchmarkMode } tooltip="Nothing to say..." />
+ return <BenchmarkModeBadge key={ benchmarkMode } name={ benchmarkMode } tooltip="Nothing to say..." />
}
} |
7bd62bdd65d4a5ada800d117094406190fb53754 | imports/ui/containers/HomePageContainer.jsx | imports/ui/containers/HomePageContainer.jsx | import { createContainer } from 'meteor/react-meteor-data';
import HomePage from '../pages/HomePage';
export default HomePageContainer = createContainer(() => {
Meteor.subscribe('homePage.counters');
Meteor.subscribe('homePage.users.last');
return {
usersLast: Meteor.users.find({}, {sort: {createdAt: -1}, limit: 5}).fetch(),
counts: {
users: Counts.get('users'),
messages: Counts.get('messages'),
},
};
}, HomePage);
| import { createContainer } from 'meteor/react-meteor-data';
import HomePage from '../pages/HomePage';
export default HomePageContainer = createContainer(() => {
Meteor.subscribe('homePage.counters');
const usersLastReady = Meteor.subscribe('homePage.users.last').ready();
return {
usersLast: usersLastReady ? Meteor.users.find({}, {sort: {createdAt: -1}, limit: 5}).fetch() : [],
counts: {
users: Counts.get('users'),
messages: Counts.get('messages'),
},
};
}, HomePage);
| Check if subscription ready before pass documents | HomePage: Check if subscription ready before pass documents
When subscription not ready container may pass array of documents
(remaining from another subscription) that don't have all required
properties.
| JSX | agpl-3.0 | Davidyuk/witcoin,Davidyuk/witcoin | ---
+++
@@ -3,9 +3,9 @@
export default HomePageContainer = createContainer(() => {
Meteor.subscribe('homePage.counters');
- Meteor.subscribe('homePage.users.last');
+ const usersLastReady = Meteor.subscribe('homePage.users.last').ready();
return {
- usersLast: Meteor.users.find({}, {sort: {createdAt: -1}, limit: 5}).fetch(),
+ usersLast: usersLastReady ? Meteor.users.find({}, {sort: {createdAt: -1}, limit: 5}).fetch() : [],
counts: {
users: Counts.get('users'),
messages: Counts.get('messages'), |
9d6e2414f018643f992719662858598e7899efc4 | app/components/elements/Userpic.jsx | app/components/elements/Userpic.jsx | import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
class Userpic extends Component {
// account is specified as string, but converted to object in connect
static propTypes = {
account: PropTypes.object
}
render() {
const {account, width, height} = this.props
const hideIfDefault = this.props.hideIfDefault || false
let url = null;
// try to extract image url from users metaData
try {
const md = JSON.parse(account.json_metadata);
if(md.profile) url = md.profile.profile_image;
} catch (e) {}
if (url && /^(https?:)\/\//.test(url)) {
const size = width && width > 48 ? '320x320' : '72x72'
url = $STM_Config.img_proxy_prefix + size + '/' + url;
} else {
if(hideIfDefault) {
return null;
}
url = require('app/assets/images/user.png');
}
const style = {backgroundImage: 'url(' + url + ')',
width: (width || 48) + 'px',
height: (height || 48) + 'px'}
return <div className="Userpic" style={style} />;
}
}
export default connect(
(state, {account, ...restOfProps}) => {
const account_obj = state.global.getIn(['accounts', account]);
return { account: account_obj ? account_obj.toJS() : null, ...restOfProps }
}
)(Userpic)
| import React, {Component, PropTypes} from 'react';
import {connect} from 'react-redux';
class Userpic extends Component {
// account is specified as string, but converted to object in connect
static propTypes = {
account: PropTypes.object
}
render() {
const {account, width, height} = this.props
const hideIfDefault = this.props.hideIfDefault || false
let url = null;
// try to extract image url from users metaData
try {
const md = JSON.parse(account.json_metadata);
if(md.profile) url = md.profile.profile_image;
} catch (e) {}
if (url && /^(https?:)\/\//.test(url)) {
const size = width && width > 48 ? '320x320' : '90x90';
url = $STM_Config.img_proxy_prefix + size + '/' + url;
} else {
if(hideIfDefault) {
return null;
}
url = require('app/assets/images/user.png');
}
const style = {backgroundImage: 'url(' + url + ')',
width: (width || 48) + 'px',
height: (height || 48) + 'px'}
return <div className="Userpic" style={style} />;
}
}
export default connect(
(state, {account, ...restOfProps}) => {
const account_obj = state.global.getIn(['accounts', account]);
return { account: account_obj ? account_obj.toJS() : null, ...restOfProps }
}
)(Userpic)
| Add greater pixel density for user comment thumbnails for improved retina/high resolution displays | Add greater pixel density for user comment thumbnails for improved retina/high resolution displays
| JSX | mit | GolosChain/tolstoy,steemit/steemit.com,GolosChain/tolstoy,steemit/steemit.com,TimCliff/steemit.com,GolosChain/tolstoy,steemit/steemit.com,TimCliff/steemit.com,TimCliff/steemit.com | ---
+++
@@ -20,7 +20,7 @@
} catch (e) {}
if (url && /^(https?:)\/\//.test(url)) {
- const size = width && width > 48 ? '320x320' : '72x72'
+ const size = width && width > 48 ? '320x320' : '90x90';
url = $STM_Config.img_proxy_prefix + size + '/' + url;
} else {
if(hideIfDefault) { |
057902c969f4aef836c751c8f9410020dea65218 | app/Resources/client/jsx/project/helpers/removeTraitFromProject.jsx | app/Resources/client/jsx/project/helpers/removeTraitFromProject.jsx | function removeTraitFromProject(traitName, biom, dimension, dbVersion,internalProjectId, action) {
let entries = dimension === 'columns' ? biom.columns : biom.rows
for(let entry of entries){
if(entry.metadata != null){
delete entry.metadata[traitName]
if(entry.metadata.trait_citations != null){
delete entry.metadata.trait_citations[traitName]
}
}
}
let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbversion});
$.ajax(webserviceUrl, {
data: {
"project_id": internalProjectId,
"biom": biom.toString()
},
method: "POST",
success: action,
error: (error) => showMessageDialog(error, 'danger')
});
}
module.exports = removeTraitFromProject; | function removeTraitFromProject(traitName, biom, dimension, dbVersion,internalProjectId, action) {
let entries = dimension === 'columns' ? biom.columns : biom.rows
for(let entry of entries){
if(entry.metadata != null){
delete entry.metadata[traitName]
if(entry.metadata.trait_citations != null){
delete entry.metadata.trait_citations[traitName]
}
}
}
let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbversion});
$.ajax(webserviceUrl, {
data: {
"projectId": internalProjectId,
"biom": biom.toString()
},
method: "POST",
success: action,
error: (error) => showMessageDialog(error, 'danger')
});
}
module.exports = removeTraitFromProject; | Fix delete button for removing traits | Fix delete button for removing traits
| JSX | mit | molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec | ---
+++
@@ -11,7 +11,7 @@
let webserviceUrl = Routing.generate('api_edit_update_project', {'dbversion': dbversion});
$.ajax(webserviceUrl, {
data: {
- "project_id": internalProjectId,
+ "projectId": internalProjectId,
"biom": biom.toString()
},
method: "POST", |
21e06ac2f8517fcd598de8204dd88d2e190bc7a8 | app/components/Html/Html.jsx | app/components/Html/Html.jsx | import React, {Component, PropTypes} from 'react';
class Html extends Component {
constructor(props) {
super(props);
}
render() {
return (
<html lang="en">
<head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no" />
<link href="http://fonts.googleapis.com/css?family=Roboto+Slab:300,400|Roboto:300,400,700,300italic" rel="stylesheet" type="text/css" />
<title>{this.props.title || 'DG | 707'}</title>
<style>{this.props.cssString}</style>
</head>
<body>
<div
id="app"
className="app"
dangerouslySetInnerHTML={{__html: this.props.innerContent}}
/>
<script src={this.props.scriptFileName}></script>
</body>
</html>
);
}
}
Html.propTypes = {
cssString: PropTypes.string.isRequired,
innerContent: PropTypes.string.isRequired,
scriptFileName: PropTypes.string.isRequired,
title: PropTypes.string
};
export default Html;
| import React, {Component, PropTypes} from 'react';
class Html extends Component {
constructor(props) {
super(props);
}
render() {
return (
<html lang="en">
<head>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no" />
<link href="http://fonts.googleapis.com/css?family=Roboto+Slab:300,400|Roboto:300,400,700,300italic" rel="stylesheet" type="text/css" />
<title>{this.props.title || 'DG | 707'}</title>
<style dangerouslySetInnerHTML={{__html: this.props.cssString}}></style>
</head>
<body>
<div
id="app"
className="app"
dangerouslySetInnerHTML={{__html: this.props.innerContent}}
/>
<script src={this.props.scriptFileName}></script>
</body>
</html>
);
}
}
Html.propTypes = {
cssString: PropTypes.string.isRequired,
innerContent: PropTypes.string.isRequired,
scriptFileName: PropTypes.string.isRequired,
title: PropTypes.string
};
export default Html;
| Fix single quotes getting lost in CSS | Fix single quotes getting lost in CSS
| JSX | mit | davidgilbertson/davidg-site,davidgilbertson/davidg-site | ---
+++
@@ -13,7 +13,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no" />
<link href="http://fonts.googleapis.com/css?family=Roboto+Slab:300,400|Roboto:300,400,700,300italic" rel="stylesheet" type="text/css" />
<title>{this.props.title || 'DG | 707'}</title>
- <style>{this.props.cssString}</style>
+ <style dangerouslySetInnerHTML={{__html: this.props.cssString}}></style>
</head>
<body> |
ef1e5b8d19772047c7f67aa6ac660937c25c4d51 | static/js/src/ImageUpload.jsx | static/js/src/ImageUpload.jsx | var React = require('react');
var Chat = require('./Chat.jsx');
var Actions = require('./Actions');
var ImageUpload = require('./ImageUpload.jsx');
var ImageUpload = React.createClass({
handleChange: function(e) {
if (this.props.readyState === 1) {
var that = this;
var reader = new FileReader();
reader.onload = function(e) {
var img = new Image();
img.src = e.target.result;
that.props.addElement(img);
};
Array.prototype.forEach.call(e.target.files, function(curr) {
reader.readAsDataURL(curr);
});
}
},
render: function() {
var labelName = 'imageuploadlabel';
var inputName = 'imageupload';
var disabled = false;
if (this.props.readyState !== 1) {
disabled = 'disabled';
labelName += ' disabled';
inputName += ' disabled';
}
return (
<label title={this.props.title} className={labelName}><input type="file" disabled={disabled} className={inputName} onChange={this.handleChange} /></label>
);
}
});
module.exports = ImageUpload; | var React = require('react');
var Chat = require('./Chat.jsx');
var Actions = require('./Actions');
var ImageUpload = require('./ImageUpload.jsx');
var ImageUpload = React.createClass({
handleChange: function(e) {
if (this.props.readyState === 1) {
var that = this;
var reader = new FileReader();
reader.onload = function(e) {
var img = new Image();
img.src = e.target.result;
that.props.addElement(img);
};
Array.prototype.forEach.call(e.target.files, function(curr) {
reader.readAsDataURL(curr);
});
}
},
render: function() {
var labelName = 'imageuploadlabel';
var inputName = 'imageupload';
var disabled = false;
if (this.props.readyState !== 1) {
disabled = 'disabled';
labelName += ' disabled';
inputName += ' disabled';
}
return (
<label title={this.props.title} className={labelName}><input type="file" disabled={disabled} className={inputName} onChange={this.handleChange} value="" /></label>
);
}
});
module.exports = ImageUpload; | Set image file input value to blank\n\n event was only firing once; keep input value clear to allow event to keep firing | Set image file input value to blank\n\n event was only firing once; keep input value clear to allow event to keep firing
| JSX | mit | ebenpack/chatblast,ebenpack/chatblast,ebenpack/chatblast | ---
+++
@@ -28,7 +28,7 @@
inputName += ' disabled';
}
return (
- <label title={this.props.title} className={labelName}><input type="file" disabled={disabled} className={inputName} onChange={this.handleChange} /></label>
+ <label title={this.props.title} className={labelName}><input type="file" disabled={disabled} className={inputName} onChange={this.handleChange} value="" /></label>
);
}
}); |
10459b1379a21e33bdcf46baab19b81f04722181 | client/src/components/Base.jsx | client/src/components/Base.jsx | import React from 'react';
import { NavLink, Link } from 'react-router-dom';
const Base = () => (
<div>
<div className="top-bar">
<div className="top-bar-left">
<NavLink exact to="/">Fridgr</NavLink>
</div>
<div className="top-bar-right">
<Link to="/login">Log in</Link>
<Link to="/signup">Sign up</Link>
</div>
</div>
</div>
);
export default Base;
| import React from 'react';
import { NavLink, Link } from 'react-router-dom';
import AppBar from 'material-ui/AppBar';
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import { Router, hashHistory, Route, IndexRoute, withRouter } from 'react-router'; // here in attempt to make the title clickable
class Base extends React.Component {
constructor(props) {
super(props);
this.state = {
open: false
};
}
handleToggle(event) {
this.setState({ open: !this.state.open });
}
handleClose() {
this.setState({open: false});
}
render() {
return (
<div>
<AppBar
onLeftIconButtonTouchTap={this.handleToggle.bind(this)}
onLeftIconButtonClick={this.handleToggle.bind(this)}
title="Fridgr"
/>
<Drawer
docked={false}
open={this.state.open}
onRequestChange={open => this.setState({ open })}
>
<MenuItem onTouchTap={this.handleClose.bind(this)} primaryText="Login" containerElement={<Link to="/login"/>}/>
<MenuItem onTouchTap={this.handleClose.bind(this)} primaryText="Sign Up" containerElement={<Link to="/signup"/>}/>
</Drawer>
</div>
);
}
}
export default Base;
/*
<div className="top-bar">
<div className="top-bar-left">
<NavLink exact to="/">Fridgr</NavLink>
</div>
<div className="top-bar-right">
<Link to="/login">Log in</Link>
<Link to="/signup">Sign up</Link>
</div>
</div>
*/
| Change to App Bar implementation | Change to App Bar implementation
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -1,9 +1,51 @@
import React from 'react';
import { NavLink, Link } from 'react-router-dom';
+import AppBar from 'material-ui/AppBar';
+import Drawer from 'material-ui/Drawer';
+import MenuItem from 'material-ui/MenuItem';
+import { Router, hashHistory, Route, IndexRoute, withRouter } from 'react-router'; // here in attempt to make the title clickable
-const Base = () => (
- <div>
+class Base extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {
+ open: false
+ };
+ }
+
+ handleToggle(event) {
+ this.setState({ open: !this.state.open });
+ }
+
+ handleClose() {
+ this.setState({open: false});
+ }
+
+ render() {
+ return (
+ <div>
+ <AppBar
+ onLeftIconButtonTouchTap={this.handleToggle.bind(this)}
+ onLeftIconButtonClick={this.handleToggle.bind(this)}
+ title="Fridgr"
+ />
+ <Drawer
+ docked={false}
+ open={this.state.open}
+ onRequestChange={open => this.setState({ open })}
+ >
+ <MenuItem onTouchTap={this.handleClose.bind(this)} primaryText="Login" containerElement={<Link to="/login"/>}/>
+ <MenuItem onTouchTap={this.handleClose.bind(this)} primaryText="Sign Up" containerElement={<Link to="/signup"/>}/>
+ </Drawer>
+ </div>
+ );
+ }
+}
+
+export default Base;
+/*
<div className="top-bar">
<div className="top-bar-left">
<NavLink exact to="/">Fridgr</NavLink>
@@ -15,8 +57,4 @@
</div>
</div>
-
- </div>
-);
-
-export default Base;
+*/ |
3918f5322541212ae96b13dfd407ddc9bed18e50 | client/app/main.jsx | client/app/main.jsx | import alt from './libs/alt';
import makeFinalStore from 'alt/utils/makeFinalStore';
import React from 'react';
import App from './views/App';
import VertxActions from './actions/VertxActions.js';
function main() {
const finalStore = makeFinalStore(alt);
finalStore.listen(() => {
console.log("Dispatch cycle complete");
});
const app = document.createElement('div');
document.body.appendChild(app);
React.render(<App />, app);
}
main();
VertxActions.doVertxConnect(); | import alt from './libs/alt';
import makeFinalStore from 'alt/utils/makeFinalStore';
import React from 'react';
import App from './views/App';
import VertxActions from './actions/VertxActions.js';
function main() {
const finalStore = makeFinalStore(alt);
finalStore.listen(() => {
console.log("Dispatch cycle complete");
});
const app = document.createElement('div');
document.body.appendChild(app);
React.render(<App />, app);
}
main();
const Vertx = require('vertx3-eventbus-client');
var eb = new Vertx("http://localhost:8080/eventbus");
eb.onopen = function () {
eb.send("org.mmog2048", {"msg":"From the client"});
};
| Send a message from the client | Send a message from the client
| JSX | mit | kaerfredoc/2048MMOG,kaerfredoc/2048MMOG,kaerfredoc/2048MMOG | ---
+++
@@ -18,4 +18,9 @@
}
main();
-VertxActions.doVertxConnect();
+
+const Vertx = require('vertx3-eventbus-client');
+var eb = new Vertx("http://localhost:8080/eventbus");
+eb.onopen = function () {
+ eb.send("org.mmog2048", {"msg":"From the client"});
+}; |
bdc13a0ed68af8bf2c6a689982e7364c62ce3634 | voting-client/test/components/Voting_spec.jsx | voting-client/test/components/Voting_spec.jsx | import Voting from '../../src/components/Voting';
import ReactDOM from 'react-dom';
import {
renderIntoDocument,
scryRenderedDOMComponentsWithTag,
Simulate
} from 'react-addons-test-utils';
import Voting from '../../src/components/Voting';
import {expect} from 'chai';
desribe('Voting', () => {
it('renders a pair of buttons', () => {
const component = renderIntoDocument(
<Voting pair={['Trainspotting', '28 Days Later']} />
);
const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
expect(buttons.length).to.equal(2);
expect(buttons[0].textContent).to.equal('Trainspotting');
expect(buttons[0].textContent).to.equal('28 Days Later');
});
it('invokes callback when a button is clicked', () => {
let votedWith;
const vote = (entry) => votedWith = entry;
const component = renderIntoDocument(
<Voting
pair={['Trainspotting', '28 Days Later']}
vote={vote} />
);
const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
Simulate.click(buttons[0]);
expect(votedWith).to.equal('Trainspotting');
});
});
| import Voting from '../../src/components/Voting';
import ReactDOM from 'react-dom';
import {
renderIntoDocument,
scryRenderedDOMComponentsWithTag,
Simulate
} from 'react-addons-test-utils';
import Voting from '../../src/components/Voting';
import {expect} from 'chai';
desribe('Voting', () => {
it('renders a pair of buttons', () => {
const component = renderIntoDocument(
<Voting pair={['Trainspotting', '28 Days Later']} />
);
const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
expect(buttons.length).to.equal(2);
expect(buttons[0].textContent).to.equal('Trainspotting');
expect(buttons[0].textContent).to.equal('28 Days Later');
});
it('invokes callback when a button is clicked', () => {
let votedWith;
const vote = (entry) => votedWith = entry;
const component = renderIntoDocument(
<Voting
pair={['Trainspotting', '28 Days Later']}
vote={vote} />
);
const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
Simulate.click(buttons[0]);
expect(votedWith).to.equal('Trainspotting');
});
it('disables butons when user has voted', () => {
const component = renderIntoDocument(
<Voting pair={['Trainspotting', '28 Days Later']} hasVoted='Trainspotting' />
);
const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
expect(buttons.length).to.equal(2);
expect(buttons[0].hasAttribute('disabled')).to.equal(true);
expect(buttons[1].hasAttribute('disabled')).to.equal(true);
});
});
| Add unit test for disabled button state | Add unit test for disabled button state
| JSX | mit | danshapiro-optimizely/full_stack_redux | ---
+++
@@ -36,4 +36,15 @@
expect(votedWith).to.equal('Trainspotting');
});
+ it('disables butons when user has voted', () => {
+ const component = renderIntoDocument(
+ <Voting pair={['Trainspotting', '28 Days Later']} hasVoted='Trainspotting' />
+ );
+ const buttons = scryRenderedDOMComponentsWithTag(component, 'button');
+
+ expect(buttons.length).to.equal(2);
+ expect(buttons[0].hasAttribute('disabled')).to.equal(true);
+ expect(buttons[1].hasAttribute('disabled')).to.equal(true);
+ });
+
}); |
f7a20d2b32aa65d278f9f501cf89b95094757a96 | examples/source/components/InnerMenuBlockGather.jsx | examples/source/components/InnerMenuBlockGather.jsx | import React, { Component } from "react";
import { contextMenu } from "downright";
import PaddedBox from "../layout/PaddedBox";
import Heading from "../styles/Heading";
@contextMenu(
() => [<Heading>Inner menu 3</Heading>, "Fully blocks outer menu"],
{
stopGathering: true
}
)
export default class InnerMenuBlockGather extends Component {
render = () => <PaddedBox blue>Nested, appending</PaddedBox>;
}
| import React, { Component } from "react";
import { contextMenu } from "downright";
import PaddedBox from "../layout/PaddedBox";
import Heading from "../styles/Heading";
@contextMenu(
() => [<Heading>Inner menu 3</Heading>, "Fully blocks outer menu"],
{
stopGathering: true
}
)
export default class InnerMenuBlockGather extends Component {
render = () => <PaddedBox blue>Nested, blocking</PaddedBox>;
}
| Fix text on nested example | Fix text on nested example
| JSX | mit | downplay/downright | ---
+++
@@ -10,5 +10,5 @@
}
)
export default class InnerMenuBlockGather extends Component {
- render = () => <PaddedBox blue>Nested, appending</PaddedBox>;
+ render = () => <PaddedBox blue>Nested, blocking</PaddedBox>;
} |
91fdece57656a4abd0d4c0b4abd155bf6dcf3421 | js/components/AppVersionListComponent.jsx | js/components/AppVersionListComponent.jsx | /** @jsx React.DOM */
define([
"React",
"jsx!components/AppVersionListItemComponent",
], function(React, AppVersionListItemComponent) {
return React.createClass({
displayName: "AppVersionListComponent",
propTypes: {
app: React.PropTypes.object.isRequired,
appVersions: React.PropTypes.array,
onRollback: React.PropTypes.func
},
getInitialState: function() {
return {
expandedAppVersions: {}
};
},
render: function() {
var listItems;
if (this.props.appVersions == null) {
listItems = (
<tr><td className="text-muted text-center">Loading versions...</td></tr>
);
} else {
if (this.props.appVersions.length > 0) {
listItems = [];
this.props.appVersions.forEach(function(v) {
return (
<AppVersionListItemComponent
app={this.props.app}
appVersion={v}
key={v.get("version")}
onRollback={this.props.onRollback}
onShowDetails={this.props.onShowDetails} />
);
}, this);
} else {
listItems = <tr><td className="text-muted text-center">No previous versions</td></tr>
}
}
return (
<table className="table table-selectable">
<tbody>
{listItems}
</tbody>
</table>
);
}
});
});
| /** @jsx React.DOM */
define([
"React",
"jsx!components/AppVersionListItemComponent",
], function(React, AppVersionListItemComponent) {
return React.createClass({
displayName: "AppVersionListComponent",
propTypes: {
app: React.PropTypes.object.isRequired,
appVersions: React.PropTypes.array,
onRollback: React.PropTypes.func
},
getInitialState: function() {
return {
expandedAppVersions: {}
};
},
render: function() {
var listItems;
if (this.props.appVersions == null) {
listItems = (
<tr><td className="text-muted text-center">Loading versions...</td></tr>
);
} else {
if (this.props.appVersions.length > 0) {
listItems = this.props.appVersions.map(function(v) {
return (
<AppVersionListItemComponent
app={this.props.app}
appVersion={v}
key={v.get("version")}
onRollback={this.props.onRollback}
onShowDetails={this.props.onShowDetails} />
);
}, this);
} else {
listItems = <tr><td className="text-muted text-center">No previous versions</td></tr>
}
}
return (
<table className="table table-selectable">
<tbody>
{listItems}
</tbody>
</table>
);
}
});
});
| Use `map` to render app versions | Use `map` to render app versions | JSX | apache-2.0 | pierlo-upitup/marathon-ui,Raffo/marathon-ui,Raffo/marathon-ui,pierlo-upitup/marathon-ui,janisz/marathon-ui,mesosphere/marathon-ui,mesosphere/marathon-ui,Kosta-Github/marathon-ui,cribalik/marathon-ui,cribalik/marathon-ui,Kosta-Github/marathon-ui,yp-engineering/marathon-ui,yp-engineering/marathon-ui,quamilek/marathon-ui,janisz/marathon-ui,watonyweng/marathon-ui,watonyweng/marathon-ui,quamilek/marathon-ui | ---
+++
@@ -27,8 +27,7 @@
);
} else {
if (this.props.appVersions.length > 0) {
- listItems = [];
- this.props.appVersions.forEach(function(v) {
+ listItems = this.props.appVersions.map(function(v) {
return (
<AppVersionListItemComponent
app={this.props.app} |
41af2bcd135cce5de57cb489ef8f00d4acec8da8 | src/ui/pane/quick_auth_pane.jsx | src/ui/pane/quick_auth_pane.jsx | import React from 'react';
import AuthButton from '../button/auth_button';
const QuickAuthPane = (props) => {
const {
alternativeLabel,
alternativeClickHandler,
buttonLabel,
buttonClickHandler,
header,
strategy
} = props;
return (
<div className="auth0-lock-last-login-pane">
{header}
<AuthButton
label={buttonLabel}
onClick={e => {e.preventDefault(); buttonClickHandler(e)}}
strategy={strategy}
/>
<p className="auth0-lock-alternative">
<a
className="auth0-lock-alternative-link"
href="#"
onClick={e => {e.preventDefault(); alternativeClickHandler(e)}}
>
{alternativeLabel}
</a>
</p>
<div className="auth0-loading-container">
<div className="auth0-loading" />
</div>
</div>
);
};
QuickAuthPane.propTypes = {
alternativeLabel: React.PropTypes.string.isRequired,
alternativeClickHandler: React.PropTypes.func.isRequired,
buttonLabel: React.PropTypes.string.isRequired,
buttonClickHandler: React.PropTypes.func.isRequired,
header: React.PropTypes.element,
strategy: React.PropTypes.string.isRequired
};
export default QuickAuthPane;
| import React from 'react';
import AuthButton from '../button/auth_button';
const QuickAuthPane = (props) => {
const {
alternativeLabel,
alternativeClickHandler,
buttonLabel,
buttonClickHandler,
header,
strategy
} = props;
const alternative = alternativeLabel
? <p className="auth0-lock-alternative">
<a
className="auth0-lock-alternative-link"
href="#"
onClick={e => {e.preventDefault(); alternativeClickHandler(e)}}
>
{alternativeLabel}
</a>
</p>
: null;
return (
<div className="auth0-lock-last-login-pane">
{header}
<AuthButton
label={buttonLabel}
onClick={e => {e.preventDefault(); buttonClickHandler(e)}}
strategy={strategy}
/>
{alternative}
<div className="auth0-loading-container">
<div className="auth0-loading" />
</div>
</div>
);
};
QuickAuthPane.propTypes = {
alternativeLabel: React.PropTypes.string,
alternativeClickHandler: (props, propName, component) => {
if (props.alternativeLabel !== undefined) {
return React.PropTypes.func.isRequired(props, propName, component)
}
},
buttonLabel: React.PropTypes.string.isRequired,
buttonClickHandler: React.PropTypes.func.isRequired,
header: React.PropTypes.element,
strategy: React.PropTypes.string.isRequired
};
export default QuickAuthPane;
| Make alternative link optional in QuickAuthPane | Make alternative link optional in QuickAuthPane
| JSX | mit | mike-casas/lock,mike-casas/lock,mike-casas/lock | ---
+++
@@ -11,6 +11,19 @@
strategy
} = props;
+ const alternative = alternativeLabel
+ ? <p className="auth0-lock-alternative">
+ <a
+ className="auth0-lock-alternative-link"
+ href="#"
+ onClick={e => {e.preventDefault(); alternativeClickHandler(e)}}
+ >
+ {alternativeLabel}
+ </a>
+ </p>
+ : null;
+
+
return (
<div className="auth0-lock-last-login-pane">
{header}
@@ -21,15 +34,7 @@
strategy={strategy}
/>
- <p className="auth0-lock-alternative">
- <a
- className="auth0-lock-alternative-link"
- href="#"
- onClick={e => {e.preventDefault(); alternativeClickHandler(e)}}
- >
- {alternativeLabel}
- </a>
- </p>
+ {alternative}
<div className="auth0-loading-container">
<div className="auth0-loading" />
@@ -39,8 +44,12 @@
};
QuickAuthPane.propTypes = {
- alternativeLabel: React.PropTypes.string.isRequired,
- alternativeClickHandler: React.PropTypes.func.isRequired,
+ alternativeLabel: React.PropTypes.string,
+ alternativeClickHandler: (props, propName, component) => {
+ if (props.alternativeLabel !== undefined) {
+ return React.PropTypes.func.isRequired(props, propName, component)
+ }
+ },
buttonLabel: React.PropTypes.string.isRequired,
buttonClickHandler: React.PropTypes.func.isRequired,
header: React.PropTypes.element, |
9ba9a6b87ea3f983a8fc765ae9ff3e0c16ca3947 | tutor/src/components/scores/average-info.jsx | tutor/src/components/scores/average-info.jsx | import React from 'react';
import { Popover, OverlayTrigger } from 'react-bootstrap';
import Icon from '../icon';
const TUTOR_AVERAGE_INFO = `\
Class averages are not displayed or included in the overall average until
after the assignment due date.
At that time, scores from all assignments, both complete and incomplete, are included.\
`;
const CC_AVERAGE_INFO = `\
Scores from completed assignments
(in which all questions have been answered)
are included in class and overall averages.\
`;
export default class AverageInfo extends React.PureComponent {
static propTypes = {
isConceptCoach: React.PropTypes.bool.isRequired,
}
render() {
const title = 'Class and Overall Averages';
const body =
this.props.isConceptCoach ?
CC_AVERAGE_INFO
:
TUTOR_AVERAGE_INFO;
const popover =
<Popover
title={title}
id="scores-average-info-popover"
className="scores-average-info-popover">
{body}
</Popover>;
return (
<OverlayTrigger
ref="overlay"
placement="right"
trigger="click"
rootClose={true}
overlay={popover}>
<Icon type="info-circle" />
</OverlayTrigger>
);
}
}
| import React from 'react';
import { Popover, OverlayTrigger } from 'react-bootstrap';
import Icon from '../icon';
const TUTOR_AVERAGE_INFO = `\
Class performance reflects class-wide averages of assignment scores and assignment progress. This metric includes scores and work
completed by the due date.\
`;
const CC_AVERAGE_INFO = `\
Scores from completed assignments
(in which all questions have been answered)
are included in class and overall averages.\
`;
export default class AverageInfo extends React.PureComponent {
static propTypes = {
isConceptCoach: React.PropTypes.bool.isRequired,
}
render() {
const title = 'Class performance';
const body =
this.props.isConceptCoach ?
CC_AVERAGE_INFO
:
TUTOR_AVERAGE_INFO;
const popover =
<Popover
title={title}
id="scores-average-info-popover"
className="scores-average-info-popover">
{body}
</Popover>;
return (
<OverlayTrigger
ref="overlay"
placement="right"
trigger="click"
rootClose={true}
overlay={popover}>
<Icon type="info-circle" />
</OverlayTrigger>
);
}
}
| Update Class Performance (i) copy | Update Class Performance (i) copy
Per mockup: http://4tk3oi.axshare.com/tutor_scores_paired_new_tabs_toolbar_dashboard_sty_2.html#choose_settings_tab=lms&CSUM=1 | JSX | agpl-3.0 | openstax/tutor-js,openstax/tutor-js,openstax/tutor-js,openstax/tutor-js,openstax/tutor-js | ---
+++
@@ -3,9 +3,8 @@
import Icon from '../icon';
const TUTOR_AVERAGE_INFO = `\
-Class averages are not displayed or included in the overall average until
- after the assignment due date.
- At that time, scores from all assignments, both complete and incomplete, are included.\
+Class performance reflects class-wide averages of assignment scores and assignment progress. This metric includes scores and work
+completed by the due date.\
`;
const CC_AVERAGE_INFO = `\
@@ -22,7 +21,7 @@
}
render() {
- const title = 'Class and Overall Averages';
+ const title = 'Class performance';
const body =
this.props.isConceptCoach ? |
0b60a7bf993d3247aa763ab6e9d979f51c802104 | web-server/app/assets/javascripts/components/updates/show-update-component.jsx | web-server/app/assets/javascripts/components/updates/show-update-component.jsx | define(function(require) {
var _ = require('underscore'),
React = require('react'),
Status = require('../../stores/status'),
StatusComponent = require('../../components/updates/status-component'),
showModel = require('../../mixins/show-model');
var ShowUpdateComponent = React.createClass({
contextTypes: {
router: React.PropTypes.func
},
mixins: [showModel],
whereClause: function() {
var params = this.context.router.getCurrentParams();
return {id: parseInt(params.id)};
},
showView: function() {
var rows = _.map(this.state.Model.attributes, function(value, key) {
return (
<tr>
<td>
{key}
</td>
<td>
{value}
</td>
</tr>
);
});
return (
<div>
<div className="row">
<div className="col-md-12">
<h1>
Update ID: {this.state.Model.get('id')}
</h1>
</div>
</div>
<br/>
<div className="row">
<div className="col-md-12">
<table className="table table-striped table-bordered">
<tbody>
{ rows }
</tbody>
</table>
</div>
</div>
<StatusComponent Model={new Status({}, {updateId: this.state.Model.get('id')})} />
</div>
);
}
});
return ShowUpdateComponent;
});
| define(function(require) {
var _ = require('underscore'),
React = require('react'),
Status = require('../../stores/status'),
StatusComponent = require('../../components/updates/status-component'),
showModel = require('../../mixins/show-model');
var ShowUpdateComponent = React.createClass({
contextTypes: {
router: React.PropTypes.func
},
mixins: [showModel],
whereClause: function() {
var params = this.context.router.getCurrentParams();
return {id: params.id};
},
showView: function() {
var rows = _.map(this.state.Model.attributes, function(value, key) {
return (
<tr>
<td>
{key}
</td>
<td>
{value}
</td>
</tr>
);
});
return (
<div>
<div className="row">
<div className="col-md-12">
<h1>
Update ID: {this.state.Model.get('id')}
</h1>
</div>
</div>
<br/>
<div className="row">
<div className="col-md-12">
<table className="table table-striped table-bordered">
<tbody>
{ rows }
</tbody>
</table>
</div>
</div>
<StatusComponent Model={new Status({}, {updateId: this.state.Model.get('id')})} />
</div>
);
}
});
return ShowUpdateComponent;
});
| Fix show update campaign to use UUID | Fix show update campaign to use UUID
| JSX | mpl-2.0 | PDXostc/rvi_sota_server,PDXostc/rvi_sota_server,PDXostc/rvi_sota_server | ---
+++
@@ -12,7 +12,7 @@
mixins: [showModel],
whereClause: function() {
var params = this.context.router.getCurrentParams();
- return {id: parseInt(params.id)};
+ return {id: params.id};
},
showView: function() {
var rows = _.map(this.state.Model.attributes, function(value, key) { |
438eb55b1a59c8d359d6f1520c77a8e64a0bcfa7 | docs/src/app/components/pages/components/avatar.jsx | docs/src/app/components/pages/components/avatar.jsx | var React = require('react');
var mui = require('mui');
var Avatar = mui.Avatar;
var Icon = mui.Icon;
var ComponentDoc = require('../../component-doc.jsx');
var AvatarPage = React.createClass({
render: function() {
var avatarCode = '<Avatar className="my-custom-avatar">KS</Avatar>\n\n' +
'<Avatar className="my-custom-avatar"><Icon>face</Icon></Avatar>\n\n' +
'// in your css...\n' +
'.my-custom-avatar { background-color: red; }';
var avatarDesc = (
<p className="mui-font-style-subhead-1">
The Avatar component is very simple. Basically, it renders a circle with some centered content inside of it.<br/>
You can put anything inside of it, and it can be styled with regular css.<br/>
The default size is 40px, but you can set your own width/height in css, or in inline-styles if you like.<br/>
You can embed an Icon, an img, or just some plain old text.
</p>
);
var componentInfo = [];
return (
<div>
<ComponentDoc
name="Avatar"
code={avatarCode}
desc={avatarDesc}
componentInfo={componentInfo}>
<Avatar style={{backgroundColor: "red"}}>KS</Avatar>
<br/>
<Avatar><Icon>face</Icon></Avatar>
</ComponentDoc>
</div>
);
}
});
module.exports = AvatarPage;
| var React = require('react');
var mui = require('mui');
var Avatar = mui.Avatar;
var Icon = mui.Icon;
var ComponentDoc = require('../../component-doc.jsx');
var AvatarPage = React.createClass({
render: function() {
var avatarCode = '<Avatar className="my-custom-avatar">KS</Avatar>\n\n' +
'<Avatar><Icon>face</Icon></Avatar>\n\n' +
'// in your css...\n' +
'.my-custom-avatar { background-color: red; }';
var avatarDesc = (
<p className="mui-font-style-subhead-1">
The Avatar component is very simple. Basically, it renders a circle with some centered content inside of it.<br/>
You can put anything inside of it, and it can be styled with regular css.<br/>
The default size is 40px, but you can set your own width/height in css, or in inline-styles if you like.<br/>
You can embed an Icon, an img, or just some plain old text.
</p>
);
var componentInfo = [];
return (
<div>
<ComponentDoc
name="Avatar"
code={avatarCode}
desc={avatarDesc}
componentInfo={componentInfo}>
<Avatar style={{backgroundColor: "red"}}>KS</Avatar>
<br/>
<Avatar><Icon>face</Icon></Avatar>
</ComponentDoc>
</div>
);
}
});
module.exports = AvatarPage;
| Fix wrong className on Avatar documentation | Fix wrong className on Avatar documentation
| JSX | mit | pschlette/material-ui-with-sass,sarink/material-ui-with-sass,pschlette/material-ui-with-sass,sarink/material-ui-with-sass | ---
+++
@@ -7,7 +7,7 @@
var AvatarPage = React.createClass({
render: function() {
var avatarCode = '<Avatar className="my-custom-avatar">KS</Avatar>\n\n' +
- '<Avatar className="my-custom-avatar"><Icon>face</Icon></Avatar>\n\n' +
+ '<Avatar><Icon>face</Icon></Avatar>\n\n' +
'// in your css...\n' +
'.my-custom-avatar { background-color: red; }';
var avatarDesc = ( |
1eb7ff2925ef77ecacfc362da16c992439179fca | BlazarUI/app/scripts/components/branch-state/CommitInfo.jsx | BlazarUI/app/scripts/components/branch-state/CommitInfo.jsx | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Icon from '../shared/Icon.jsx';
import CommitLink from './CommitLink.jsx';
import CompareCommitsLink from './CompareCommitsLink.jsx';
const CommitInfo = ({commitInfo}) => {
const previousCommit = <CommitLink commit={commitInfo.get('previous')} />;
const currentCommit = <CommitLink commit={commitInfo.get('current')} />;
const arrow = <Icon name="long-arrow-right" />;
const compareLink = <CompareCommitsLink className="commit-info__compare-link" commitInfo={commitInfo} />;
return (
<p className="module-build__commit-info" onClick={(e) => e.stopPropagation()}>
{previousCommit} {arrow} {currentCommit}{compareLink}
</p>
);
};
CommitInfo.propTypes = {
commitInfo: ImmutablePropTypes.mapContains({
current: ImmutablePropTypes.map,
previous: ImmutablePropTypes.map
})
};
export default CommitInfo;
| import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Icon from '../shared/Icon.jsx';
import CommitLink from './CommitLink.jsx';
import CompareCommitsLink from './CompareCommitsLink.jsx';
const CommitInfo = ({commitInfo}) => {
if (!commitInfo.get('previous')) {
return <CommitLink commit={commitInfo.get('current')} />;
}
const previousCommit = <CommitLink commit={commitInfo.get('previous')} />;
const currentCommit = <CommitLink commit={commitInfo.get('current')} />;
const arrow = <Icon name="long-arrow-right" />;
const compareLink = <CompareCommitsLink className="commit-info__compare-link" commitInfo={commitInfo} />;
return (
<p className="module-build__commit-info" onClick={(e) => e.stopPropagation()}>
{previousCommit} {arrow} {currentCommit}{compareLink}
</p>
);
};
CommitInfo.propTypes = {
commitInfo: ImmutablePropTypes.mapContains({
current: ImmutablePropTypes.map,
previous: ImmutablePropTypes.map
})
};
export default CommitInfo;
| Handle commit info for first build in branch when there is no previous build | Handle commit info for first build in branch when there is no previous build
| JSX | apache-2.0 | HubSpot/Blazar,HubSpot/Blazar,HubSpot/Blazar,HubSpot/Blazar | ---
+++
@@ -5,6 +5,10 @@
import CompareCommitsLink from './CompareCommitsLink.jsx';
const CommitInfo = ({commitInfo}) => {
+ if (!commitInfo.get('previous')) {
+ return <CommitLink commit={commitInfo.get('current')} />;
+ }
+
const previousCommit = <CommitLink commit={commitInfo.get('previous')} />;
const currentCommit = <CommitLink commit={commitInfo.get('current')} />;
const arrow = <Icon name="long-arrow-right" />; |
1e5e25b7f5c25bc68670fcff52b777eee53e0dc5 | src/app/global/NavBar.jsx | src/app/global/NavBar.jsx | import React, { Component } from 'react';
import { Link } from 'react-router'
export default class NavBar extends Component {
constructor(props) {
super(props);
this.state = {
authenticated: true
}
}
render() {
return (
<ul className="nav__list">
{ this.renderNavItems() }
</ul>
)
}
renderNavItems() {
if (this.state.authenticated) {
return (
<span>
<li className="nav__item">
<Link to="/florence/collections" activeClassName="selected" className="nav__link">Collections</Link>
</li>
<li className="nav__item">
<a className="nav__link">Publishing queue</a>
</li>
<li className="nav__item">
<a className="nav__link">Reports</a>
</li>
<li className="nav__item">
<a className="nav__link">Users and access</a>
</li>
<li className="nav__item">
<a className="nav__link">Teams</a>
</li>
<li className="nav__item">
<a className="nav__link">Logout</a>
</li>
</span>
)
} else {
return (
<li className="nav__item">
<a className="nav__link">Login</a>
</li>
)
}
}
} | import React, { Component } from 'react';
import { Link } from 'react-router'
import { connect } from 'react-redux'
class NavBar extends Component {
constructor(props) {
super(props);
}
render() {
return (
<ul className="nav__list">
{ this.renderNavItems() }
</ul>
)
}
renderNavItems() {
if (this.props.isAuthenticated) {
return (
<span>
<li className="nav__item">
<Link to="/florence/collections" activeClassName="selected" className="nav__link">Collections</Link>
</li>
<li className="nav__item">
<a className="nav__link">Publishing queue</a>
</li>
<li className="nav__item">
<a className="nav__link">Reports</a>
</li>
<li className="nav__item">
<a className="nav__link">Users and access</a>
</li>
<li className="nav__item">
<a className="nav__link">Teams</a>
</li>
<li className="nav__item">
<a className="nav__link">Logout</a>
</li>
</span>
)
} else {
return (
<li className="nav__item">
<a className="nav__link">Login</a>
</li>
)
}
}
}
function mapStateToProps(state) {
const isAuthenticated = state.state.user.isAuthenticated;
return {
isAuthenticated
}
}
export default connect(mapStateToProps)(NavBar); | Use mapStateToProps to allow checking if user is authenticated | Use mapStateToProps to allow checking if user is authenticated
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -1,14 +1,12 @@
import React, { Component } from 'react';
import { Link } from 'react-router'
+import { connect } from 'react-redux'
-export default class NavBar extends Component {
+class NavBar extends Component {
constructor(props) {
super(props);
- this.state = {
- authenticated: true
- }
}
render() {
@@ -22,7 +20,7 @@
}
renderNavItems() {
- if (this.state.authenticated) {
+ if (this.props.isAuthenticated) {
return (
<span>
<li className="nav__item">
@@ -60,3 +58,12 @@
}
}
+
+function mapStateToProps(state) {
+ const isAuthenticated = state.state.user.isAuthenticated;
+
+ return {
+ isAuthenticated
+ }
+}
+export default connect(mapStateToProps)(NavBar); |
f410329df36e881983fc324093f170ac135b5b10 | application/client/bootstrap.jsx | application/client/bootstrap.jsx | /* global navigator */
/**
* Handle client side file loading and take
* care for performance due to async loading.
*
* @file
* @module
*
* @author [email protected] (Ulrich Merkel), 2016
* @version 0.0.2
*
* @requires client/loader/offline
* @requires client/loader/async
* @requires common/config/application
* @requires common/utils/logger
*
* @changelog
* - 0.0.2 Added service workers
* - 0.0.1 Basic functions and structure
*/
import configApplication from './../common/config/application';
import logger from './../common/utils/logger';
import './loader/offline';
import loaderAsync from './loader/async';
// Register the service worker if available
if (configApplication.serviceWorker.use && navigator.serviceWorker) {
navigator.serviceWorker.register('./service-worker.bundle.js')
.then(function (reg) {
if (reg.installing) {
return logger.log('Service worker installing');
}
if (reg.waiting) {
return logger.log('Service worker installed');
}
if (reg.active) {
return logger.log('Service worker active');
}
return logger.log('Successfully registered service worker');
})
.catch(function (err) {
logger.warn('Error whilst registering service worker', err);
});
}
// Load assets async to improve performance
loaderAsync.css('/css/app.css');
loaderAsync.js('/js/client.bundle.js');
| /* global navigator */
/**
* Handle client side file loading and take
* care for performance due to async loading.
*
* @file
* @module
*
* @author [email protected] (Ulrich Merkel), 2016
* @version 0.0.2
*
* @requires client/loader/offline
* @requires client/loader/async
* @requires common/config/application
* @requires common/utils/logger
*
* @changelog
* - 0.0.2 Added service workers
* - 0.0.1 Basic functions and structure
*/
import configApplication from './../common/config/application';
import logger from './../common/utils/logger';
import './loader/offline';
import loaderAsync from './loader/async';
// Register the service worker if available
if (configApplication.serviceWorker.use && navigator.serviceWorker) {
navigator.serviceWorker.register('/service-worker.bundle.js')
.then(function (reg) {
if (reg.installing) {
return logger.log('Service worker installing');
}
if (reg.waiting) {
return logger.log('Service worker installed');
}
if (reg.active) {
return logger.log('Service worker active');
}
return logger.log('Successfully registered service worker');
})
.catch(function (err) {
logger.warn('Error whilst registering service worker', err);
});
}
// Load assets async to improve performance
loaderAsync.css('/css/app.css');
loaderAsync.js('/js/client.bundle.js');
| Adjust service worker file path | Adjust service worker file path
| JSX | mit | ulrich-merkel/www.ulrichmerkel.com,ulrich-merkel/www.ulrichmerkel.com,ulrich-merkel/www.ulrichmerkel.com | ---
+++
@@ -25,7 +25,7 @@
// Register the service worker if available
if (configApplication.serviceWorker.use && navigator.serviceWorker) {
- navigator.serviceWorker.register('./service-worker.bundle.js')
+ navigator.serviceWorker.register('/service-worker.bundle.js')
.then(function (reg) {
if (reg.installing) {
return logger.log('Service worker installing'); |
34827509e30b93fe0147794e645dbffb6730b5c4 | src/shell/components/shell-view.jsx | src/shell/components/shell-view.jsx | 'use strict';
require('./shell-view.scss');
var React = require('react');
var glimpse = require('glimpse');
var EmitterMixin = require('lib/components/emitter-mixin');
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.map(function (application) {
return <div key={application.key}>{application.component()}</div>;
})}
</div>
);
},
_applicationAdded: function () {
this.forceUpdate();
}
});
| 'use strict';
require('./shell-view.scss');
var React = require('react');
var glimpse = require('glimpse');
var EmitterMixin = require('lib/components/emitter-mixin');
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.map(function (application) {
return <div key={application.key}><application.component /></div>;
})}
</div>
);
},
_applicationAdded: function () {
this.forceUpdate();
}
});
| Remove last warning from 0.12.x update | Remove last warning from 0.12.x update
| JSX | unknown | Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype | ---
+++
@@ -15,7 +15,7 @@
return (
<div className="application-holder">
{this.props.applications.map(function (application) {
- return <div key={application.key}>{application.component()}</div>;
+ return <div key={application.key}><application.component /></div>;
})}
</div>
); |
3ccbccff6ac4c2801fa8dbb639e0f73be8e3266f | app/components/pages/SubmitPost.jsx | app/components/pages/SubmitPost.jsx | import React from 'react';
// import {connect} from 'react-redux';
import { browserHistory } from 'react-router';
import ReplyEditor from 'app/components/elements/ReplyEditor'
const formId = 'submitStory'
const SubmitReplyEditor = ReplyEditor(formId)
class SubmitPost extends React.Component {
// static propTypes = {
// routeParams: React.PropTypes.object.isRequired,
// }
constructor() {
super()
this.success = (/*operation*/) => {
// const { category } = operation
localStorage.removeItem('replyEditorData-' + formId)
browserHistory.push('/created')//'/category/' + category)
}
}
render() {
const {success} = this
const {query} = this.props.location
return (
<div className="SubmitPost">
<SubmitReplyEditor type={query.type || 'submit_story'} successCallback={success} />
</div>
);
}
}
module.exports = {
path: 'submit.html',
component: SubmitPost // connect(state => ({ global: state.global }))(SubmitPost)
};
| import React from 'react';
// import {connect} from 'react-redux';
import { browserHistory } from 'react-router';
import ReplyEditor from 'app/components/elements/ReplyEditor'
const formId = 'submitStory'
const SubmitReplyEditor = ReplyEditor(formId)
class SubmitPost extends React.Component {
// static propTypes = {
// routeParams: React.PropTypes.object.isRequired,
// }
constructor() {
super()
this.success = (/*operation*/) => {
// const { category } = operation
// localStorage.removeItem('replyEditorData-' + formId)
browserHistory.push('/created')//'/category/' + category)
}
}
render() {
const {success} = this
const {query} = this.props.location
return (
<div className="SubmitPost">
<SubmitReplyEditor type={query.type || 'submit_story'} successCallback={success} />
</div>
);
}
}
module.exports = {
path: 'submit.html',
component: SubmitPost // connect(state => ({ global: state.global }))(SubmitPost)
};
| Disable ReplyEditor form cleaning after submit | Disable ReplyEditor form cleaning after submit
| JSX | mit | GolosChain/tolstoy,GolosChain/tolstoy,GolosChain/tolstoy | ---
+++
@@ -14,7 +14,7 @@
super()
this.success = (/*operation*/) => {
// const { category } = operation
- localStorage.removeItem('replyEditorData-' + formId)
+ // localStorage.removeItem('replyEditorData-' + formId)
browserHistory.push('/created')//'/category/' + category)
}
} |
e1e043238eb62afcfc84a1b584c3fba8710905a4 | components/Signup.jsx | components/Signup.jsx | import React, { PropTypes } from 'react';
import { Link } from 'react-router';
const propTypes = {
children: PropTypes.element,
};
function SignUp() {
return (
<div>
<h1>Get Your Own Lost-Item.Com Link</h1>
<p>
So if you lose your stuff, someone can get it back to you.
</p>
</div>
);
}
SignUp.propTypes = propTypes;
export default SignUp;
| import React, { PropTypes } from 'react';
import { Link } from 'react-router';
const propTypes = {
children: PropTypes.element,
};
class SignUpForm extends React.Component {
render() {
return (
<form>
<div>
<label>What is your name?</label>
<input type="text" name="name" />
<p>If someone you know finds something that belongs to you, they can give it to you directly</p>
</div>
<div>
<label>What is your email address?</label>
<input type="email" name="email" />
<p>So if someone you do not know finds something of yours, they'll let us know, and we can contact you to let you know.</p>
</div>
<div>Privacy</div>
<div>
<p>If someone finds something that belongs to you and goes to your link, do you want us to display the email address to them to contact you directly? Or hide it using a form to contact you through us?</p>
<p><input type="radio" name="contact" value="form" /> Hide my email and contact me through Lost-Item.Com</p>
<p><input type="radio" name="contact" value="direct" /> Have them email me directly.</p>
</div>
<div>
<input disabled type="submit" value="Get Your Own Lost Item Link!" />
</div>
</form>
)
}
}
function SignUp() {
return (
<div>
<h1>Get Your Own Lost-Item.Com Link</h1>
<p>
So if you lose your stuff, someone can get it back to you.
</p>
<SignUpForm />
</div>
);
}
SignUp.propTypes = propTypes;
export default SignUp;
| Add a (not yet working) signup form | Add a (not yet working) signup form
| JSX | mit | ezl/lost-item,ezl/lost-item | ---
+++
@@ -4,6 +4,34 @@
const propTypes = {
children: PropTypes.element,
};
+
+class SignUpForm extends React.Component {
+ render() {
+ return (
+ <form>
+ <div>
+ <label>What is your name?</label>
+ <input type="text" name="name" />
+ <p>If someone you know finds something that belongs to you, they can give it to you directly</p>
+ </div>
+ <div>
+ <label>What is your email address?</label>
+ <input type="email" name="email" />
+ <p>So if someone you do not know finds something of yours, they'll let us know, and we can contact you to let you know.</p>
+ </div>
+ <div>Privacy</div>
+ <div>
+ <p>If someone finds something that belongs to you and goes to your link, do you want us to display the email address to them to contact you directly? Or hide it using a form to contact you through us?</p>
+ <p><input type="radio" name="contact" value="form" /> Hide my email and contact me through Lost-Item.Com</p>
+ <p><input type="radio" name="contact" value="direct" /> Have them email me directly.</p>
+ </div>
+ <div>
+ <input disabled type="submit" value="Get Your Own Lost Item Link!" />
+ </div>
+ </form>
+ )
+ }
+}
function SignUp() {
return (
@@ -12,6 +40,7 @@
<p>
So if you lose your stuff, someone can get it back to you.
</p>
+ <SignUpForm />
</div>
);
} |
45df090ae7806165129aba204b22e23ac5b30fd9 | app/app/utils/auth.jsx | app/app/utils/auth.jsx | import axios from 'axios'
let auth = {
login(user, callback){
if (this.loggedIn()){
callback(true);
return;
}
axios.post('/sessions', user).then((res) => {
if (res.data.authenticated) {
localStorage.token = res.data.token
localStorage.id = res.data.user.id
if (callback) callback(true);
} else {
callback(false, res.data.error)
}
})
},
getUser(id, callback){
axios.get('/users/' + id).then((res) => {
callback(res.data)
})
},
loggedIn(){
return !!localStorage.token
},
logout(callback){
axios.delete('/sessions').then((res) => {
if (res.data.err) {
callback(false)
} else {
localStorage.clear()
callback(true)
}
})
},
register(data, type, callback) {
axios.post('/' + type, data).then((res) => {
this.login(res.data.user, callback)
})
}
}
export default auth | import axios from 'axios'
let auth = {
login(user, callback){
if (this.loggedIn()){
callback(true);
return;
}
axios.post('/sessions', user).then((res) => {
if (res.data.authenticated) {
localStorage.token = res.data.token
localStorage.id = res.data.user.id
if (callback) callback(true);
} else {
callback(false, res.data.error)
}
})
},
getUser(id, callback){
axios.get('/users/' + id).then((res) => {
callback(res.data)
})
},
loggedIn(){
return !!localStorage.token
},
logout(){
console.log('Logged Out')
localStorage.clear()
},
register(data, type, callback) {
axios.post('/' + type, data).then((res) => {
this.login(res.data.user, callback)
})
}
}
export default auth | Refactor logout helper to just clear localstorage | Refactor logout helper to just clear localstorage
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | ---
+++
@@ -27,15 +27,9 @@
return !!localStorage.token
},
- logout(callback){
- axios.delete('/sessions').then((res) => {
- if (res.data.err) {
- callback(false)
- } else {
- localStorage.clear()
- callback(true)
- }
- })
+ logout(){
+ console.log('Logged Out')
+ localStorage.clear()
},
register(data, type, callback) { |
3035766927dd6da73a43f48ca4cc2277ba2e0d53 | dashboard/client/packages/bulma-dashboard-theme-worona/src/elements/Input/index.jsx | dashboard/client/packages/bulma-dashboard-theme-worona/src/elements/Input/index.jsx | import React from 'react';
import cx from 'classnames';
import styles from './style.css';
const Input = ({ input, touched, error, size, label }) =>
<div className={styles.input}>
{label && <label className="label">{label}</label>}
<p className={cx('control', input.icon && 'has-icon')}>
<input className={cx('input', error && touched && 'is-danger', size && `is-${size}`)}
{...input}
/>
{input.icon && <i className={`fa fa-${input.icon}`}></i>}
{touched && error && <span className="help is-danger">{error}</span>}
</p>
</div>;
Input.propTypes = {
input: React.PropTypes.object,
label: React.PropTypes.string,
error: React.PropTypes.string,
touched: React.PropTypes.bool,
size: React.PropTypes.string,
};
export default Input;
| import React from 'react';
import cx from 'classnames';
import styles from './style.css';
const Input = ({ input, meta: { touched, error }, size, label, icon, placeholder, type }) =>
<div className={styles.input}>
{label && <label className="label">{label}</label>}
<p className={cx('control', icon && 'has-icon')}>
<input className={cx('input', error && touched && 'is-danger', size && `is-${size}`)}
{...input} placeholder={placeholder} type={type}
/>
{icon && <i className={`fa fa-${icon}`}></i>}
{touched && error && <span className="help is-danger">{error}</span>}
</p>
</div>;
Input.propTypes = {
input: React.PropTypes.object,
label: React.PropTypes.string,
meta: React.PropTypes.shape({
error: React.PropTypes.bool,
touched: React.PropTypes.bool,
}),
size: React.PropTypes.string,
icon: React.PropTypes.string,
placeholder: React.PropTypes.string,
type: React.PropTypes.string,
};
export default Input;
| Fix problem with new object shape of redux-form 6 rc4 | Fix problem with new object shape of redux-form 6 rc4
| JSX | mit | worona/worona,worona/worona-dashboard,worona/worona-dashboard,worona/worona-core,worona/worona,worona/worona-core,worona/worona | ---
+++
@@ -2,14 +2,14 @@
import cx from 'classnames';
import styles from './style.css';
-const Input = ({ input, touched, error, size, label }) =>
+const Input = ({ input, meta: { touched, error }, size, label, icon, placeholder, type }) =>
<div className={styles.input}>
{label && <label className="label">{label}</label>}
- <p className={cx('control', input.icon && 'has-icon')}>
+ <p className={cx('control', icon && 'has-icon')}>
<input className={cx('input', error && touched && 'is-danger', size && `is-${size}`)}
- {...input}
+ {...input} placeholder={placeholder} type={type}
/>
- {input.icon && <i className={`fa fa-${input.icon}`}></i>}
+ {icon && <i className={`fa fa-${icon}`}></i>}
{touched && error && <span className="help is-danger">{error}</span>}
</p>
</div>;
@@ -17,9 +17,14 @@
Input.propTypes = {
input: React.PropTypes.object,
label: React.PropTypes.string,
- error: React.PropTypes.string,
- touched: React.PropTypes.bool,
+ meta: React.PropTypes.shape({
+ error: React.PropTypes.bool,
+ touched: React.PropTypes.bool,
+ }),
size: React.PropTypes.string,
+ icon: React.PropTypes.string,
+ placeholder: React.PropTypes.string,
+ type: React.PropTypes.string,
};
export default Input; |
6855a3a4d7b6a2f482a2c4805f5c362697768b64 | SingularityUI/app/components/taskDetail/TaskHistory.jsx | SingularityUI/app/components/taskDetail/TaskHistory.jsx | import React, { PropTypes } from 'react';
import Utils from '../../utils';
import Section from '../common/Section';
import SimpleTable from '../common/SimpleTable';
import classNames from 'classnames';
function TaskHistory (props) {
return (
<Section title="History">
<SimpleTable
emptyMessage="This task has no history yet"
entries={props.taskUpdates.concat().reverse()}
perPage={5}
headers={['Status', 'Message', 'Time']}
renderTableRow={(data, index) => {
return (
<tr key={index} className={classNames({'medium-weight' :index === 0})}>
<td>{Utils.humanizeText(data.taskState)}</td>
<td>{data.statusMessage ? data.statusMessage : '—'}</td>
<td>{Utils.timestampFromNow(data.timestamp)}</td>
</tr>
);
}}
/>
</Section>
);
}
TaskHistory.propTypes = {
taskUpdates: PropTypes.arrayOf(PropTypes.shape({
taskState: PropTypes.string,
statusMessage: PropTypes.string,
timestamp: PropTypes.number
})).isRequired
};
export default TaskHistory;
| import React, { PropTypes } from 'react';
import Utils from '../../utils';
import Section from '../common/Section';
import SimpleTable from '../common/SimpleTable';
import classNames from 'classnames';
function TaskHistory (props) {
return (
<Section title="History">
<SimpleTable
emptyMessage="This task has no history yet"
entries={props.taskUpdates.concat().reverse()}
perPage={5}
headers={['Status', 'Message', 'Time']}
renderTableRow={(data, index) => {
return (
<tr key={index} className={classNames({'medium-weight': index === 0})}>
<td>{Utils.humanizeText(data.taskState)}</td>
<td>{data.statusMessage ? data.statusMessage : '—'}</td>
<td>{Utils.timestampFromNow(data.timestamp)}</td>
</tr>
);
}}
/>
</Section>
);
}
TaskHistory.propTypes = {
taskUpdates: PropTypes.arrayOf(PropTypes.shape({
taskState: PropTypes.string,
statusMessage: PropTypes.string,
timestamp: PropTypes.number
})).isRequired
};
export default TaskHistory;
| Fix one last lint error | Fix one last lint error
| JSX | apache-2.0 | andrhamm/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,andrhamm/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity | ---
+++
@@ -14,7 +14,7 @@
headers={['Status', 'Message', 'Time']}
renderTableRow={(data, index) => {
return (
- <tr key={index} className={classNames({'medium-weight' :index === 0})}>
+ <tr key={index} className={classNames({'medium-weight': index === 0})}>
<td>{Utils.humanizeText(data.taskState)}</td>
<td>{data.statusMessage ? data.statusMessage : '—'}</td>
<td>{Utils.timestampFromNow(data.timestamp)}</td> |
6da16806d1dacdf1306a233f1b4997033eb6dc71 | src/views/Layout.jsx | src/views/Layout.jsx | import React from "react";
export default function Layout(props) {
return (
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>URI:teller</title>
{props.styles.map((href, index) => <link key={index} rel="stylesheet" href={href} />)}
</head>
<body>
<nav className="navbar navbar-default navbar-fixed-top">
<div className="container">
<div className="navbar-header">
<a className="navbar-brand" href="#">
URI:teller
</a>
</div>
</div>
</nav>
<div id="app">
{props.children}
</div>
<footer className="footer text-muted">
<div className="container">
<hr />
<p className="pull-right">
Made with <span className="glyphicon glyphicon-scissors"></span> in Finland
</p>
</div>
</footer>
{props.scripts.map((src, index) => <script key={index} src={src}></script>)}
</body>
</html>
);
}
| import React from "react";
export default function Layout(props) {
return (
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>URI:teller</title>
{props.styles.map((href, index) => <link key={index} rel="stylesheet" href={href} />)}
</head>
<body>
<nav className="navbar navbar-default navbar-fixed-top">
<div className="container">
<div className="navbar-header">
<a className="navbar-brand" href="/">URI:teller</a>
</div>
</div>
</nav>
<div id="app">
{props.children}
</div>
<footer className="footer text-muted">
<div className="container">
<hr />
<p className="pull-right">
Made with <span className="glyphicon glyphicon-scissors"></span> in Finland
</p>
</div>
</footer>
{props.scripts.map((src, index) => <script key={index} src={src}></script>)}
</body>
</html>
);
}
| Add a link to the main page | Add a link to the main page
| JSX | mit | HowNetWorks/uriteller | ---
+++
@@ -14,9 +14,7 @@
<nav className="navbar navbar-default navbar-fixed-top">
<div className="container">
<div className="navbar-header">
- <a className="navbar-brand" href="#">
- URI:teller
- </a>
+ <a className="navbar-brand" href="/">URI:teller</a>
</div>
</div>
</nav> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.