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
|
---|---|---|---|---|---|---|---|---|---|---|
7faf44701ed8801e7f70490aaf69c4225036dae9 | app/scripts/views/home.jsx | app/scripts/views/home.jsx | import React from 'react';
import Countdown from "../components/countdown.jsx";
import About from "../components/about.jsx";
export default class Login extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<Countdown/>
<hr/>
<About/>
</div>
);
}
} | import React from 'react';
import Login from './login.jsx';
import Countdown from "../components/countdown.jsx";
import About from "../components/about.jsx";
export default class Home extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<Countdown/>
<hr/>
<About/>
<hr/>
<Login/>
</div>
);
}
} | Fix class name and add login component | Fix class name and add login component
| JSX | mit | benct/tomlin-web,benct/tomlin-web | ---
+++
@@ -1,8 +1,9 @@
import React from 'react';
+import Login from './login.jsx';
import Countdown from "../components/countdown.jsx";
import About from "../components/about.jsx";
-export default class Login extends React.Component {
+export default class Home extends React.Component {
constructor(props) {
super(props);
}
@@ -13,6 +14,8 @@
<Countdown/>
<hr/>
<About/>
+ <hr/>
+ <Login/>
</div>
);
} |
4e745820554f6c51201aa25f720ef446941fb3e0 | components/Tabs.jsx | components/Tabs.jsx | var React = require('react/addons');
var Component = require('../component');
module.exports = Component({
name: 'Tabs',
getDefaultProps() {
return {
type: 'text'
};
},
render() {
var { children, type, ...props } = this.props;
if (type)
this.addStyles(this.styles[type]);
return (
<ul {...props} {...this.componentProps()}>
{React.Children.map(children, (child, i) => {
return React.addons.cloneWithProps(child, {
key: i,
type: type
});
})}
</ul>
);
}
}); | var React = require('react/addons');
var Component = require('../component');
var clone = require('../lib/niceClone');
module.exports = Component({
name: 'Tabs',
getDefaultProps() {
return {
type: 'text'
};
},
render() {
var { children, type, ...props } = this.props;
if (type)
this.addStyles(this.styles[type]);
return (
<ul {...props} {...this.componentProps()}>
{clone(children, (child, i) => ({ key: i, type }))}
</ul>
);
}
}); | Move tabs to use niceClone | Move tabs to use niceClone
| JSX | mit | zenlambda/reapp-ui,Lupino/reapp-ui,zackp30/reapp-ui,srounce/reapp-ui,reapp/reapp-ui,jhopper28/reapp-ui,oToUC/reapp-ui | ---
+++
@@ -1,5 +1,6 @@
var React = require('react/addons');
var Component = require('../component');
+var clone = require('../lib/niceClone');
module.exports = Component({
name: 'Tabs',
@@ -18,12 +19,7 @@
return (
<ul {...props} {...this.componentProps()}>
- {React.Children.map(children, (child, i) => {
- return React.addons.cloneWithProps(child, {
- key: i,
- type: type
- });
- })}
+ {clone(children, (child, i) => ({ key: i, type }))}
</ul>
);
} |
8b4c168b7734918b17660ae34b0cc9f136872bcf | src/pages/home.jsx | src/pages/home.jsx | import React from 'react';
import Header from '../components/header.jsx';
export default class Home extends React.Component {
constructor(props) {
super(props);
this.onClickButton = this.onClickButton.bind(this);
this.state = {
counter: 0
};
}
onClickButton () {
this.setState({ counter: this.state.counter += 1 });
}
render () {
return (<html>
<head>
<title>Example of isomorphic App in ES6.</title>
</head>
<body>
<Header name={this.props.name} />
<main>
<button onClick={this.onClickButton}>Click ME!!!</button>
<span> {this.state.counter} Clicks</span>
</main>
<script src='./js/app.js'></script>
</body>
</html>
);
}
};
| import React from 'react';
import Header from '../components/header.jsx';
export default class Home extends React.Component {
constructor(props) {
super(props);
this.onClickButton = this.onClickButton.bind(this);
this.state = {
counter: 0
};
}
onClickButton () {
this.setState({ counter: this.state.counter += 1 });
}
render () {
return (<html>
<head>
<title>Example of isomorphic App in ES6.</title>
</head>
<body>
<Header name={this.props.name} />
<main>
<button onClick={this.onClickButton}>Click ME!!!</button>
<span> {this.state.counter} Clicks</span>
<p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p>
</main>
<script src='./js/app.js'></script>
</body>
</html>
);
}
};
| Add noscript tag with a message | Add noscript tag with a message
| JSX | mit | Juan1ll0/es6-react-server-side-render,Juan1ll0/es6-react-server-side-render | ---
+++
@@ -26,6 +26,7 @@
<main>
<button onClick={this.onClickButton}>Click ME!!!</button>
<span> {this.state.counter} Clicks</span>
+ <p><noscript><strong>You don't have Javascript enabled in your browser</strong></noscript></p>
</main>
<script src='./js/app.js'></script>
</body> |
8b35b2e01733a35d2f5dc606c52f7200b4b82fb4 | 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: `${document.location.protocol}//${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)
})
| Use protocol-relative url in cozy.init() | [styles] Use protocol-relative url in cozy.init()
| JSX | agpl-3.0 | enguerran/cozy-files-v3,cozy/cozy-files-v3,enguerran/cozy-files-v3,nono/cozy-files-v3,y-lohse/cozy-drive,nono/cozy-files-v3,enguerran/cozy-drive,goldoraf/cozy-drive,y-lohse/cozy-drive,goldoraf/cozy-drive,cozy/cozy-files-v3,cozy/cozy-files-v3,nono/cozy-photos-v3,goldoraf/cozy-drive,nono/cozy-photos-v3,enguerran/cozy-drive,y-lohse/cozy-drive,nono/cozy-files-v3,cozy/cozy-files-v3,enguerran/cozy-drive,y-lohse/cozy-photos-v3,y-lohse/cozy-files-v3,cozy/cozy-photos-v3,goldoraf/cozy-drive,goldoraf/cozy-photos-v3,enguerran/cozy-drive,enguerran/cozy-files-v3,goldoraf/cozy-photos-v3,y-lohse/cozy-files-v3,enguerran/cozy-files-v3,y-lohse/cozy-drive,nono/cozy-files-v3,cozy/cozy-photos-v3,y-lohse/cozy-files-v3,y-lohse/cozy-photos-v3 | ---
+++
@@ -35,7 +35,7 @@
const applicationElement = document.querySelector('[role=application]')
cozy.init({
- cozyURL: `${document.location.protocol}//${applicationElement.dataset.cozyStack}`,
+ cozyURL: `//${applicationElement.dataset.cozyStack}`,
token: applicationElement.dataset.token
})
|
81d228fbc95bced2469137b4ade16589491f3868 | dist/js/checkbox.jsx | dist/js/checkbox.jsx | /**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js');
var Checkbox = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired,
value: React.PropTypes.string.isRequired,
onCheck: React.PropTypes.func,
checked: React.PropTypes.bool
},
mixins: [Classable],
getInitialState: function() {
return {
checked: this.props.checked || false
}
},
getDefaultProps: function() {
return {
};
},
componentWillReceiveProps: function(nextProps) {
this.setState({checked: nextProps.checked || false});
},
check: function() {
this.setState({ checked: !this.state.checked });
this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked;
},
render: function() {
var classes = this.getClasses('mui-checkbox', {
'mui-checked': this.state.checked === true
})
return (
<div className={classes} onClick={this._onCheck}>
<input ref="checkbox" type="checkbox" name={this.props.name} value={this.props.value} />
<span className="mui-checkbox-box" />
<span className="mui-checkbox-check" />
</div>
);
},
_onCheck: function(e) {
var checkedState = this.state.checked;
this.check();
if (this.props.onClick) this.props.onClick(e, !checkedState);
}
});
module.exports = Checkbox; | /**
* @jsx React.DOM
*/
var React = require('react'),
Classable = require('./mixins/classable.js');
var Checkbox = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired,
value: React.PropTypes.string.isRequired,
onCheck: React.PropTypes.func,
checked: React.PropTypes.bool
},
mixins: [Classable],
getInitialState: function() {
return {
checked: this.props.checked || false
}
},
getDefaultProps: function() {
return {
};
},
componentWillReceiveProps: function(nextProps) {
if (nextProps.hasOwnProperty('checked')) this.setState({checked: nextProps.checked});
},
check: function() {
this.setState({ checked: !this.state.checked });
this.refs.checkbox.getDOMNode().checked = !this.refs.checkbox.getDOMNode().checked;
},
render: function() {
var classes = this.getClasses('mui-checkbox', {
'mui-checked': this.state.checked === true
})
return (
<div className={classes} onClick={this._onCheck}>
<input ref="checkbox" type="checkbox" name={this.props.name} value={this.props.value} />
<span className="mui-checkbox-box" />
<span className="mui-checkbox-check" />
</div>
);
},
_onCheck: function(e) {
var checkedState = this.state.checked;
this.check();
if (this.props.onClick) this.props.onClick(e, !checkedState);
}
});
module.exports = Checkbox; | Update to latest from docs branch | Update to latest from docs branch
| JSX | mit | milworm/material-ui,Qix-/material-ui,WolfspiritM/material-ui,b4456609/pet-new,jacobrosenthal/material-ui,sarink/material-ui-with-sass,Joker666/material-ui,dsslimshaddy/material-ui,JonatanGarciaClavo/material-ui,garth/material-ui,AndriusBil/material-ui,ianwcarlson/material-ui,oliviertassinari/material-ui,tingi/material-ui,kybarg/material-ui,verdan/material-ui,yinickzhou/material-ui,mit-cml/iot-website-source,JAStanton/material-ui,maoziliang/material-ui,pospisil1/material-ui,pomerantsev/material-ui,Joker666/material-ui,mulesoft-labs/material-ui,Iamronan/material-ui,tyfoo/material-ui,mubassirhayat/material-ui,VirtueMe/material-ui,nahue/material-ui,kasra-co/material-ui,kasra-co/material-ui,bratva/material-ui,cpojer/material-ui,callemall/material-ui,freeslugs/material-ui,freedomson/material-ui,b4456609/pet-new,chirilo/material-ui,subjectix/material-ui,motiz88/material-ui,gsklee/material-ui,br0r/material-ui,rscnt/material-ui,br0r/material-ui,Zadielerick/material-ui,spiermar/material-ui,rscnt/material-ui,MrOrz/material-ui,w01fgang/material-ui,barakmitz/material-ui,Josh-a-e/material-ui,hesling/material-ui,rscnt/material-ui,MrLeebo/material-ui,mulesoft/material-ui,skyflux/material-ui,domagojk/material-ui,vmaudgalya/material-ui,pancho111203/material-ui,RickyDan/material-ui,meimz/material-ui,hjmoss/material-ui,milworm/material-ui,rolandpoulter/material-ui,AndriusBil/material-ui,checkraiser/material-ui,ludiculous/material-ui,xiaoking/material-ui,ArcanisCz/material-ui,myfintech/material-ui,oliviertassinari/material-ui,yhikishima/material-ui,mbrookes/material-ui,frnk94/material-ui,yongxu/material-ui,ababol/material-ui,Tionx/material-ui,suvjunmd/material-ui,Tionx/material-ui,bjfletcher/material-ui,mobilelife/material-ui,ahlee2326/material-ui,agnivade/material-ui,19hz/material-ui,jeroencoumans/material-ui,JsonChiu/material-ui,CalebEverett/material-ui,bgribben/material-ui,ziad-saab/material-ui,Kagami/material-ui,jmknoll/material-ui,CumpsD/material-ui,ntgn81/material-ui,jeroencoumans/material-ui,Josh-a-e/material-ui,safareli/material-ui,lunohq/material-ui,mbrookes/material-ui,zulfatilyasov/material-ui-yearpicker,XiaonuoGantan/material-ui,mayblue9/material-ui,sarink/material-ui-with-sass,creatorkuang/mui-react,tribecube/material-ui,verdan/material-ui,cloudseven/material-ui,JAStanton/material-ui-io,hybrisCole/material-ui,azazdeaz/material-ui,nik4152/material-ui,cgestes/material-ui,gsls1817/material-ui,MrOrz/material-ui,esleducation/material-ui,felipeptcho/material-ui,mbrookes/material-ui,AllenSH12/material-ui,safareli/material-ui,juhaelee/material-ui-io,mui-org/material-ui,hwo411/material-ui,ziad-saab/material-ui,ludiculous/material-ui,yhikishima/material-ui,trendchaser4u/material-ui,janmarsicek/material-ui,suvjunmd/material-ui,marcelmokos/material-ui,zuren/material-ui,juhaelee/material-ui-io,mjhasbach/material-ui,ronlobo/material-ui,freeslugs/material-ui,ArcanisCz/material-ui,drojas/material-ui,yulric/material-ui,juhaelee/material-ui,cherniavskii/material-ui,insionng/material-ui,JAStanton/material-ui-io,sanemat/material-ui,ramsey-darling1/material-ui,juhaelee/material-ui,igorbt/material-ui,wdamron/material-ui,hophacker/material-ui,mogii/material-ui,Shiiir/learning-reactjs-first-demo,cherniavskii/material-ui,callemall/material-ui,gobadiah/material-ui,Saworieza/material-ui,timuric/material-ui,zhengjunwei/material-ui,Kagami/material-ui,mui-org/material-ui,ProductiveMobile/material-ui,mmrtnz/material-ui,Qix-/material-ui,checkraiser/material-ui,ruifortes/material-ui,mikedklein/material-ui,baiyanghese/material-ui,VirtueMe/material-ui,elwebdeveloper/material-ui,kybarg/material-ui,lastjune/material-ui,patelh18/material-ui,matthewoates/material-ui,Unforgiven-wanda/learning-react,kabaka/material-ui,Saworieza/material-ui,tastyeggs/material-ui,motiz88/material-ui,callemall/material-ui,mogii/material-ui,jkruder/material-ui,unageanu/material-ui,Jandersolutions/material-ui,callemall/material-ui,manchesergit/material-ui,ButuzGOL/material-ui,jkruder/material-ui,oliverfencott/material-ui,salamer/material-ui,2390183798/material-ui,cherniavskii/material-ui,ddebowczyk/material-ui,zulfatilyasov/material-ui-yearpicker,Kagami/material-ui,KevinMcIntyre/material-ui,marwein/material-ui,arkxu/material-ui,bokzor/material-ui,shaurya947/material-ui,vaiRk/material-ui,nik4152/material-ui,janmarsicek/material-ui,kwangkim/course-react,loki315zx/material-ui,chrismcv/material-ui,und3fined/material-ui,wdamron/material-ui,alitaheri/material-ui,NogsMPLS/material-ui,skarnecki/material-ui,buttercloud/material-ui,andrejunges/material-ui,tingi/material-ui,ilear/material-ui,lionkeng/material-ui,jarno-steeman/material-ui,cjhveal/material-ui,isakib/material-ui,Jandersolutions/material-ui,inoc603/material-ui,jtollerene/material-ui,trendchaser4u/material-ui,marwein/material-ui,und3fined/material-ui,felipethome/material-ui,Yepstr/material-ui,staticinstance/material-ui,grovelabs/material-ui,btmills/material-ui,wunderlink/material-ui,deerawan/material-ui,owencm/material-ui,owencm/material-ui,bdsabian/material-ui-old,agnivade/material-ui,w01fgang/material-ui,ahmedshuhel/material-ui,yh453926638/material-ui,glabcn/material-ui,tomgco/material-ui,cmpereirasi/material-ui,EllieAdam/material-ui,hellokitty111/material-ui,JsonChiu/material-ui,conundrumer/material-ui,dsslimshaddy/material-ui,Chuck8080/materialdesign-react,mmrtnz/material-ui,haf/material-ui,louy/material-ui,hybrisCole/material-ui,pschlette/material-ui-with-sass,udhayam/material-ui,bright-sparks/material-ui,mtsandeep/material-ui,janmarsicek/material-ui,ruifortes/material-ui,tan-jerene/material-ui,pschlette/material-ui-with-sass,igorbt/material-ui,2390183798/material-ui,tungmv7/material-ui,developer-prosenjit/material-ui,bratva/material-ui,ghondar/material-ui,CyberSpace7/material-ui,demoalex/material-ui,tan-jerene/material-ui,mikey2XU/material-ui,EcutDavid/material-ui,frnk94/material-ui,b4456609/pet-new,Lottid/material-ui,kittyjumbalaya/material-components-web,kittyjumbalaya/material-components-web,rodolfo2488/material-ui,ilovezy/material-ui,ashfaqueahmadbari/material-ui,Cerebri/material-ui,marnusw/material-ui,roderickwang/material-ui,xiaoking/material-ui,Iamronan/material-ui,bright-sparks/material-ui,Hamstr/material-ui,dsslimshaddy/material-ui,rodolfo2488/material-ui,ashfaqueahmadbari/material-ui,alex-dixon/material-ui,lawrence-yu/material-ui,buttercloud/material-ui,Shiiir/learning-reactjs-first-demo,RickyDan/material-ui,lionkeng/material-ui,gaowenbin/material-ui,CumpsD/material-ui,hiddentao/material-ui,DenisPostu/material-ui,hwo411/material-ui,ichiohta/material-ui,enriqueojedalara/material-ui,kybarg/material-ui,inoc603/material-ui,lawrence-yu/material-ui,loaf/material-ui,ngbrown/material-ui,yinickzhou/material-ui,wustxing/material-ui,AndriusBil/material-ui,Syncano/material-ui,isakib/material-ui,matthewoates/material-ui,wunderlink/material-ui,insionng/material-ui,maoziliang/material-ui,Dolmio/material-ui,ProductiveMobile/material-ui,hiddentao/material-ui,chrxn/material-ui,mtnk/material-ui,Kagami/material-ui,ddebowczyk/material-ui,xmityaz/material-ui,mit-cml/iot-website-source,oliverfencott/material-ui,izziaraffaele/material-ui,gaowenbin/material-ui,NatalieT/material-ui,christopherL91/material-ui,pospisil1/material-ui,mtsandeep/material-ui,manchesergit/material-ui,cherniavskii/material-ui,JAStanton/material-ui,gsklee/material-ui,pomerantsev/material-ui,mjhasbach/material-ui,whatupdave/material-ui,nathanmarks/material-ui,keokilee/material-ui,mgibeau/material-ui,dsslimshaddy/material-ui,tungmv7/material-ui,oToUC/material-ui,kebot/material-ui,Zeboch/material-ui,andrejunges/material-ui,lightning18/material-ui,nevir/material-ui,grovelabs/material-ui,tomrosier/material-ui,ask-izzy/material-ui,patelh18/material-ui,bdsabian/material-ui-old,hellokitty111/material-ui,lucy-orbach/material-ui,tastyeggs/material-ui,cjhveal/material-ui,Videri/material-ui,mit-cml/iot-website-source,salamer/material-ui,mui-org/material-ui,und3fined/material-ui,AndriusBil/material-ui,zuren/material-ui,developer-prosenjit/material-ui,gsls1817/material-ui,hai-cea/material-ui,oliviertassinari/material-ui,lgollut/material-ui,zenlambda/material-ui,bORm/material-ui,janmarsicek/material-ui,shadowhunter2/material-ui,2947721120/material-ui,nevir/material-ui,ichiohta/material-ui,Jonekee/material-ui,arkxu/material-ui,ahmedshuhel/material-ui,freedomson/material-ui,kybarg/material-ui,hai-cea/material-ui,gitmithy/material-ui,JohnnyRockenstein/material-ui,ahlee2326/material-ui,woanversace/material-ui,ilovezy/material-ui,adamlee/material-ui,pradel/material-ui,ababol/material-ui,ButuzGOL/material-ui,WolfspiritM/material-ui,whatupdave/material-ui,rhaedes/material-ui,domagojk/material-ui,chirilo/material-ui,allanalexandre/material-ui,glabcn/material-ui,pancho111203/material-ui,121nexus/material-ui,tirams/material-ui | ---
+++
@@ -28,7 +28,7 @@
},
componentWillReceiveProps: function(nextProps) {
- this.setState({checked: nextProps.checked || false});
+ if (nextProps.hasOwnProperty('checked')) this.setState({checked: nextProps.checked});
},
check: function() { |
4a46159c0a9b1391cd7f588546e74b85105aa522 | src/editor/toolBar/undoredoControls.jsx | src/editor/toolBar/undoredoControls.jsx | import React, {Component} from 'react';
import {Icon} from "antd"
class UndoRedo extends Component {
constructor(props) {
super(props);
}
render() {
let className = 'RichEditor-styleButton';
return (
<div className="RichEditor-controls">
<span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("undo")}>
<Icon key="_undo" type="editor_undo" />
</span>
<span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("redo")}>
<Icon key="_redo" type="editor_redo" />
</span>
</div>
)
}
};
module.exports = UndoRedo;
| import React, {Component} from 'react';
import {Icon} from "antd"
class UndoRedo extends Component {
constructor(props) {
super(props);
}
render() {
let className = 'RichEditor-styleButton';
return (
<div className="RichEditor-controls">
<span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("undo")} title="撤销(Ctrl-Z,Cmd-Z)">
<Icon key="_undo" type="editor_undo" />
</span>
<span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("redo")} title="重做(Ctrl-Y,Cmd-Shift-Z)">
<Icon key="_redo" type="editor_redo" />
</span>
</div>
)
}
};
module.exports = UndoRedo;
| Add title tip text of redo and undo. | :apple: Add title tip text of redo and undo.
| JSX | mit | WHKFZYX-Tool/react-lz-editor-whkfzyx,leejaen/react-lz-editor,WHKFZYX-Tool/react-lz-editor-whkfzyx,leejaen/react-lz-editor,WHKFZYX-Tool/react-lz-editor-whkfzyx,leejaen/react-lz-editor | ---
+++
@@ -9,10 +9,10 @@
let className = 'RichEditor-styleButton';
return (
<div className="RichEditor-controls">
- <span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("undo")}>
+ <span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("undo")} title="撤销(Ctrl-Z,Cmd-Z)">
<Icon key="_undo" type="editor_undo" />
</span>
- <span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("redo")}>
+ <span className='RichEditor-styleButton' onClick={()=>this.props.onToggle("redo")} title="重做(Ctrl-Y,Cmd-Shift-Z)">
<Icon key="_redo" type="editor_redo" />
</span>
</div> |
fa3d6dc708d8a2524a5fdab843866245700da9b6 | src/request/components/request-entry-item-view.jsx | src/request/components/request-entry-item-view.jsx | var React = require('react'),
Timeago = require('../../lib/components/timeago.jsx');
module.exports = React.createClass({
render: function() {
var entry = this.props.entry;
return (
<div className="request-entry-item-holder">
<table className="table table-bordered">
<tr>
<td rowSpan="2">{entry.duration}ms</td>
<td colSpan="6">
{entry.uri} {entry.method} {entry.statusCode} ({entry.statusText}) - {entry.contentType}
</td>
<td><Timeago time={entry.dateTime} /></td>
</tr>
<tr>
<td>{entry.summary.networkTime}ms</td>
<td>{entry.summary.serverTime}ms</td>
<td>{entry.summary.clientTime}ms</td>
<td>{entry.summary.controller}.{entry.summary.action}(...)</td>
<td>{entry.summary.actionTime}ms</td>
<td>{entry.summary.viewTime}ms</td>
<td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td>
</tr>
</table>
</div>
);
}
});
| var React = require('react'),
Timeago = require('../../lib/components/timeago.jsx');
module.exports = React.createClass({
render: function() {
var entry = this.props.entry;
return (
<div className="request-entry-item-holder">
<table className="table table-bordered">
<tr>
<td>{entry.duration}ms</td>
<td colSpan="6">
{entry.uri} {entry.method} {entry.statusCode} ({entry.statusText}) - {entry.contentType}
</td>
<td><Timeago time={entry.dateTime} /></td>
</tr>
<tr>
<td>{entry.user.name}</td>
<td>{entry.summary.networkTime}ms</td>
<td>{entry.summary.serverTime}ms</td>
<td>{entry.summary.clientTime}ms</td>
<td>{entry.summary.controller}.{entry.summary.action}(...)</td>
<td>{entry.summary.actionTime}ms</td>
<td>{entry.summary.viewTime}ms</td>
<td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td>
</tr>
</table>
</div>
);
}
});
| Add username to the record list so that its easy to tell filtering is working | Add username to the record list so that its easy to tell filtering is working
| JSX | unknown | avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype | ---
+++
@@ -8,13 +8,14 @@
<div className="request-entry-item-holder">
<table className="table table-bordered">
<tr>
- <td rowSpan="2">{entry.duration}ms</td>
+ <td>{entry.duration}ms</td>
<td colSpan="6">
{entry.uri} {entry.method} {entry.statusCode} ({entry.statusText}) - {entry.contentType}
</td>
<td><Timeago time={entry.dateTime} /></td>
</tr>
<tr>
+ <td>{entry.user.name}</td>
<td>{entry.summary.networkTime}ms</td>
<td>{entry.summary.serverTime}ms</td>
<td>{entry.summary.clientTime}ms</td> |
8b0c1d6f6a40a049c1787ae5da9d1d9aa9211024 | app/components/cardscontainer/cardscontainer.jsx | app/components/cardscontainer/cardscontainer.jsx | 'use strict';
import React from 'react';
import axios from 'axios';
import Card from './card/Card.jsx';
import Mydiet from './mydiet/Mydiet.jsx';
const MyDietItem = [];
const Cardhome = React.createClass({
handleAddDiet: function(info) {
console.log(info);
MyDietItem.push({
'id': info.recipeid,
'name': info.name,
'image': info.image
});
console.log(MyDietItem);
},
render: function() {
return (
<Card handleAddDiet={this.handleAddDiet} />
);
}
});
export default Cardhome; | 'use strict';
import React from 'react';
import axios from 'axios';
import Card from './card/Card.jsx';
import Mydiet from './mydiet/Mydiet.jsx';
const MyDietItem = [];
const Cardhome = React.createClass({
handleAddDiet: function(info) {
// console.log(info);
var apiurl = 'http://api.cs50.net/food/3/facts?key=64b1434ce52fd6e5ee55f01f7d0ae3f0';
var proxyurl = 'https://cors-anywhere.herokuapp.com/';
var finalurl = proxyurl + apiurl;
axios.get(finalurl, {
params: {
recipe: info.recipeid,
output: 'json'
},
auth: {
username: 'p4suhag',
password: 'gabrusuhag'
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
MyDietItem.push({
'id': info.recipeid,
'name': info.name,
'image': info.image
});
// console.log(MyDietItem);
},
render: function() {
return (
<Card handleAddDiet={this.handleAddDiet} />
);
}
});
export default Cardhome; | Return data from home cards | Return data from home cards
| JSX | mit | p4suhag/gabru,p4suhag/gabru | ---
+++
@@ -9,13 +9,32 @@
const Cardhome = React.createClass({
handleAddDiet: function(info) {
- console.log(info);
+ // console.log(info);
+ var apiurl = 'http://api.cs50.net/food/3/facts?key=64b1434ce52fd6e5ee55f01f7d0ae3f0';
+ var proxyurl = 'https://cors-anywhere.herokuapp.com/';
+ var finalurl = proxyurl + apiurl;
+ axios.get(finalurl, {
+ params: {
+ recipe: info.recipeid,
+ output: 'json'
+ },
+ auth: {
+ username: 'p4suhag',
+ password: 'gabrusuhag'
+ }
+ })
+ .then(function (response) {
+ console.log(response);
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
MyDietItem.push({
'id': info.recipeid,
'name': info.name,
'image': info.image
});
- console.log(MyDietItem);
+ // console.log(MyDietItem);
},
render: function() {
return ( |
2a228ae6b9e80e0d85f16200269378a0ab8d3f80 | ui/src/reducers.jsx | ui/src/reducers.jsx | import { combineReducers } from 'redux';
import { reducer as api } from 'redux-json-api';
import reduceReducers from 'reduce-reducers';
import queryString from 'query-string';
const generateRaceAttributes = (state, action) => {
let newState = state;
switch (action.type) {
case 'API_READ':
const [paramStr] = action.payload.endpoint.split('?');
const params = queryString.parse(paramStr);
const includes = params.include ? params.include.split(',') : [];
const includeMap = state.includeMap || {};
includes.forEach(includeKey => {
includeMap[includeKey] = state.api[includeKey].data.reduce((partialMap, includedObj) => {
const map = partialMap;
map[includedObj.id] = includedObj;
return map;
}, {});
newState = Object.assign({}, state, { includeMap });
});
break;
default:
break;
}
return newState;
};
const combinedReducer = combineReducers({
api,
includeMap: (state) => Object.assign({}, state)
});
// Join all reducers into one.
export default reduceReducers(combinedReducer, generateRaceAttributes);
| import { combineReducers } from 'redux';
import { reducer as api } from 'redux-json-api';
import reduceReducers from 'reduce-reducers';
import queryString from 'query-string';
const buildIncludeMap = (state, action) => {
let newState = state;
switch (action.type) {
case 'API_READ':
const paramStr = action.payload.endpoint.split('?', 2).pop();
const params = queryString.parse(paramStr);
const includes = params.include ? params.include.split(',') : [];
const includeMap = state.includeMap || {};
includes.forEach(includeKey => {
includeMap[includeKey] = state.api[includeKey].data.reduce((partialMap, includedObj) => {
const map = partialMap;
map[includedObj.id] = includedObj;
return map;
}, {});
newState = Object.assign({}, state, { includeMap });
});
break;
default:
break;
}
return newState;
};
const combinedReducer = combineReducers({
api,
includeMap: (state) => Object.assign({}, state)
});
// Join all reducers into one.
export default reduceReducers(combinedReducer, buildIncludeMap);
| Rename and fix buildIncludeMap reducer | Rename and fix buildIncludeMap reducer
| JSX | apache-2.0 | jimbobhickville/swd6,jimbobhickville/swd6,jimbobhickville/swd6 | ---
+++
@@ -4,12 +4,12 @@
import queryString from 'query-string';
-const generateRaceAttributes = (state, action) => {
+const buildIncludeMap = (state, action) => {
let newState = state;
switch (action.type) {
case 'API_READ':
- const [paramStr] = action.payload.endpoint.split('?');
+ const paramStr = action.payload.endpoint.split('?', 2).pop();
const params = queryString.parse(paramStr);
const includes = params.include ? params.include.split(',') : [];
@@ -38,4 +38,4 @@
});
// Join all reducers into one.
-export default reduceReducers(combinedReducer, generateRaceAttributes);
+export default reduceReducers(combinedReducer, buildIncludeMap); |
88131a3a884e8bfc4ecb766c715f0ba67b320ead | client/src/index.jsx | client/src/index.jsx | import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import injectTapEventPlugin from 'react-tap-event-plugin';
import App from './components/App';
import LandingPage from './components/LandingPage';
import Login from './components/Login';
import Signup from './components/Signup';
import JamRoom from './components/JamRoom';
import Room from './components/Room';
import Invalid from './components/Invalid';
import Metronome from './components/Metronome';
// Needed for onTouchTap
// http://stackoverflow.com/a/34015469/988941
injectTapEventPlugin();
render((
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={LandingPage} />
<Route path="login" component={Login} />
<Route path="signup" component={Signup} />
<Route path="room/:roomId" component={Room} />
<Route path="metronome" component={Metronome} />
<Route path="*" component={Invalid} />
</Route>
</Router>
), document.getElementById('app'));
| import React from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import injectTapEventPlugin from 'react-tap-event-plugin';
import App from './components/App';
import LandingPage from './components/LandingPage';
import Login from './components/Login';
import Signup from './components/Signup';
import JamRoom from './components/JamRoom';
import Room from './components/Room';
import CreateOrJoin from './components/CreateOrJoin';
import Invalid from './components/Invalid';
import Metronome from './components/Metronome';
// Needed for onTouchTap
// http://stackoverflow.com/a/34015469/988941
injectTapEventPlugin();
render((
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={LandingPage} />
<Route path="login" component={Login} />
<Route path="signup" component={Signup} />
<Route path="room/:roomId" component={Room} />
<Route path="createorjoin" component={CreateOrJoin} />
<Route path="metronome" component={Metronome} />
<Route path="*" component={Invalid} />
</Route>
</Router>
), document.getElementById('app'));
| Add route for react router for createorjoin component | Add route for react router for createorjoin component
| JSX | mit | NerdDiffer/reprise,NerdDiffer/reprise,NerdDiffer/reprise | ---
+++
@@ -9,6 +9,7 @@
import Signup from './components/Signup';
import JamRoom from './components/JamRoom';
import Room from './components/Room';
+import CreateOrJoin from './components/CreateOrJoin';
import Invalid from './components/Invalid';
import Metronome from './components/Metronome';
@@ -23,6 +24,7 @@
<Route path="login" component={Login} />
<Route path="signup" component={Signup} />
<Route path="room/:roomId" component={Room} />
+ <Route path="createorjoin" component={CreateOrJoin} />
<Route path="metronome" component={Metronome} />
<Route path="*" component={Invalid} />
</Route> |
aa66e1e9b51b962dec5c0dcd0cb76a90e045f552 | src/IssueFilter.jsx | src/IssueFilter.jsx | import React from 'react';
export default class IssueFilter extends React.Component {
render() {
return (
<div>This is a placeholder for the Issue Filter.</div>
);
}
}
| import React from 'react';
export default class IssueFilter extends React.Component { // eslint-disable-line
render() {
return (
<div>This is a placeholder for the Issue Filter.</div>
);
}
}
| Add exception for component stateless error | Add exception for component stateless error
| JSX | mit | seanlinxs/issue-tracker,seanlinxs/issue-tracker | ---
+++
@@ -1,6 +1,6 @@
import React from 'react';
-export default class IssueFilter extends React.Component {
+export default class IssueFilter extends React.Component { // eslint-disable-line
render() {
return (
<div>This is a placeholder for the Issue Filter.</div> |
9bfdf7a665e18a381e045760d4d2431b818bbb37 | src/editor-page.jsx | src/editor-page.jsx | /** @jsx React.DOM */
(function(Perseus) {
var ItemEditor = Perseus.ItemEditor;
var ItemRenderer = Perseus.ItemRenderer;
var CombinedHintsEditor = Perseus.CombinedHintsEditor;
Perseus.EditorPage = React.createClass({
render: function() {
return <div id="perseus" className="framework-perseus">
<ItemEditor
ref="itemEditor"
question={this.props.question}
answerArea={this.props.answerArea}
onChange={this.updatePreview} />
<CombinedHintsEditor
ref="hintsEditor"
hints={this.props.hints} />
</div>;
},
componentWillMount: function() {
this.rendererMountNode = document.createElement("div");
},
updatePreview: function() {
this.renderer = React.renderComponent(Perseus.ItemRenderer({
item: this.toJSON(true),
initialHintsVisible: 0 /* none; to be displayed below */
}), this.rendererMountNode);
},
scorePreview: function() {
if (this.renderer) {
return this.renderer.scoreInput();
} else {
return null;
}
},
toJSON: function(skipValidation) {
return _.extend(this.refs.itemEditor.toJSON(skipValidation), {
hints: this.refs.hintsEditor.toJSON()
});
}
});
})(Perseus);
| /** @jsx React.DOM */
(function(Perseus) {
var ItemEditor = Perseus.ItemEditor;
var ItemRenderer = Perseus.ItemRenderer;
var CombinedHintsEditor = Perseus.CombinedHintsEditor;
Perseus.EditorPage = React.createClass({
render: function() {
return <div id="perseus" className="framework-perseus">
<ItemEditor
ref="itemEditor"
question={this.props.question}
answerArea={this.props.answerArea}
onChange={this.handleChange} />
<CombinedHintsEditor
ref="hintsEditor"
hints={this.props.hints} />
</div>;
},
componentWillMount: function() {
this.rendererMountNode = document.createElement("div");
},
handleChange: function() {
var obj = this.toJSON(true);
if (this.props.onChange) {
this.props.onChange(obj);
}
this.renderer = React.renderComponent(Perseus.ItemRenderer({
item: obj,
initialHintsVisible: 0 /* none; to be displayed below */
}), this.rendererMountNode);
},
scorePreview: function() {
if (this.renderer) {
return this.renderer.scoreInput();
} else {
return null;
}
},
toJSON: function(skipValidation) {
return _.extend(this.refs.itemEditor.toJSON(skipValidation), {
hints: this.refs.hintsEditor.toJSON()
});
}
});
})(Perseus);
| Add onChange prop to EditorPage. | Add onChange prop to EditorPage.
Used for the perseus manifesto.
Test Plan:
Sorry for vagueness. Successfully used this to update perseus one with
an unsaved indicator whenever the question changes.
Auditors: alpert
| JSX | mit | daukantas/perseus,daukantas/perseus,ariabuckles/perseus,junyiacademy/perseus,huangins/perseus,learningequality/perseus,abe4mvp/perseus,ariabuckles/perseus,chirilo/perseus,iamchenxin/perseus,iamchenxin/perseus,huangins/perseus,chirilo/perseus,abe4mvp/perseus,alexristich/perseus,sachgits/perseus,junyiacademy/perseus,sachgits/perseus,learningequality/perseus,alexristich/perseus,ariabuckles/perseus,ariabuckles/perseus | ---
+++
@@ -6,15 +6,15 @@
var CombinedHintsEditor = Perseus.CombinedHintsEditor;
Perseus.EditorPage = React.createClass({
-
+
render: function() {
return <div id="perseus" className="framework-perseus">
- <ItemEditor
+ <ItemEditor
ref="itemEditor"
question={this.props.question}
answerArea={this.props.answerArea}
- onChange={this.updatePreview} />
+ onChange={this.handleChange} />
<CombinedHintsEditor
ref="hintsEditor"
@@ -22,18 +22,23 @@
</div>;
},
-
+
componentWillMount: function() {
this.rendererMountNode = document.createElement("div");
},
-
- updatePreview: function() {
+
+ handleChange: function() {
+ var obj = this.toJSON(true);
+ if (this.props.onChange) {
+ this.props.onChange(obj);
+ }
+
this.renderer = React.renderComponent(Perseus.ItemRenderer({
- item: this.toJSON(true),
+ item: obj,
initialHintsVisible: 0 /* none; to be displayed below */
}), this.rendererMountNode);
},
-
+
scorePreview: function() {
if (this.renderer) {
return this.renderer.scoreInput(); |
ab7b0ec22385e62203d16e02c8be1f763c61d6ed | src/widgets/component-new-edit/components/response-format/table/input-measure.jsx | src/widgets/component-new-edit/components/response-format/table/input-measure.jsx | import React from 'react';
import { Field } from 'redux-form';
import PropTypes from 'prop-types';
import { InputWithVariableAutoCompletion } from 'forms/controls/control-with-suggestions';
import { SelectorView, View } from 'widgets/selector-view';
import ResponseFormatSimple from '../simple/response-format-simple';
import ResponseFormatSingle from '../single/response-format-single';
import Dictionary from 'utils/dictionary/dictionary';
import { QUESTION_TYPE_ENUM } from 'constants/pogues-constants';
const { SIMPLE, SINGLE_CHOICE } = QUESTION_TYPE_ENUM;
function InputMeasure(props) {
return (
<div>
<Field
name="label"
type="text"
component={InputWithVariableAutoCompletion}
label={Dictionary.measureLabel}
required
/>
<SelectorView
label={Dictionary.typeMeasure}
selectorPath={props.selectorPath}
>
<View
key={SIMPLE}
value={SIMPLE}
label={Dictionary.responseFormatSimple}
>
<ResponseFormatSimple
selectorPathParent={props.selectorPath}
showMandatory={false}
/>
</View>
<View
key={SINGLE_CHOICE}
value={SINGLE_CHOICE}
label={Dictionary.responseFormatSingle}
>
<ResponseFormatSingle
selectorPathParent={props.selectorPath}
showMandatory={false}
/>
</View>
</SelectorView>
</div>
);
}
InputMeasure.propTypes = {
selectorPath: PropTypes.string.isRequired,
};
export default InputMeasure;
| import React from 'react';
import { Field } from 'redux-form';
import PropTypes from 'prop-types';
import { RichTextareaWithVariableAutoCompletion } from 'forms/controls/control-with-suggestions';
import {toolbarConfigTooltip} from "forms/controls/rich-textarea";
import { SelectorView, View } from 'widgets/selector-view';
import ResponseFormatSimple from '../simple/response-format-simple';
import ResponseFormatSingle from '../single/response-format-single';
import Dictionary from 'utils/dictionary/dictionary';
import { QUESTION_TYPE_ENUM } from 'constants/pogues-constants';
const { SIMPLE, SINGLE_CHOICE } = QUESTION_TYPE_ENUM;
function InputMeasure(props) {
return (
<div>
<Field
name="label"
component={RichTextareaWithVariableAutoCompletion}
label={Dictionary.measureLabel}
toolbar={toolbarConfigTooltip}
required
/>
<SelectorView
label={Dictionary.typeMeasure}
selectorPath={props.selectorPath}
>
<View
key={SIMPLE}
value={SIMPLE}
label={Dictionary.responseFormatSimple}
>
<ResponseFormatSimple
selectorPathParent={props.selectorPath}
showMandatory={false}
/>
</View>
<View
key={SINGLE_CHOICE}
value={SINGLE_CHOICE}
label={Dictionary.responseFormatSingle}
>
<ResponseFormatSingle
selectorPathParent={props.selectorPath}
showMandatory={false}
/>
</View>
</SelectorView>
</div>
);
}
InputMeasure.propTypes = {
selectorPath: PropTypes.string.isRequired,
};
export default InputMeasure;
| Change Measure Label input to Rich Textarea | Change Measure Label input to Rich Textarea
| JSX | mit | InseeFr/Pogues,InseeFr/Pogues,InseeFr/Pogues | ---
+++
@@ -2,7 +2,8 @@
import { Field } from 'redux-form';
import PropTypes from 'prop-types';
-import { InputWithVariableAutoCompletion } from 'forms/controls/control-with-suggestions';
+import { RichTextareaWithVariableAutoCompletion } from 'forms/controls/control-with-suggestions';
+import {toolbarConfigTooltip} from "forms/controls/rich-textarea";
import { SelectorView, View } from 'widgets/selector-view';
import ResponseFormatSimple from '../simple/response-format-simple';
import ResponseFormatSingle from '../single/response-format-single';
@@ -16,12 +17,12 @@
<div>
<Field
name="label"
- type="text"
- component={InputWithVariableAutoCompletion}
+ component={RichTextareaWithVariableAutoCompletion}
label={Dictionary.measureLabel}
+ toolbar={toolbarConfigTooltip}
required
/>
-
+
<SelectorView
label={Dictionary.typeMeasure}
selectorPath={props.selectorPath} |
77183f11944e7dd47c89df1b277ecdbe9070a17a | src/Menu/SubheaderMenuItem.jsx | src/Menu/SubheaderMenuItem.jsx | import React from 'react';
import PropTypes from 'prop-types';
import ThemeService from '../styles/ChamelThemeService';
const SubheaderMenuItem = (props) => {
let theme = ThemeService.defaultTheme.menu;
return (
<div key={props.index} className={theme.menuSubheader}>{props.text}</div>
);
}
SubheaderMenuItem.propTypes = {
index: PropTypes.number.isRequired,
text: PropTypes.string.isRequired,
};
export default SubheaderMenuItem;
| import React from 'react';
import PropTypes from 'prop-types';
import ThemeService from '../styles/ChamelThemeService';
const SubheaderMenuItem = (props, context) => {
const theme = (context.chamelTheme && context.chamelTheme.menu)
? context.chamelTheme.menu : ThemeService.defaultTheme.menu;
return (
<div key={props.index} className={theme.menuSubheader}>{props.text}</div>
);
}
SubheaderMenuItem.propTypes = {
index: PropTypes.number.isRequired,
text: PropTypes.string.isRequired,
};
export default SubheaderMenuItem;
| Update the way of calling the ThemeService | Update the way of calling the ThemeService
| JSX | mit | skystebnicki/chamel,skystebnicki/chamel | ---
+++
@@ -2,8 +2,10 @@
import PropTypes from 'prop-types';
import ThemeService from '../styles/ChamelThemeService';
-const SubheaderMenuItem = (props) => {
- let theme = ThemeService.defaultTheme.menu;
+const SubheaderMenuItem = (props, context) => {
+ const theme = (context.chamelTheme && context.chamelTheme.menu)
+ ? context.chamelTheme.menu : ThemeService.defaultTheme.menu;
+
return (
<div key={props.index} className={theme.menuSubheader}>{props.text}</div>
); |
637f668f7b90a7c5f6f792c08b32689ac7779f78 | examplePlugin/src/js/components/ExamplePluginComponent.jsx | examplePlugin/src/js/components/ExamplePluginComponent.jsx | import React from "react/addons";
import ExamplePluginStore from "../stores/ExamplePluginStore";
import ExamplePluginEvents from "../events/ExamplePluginEvents";
var {PluginActions, PluginHelper} =
global.MarathonUIPluginAPI;
var ExamplePluginComponent = React.createClass({
getInitialState: function () {
return {
appsCount: 0
};
},
componentDidMount: function () {
ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange);
},
componentWillUnmount: function () {
ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE,
this.onAppsChange);
},
onAppsChange: function () {
this.setState({
appsCount: ExamplePluginStore.apps.length
});
},
handleClick: function (e) {
e.stopPropagation();
PluginHelper.callAction(PluginActions.DIALOG_ALERT, {
title: "Hello world",
message: "Hi, Plugin speaking here."
});
},
render: function () {
return (
<div>
<div className="flex-row">
<h3 className="small-caps">Example Plugin</h3>
</div>
<ul className="list-group filters">
<li>{this.state.appsCount} applications in total</li>
<li><hr /></li>
<li className="clickable" onClick={this.handleClick}>
<a>Click me</a>
</li>
</ul>
</div>
);
}
});
export default ExamplePluginComponent;
| import React from "react/addons";
import ExamplePluginStore from "../stores/ExamplePluginStore";
import ExamplePluginEvents from "../events/ExamplePluginEvents";
var {PluginActions, PluginHelper} =
global.MarathonUIPluginAPI;
var ExamplePluginComponent = React.createClass({
getInitialState: function () {
return {
appsCount: ExamplePluginStore.apps.length
};
},
componentDidMount: function () {
ExamplePluginStore.on(ExamplePluginEvents.APPS_CHANGE, this.onAppsChange);
},
componentWillUnmount: function () {
ExamplePluginStore.removeListener(ExamplePluginEvents.APPS_CHANGE,
this.onAppsChange);
},
onAppsChange: function () {
this.setState({
appsCount: ExamplePluginStore.apps.length
});
},
handleClick: function (e) {
e.stopPropagation();
PluginHelper.callAction(PluginActions.DIALOG_ALERT, {
title: "Hello world",
message: "Hi, Plugin speaking here."
});
},
render: function () {
return (
<div>
<div className="flex-row">
<h3 className="small-caps">Example Plugin</h3>
</div>
<ul className="list-group filters">
<li>{this.state.appsCount} applications in total</li>
<li><hr /></li>
<li className="clickable" onClick={this.handleClick}>
<a>Click me</a>
</li>
</ul>
</div>
);
}
});
export default ExamplePluginComponent;
| Fix small bug in examplePlugin :D | Fix small bug in examplePlugin :D | JSX | apache-2.0 | mesosphere/marathon-ui,cribalik/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui | ---
+++
@@ -10,7 +10,7 @@
getInitialState: function () {
return {
- appsCount: 0
+ appsCount: ExamplePluginStore.apps.length
};
},
|
70c1f8c2a3b1f09ea4eb0a4a8a46e31f906e1972 | src/furniture/components/listingFurnitureRow.component.jsx | src/furniture/components/listingFurnitureRow.component.jsx | import React from 'react';
import UpdateFurnitureFormTable from '../containers/updateFurnitureFormTable.container.jsx';
export default function listingFurnitureRow(props) {
const { roomName, furnitureName, furnitureObj } = props.data;
function controlsClick(e, type) {
// todo: Convert this to a switch-object. Or refactor otherwise; it's looking like it
// hardly does anything, and maybe could just be done inline or something.
if (type === 'edit') {
props.updateEditStatus(furnitureName, true);
} else if (type === 'cancel') {
props.updateEditStatus(furnitureName, false);
} else if (type === 'submit') {
props.updateEditStatus(furnitureName, false);
}
}
return props.editing ? (
<UpdateFurnitureFormTable data={ props.data } controlsClick={ controlsClick }
formKey={ props.data.furnitureName }
initialValues={ props.initialValues } />
) : (
<div className="table-item tr">
<span className="td room slimDown"><strong>{ roomName }</strong></span>
<span className="td slimDown furniture">{ furnitureName }</span>
<span className="td slimDown price">{ furnitureObj.price }</span>
<span className="td slimDown size">{ furnitureObj.size }</span>
<span className="td slimDown color">{ furnitureObj.color }</span>
<span className="td controls slimDown">
<button className={ `btn-flat` } onClick={ (e) => controlsClick(e, 'edit') }>Edit</button>
</span>
</div>
);
}
| import React from 'react';
import UpdateFurnitureFormTable from '../containers/updateFurnitureFormTable.container.jsx';
export default function listingFurnitureRow(props) {
const { roomName, furnitureName, furnitureObj } = props.data;
function controlsClick(e, type) {
const status = {
edit: true,
cancel: false,
submit: false,
};
props.updateEditStatus(furnitureName, status[type]);
}
return props.editing ? (
<UpdateFurnitureFormTable data={ props.data } controlsClick={ controlsClick }
formKey={ props.data.furnitureName }
initialValues={ props.initialValues } />
) : (
<div className="table-item tr">
<span className="td room slimDown"><strong>{ roomName }</strong></span>
<span className="td slimDown furniture">{ furnitureName }</span>
<span className="td slimDown price">{ furnitureObj.price }</span>
<span className="td slimDown size">{ furnitureObj.size }</span>
<span className="td slimDown color">{ furnitureObj.color }</span>
<span className="td controls slimDown">
<button className={ `btn-flat` } onClick={ (e) => controlsClick(e, 'edit') }>Edit</button>
</span>
</div>
);
}
| Replace bulky if/else block with a switch object | refactor(frontend): Replace bulky if/else block with a switch object
| JSX | mit | Nailed-it/Designify,Nailed-it/Designify | ---
+++
@@ -5,15 +5,12 @@
const { roomName, furnitureName, furnitureObj } = props.data;
function controlsClick(e, type) {
- // todo: Convert this to a switch-object. Or refactor otherwise; it's looking like it
- // hardly does anything, and maybe could just be done inline or something.
- if (type === 'edit') {
- props.updateEditStatus(furnitureName, true);
- } else if (type === 'cancel') {
- props.updateEditStatus(furnitureName, false);
- } else if (type === 'submit') {
- props.updateEditStatus(furnitureName, false);
- }
+ const status = {
+ edit: true,
+ cancel: false,
+ submit: false,
+ };
+ props.updateEditStatus(furnitureName, status[type]);
}
return props.editing ? ( |
b9a1e30e00cab33157388c065da2369af09376ff | client/views/readouts/transmission_delay_readout.jsx | client/views/readouts/transmission_delay_readout.jsx | import Moment from "moment";
import "moment-duration-format";
import React from "react";
import ListeningView from "../listening_view.js";
class TransmissionDelayReadout extends ListeningView {
componentDidMount() {
super.componentDidMount();
window.setInterval(() => {this.forceUpdate();}, 1000);
}
render() {
const unixTime = this.state.data ? this.state.data.t : 0;
const time = Moment.unix(unixTime).utc();
const now = Moment().utc();
const delta = now.diff(time, "milliseconds");
const rangeAlarm = Math.abs(delta) > 30000;
const formatted = Moment.duration(delta, "milliseconds").format("HH:mm:ss", { trim: false });
return <span className={rangeAlarm ? "time-alarm" : ""}>{formatted}</span>;
}
}
export {TransmissionDelayReadout as default};
| import Moment from "moment";
import "moment-duration-format";
import React from "react";
import ListeningView from "../listening_view.js";
class TransmissionDelayReadout extends ListeningView {
componentDidMount() {
super.componentDidMount();
window.setInterval(() => {this.forceUpdate();}, 1000);
}
render() {
const unixTime = this.state.data ? this.state.data.t : 0;
if (typeof unixTime === "undefined") {
return <span className="time-alarm">-</span>;
}
const time = Moment.unix(unixTime).utc();
const now = Moment().utc();
const delta = now.diff(time, "milliseconds");
const rangeAlarm = Math.abs(delta) > 30000;
const formatted = Moment.duration(delta, "milliseconds").format("HH:mm:ss", { trim: false });
return <span className={rangeAlarm ? "time-alarm" : ""}>{formatted}</span>;
}
}
export {TransmissionDelayReadout as default};
| Add temporary workaround for delay display in current prod outage. | Add temporary workaround for delay display in current prod outage.
| JSX | mit | sensedata/space-telemetry,sensedata/space-telemetry | ---
+++
@@ -13,6 +13,9 @@
render() {
const unixTime = this.state.data ? this.state.data.t : 0;
+ if (typeof unixTime === "undefined") {
+ return <span className="time-alarm">-</span>;
+ }
const time = Moment.unix(unixTime).utc();
const now = Moment().utc();
const delta = now.diff(time, "milliseconds"); |
d5f6fa974651704555d57e44e2387432067603a6 | src/request/components/request-session-list-view.jsx | src/request/components/request-session-list-view.jsx | var React = require('react'),
SessionItem = require('./request-session-item-view.js');
function getSessionState() {
return {
allSessions: sessionStore.getAll()
};
};
module.exports = React.createClass({
render: function() {
var allSessions = this.props.allSessions;
var sessions = [];
for (var key in allSessions) {
sessions.push(<SessionItem key={key} session={allSessions[key]} />);
}
if (sessions.length == 0) {
sessions = <em>No found sessions.</em>;
}
return (
<ul className="request-session-list-holder">
{sessions}
</ul>
);
}
});
| var React = require('react'),
SessionItem = require('./request-session-item-view.js');
module.exports = React.createClass({
render: function() {
var allSessions = this.props.allSessions;
var sessions = [];
for (var key in allSessions) {
sessions.push(<SessionItem key={key} session={allSessions[key]} />);
}
if (sessions.length == 0) {
sessions = <em>No found sessions.</em>;
}
return (
<ul className="request-session-list-holder">
{sessions}
</ul>
);
}
});
| Remove unused code from session list | Remove unused code from session list
| JSX | unknown | Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype | ---
+++
@@ -1,11 +1,5 @@
var React = require('react'),
SessionItem = require('./request-session-item-view.js');
-
-function getSessionState() {
- return {
- allSessions: sessionStore.getAll()
- };
-};
module.exports = React.createClass({
render: function() { |
2f0a52da9815964099b89d155161e5c6a9b77ef0 | src/field/social/ask_social_network.jsx | src/field/social/ask_social_network.jsx | import React from 'react';
import Screen from '../../core/screen';
import SocialButtonsPane from './social_buttons_pane';
import { renderSignedInConfirmation } from '../../core/signed_in_confirmation';
const Component = ({i18n, model, t}) => (
<SocialButtonsPane
labelFn={i18n.str}
lock={model}
showLoading={true}
signUp={false}
smallButtonsHeader={t("smallSocialButtonsHeader", {__textOnly: true})}
/>
);
export default class AskSocialNetwork extends Screen {
constructor() {
super("network");
}
renderAuxiliaryPane(lock) {
return renderSignedInConfirmation(lock);
}
render() {
return Component;
}
}
| import React from 'react';
import Screen from '../../core/screen';
import SocialButtonsPane from './social_buttons_pane';
import { renderSignedInConfirmation } from '../../core/signed_in_confirmation';
const Component = ({i18n, model}) => (
<SocialButtonsPane
instructions={i18n.html("socialLoginInstructions")}
labelFn={i18n.str}
lock={model}
showLoading={true}
signUp={false}
/>
);
export default class AskSocialNetwork extends Screen {
constructor() {
super("network");
}
renderAuxiliaryPane(lock) {
return renderSignedInConfirmation(lock);
}
render() {
return Component;
}
}
| Use i18n prop instead of t in AskSocialNetwork | Use i18n prop instead of t in AskSocialNetwork
| JSX | mit | mike-casas/lock,mike-casas/lock,mike-casas/lock | ---
+++
@@ -3,13 +3,13 @@
import SocialButtonsPane from './social_buttons_pane';
import { renderSignedInConfirmation } from '../../core/signed_in_confirmation';
-const Component = ({i18n, model, t}) => (
+const Component = ({i18n, model}) => (
<SocialButtonsPane
+ instructions={i18n.html("socialLoginInstructions")}
labelFn={i18n.str}
lock={model}
showLoading={true}
signUp={false}
- smallButtonsHeader={t("smallSocialButtonsHeader", {__textOnly: true})}
/>
);
|
ced164c8710cb017638c2f56509c238dd9f4e038 | client/app/bundles/DenpaioApp/components/AppLayout.jsx | client/app/bundles/DenpaioApp/components/AppLayout.jsx | import React from 'react';
import SearchBar from './SearchBar';
import DanmakuBar from './DanmakuBar';
export default class AppLayout extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
handleSearch = (keyword) => {
this.setState({ keyword });
this.props.router.push(`/search?q=${keyword}`);
};
render() {
backgroundStyle['backgroundImage'] = `url(${this.props.route.backgroundImage})`;
return (
<div id="denpaio-app" style={backgroundStyle}>
<header className="player">
<audio src="https://stream.denpa.io/denpaio.ogg" preload="none" controls />
<SearchBar
onSearch={this.handleSearch}
/>
</header>
<section className="container">
{this.props.children}
</section>
<footer className="navbar">
<DanmakuBar />
</footer>
</div>
);
}
}
const backgroundStyle = {
backgroundSize: 'cover',
backgroundPosition: '50% 30%',
};
| import React from 'react';
import SearchBar from './SearchBar';
import DanmakuBar from './DanmakuBar';
export default class AppLayout extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
currentStyle() {
let pathname = this.props.location.pathname;
let defaultStyle = {
backgroundColor: 'rgba(0, 0, 0, 0.4)'
};
return pathname === '/' ? {} : defaultStyle;
}
handleSearch = (keyword) => {
this.setState({ keyword });
this.props.router.push(`/search?q=${keyword}`);
};
render() {
backgroundStyle['backgroundImage'] = `url(${this.props.route.backgroundImage})`;
return (
<div id="denpaio-app" style={backgroundStyle}>
<header className="player">
<audio src="https://stream.denpa.io/denpaio.ogg" preload="none" controls />
<SearchBar
onSearch={this.handleSearch}
/>
</header>
<section className="container" style={this.currentStyle()}>
{this.props.children}
</section>
<footer className="navbar">
<DanmakuBar />
</footer>
</div>
);
}
}
const backgroundStyle = {
backgroundSize: 'cover',
backgroundPosition: '50% 30%',
};
| Add background color to non-index pages | Add background color to non-index pages
| JSX | mit | denpaio/denpaio,denpaio/denpaio,denpaio/denpaio,denpaio/denpaio | ---
+++
@@ -6,6 +6,14 @@
constructor(props) {
super(props);
this.state = {};
+ }
+
+ currentStyle() {
+ let pathname = this.props.location.pathname;
+ let defaultStyle = {
+ backgroundColor: 'rgba(0, 0, 0, 0.4)'
+ };
+ return pathname === '/' ? {} : defaultStyle;
}
handleSearch = (keyword) => {
@@ -24,7 +32,7 @@
onSearch={this.handleSearch}
/>
</header>
- <section className="container">
+ <section className="container" style={this.currentStyle()}>
{this.props.children}
</section>
<footer className="navbar"> |
3331f34d193317b3440a497566f79cdce06b3034 | src/client/render.jsx | src/client/render.jsx | import React from 'react';
import {render as renderToDom} from 'react-dom';
import {Provider} from 'react-redux';
import {ReduxAsyncConnect} from 'redux-connect';
import {Router, browserHistory} from 'react-router';
import {syncHistoryWithStore} from 'react-router-redux';
function render(configureStore, createRoutes, mountTo, helpers = {}) {
const store = configureStore(true, browserHistory, window.__INITIAL_STATE__);
const history = syncHistoryWithStore(browserHistory, store);
renderToDom(
<Provider store={store}>
<Router render={props => <ReduxAsyncConnect helpers={helpers} {...props}/>} history={history} routes={createRoutes(store)}/>
</Provider>,
mountTo
);
return store;
}
export default render;
| import React from 'react';
import {render as renderToDom} from 'react-dom';
import {Provider} from 'react-redux';
import {ReduxAsyncConnect} from 'redux-connect';
import {Router, browserHistory, applyRouterMiddleware} from 'react-router';
import {syncHistoryWithStore} from 'react-router-redux';
function render(configureStore, createRoutes, mountTo, {middleware, helpers}) {
const store = configureStore(true, browserHistory, window.__INITIAL_STATE__);
const history = syncHistoryWithStore(browserHistory, store);
renderToDom(
<Provider store={store}>
<Router history={history} routes={createRoutes(store)} render={props => (
<ReduxAsyncConnect helpers={helpers || {}} {...props} render={applyRouterMiddleware(...(middleware || []))}/>
)}/>
</Provider>,
mountTo
);
return store;
}
export default render;
| Add support for router middleware | Add support for router middleware
| JSX | mit | andy-shea/react-cornerstone | ---
+++
@@ -2,16 +2,18 @@
import {render as renderToDom} from 'react-dom';
import {Provider} from 'react-redux';
import {ReduxAsyncConnect} from 'redux-connect';
-import {Router, browserHistory} from 'react-router';
+import {Router, browserHistory, applyRouterMiddleware} from 'react-router';
import {syncHistoryWithStore} from 'react-router-redux';
-function render(configureStore, createRoutes, mountTo, helpers = {}) {
+function render(configureStore, createRoutes, mountTo, {middleware, helpers}) {
const store = configureStore(true, browserHistory, window.__INITIAL_STATE__);
const history = syncHistoryWithStore(browserHistory, store);
renderToDom(
<Provider store={store}>
- <Router render={props => <ReduxAsyncConnect helpers={helpers} {...props}/>} history={history} routes={createRoutes(store)}/>
+ <Router history={history} routes={createRoutes(store)} render={props => (
+ <ReduxAsyncConnect helpers={helpers || {}} {...props} render={applyRouterMiddleware(...(middleware || []))}/>
+ )}/>
</Provider>,
mountTo
); |
0dc68b3385427a9bdb57631bd84cc70f0cf3b8f6 | imports/ui/structure-view/element-tree/element-tree.jsx | imports/ui/structure-view/element-tree/element-tree.jsx | import React, { PropTypes } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import Elements from '../../../api/elements/elements.js';
import Element from './element.jsx';
import AddElementButton from './add-element-button.jsx';
import { Panel } from 'react-bootstrap';
const elementTreeHeader = () => (
<AddElementButton
possibleTypeNames={['dimension']}
/>
);
const ElementTree = (props) => (
<div id="element-tree">
<Panel header={elementTreeHeader()}>
<div id="elements">
{props.elements.map((element) => {
return (
<Element
setSelectedElementId={props.setSelectedElementId}
selectedElementId={props.selectedElementId}
key={element._id}
element={element}
/>
);
})}
</div>
</Panel>
</div>
);
ElementTree.propTypes = {
elements: PropTypes.array.isRequired,
setSelectedElementId: PropTypes.func.isRequired,
selectedElementId: PropTypes.string,
};
export default createContainer(() => {
return {
elements: Elements.collection.find({ parentId: { $exists: false } }).fetch(),
};
}, ElementTree);
| import React, { PropTypes } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import Elements from '../../../api/elements/elements.js';
import Element from './element.jsx';
import AddElementButton from './add-element-button.jsx';
import { Panel } from 'react-bootstrap';
const elementTreeHeader = () => (
<div>
Elements
<div className="pull-right">
<AddElementButton
possibleTypeNames={['dimension']}
/>
</div>
</div>
);
const ElementTree = (props) => (
<div id="element-tree">
<Panel header={elementTreeHeader()}>
<div id="elements">
{props.elements.map((element) => {
return (
<Element
setSelectedElementId={props.setSelectedElementId}
selectedElementId={props.selectedElementId}
key={element._id}
element={element}
/>
);
})}
</div>
</Panel>
</div>
);
ElementTree.propTypes = {
elements: PropTypes.array.isRequired,
setSelectedElementId: PropTypes.func.isRequired,
selectedElementId: PropTypes.string,
};
export default createContainer(() => {
return {
elements: Elements.collection.find({ parentId: { $exists: false } }).fetch(),
};
}, ElementTree);
| Add title to element tree and move plus button to the right | Add title to element tree and move plus button to the right
| JSX | mit | minden/data-furnace,minden/data-furnace | ---
+++
@@ -6,9 +6,14 @@
import { Panel } from 'react-bootstrap';
const elementTreeHeader = () => (
- <AddElementButton
- possibleTypeNames={['dimension']}
- />
+ <div>
+ Elements
+ <div className="pull-right">
+ <AddElementButton
+ possibleTypeNames={['dimension']}
+ />
+ </div>
+ </div>
);
const ElementTree = (props) => ( |
4411ae6cc79111e683735a9fb24c360fd47d5a7b | src/components/ClocketteApp.jsx | src/components/ClocketteApp.jsx | 'use strict';
import React from 'react';
// CSS
import 'normalize.css';
import 'styles/main.css';
const ClocketteApp = React.createClass({
render() {
return (
<p>It's working!</p>
);
}
});
export default ClocketteApp;
| 'use strict';
import React from 'react';
import { RouteHandler } from 'react-router';
import 'normalize.css';
import 'styles/main.css';
const ClocketteApp = React.createClass({
getInitialState() {
this.interval = null;
return {
ts: Date.now()
};
},
componentDidMount() {
this.interval = setInterval(() => {
this.setState({
ts: Date.now()
});
}, 1000 * 30);
},
componentWillUnmount() {
clearInterval(this.interval);
},
render() {
return (
<RouteHandler ts={this.state.ts}/>
);
}
});
export default ClocketteApp;
| Add routeHandler in App, application global timestamp state + interval to refresh it naively (so far) | Add routeHandler in App, application global timestamp state + interval to refresh it naively (so far)
| JSX | mit | rhumlover/clockette,rhumlover/clockette | ---
+++
@@ -1,17 +1,40 @@
'use strict';
import React from 'react';
+import { RouteHandler } from 'react-router';
-// CSS
import 'normalize.css';
import 'styles/main.css';
+
const ClocketteApp = React.createClass({
+
+ getInitialState() {
+ this.interval = null;
+
+ return {
+ ts: Date.now()
+ };
+ },
+
+ componentDidMount() {
+ this.interval = setInterval(() => {
+ this.setState({
+ ts: Date.now()
+ });
+ }, 1000 * 30);
+ },
+
+ componentWillUnmount() {
+ clearInterval(this.interval);
+ },
+
render() {
return (
- <p>It's working!</p>
+ <RouteHandler ts={this.state.ts}/>
);
}
+
});
export default ClocketteApp; |
5a96465b5ee54e61351c5e46f7fc98a10c2c51bf | src/components/Sidebar/InfoTab.jsx | src/components/Sidebar/InfoTab.jsx | import React from 'react';
import './Sidebar.scss';
import baseTab from './BaseTab';
function InfoTab() {
return (
<div>
<section>
<p className="info-paragraph">
Freesound Explorer is a visual interface for exploring Freesound content
in a 2-dimensional space and for creating music :)
</p>
</section>
<section>
<p className="info-paragraph">
Freesound Explorer is developed by Frederic Font and Giuseppe Bandiera at the
Music Technology Group, Universitat Pompeu Fabra.
</p>
</section>
<section>
<p className="info-paragraph">
Code at: <a href="https://github.com/ffont/freesound-explorer">
https://github.com/ffont/freesound-explorer
</a>
</p>
</section>
</div>
);
}
export default baseTab('About...', InfoTab);
| import React from 'react';
import './Sidebar.scss';
import baseTab from './BaseTab';
function InfoTab() {
return (
<div>
<section>
<p className="info-paragraph">
Freesound Explorer is a visual interface for exploring Freesound content
in a 2-dimensional space and create music at the same time :)
</p>
</section>
<section>
<p className="info-paragraph">
Please, <a href="https://github.com/ffont/freesound-explorer#tutorialhow-to-use" target="_blank">
check this tutorial</a> to learn how Freesound Explorer works.
</p>
</section>
<section>
<p className="info-paragraph">
Freesound Explorer has been developed (so far) by Frederic Font and Giuseppe Bandiera at the
Music Technology Group, Universitat Pompeu Fabra. You can find the <a href="https://github.com/ffont/freesound-explorer" target="_blank">
source code here</a>.
</p>
</section>
</div>
);
}
export default baseTab('About...', InfoTab);
| Update text in about sidebar tab | Update text in about sidebar tab
| JSX | mit | ffont/freesound-explorer,ffont/freesound-explorer,ffont/freesound-explorer | ---
+++
@@ -8,20 +8,20 @@
<section>
<p className="info-paragraph">
Freesound Explorer is a visual interface for exploring Freesound content
- in a 2-dimensional space and for creating music :)
+ in a 2-dimensional space and create music at the same time :)
</p>
</section>
<section>
<p className="info-paragraph">
- Freesound Explorer is developed by Frederic Font and Giuseppe Bandiera at the
- Music Technology Group, Universitat Pompeu Fabra.
+ Please, <a href="https://github.com/ffont/freesound-explorer#tutorialhow-to-use" target="_blank">
+ check this tutorial</a> to learn how Freesound Explorer works.
</p>
</section>
<section>
<p className="info-paragraph">
- Code at: <a href="https://github.com/ffont/freesound-explorer">
- https://github.com/ffont/freesound-explorer
- </a>
+ Freesound Explorer has been developed (so far) by Frederic Font and Giuseppe Bandiera at the
+ Music Technology Group, Universitat Pompeu Fabra. You can find the <a href="https://github.com/ffont/freesound-explorer" target="_blank">
+ source code here</a>.
</p>
</section>
</div> |
2ffddf16ff34ad7beaeef555fca94edd030d8aac | app/assets/javascripts/components/tickets/tickets_table_row.jsx | app/assets/javascripts/components/tickets/tickets_table_row.jsx | import React from 'react';
import { Link } from 'react-router-dom';
import { STATUSES } from './util';
import TicketStatusHandler from './ticket_status_handler';
import TicketOwnerHandler from './ticket_owner_handler';
const TicketsTableRow = ({ ticket }) => {
const { sender, sender_email } = ticket;
const senderName = sender.real_name || sender.username || sender_email;
return (
<tr className={ticket.status === 0 ? 'table-row--faded' : ''}>
<td className="w10">
{senderName || 'Unknown User Record' }
</td>
<td className="w15">
{ticket.subject}
</td>
<td className="w25">
{
ticket.project.id
? <Link to={`/courses/${ticket.project.slug}`}>{ ticket.project.title }</Link>
: 'Course Unknown'
}
</td>
<td className="w20">
{ STATUSES[ticket.status] }
<TicketStatusHandler ticket={ticket} />
</td>
<td className="w20">
{ ticket.owner.username }
<TicketOwnerHandler ticket={ticket} />
</td>
<td className="w10">
<Link className="button" to={`/tickets/dashboard/${ticket.id}`}>Show</Link>
</td>
</tr>
);
};
export default TicketsTableRow;
| import React from 'react';
import { Link } from 'react-router-dom';
import { STATUSES } from './util';
import TicketStatusHandler from './ticket_status_handler';
import TicketOwnerHandler from './ticket_owner_handler';
const TicketsTableRow = ({ ticket }) => {
const { sender, sender_email } = ticket;
const senderName = sender.real_name || sender.username || sender_email;
return (
<tr className={ticket.status === 0 ? 'table-row--faded' : ''}>
<td className="w10">
{senderName || 'Unknown User Record' }
</td>
<td className="w15">
{ticket.subject && ticket.subject.replace(/_/g, ' ')}
</td>
<td className="w25">
{
ticket.project.id
? <Link to={`/courses/${ticket.project.slug}`}>{ ticket.project.title }</Link>
: 'Course Unknown'
}
</td>
<td className="w20">
{ STATUSES[ticket.status] }
<TicketStatusHandler ticket={ticket} />
</td>
<td className="w20">
{ ticket.owner.username }
<TicketOwnerHandler ticket={ticket} />
</td>
<td className="w10">
<Link className="button" to={`/tickets/dashboard/${ticket.id}`}>Show</Link>
</td>
</tr>
);
};
export default TicketsTableRow;
| Replace underscores in ticket subjects, for better linebreaks | Replace underscores in ticket subjects, for better linebreaks
| JSX | mit | WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ---
+++
@@ -14,7 +14,7 @@
{senderName || 'Unknown User Record' }
</td>
<td className="w15">
- {ticket.subject}
+ {ticket.subject && ticket.subject.replace(/_/g, ' ')}
</td>
<td className="w25">
{ |
15b7aa0a4c57f9720516911d231e0a8d800516de | demo/src/demo_app.jsx | demo/src/demo_app.jsx | /**
* Created by Aaron on 12/21/2015.
*/
import * as React from 'react';
import ReCaptcha from '../../';
class DemoApp extends React.Component {
render() {
return (
<div>
<h1>react-recaptcha2 Demo App</h1>
<h3>Explicit Rendering</h3>
<ReCaptcha id="demo_recaptcha" render="explicit" sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
<h3>with dark theme</h3>
<ReCaptcha id="demo_recaptcha2" render="explicit" theme="dark"
sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
<h3>with compact size</h3>
<ReCaptcha id="demo_recaptcha3" render="explicit" size="compact"
sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
<h3>with audio type (may not display differently)</h3>
<ReCaptcha id="demo_recaptcha4" render="explicit" type="audio"
sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
</div>
);
}
}
export default DemoApp;
| /**
* Created by Aaron on 12/21/2015.
*/
import * as React from 'react';
import ReCaptcha from '../../';
const gh_pages_key = "6LfKmBMTAAAAAEEk10iOxbp11HWyhq1v_jGdyyOA";
class DemoApp extends React.Component {
render() {
return (
<div>
<h1>react-recaptcha2 Demo App</h1>
<h3>Explicit Rendering</h3>
<ReCaptcha id="demo_recaptcha" render="explicit" sitekey={gh_pages_key}/>
<h3>with dark theme</h3>
<ReCaptcha id="demo_recaptcha2" render="explicit" theme="dark"
sitekey={gh_pages_key}/>
<h3>with compact size</h3>
<ReCaptcha id="demo_recaptcha3" render="explicit" size="compact"
sitekey={gh_pages_key}/>
<h3>with audio type (may not display differently)</h3>
<ReCaptcha id="demo_recaptcha4" render="explicit" type="audio"
sitekey={gh_pages_key}/>
</div>
);
}
}
export default DemoApp;
| Add new key for gh-pages | Add new key for gh-pages
| JSX | mit | novacrazy/react-recaptcha2,novacrazy/react-recaptcha2 | ---
+++
@@ -6,6 +6,8 @@
import ReCaptcha from '../../';
+const gh_pages_key = "6LfKmBMTAAAAAEEk10iOxbp11HWyhq1v_jGdyyOA";
+
class DemoApp extends React.Component {
render() {
return (
@@ -13,19 +15,19 @@
<h1>react-recaptcha2 Demo App</h1>
<h3>Explicit Rendering</h3>
- <ReCaptcha id="demo_recaptcha" render="explicit" sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
+ <ReCaptcha id="demo_recaptcha" render="explicit" sitekey={gh_pages_key}/>
<h3>with dark theme</h3>
<ReCaptcha id="demo_recaptcha2" render="explicit" theme="dark"
- sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
+ sitekey={gh_pages_key}/>
<h3>with compact size</h3>
<ReCaptcha id="demo_recaptcha3" render="explicit" size="compact"
- sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
+ sitekey={gh_pages_key}/>
<h3>with audio type (may not display differently)</h3>
<ReCaptcha id="demo_recaptcha4" render="explicit" type="audio"
- sitekey="6Ldi-wcTAAAAAEAiAJ9bfHL3-SCdvD4xAxv0Wl-n"/>
+ sitekey={gh_pages_key}/>
</div>
);
} |
1167cc33efd371c7432f4d68a437e84080cc74e6 | app/assets/javascripts/relay/routes/board-route.react.jsx | app/assets/javascripts/relay/routes/board-route.react.jsx | var Relay = require('react-relay');
//var BoardRelayRoute = class extends Relay.Route {
// static queries = {
// board: () => Relay.QL`query { board }`,
// };
// static routeName = 'BoardHomeRoute';
//};
//KAKAclass BoardRelayRoute extends Relay.Route {};
//KAKABoardRelayRoute.queries = {
//KAKA simple: () => Relay.QL`
//KAKA query { simple }
//KAKA `,
// board: () => Relay.QL`query { board }`
//KAKA feedbackChannel: () => Relay.QL`query { feedbackChannel }`,
//KAKA};
//KAKABoardRelayRoute.routeName = 'BoardHomeRoute';
// feedbackChannelRoot: () => Relay.QL`
// query getFeedbackChannel($uniqueHash: String!) { feedbackChannelRoot(unique_hash: $uniqueHash) }`,
// },
//SS feedbackChannelRoot: () => Relay.QL`
//SS query { feedbackChannelRoot(unique_hash: "qnHXwf7V") }
//SS `,
var BoardRelayRoute = {
queries: {
simple: () => Relay.QL` query { simple } `,
},
params: {
},
name: 'BoardHomeRoute',
}
window.BoardRelayRoute = BoardRelayRoute;
module.exports = BoardRelayRoute;
//export default BoardRelayRoute;
| var Relay = require('react-relay');
var BoardRelayRoute = {
queries: {
simple: () => Relay.QL` query { simple } `,
},
params: {
},
name: 'BoardHomeRoute',
}
module.exports = BoardRelayRoute;
| Remove commented out code from route | Remove commented out code from route
| JSX | mit | nethsix/relay_on_rails,nethsix/relay-on-rails,nethsix/relay_on_rails,nethsix/relay-on-rails,nethsix/relay_on_rails,nethsix/relay-on-rails | ---
+++
@@ -1,25 +1,4 @@
var Relay = require('react-relay');
-//var BoardRelayRoute = class extends Relay.Route {
-// static queries = {
-// board: () => Relay.QL`query { board }`,
-// };
-// static routeName = 'BoardHomeRoute';
-//};
-//KAKAclass BoardRelayRoute extends Relay.Route {};
-//KAKABoardRelayRoute.queries = {
-//KAKA simple: () => Relay.QL`
-//KAKA query { simple }
-//KAKA `,
-// board: () => Relay.QL`query { board }`
-//KAKA feedbackChannel: () => Relay.QL`query { feedbackChannel }`,
-//KAKA};
-//KAKABoardRelayRoute.routeName = 'BoardHomeRoute';
-// feedbackChannelRoot: () => Relay.QL`
-// query getFeedbackChannel($uniqueHash: String!) { feedbackChannelRoot(unique_hash: $uniqueHash) }`,
-// },
-//SS feedbackChannelRoot: () => Relay.QL`
-//SS query { feedbackChannelRoot(unique_hash: "qnHXwf7V") }
-//SS `,
var BoardRelayRoute = {
queries: {
simple: () => Relay.QL` query { simple } `,
@@ -28,6 +7,4 @@
},
name: 'BoardHomeRoute',
}
-window.BoardRelayRoute = BoardRelayRoute;
module.exports = BoardRelayRoute;
-//export default BoardRelayRoute; |
372ccb6741ba07dadeeebccc706434a7b20c5e23 | client/app/presentationals/components/shared/NavMenu.jsx | client/app/presentationals/components/shared/NavMenu.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
function NavMenu(props) {
const menuItems = {
'/': 'Dashboard',
'/editor/slide': 'Slide editor',
'/signup': 'Sign up',
'/signin': 'Sign in',
};
return (
<header className={`c_nav-menu c_nav-menu--${props.cssIdentifier}`}>
<div className="c_nav-menu__wrapper">
<ul className="c_nav-menu__list">
{Object.keys(menuItems).map(route => (
<li className="c_nav-menu__item" key={route}>
<Link className="c_nav-menu__link" to={route}>
{menuItems[route]}
</Link>
</li>
))}
</ul>
</div>
</header>
);
}
NavMenu.propTypes = {
cssIdentifier: PropTypes.string,
};
NavMenu.defaultProps = {
cssIdentifier: 'default',
};
export default NavMenu;
| import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
function NavMenu(props) {
const menuItems = {
'/': 'Dashboard',
'/editor/slide': 'Slide editor',
'/signup': 'Sign up',
'/signin': 'Sign in',
};
return (
<div className={`c_nav-menu c_nav-menu--${props.cssIdentifier}`}>
<div className="c_nav-menu__wrapper">
<ul className="c_nav-menu__list">
{Object.keys(menuItems).map(route => (
<li className="c_nav-menu__item" key={route}>
<Link className="c_nav-menu__link" to={route}>
{menuItems[route]}
</Link>
</li>
))}
</ul>
</div>
</div>
);
}
NavMenu.propTypes = {
cssIdentifier: PropTypes.string,
};
NavMenu.defaultProps = {
cssIdentifier: 'default',
};
export default NavMenu;
| Fix faulty use of header tag in nav menu. | Fix faulty use of header tag in nav menu.
| JSX | mit | OpenWebslides/OpenWebslides,OpenWebslides/OpenWebslides,OpenWebslides/OpenWebslides,OpenWebslides/OpenWebslides | ---
+++
@@ -11,7 +11,7 @@
};
return (
- <header className={`c_nav-menu c_nav-menu--${props.cssIdentifier}`}>
+ <div className={`c_nav-menu c_nav-menu--${props.cssIdentifier}`}>
<div className="c_nav-menu__wrapper">
<ul className="c_nav-menu__list">
{Object.keys(menuItems).map(route => (
@@ -23,7 +23,7 @@
))}
</ul>
</div>
- </header>
+ </div>
);
}
|
81e961f3f78a4fd270ec31dbcfcc0ba5eaeffa45 | web/static/js/components/remote_retro.jsx | web/static/js/components/remote_retro.jsx | import React, { Component, PropTypes } from "react"
import { Presence } from "phoenix"
import * as AppPropTypes from "../prop_types"
import Room from "./room"
const isFacilitator = currentPresence => {
if (currentPresence) {
return currentPresence.user.is_facilitator
}
return false
}
class RemoteRetro extends Component {
constructor(props) {
super(props)
this.state = {
presences: {},
}
}
componentWillMount() {
this.props.retroChannel.on("presence_state", presences => this.setState({ presences }))
this.props.retroChannel.join()
}
render() {
const { userToken, retroChannel } = this.props
const { presences } = this.state
const users = Presence.list(presences, (_username, presence) => (presence.user))
const currentPresence = presences[userToken]
return (
<Room
currentPresence={currentPresence}
users={users}
isFacilitator={isFacilitator(currentPresence)}
retroChannel={retroChannel}
/>
)
}
}
RemoteRetro.propTypes = {
retroChannel: AppPropTypes.retroChannel.isRequired,
userToken: PropTypes.string.isRequired,
}
export default RemoteRetro
| import React, { Component, PropTypes } from "react"
import { Presence } from "phoenix"
import * as AppPropTypes from "../prop_types"
import Room from "./room"
const isFacilitator = currentPresence => {
if (currentPresence) {
return currentPresence.user.is_facilitator
}
return false
}
class RemoteRetro extends Component {
constructor(props) {
super(props)
this.state = {
presences: {},
}
}
componentWillMount() {
this.props.retroChannel.on("presence_state", presences => this.setState({ presences }))
this.props.retroChannel.join()
.receive("ok", () => console.log("RetroChannel joined"))
.receive("error", error => console.error(error))
}
render() {
const { userToken, retroChannel } = this.props
const { presences } = this.state
const users = Presence.list(presences, (_username, presence) => (presence.user))
const currentPresence = presences[userToken]
return (
<Room
currentPresence={currentPresence}
users={users}
isFacilitator={isFacilitator(currentPresence)}
retroChannel={retroChannel}
/>
)
}
}
RemoteRetro.propTypes = {
retroChannel: AppPropTypes.retroChannel.isRequired,
userToken: PropTypes.string.isRequired,
}
export default RemoteRetro
| Add handlers for retroChannel.js client's 'join' responses | Add handlers for retroChannel.js client's 'join' responses
| JSX | mit | samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro | ---
+++
@@ -23,6 +23,8 @@
componentWillMount() {
this.props.retroChannel.on("presence_state", presences => this.setState({ presences }))
this.props.retroChannel.join()
+ .receive("ok", () => console.log("RetroChannel joined"))
+ .receive("error", error => console.error(error))
}
render() { |
32551f6be560d27cd03641f7694c34768aaaa064 | app/scripts/pages/lobby.jsx | app/scripts/pages/lobby.jsx | import React from 'react';
import GameList from '../components/GameList.jsx';
import LobbyActions from '../actions/LobbyActions';
import LobbyStore from '../stores/LobbyStore';
class Lobby extends React.Component {
render() {
return (
<div>
<GameList />
</div>
);
}
}
export default Lobby;
| import React from 'react';
import $ from 'jquery';
import GameList from '../components/GameList.jsx';
import LobbyActions from '../actions/LobbyActions';
import LobbyStore from '../stores/LobbyStore';
class Lobby extends React.Component {
validate() {
var redirect = '/auth/login?redirect=' + encodeURIComponent(window.location);
$.ajax({
type: 'GET',
url: '/auth/me',
statusCode: {
401: function() { window.location = redirect; }
}
});
}
render() {
//this.validate();
return (
<div>
<GameList />
</div>
);
}
}
export default Lobby;
| Add structure for auth validation | Add structure for auth validation
| JSX | mit | gnidan/foodtastechess-client,gnidan/foodtastechess-client | ---
+++
@@ -1,4 +1,5 @@
import React from 'react';
+import $ from 'jquery';
import GameList from '../components/GameList.jsx';
import LobbyActions from '../actions/LobbyActions';
@@ -6,7 +7,23 @@
class Lobby extends React.Component {
+ validate() {
+
+ var redirect = '/auth/login?redirect=' + encodeURIComponent(window.location);
+
+ $.ajax({
+ type: 'GET',
+ url: '/auth/me',
+ statusCode: {
+ 401: function() { window.location = redirect; }
+ }
+ });
+
+ }
+
render() {
+ //this.validate();
+
return (
<div>
<GameList /> |
04ed67d8aa13e15bed669b24d09ff86ef531be3e | src/frontend/components/admin/GroupsList.jsx | src/frontend/components/admin/GroupsList.jsx | 'use strict';
import React from 'react';
import GroupListEntry from './GroupListEntry.jsx';
import AddGroupModalLauncher from './AddGroupModalLauncher.jsx';
export default ({ groups , selectedGroup, editable, onSave, onSelectGroup}) => {
let groupEntries = groups.map( group => (<GroupListEntry group={group} onSave={onSave} onSelect={onSelectGroup} />));
let addModalLauncher = editable ? <li className="new"><AddGroupModalLauncher onSave={onSave} /></li> : null;
function selectAll() {
onSelectGroup();
}
return (
<ul>
<li onClick={selectAll} className={selectedGroup === undefined ? 'selected' : '' }>All participants</li>
{ groupEntries }
{ addModalLauncher }
</ul>
)
}
| 'use strict';
import React from 'react';
import GroupListEntry from './GroupListEntry.jsx';
import AddGroupModalLauncher from './AddGroupModalLauncher.jsx';
export default ({ groups , selectedGroup, editable, onSave, onSelectGroup}) => {
let groupEntries = groups.map( group => (<GroupListEntry key={group.id} group={group} onSave={onSave} onSelect={onSelectGroup} />));
let addModalLauncher = editable ? <li className="new"><AddGroupModalLauncher onSave={onSave} /></li> : null;
function selectAll() {
onSelectGroup();
}
return (
<ul>
<li onClick={selectAll} className={selectedGroup === undefined ? 'selected' : '' }>All participants</li>
{ groupEntries }
{ addModalLauncher }
</ul>
)
}
| Add key property to group list to stop react complaining | Add key property to group list to stop react complaining
| JSX | agpl-3.0 | rabblerouser/core,rabblerouser/core,rabblerouser/core | ---
+++
@@ -4,7 +4,7 @@
import AddGroupModalLauncher from './AddGroupModalLauncher.jsx';
export default ({ groups , selectedGroup, editable, onSave, onSelectGroup}) => {
- let groupEntries = groups.map( group => (<GroupListEntry group={group} onSave={onSave} onSelect={onSelectGroup} />));
+ let groupEntries = groups.map( group => (<GroupListEntry key={group.id} group={group} onSave={onSave} onSelect={onSelectGroup} />));
let addModalLauncher = editable ? <li className="new"><AddGroupModalLauncher onSave={onSave} /></li> : null;
function selectAll() { |
fab692abff96eb032e7a7c58a0e7d996bc7305f5 | client/sections/conversations/components/Rooms.jsx | client/sections/conversations/components/Rooms.jsx | import React from 'react';
import Button from './Button.jsx';
import classNames from 'classnames';
const nameMaker = (users) => {
const last = users.length - 1;
return users
.map(user => `${user.firstName} ${user.lastName}`)
.reduce((names, currName, i) =>
names + (i === last ? ' & ' : ', ') + currName
);
};
const Room = ({ selfId, room, handleRoomChange, roomDeleter, index }) => (
<a href="#" onClick={(e) => handleRoomChange(e, index)}>
<div className="room">
<div className="thread-name">{nameMaker(room.users)}</div>
<Button label='Delete' type='action' clickHandler={(e) => roomDeleter(e, index, selfId, room.id)} />
</div>
</a>
);
// TODO
/* add time last updated?? */
/* display last message text? */
const Rooms = ({ selfId, rooms, handleRoomChange, roomDeleter }) => (
<div className="thread-section">
<div className="thread-list">
{rooms.map((room, i, roomsState) => (
<Room key={i} index={i} room={room} handleRoomChange={handleRoomChange} roomDeleter={roomDeleter} selfId={selfId} />
))}
</div>
</div>
);
export default Rooms;
| import React from 'react';
import Button from './Button.jsx';
import classNames from 'classnames';
const nameMaker = (users) => {
const last = users.length - 1;
return users
.map(user => `${user.firstName} ${user.lastName}`)
.reduce((names, currName, i) =>
names + (i === last ? ' & ' : ', ') + currName
);
};
const Room = ({ selfId, room, handleRoomChange, roomDeleter, index }) => (
<a href="#" onClick={(e) => handleRoomChange(e, index)}>
<div className="room">
<div className="thread-name">{nameMaker(room.users)}</div>
</div>
</a>
);
// TODO
/* add time last updated?? */
/* display last message text? */
const Rooms = ({ selfId, rooms, handleRoomChange, roomDeleter }) => (
<div className="thread-section">
<div className="thread-list">
{rooms.map((room, i, roomsState) => (
<Room key={i} index={i} room={room} handleRoomChange={handleRoomChange} roomDeleter={roomDeleter} selfId={selfId} />
))}
</div>
</div>
);
export default Rooms;
// <Button label='Delete' type='action' clickHandler={(e) => roomDeleter(e, index, selfId, room.id)} />
| Comment out delete button in conversations | Comment out delete button in conversations
| JSX | mit | VictoriousResistance/iDioma,VictoriousResistance/iDioma | ---
+++
@@ -15,7 +15,7 @@
<a href="#" onClick={(e) => handleRoomChange(e, index)}>
<div className="room">
<div className="thread-name">{nameMaker(room.users)}</div>
- <Button label='Delete' type='action' clickHandler={(e) => roomDeleter(e, index, selfId, room.id)} />
+
</div>
</a>
);
@@ -35,3 +35,5 @@
);
export default Rooms;
+
+// <Button label='Delete' type='action' clickHandler={(e) => roomDeleter(e, index, selfId, room.id)} /> |
2917953b488bbb868f821c99998047c55b504086 | imports/ui/Task.jsx | imports/ui/Task.jsx | import React, {Component, PropTypes} from 'react';
// Task component - represents a single todo item
export default class Task extends Component {
render(){
return (
<li>{this.props.task.text}</li>
);
}
}
Task.propTypes = {
// This component gets the task to display through a React prop.
// We can use propTypes to indicate it is required.
task: PropTypes.object.isRequired,
};
| import React, {Component, PropTypes} from 'react';
import { Tasks } from '../api/tasks.js';
// Task component - represents a single todo item
export default class Task extends Component {
toggleChecked() {
// Set the checked property to the opposite of its current value
Tasks.update(this.props.task._id, {
$set: {checked: !this.props.task.checked},
});
}
deleteThisTask() {
Tasks.remove(this.props.task._id);
}
render(){
// Give tasks a different className when they are checked off,
// so that we can style them nicely in css
const taskClassName = this.props.task.checked ? 'checked' : '';
return (
<li className={taskClassName}>
<button className="delete" onClick={this.deleteThisTask.bind(this)}>
×
</button>
<input
type="checkbox"
readOnly
checked={this.props.task.checked}
onClick={this.toggleChecked.bind(this)}
/>
<span className="text">{this.props.task.text}</span>
</li>
);
}
}
Task.propTypes = {
// This component gets the task to display through a React prop.
// We can use propTypes to indicate it is required.
task: PropTypes.object.isRequired,
};
| Add update and delete for tasks | Add update and delete for tasks
| JSX | mit | verdantred/simple-todo,verdantred/simple-todo | ---
+++
@@ -1,10 +1,40 @@
import React, {Component, PropTypes} from 'react';
+
+import { Tasks } from '../api/tasks.js';
// Task component - represents a single todo item
export default class Task extends Component {
+ toggleChecked() {
+ // Set the checked property to the opposite of its current value
+ Tasks.update(this.props.task._id, {
+ $set: {checked: !this.props.task.checked},
+ });
+ }
+
+ deleteThisTask() {
+ Tasks.remove(this.props.task._id);
+ }
+
render(){
+ // Give tasks a different className when they are checked off,
+ // so that we can style them nicely in css
+ const taskClassName = this.props.task.checked ? 'checked' : '';
+
return (
- <li>{this.props.task.text}</li>
+ <li className={taskClassName}>
+ <button className="delete" onClick={this.deleteThisTask.bind(this)}>
+ ×
+ </button>
+
+ <input
+ type="checkbox"
+ readOnly
+ checked={this.props.task.checked}
+ onClick={this.toggleChecked.bind(this)}
+ />
+
+ <span className="text">{this.props.task.text}</span>
+ </li>
);
}
} |
c4b381ce1c058da07d12cade3ffa226b40069414 | app/assets/javascripts/components/search_container.es6.jsx | app/assets/javascripts/components/search_container.es6.jsx | class SearchContainer extends React.Component {
constructor(props) {
super(props)
this.state = { showDropdown: false, term: '', posts: [], users: [], tags: [] }
this.hideDropdown = this.hideDropdown.bind(this);
this.showDropdown = this.showDropdown.bind(this);
}
search(term) {
this.setState({ term });
$.ajax({
url: `/api/autocomplete.json/?term=${term}`,
method: 'GET',
success: (data) => { this.setState({
posts: data.posts,
users: data.users,
tags: data.tags
});}
});
}
hideDropdown() {
this.setState({ showDropdown: false });
}
showDropdown() {
this.setState({ showDropdown: true });
}
render () {
return (
<div>
<SearchBar
onInputFocus={this.showDropdown}
onInputBlur={this.hideDropdown}
term={this.state.term}
onSearchTermChange={(term) => {this.search(term)}}
/>
{this.renderSearchResults()}
</div>
);
}
renderSearchResults() {
if(!this.state.showDropdown || (this.state.posts.length === 0 && this.state.users.length === 0 && this.state.tags.length === 0)) {
return;
}
return (
<SearchResultsList
term={this.state.term}
posts={this.state.posts}
users={this.state.users}
tags={this.state.tags}
/>
);
}
}
| class SearchContainer extends React.Component {
constructor(props) {
super(props)
this.state = { showDropdown: false, term: '', posts: [], users: [], tags: [] }
this.hideDropdown = this.hideDropdown.bind(this);
this.showDropdown = this.showDropdown.bind(this);
}
search(term) {
this.setState({ term });
$.ajax({
url: `/api/autocomplete.json/?term=${term}`,
method: 'GET',
success: (data) => { this.setState({
posts: data.posts,
users: data.users,
tags: data.tags
});}
});
}
hideDropdown() {
setTimeout(() => { this.setState({ showDropdown: false }) }, 250); //FIXME: really hacky workaround.
}
showDropdown() {
this.setState({ showDropdown: true });
}
render () {
return (
<div>
<SearchBar
onInputFocus={this.showDropdown}
onInputBlur={this.hideDropdown}
term={this.state.term}
onSearchTermChange={(term) => {this.search(term)}}
/>
{this.renderSearchResults()}
</div>
);
}
renderSearchResults() {
if(!this.state.showDropdown || (this.state.posts.length === 0 && this.state.users.length === 0 && this.state.tags.length === 0)) {
return;
}
return (
<SearchResultsList
term={this.state.term}
posts={this.state.posts}
users={this.state.users}
tags={this.state.tags}
/>
);
}
}
| Add temporary fix for search result dropdown | Add temporary fix for search result dropdown
| JSX | mit | aamin005/Firdowsspace,dev-warner/Revinyl-Product,kenny-hibino/stories,kenny-hibino/stories,aamin005/Firdowsspace,dev-warner/Revinyl-Product,dev-warner/Revinyl-Product,aamin005/Firdowsspace,kenny-hibino/stories | ---
+++
@@ -22,7 +22,7 @@
}
hideDropdown() {
- this.setState({ showDropdown: false });
+ setTimeout(() => { this.setState({ showDropdown: false }) }, 250); //FIXME: really hacky workaround.
}
showDropdown() { |
e2da0b5250fd990ef870aa06ec0390189abf93e2 | src/components/people-grid/people-grid.jsx | src/components/people-grid/people-grid.jsx | const classNames = require('classnames');
const omit = require('lodash.omit');
const PropTypes = require('prop-types');
const React = require('react');
const Avatar = require('../../components/avatar/avatar.jsx');
require('./people-grid.scss');
const PeopleGrid = props => (
<ul className="avatar-grid">
{props.people.map((person, index) => (
<li
className="avatar-item"
key={`person-${index}`}
>
<div>
{person.userName ? (
<a href={`https://scratch.mit.edu/users/${person.userName}/`}>
<Avatar
alt=""
src={`https://cdn.scratch.mit.edu/get_image/user/${person.userId || 'default'}_80x80.png`}
/>
</a>
) : (
/* if userName is not given, there's no chance userId is given */
<Avatar
alt=""
src={`https://cdn.scratch.mit.edu/get_image/user/default_80x80.png`}
/>
)}
</div>
<span className="avatar-text">
{person.name}
</span>
</li>
))}
</ul>
);
PeopleGrid.propTypes = {
people: PropTypes.arrayOf(PropTypes.shape({
userName: PropTypes.string,
userId: PropTypes.number,
name: PropTypes.string
}))
};
module.exports = PeopleGrid; | const PropTypes = require('prop-types');
const React = require('react');
const Avatar = require('../../components/avatar/avatar.jsx');
require('./people-grid.scss');
const PeopleGrid = props => (
<ul className="avatar-grid">
{props.people.map((person, index) => (
<li
className="avatar-item"
key={`person-${index}`}
>
<div>
{person.userName ? (
<a href={`https://scratch.mit.edu/users/${person.userName}/`}>
<Avatar
alt=""
src={`https://cdn.scratch.mit.edu/get_image/user/${person.userId || 'default'}_80x80.png`}
/>
</a>
) : (
/* if userName is not given, there's no chance userId is given */
<Avatar
alt=""
src={`https://cdn.scratch.mit.edu/get_image/user/default_80x80.png`}
/>
)}
</div>
<span className="avatar-text">
{person.name}
</span>
</li>
))}
</ul>
);
PeopleGrid.propTypes = {
people: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string,
userId: PropTypes.number,
userName: PropTypes.string
}))
};
module.exports = PeopleGrid;
| Fix lint issues in people grid component | Fix lint issues in people grid component
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -1,5 +1,3 @@
-const classNames = require('classnames');
-const omit = require('lodash.omit');
const PropTypes = require('prop-types');
const React = require('react');
const Avatar = require('../../components/avatar/avatar.jsx');
@@ -39,9 +37,9 @@
PeopleGrid.propTypes = {
people: PropTypes.arrayOf(PropTypes.shape({
- userName: PropTypes.string,
- userId: PropTypes.number,
- name: PropTypes.string
+ name: PropTypes.string,
+ userId: PropTypes.number,
+ userName: PropTypes.string
}))
};
|
65c24eb83273fae68548312d92eccc52884d161a | app/assets/javascripts/components/high_order/expandable.jsx | app/assets/javascripts/components/high_order/expandable.jsx | import React from 'react';
import createReactClass from 'create-react-class';
import UIActions from '../../actions/ui_actions.js';
import UIStore from '../../stores/ui_store.js';
const Expandable = function (Component) {
return createReactClass({
displayName: 'Expandable',
mixins: [UIStore.mixin],
getInitialState() {
return { is_open: false };
},
storeDidChange() {
this.setState({
is_open: UIStore.getOpenKey() === this.refs.component.getKey()
});
},
open(e) {
if (e !== null) { e.stopPropagation(); }
return UIActions.open(this.refs.component.getKey());
},
render() {
return (
<Component
{...this.state} {...this.props}
open={this.open}
stop={this.stop}
ref={'component'}
/>
);
}
});
};
export default Expandable;
| import React from 'react';
import createReactClass from 'create-react-class';
import { connect } from 'react-redux';
import { toggleUI, resetUI } from '../../actions';
const mapStateToProps = state => ({
openKey: state.ui.openKey
});
const mapDispatchToProps = {
toggleUI,
resetUI
};
const Expandable = function (Component) {
const wrappedComponent = createReactClass({
displayName: 'Expandable',
componentWillReceiveProps(props) {
this.setState({
is_open: this.refs.component.getKey() === props.openKey
});
},
open(e) {
if (e !== null) { e.stopPropagation(); }
return this.props.toggleUI(this.refs.component.getKey());
},
render() {
return (
<Component
{...this.state} {...this.props}
open={this.open}
stop={this.stop}
ref={'component'}
/>
);
}
});
return connect(mapStateToProps, mapDispatchToProps)(wrappedComponent);
};
export default Expandable;
| Convert Expandable component to redux | Convert Expandable component to redux
| JSX | mit | WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard,sejalkhatri/WikiEduDashboard,alpha721/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,alpha721/WikiEduDashboard,alpha721/WikiEduDashboard | ---
+++
@@ -1,26 +1,30 @@
import React from 'react';
import createReactClass from 'create-react-class';
-import UIActions from '../../actions/ui_actions.js';
-import UIStore from '../../stores/ui_store.js';
+import { connect } from 'react-redux';
+import { toggleUI, resetUI } from '../../actions';
+
+const mapStateToProps = state => ({
+ openKey: state.ui.openKey
+});
+
+const mapDispatchToProps = {
+ toggleUI,
+ resetUI
+};
const Expandable = function (Component) {
- return createReactClass({
+ const wrappedComponent = createReactClass({
displayName: 'Expandable',
- mixins: [UIStore.mixin],
- getInitialState() {
- return { is_open: false };
- },
-
- storeDidChange() {
+ componentWillReceiveProps(props) {
this.setState({
- is_open: UIStore.getOpenKey() === this.refs.component.getKey()
+ is_open: this.refs.component.getKey() === props.openKey
});
},
open(e) {
if (e !== null) { e.stopPropagation(); }
- return UIActions.open(this.refs.component.getKey());
+ return this.props.toggleUI(this.refs.component.getKey());
},
render() {
@@ -34,6 +38,7 @@
);
}
});
+ return connect(mapStateToProps, mapDispatchToProps)(wrappedComponent);
};
export default Expandable; |
70b31884ed01e705b35f6c333f29bc2ef9849023 | src/types/Checkbox.jsx | src/types/Checkbox.jsx | var React = require('react'), FieldMixin = require('../FieldMixin.jsx'), Constants = require('../Constants');
var Checkbox = React.createClass({
mixins: [FieldMixin],
statics: {
inputClassName: Constants.inputClassName
},
render() {
var className = Constants.clz(Checkbox.inputClassName, this.props.editorClass);
return <input onBlur={this.handleValidate} onChange={this.handleChange} id={this.props.name}
className={Checkbox.inputClassName} type="checkbox" value={this.state.value}
data-path={this.props.path}
title={this.props.title} placeholder={this.props.placeholder}/>
}
});
module.exports = Checkbox; | var React = require('react'), FieldMixin = require('../FieldMixin.jsx'), Constants = require('../Constants');
var Checkbox = React.createClass({
mixins: [FieldMixin],
statics: {
inputClassName: Constants.inputClassName
},
doChange:function(e){
this.props.onValueChange(e.target.checked ? this.props.value || true : null, this.state.value || false, this.props.name, this.props.path);
},
render() {
var className = Constants.clz(Checkbox.inputClassName, this.props.editorClass);
return <input onBlur={this.handleValidate} onChange={this.doChange} id={this.props.name}
className={Checkbox.inputClassName} type="checkbox" value={this.state.value}
data-path={this.props.path}
title={this.props.title} placeholder={this.props.placeholder}/>
}
});
module.exports = Checkbox; | Make checkbox true or false if no value is found | Make checkbox true or false if no value is found
| JSX | mit | subschema/subschema,pbarnes/subschema,subschema/subschema,pbarnes/subschema,redbadger/subschema,jspears/subschema,redbadger/subschema,Kikonejacob/subschema,jspears/subschema,bigdrum/subschema,martosource/subschema,martosource/subschema,bigdrum/subschema,jspears/subschema,Kikonejacob/subschema | ---
+++
@@ -6,9 +6,12 @@
statics: {
inputClassName: Constants.inputClassName
},
+ doChange:function(e){
+ this.props.onValueChange(e.target.checked ? this.props.value || true : null, this.state.value || false, this.props.name, this.props.path);
+ },
render() {
var className = Constants.clz(Checkbox.inputClassName, this.props.editorClass);
- return <input onBlur={this.handleValidate} onChange={this.handleChange} id={this.props.name}
+ return <input onBlur={this.handleValidate} onChange={this.doChange} id={this.props.name}
className={Checkbox.inputClassName} type="checkbox" value={this.state.value}
data-path={this.props.path}
title={this.props.title} placeholder={this.props.placeholder}/> |
db900e1f38271d10eadec070f1ed8797fded5609 | public/js/home.jsx | public/js/home.jsx | /* global React */
import SplashExample from './components/splash-example';
export default function init(state) {
var splashProps = Object.assign({}, state.intl, state.examples.splash);
var containerNode = document.querySelector('.splash-example-container');
// Expose React component on its DOM node for testing.
node.component = React.render(
<SplashExample {...splashProps} />,
containerNode
);
}
| /* global React */
import SplashExample from './components/splash-example';
export default function init(state) {
var splashProps = Object.assign({}, state.intl, state.examples.splash);
var containerNode = document.querySelector('.splash-example-container');
// Expose React component on its DOM node for testing.
containerNode.component = React.render(
<SplashExample {...splashProps} />,
containerNode
);
}
| Fix refactor bug in Home init | Fix refactor bug in Home init
| JSX | bsd-3-clause | ericf/formatjs-site,ericf/formatjs-site | ---
+++
@@ -7,7 +7,7 @@
var containerNode = document.querySelector('.splash-example-container');
// Expose React component on its DOM node for testing.
- node.component = React.render(
+ containerNode.component = React.render(
<SplashExample {...splashProps} />,
containerNode
); |
8e186528b73c85b312f0a626252e1eec91f1fa66 | app/assets/javascripts/components/map-select.jsx | app/assets/javascripts/components/map-select.jsx | import PropTypes from 'prop-types'
import SelectMenu from './select-menu.jsx'
const MapSelect = function(props) {
const { selectedMapID, disabled, maps, onChange } = props
const selectedMap = maps.filter(m => m.id === selectedMapID)[0]
return (
<SelectMenu
items={maps}
disabled={disabled}
selectedItemID={selectedMapID}
onChange={val => onChange(val)}
containerClass={() => 'map-select-container'}
menuToggleContents={() => (
<span>
<i
className="fa fa-map-marker"
aria-hidden="true"
/> {selectedMap.name}
</span>
)}
menuItemClass={map => `map-${map.slug}`}
menuItemContent={(map, isSelected) => (
<span className={isSelected ? 'with-selected' : ''}>
{map.name}
</span>
)}
/>
)
}
MapSelect.propTypes = {
disabled: PropTypes.bool.isRequired,
selectedMapID: PropTypes.number.isRequired,
maps: PropTypes.array.isRequired,
onChange: PropTypes.func.isRequired
}
export default MapSelect
| import PropTypes from 'prop-types'
import SelectMenu from './select-menu.jsx'
const MapSelect = function(props) {
const { selectedMapID, disabled, maps, onChange } = props
const selectedMap = maps.filter(m => m.id === selectedMapID)[0]
return (
<SelectMenu
items={maps}
disabled={disabled}
selectedItemID={selectedMapID}
onChange={val => onChange(val)}
containerClass={() => 'map-select-container'}
menuToggleContents={() => (
<span>
<i
className="fa fa-map-marker"
aria-hidden="true"
/> {selectedMap.name}
</span>
)}
menuItemClass={map => `map-${map.slug}`}
menuItemContent={(map, isSelected) => (
<span className={isSelected ? 'with-selected' : ''}>
<span className="css-truncate">{map.name}</span>
</span>
)}
/>
)
}
MapSelect.propTypes = {
disabled: PropTypes.bool.isRequired,
selectedMapID: PropTypes.number.isRequired,
maps: PropTypes.array.isRequired,
onChange: PropTypes.func.isRequired
}
export default MapSelect
| Handle long map names with ellipsis | Handle long map names with ellipsis
| JSX | mit | cheshire137/overwatch-team-comps,cheshire137/overwatch-team-comps,cheshire137/overwatch-team-comps | ---
+++
@@ -24,7 +24,7 @@
menuItemClass={map => `map-${map.slug}`}
menuItemContent={(map, isSelected) => (
<span className={isSelected ? 'with-selected' : ''}>
- {map.name}
+ <span className="css-truncate">{map.name}</span>
</span>
)}
/> |
1def054b2cd29da0d32b2afff58b3de4d49be3cd | webapp/src/components/select/ChartSelect.jsx | webapp/src/components/select/ChartSelect.jsx | import React, {Component, PropTypes} from 'react'
import Dropdown from 'components/select/Select'
import DropdownMenuItem from 'components/dropdown/DropdownMenuItem'
class ChartSelect extends Component {
static propTypes = {
charts: React.PropTypes.array.isRequired,
selected: React.PropTypes.object.isRequired,
selectChart: React.PropTypes.func.isRequired
}
static defaultProps = {
charts: [],
selected: {'title': 'Select existing chart'}
}
render () {
const charts = this.props.charts || []
const chart_menu_items = charts.map(chart =>
<DropdownMenuItem
key={'chart-' + chart.id}
text={chart.title}
onClick={() => this.props.selectChart(chart)}
classes='chart'
/>
)
return (
<Dropdown
className='font-weight-600 chart-selector'
icon='fa-chevron-down'
text={this.props.selected.title}>
{chart_menu_items}
</Dropdown>
)
}
}
export default ChartSelect
| import React, {Component, PropTypes} from 'react'
import Select from 'components/select/Select'
import DropdownMenuItem from 'components/dropdown/DropdownMenuItem'
class ChartSelect extends Component {
constructor (props) {
super(props)
this.state = {
pattern: ''
}
}
static propTypes = {
charts: React.PropTypes.array.isRequired,
selected: React.PropTypes.object.isRequired,
selectChart: React.PropTypes.func.isRequired
}
static defaultProps = {
charts: [],
selected: {'title': 'Select existing chart'}
}
setPattern = (value) => {
this.setState({ pattern: value })
this.forceUpdate()
}
render () {
const charts = this.props.charts || []
const pattern = this.state.pattern
const filtered_charts = pattern.length > 2 ? charts.filter(chart => new RegExp(pattern, 'i').test(chart.title)) : charts
const chart_menu_items = filtered_charts.map(chart =>
<DropdownMenuItem
key={'chart-' + chart.id}
text={chart.title}
onClick={() => this.props.selectChart(chart)}
classes='chart'
/>
)
return (
<Select
className='font-weight-600 chart-selector'
icon='fa-chevron-down'
text={this.props.selected.title}
searchable
onSearch={this.setPattern}>
{chart_menu_items}
</Select>
)
}
}
export default ChartSelect
| Add search functionality to chart selector | Add search functionality to chart selector
| JSX | agpl-3.0 | unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome | ---
+++
@@ -1,9 +1,16 @@
import React, {Component, PropTypes} from 'react'
-import Dropdown from 'components/select/Select'
+import Select from 'components/select/Select'
import DropdownMenuItem from 'components/dropdown/DropdownMenuItem'
class ChartSelect extends Component {
+
+ constructor (props) {
+ super(props)
+ this.state = {
+ pattern: ''
+ }
+ }
static propTypes = {
charts: React.PropTypes.array.isRequired,
@@ -16,9 +23,16 @@
selected: {'title': 'Select existing chart'}
}
+ setPattern = (value) => {
+ this.setState({ pattern: value })
+ this.forceUpdate()
+ }
+
render () {
const charts = this.props.charts || []
- const chart_menu_items = charts.map(chart =>
+ const pattern = this.state.pattern
+ const filtered_charts = pattern.length > 2 ? charts.filter(chart => new RegExp(pattern, 'i').test(chart.title)) : charts
+ const chart_menu_items = filtered_charts.map(chart =>
<DropdownMenuItem
key={'chart-' + chart.id}
text={chart.title}
@@ -28,12 +42,14 @@
)
return (
- <Dropdown
+ <Select
className='font-weight-600 chart-selector'
icon='fa-chevron-down'
- text={this.props.selected.title}>
+ text={this.props.selected.title}
+ searchable
+ onSearch={this.setPattern}>
{chart_menu_items}
- </Dropdown>
+ </Select>
)
}
} |
508203a69159e16bc8200bfd34bc178e00ca61cd | app/components/add-item/index.jsx | app/components/add-item/index.jsx | require("./add-item.styl")
import React from "react"
import {Button} from "react-bootstrap"
const ENTER_KEYCODE = 13;
export default class AddItem extends React.Component {
constructor() {
this.state = {
newItem: ""
}
}
updateNewItem(event) {
this.setState({
newItem: event.target.value
})
}
handleAddNew() {
let {newItem} = this.state; //let newItem = this.state.newItem;
if (newItem.length === 0) {
return
}
this.props.addNew(newItem)
this.setState({
newItem: ""
})
}
handleKeyUp(event) {
event.preventDefault();
if (event.keyCode === ENTER_KEYCODE) {
this.handleAddNew()
}
}
render() {
return <div>
<input
type="text" value={this.state.newItem}
onChange={this.updateNewItem.bind(this)}
onKeyUp={this.handleKeyUp.bind(this)}
/>
<Button onClick={this.props.handleNextDay}>Done</Button>
<Button onClick={this.props.revealActual}>Reveal</Button>
</div>
}
}
| require("./add-item.styl")
import React from "react"
import {Button} from "react-bootstrap"
const ENTER_KEYCODE = 13;
export default class AddItem extends React.Component {
constructor() {
this.state = {
newItem: ""
}
}
updateNewItem(event) {
this.setState({
newItem: event.target.value
})
}
handleAddNew() {
let {newItem} = this.state; //let newItem = this.state.newItem;
if (newItem.length === 0) {
return
}
this.props.addNew(newItem)
this.setState({
newItem: ""
})
}
handleKeyUp(event) {
event.preventDefault();
if (event.keyCode === ENTER_KEYCODE) {
this.handleAddNew()
}
}
render() {
return <div>
<input
type="text" value={this.state.newItem}
onChange={this.updateNewItem.bind(this)}
onKeyUp={this.handleKeyUp.bind(this)} />
</div>
}
}
| Resolve conflict between local and master | Resolve conflict between local and master
| JSX | unlicense | babadoozep/ema,babadoozep/ema | ---
+++
@@ -45,11 +45,7 @@
<input
type="text" value={this.state.newItem}
onChange={this.updateNewItem.bind(this)}
- onKeyUp={this.handleKeyUp.bind(this)}
- />
-
- <Button onClick={this.props.handleNextDay}>Done</Button>
- <Button onClick={this.props.revealActual}>Reveal</Button>
+ onKeyUp={this.handleKeyUp.bind(this)} />
</div>
}
} |
13e47c67eea01a0a0ff58b45f94688cc8f8f10da | indico/modules/rb/client/js/common/timeline/TimelineHeader.jsx | indico/modules/rb/client/js/common/timeline/TimelineHeader.jsx | // This file is part of Indico.
// Copyright (C) 2002 - 2019 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.
import React from 'react';
import PropTypes from 'prop-types';
import TimelineLegend from './TimelineLegend';
import {legendLabelShape} from '../../props';
import DateNavigator from './DateNavigator';
export default class TimelineHeader extends React.Component {
static propTypes = {
datePicker: PropTypes.object.isRequired,
legendLabels: PropTypes.arrayOf(legendLabelShape).isRequired,
onDateChange: PropTypes.func.isRequired,
onModeChange: PropTypes.func.isRequired,
disableDatePicker: PropTypes.bool,
isLoading: PropTypes.bool,
};
static defaultProps = {
isLoading: false,
disableDatePicker: false,
};
render() {
const {
disableDatePicker,
isLoading,
legendLabels,
onModeChange,
onDateChange,
datePicker,
} = this.props;
return (
<TimelineLegend
labels={legendLabels}
aside={
<DateNavigator
{...datePicker}
isLoading={isLoading}
disabled={disableDatePicker || isLoading}
onDateChange={onDateChange}
onModeChange={onModeChange}
/>
}
/>
);
}
}
| // This file is part of Indico.
// Copyright (C) 2002 - 2019 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.
import React from 'react';
import PropTypes from 'prop-types';
import {useResponsive} from 'indico/react/util';
import TimelineLegend from './TimelineLegend';
import {legendLabelShape} from '../../props';
import DateNavigator from './DateNavigator';
export default function TimelineHeader({
datePicker,
legendLabels,
onDateChange,
onModeChange,
disableDatePicker,
isLoading,
}) {
const {isPhone, isLandscape} = useResponsive();
return (
!isPhone &&
isLandscape && (
<TimelineLegend
labels={legendLabels}
aside={
<DateNavigator
{...datePicker}
isLoading={isLoading}
disabled={disableDatePicker || isLoading}
onDateChange={onDateChange}
onModeChange={onModeChange}
/>
}
/>
)
);
}
TimelineHeader.propTypes = {
datePicker: PropTypes.object.isRequired,
legendLabels: PropTypes.arrayOf(legendLabelShape).isRequired,
onDateChange: PropTypes.func.isRequired,
onModeChange: PropTypes.func.isRequired,
disableDatePicker: PropTypes.bool,
isLoading: PropTypes.bool,
};
TimelineHeader.defaultProps = {
isLoading: false,
disableDatePicker: false,
};
| Hide timeline header on mobile and portrait mode | Hide timeline header on mobile and portrait mode
| JSX | mit | mvidalgarcia/indico,ThiefMaster/indico,DirkHoffmann/indico,DirkHoffmann/indico,mic4ael/indico,OmeGak/indico,mvidalgarcia/indico,OmeGak/indico,pferreir/indico,OmeGak/indico,mic4ael/indico,pferreir/indico,ThiefMaster/indico,ThiefMaster/indico,mvidalgarcia/indico,pferreir/indico,mvidalgarcia/indico,indico/indico,indico/indico,mic4ael/indico,OmeGak/indico,DirkHoffmann/indico,mic4ael/indico,DirkHoffmann/indico,ThiefMaster/indico,indico/indico,indico/indico,pferreir/indico | ---
+++
@@ -7,35 +7,23 @@
import React from 'react';
import PropTypes from 'prop-types';
+import {useResponsive} from 'indico/react/util';
import TimelineLegend from './TimelineLegend';
import {legendLabelShape} from '../../props';
import DateNavigator from './DateNavigator';
-export default class TimelineHeader extends React.Component {
- static propTypes = {
- datePicker: PropTypes.object.isRequired,
- legendLabels: PropTypes.arrayOf(legendLabelShape).isRequired,
- onDateChange: PropTypes.func.isRequired,
- onModeChange: PropTypes.func.isRequired,
- disableDatePicker: PropTypes.bool,
- isLoading: PropTypes.bool,
- };
-
- static defaultProps = {
- isLoading: false,
- disableDatePicker: false,
- };
-
- render() {
- const {
- disableDatePicker,
- isLoading,
- legendLabels,
- onModeChange,
- onDateChange,
- datePicker,
- } = this.props;
- return (
+export default function TimelineHeader({
+ datePicker,
+ legendLabels,
+ onDateChange,
+ onModeChange,
+ disableDatePicker,
+ isLoading,
+}) {
+ const {isPhone, isLandscape} = useResponsive();
+ return (
+ !isPhone &&
+ isLandscape && (
<TimelineLegend
labels={legendLabels}
aside={
@@ -48,6 +36,20 @@
/>
}
/>
- );
- }
+ )
+ );
}
+
+TimelineHeader.propTypes = {
+ datePicker: PropTypes.object.isRequired,
+ legendLabels: PropTypes.arrayOf(legendLabelShape).isRequired,
+ onDateChange: PropTypes.func.isRequired,
+ onModeChange: PropTypes.func.isRequired,
+ disableDatePicker: PropTypes.bool,
+ isLoading: PropTypes.bool,
+};
+
+TimelineHeader.defaultProps = {
+ isLoading: false,
+ disableDatePicker: false,
+}; |
4f05336c4e428fd04c3594399d1bbd48215625ea | src/todos/components/todoInput.jsx | src/todos/components/todoInput.jsx | import React from 'react';
var ReactPropTypes = React.PropTypes;
import './todoInput.less';
const RETURN_KEY_CODE = 13;
export default class TodoInput extends React.Component {
constructor(props) {
super(props);
this.state = {
value: props.value || '',
};
}
create() {
this.props.createHandler(this.state.value);
this.setState({value: ''});
}
onChange(ev) {
this.setState({
value: ev.target.value,
});
}
onKeyDown(ev) {
if (ev.keyCode === RETURN_KEY_CODE) {
this.create();
}
}
render() {
var className = ('form-control ' + (this.props.className || '')).trim();
return (
<div className="todo-input">
<input
type="text"
className={className}
value={this.state.value}
onBlur={this.create.bind(this)}
onChange={this.onChange.bind(this)}
onKeyDown={this.onKeyDown.bind(this)}
placeholder={this.props.placeholder}
autoFocus={true}
/>
<button onClick={this.create.bind(this)} className="btn btn-info">save</button>
</div>
);
}
}
TodoInput.propTypes = {
createHandler: ReactPropTypes.func.isRequired,
className: ReactPropTypes.string,
value: ReactPropTypes.string,
placeholder: ReactPropTypes.string,
};
| import {default as React,
PropTypes as ReactPropTypes} from 'react';
import './todoInput.less';
const RETURN_KEY_CODE = 13;
export default class TodoInput extends React.Component {
constructor(props) {
super(props);
this.state = {
value: props.value || '',
};
}
create() {
this.props.createHandler(this.state.value);
this.setState({value: ''});
}
onChange(ev) {
this.setState({
value: ev.target.value,
});
}
onKeyDown(ev) {
if (ev.keyCode === RETURN_KEY_CODE) {
this.create();
}
}
render() {
var className = ('form-control ' + (this.props.className || '')).trim();
return (
<div className="todo-input">
<input
type="text"
className={className}
value={this.state.value}
onBlur={this.create.bind(this)}
onChange={this.onChange.bind(this)}
onKeyDown={this.onKeyDown.bind(this)}
placeholder={this.props.placeholder}
autoFocus={true}
/>
<button onClick={this.create.bind(this)} className="btn btn-info">save</button>
</div>
);
}
}
TodoInput.propTypes = {
createHandler: ReactPropTypes.func.isRequired,
className: ReactPropTypes.string,
value: ReactPropTypes.string,
placeholder: ReactPropTypes.string,
};
| Refactor code to use `import` keyword only | Refactor code to use `import` keyword only
| JSX | mit | yejodido/webpack-todomvc,yejodido/webpack-todomvc | ---
+++
@@ -1,5 +1,5 @@
-import React from 'react';
-var ReactPropTypes = React.PropTypes;
+import {default as React,
+ PropTypes as ReactPropTypes} from 'react';
import './todoInput.less';
|
a0ff894802a132b0e2755f910b92a8b26cee9919 | src/form.jsx | src/form.jsx | var React = require("react");
var Form = React.createClass({
getInitialState: function() {
return {
url: ""
};
},
handleSubmit: function(e) {
e.preventDefault();
if (this.state.url == "") {
return;
}
Store.create(this.state.url);
this.setState({
url: "",
error: ""
});
},
handleChange: function(e) {
var word = e.target.value.trim();
this.props.onChange(word.toLowerCase());
this.setState({
url: word
});
},
render: function() {
return (
<form onSubmit={this.handleSubmit}>
<div className="form-group">
<input type="url" onChange={this.handleChange} className="form-control" value={this.state.url} placeholder="ほしいものリストのURL" />
</div>
</form>
)
},
});
module.exports = Form;
| var React = require("react");
var Store = require("./store.js");
var Form = React.createClass({
getInitialState: function() {
return {
url: ""
};
},
handleSubmit: function(e) {
e.preventDefault();
if (this.state.url == "") {
return;
}
Store.create(this.state.url);
this.setState({
url: "",
error: ""
});
},
handleChange: function(e) {
var word = e.target.value.trim();
this.props.onChange(word.toLowerCase());
this.setState({
url: word
});
},
render: function() {
return (
<form onSubmit={this.handleSubmit}>
<div className="form-group">
<input type="url" onChange={this.handleChange} className="form-control" value={this.state.url} placeholder="ほしいものリストのURL" />
</div>
</form>
)
},
});
module.exports = Form;
| Fix bug that From requires Store | Fix bug that From requires Store
| JSX | mit | Sixeight/iwai,Sixeight/iwai,Sixeight/iwai | ---
+++
@@ -1,4 +1,5 @@
var React = require("react");
+var Store = require("./store.js");
var Form = React.createClass({
getInitialState: function() { |
834f252f3262e2c86d3e9f2e84aa4c66a53a793b | src/components/Navigation.jsx | src/components/Navigation.jsx | import React from 'react';
import { Link } from 'react-router';
export default class Navigation extends React.Component {
render() {
return (
<div>
<h1>{this.props.appName}</h1>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/page/0">Page 0</Link></li>
<li><Link to="/page/1">Page 1</Link></li>
<li><Link to="/page/2">Page 2</Link></li>
<li><Link to="/article/1">Article 1</Link></li>
</ul>
</div>
)
}
}
| import React from 'react';
import { Link } from 'react-router';
export default class Navigation extends React.Component {
render() {
return (
<div>
<h1>{this.props.appName}</h1>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/page/0">Page 0</Link></li>
<li><Link to="/page/1">Page 1</Link></li>
<li><Link to="/page/2">Page 2</Link></li>
<li><Link to="/article/0">Article 1</Link></li>
</ul>
</div>
)
}
}
| Fix Falcor cache article indexing bug | Fix Falcor cache article indexing bug
| JSX | mit | thegazelle-ad/gazelle-server,thegazelle-ad/gazelle-server,thegazelle-ad/gazelle-front-end,thegazelle-ad/gazelle-front-end,thegazelle-ad/gazelle-server,thegazelle-ad/gazelle-server,thegazelle-ad/gazelle-server | ---
+++
@@ -11,7 +11,7 @@
<li><Link to="/page/0">Page 0</Link></li>
<li><Link to="/page/1">Page 1</Link></li>
<li><Link to="/page/2">Page 2</Link></li>
- <li><Link to="/article/1">Article 1</Link></li>
+ <li><Link to="/article/0">Article 1</Link></li>
</ul>
</div>
) |
599f5757bca438129f10c3ab9d8353ea48455ebe | src/components/query.jsx | src/components/query.jsx | import React, { Component, PropTypes } from 'react';
import hoistStatics from 'hoist-non-react-statics';
import { resolveComponentsQueries } from '../query';
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
export default function query(queries) {
return function wrapWithQuery(WrappedComponent) {
class Query extends Component {
componentWillMount() {
const { mergeResolvedQueries } = this.context;
const { routes } = this.props;
resolveComponentsQueries(
routes[0],
routes.map(r => r.component)
).then((resolvedQueries) => {
console.info('resolved queries', resolvedQueries);
mergeResolvedQueries(resolvedQueries);
});
}
render() {
const props = this.props;
const resolvedQuery = this.context.resolvedQueries.get(Query);
if (!resolvedQuery) {
return <div>Loading...</div>;
}
return <WrappedComponent {...props} {...resolvedQuery} />;
}
}
Query.displayName = `Query(${getDisplayName(WrappedComponent)})`;
Query.contextTypes = {
resolvedQueries: PropTypes.instanceOf(Map).isRequired,
mergeResolvedQueries: PropTypes.func.isRequired,
};
Query.propTypes = {
routes: PropTypes.array.isRequired,
};
Query.nucleateQuery = queries;
hoistStatics(Query, WrappedComponent);
return Query;
};
}
| import React, { Component, PropTypes } from 'react';
import hoistStatics from 'hoist-non-react-statics';
import { resolveComponentsQueries } from '../query';
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
export default function query(queries) {
return function wrapWithQuery(WrappedComponent) {
class Query extends Component {
componentWillMount() {
const { mergeResolvedQueries } = this.context;
const { routes } = this.props;
resolveComponentsQueries(
routes[0],
routes.map(r => r.component)
).then((resolvedQueries) => {
mergeResolvedQueries(resolvedQueries);
});
}
render() {
const props = this.props;
const resolvedQuery = this.context.resolvedQueries.get(Query);
if (!resolvedQuery) {
return <div>Loading...</div>;
}
return <WrappedComponent {...props} {...resolvedQuery} />;
}
}
Query.displayName = `Query(${getDisplayName(WrappedComponent)})`;
Query.contextTypes = {
resolvedQueries: PropTypes.instanceOf(Map).isRequired,
mergeResolvedQueries: PropTypes.func.isRequired,
};
Query.propTypes = {
routes: PropTypes.array.isRequired,
};
Query.nucleateQuery = queries;
hoistStatics(Query, WrappedComponent);
return Query;
};
}
| Remove console.info when resolving queries | Remove console.info when resolving queries
| JSX | mit | nucleate/nucleate | ---
+++
@@ -16,7 +16,6 @@
routes[0],
routes.map(r => r.component)
).then((resolvedQueries) => {
- console.info('resolved queries', resolvedQueries);
mergeResolvedQueries(resolvedQueries);
});
} |
1517c44d9ee823cc16f5759a5073cdeb20dc25ae | src/components/group-settings.jsx | src/components/group-settings.jsx | import React from 'react'
import {connect} from 'react-redux'
import _ from 'lodash'
import {updateGroup} from '../redux/action-creators'
import GroupSettingsForm from './group-settings-form'
const GroupSettings = (props) => (
<div className="content">
<div className="box">
<div className="box-header-timeline">
Settings
</div>
<div className="box-body">
<GroupSettingsForm
group={props.group}
updateGroup={props.updateGroup}
{...props.groupSettingsForm}/>
</div>
</div>
</div>
)
function mapStateToProps(state) {
return {
group: (_.find(state.users, { 'username': state.router.params.userName }) || {}),
groupSettingsForm: state.groupSettingsForm
}
}
function mapDispatchToProps(dispatch) {
return {
updateGroup: (...args) => dispatch(updateGroup(...args))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(GroupSettings)
| import React from 'react'
import {Link} from 'react-router'
import {connect} from 'react-redux'
import _ from 'lodash'
import {updateGroup} from '../redux/action-creators'
import GroupSettingsForm from './group-settings-form'
const GroupSettings = (props) => (
<div className="content">
<div className="box">
<div className="box-header-timeline">
<Link to={`/${props.group.username}`}>{props.group.username}</Link>: group settings
</div>
<div className="box-body">
<GroupSettingsForm
group={props.group}
updateGroup={props.updateGroup}
{...props.groupSettingsForm}/>
</div>
</div>
</div>
)
function mapStateToProps(state) {
return {
group: (_.find(state.users, { 'username': state.router.params.userName }) || {}),
groupSettingsForm: state.groupSettingsForm
}
}
function mapDispatchToProps(dispatch) {
return {
updateGroup: (...args) => dispatch(updateGroup(...args))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(GroupSettings)
| Add a link back to the group page | [group-descriptions] Add a link back to the group page
| JSX | mit | kadmil/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-html-react,ujenjt/freefeed-react-client,ujenjt/freefeed-react-client,clbn/freefeed-gamma,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-html-react,kadmil/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,ujenjt/freefeed-react-client,kadmil/freefeed-react-client,FreeFeed/freefeed-html-react,clbn/freefeed-gamma,clbn/freefeed-gamma | ---
+++
@@ -1,4 +1,5 @@
import React from 'react'
+import {Link} from 'react-router'
import {connect} from 'react-redux'
import _ from 'lodash'
@@ -9,7 +10,7 @@
<div className="content">
<div className="box">
<div className="box-header-timeline">
- Settings
+ <Link to={`/${props.group.username}`}>{props.group.username}</Link>: group settings
</div>
<div className="box-body">
<GroupSettingsForm |
65248ef36bcff9b1e3a3f56eeaadcd148263a07f | client/js/app.jsx | client/js/app.jsx | "use strict";
import React from 'react';
import ReactDOM from 'react-dom';
import Router from 'react-router';
import Routes from './routes';
import SettingsAction from './actions/settings';
import history from './history';
//Needed for onTouchTap
//Can go away when react 1.0 release
//Check this repo:
//https://github.com/zilverline/react-tap-event-plugin
import injectTapEventPlugin from "react-tap-event-plugin";
injectTapEventPlugin();
// Set a device type based on window width, so that we can write media queries in javascript
// by calling if (this.props.deviceType === "mobile")
var deviceType;
if (window.matchMedia("(max-width: 639px)").matches){
deviceType = "mobile";
} else if (window.matchMedia("(max-width: 768px)").matches){
deviceType = "tablet";
} else {
deviceType = "desktop";
}
// Initialize store singletons
SettingsAction.load(window.DEFAULT_SETTINGS);
ReactDOM.render((<Router history={history}>{Routes}</Router>), document.getElementById("main")); | "use strict";
import React from 'react';
import ReactDOM from 'react-dom';
import Router from 'react-router';
import Routes from './routes';
import SettingsAction from './actions/settings';
import history from './history';
// Initialize store singletons
SettingsAction.load(window.DEFAULT_SETTINGS);
ReactDOM.render((<Router history={history}>{Routes}</Router>), document.getElementById("main")); | Remove the rest of material ui | Remove the rest of material ui
| JSX | mit | atomicjolt/adhesion,atomicjolt/react_starter_app,atomicjolt/react_rails_starter_app,atomicjolt/react_rails_starter_app,atomicjolt/adhesion,atomicjolt/react_rails_starter_app,atomicjolt/adhesion,atomicjolt/lti_starter_app,atomicjolt/react_starter_app,atomicjolt/lti_starter_app,atomicjolt/lti_starter_app,atomicjolt/react_starter_app,atomicjolt/lti_starter_app,atomicjolt/adhesion,atomicjolt/react_rails_starter_app,atomicjolt/react_starter_app | ---
+++
@@ -7,26 +7,6 @@
import SettingsAction from './actions/settings';
import history from './history';
-//Needed for onTouchTap
-//Can go away when react 1.0 release
-//Check this repo:
-//https://github.com/zilverline/react-tap-event-plugin
-import injectTapEventPlugin from "react-tap-event-plugin";
-injectTapEventPlugin();
-
-
-// Set a device type based on window width, so that we can write media queries in javascript
-// by calling if (this.props.deviceType === "mobile")
-var deviceType;
-
-if (window.matchMedia("(max-width: 639px)").matches){
- deviceType = "mobile";
-} else if (window.matchMedia("(max-width: 768px)").matches){
- deviceType = "tablet";
-} else {
- deviceType = "desktop";
-}
-
// Initialize store singletons
SettingsAction.load(window.DEFAULT_SETTINGS);
|
ed624a1b5d594d58814159ec7bc84616308dff69 | ui/component/claimInsufficientCredits/view.jsx | ui/component/claimInsufficientCredits/view.jsx | // @flow
import * as React from 'react';
import Button from 'component/button';
import I18nMessage from 'component/i18nMessage';
type Props = {
uri: string,
fileInfo: FileListItem,
isInsufficientCredits: boolean,
claimWasPurchased: boolean,
};
function ClaimInsufficientCredits(props: Props) {
const { isInsufficientCredits, fileInfo, claimWasPurchased } = props;
if (fileInfo || !isInsufficientCredits || claimWasPurchased) {
return null;
}
return (
<div className="media__insufficient-credits help--warning">
<I18nMessage
tokens={{
reward_link: <Button button="link" navigate="/$/rewards" label={__('Rewards')} />,
buy_link: <Button button="link" navigate="/$/rewards" label={__('buy')} />,
}}
>
The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it. Check
out %reward_link% for free LBC or send more LBC to your wallet. You can also %buy_link% more LBC.
</I18nMessage>
</div>
);
}
export default ClaimInsufficientCredits;
| // @flow
import * as React from 'react';
import Button from 'component/button';
import I18nMessage from 'component/i18nMessage';
type Props = {
uri: string,
fileInfo: FileListItem,
isInsufficientCredits: boolean,
claimWasPurchased: boolean,
};
function ClaimInsufficientCredits(props: Props) {
const { isInsufficientCredits, fileInfo, claimWasPurchased } = props;
if (fileInfo || !isInsufficientCredits || claimWasPurchased) {
return null;
}
return (
<div className="media__insufficient-credits help--warning">
<I18nMessage
tokens={{
reward_link: <Button button="link" navigate="/$/rewards" label={__('Rewards')} />,
buy_link: <Button button="link" navigate="/$/buy" label={__('buy')} />,
}}
>
The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it. Check
out %reward_link% for free LBC or send more LBC to your wallet. You can also %buy_link% more LBC.
</I18nMessage>
</div>
);
}
export default ClaimInsufficientCredits;
| Correct link to buy page | Correct link to buy page | JSX | mit | lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron | ---
+++
@@ -22,7 +22,7 @@
<I18nMessage
tokens={{
reward_link: <Button button="link" navigate="/$/rewards" label={__('Rewards')} />,
- buy_link: <Button button="link" navigate="/$/rewards" label={__('buy')} />,
+ buy_link: <Button button="link" navigate="/$/buy" label={__('buy')} />,
}}
>
The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it. Check |
40706b1eaa409ba3d4945d71574d7e16929a9d98 | ui/src/components/DocumentScreen/viewers/PdfViewer.jsx | ui/src/components/DocumentScreen/viewers/PdfViewer.jsx | import React, { Component } from 'react';
import { Document, Page } from 'react-pdf/build/entry.webpack';
import { findLast } from 'lodash';
import { parse as parsePdfFragId } from 'src/util/pdfFragId';
import './PdfViewer.css';
class PdfViewer extends Component {
constructor(props) {
super(props);
this.state = {};
}
onDocumentLoad(pdfInfo) {
this.setState({
numPages: pdfInfo.numPages
});
}
render() {
const { url, fragId } = this.props;
const { numPages } = this.state;
let pageNumber = getPageNumber(fragId);
if (pageNumber === undefined) pageNumber = 1;
return (
<div className="PdfViewer">
<Document file={url} onLoadSuccess={this.onDocumentLoad.bind(this)}>
<Page
pageNumber={pageNumber}
className="page"
/>
</Document>
</div>
);
}
}
export default PdfViewer;
function getPageNumber(fragId) {
const pageParameter = findLast(
parsePdfFragId(fragId),
{ parameter: 'page' },
);
return pageParameter && pageParameter.pagenum;
}
| import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Document, Page } from 'react-pdf/build/entry.webpack';
import { findLast } from 'lodash';
import { parse as parsePdfFragId } from 'src/util/pdfFragId';
import './PdfViewer.css';
class PdfViewer extends Component {
constructor(props) {
super(props);
this.state = {};
}
onDocumentLoad(pdfInfo) {
this.setState({
numPages: pdfInfo.numPages
});
}
render() {
const { url, fragId } = this.props;
const { numPages } = this.state;
let pageNumber = getPageNumber(fragId);
if (pageNumber === undefined) pageNumber = 1;
return (
<div className="PdfViewer">
{(pageNumber > 1) &&
<Link to={{ hash: `page=${pageNumber-1}` }}>Previous</Link>
}
{(pageNumber < numPages) &&
<Link to={{ hash: `page=${pageNumber+1}` }}>Next</Link>
}
<Document file={url} onLoadSuccess={this.onDocumentLoad.bind(this)}>
<Page
pageNumber={pageNumber}
className="page"
/>
</Document>
</div>
);
}
}
export default PdfViewer;
function getPageNumber(fragId) {
const pageParameter = findLast(
parsePdfFragId(fragId),
{ parameter: 'page' },
);
return pageParameter && pageParameter.pagenum;
}
| Add links to prev/next page. | Add links to prev/next page.
| JSX | mit | alephdata/aleph,pudo/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph | ---
+++
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
import { Document, Page } from 'react-pdf/build/entry.webpack';
import { findLast } from 'lodash';
@@ -27,6 +28,12 @@
return (
<div className="PdfViewer">
+ {(pageNumber > 1) &&
+ <Link to={{ hash: `page=${pageNumber-1}` }}>Previous</Link>
+ }
+ {(pageNumber < numPages) &&
+ <Link to={{ hash: `page=${pageNumber+1}` }}>Next</Link>
+ }
<Document file={url} onLoadSuccess={this.onDocumentLoad.bind(this)}>
<Page
pageNumber={pageNumber} |
11d1ab3641a544a6df9be33c302db0f33bc2faab | src/containers/ComicListContainer.jsx | src/containers/ComicListContainer.jsx | import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import ComicList from '../components/ComicList'
import * as Actions from '../actions'
class ComicListContainer extends React.Component {
static propTypes = {
filter: PropTypes.object.isRequired,
comics: PropTypes.array.isRequired,
shrink: PropTypes.bool.isRequired
}
componentDidMount() {
this.props.dispatch(Actions.fetchComicsIfNeeded())
}
filterComics = () => {
let { filter, comics } = this.props
switch (filter.category) {
case 'SHOW_FAVORITE':
comics = comics.filter(comic => comic.favorite)
break
}
let reg
try {
reg = new RegExp(filter.query || '.+', 'i')
} catch (err) {
return []
}
return comics.filter(comic =>
reg.test(comic.title)
)
}
render() {
return (
<ComicList comics={ this.filterComics() } shrink={this.props.shrink} />
)
}
}
const mapStateToProps = (state) => {
return {
filter: state.filter,
comics: state.comic.comics
}
}
export default connect(
mapStateToProps
)(ComicListContainer)
| import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import ComicList from '../components/ComicList'
import * as Actions from '../actions'
class ComicListContainer extends React.Component {
static propTypes = {
filter: PropTypes.object.isRequired,
comics: PropTypes.array.isRequired,
shrink: PropTypes.bool.isRequired
}
componentDidMount() {
if (!this.props.comics || this.props.comics.length === 0) {
this.props.dispatch(Actions.fetchComicsIfNeeded())
}
}
filterComics = () => {
let { filter, comics } = this.props
switch (filter.category) {
case 'SHOW_FAVORITE':
comics = comics.filter(comic => comic.favorite)
break
}
let reg
try {
reg = new RegExp(filter.query || '.+', 'i')
} catch (err) {
return []
}
return comics.filter(comic =>
reg.test(comic.title)
)
}
render() {
return (
<ComicList comics={ this.filterComics() } shrink={this.props.shrink} />
)
}
}
const mapStateToProps = (state) => {
return {
filter: state.filter,
comics: state.comic.comics
}
}
export default connect(
mapStateToProps
)(ComicListContainer)
| Fix unexpected comics state reset after navigating from ComicViewer to ComicList | Fix unexpected comics state reset after navigating from ComicViewer to ComicList
| JSX | mit | rickychien/comiz,rickychien/comiz | ---
+++
@@ -14,7 +14,9 @@
}
componentDidMount() {
- this.props.dispatch(Actions.fetchComicsIfNeeded())
+ if (!this.props.comics || this.props.comics.length === 0) {
+ this.props.dispatch(Actions.fetchComicsIfNeeded())
+ }
}
filterComics = () => { |
909f00d4cbe2890ad201a32083a42baa946881fc | imports/ui/Location.jsx | imports/ui/Location.jsx | import React, { Component, PropTypes } from 'react';
import { Locations } from '../api/locations.js';
// Location component - represents a single location item
export default class Location extends Component {
toggleChecked() {
Locations.update(this.props.location._id, {
$set: { checked: !this.props.location.checked },
});
}
deleteThisLocation() {
console.log('Locations: ', Locations);
console.log('this: ', this);
Locations.remove(this.props.location._id);
}
render() {
const locationClassName = this.props.location.checked ? 'checked' : '';
return (
<li className={locationClassName}>
<button className="delete" onClick={this.deleteThisLocation.bind(this)}>
×
</button>
<input
type="checkbox"
readOnly
checked={this.props.location.checked}
onClick={this.toggleChecked.bind(this)}
/>
<span className="text">
<strong>{this.props.location.username}</strong>: {this.props.location.text}
</span>
</li>
);
}
}
Location.propTypes = {
// This component gets the location to display through a React prop.
// We can use propTypes to indicate it is required
location: PropTypes.object.isRequired,
};
| import React, { Component, PropTypes } from 'react';
import { Locations } from '../api/locations.js';
// Location component - represents a single location item
export default class Location extends Component {
toggleChecked() {
Locations.update(this.props.location._id, {
$set: { checked: !this.props.location.checked },
});
}
deleteThisLocation() {
console.log('Locations: ', Locations);
console.log('this: ', this);
Locations.remove(this.props.location._id);
}
render() {
const locationClassName = this.props.location.checked ? 'checked' : '';
return (
<li className={locationClassName}>
<button className="delete" onClick={this.deleteThisLocation.bind(this)}>
×
</button>
<input
type="checkbox"
readOnly
checked={this.props.location.checked}
onClick={this.toggleChecked.bind(this)}
/>
<span className="text">
<strong>{this.props.location.username}</strong>: {this.props.location.name}
</span>
</li>
);
}
}
Location.propTypes = {
// This component gets the location to display through a React prop.
// We can use propTypes to indicate it is required
location: PropTypes.object.isRequired,
};
| Make UI match the data structure | Make UI match the data structure
| JSX | mit | scimusmn/map-stories,scimusmn/map-stories | ---
+++
@@ -33,7 +33,7 @@
/>
<span className="text">
- <strong>{this.props.location.username}</strong>: {this.props.location.text}
+ <strong>{this.props.location.username}</strong>: {this.props.location.name}
</span>
</li>
); |
2fab42c47102ddea8c35702279a627f5f6a02aa7 | imports/startup/client/routes.jsx | imports/startup/client/routes.jsx | import React from 'react';
import { Router, Route, browserHistory, Redirect } from 'react-router';
import StructureView from '../../ui/structure-view/structure-view.jsx';
import MeasureView from '../../ui/measure-view/measure-view.jsx';
import ReportView from '../../ui/report-view/report-view.jsx';
// route components
import App from '../../ui/app.jsx';
export const getRoutes = () => (
<Router history={browserHistory}>
<Redirect from="/" to="/measure-view" />
<Route path="/" component={App}>
<Route path="/structure-view" component={StructureView} />
<Route path="/measure-view" component={MeasureView} />
<Route path="/report-view" component={ReportView} />
</Route>
</Router>
);
| import React from 'react';
import { Router, Route, browserHistory, Redirect } from 'react-router';
import StructureView from '../../ui/structure-view/structure-view.jsx';
import MeasureView from '../../ui/measure-view/measure-view.jsx';
import ReportView from '../../ui/report-view/report-view.jsx';
// route components
import App from '../../ui/app.jsx';
export const getRoutes = () => (
<Router history={browserHistory}>
<Redirect from="/" to="/structure-view" />
<Route path="/" component={App}>
<Route path="/structure-view" component={StructureView} />
<Route path="/measure-view" component={MeasureView} />
<Route path="/report-view" component={ReportView} />
</Route>
</Router>
);
| Make structure view the landing page | Make structure view the landing page
| JSX | mit | minden/data-furnace,minden/data-furnace | ---
+++
@@ -10,7 +10,7 @@
export const getRoutes = () => (
<Router history={browserHistory}>
- <Redirect from="/" to="/measure-view" />
+ <Redirect from="/" to="/structure-view" />
<Route path="/" component={App}>
<Route path="/structure-view" component={StructureView} />
<Route path="/measure-view" component={MeasureView} /> |
89113c8f52f83d9f8b57352e8a2be81577102fa8 | app/assets/javascripts/components/AboutTeamComponents/AboutTeamShow.js.jsx | app/assets/javascripts/components/AboutTeamComponents/AboutTeamShow.js.jsx | var AboutTeamShow = React.createClass({
render: function(){
return (
<div className="about_team_show_page">
< CommunityStandards />
< TeamMediaCards />
</div>
)
}
})
| var AboutTeamShow = React.createClass({
render: function(){
return (
<div className="about_team_show_page">
< CommunityStandards />
< CategoryDescriptions />
< TeamMediaCards />
</div>
)
}
})
| Add community standards to the about team page | Add community standards to the about team page
| JSX | mit | ShadyLogic/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter | ---
+++
@@ -3,6 +3,7 @@
return (
<div className="about_team_show_page">
< CommunityStandards />
+ < CategoryDescriptions />
< TeamMediaCards />
</div>
) |
79bc95a4c6042451eba613862c09b30307d8c05b | src/components/video/video.jsx | src/components/video/video.jsx | const PropTypes = require('prop-types');
const React = require('react');
const classNames = require('classnames');
require('./video.scss');
const Video = props => (
<div className={classNames('video-player', props.className)}>
<iframe
allowFullScreen
// allowFullScreen is legacy, can we start using allow='fullscreen'?
// allow="fullscreen"
frameBorder="0" // deprecated attribute
height={props.height}
scrolling="no" // deprecated attribute
src={`https://fast.wistia.net/embed/iframe/${props.videoId}?seo=false&videoFoam=true`}
title={props.title}
width={props.width}
/>
<script
async
src="https://fast.wistia.net/assets/external/E-v1.js"
/>
</div>
);
Video.defaultProps = {
height: '225',
title: '',
width: '400'
};
Video.propTypes = {
className: PropTypes.string,
height: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
videoId: PropTypes.string.isRequired,
width: PropTypes.string.isRequired
};
module.exports = Video;
| const PropTypes = require('prop-types');
const React = require('react');
const classNames = require('classnames');
require('./video.scss');
const Video = props => (
<div className={classNames('video-player', props.className)}>
<iframe
allowFullScreen
// allowFullScreen is legacy, can we start using allow='fullscreen'?
// allow="fullscreen"
frameBorder="0" // deprecated attribute
height={props.height}
scrolling="no" // deprecated attribute
src={props.isYouTube ?
`https://www.youtube.com/embed/${props.videoId}?autoplay=1` :
`https://fast.wistia.net/embed/iframe/${props.videoId}?seo=false&videoFoam=true`
}
title={props.title}
width={props.width}
/>
<script
async
src="https://fast.wistia.net/assets/external/E-v1.js"
/>
</div>
);
Video.defaultProps = {
height: '225',
isYouTube: false,
title: '',
width: '400'
};
Video.propTypes = {
className: PropTypes.string,
height: PropTypes.string.isRequired,
isYouTube: PropTypes.bool,
title: PropTypes.string.isRequired,
videoId: PropTypes.string.isRequired,
width: PropTypes.string.isRequired
};
module.exports = Video;
| Add ability to display YouTube in addition to Wistia | Add ability to display YouTube in addition to Wistia
| JSX | bsd-3-clause | LLK/scratch-www,LLK/scratch-www | ---
+++
@@ -13,7 +13,10 @@
frameBorder="0" // deprecated attribute
height={props.height}
scrolling="no" // deprecated attribute
- src={`https://fast.wistia.net/embed/iframe/${props.videoId}?seo=false&videoFoam=true`}
+ src={props.isYouTube ?
+ `https://www.youtube.com/embed/${props.videoId}?autoplay=1` :
+ `https://fast.wistia.net/embed/iframe/${props.videoId}?seo=false&videoFoam=true`
+ }
title={props.title}
width={props.width}
/>
@@ -25,6 +28,7 @@
);
Video.defaultProps = {
height: '225',
+ isYouTube: false,
title: '',
width: '400'
};
@@ -32,6 +36,7 @@
Video.propTypes = {
className: PropTypes.string,
height: PropTypes.string.isRequired,
+ isYouTube: PropTypes.bool,
title: PropTypes.string.isRequired,
videoId: PropTypes.string.isRequired,
width: PropTypes.string.isRequired |
e2ae93c7aab392c979a4d83c3e50c7c1de7557c8 | src/controls/StyleButton.jsx | src/controls/StyleButton.jsx | import React, { Component, PropTypes } from 'react';
class StyleButton extends Component {
constructor() {
super();
this.onToggle = (e) => {
e.preventDefault();
this.props.onToggle(this.props.style);
};
}
render() {
let className = 'DraftJSEditor-styleButton';
if (this.props.active) {
className += ' DraftJSEditor-activeButton';
}
return (
<span className={className} onMouseDown={this.onToggle}>
{this.props.icon ? this.props.icon : this.props.label}
</span>
);
}
}
StyleButton.propTypes = {
onToggle: PropTypes.func,
style: PropTypes.string,
active: PropTypes.bool,
label: PropTypes.string,
icon: PropTypes.node,
};
export default StyleButton;
| import React, { Component, PropTypes } from 'react';
class StyleButton extends Component {
constructor() {
super();
this.onToggle = (e) => {
e.preventDefault();
this.props.onToggle(this.props.style);
};
}
render() {
let className = 'DraftJSEditor-styleButton';
if (this.props.active) {
className += ' DraftJSEditor-activeButton';
}
return (
<span
className={className}
title={this.props.label}
onMouseDown={this.onToggle}
>
{this.props.icon ? this.props.icon : this.props.label}
</span>
);
}
}
StyleButton.propTypes = {
onToggle: PropTypes.func,
style: PropTypes.string,
active: PropTypes.bool,
label: PropTypes.string,
icon: PropTypes.node,
};
export default StyleButton;
| Add title attribute with label to control buttons | Add title attribute with label to control buttons
| JSX | mit | synapsestudios/draftjs-editor | ---
+++
@@ -17,7 +17,11 @@
}
return (
- <span className={className} onMouseDown={this.onToggle}>
+ <span
+ className={className}
+ title={this.props.label}
+ onMouseDown={this.onToggle}
+ >
{this.props.icon ? this.props.icon : this.props.label}
</span>
); |
a7db45324067a9f239e68599005fb5bd3dee60bb | src/pages/index.jsx | src/pages/index.jsx | import React from 'react'
import Helmet from 'react-helmet'
import HeroBlock from './HeroBlock'
import HeroImage from './HeroImage'
import About from './About'
import Career from './Career'
import '../lib/font-awesome/css/font-awesome.min.css'
import './index.scss'
const Footer = () => (
<div className="Footer">
<div className="Footer-Text">
<p className="small">© Teemu Huovinen 2018</p>
</div>
<div className="Footer-SocialMedia">
<a href="http://www.github.com/Echie">
<i className="fa fa-2x fa-github" aria-hidden="true" />
</a>
<a href="http://www.linkedin.com/in/teemuhuovinen">
<i className="fa fa-2x fa-linkedin" aria-hidden="true" />
</a>
</div>
</div>
)
const IndexPage = () => (
<div>
<Helmet title="Teemu Huovinen" meta={[{ name: 'description', content: 'Homepage of Teemu Huovinen' }]} />
<HeroImage />
<HeroBlock />
<About />
<Career />
<Footer />
</div>
)
export default IndexPage
| import React from 'react'
import Helmet from 'react-helmet'
import HeroBlock from './HeroBlock'
import HeroImage from './HeroImage'
import About from './About'
import Career from './Career'
import '../lib/font-awesome/css/font-awesome.min.css'
import './index.scss'
const getYear = () => new Date().getFullYear()
const Footer = () => (
<div className="Footer">
<div className="Footer-Text">
<p className="small">© Teemu Huovinen {getYear()}</p>
</div>
<div className="Footer-SocialMedia">
<a href="http://www.github.com/Echie">
<i className="fa fa-2x fa-github" aria-hidden="true" />
</a>
<a href="http://www.linkedin.com/in/teemuhuovinen">
<i className="fa fa-2x fa-linkedin" aria-hidden="true" />
</a>
</div>
</div>
)
const IndexPage = () => (
<div>
<Helmet title="Teemu Huovinen" meta={[{ name: 'description', content: 'Homepage of Teemu Huovinen' }]} />
<HeroImage />
<HeroBlock />
<About />
<Career />
<Footer />
</div>
)
export default IndexPage
| Add automatic copyright year updating | Add automatic copyright year updating
| JSX | mit | Echie/echie-net | ---
+++
@@ -8,10 +8,12 @@
import '../lib/font-awesome/css/font-awesome.min.css'
import './index.scss'
+const getYear = () => new Date().getFullYear()
+
const Footer = () => (
<div className="Footer">
<div className="Footer-Text">
- <p className="small">© Teemu Huovinen 2018</p>
+ <p className="small">© Teemu Huovinen {getYear()}</p>
</div>
<div className="Footer-SocialMedia">
<a href="http://www.github.com/Echie"> |
07e697ef752b25da0979502ffb478d0bd2255be5 | src/js/components/login/Password.jsx | src/js/components/login/Password.jsx | /**
* Password.jsx
* Created by Kyle Fox 12/4/15
**/
import React, { PropTypes } from 'react';
const propTypes = {
handleChange: PropTypes.func.isRequired
};
export default class Password extends React.Component {
render() {
return (
<div className="usa-da-input-container usa-da-input-password">
<label className="sr-only" htmlFor="password">Password</label>
<input
className="usa-da-input-with-icon"
id="password"
name="password"
type="password"
placeholder="Password"
aria-describedby="password"
onChange={this.props.handleChange}
/>
<div className="usa-da-icon usa-da-icon-lock usa-da-icon-nobg"></div>
</div>
);
}
}
Password.propTypes = propTypes;
| /**
* Password.jsx
* Created by Kyle Fox 12/4/15
**/
import React, { PropTypes } from 'react';
const propTypes = {
handleChange: PropTypes.func.isRequired,
fieldID: PropTypes.string
};
const defaultProps = {
fieldID: "password"
};
export default class Password extends React.Component {
render() {
return (
<div className="usa-da-input-container usa-da-input-password">
<label className="sr-only" htmlFor="password">Password</label>
<input
className="usa-da-input-with-icon"
id={this.props.fieldID}
name={this.props.fieldID}
type="password"
placeholder="Password"
aria-describedby="password"
onChange={this.props.handleChange}
/>
<div className="usa-da-icon usa-da-icon-lock usa-da-icon-nobg"></div>
</div>
);
}
}
Password.propTypes = propTypes;
| Add fieldID prop to password component | Add fieldID prop to password component
| JSX | cc0-1.0 | fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app | ---
+++
@@ -6,9 +6,12 @@
import React, { PropTypes } from 'react';
const propTypes = {
- handleChange: PropTypes.func.isRequired
+ handleChange: PropTypes.func.isRequired,
+ fieldID: PropTypes.string
};
-
+const defaultProps = {
+ fieldID: "password"
+};
export default class Password extends React.Component {
render() {
return (
@@ -16,8 +19,8 @@
<label className="sr-only" htmlFor="password">Password</label>
<input
className="usa-da-input-with-icon"
- id="password"
- name="password"
+ id={this.props.fieldID}
+ name={this.props.fieldID}
type="password"
placeholder="Password"
aria-describedby="password" |
929d56be160ccf0ab3a986e192331f1023833877 | livedoc-ui/src/components/doc/DocPresenter.jsx | livedoc-ui/src/components/doc/DocPresenter.jsx | // @flow
import * as React from 'react';
import { connect } from 'react-redux';
import type { Livedoc } from '../../model/livedoc';
import type { State } from '../../model/state';
import DocContent from './content/DocContent';
import { GlobalInfo } from './GlobalInfo';
import { LoadingInfo } from './LoadingInfo';
import NavPanel from './nav/NavPanel';
type Props = {
loading: boolean, url: ?string, livedoc: ?Livedoc
}
const DocPresenter = (props: Props) => {
if (props.loading) {
return <LoadingInfo url={props.url}/>;
}
if (!props.livedoc) {
return <p>Please provide a URL to fetch a documentation.</p>;
}
return <div className='App-content'>
<GlobalInfo livedoc={props.livedoc}/>
<NavPanel/>
<DocContent/>
</div>;
};
const mapStateToProps = (state: State) => ({
loading: state.loader.loading,
url: state.loader.url,
livedoc: state.livedoc,
});
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(DocPresenter);
| // @flow
import * as React from 'react';
import {Col, Grid, Row} from 'react-bootstrap';
import {connect} from 'react-redux';
import {Livedoc} from '../../model/livedoc';
import type {State} from '../../model/state';
import DocContent from './content/DocContent';
import {GlobalInfo} from './GlobalInfo';
import {LoadingInfo} from './LoadingInfo';
import NavPanel from './nav/NavPanel';
type Props = {
loading: boolean, url: ?string, livedoc: ?Livedoc
}
const DocPresenter = (props: Props) => {
if (props.loading) {
return <LoadingInfo url={props.url}/>;
}
if (!props.livedoc) {
return <p>Please provide a URL to fetch a documentation.</p>;
}
return <div className='App-content'>
<GlobalInfo livedoc={props.livedoc}/>
<Grid fluid>
<Row>
<Col md={3}>
<NavPanel/>
</Col>
<Col md={6}>
<DocContent/>
</Col>
</Row>
</Grid>
</div>;
};
const mapStateToProps = (state: State) => ({
loading: state.loader.loading,
url: state.loader.url,
livedoc: state.livedoc,
});
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(DocPresenter);
| Improve layout using bootstrap's grid | Improve layout using bootstrap's grid
| JSX | mit | joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc,joffrey-bion/livedoc | ---
+++
@@ -1,11 +1,12 @@
// @flow
import * as React from 'react';
-import { connect } from 'react-redux';
-import type { Livedoc } from '../../model/livedoc';
-import type { State } from '../../model/state';
+import {Col, Grid, Row} from 'react-bootstrap';
+import {connect} from 'react-redux';
+import {Livedoc} from '../../model/livedoc';
+import type {State} from '../../model/state';
import DocContent from './content/DocContent';
-import { GlobalInfo } from './GlobalInfo';
-import { LoadingInfo } from './LoadingInfo';
+import {GlobalInfo} from './GlobalInfo';
+import {LoadingInfo} from './LoadingInfo';
import NavPanel from './nav/NavPanel';
type Props = {
@@ -22,8 +23,16 @@
return <div className='App-content'>
<GlobalInfo livedoc={props.livedoc}/>
- <NavPanel/>
- <DocContent/>
+ <Grid fluid>
+ <Row>
+ <Col md={3}>
+ <NavPanel/>
+ </Col>
+ <Col md={6}>
+ <DocContent/>
+ </Col>
+ </Row>
+ </Grid>
</div>;
};
|
445116a9b2fd08ed96ce81ecf8f8157ac9ae8987 | src/components/ResultStatsRow.jsx | src/components/ResultStatsRow.jsx | import React, { PropTypes } from 'react';
import { Row, Col } from 'react-bootstrap';
import InformationLabel from './InformationLabel';
import languageColors from '../utils/languageColors';
import '../styles/result-stats-row.css';
const ResultStatsRow = (props) => {
const data = props.data;
return (
<Row className='quick-info-row'>
<Col xs={12}>
<InformationLabel data={data.forks_count} level="success">{ "Forks: " }</InformationLabel>
<InformationLabel data={data.stargazers_count} level="warning">{ "Stars: " }</InformationLabel>
<InformationLabel data={data.watchers_count} level="info">{ "Watchers: " }</InformationLabel>
<InformationLabel data={data.open_issues_count} color="#C370E8">{ "Issues: " }</InformationLabel>
<InformationLabel data={data.language} color={languageColors[data.language]} />
</Col>
</Row>
);
}
ResultStatsRow.propTypes = {
data: PropTypes.object.isRequired
};
export default ResultStatsRow;
| import React, { PropTypes } from 'react';
import { Row, Col } from 'react-bootstrap';
import InformationLabel from './InformationLabel';
import languageColors from '../utils/languageColors';
import '../styles/result-stats-row.css';
const ResultStatsRow = (props) => {
const data = props.data;
return (
<Row className='quick-info-row'>
<Col xs={12}>
<InformationLabel data={data.forks_count} level="success">{ "Forks: " }</InformationLabel>
<InformationLabel data={data.stargazers_count} level="warning">{ "Stars: " }</InformationLabel>
<InformationLabel data={data.watchers_count} level="info">{ "Watchers: " }</InformationLabel>
<InformationLabel data={data.open_issues_count} color="#C370E8">{ "Open Issues and PRs: " }</InformationLabel>
<InformationLabel data={data.language} color={languageColors[data.language]} />
</Col>
</Row>
);
}
ResultStatsRow.propTypes = {
data: PropTypes.object.isRequired
};
export default ResultStatsRow;
| Update issue badge text to indicate the count also includes PRs | Update issue badge text to indicate the count also includes PRs
| JSX | mit | tmobaird/i-want-to-contribute,tmobaird/i-want-to-contribute | ---
+++
@@ -13,7 +13,7 @@
<InformationLabel data={data.forks_count} level="success">{ "Forks: " }</InformationLabel>
<InformationLabel data={data.stargazers_count} level="warning">{ "Stars: " }</InformationLabel>
<InformationLabel data={data.watchers_count} level="info">{ "Watchers: " }</InformationLabel>
- <InformationLabel data={data.open_issues_count} color="#C370E8">{ "Issues: " }</InformationLabel>
+ <InformationLabel data={data.open_issues_count} color="#C370E8">{ "Open Issues and PRs: " }</InformationLabel>
<InformationLabel data={data.language} color={languageColors[data.language]} />
</Col>
</Row> |
8202ce6170e52947beb05e7609561db95bf72564 | web-server/app/assets/javascripts/components/packages/list-of-packages-for-vin.jsx | web-server/app/assets/javascripts/components/packages/list-of-packages-for-vin.jsx | define(function(require) {
var React = require('react'),
Router = require('react-router'),
_ = require('underscore'),
SotaDispatcher = require('sota-dispatcher');
var Packages = React.createClass({
contextTypes: {
router: React.PropTypes.func
},
componentWillUnmount: function(){
this.props.Packages.removeWatch("poll-packages");
},
componentWillMount: function(){
SotaDispatcher.dispatch({actionType: 'get-packages-for-vin', vin: this.props.Vin});
this.props.Packages.addWatch("poll-packages", _.bind(this.forceUpdate, this, null));
},
render: function() {
var rows = _.map(this.props.Packages.deref(), function(package) {
return (
<tr key={package.name + '-' + package.version}>
<td>
<Router.Link to='package' params={{name: package.name, version: package.version}}>
{ package.name }
</Router.Link>
</td>
<td>
{ package.version }
</td>
<td>
<Router.Link to='new-campaign' params={{name: package.name, version: package.version}}>
Create Campaign
</Router.Link>
</td>
</tr>
);
});
return (
<table className="table table-striped table-bordered">
<thead>
<tr>
<td>
Packages
</td>
<td>
Version
</td>
</tr>
</thead>
<tbody>
{ rows }
</tbody>
</table>
);
}
});
return Packages;
});
| define(function(require) {
var React = require('react'),
Router = require('react-router'),
_ = require('underscore'),
SotaDispatcher = require('sota-dispatcher');
var Packages = React.createClass({
contextTypes: {
router: React.PropTypes.func
},
componentWillUnmount: function(){
this.props.Packages.removeWatch("poll-packages");
},
componentWillMount: function(){
SotaDispatcher.dispatch({actionType: 'get-packages-for-vin', vin: this.props.Vin});
this.props.Packages.addWatch("poll-packages", _.bind(this.forceUpdate, this, null));
},
render: function() {
var rows = _.map(this.props.Packages.deref(), function(package) {
return (
<tr key={package.name + '-' + package.version}>
<td>
<Router.Link to='package' params={{name: package.name, version: package.version}}>
{ package.name }
</Router.Link>
</td>
<td>
{ package.version }
</td>
</tr>
);
});
return (
<table className="table table-striped table-bordered">
<thead>
<tr>
<td>
Packages
</td>
<td>
Version
</td>
</tr>
</thead>
<tbody>
{ rows }
</tbody>
</table>
);
}
});
return Packages;
});
| Remove meaningless 'create campaign' link | Remove meaningless 'create campaign' link
| JSX | mpl-2.0 | PDXostc/rvi_sota_server,PDXostc/rvi_sota_server,PDXostc/rvi_sota_server | ---
+++
@@ -28,11 +28,6 @@
<td>
{ package.version }
</td>
- <td>
- <Router.Link to='new-campaign' params={{name: package.name, version: package.version}}>
- Create Campaign
- </Router.Link>
- </td>
</tr>
);
}); |
90b670ddc46749735f3c83f3298a82079e0935fb | app/components/pages/_Page.jsx | app/components/pages/_Page.jsx | import PropTypes from 'prop-types';
import React from 'react';
import Header from '../organisms/Header';
import Footer from '../organisms/Footer';
class Page extends React.Component {
render() {
return (
<div>
<Header />
{ this.props.children }
<Footer />
</div>
);
}
}
Page.propTypes = {
children: PropTypes.node,
};
export default (Page);
| import PropTypes from 'prop-types';
import React from 'react';
import Header from '../organisms/Header';
import Footer from '../organisms/Footer';
import { hot } from 'react-hot-loader';
class Page extends React.Component {
render() {
return (
<div>
<Header />
{ this.props.children }
<Footer />
</div>
);
}
}
Page.propTypes = {
children: PropTypes.node,
};
export default hot(module)(Page);
| Allow hot reloading outside of page content... | Allow hot reloading outside of page content...
https://github.com/gatsbyjs/gatsby/issues/8237#issuecomment-422213443
Though according to someone on discord, hot reloading should have been
working out of the box.
Also, not sure if this change has any consequences.
| JSX | mit | amcsi/szeremi,amcsi/szeremi | ---
+++
@@ -2,6 +2,7 @@
import React from 'react';
import Header from '../organisms/Header';
import Footer from '../organisms/Footer';
+import { hot } from 'react-hot-loader';
class Page extends React.Component {
render() {
@@ -21,4 +22,4 @@
children: PropTypes.node,
};
-export default (Page);
+export default hot(module)(Page); |
d8f44307cf5d1fff2fcdb3762573b9a6f42d7561 | client/source/components/SearchExplore/searchResultsList.jsx | client/source/components/SearchExplore/searchResultsList.jsx | import React, {Component} from 'react';
//Bootstrap
import { Grid, Row, Col, Table, Button, Thumbnail } from 'react-bootstrap';
export default ({recipeList, name, handleRecipeForkClick, handleRecipeCookClick}) => {
return (
<div>
{recipeList.map((recipe, i) => {
return (
<Col xs={3} md={3} key={`${name}${i}`} style={{padding: '0px', margin: '20px'}}>
<Thumbnail src={recipe.picture.value} alt="200x200">
<h3>{recipe.name.value}</h3>
<h4>cooked by // {recipe.username}</h4>
<p>{recipe.description.value.split('.').slice(0,2).join('.')}...Click to read more</p>
<p>
<Button bsStyle="success" onClick={handleRecipeCookClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion} data-branch={recipe.branch} data-version={recipe._id}>Cook</Button>
<Button bsStyle="default" onClick={handleRecipeForkClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion} data-branch={recipe.branch} data-version={recipe._id}>Fork</Button>
</p>
</Thumbnail>
</Col>
)
})}
</div>
);
} | import React, {Component} from 'react';
//Bootstrap
import { Grid, Row, Col, Table, Button, Thumbnail } from 'react-bootstrap';
export default ({recipeList, name, handleRecipeForkClick, handleRecipeCookClick}) => {
return (
<div>
{recipeList.map((recipe, i) => {
return (
<Col xs={3} md={3} key={`${name}${i}`} style={{padding: '0px', margin: '20px'}}>
<Thumbnail src={recipe.picture.value} alt="200x200">
<h3>{recipe.name.value}</h3>
<h4>cooked by // {recipe.username}</h4>
<p>{recipe.description.value.split('.').slice(0,2).join('.')}...Click to read more</p>
<p>
<Button bsStyle="success" onClick={handleRecipeCookClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion || recipe._id} data-branch={recipe.branch} data-version={recipe._id}>Cook</Button>
<Button bsStyle="default" onClick={handleRecipeForkClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion || recipe._id} data-branch={recipe.branch} data-version={recipe._id}>Fork</Button>
</p>
</Thumbnail>
</Col>
)
})}
</div>
);
} | Fix bug preventing users from accessing root recipes shown in the Explore component Fixed bug involving the cook button | Fix bug preventing users from accessing root recipes shown in the Explore component
Fixed bug involving the cook button
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -13,8 +13,8 @@
<h4>cooked by // {recipe.username}</h4>
<p>{recipe.description.value.split('.').slice(0,2).join('.')}...Click to read more</p>
<p>
- <Button bsStyle="success" onClick={handleRecipeCookClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion} data-branch={recipe.branch} data-version={recipe._id}>Cook</Button>
- <Button bsStyle="default" onClick={handleRecipeForkClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion} data-branch={recipe.branch} data-version={recipe._id}>Fork</Button>
+ <Button bsStyle="success" onClick={handleRecipeCookClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion || recipe._id} data-branch={recipe.branch} data-version={recipe._id}>Cook</Button>
+ <Button bsStyle="default" onClick={handleRecipeForkClick.bind(this)} data-username={recipe.username} data-recipe={recipe.rootVersion || recipe._id} data-branch={recipe.branch} data-version={recipe._id}>Fork</Button>
</p>
</Thumbnail>
</Col> |
95e0fc31e41b0cd773e451cf40e57bf444204bb8 | src/OverflowDetector.jsx | src/OverflowDetector.jsx | import React, { Component, PropTypes } from 'react';
import ResizeDetector from './ResizeDetector';
export default class OverflowDetector extends Component {
static propTypes = {
onOverflowChange: PropTypes.func,
children: PropTypes.node,
style: PropTypes.object,
className: PropTypes.string,
};
static defaultProps = {
style: {},
};
constructor(props) {
super(props);
this.isOverflowed = false;
this.domElement = null;
this.setDOMElement = this.setDOMElement.bind(this);
this.checkOverflow = this.checkOverflow.bind(this);
}
componentDidMount() {
this.checkOverflow();
}
componentDidUpdate() {
this.checkOverflow();
}
setDOMElement(domElement) {
this.domElement = domElement;
}
checkOverflow() {
const isOverflowed =
this.domElement.scrollWidth > this.domElement.clientWidth ||
this.domElement.scrollHeight > this.domElement.scrollHeight;
if (isOverflowed !== this.isOverflowed) {
this.isOverflowed = isOverflowed;
if (this.props.onOverflowChange) {
this.props.onOverflowChange(isOverflowed);
}
}
}
render() {
const { style, className, children } = this.props;
return (
<div
ref={this.setDOMElement}
style={{ ...style, position: 'relative' }}
className={className}
>
{children}
<ResizeDetector onResize={this.checkOverflow} />
</div>
);
}
}
| import React, { Component, PropTypes } from 'react';
import ResizeDetector from './ResizeDetector';
export default class OverflowDetector extends Component {
static propTypes = {
onOverflowChange: PropTypes.func,
children: PropTypes.node,
style: PropTypes.object,
className: PropTypes.string,
};
static defaultProps = {
style: {},
};
constructor(props) {
super(props);
this.isOverflowed = false;
this.domElement = null;
this.setDOMElement = this.setDOMElement.bind(this);
this.checkOverflow = this.checkOverflow.bind(this);
}
componentDidMount() {
this.checkOverflow();
}
componentDidUpdate() {
this.checkOverflow();
}
setDOMElement(domElement) {
this.domElement = domElement;
}
checkOverflow() {
const isOverflowed =
this.domElement.scrollWidth > this.domElement.clientWidth ||
this.domElement.scrollHeight > this.domElement.clientHeight;
if (isOverflowed !== this.isOverflowed) {
this.isOverflowed = isOverflowed;
if (this.props.onOverflowChange) {
this.props.onOverflowChange(isOverflowed);
}
}
}
render() {
const { style, className, children } = this.props;
return (
<div
ref={this.setDOMElement}
style={{ ...style, position: 'relative' }}
className={className}
>
{children}
<ResizeDetector onResize={this.checkOverflow} />
</div>
);
}
}
| Fix issue with vertical overflow detection | Fix issue with vertical overflow detection
| JSX | mit | nickuraltsev/react-overflow | ---
+++
@@ -36,7 +36,7 @@
checkOverflow() {
const isOverflowed =
this.domElement.scrollWidth > this.domElement.clientWidth ||
- this.domElement.scrollHeight > this.domElement.scrollHeight;
+ this.domElement.scrollHeight > this.domElement.clientHeight;
if (isOverflowed !== this.isOverflowed) {
this.isOverflowed = isOverflowed; |
32d30a65d9862aadcec3728ba74ec95c761cd9cf | lib/src/_shared/MaskedInput.jsx | lib/src/_shared/MaskedInput.jsx | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import MaskedInput from 'react-text-mask';
export default class Input extends PureComponent {
static propTypes = {
mask: PropTypes.any,
inputRef: PropTypes.func.isRequired,
}
static defaultProps = {
mask: undefined,
}
render() {
const { inputRef, ...props } = this.props;
return (
this.props.mask
? <MaskedInput {...props} ref={inputRef} />
: <input {...props} ref={inputRef} />
);
}
}
| import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import MaskedInput from 'react-text-mask';
export default class Input extends PureComponent {
static propTypes = {
mask: PropTypes.any,
value: PropTypes.string,
inputRef: PropTypes.func.isRequired,
}
static defaultProps = {
value: undefined,
mask: undefined,
}
getMask = () => {
if (this.props.value) {
return this.props.mask;
}
return [];
}
render() {
const { inputRef, mask, ...props } = this.props;
return (
mask
? <MaskedInput mask={this.getMask()} {...props} ref={inputRef} />
: <input {...props} ref={inputRef} />
);
}
}
| Fix showing mask on clearing timepicker | Fix showing mask on clearing timepicker
| JSX | mit | callemall/material-ui,callemall/material-ui,mui-org/material-ui,mbrookes/material-ui,callemall/material-ui,mbrookes/material-ui,dmtrKovalenko/material-ui-pickers,rscnt/material-ui,oliviertassinari/material-ui,callemall/material-ui,mui-org/material-ui,oliviertassinari/material-ui,dmtrKovalenko/material-ui-pickers,rscnt/material-ui,oliviertassinari/material-ui,mbrookes/material-ui,mui-org/material-ui,rscnt/material-ui | ---
+++
@@ -5,18 +5,28 @@
export default class Input extends PureComponent {
static propTypes = {
mask: PropTypes.any,
+ value: PropTypes.string,
inputRef: PropTypes.func.isRequired,
}
static defaultProps = {
+ value: undefined,
mask: undefined,
}
+ getMask = () => {
+ if (this.props.value) {
+ return this.props.mask;
+ }
+
+ return [];
+ }
+
render() {
- const { inputRef, ...props } = this.props;
+ const { inputRef, mask, ...props } = this.props;
return (
- this.props.mask
- ? <MaskedInput {...props} ref={inputRef} />
+ mask
+ ? <MaskedInput mask={this.getMask()} {...props} ref={inputRef} />
: <input {...props} ref={inputRef} />
);
} |
9a7a8e98d87ca3ff333a797c66ba6b5391f1a37c | src/components/settings/sign-in.jsx | src/components/settings/sign-in.jsx | import { Link } from 'react-router';
import ExtAuthForm from './forms/ext-auth-accounts';
import ChangePasswordForm from './forms/change-password';
import styles from './settings.module.scss';
import { SettingsPage } from './layout';
export default function SignInPage() {
return (
<SettingsPage title="Password & sign in">
<section className={styles.formSection}>
<h4>Connected social network profiles</h4>
<ExtAuthForm />
</section>
<section className={styles.formSection}>
<h4>Change password</h4>
<ChangePasswordForm />
</section>
<section className={styles.formSection}>
<h4>Authorization sessions</h4>
<p>
<Link to="/settings/sign-in/sessions">View your authorization sessions</Link>
</p>
</section>
</SettingsPage>
);
}
| import { Link } from 'react-router';
import ExtAuthForm from './forms/ext-auth-accounts';
import ChangePasswordForm from './forms/change-password';
import styles from './settings.module.scss';
import { SettingsPage } from './layout';
export default function SignInPage() {
return (
<SettingsPage title="Password & sign in">
<section className={styles.formSection}>
<h4>Connected social network profiles</h4>
<ExtAuthForm />
</section>
<section className={styles.formSection}>
<h4>Change password</h4>
<ChangePasswordForm />
</section>
<section className={styles.formSection}>
<h4>Login sessions</h4>
<p>
<Link to="/settings/sign-in/sessions">View your login sessions</Link>
</p>
</section>
</SettingsPage>
);
}
| Rename 'authorization sessions' to 'login sessions' | Rename 'authorization sessions' to 'login sessions' | JSX | mit | FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client | ---
+++
@@ -19,9 +19,9 @@
</section>
<section className={styles.formSection}>
- <h4>Authorization sessions</h4>
+ <h4>Login sessions</h4>
<p>
- <Link to="/settings/sign-in/sessions">View your authorization sessions</Link>
+ <Link to="/settings/sign-in/sessions">View your login sessions</Link>
</p>
</section>
</SettingsPage> |
36b4f4cf42cd5cc691b4b28ae04ff677e8321ec4 | src/components/status.jsx | src/components/status.jsx | /*eslint no-extra-parens:0*/
import React from 'react';
/**
* @class Status
* @extends React.Component
* @public
*
* Displays information about the current sculpture data,
* recent state udpates, and actions.
*/
export default class Status extends React.Component {
static propTypes = {
commandLog: React.PropTypes.array,
sculpture: React.PropTypes.object.isRequired
};
render() {
const msgs = _(this.props.commandLog).map((msg, idx) => <p key={idx}>{msg}</p>).reverse().value();
const currentGame = this.props.sculpture.data.get("currentGame");
const status = this.props.sculpture.data.get("status")
const handshakeState = this.props.sculpture.data.get("handshake").get("state");
const gameInfo = currentGame ? this.props.sculpture.data.get(currentGame) : null;
return (
<div className="status"><h3>Status</h3>
<p>Game: { currentGame } | State: { status } | { handshakeState }</p>
<pre>{ currentGame } game: { gameInfo ? JSON.stringify(gameInfo.pretty(), null, 2) : "" }</pre>
<hr/>
<div className="log">{ msgs }</div>
</div>
);
}
}
| /*eslint no-extra-parens:0*/
import React from 'react';
/**
* @class Status
* @extends React.Component
* @public
*
* Displays information about the current sculpture data,
* recent state udpates, and actions.
*/
export default class Status extends React.Component {
static propTypes = {
commandLog: React.PropTypes.array,
sculpture: React.PropTypes.object.isRequired
};
render() {
const msgs = this.props.commandLog.map((msg, idx) => <p key={idx}>{msg}</p>).reverse();
const currentGame = this.props.sculpture.data.get("currentGame");
const status = this.props.sculpture.data.get("status")
const handshakeState = this.props.sculpture.data.get("handshake").get("state");
const gameInfo = currentGame ? this.props.sculpture.data.get(currentGame) : null;
return (
<div className="status"><h3>Status</h3>
<p>Game: { currentGame } | State: { status } | { handshakeState }</p>
<pre>{ currentGame } game: { gameInfo ? JSON.stringify(gameInfo.pretty(), null, 2) : "" }</pre>
<hr/>
<div className="log">{ msgs }</div>
</div>
);
}
}
| Use ES6 instead of lodash | Use ES6 instead of lodash
| JSX | mit | anyWareSculpture/sculpture-emulator-client,anyWareSculpture/sculpture-emulator-client | ---
+++
@@ -16,7 +16,7 @@
sculpture: React.PropTypes.object.isRequired
};
render() {
- const msgs = _(this.props.commandLog).map((msg, idx) => <p key={idx}>{msg}</p>).reverse().value();
+ const msgs = this.props.commandLog.map((msg, idx) => <p key={idx}>{msg}</p>).reverse();
const currentGame = this.props.sculpture.data.get("currentGame");
const status = this.props.sculpture.data.get("status")
const handshakeState = this.props.sculpture.data.get("handshake").get("state"); |
75012735ebea80d5850aaca0ca4001f934a8b6d3 | client/app/bundles/course/survey/containers/UnsubmitButton.jsx | client/app/bundles/course/survey/containers/UnsubmitButton.jsx | import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import { IconButton } from '@mui/material';
import RemoveCircle from '@mui/icons-material/RemoveCircle';
const styles = {
formButton: {
padding: '0.25em 0.4em',
},
};
const UnsubmitButton = (props) => {
const isUnsubmitting =
useSelector(
(state) =>
state.surveysFlags && state.surveysFlags.isUnsubmittingResponse,
) || false;
return (
<>
<span className="unsubmit-button" data-for="unsubmit-button" data-tip>
<IconButton
id={`unsubmit-button-${props.buttonId}`}
disabled={isUnsubmitting || props.isUnsubmitting}
onClick={() =>
props.setState({
...props.state,
unsubmitConfirmation: true,
})
}
size="large"
style={styles.formButton}
>
<RemoveCircle
htmlColor={
isUnsubmitting || props.isUnsubmitting ? undefined : props.color
}
/>
</IconButton>
</span>
</>
);
};
UnsubmitButton.propTypes = {
buttonId: PropTypes.number.isRequired,
color: PropTypes.string.isRequired,
isUnsubmitting: PropTypes.bool.isRequired,
setState: PropTypes.func.isRequired,
state: PropTypes.object.isRequired,
};
export default UnsubmitButton;
| import { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { IconButton } from '@mui/material';
import RemoveCircle from '@mui/icons-material/RemoveCircle';
const styles = {
formButton: {
padding: '0.25em 0.4em',
},
};
class UnsubmitButton extends Component {
render() {
const { isUnsubmitting } = this.props;
return (
<>
<span className="unsubmit-button" data-for="unsubmit-button" data-tip>
<IconButton
id={`unsubmit-button-${this.props.buttonId}`}
disabled={isUnsubmitting}
onClick={() =>
this.props.setState({
...this.props.state,
unsubmitConfirmation: true,
})
}
size="large"
style={styles.formButton}
>
<RemoveCircle
htmlColor={isUnsubmitting ? undefined : this.props.color}
/>
</IconButton>
</span>
</>
);
}
}
UnsubmitButton.propTypes = {
buttonId: PropTypes.number.isRequired,
color: PropTypes.string.isRequired,
isUnsubmitting: PropTypes.bool.isRequired,
setState: PropTypes.func.isRequired,
state: PropTypes.object.isRequired,
};
export default connect((state, ownProps) => ({
isUnsubmitting: state.surveysFlags
? state.surveysFlags.isUnsubmittingResponse
: ownProps.isUnsubmitting,
}))(UnsubmitButton);
| Fix test by adding dummy store, fix linting | refactor(surveysChipIcons): Fix test by adding dummy store, fix linting
| JSX | mit | Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2,Coursemology/coursemology2 | ---
+++
@@ -1,5 +1,6 @@
+import { Component } from 'react';
import PropTypes from 'prop-types';
-import { useSelector } from 'react-redux';
+import { connect } from 'react-redux';
import { IconButton } from '@mui/material';
import RemoveCircle from '@mui/icons-material/RemoveCircle';
@@ -9,37 +10,33 @@
},
};
-const UnsubmitButton = (props) => {
- const isUnsubmitting =
- useSelector(
- (state) =>
- state.surveysFlags && state.surveysFlags.isUnsubmittingResponse,
- ) || false;
- return (
- <>
- <span className="unsubmit-button" data-for="unsubmit-button" data-tip>
- <IconButton
- id={`unsubmit-button-${props.buttonId}`}
- disabled={isUnsubmitting || props.isUnsubmitting}
- onClick={() =>
- props.setState({
- ...props.state,
- unsubmitConfirmation: true,
- })
- }
- size="large"
- style={styles.formButton}
- >
- <RemoveCircle
- htmlColor={
- isUnsubmitting || props.isUnsubmitting ? undefined : props.color
+class UnsubmitButton extends Component {
+ render() {
+ const { isUnsubmitting } = this.props;
+ return (
+ <>
+ <span className="unsubmit-button" data-for="unsubmit-button" data-tip>
+ <IconButton
+ id={`unsubmit-button-${this.props.buttonId}`}
+ disabled={isUnsubmitting}
+ onClick={() =>
+ this.props.setState({
+ ...this.props.state,
+ unsubmitConfirmation: true,
+ })
}
- />
- </IconButton>
- </span>
- </>
- );
-};
+ size="large"
+ style={styles.formButton}
+ >
+ <RemoveCircle
+ htmlColor={isUnsubmitting ? undefined : this.props.color}
+ />
+ </IconButton>
+ </span>
+ </>
+ );
+ }
+}
UnsubmitButton.propTypes = {
buttonId: PropTypes.number.isRequired,
@@ -49,4 +46,8 @@
state: PropTypes.object.isRequired,
};
-export default UnsubmitButton;
+export default connect((state, ownProps) => ({
+ isUnsubmitting: state.surveysFlags
+ ? state.surveysFlags.isUnsubmittingResponse
+ : ownProps.isUnsubmitting,
+}))(UnsubmitButton); |
31db199818339a90756a31972276f9d86e642ee9 | components/slices/experience/content.jsx | components/slices/experience/content.jsx | import React, { PureComponent } from 'react'
import { uniqBy } from 'lodash'
import Entry from './entry'
class Content extends PureComponent {
displayName = 'SliceContent'
constructor (props) {
super(props)
const { tasks, techStack } = this.getTasksAndStack({
tasks: props.tasks
})
this.state = { tasks, techStack }
}
getTasksAndStack ({ tasks }) {
return tasks.reduce(
({ tasks, techStack }, { description, stack }) => ({
tasks: tasks.concat(description),
techStack: uniqBy(techStack.concat(stack), details => details)
}),
{ tasks: [], techStack: [] }
)
}
render () {
const { type, title, company, startDate, endDate, currentJob } = this.props
return (
<Entry
type={type}
title={title}
company={company}
startDate={startDate}
endDate={endDate}
currentJob={currentJob}
techStack={this.state.techStack}
tasks={this.state.tasks}
/>
)
}
}
export default Content
| import React, { PureComponent } from 'react'
import uniqBy from 'lodash.uniqby'
import Entry from './entry'
class Content extends PureComponent {
displayName = 'SliceContent'
constructor (props) {
super(props)
const { tasks, techStack } = this.getTasksAndStack({
tasks: props.tasks
})
this.state = { tasks, techStack }
}
getTasksAndStack ({ tasks }) {
return tasks.reduce(
({ tasks, techStack }, { description, stack }) => ({
tasks: tasks.concat(description),
techStack: uniqBy(techStack.concat(stack), details => details)
}),
{ tasks: [], techStack: [] }
)
}
render () {
const { type, title, company, startDate, endDate, currentJob } = this.props
return (
<Entry
type={type}
title={title}
company={company}
startDate={startDate}
endDate={endDate}
currentJob={currentJob}
techStack={this.state.techStack}
tasks={this.state.tasks}
/>
)
}
}
export default Content
| Use lodash module, not the whole lib. | Use lodash module, not the whole lib.
| JSX | mit | andreiconstantinescu/constantinescu.io | ---
+++
@@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'
-import { uniqBy } from 'lodash'
+import uniqBy from 'lodash.uniqby'
import Entry from './entry'
class Content extends PureComponent { |
01939bee685831667426a30fb63a001174689fdd | src/components/about/about-body.jsx | src/components/about/about-body.jsx | import React from 'react';
import Icon from '../partials/icon.jsx';
import linebreakToBr from "../../helpers/linebreak-to-br";
export default class AboutBody extends React.PureComponent {
render() {
const {about} = this.props.profile;
const findMeOnElements = about.findMeOn.map(
(element, i) => <a className="flex flex-cross-center" key={i} href={element.url} target="_blank"><Icon iconName={element.iconName} iconColor={element.hoverColor} /> {element.text}</a>
)
return (
<div className="pt-content-card__body pt-content-card__body__about flex flex-main-center">
<div className="pt-content-card__body__about__presentation flex flex-dc flex-full-center">
<img src="./assets/avatar.svg" alt="WEBSITE OWNER's Image" />
<h1 className="ta-c">{linebreakToBr(about.title)}</h1>
</div>
<div className="pt-content-card__body__about__details flex flex-dc flex-full-center">
<p>
{linebreakToBr(about.description)}
</p>
<h3>You'll find me on:</h3>
<div className="pt-content-card__body__about__details__net-icons flex-sa">
{findMeOnElements}
</div>
</div>
</div>
);
}
}
| import React from 'react';
import Icon from '../partials/icon.jsx';
import linebreakToBr from "../../helpers/linebreak-to-br";
export default class AboutBody extends React.PureComponent {
render() {
const {about} = this.props.profile;
const findMeOnElements = about.findMeOn.map(
(element, i) => (element.url ?
<a className="flex flex-cross-center" key={i} href={element.url} target="_blank"><Icon iconName={element.iconName} iconColor={element.hoverColor} /> {element.text}</a>
:
<span className="flex flex-cross-center" key={i}><Icon iconName={element.iconName} iconColor={element.hoverColor} /> {element.text}</span>
)
)
return (
<div className="pt-content-card__body pt-content-card__body__about flex flex-main-center">
<div className="pt-content-card__body__about__presentation flex flex-dc flex-full-center">
<img src="./assets/avatar.svg" alt="WEBSITE OWNER's Image" />
<h1 className="ta-c">{linebreakToBr(about.title)}</h1>
</div>
<div className="pt-content-card__body__about__details flex flex-dc flex-full-center">
<p>
{linebreakToBr(about.description)}
</p>
<h3>You'll find me on:</h3>
<div className="pt-content-card__body__about__details__net-icons flex-sa">
{findMeOnElements}
</div>
</div>
</div>
);
}
}
| Replace a for span in findMeOnElements which hasn't any link | Replace a for span in findMeOnElements which hasn't any link
| JSX | mit | nethruster/ptemplate,nethruster/ptemplate | ---
+++
@@ -8,7 +8,11 @@
render() {
const {about} = this.props.profile;
const findMeOnElements = about.findMeOn.map(
- (element, i) => <a className="flex flex-cross-center" key={i} href={element.url} target="_blank"><Icon iconName={element.iconName} iconColor={element.hoverColor} /> {element.text}</a>
+ (element, i) => (element.url ?
+ <a className="flex flex-cross-center" key={i} href={element.url} target="_blank"><Icon iconName={element.iconName} iconColor={element.hoverColor} /> {element.text}</a>
+ :
+ <span className="flex flex-cross-center" key={i}><Icon iconName={element.iconName} iconColor={element.hoverColor} /> {element.text}</span>
+ )
)
return ( |
7eb875697b062cb01c003fcc0bdeaa9dab76fac6 | src/mb/containers/HomePage.jsx | src/mb/containers/HomePage.jsx | import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import modelActionCreators from '../actions/model-action-creators';
import LoLoMo from './LoLoMo';
@connect(
state => ({ models: state.models }),
dispatch => bindActionCreators(modelActionCreators, dispatch)
)
/**
* Home page container.
*/
export default class HomePage extends React.PureComponent {
static propTypes = {
models: React.PropTypes.shape({
inTheaters: React.PropTypes.object,
comingSoon: React.PropTypes.object
}),
loadComingSoon: React.PropTypes.func.isRequired,
loadInTheaters: React.PropTypes.func.isRequired
}
static defaultProps = {
models: {
inTheaters: { count: 0, total: 0, subjects: [] },
comingSoon: { count: 0, total: 0, subjects: [] }
}
}
componentDidMount() {
this.props.loadInTheaters();
this.props.loadComingSoon();
}
render() {
// We only want to show inTheaters and comingSoon in the home page.
// This is why LoLoMo MUST be a pure component which is using shallow comparation.
const models = {
inTheaters: this.props.models.inTheaters,
comingSoon: this.props.models.comingSoon,
};
return (
<div className="mb-page mb-home-page">
<LoLoMo models={models} />
</div>
);
}
}
| import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import modelActionCreators from '../actions/model-action-creators';
import LoLoMo from './LoLoMo';
@connect(
state => ({ models: state.models }),
dispatch => ({
actions: bindActionCreators(modelActionCreators, dispatch)
})
)
/**
* Home page container.
*/
export default class HomePage extends React.PureComponent {
static propTypes = {
models: React.PropTypes.shape({
inTheaters: React.PropTypes.object,
comingSoon: React.PropTypes.object
}),
actions: React.PropTypes.shape({
loadComingSoon: React.PropTypes.func.isRequired,
loadInTheaters: React.PropTypes.func.isRequired
}).isRequired
}
static defaultProps = {
models: {
inTheaters: { count: 0, total: 0, subjects: [] },
comingSoon: { count: 0, total: 0, subjects: [] }
}
}
componentDidMount() {
this.props.actions.loadInTheaters();
this.props.actions.loadComingSoon();
}
render() {
// We only want to show inTheaters and comingSoon in the home page.
// This is why LoLoMo MUST be a pure component which is using shallow comparation.
const models = {
inTheaters: this.props.models.inTheaters,
comingSoon: this.props.models.comingSoon,
};
return (
<div className="mb-page mb-home-page">
<LoLoMo models={models} />
</div>
);
}
}
| Put all loading actions to the 'actions' property | Put all loading actions to the 'actions' property
| JSX | mit | MagicCube/movie-board,MagicCube/movie-board,MagicCube/movie-board | ---
+++
@@ -8,7 +8,9 @@
@connect(
state => ({ models: state.models }),
- dispatch => bindActionCreators(modelActionCreators, dispatch)
+ dispatch => ({
+ actions: bindActionCreators(modelActionCreators, dispatch)
+ })
)
/**
* Home page container.
@@ -19,8 +21,10 @@
inTheaters: React.PropTypes.object,
comingSoon: React.PropTypes.object
}),
- loadComingSoon: React.PropTypes.func.isRequired,
- loadInTheaters: React.PropTypes.func.isRequired
+ actions: React.PropTypes.shape({
+ loadComingSoon: React.PropTypes.func.isRequired,
+ loadInTheaters: React.PropTypes.func.isRequired
+ }).isRequired
}
static defaultProps = {
@@ -31,8 +35,8 @@
}
componentDidMount() {
- this.props.loadInTheaters();
- this.props.loadComingSoon();
+ this.props.actions.loadInTheaters();
+ this.props.actions.loadComingSoon();
}
render() { |
cac92bef308f21d9fbd05546361f73139cfa56fd | app/index.jsx | app/index.jsx | import React from 'react';
import dataStore from './stores/dataStore';
import JscsModel from './models/JscsModel';
if (typeof window.__jscsData !== 'undefined') {
dataStore.setData(JscsModel.fromJSON(window.__jscsData));
}
import AppView from './views/AppView';
React.render(<AppView />, document.getElementById('root'));
| import React from 'react';
import dataStore from './stores/dataStore';
import JscsModel from './models/JscsModel';
if (typeof window.__jscsData !== 'undefined') {
dataStore.setData(JscsModel.fromJSON(window.__jscsData));
}
var AppView = require('./views/AppView');
React.render(<AppView />, document.getElementById('root'));
| Fix loading hash legacy links | Fix loading hash legacy links
| JSX | mit | dutzi/jscs-dev.github.io,indexzero/jscs-dev.github.io,jscs-dev/jscs-dev.github.io,escaton/jscs-dev.github.io,indexzero/jscs-dev.github.io,dutzi/jscs-dev.github.io,escaton/jscs-dev.github.io,jscs-dev/jscs-dev.github.io | ---
+++
@@ -6,6 +6,6 @@
dataStore.setData(JscsModel.fromJSON(window.__jscsData));
}
-import AppView from './views/AppView';
+var AppView = require('./views/AppView');
React.render(<AppView />, document.getElementById('root')); |
52f1f2661edc103d5db6306dfe676916dd4709d0 | WebClient/app/scene/Board/components/SideBarOverlay/components/Tools/components/GenericTool/index.jsx | WebClient/app/scene/Board/components/SideBarOverlay/components/Tools/components/GenericTool/index.jsx | import React from 'react'
import {
Icon
} from 'semantic-ui-react'
export default class GenericTool extends React.Component {
render () {
return (
<div onClick={this.props.onClickTool} style={{width: '38px', height: '38px'}}>
<Icon name={this.props.content} size='large' style={{paddingTop: '5px', width: '38px', height: '38px'}} />
</div>
)
}
}
| import React from 'react'
import { Icon } from 'semantic-ui-react'
export default function GenericTool (props) {
const style = {paddingTop: '5px', width: '38px', height: '38px'}
return <Icon onClick={props.onClickTool} name={props.content} size='large' style={style} />
}
| Change GenericTool to functional Component | Change GenericTool to functional Component
| JSX | mit | PedDavid/qip,PedDavid/qip,PedDavid/qip | ---
+++
@@ -1,15 +1,8 @@
import React from 'react'
-import {
- Icon
-} from 'semantic-ui-react'
+import { Icon } from 'semantic-ui-react'
-export default class GenericTool extends React.Component {
- render () {
- return (
- <div onClick={this.props.onClickTool} style={{width: '38px', height: '38px'}}>
- <Icon name={this.props.content} size='large' style={{paddingTop: '5px', width: '38px', height: '38px'}} />
- </div>
- )
- }
+export default function GenericTool (props) {
+ const style = {paddingTop: '5px', width: '38px', height: '38px'}
+ return <Icon onClick={props.onClickTool} name={props.content} size='large' style={style} />
} |
56f27b6fa63c5ef23e960eaef6fa07a4c2f463c5 | client/src/components/Header.jsx | client/src/components/Header.jsx | import React from 'react';
class Header extends React.Component {
constructor (props) {
super(props);
}
render() {
return (
<div>
<div className="page-header text-center">
<h1>FoodQuest</h1>
<small>the go-to app for Adventurous Eaters</small>
</div>
</div>
);
}
}
export default Header; | import React from 'react';
class Header extends React.Component {
constructor (props) {
super(props);
}
render() {
return (
<div>
<div className="page-header text-center">
<h1>Food Quest</h1>
<small>the go-to app for Adventurous Eaters</small>
</div>
</div>
);
}
}
export default Header; | Add a space in the name of the app. | Add a space in the name of the app.
| JSX | mit | Sibilant-Siblings/sibilant-siblings,Sibilant-Siblings/sibilant-siblings | ---
+++
@@ -9,7 +9,7 @@
return (
<div>
<div className="page-header text-center">
- <h1>FoodQuest</h1>
+ <h1>Food Quest</h1>
<small>the go-to app for Adventurous Eaters</small>
</div>
</div> |
dda5db611d2b529cc17c3a1ad913f2d3345ef07a | src/pages/_document.jsx | src/pages/_document.jsx | import React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
export default class BaseDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
return initialProps;
}
render() {
// const { dir } = this.props;
// console.log(this.props);
return (
<html lang="en">
<Head>
<link
rel="stylesheet"
type="text/css"
href="/_next/static/style.css"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
}
| import React from 'react';
import Document, { Head, Main, NextScript } from 'next/document';
export default class BaseDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
return initialProps;
}
render() {
const isProduction = process.env.NODE_ENV === 'production';
return (
<html lang="en">
<Head>
{isProduction && (
<link
rel="stylesheet"
type="text/css"
href="/_next/static/style.css"
/>
)}
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
}
| Disable root style.css in non production environment | Disable root style.css in non production environment
| JSX | mit | ArturJS/ArturJS.github.io,ArturJS/ArturJS.github.io | ---
+++
@@ -9,18 +9,18 @@
}
render() {
- // const { dir } = this.props;
-
- // console.log(this.props);
+ const isProduction = process.env.NODE_ENV === 'production';
return (
<html lang="en">
<Head>
- <link
- rel="stylesheet"
- type="text/css"
- href="/_next/static/style.css"
- />
+ {isProduction && (
+ <link
+ rel="stylesheet"
+ type="text/css"
+ href="/_next/static/style.css"
+ />
+ )}
</Head>
<body>
<Main /> |
7b99d781034ebaf9c764bd3a7ba62041e217d339 | sample/parcel/Sample.jsx | sample/parcel/Sample.jsx | import React, { Component } from 'react';
import { Document, Page, setOptions } from 'react-pdf/src/entry.parcel';
import './Sample.less';
import pdfFile from './sample.pdf';
setOptions({
cMapUrl: 'cmaps/',
cMapPacked: true,
});
export default class Sample extends Component {
state = {
file: pdfFile,
numPages: null,
}
onFileChange = (event) => {
this.setState({
file: event.target.files[0],
});
}
onDocumentLoadSuccess = ({ numPages }) =>
this.setState({
numPages,
})
render() {
const { file, numPages } = this.state;
return (
<div className="Example">
<header>
<h1>react-pdf sample page</h1>
</header>
<div className="Example__container">
<div className="Example__container__load">
<label htmlFor="file">Load from file:</label>
<input
type="file"
onChange={this.onFileChange}
/>
</div>
<div className="Example__container__document">
<Document
file={file}
onLoadSuccess={this.onDocumentLoadSuccess}
>
{
Array.from(
new Array(numPages),
(el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
/>
),
)
}
</Document>
</div>
</div>
</div>
);
}
}
| import React, { Component } from 'react';
import { Document, Page, setOptions } from 'react-pdf/dist/entry.parcel';
import './Sample.less';
import pdfFile from './sample.pdf';
setOptions({
cMapUrl: 'cmaps/',
cMapPacked: true,
});
export default class Sample extends Component {
state = {
file: pdfFile,
numPages: null,
}
onFileChange = (event) => {
this.setState({
file: event.target.files[0],
});
}
onDocumentLoadSuccess = ({ numPages }) =>
this.setState({
numPages,
})
render() {
const { file, numPages } = this.state;
return (
<div className="Example">
<header>
<h1>react-pdf sample page</h1>
</header>
<div className="Example__container">
<div className="Example__container__load">
<label htmlFor="file">Load from file:</label>
<input
type="file"
onChange={this.onFileChange}
/>
</div>
<div className="Example__container__document">
<Document
file={file}
onLoadSuccess={this.onDocumentLoadSuccess}
>
{
Array.from(
new Array(numPages),
(el, index) => (
<Page
key={`page_${index + 1}`}
pageNumber={index + 1}
/>
),
)
}
</Document>
</div>
</div>
</div>
);
}
}
| Use compiled entry file for Parcel sample | Use compiled entry file for Parcel sample
| JSX | mit | wojtekmaj/react-pdf,wojtekmaj/react-pdf,wojtekmaj/react-pdf | ---
+++
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import { Document, Page, setOptions } from 'react-pdf/src/entry.parcel';
+import { Document, Page, setOptions } from 'react-pdf/dist/entry.parcel';
import './Sample.less';
|
0f45dd33e0d5f988198f92e1840b89e5adce1d02 | test/components/overview/course_cloned_modal.spec.jsx | test/components/overview/course_cloned_modal.spec.jsx | import React from 'react';
import { mount } from 'enzyme';
import '../../testHelper';
import CourseClonedModal from '../../../app/assets/javascripts/components/overview/course_cloned_modal.jsx';
describe('CourseClonedModal', () => {
const course = {
slug: 'foo/bar_(baz)',
school: 'foo',
term: 'baz',
title: 'bar',
expected_students: 0
};
const TestModal = mount(
<CourseClonedModal
course={course}
/>
);
it('renders a Modal', () => {
const renderedModal = TestModal.find('.cloned-course');
expect(renderedModal).to.have.length(1);
TestModal.setState({ error_message: null });
const warnings = TestModal.find('.warning');
expect(warnings).to.have.length(0);
});
it('renders an error message if state includes one', () => {
TestModal.setState({ error_message: 'test error message' });
const warnings = TestModal.find('.warning');
expect(warnings).not.to.be.empty;
expect(warnings.first().text()).to.eq('test error message');
});
});
| import React from 'react';
import { mount } from 'enzyme';
import '../../testHelper';
import CourseClonedModal from '../../../app/assets/javascripts/components/overview/course_cloned_modal.jsx';
describe('CourseClonedModal', () => {
const course = {
slug: 'foo/bar_(baz)',
school: 'foo',
term: 'baz',
title: 'bar',
expected_students: 0
};
const TestModal = mount(
<CourseClonedModal
course={course}
updateCourse={jest.fn()}
updateClonedCourse={jest.fn()}
/>
);
it('renders a Modal', () => {
const renderedModal = TestModal.find('.cloned-course');
expect(renderedModal).to.have.length(1);
TestModal.setState({ error_message: null });
const warnings = TestModal.find('.warning');
expect(warnings).to.have.length(0);
});
it('renders an error message if state includes one', () => {
TestModal.setState({ error_message: 'test error message' });
const warnings = TestModal.find('.warning');
expect(warnings).not.to.be.empty;
expect(warnings.first().text()).to.eq('test error message');
});
});
| Fix prop warnings in CourseClonedModal test | Fix prop warnings in CourseClonedModal test
| JSX | mit | sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ---
+++
@@ -15,6 +15,8 @@
const TestModal = mount(
<CourseClonedModal
course={course}
+ updateCourse={jest.fn()}
+ updateClonedCourse={jest.fn()}
/>
);
|
d4ac1cdd087b03419327e4647cd6451459c3c93a | webapp/components/Login.jsx | webapp/components/Login.jsx | import React, {Component} from 'react';
import PropTypes from 'prop-types';
import idx from 'idx';
import {connect} from 'react-redux';
import GitHubLoginButton from './GitHubLoginButton';
import Modal from './Modal';
class Login extends Component {
static propTypes = {
isAuthenticated: PropTypes.bool
};
static contextTypes = {
router: PropTypes.object.isRequired
};
componentDidMount() {
if (this.props.isAuthenticated) {
this.context.router.push('/');
}
}
shouldComponentUpdate(nextProps) {
return this.props.isAuthenticated === nextProps.isAuthenticated;
}
componentDidUpdate(nextProps) {
if (nextProps.isAuthenticated) {
this.context.router.push('/');
}
}
render() {
return (
<Modal title="Login">
<p>To continue you will need to first authenticate using your GitHub account.</p>
<p style={{textAlign: 'center'}}>
<GitHubLoginButton next={idx(this.context.router, _ => _.query.next)} />
</p>
<p style={{textAlign: 'center', marginBottom: 0}}>
<small>
Zeus asks for both public and private permissions, however we will never
import any of your code without your explicit consent.
</small>
</p>
</Modal>
);
}
}
export default connect(({auth}) => ({
isAuthenticated: auth.isAuthenticated
}))(Login);
| import React, {Component} from 'react';
import PropTypes from 'prop-types';
import idx from 'idx';
import {connect} from 'react-redux';
import GitHubLoginButton from './GitHubLoginButton';
import Modal from './Modal';
class Login extends Component {
static propTypes = {
isAuthenticated: PropTypes.bool
};
static contextTypes = {
router: PropTypes.object.isRequired
};
componentDidMount() {
if (this.props.isAuthenticated) {
this.context.router.push('/');
}
}
shouldComponentUpdate(nextProps) {
return this.props.isAuthenticated === nextProps.isAuthenticated;
}
componentDidUpdate(nextProps) {
if (nextProps.isAuthenticated) {
this.context.router.push('/');
}
}
render() {
return (
<Modal title="Login">
<p>To continue you will need to first authenticate using your GitHub account.</p>
<p style={{textAlign: 'center'}}>
<GitHubLoginButton
next={idx(this.context.router, _ => _.location.query.next)}
/>
</p>
<p style={{textAlign: 'center', marginBottom: 0}}>
<small>
Zeus asks for both public and private permissions, however we will never
import any of your code without your explicit consent.
</small>
</p>
</Modal>
);
}
}
export default connect(({auth}) => ({
isAuthenticated: auth.isAuthenticated
}))(Login);
| Correct next redirect propagation in login component | fix: Correct next redirect propagation in login component
| JSX | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | ---
+++
@@ -36,7 +36,9 @@
<Modal title="Login">
<p>To continue you will need to first authenticate using your GitHub account.</p>
<p style={{textAlign: 'center'}}>
- <GitHubLoginButton next={idx(this.context.router, _ => _.query.next)} />
+ <GitHubLoginButton
+ next={idx(this.context.router, _ => _.location.query.next)}
+ />
</p>
<p style={{textAlign: 'center', marginBottom: 0}}>
<small> |
8b998de54f6a18116ff6576e755f1de4210cf881 | zucchini-ui-frontend/src/ui/components/RootPage.jsx | zucchini-ui-frontend/src/ui/components/RootPage.jsx | import PropTypes from "prop-types";
import React from "react";
import Navbar from "react-bootstrap/Navbar";
import Nav from "react-bootstrap/Nav";
import Container from "react-bootstrap/Container";
import { Link } from "react-router-dom";
import LoadingIndicator from "../../loadingIndicator/components/LoadingIndicator";
import ErrorAlert from "../../errors/components/ErrorAlert";
import ErrorBarrier from "./ErrorBarrier";
export default function RootPage({ children }) {
return (
<>
<LoadingIndicator />
<Navbar bg="dark" variant="dark" className="mb-4">
<Navbar.Brand as={Link} to="/">
Zucchini UI
</Navbar.Brand>
<Nav className="mr-auto">
<Nav.Item>
<Nav.Link as={Link} to="/">
Derniers tirs
</Nav.Link>
</Nav.Item>
</Nav>
</Navbar>
<Container>
<ErrorBarrier className="my-4" name="Root page">
<ErrorAlert />
{children}
</ErrorBarrier>
</Container>
</>
);
}
RootPage.propTypes = {
children: PropTypes.node
};
| import PropTypes from "prop-types";
import React from "react";
import Navbar from "react-bootstrap/Navbar";
import Nav from "react-bootstrap/Nav";
import Container from "react-bootstrap/Container";
import { Link, NavLink } from "react-router-dom";
import LoadingIndicator from "../../loadingIndicator/components/LoadingIndicator";
import ErrorAlert from "../../errors/components/ErrorAlert";
import ErrorBarrier from "./ErrorBarrier";
export default function RootPage({ children }) {
return (
<>
<LoadingIndicator />
<Navbar bg="dark" variant="dark" className="mb-4">
<Navbar.Brand as={Link} to="/">
Zucchini UI
</Navbar.Brand>
<Nav className="mr-auto">
<Nav.Item>
<Nav.Link as={NavLink} to="/" exact aria-current="true">
Derniers tirs
</Nav.Link>
</Nav.Item>
</Nav>
</Navbar>
<Container>
<ErrorBarrier className="my-4" name="Root page">
<ErrorAlert />
{children}
</ErrorBarrier>
</Container>
</>
);
}
RootPage.propTypes = {
children: PropTypes.node
};
| Use NavLink for current page | Use NavLink for current page
| JSX | mit | pgentile/tests-cucumber,pgentile/zucchini-ui,pgentile/tests-cucumber,pgentile/zucchini-ui,pgentile/zucchini-ui,pgentile/zucchini-ui,pgentile/zucchini-ui,pgentile/tests-cucumber,pgentile/tests-cucumber | ---
+++
@@ -3,7 +3,7 @@
import Navbar from "react-bootstrap/Navbar";
import Nav from "react-bootstrap/Nav";
import Container from "react-bootstrap/Container";
-import { Link } from "react-router-dom";
+import { Link, NavLink } from "react-router-dom";
import LoadingIndicator from "../../loadingIndicator/components/LoadingIndicator";
import ErrorAlert from "../../errors/components/ErrorAlert";
@@ -19,7 +19,7 @@
</Navbar.Brand>
<Nav className="mr-auto">
<Nav.Item>
- <Nav.Link as={Link} to="/">
+ <Nav.Link as={NavLink} to="/" exact aria-current="true">
Derniers tirs
</Nav.Link>
</Nav.Item> |
1df5380c87b0cbcd9b7ba5e0c2f994b835dce661 | client/userlist.jsx | client/userlist.jsx | var React = require('react');
var Avatar = require('./avatar.jsx');
var UserList = React.createClass({
getInitialState() {
return {
users: [],
myUsername: null
};
},
onLogin(myUsername, users) {
this.setState({myUsername, users});
},
onJoin(username) {
if (username != this.state.myUsername) {
var newState = React.addons.update(
this.state, {
users: {
$push: [username]
}
}
);
this.setState(newState);
}
},
onPart(username) {
var newUsers = this.state.users.filter((name) => {
return username != name;
});
this.setState({
users: newUsers
});
},
render() {
var userNodes = this.state.users.map((user) => {
return (
<User username={user} />
);
});
return (
<ul id='online-list'>
<li className='active'><span>ting</span></li>
{userNodes}
</ul>
);
}
});
var User = React.createClass({
render() {
return (
<li>
<Avatar username={this.props.username} />
<span>{this.props.username}</span>
</li>
)
}
});
module.exports = UserList;
| var React = require('react');
var Avatar = require('./avatar.jsx');
var UserList = React.createClass({
getInitialState() {
return {
users: [],
myUsername: null
};
},
onLogin(myUsername, users) {
this.setState({myUsername, users});
},
onJoin(username) {
if (username != this.state.myUsername) {
var newState = React.addons.update(
this.state, {
users: {
$push: [username]
}
}
);
this.setState(newState);
}
},
onPart(username) {
var newUsers = this.state.users.filter((name) => {
return username != name;
});
this.setState({
users: newUsers
});
},
render() {
var userNodes = this.state.users.map((user) => {
return (
<User key={user} username={user} />
);
});
return (
<ul id='online-list'>
<li className='active'><span>ting</span></li>
{userNodes}
</ul>
);
}
});
var User = React.createClass({
render() {
return (
<li>
<Avatar username={this.props.username} />
<span>{this.props.username}</span>
</li>
)
}
});
module.exports = UserList;
| Use keys in user list | Use keys in user list
| JSX | mit | VitSalis/ting,mbalamat/ting,mbalamat/ting,VitSalis/ting,odyvarv/ting-1,dionyziz/ting,VitSalis/ting,dionyziz/ting,dionyziz/ting,odyvarv/ting-1,mbalamat/ting,sirodoht/ting,sirodoht/ting,VitSalis/ting,odyvarv/ting-1,sirodoht/ting,gtklocker/ting,dionyziz/ting,mbalamat/ting,sirodoht/ting,odyvarv/ting-1,gtklocker/ting,gtklocker/ting,gtklocker/ting | ---
+++
@@ -34,7 +34,7 @@
render() {
var userNodes = this.state.users.map((user) => {
return (
- <User username={user} />
+ <User key={user} username={user} />
);
});
|
f350ec07a9c47035dfbc542f3a9f7991cf41e2e7 | src/containers/Root/Routes.jsx | src/containers/Root/Routes.jsx | import React from 'react'
import { Router, Route, Redirect, IndexRoute } from 'react-router'
/* Pages */
import Home from 'pages/Home'
import NotFound from 'pages/NotFound'
export default function Routes({ history }) {
const App = ({ children }) => children
return (
<Router history={ history }>
<Route path="/" component={ App }>
<IndexRoute component={ Home } />
<Redirect from="home" to="/" />
<Route path="*" component={ NotFound } />
</Route>
</Router>
)
}
| import React from 'react'
import { Router, Route, Redirect, IndexRoute } from 'react-router'
/* Pages */
import Home from 'pages/Home'
import NotFound from 'pages/NotFound'
export default function Routes({ history }) {
return (
<Router history={ history }>
<Route path="/">
<IndexRoute component={ Home } />
<Redirect from="home" to="/" />
<Route path="*" component={ NotFound } />
</Route>
</Router>
)
}
| Remove trivial 'App => children' component; Router does this for you. | Remove trivial 'App => children' component; Router does this for you.
| JSX | mit | ADI-Labs/calendar-web,ADI-Labs/calendar-web | ---
+++
@@ -6,10 +6,9 @@
import NotFound from 'pages/NotFound'
export default function Routes({ history }) {
- const App = ({ children }) => children
return (
<Router history={ history }>
- <Route path="/" component={ App }>
+ <Route path="/">
<IndexRoute component={ Home } />
<Redirect from="home" to="/" />
<Route path="*" component={ NotFound } /> |
4ec522e21161c5b01143476b93606b8f38391013 | app-shell-demo/src/components/app.jsx | app-shell-demo/src/components/app.jsx | import React from 'react';
import Footer from './footer';
import Header from './header';
export default class App extends React.Component {
render() {
return (
<div>
<Header/>
{this.props.children}
<Footer/>
</div>
);
}
}
| import React from 'react';
import Footer from './footer';
import Header from './header';
export default class App extends React.Component {
render() {
return (
<div>
{this.props.children}
</div>
);
}
}
| Remove the header/footer for the time being. | Remove the header/footer for the time being.
| JSX | apache-2.0 | marco-c/sw-precache,GoogleChromeLabs/sw-precache,GoogleChromeLabs/sw-precache,marco-c/sw-precache | ---
+++
@@ -7,9 +7,7 @@
render() {
return (
<div>
- <Header/>
{this.props.children}
- <Footer/>
</div>
);
} |
77833e570b394a835b1065200f101c3e88e2345f | client/src/components/CustomizationWidget/index.jsx | client/src/components/CustomizationWidget/index.jsx | import React, { Component } from 'react';
import StickerListContainer from '../../containers/StickerListContainer';
import ProductContainer from '../../containers/ProductContainer';
import Pagination from '../Pagination';
import './CustomizationWidget.scss';
const defaultProps = {
};
class CustomizationWidget extends Component {
render() {
const { onChangeFilter } = this.props;
return (
<div className="container container-product">
<ProductContainer />
<div className="content stickers">
<div className="stickers-search">
<input placeholder="Find stickers" onChange={onChangeFilter}/>
</div>
<StickerListContainer />
<Pagination
totalPages={this.props.totalPages}
onChangePage={this.props.onChangePage}
currentPage={this.props.currentPage}
/>
</div>
</div>
);
}
}
CustomizationWidget.defaultProps = defaultProps;
export default CustomizationWidget;
| import React, { Component } from 'react';
import StickerListContainer from '../../containers/StickerListContainer';
import ProductContainer from '../../containers/ProductContainer';
import Pagination from '../Pagination';
import './CustomizationWidget.scss';
const defaultProps = {
};
class CustomizationWidget extends Component {
render() {
const { onChangeFilter } = this.props;
return (
<div className="container container-product">
<ProductContainer />
<div className="content stickers">
<div className="stickers-search">
<input placeholder="Search stickers" onChange={onChangeFilter}/>
</div>
<StickerListContainer />
<Pagination
totalPages={this.props.totalPages}
onChangePage={this.props.onChangePage}
currentPage={this.props.currentPage}
/>
</div>
</div>
);
}
}
CustomizationWidget.defaultProps = defaultProps;
export default CustomizationWidget;
| Change input placeholder from 'Find Stickers' to 'Search stickers' | Change input placeholder from 'Find Stickers' to 'Search stickers'
| JSX | mit | marlonbernardes/coding-stickers,marlonbernardes/coding-stickers | ---
+++
@@ -17,7 +17,7 @@
<ProductContainer />
<div className="content stickers">
<div className="stickers-search">
- <input placeholder="Find stickers" onChange={onChangeFilter}/>
+ <input placeholder="Search stickers" onChange={onChangeFilter}/>
</div>
<StickerListContainer />
<Pagination |
0e2ee7e8785c10173f492d00f8916ce520bd231f | src/components/SideMenu.jsx | src/components/SideMenu.jsx | import React from 'react';
export default function SideMenu() {
return (
<div className="pane-sm sidebar">
<nav className="nav-group">
<h5 className="nav-group-title">Recent Files</h5>
<span className="nav-group-item">
<span className="icon icon-doc-text" />
file
</span>
<span className="nav-group-item">
<span className="icon icon-doc-text" />
file
</span>
<h5 className="nav-group-title">Files</h5>
<a className="nav-group-item active">
<span className="icon icon-folder" />
directory
</a>
<span className="nav-group-item">
<span className="icon icon-doc-text" />
file
</span>
</nav>
</div>
);
}
| import React from 'react';
export default class SideMenu extends React.Component {
constructor() {
super();
this.state = {
};
}
render() {
return (
<div className="pane-sm sidebar">
<nav className="nav-group">
<h5 className="nav-group-title">Recent Files</h5>
<span className="nav-group-item">
<span className="icon icon-doc-text" />
file
</span>
<span className="nav-group-item">
<span className="icon icon-doc-text" />
file
</span>
<h5 className="nav-group-title">Files</h5>
<a className="nav-group-item active">
<span className="icon icon-folder" />
directory
</a>
<span className="nav-group-item">
<span className="icon icon-doc-text" />
file
</span>
</nav>
</div>
);
}
}
| Change Sidemenu to class from pure function | Change Sidemenu to class from pure function
| JSX | mit | tanaka0325/dropnote,tanaka0325/dropnote | ---
+++
@@ -1,31 +1,39 @@
import React from 'react';
-export default function SideMenu() {
- return (
- <div className="pane-sm sidebar">
+export default class SideMenu extends React.Component {
+ constructor() {
+ super();
+ this.state = {
+ };
+ }
- <nav className="nav-group">
- <h5 className="nav-group-title">Recent Files</h5>
- <span className="nav-group-item">
- <span className="icon icon-doc-text" />
- file
- </span>
- <span className="nav-group-item">
- <span className="icon icon-doc-text" />
- file
- </span>
+ render() {
+ return (
+ <div className="pane-sm sidebar">
- <h5 className="nav-group-title">Files</h5>
- <a className="nav-group-item active">
- <span className="icon icon-folder" />
- directory
- </a>
- <span className="nav-group-item">
- <span className="icon icon-doc-text" />
- file
- </span>
- </nav>
+ <nav className="nav-group">
+ <h5 className="nav-group-title">Recent Files</h5>
+ <span className="nav-group-item">
+ <span className="icon icon-doc-text" />
+ file
+ </span>
+ <span className="nav-group-item">
+ <span className="icon icon-doc-text" />
+ file
+ </span>
- </div>
- );
+ <h5 className="nav-group-title">Files</h5>
+ <a className="nav-group-item active">
+ <span className="icon icon-folder" />
+ directory
+ </a>
+ <span className="nav-group-item">
+ <span className="icon icon-doc-text" />
+ file
+ </span>
+ </nav>
+
+ </div>
+ );
+ }
} |
7aef9152265acda25eabd13d12b002b141620ef0 | src/components/board.jsx | src/components/board.jsx | import React from 'react';
import Tile from './tile';
require('./css/board.css');
export default class Board extends React.Component {
render() {
return (
<div id="board">
{
// Generate tiles for board.
this.props.board.map((index) => {
return (
<Tile/>
);
})
}
</div>
);
}
}
export default class Board extends React.Component {
render() {
return (
<div id="board">
{
// Generate tiles for board.
this.props.board.map((index) => {
return (
<Tile/>
);
})
}
</div>
);
}
} | import React from 'react';
import Tile from './tile';
require('./css/board.css');
export default class Board extends React.Component {
render() {
return (
<div id="board">
{
// Generate tiles for board.
this.props.board.map((index) => {
return (
<Tile/>
);
})
}
</div>
);
}
} | Remove extra declaration of Board. | Remove extra declaration of Board.
| JSX | mit | aelawson/tic_tac_toe,aelawson/tic_tac_toe | ---
+++
@@ -19,20 +19,3 @@
);
}
}
-
-export default class Board extends React.Component {
- render() {
- return (
- <div id="board">
- {
- // Generate tiles for board.
- this.props.board.map((index) => {
- return (
- <Tile/>
- );
- })
- }
- </div>
- );
- }
-} |
eb5e313f0161ff0d10ff7b33ecfacc2ee8167082 | assets-server/components/shared/header.jsx | assets-server/components/shared/header.jsx | import React from 'react/addons';
import Styles from 'react-style';
const styles = Styles.create({
contStyle : {
padding : '8px 0 0 0',
maxWidth : '1218px',
margin : '0 auto'
}
});
export default class Header extends React.Component {
constructor(props) {
super(props);
},
render() {
const { heading } = this.props,
{ contStyle } = this.styles;
return (
<header {...this.props}>
<div className="container" styles={[contStyle]}>
<h2>{heading}</h2>
</div>
</header>
);
}
}; | import React from 'react/addons';
import InlineStyles from 'react-style';
const is = InlineStyles.create({
isContainer : {
padding : '8px 0 0 0',
maxWidth : '1218px',
margin : '0 auto'
}
});
export default class Header extends React.Component {
constructor(props) {
super(props);
},
render() {
const { heading } = this.props,
{ isContainer } = this.styles;
return (
<header {...this.props}>
<div className="container" styles={[isContainer]}>
<h2>{heading}</h2>
</div>
</header>
);
}
}; | Change name of inline styles variable | Change name of inline styles variable
| JSX | mit | renemonroy/es6-scaffold,renemonroy/es6-scaffold | ---
+++
@@ -1,8 +1,8 @@
import React from 'react/addons';
-import Styles from 'react-style';
+import InlineStyles from 'react-style';
-const styles = Styles.create({
- contStyle : {
+const is = InlineStyles.create({
+ isContainer : {
padding : '8px 0 0 0',
maxWidth : '1218px',
margin : '0 auto'
@@ -15,10 +15,10 @@
},
render() {
const { heading } = this.props,
- { contStyle } = this.styles;
+ { isContainer } = this.styles;
return (
<header {...this.props}>
- <div className="container" styles={[contStyle]}>
+ <div className="container" styles={[isContainer]}>
<h2>{heading}</h2>
</div>
</header> |
4d8f25c854c36d90dbfc486c5c4cfbabf29fb7b2 | src/js/components/SharedComponents/DiscreteProgressBarComponent.jsx | src/js/components/SharedComponents/DiscreteProgressBarComponent.jsx | /**
* DiscreteProgressBarComponent.jsx
* Created by Katie Rose 12/17/15
**/
import React, { PropTypes } from 'react';
const propTypes = {
progressCurrentStep: PropTypes.Number,
progressTotalSteps: PropTypes.Number
};
// to do: complete implementation of inputLength prop
const defaultProps = {
progressCurrentStep: 1,
progressTotalSteps: 4
};
// A standard text input for submission that we can further turn into a sharable component
export default class DiscreteProgressBar extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="usa-da-discrete-progress usa-grid-full usa-color-text-white">
<div className="usa-da-progress-step usa-da-progress-one-fourth"><span>1</span></div>
<div className="usa-da-progress-step usa-da-progress-one-fourth"><span>2</span></div>
<div className="usa-da-progress-step usa-da-progress-one-fourth usa-da-progress-current"><span>3</span></div>
<div className="usa-da-progress-step usa-da-progress-one-fourth"><span>4</span></div>
</div>
);
}
}
DiscreteProgressBar.propTypes = propTypes;
DiscreteProgressBar.defaultProps = defaultProps; | /**
* DiscreteProgressBarComponent.jsx
* Created by Katie Rose 12/17/15
**/
import React, { PropTypes } from 'react';
const propTypes = {
progressCurrentStep: PropTypes.Number,
progressTotalSteps: PropTypes.Number
};
// to do: complete implementation of inputLength prop
const defaultProps = {
progressCurrentStep: 1,
progressTotalSteps: 4
};
// A standard text input for submission that we can further turn into a sharable component
export default class DiscreteProgressBar extends React.Component {
constructor(props) {
super(props);
}
render() {
var progress = [];
for (var i = 0; i < this.props.progressTotalSteps; i++){
if ((i+1) == this.props.progressCurrentStep)
progress.push(<div className="usa-da-progress-step usa-da-progress-one-fourth usa-da-progress-current"><span>{i+1}</span></div>);
else
progress.push(<div className="usa-da-progress-step usa-da-progress-one-fourth"><span>{i+1}</span></div>);
}
return (
<div className="usa-da-discrete-progress usa-grid-full usa-color-text-white">
{progress}
</div>
);
}
}
DiscreteProgressBar.propTypes = propTypes;
DiscreteProgressBar.defaultProps = defaultProps; | Set progress bar to use passed variables | Set progress bar to use passed variables
| JSX | cc0-1.0 | fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app | ---
+++
@@ -25,12 +25,18 @@
}
render() {
+ var progress = [];
+
+ for (var i = 0; i < this.props.progressTotalSteps; i++){
+ if ((i+1) == this.props.progressCurrentStep)
+ progress.push(<div className="usa-da-progress-step usa-da-progress-one-fourth usa-da-progress-current"><span>{i+1}</span></div>);
+ else
+ progress.push(<div className="usa-da-progress-step usa-da-progress-one-fourth"><span>{i+1}</span></div>);
+
+ }
return (
<div className="usa-da-discrete-progress usa-grid-full usa-color-text-white">
- <div className="usa-da-progress-step usa-da-progress-one-fourth"><span>1</span></div>
- <div className="usa-da-progress-step usa-da-progress-one-fourth"><span>2</span></div>
- <div className="usa-da-progress-step usa-da-progress-one-fourth usa-da-progress-current"><span>3</span></div>
- <div className="usa-da-progress-step usa-da-progress-one-fourth"><span>4</span></div>
+ {progress}
</div>
);
} |
3bc0d08f020a55d2a135082af86982d23e52071d | src/request/components/request-entry-list-item-view.jsx | src/request/components/request-entry-list-item-view.jsx | var React = require('react'),
Timeago = require('../../lib/components/timeago.jsx');
module.exports = React.createClass({
render: function() {
var entry = this.props.entry;
return (
<div className="request-entry-item-holder">
<table className="table table-bordered">
<tr>
<td width="90">{entry.duration}ms</td>
<td colSpan="6">
{entry.uri} {entry.method} {entry.statusCode} ({entry.statusText}) - {entry.contentType}
</td>
<td><Timeago time={entry.dateTime} /></td>
</tr>
<tr>
<td>{entry.user.name}</td>
<td>{entry.summary.networkTime}ms</td>
<td>{entry.summary.serverTime}ms</td>
<td>{entry.summary.clientTime}ms</td>
<td>{entry.summary.controller}.{entry.summary.action}(...)</td>
<td>{entry.summary.actionTime}ms</td>
<td>{entry.summary.viewTime}ms</td>
<td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td>
</tr>
</table>
</div>
);
}
});
| var glimpse = require('glimpse'),
React = require('react'),
Timeago = require('../../lib/components/timeago.jsx');
module.exports = React.createClass({
render: function() {
var entry = this.props.entry;
return (
<div className="request-entry-item-holder" onClick={this.onSelect}>
<table className="table table-bordered">
<tr>
<td width="90">{entry.duration}ms</td>
<td colSpan="6">
{entry.uri} {entry.method} {entry.statusCode} ({entry.statusText}) - {entry.contentType}
</td>
<td><Timeago time={entry.dateTime} /></td>
</tr>
<tr>
<td>{entry.user.name}</td>
<td>{entry.summary.networkTime}ms</td>
<td>{entry.summary.serverTime}ms</td>
<td>{entry.summary.clientTime}ms</td>
<td>{entry.summary.controller}.{entry.summary.action}(...)</td>
<td>{entry.summary.actionTime}ms</td>
<td>{entry.summary.viewTime}ms</td>
<td>{entry.summary.queryTime}ms / {entry.summary.queryCount}</td>
</tr>
</table>
</div>
);
},
onSelect: function() {
glimpse.emit('shell.request.detail.requested', { id: this.props.entry.id });
}
});
| Add click event for when a request is selected | Add click event for when a request is selected
| JSX | unknown | avanderhoorn/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype | ---
+++
@@ -1,11 +1,12 @@
-var React = require('react'),
+var glimpse = require('glimpse'),
+ React = require('react'),
Timeago = require('../../lib/components/timeago.jsx');
module.exports = React.createClass({
render: function() {
var entry = this.props.entry;
return (
- <div className="request-entry-item-holder">
+ <div className="request-entry-item-holder" onClick={this.onSelect}>
<table className="table table-bordered">
<tr>
<td width="90">{entry.duration}ms</td>
@@ -27,5 +28,8 @@
</table>
</div>
);
+ },
+ onSelect: function() {
+ glimpse.emit('shell.request.detail.requested', { id: this.props.entry.id });
}
}); |
20059eae8851834ca16414a0ba4c8528bdd0e834 | packages/lesswrong/components/common/DraftJSRenderer.jsx | packages/lesswrong/components/common/DraftJSRenderer.jsx | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { registerComponent, Components, Utils } from 'meteor/vulcan:core';
import { convertFromRaw } from 'draft-js';
class DraftJSRenderer extends PureComponent {
render() {
let htmlBody = {__html: "<span>No description</span>"}
try {
const contentState = convertFromRaw(this.props.content);
htmlBody = {__html: Utils.draftToHTML(contentState)};
} catch(err) {
//eslint-disable-next-line no-console
console.error("invalid draftContentState", this.props.content);
}
return <div dangerouslySetInnerHTML={htmlBody}/>
}
}
DraftJSRenderer.propTypes = {
content: PropTypes.object.isRequired,
}
registerComponent("DraftJSRenderer", DraftJSRenderer);
| import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { registerComponent, Components } from 'meteor/vulcan:core';
import { convertFromRaw } from 'draft-js';
import { draftToHTML } from '../../lib/editor/utils.js'
class DraftJSRenderer extends PureComponent {
render() {
let htmlBody = {__html: "<span>No description</span>"}
try {
const contentState = convertFromRaw(this.props.content);
htmlBody = {__html: draftToHTML(contentState)};
} catch(err) {
//eslint-disable-next-line no-console
console.error("invalid draftContentState", this.props.content);
}
return <div dangerouslySetInnerHTML={htmlBody}/>
}
}
DraftJSRenderer.propTypes = {
content: PropTypes.object.isRequired,
}
registerComponent("DraftJSRenderer", DraftJSRenderer);
| Change import of draft-js renderer | Change import of draft-js renderer
| JSX | mit | Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2 | ---
+++
@@ -1,14 +1,15 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
-import { registerComponent, Components, Utils } from 'meteor/vulcan:core';
+import { registerComponent, Components } from 'meteor/vulcan:core';
import { convertFromRaw } from 'draft-js';
+import { draftToHTML } from '../../lib/editor/utils.js'
class DraftJSRenderer extends PureComponent {
render() {
let htmlBody = {__html: "<span>No description</span>"}
try {
const contentState = convertFromRaw(this.props.content);
- htmlBody = {__html: Utils.draftToHTML(contentState)};
+ htmlBody = {__html: draftToHTML(contentState)};
} catch(err) {
//eslint-disable-next-line no-console
console.error("invalid draftContentState", this.props.content); |
b61da859d723e85035ae7425e5cdb27f72703b1e | src/js/components/App.jsx | src/js/components/App.jsx | import React from 'react';
import Header from './Header.jsx';
import DateHeader from './DateHeader.jsx';
import Diary from './Diary.jsx';
import TasksContainer from '../containers/TasksContainer.jsx';
import Utils from '../utils.js';
export default class App extends React.Component {
constructor(props) {
super(props);
const today = new Date();
this.state = {
date: `${today.getFullYear()}-\
${Utils.paddingZero(today.getMonth() + 1)}-\
${Utils.paddingZero(today.getDate())}`.replace(/\s/g, ''),
};
}
render() {
return (
<div>
<Header />
<DateHeader />
<div className="section">
<div className="columns">
<TasksContainer date={this.state.date} />
<Diary date={this.state.date} />
</div>
</div>
</div>
);
}
}
| import React from 'react';
import Header from './Header.jsx';
import DateHeader from './DateHeader.jsx';
import Diary from './Diary.jsx';
import TasksContainer from '../containers/TasksContainer.jsx';
import Utils from '../utils.js';
export default class App extends React.Component {
constructor(props) {
super(props);
const today = new Date();
this.state = {
date: today,
};
}
render() {
return (
<div>
<Header />
<DateHeader />
<div className="section">
<div className="columns">
<TasksContainer date={Utils.formatDate(this.state.date)} />
<Diary date={Utils.formatDate(this.state.date)} />
</div>
</div>
</div>
);
}
}
| Change date state from string to date | Change date state from string to date
| JSX | mit | tanaka0325/nippo-web,tanaka0325/nippo-web | ---
+++
@@ -13,9 +13,7 @@
const today = new Date();
this.state = {
- date: `${today.getFullYear()}-\
- ${Utils.paddingZero(today.getMonth() + 1)}-\
- ${Utils.paddingZero(today.getDate())}`.replace(/\s/g, ''),
+ date: today,
};
}
@@ -26,8 +24,8 @@
<DateHeader />
<div className="section">
<div className="columns">
- <TasksContainer date={this.state.date} />
- <Diary date={this.state.date} />
+ <TasksContainer date={Utils.formatDate(this.state.date)} />
+ <Diary date={Utils.formatDate(this.state.date)} />
</div>
</div>
</div> |
28414a516775c9f7d6d1daf6cc92c9f084df4e9e | src/ui/component/fileActions/view.jsx | src/ui/component/fileActions/view.jsx | // @flow
import * as MODALS from 'constants/modal_types';
import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button';
import Tooltip from 'component/common/tooltip';
type Props = {
uri: string,
claimId: string,
openModal: (id: string, { uri: string }) => void,
claimIsMine: boolean,
fileInfo: FileListItem,
};
class FileActions extends React.PureComponent<Props> {
render() {
const { fileInfo, uri, openModal, claimIsMine, claimId } = this.props;
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
return (
<React.Fragment>
{showDelete && (
<Tooltip label={__('Remove from your library')}>
<Button
button="link"
icon={ICONS.DELETE}
description={__('Delete')}
onClick={() => openModal(MODALS.CONFIRM_FILE_REMOVE, { uri })}
/>
</Tooltip>
)}
{!claimIsMine && (
<Tooltip label={__('Report content')}>
<Button button="link" icon={ICONS.REPORT} href={`https://lbry.com/dmca?claim_id=${claimId}`} />
</Tooltip>
)}
</React.Fragment>
);
}
}
export default FileActions;
| // @flow
import * as MODALS from 'constants/modal_types';
import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button';
import Tooltip from 'component/common/tooltip';
type Props = {
uri: string,
claimId: string,
openModal: (id: string, { uri: string }) => void,
claimIsMine: boolean,
fileInfo: FileListItem,
};
class FileActions extends React.PureComponent<Props> {
render() {
const { fileInfo, uri, openModal, claimIsMine, claimId } = this.props;
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
return (
<React.Fragment>
{showDelete && (
<Tooltip label={__('Remove from your library')}>
<Button
button="link"
icon={ICONS.DELETE}
description={__('Delete')}
onClick={() => openModal(MODALS.CONFIRM_FILE_REMOVE, { uri })}
/>
</Tooltip>
)}
{!claimIsMine && (
<Tooltip label={__('Report content')}>
<Button button="link" icon={ICONS.REPORT} href={`https://lbry.com/dmca/${claimId}`} />
</Tooltip>
)}
</React.Fragment>
);
}
}
export default FileActions;
| Fix report button to use new route | Fix report button to use new route
New route: https://lbry.com/dmca/116d62d14d8efc311e1f8a9de92dcbc17deb259a | JSX | mit | lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron | ---
+++
@@ -31,7 +31,7 @@
)}
{!claimIsMine && (
<Tooltip label={__('Report content')}>
- <Button button="link" icon={ICONS.REPORT} href={`https://lbry.com/dmca?claim_id=${claimId}`} />
+ <Button button="link" icon={ICONS.REPORT} href={`https://lbry.com/dmca/${claimId}`} />
</Tooltip>
)}
</React.Fragment> |
7e2100f3807749e154f60d9dc313d41c5de23052 | client/components/App.jsx | client/components/App.jsx | import React from 'react';
export default class App extends React.Component {
render() {
return <h1>sdsdasdasdsdsdasd</h1>
}
}
| import React from 'react';
export default class App extends React.Component {
render() {
return (
<p>
Lo there, do I see my father, <br />
Lo there, do I see my mother, my sisters and brothers, <br />
Lo there, do I see the line of my people, back to the beginning, <br />
Lo, they do call to me, they bid me take my place among them, <br />
In the halls of Valhalla where the brave may code forever.
</p>
)
}
}
| Add the necessary welcome text | Add the necessary welcome text
| JSX | mit | vikingsofcode/react-project-template | ---
+++
@@ -2,6 +2,14 @@
export default class App extends React.Component {
render() {
- return <h1>sdsdasdasdsdsdasd</h1>
+ return (
+ <p>
+ Lo there, do I see my father, <br />
+ Lo there, do I see my mother, my sisters and brothers, <br />
+ Lo there, do I see the line of my people, back to the beginning, <br />
+ Lo, they do call to me, they bid me take my place among them, <br />
+ In the halls of Valhalla where the brave may code forever.
+ </p>
+ )
}
} |
7160b6219896cd140876f699724e81bdafeef067 | src/index.jsx | src/index.jsx | import {DelegateContainer} from 'preact-delegate'
import {h, render} from 'preact'
import {Provider} from 'preact-redux'
import {BrowserRouter} from 'react-router-dom'
import {createStore} from 'redux'
import {reducer} from './reducer/index'
import '../styles/styles.css'
import {App} from './app'
const store = createStore(reducer)
function Root() {
return (
<Provider store={store}>
<DelegateContainer>
<BrowserRouter>
<App />
</BrowserRouter>
</DelegateContainer>
</Provider>
)
}
render(<Root />, document.body)
const spinner = document.querySelector('.splash')
document.body.removeChild(spinner)
| import {DelegateContainer} from 'preact-delegate'
import {h, render} from 'preact'
import {Provider} from 'preact-redux'
import {BrowserRouter} from 'react-router-dom'
import {createStore} from 'redux'
import {reducer} from './reducer/index'
import '../styles/styles.css'
import {App} from './app'
const store = createStore(reducer)
function Root() {
return (
<Provider store={store}>
<DelegateContainer>
<BrowserRouter>
<App />
</BrowserRouter>
</DelegateContainer>
</Provider>
)
}
render(<Root />, document.body)
const spinner = document.querySelector('.splash')
document.body.removeChild(spinner)
if (process.env.NODE_ENV !== 'production') {
require('preact/devtools')
}
| Add react dev tools support | Add react dev tools support
| JSX | mit | Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc | ---
+++
@@ -24,3 +24,7 @@
render(<Root />, document.body)
const spinner = document.querySelector('.splash')
document.body.removeChild(spinner)
+
+if (process.env.NODE_ENV !== 'production') {
+ require('preact/devtools')
+} |
2070d618f2ef62b72933474c2ca8e6d1450d718a | src/components/notes/Note.jsx | src/components/notes/Note.jsx | import React from 'react';
import './Note.scss';
import noteRepository from '../../data/NoteRepository';
export default class Note extends React.Component {
remove() {
noteRepository.remove(this.props, err => {
// TODO: inform user
if (err) throw err;
});
}
render() {
// console.log(this.props);
return (
<div className="note">
<h1>{this.props.title}</h1>
<pre>{this.props.content}</pre>
<button type="button" onClick={() => this.remove()}>
<i className="fa fa-trash-o" aria-hidden></i>
</button>
<button className="edit" type="button">
<i className="fa fa-pencil" aria-hidden></i>
</button>
</div>
);
}
}
| import React from 'react';
import './Note.scss';
import noteRepository from '../../data/NoteRepository';
export default class Note extends React.Component {
remove() {
noteRepository.remove(this.props, err => {
// TODO: inform user
if (err) throw err;
});
}
render() {
// console.log(this.props);
return (
<div className="note">
<h1>{this.props.title}</h1>
<pre>{this.props.content}</pre>
<button type="button" onClick={() => this.remove()}>
<i className="fa fa-trash-o" aria-hidden></i>
</button>
<button className="edit" type="button">
<i className="fa fa-pencil" aria-hidden></i>
</button>
</div>
);
}
}
// export default function Note({ title, content }) {
// const remove = () => {
// console.log('hi');
// }
//
// return (
// <div className="note">
// <h1>{title}</h1>
// <pre>{content}</pre>
// <button type="button" onClick={remove()}>
// <i className="fa fa-trash-o" aria-hidden></i>
// </button>
// <button className="edit" type="button">
// <i className="fa fa-pencil" aria-hidden></i>
// </button>
// </div>
// );
// }
| Comment out stateless function component | Comment out stateless function component
| JSX | mit | emyarod/refuge,emyarod/refuge | ---
+++
@@ -26,3 +26,22 @@
);
}
}
+
+// export default function Note({ title, content }) {
+// const remove = () => {
+// console.log('hi');
+// }
+//
+// return (
+// <div className="note">
+// <h1>{title}</h1>
+// <pre>{content}</pre>
+// <button type="button" onClick={remove()}>
+// <i className="fa fa-trash-o" aria-hidden></i>
+// </button>
+// <button className="edit" type="button">
+// <i className="fa fa-pencil" aria-hidden></i>
+// </button>
+// </div>
+// );
+// } |
ca6a4973688d84be1396a75ae83ea278296e01ac | src/app/elements/ContentHtml/index.jsx | src/app/elements/ContentHtml/index.jsx | /* eslint-disable react/no-danger */
import React from 'react';
import cheerio from 'cheerio';
import CaptureLinks from '../CaptureLinks';
import * as libs from '../../libs';
const ContentHtml = ({ html, linksColor }) => {
const $ = cheerio.load(html);
$('a').attr('style', `color: ${libs.darkenColor(linksColor)};`).attr('target', '_blank');
return (
<CaptureLinks>
<div
style={{ overflow: 'hidden' }}
className="content is-medium"
dangerouslySetInnerHTML={{ __html: $.html() }}
/>
</CaptureLinks>
);
};
ContentHtml.propTypes = {
html: React.PropTypes.string,
linksColor: React.PropTypes.string,
};
export default ContentHtml;
| /* eslint-disable react/no-danger, no-undef */
import React from 'react';
import cheerio from 'cheerio';
import CaptureLinks from '../CaptureLinks';
import * as libs from '../../libs';
const ContentHtml = ({ html, linksColor }) => {
const $ = cheerio.load(html);
$('a').attr('style', `color: ${libs.darkenColor(linksColor)};`).attr('target', '_blank');
$('img').each((i, e) => {
const src = $(e).attr('src');
const srcset = $(e).attr('srcset');
if (src.startsWith('http://') && window.location.protocol === 'https:') {
$(e).attr('src', `https://cors.worona.io/${src}`);
$(e).attr('srcset', srcset.replace(/http:\/\//g, 'https://cors.worona.io/http://'));
}
});
return (
<CaptureLinks>
<div
style={{ overflow: 'hidden' }}
className="content is-medium"
dangerouslySetInnerHTML={{ __html: $.html() }}
/>
</CaptureLinks>
);
};
ContentHtml.propTypes = {
html: React.PropTypes.string,
linksColor: React.PropTypes.string,
};
export default ContentHtml;
| Add cors if protocol is https | Add cors if protocol is https
| JSX | mit | worona/starter-pro-app-theme-worona | ---
+++
@@ -1,4 +1,4 @@
-/* eslint-disable react/no-danger */
+/* eslint-disable react/no-danger, no-undef */
import React from 'react';
import cheerio from 'cheerio';
import CaptureLinks from '../CaptureLinks';
@@ -7,6 +7,14 @@
const ContentHtml = ({ html, linksColor }) => {
const $ = cheerio.load(html);
$('a').attr('style', `color: ${libs.darkenColor(linksColor)};`).attr('target', '_blank');
+ $('img').each((i, e) => {
+ const src = $(e).attr('src');
+ const srcset = $(e).attr('srcset');
+ if (src.startsWith('http://') && window.location.protocol === 'https:') {
+ $(e).attr('src', `https://cors.worona.io/${src}`);
+ $(e).attr('srcset', srcset.replace(/http:\/\//g, 'https://cors.worona.io/http://'));
+ }
+ });
return (
<CaptureLinks>
<div |
cf1d452ef7d4f4dab2edd1aab374679944a6b162 | apps/gort/src/components/broadcasts/BroadcastCreate.jsx | apps/gort/src/components/broadcasts/BroadcastCreate.jsx |
import React from "react";
import SK from "../../SK";
import SKField from "../SKField";
export default class BroadcastCreate extends React.Component{
constructor(params) {
super(params);
this.state = {};
}
reset() {
this.setState({
newBroadcast: {
title: "",
url: "",
enabled: false,
outputIds: [],
}
});
}
handleSubmit(e) {
e.preventDefault();
SK.broadcasts.create(this.state.newBroadcast);
this.reset();
}
handleChange(newBroadcast) {
this.setState({newBroadcast});
}
render() {
return (
<form className="pure-form" onSubmit={this.handleSubmit.bind(this)}>
<fieldset>
<em>Add a broadcast</em>
<SKField type="text" data={this.state.newBroadcast} onChange={this.handleChange.bind(this)} placeholder="Best Broadcast Ever" label="Title" field="title" />
<button type="submit" className="pure-button pure-button-primary">Create</button>
</fieldset>
</form>
);
}
}
|
import React from "react";
import SK from "../../SK";
import SKField from "../SKField";
export default class BroadcastCreate extends React.Component{
constructor(params) {
super(params);
this.state = {};
this.reset();
}
reset() {
this.setState({
newBroadcast: {
title: "",
url: "",
enabled: false,
outputIds: [],
}
});
}
handleSubmit(e) {
e.preventDefault();
SK.broadcasts.create(this.state.newBroadcast);
this.reset();
}
handleChange(newBroadcast) {
this.setState({newBroadcast});
}
render() {
return (
<form className="pure-form" onSubmit={this.handleSubmit.bind(this)}>
<fieldset>
<em>Add a broadcast</em>
<SKField type="text" data={this.state.newBroadcast} onChange={this.handleChange.bind(this)} placeholder="Best Broadcast Ever" label="Title" field="title" />
<button type="submit" className="pure-button pure-button-primary">Create</button>
</fieldset>
</form>
);
}
}
| Fix broadcast creation default fields | Fix broadcast creation default fields
| JSX | apache-2.0 | streamkitchen/streamkitchen,streamplace/streamplace,streamkitchen/streamkitchen,streamplace/streamplace,streamplace/streamplace,streamkitchen/streamkitchen | ---
+++
@@ -8,6 +8,7 @@
constructor(params) {
super(params);
this.state = {};
+ this.reset();
}
reset() { |
e4d8f3d06c2591a00fe95bda02fd257db4f9a2d5 | src/sentry/static/sentry/app/views/groupDetails/seenBy.jsx | src/sentry/static/sentry/app/views/groupDetails/seenBy.jsx | /*** @jsx React.DOM */
var React = require("react");
var Gravatar = require("../../components/gravatar");
var GroupState = require("../../mixins/groupState");
var GroupSeenBy = React.createClass({
mixins: [GroupState],
render() {
var group = this.getGroup();
var seenByNodes = group.seenBy.map((user, userIdx) => {
return (
<li key={userIdx}>
<Gravatar size={52} email={user.email} />
</li>
);
});
if (!seenByNodes) {
return <div />;
}
return (
<div className="seen-by">
<ul>
<li><span className="icon-eye"></span> 23</li>
{seenByNodes}
</ul>
</div>
);
}
});
module.exports = GroupSeenBy;
| /*** @jsx React.DOM */
var React = require("react");
var Gravatar = require("../../components/gravatar");
var GroupState = require("../../mixins/groupState");
var GroupSeenBy = React.createClass({
mixins: [GroupState],
render() {
var group = this.getGroup();
var seenByNodes = group.seenBy.map((user, userIdx) => {
return (
<li key={userIdx}>
<Gravatar size={52} email={user.email} />
</li>
);
});
if (!seenByNodes) {
return <div />;
}
return (
<div className="seen-by">
<ul>
<li><span className="icon-eye" /></li>
{seenByNodes}
</ul>
</div>
);
}
});
module.exports = GroupSeenBy;
| Remove count from seen by | Remove count from seen by
| JSX | bsd-3-clause | zenefits/sentry,daevaorn/sentry,mitsuhiko/sentry,wong2/sentry,ifduyue/sentry,fuziontech/sentry,mvaled/sentry,gencer/sentry,JackDanger/sentry,hongliang5623/sentry,nicholasserra/sentry,korealerts1/sentry,mitsuhiko/sentry,imankulov/sentry,hongliang5623/sentry,JackDanger/sentry,BayanGroup/sentry,gencer/sentry,daevaorn/sentry,zenefits/sentry,BuildingLink/sentry,songyi199111/sentry,BuildingLink/sentry,wong2/sentry,felixbuenemann/sentry,looker/sentry,jean/sentry,BayanGroup/sentry,gencer/sentry,zenefits/sentry,JamesMura/sentry,songyi199111/sentry,fotinakis/sentry,jean/sentry,looker/sentry,ifduyue/sentry,alexm92/sentry,Kryz/sentry,ngonzalvez/sentry,ngonzalvez/sentry,felixbuenemann/sentry,Kryz/sentry,nicholasserra/sentry,beeftornado/sentry,ifduyue/sentry,Kryz/sentry,BuildingLink/sentry,fuziontech/sentry,zenefits/sentry,ngonzalvez/sentry,daevaorn/sentry,alexm92/sentry,Natim/sentry,hongliang5623/sentry,ifduyue/sentry,fotinakis/sentry,looker/sentry,gencer/sentry,korealerts1/sentry,mvaled/sentry,songyi199111/sentry,fotinakis/sentry,kevinlondon/sentry,zenefits/sentry,JamesMura/sentry,daevaorn/sentry,jean/sentry,mvaled/sentry,imankulov/sentry,jean/sentry,JamesMura/sentry,JamesMura/sentry,wong2/sentry,nicholasserra/sentry,mvaled/sentry,kevinlondon/sentry,fotinakis/sentry,jean/sentry,Natim/sentry,BayanGroup/sentry,ifduyue/sentry,kevinlondon/sentry,korealerts1/sentry,felixbuenemann/sentry,JamesMura/sentry,Natim/sentry,beeftornado/sentry,looker/sentry,JackDanger/sentry,BuildingLink/sentry,fuziontech/sentry,mvaled/sentry,looker/sentry,mvaled/sentry,gencer/sentry,BuildingLink/sentry,alexm92/sentry,beeftornado/sentry,imankulov/sentry | ---
+++
@@ -26,7 +26,7 @@
return (
<div className="seen-by">
<ul>
- <li><span className="icon-eye"></span> 23</li>
+ <li><span className="icon-eye" /></li>
{seenByNodes}
</ul>
</div> |
0919b897f518f8ea5c2026c1a168d1288e4344a1 | app/app/components/home/Home.jsx | app/app/components/home/Home.jsx | import React from 'react'
import UnregisteredHome from './UnregisteredHome.jsx'
export default class Home extends React.Component {
render(){
return (
<UnregisteredHome />
)
}
} | import React from 'react'
import UnregisteredHome from './UnregisteredHome.jsx'
import RegisteredUserHome from './RegisteredUserHome.jsx'
import auth from '../../utils/auth.jsx'
export default class Home extends React.Component {
constructor(){
super();
this.state = {
user: null
}
}
componentWillMount(){
if (auth.loggedIn()){
auth.getUser(localStorage.id).then((res) => {
this.setState({user: res.data.user})
})
}
}
render(){
if (auth.loggedIn()){
return (
<RegisteredUserHome user={this.user} />
)
} else {
return (
<UnregisteredHome />
)
}
}
} | Refactor for registered and unregistered users | Refactor for registered and unregistered users
| JSX | mit | taodav/MicroSerfs,taodav/MicroSerfs | ---
+++
@@ -1,10 +1,31 @@
import React from 'react'
import UnregisteredHome from './UnregisteredHome.jsx'
+import RegisteredUserHome from './RegisteredUserHome.jsx'
+import auth from '../../utils/auth.jsx'
export default class Home extends React.Component {
+ constructor(){
+ super();
+ this.state = {
+ user: null
+ }
+ }
+ componentWillMount(){
+ if (auth.loggedIn()){
+ auth.getUser(localStorage.id).then((res) => {
+ this.setState({user: res.data.user})
+ })
+ }
+ }
render(){
- return (
- <UnregisteredHome />
- )
+ if (auth.loggedIn()){
+ return (
+ <RegisteredUserHome user={this.user} />
+ )
+ } else {
+ return (
+ <UnregisteredHome />
+ )
+ }
}
} |
2849d9b281e1a5222a36859fa51696f2ffc605cb | src/components/ProtectedRoute/index.jsx | src/components/ProtectedRoute/index.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { Route, Redirect } from 'react-router-dom';
class ProtectedRoute extends React.PureComponent {
render() {
const { component: Component, ...rest } = this.props;
return (
<Route
{...rest}
render={props => (
localStorage.monzo_access_token ? (
<Component {...props} />
) : (
<Redirect
to={{
pathname: '/login',
state: { from: props.location },
}}
/>
)
)}
/>
);
}
}
ProtectedRoute.propTypes = {
component: PropTypes.func.isRequired,
};
export default ProtectedRoute;
| import React from 'react';
import PropTypes from 'prop-types';
import { Route, Redirect } from 'react-router-dom';
class ProtectedRoute extends React.Component {
render() {
const { component: Component, ...rest } = this.props;
return (
<Route
{...rest}
render={props => (
localStorage.monzo_access_token ? (
<Component {...props} />
) : (
<Redirect
to={{
pathname: '/login',
state: { from: props.location },
}}
/>
)
)}
/>
);
}
}
ProtectedRoute.propTypes = {
component: PropTypes.func.isRequired,
};
export default ProtectedRoute;
| Fix protected route not having lifecycle events | fix(routing): Fix protected route not having lifecycle events
| JSX | mit | robcalcroft/mondoweb,robcalcroft/mondoweb,robcalcroft/monzoweb,robcalcroft/monzoweb | ---
+++
@@ -2,7 +2,7 @@
import PropTypes from 'prop-types';
import { Route, Redirect } from 'react-router-dom';
-class ProtectedRoute extends React.PureComponent {
+class ProtectedRoute extends React.Component {
render() {
const { component: Component, ...rest } = this.props;
|
0b1d73a954a0e231e5697e5ab46826b838d3dd27 | app/assets/javascripts/components/common/ArticleViewer/components/ParsedArticle.jsx | app/assets/javascripts/components/common/ArticleViewer/components/ParsedArticle.jsx | import React from 'react';
import PropTypes from 'prop-types';
export const ParsedArticle = ({ highlightedHtml, whocolorHtml, parsedArticle }) => {
const articleHTML = highlightedHtml || whocolorHtml || parsedArticle;
return (
<div className="parsed-article" dangerouslySetInnerHTML={{ __html: articleHTML }} />
);
};
ParsedArticle.propTypes = {
highlightedHtml: PropTypes.string,
whocolorHtml: PropTypes.string,
parsedArticle: PropTypes.string
};
export default ParsedArticle;
| import React from 'react';
import PropTypes from 'prop-types';
const wikilinkMatcher = new RegExp('<a href=', 'g');
const blankTargetLink = '<a target="_blank" href=';
export const ParsedArticle = ({ highlightedHtml, whocolorHtml, parsedArticle }) => {
let articleHTML = highlightedHtml || whocolorHtml || parsedArticle;
// This sets `target="_blank"` for all of the link in the article HTML,
// so that clicking one will open it in a new tab.
articleHTML = articleHTML?.replace(wikilinkMatcher, blankTargetLink);
return (
<div className="parsed-article" dangerouslySetInnerHTML={{ __html: articleHTML }} />
);
};
ParsedArticle.propTypes = {
highlightedHtml: PropTypes.string,
whocolorHtml: PropTypes.string,
parsedArticle: PropTypes.string
};
export default ParsedArticle;
| Add target="_blanks" to typical links in ArticleViewer | Add target="_blanks" to typical links in ArticleViewer
This cleanly handles standard wikilinks in Wikipedia articles, so that clicking one will open the Wikipedia article in a new tab instead of navigating the user away from the Dashboard.
Wikidata links, however, are formatted differently, with a `title` attribute before the `href` and relative links instead of absolute ones... so this change doesn't affect Wikidata items, which have broken links in ArticleViewer anyway.
| JSX | mit | WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ---
+++
@@ -1,8 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
+
+const wikilinkMatcher = new RegExp('<a href=', 'g');
+const blankTargetLink = '<a target="_blank" href=';
+
export const ParsedArticle = ({ highlightedHtml, whocolorHtml, parsedArticle }) => {
- const articleHTML = highlightedHtml || whocolorHtml || parsedArticle;
+ let articleHTML = highlightedHtml || whocolorHtml || parsedArticle;
+
+ // This sets `target="_blank"` for all of the link in the article HTML,
+ // so that clicking one will open it in a new tab.
+ articleHTML = articleHTML?.replace(wikilinkMatcher, blankTargetLink);
+
return (
<div className="parsed-article" dangerouslySetInnerHTML={{ __html: articleHTML }} />
); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.