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
|
---|---|---|---|---|---|---|---|---|---|---|
be3514cf63d5aeb734eee71f3d11aa59b8a26101 | src/components/Main.jsx | src/components/Main.jsx | import React from 'react';
import { Switch, Route } from 'react-router-dom';
import NewSnippet from './NewSnippet';
import RecentSnippets from './RecentSnippets';
import Snippet from './Snippet';
import About from './About';
import SignIn from './SignIn';
import '../styles/Main.styl';
const Main = () => (
<main className="main">
<Switch>
<Route exact path="/" component={NewSnippet} />
<Route path="/recent" component={RecentSnippets} />
<Route path="/about" component={About} />
<Route path="/sign-in" component={SignIn} />
<Route path="/:id" component={Snippet} />
</Switch>
</main>
);
export default Main;
| import React from 'react';
import { Switch, Route } from 'react-router-dom';
import NewSnippet from './NewSnippet';
import RecentSnippets from './RecentSnippets';
import Snippet from './Snippet';
import About from './About';
import SignIn from './SignIn';
import '../styles/Main.styl';
const Main = () => (
<main className="main">
<Switch>
<Route exact path="/" component={NewSnippet} />
<Route exact path="/recent" component={RecentSnippets} />
<Route exact path="/about" component={About} />
<Route exact path="/sign-in" component={SignIn} />
<Route exact path="/:id(\d+)" component={Snippet} />
</Switch>
</main>
);
export default Main;
| Use exact routes to pages | Use exact routes to pages
By default, react route matches a URI (let's say) greedy which means the
following route:
<Route path="/about" ... />
will match the following URIs:
/about
/about/
/about/foo
/about/foo/bar
Well, that's not what would we expect. That's why we want to set 'exact'
option on routes, so only two cases would be allows for the example
above:
/about
/about/
Any other options will end up with 404 Not Found.
| JSX | mit | xsnippet/xsnippet-web,xsnippet/xsnippet-web | ---
+++
@@ -13,10 +13,10 @@
<main className="main">
<Switch>
<Route exact path="/" component={NewSnippet} />
- <Route path="/recent" component={RecentSnippets} />
- <Route path="/about" component={About} />
- <Route path="/sign-in" component={SignIn} />
- <Route path="/:id" component={Snippet} />
+ <Route exact path="/recent" component={RecentSnippets} />
+ <Route exact path="/about" component={About} />
+ <Route exact path="/sign-in" component={SignIn} />
+ <Route exact path="/:id(\d+)" component={Snippet} />
</Switch>
</main>
); |
545b21ce3de1c50aac0d3c4f2b47b3f38e38e1d0 | client/js/app/src/app/pages/querybuilder/query-derived/query-derived.jsx | client/js/app/src/app/pages/querybuilder/query-derived/query-derived.jsx | import React from 'react';
import { Badge, Group, JsonInput, Stack, Button } from '@mantine/core';
import { useQueryBuilderContext } from 'app/pages/querybuilder/context/query-builder-provider';
import { Icon } from 'app/components';
export function QueryDerived() {
const query = useQueryBuilderContext((ctx) => ctx.query.input);
return (
<Stack>
<Group position="apart">
<Badge variant="filled">Query</Badge>
<Button
leftIcon={<Icon name="paste" />}
variant="outline"
size="xs"
compact
>
Paste JSON
</Button>
</Group>
<JsonInput
styles={{
root: { height: '100%' },
wrapper: { height: '100%' },
input: { height: '100%' },
}}
value={query}
validationError="Invalid json"
variant={'unstyled'}
minRows={21}
formatOnBlur
autosize
/>
</Stack>
);
}
| import React from 'react';
import {
Badge,
Group,
JsonInput,
Stack,
Button,
CopyButton,
} from '@mantine/core';
import { useQueryBuilderContext } from 'app/pages/querybuilder/context/query-builder-provider';
import { Icon } from 'app/components';
export function QueryDerived() {
const query = useQueryBuilderContext((ctx) => ctx.query.input);
return (
<Stack>
<Group position="apart">
<Badge variant="filled">Query</Badge>
<Group spacing="xs">
<CopyButton value={query}>
{({ copied, copy }) => (
<Button
leftIcon={<Icon name={copied ? 'check' : 'copy'} />}
color={copied ? 'teal' : 'blue'}
variant="outline"
onClick={copy}
size="xs"
compact
>
Copy
</Button>
)}
</CopyButton>
<Button
leftIcon={<Icon name="paste" />}
variant="outline"
size="xs"
compact
>
Paste JSON
</Button>
</Group>
</Group>
<JsonInput
styles={{
root: { height: '100%' },
wrapper: { height: '100%' },
input: { height: '100%' },
}}
value={query}
validationError="Invalid json"
variant={'unstyled'}
minRows={21}
formatOnBlur
autosize
/>
</Stack>
);
}
| Add copy button to Query | Add copy button to Query
| JSX | apache-2.0 | vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa | ---
+++
@@ -1,5 +1,12 @@
import React from 'react';
-import { Badge, Group, JsonInput, Stack, Button } from '@mantine/core';
+import {
+ Badge,
+ Group,
+ JsonInput,
+ Stack,
+ Button,
+ CopyButton,
+} from '@mantine/core';
import { useQueryBuilderContext } from 'app/pages/querybuilder/context/query-builder-provider';
import { Icon } from 'app/components';
@@ -9,14 +16,30 @@
<Stack>
<Group position="apart">
<Badge variant="filled">Query</Badge>
- <Button
- leftIcon={<Icon name="paste" />}
- variant="outline"
- size="xs"
- compact
- >
- Paste JSON
- </Button>
+ <Group spacing="xs">
+ <CopyButton value={query}>
+ {({ copied, copy }) => (
+ <Button
+ leftIcon={<Icon name={copied ? 'check' : 'copy'} />}
+ color={copied ? 'teal' : 'blue'}
+ variant="outline"
+ onClick={copy}
+ size="xs"
+ compact
+ >
+ Copy
+ </Button>
+ )}
+ </CopyButton>
+ <Button
+ leftIcon={<Icon name="paste" />}
+ variant="outline"
+ size="xs"
+ compact
+ >
+ Paste JSON
+ </Button>
+ </Group>
</Group>
<JsonInput
styles={{ |
6e4a3543d933beb7a94ad6d318c997953059d159 | client/javascript/components/EditorOverlay.jsx | client/javascript/components/EditorOverlay.jsx | import React from 'react';
import { DOC_INITIAL, DOC_OPENING, DOC_FAILED } from './SyncedEditor';
function EditorOverlay(state) {
let overlay;
switch (state) {
case DOC_INITIAL:
overlay = (<div className="overlay" />);
break;
case DOC_OPENING:
overlay = (
<div className="overlay">
<div className="content">
Opening...
</div>
</div>
);
break;
case DOC_FAILED:
overlay = (
<div className="overlay">
<div className="content">
Failed
</div>
</div>
);
break;
default:
overlay = (<div className="overlay hide" />);
break;
}
return overlay;
}
export default EditorOverlay;
| import React from 'react';
import { DOC_INITIAL, DOC_OPENING, DOC_FAILED } from './SyncedEditor';
function EditorOverlay(props) {
let overlay;
switch (props.state) {
case DOC_INITIAL:
overlay = (<div className="overlay" />);
break;
case DOC_OPENING:
overlay = (
<div className="overlay">
<div className="content">
Opening...
</div>
</div>
);
break;
case DOC_FAILED:
overlay = (
<div className="overlay">
<div className="content">
Failed
</div>
</div>
);
break;
default:
overlay = (<div className="overlay hide" />);
break;
}
return overlay;
}
export default EditorOverlay;
| Fix incorrect argument of function component | Fix incorrect argument of function component
| JSX | bsd-3-clause | zesik/insnota,zesik/insnota | ---
+++
@@ -1,9 +1,9 @@
import React from 'react';
import { DOC_INITIAL, DOC_OPENING, DOC_FAILED } from './SyncedEditor';
-function EditorOverlay(state) {
+function EditorOverlay(props) {
let overlay;
- switch (state) {
+ switch (props.state) {
case DOC_INITIAL:
overlay = (<div className="overlay" />);
break; |
92d375e7fdb589789783aa64c807c8e1879e1046 | app/components/month.jsx | app/components/month.jsx | import '../styles/month'
import React, { Component, PropTypes } from 'react'
import { Map } from 'immutable'
import moment from 'moment'
import range from 'lodash/utility/range'
import Day from './day'
export default class Month extends Component {
static propTypes = {
date: PropTypes.any.isRequired,
events: PropTypes.instanceOf(Map)
}
render () {
const date = moment(this.props.date)
const daysInMonth = range(date.daysInMonth())
const dateStart = moment(date).startOf('month')
const dateEnd = moment(date).endOf('month')
const events = this.props.events.toArray().filter(event =>
// Event occurs in this month if it starts before end of month AND it ends after start of month
// <=> end of month is after start of event AND start of month is before end of event
dateEnd.isAfter(event.start) && dateStart.isBefore(event.end)
)
return (
<div className="month">
<header className="month-title">{date.format('MMMM YYYY')}</header>
{daysInMonth.map(day => (
<Day date={moment(date).date(day + 1)} events={events} />
))}
</div>
)
}
}
| import '../styles/month'
import React, { Component, PropTypes } from 'react'
import { Map } from 'immutable'
import moment from 'moment'
import range from 'lodash/utility/range'
import Day from './day'
export default class Month extends Component {
static propTypes = {
date: PropTypes.any.isRequired,
events: PropTypes.instanceOf(Map)
}
render () {
const date = moment(this.props.date)
const daysInMonth = range(date.daysInMonth())
const dateStart = moment(date).startOf('month')
const dateEnd = moment(date).endOf('month')
const events = this.props.events.toArray().filter(event =>
// Event occurs in this month if it starts before end of month AND it ends after start of month
// <=> end of month is after start of event AND start of month is before end of event
dateEnd.isAfter(event.start) && dateStart.isBefore(event.end)
)
return (
<div className="month">
<header className="month-title">{date.format('MMMM YYYY')}</header>
{daysInMonth.map(day => moment(date).date(day + 1)).map(d =>
<Day date={d} events={events} key={d.format()} />
)}
</div>
)
}
}
| Add key to Day components | Add key to Day components
| JSX | mit | lmtm/bc-planner,byteclubfr/bc-planner,lmtm/bc-planner,byteclubfr/bc-planner | ---
+++
@@ -29,9 +29,9 @@
<div className="month">
<header className="month-title">{date.format('MMMM YYYY')}</header>
- {daysInMonth.map(day => (
- <Day date={moment(date).date(day + 1)} events={events} />
- ))}
+ {daysInMonth.map(day => moment(date).date(day + 1)).map(d =>
+ <Day date={d} events={events} key={d.format()} />
+ )}
</div>
)
} |
ebb0d3f5d116f81bdbaf7647765ed787b49ff677 | imports/ui/builder/element-name.jsx | imports/ui/builder/element-name.jsx | import React from 'react';
import Elements from '../../api/elements.js';
export default class ElementName extends React.Component {
constructor(props) {
super(props);
this.state = {
editing: false,
};
}
editName() {
this.setState({ editing: true }, () => {
this.refs.nameInput.focus();
});
}
setName() {
Elements.setName(this.props.elementId, this.refs.nameInput.value);
this.setState({ editing: false });
}
render() {
if (this.state.editing) {
return (
<input
className="elementName"
style={{ marginLeft: '5px' }}
type="text"
defaultValue={this.props.elementName}
ref="nameInput"
onBlur={this.setName.bind(this)}
/>
);
}
return (
<div
className="elementName"
style={{ display: 'inline-block', paddingLeft: '7px', paddingTop: '3px', paddingBottom: '3px'}}
onClick={this.editName.bind(this)}
>
{this.props.elementName}
</div>
);
}
}
ElementName.propTypes = {
elementName: React.PropTypes.string.isRequired,
elementId: React.PropTypes.string.isRequired
};
| import React from 'react';
import Elements from '../../api/elements.js';
export default class ElementName extends React.Component {
constructor(props) {
super(props);
this.state = {
editing: false,
};
this.setName = this.setName.bind(this);
this.editName = this.editName.bind(this);
}
setName() {
Elements.setName(this.props.elementId, this.refs.nameInput.value);
this.setState({ editing: false });
}
editName() {
this.setState({ editing: true }, () => {
this.refs.nameInput.focus();
});
}
render() {
let elementName;
if (this.props.elementName.length === 0) {
elementName = 'name';
} else {
elementName = this.props.elementName;
}
if (this.state.editing) {
return (
<input
className="elementName"
style={{ marginLeft: '5px' }}
type="text"
defaultValue={this.props.elementName}
ref="nameInput"
onBlur={this.setName}
/>
);
}
return (
<div
className="elementName"
style={{ display: 'inline-block',
paddingLeft: '7px',
paddingTop: '3px',
paddingBottom: '3px' }}
onClick={this.editName}
>
{elementName}
</div>
);
}
}
ElementName.propTypes = {
elementName: React.PropTypes.string.isRequired,
elementId: React.PropTypes.string.isRequired,
};
| Add placeholder if name is not specified and enforce coding style | Add placeholder if name is not specified and enforce coding style
| JSX | mit | minden/data-furnace,minden/data-furnace | ---
+++
@@ -7,6 +7,13 @@
this.state = {
editing: false,
};
+ this.setName = this.setName.bind(this);
+ this.editName = this.editName.bind(this);
+ }
+
+ setName() {
+ Elements.setName(this.props.elementId, this.refs.nameInput.value);
+ this.setState({ editing: false });
}
editName() {
@@ -15,12 +22,14 @@
});
}
- setName() {
- Elements.setName(this.props.elementId, this.refs.nameInput.value);
- this.setState({ editing: false });
- }
+ render() {
+ let elementName;
+ if (this.props.elementName.length === 0) {
+ elementName = 'name';
+ } else {
+ elementName = this.props.elementName;
+ }
- render() {
if (this.state.editing) {
return (
<input
@@ -29,7 +38,7 @@
type="text"
defaultValue={this.props.elementName}
ref="nameInput"
- onBlur={this.setName.bind(this)}
+ onBlur={this.setName}
/>
);
}
@@ -37,10 +46,13 @@
return (
<div
className="elementName"
- style={{ display: 'inline-block', paddingLeft: '7px', paddingTop: '3px', paddingBottom: '3px'}}
- onClick={this.editName.bind(this)}
+ style={{ display: 'inline-block',
+ paddingLeft: '7px',
+ paddingTop: '3px',
+ paddingBottom: '3px' }}
+ onClick={this.editName}
>
- {this.props.elementName}
+ {elementName}
</div>
);
}
@@ -48,5 +60,5 @@
ElementName.propTypes = {
elementName: React.PropTypes.string.isRequired,
- elementId: React.PropTypes.string.isRequired
+ elementId: React.PropTypes.string.isRequired,
}; |
bafb698e210a0f78e522dbc2599aac719f2e7ddc | kanban_app/app/components/Notes.jsx | kanban_app/app/components/Notes.jsx | import React from 'react';
import Editable from './Editable.jsx';
import Note from './Note.jsx';
export default class Notes extends React.Component {
constructor(props) {
super(props);
this.renderNote = this.renderNote.bind(this);
}
render() {
const notes = this.props.items;
return <ul className='notes'>{notes.map(this.renderNote)}</ul>;
}
renderNote(note) {
// XXX: LaneActions.move
return (
<Note className='note' onMove={() => {}}
id={note.id} key={`note${note.id}`}>
<Editable
value={note.task}
onEdit={this.props.onEdit.bind(null, note.id)}
onDelete={this.props.onDelete.bind(null, note.id)} />
</Note>
);
}
}
| import React from 'react';
import Editable from './Editable.jsx';
import Note from './Note.jsx';
export default class Notes extends React.Component {
constructor(props) {
super(props);
this.renderNote = this.renderNote.bind(this);
}
render() {
// XXX
const notes = this.props.items || [];
return <ul className='notes'>{notes.map(this.renderNote)}</ul>;
}
renderNote(note) {
// XXX: LaneActions.move
return (
<Note className='note' onMove={() => {}}
id={note.id} key={`note${note.id}`}>
<Editable
value={note.task}
onEdit={this.props.onEdit.bind(null, note.id)}
onDelete={this.props.onDelete.bind(null, note.id)} />
</Note>
);
}
}
| Check against possibly missing notes | Check against possibly missing notes
Ideally this would be on proptype level but this will do for now. I'll
get rid of this check later.
| JSX | mit | deden/redux-demo,Live4Code/react-codemirror,survivejs-demos/redux-demo,survivejs/redux-demo | ---
+++
@@ -9,7 +9,8 @@
this.renderNote = this.renderNote.bind(this);
}
render() {
- const notes = this.props.items;
+ // XXX
+ const notes = this.props.items || [];
return <ul className='notes'>{notes.map(this.renderNote)}</ul>;
} |
68670d8b0a791a5ae807b8a222ba342c4b0f08d3 | client/components/game/home/MainHeaderBar.jsx | client/components/game/home/MainHeaderBar.jsx | import React from 'react';
export default React.createClass({
render() {
return (
<div>
<div style={{display: "inline-block", marginRight: "30px"}}>
Capital: {this.props.capital}
</div>
<div style={{display: "inline-block", marginRight: "30px"}}>
Cash Flow: {this.props.cashFlow}
</div>
<div style={{display: "inline-block"}}>
Quarter: {this.props.quarter} of {this.props.totalQuarterCount}
</div>
</div>
);
}
});
| import React from 'react';
export default React.createClass({
render() {
return (
<div>
<div style={{display: 'inline-block', marginRight: '30px'}}>
Capital: {this.props.capital}
</div>
<div style={{display: 'inline-block', marginRight: '30px'}}>
Cash Flow: {this.props.cashFlow}
</div>
<div style={{display: 'inline-block'}}>
Quarter: {this.props.quarter} of {this.props.totalQuarterCount}
</div>
</div>
);
}
});
| Replace double quotes with single quotes | Replace double quotes with single quotes | JSX | mit | gios-asu/sustainability-game,gios-asu/dont-get-fired-game,gios-asu/dont-get-fired-game,gios-asu/sustainability-game | ---
+++
@@ -4,13 +4,13 @@
render() {
return (
<div>
- <div style={{display: "inline-block", marginRight: "30px"}}>
+ <div style={{display: 'inline-block', marginRight: '30px'}}>
Capital: {this.props.capital}
</div>
- <div style={{display: "inline-block", marginRight: "30px"}}>
+ <div style={{display: 'inline-block', marginRight: '30px'}}>
Cash Flow: {this.props.cashFlow}
</div>
- <div style={{display: "inline-block"}}>
+ <div style={{display: 'inline-block'}}>
Quarter: {this.props.quarter} of {this.props.totalQuarterCount}
</div>
</div> |
d33f2b4ffdc752594b7decbf275658e93823aaf8 | client/source/components/Recipe/RecipeIngredientsBS.jsx | client/source/components/Recipe/RecipeIngredientsBS.jsx | import React, {Component} from 'react';
import { Grid, Row, Col, Table } from 'react-bootstrap';
// TODO: Confirm ingredient object structure, ensure that key refers to the proper value
// TODO: Add headers for the 'Ingredient', 'Quantity', 'Unit' and other fields.
export default ({ingredientList}) => {
return (
<Grid>
<Col xs={8} md={8}>
<Table bordered>
<thead>
<tr>
<th data-field="ingredient">Ingredient</th>
<th data-field="quantity">Quantity</th>
<th data-field="unit">Unit</th>
</tr>
</thead>
<tbody>
{ingredientList.map((ingredient) => {
return (
<tr key={ingredient.position}>
<td> {ingredient.name} </td>
<td> {ingredient.amount} </td>
<td> {ingredient.unit} </td>
</tr>
)
})}
</tbody>
</Table>
</Col>
</Grid>
);
}
| import React, {Component} from 'react';
import { Grid, Row, Col, Table } from 'react-bootstrap';
// TODO: Confirm ingredient object structure, ensure that key refers to the proper value
// TODO: Add headers for the 'Ingredient', 'Quantity', 'Unit' and other fields.
class RecipeIngredients extends React.Component {
constructor(props) {
super(props);
}
_renderIngredientName(ingredient){
console.log('Firing render function!');
if (ingredient.prep) {
return (
<p> {`${ingredient.name}, ${ingredient.prep}`} </p>
)
} else {
return (
<p> {`${ingredient.name}`} </p>
)
}
}
render() {
return (
<Grid>
<Col xs={12} md={12}>
<Table bordered>
<thead>
<tr>
<th data-field="ingredient">Ingredient</th>
<th data-field="quantity">Quantity</th>
<th data-field="unit">Unit</th>
</tr>
</thead>
<tbody>
{this.props.ingredientList.map((ingredient) => {
return (
<tr key={ingredient.position}>
<td> {this._renderIngredientName(ingredient)} </td>
<td> {ingredient.amount} </td>
<td> {ingredient.unit} </td>
</tr>
)
})}
</tbody>
</Table>
</Col>
</Grid>
);
}
}
export default RecipeIngredients;
| Implement optional render method that displays a given preparation value along with ingredient name. | Implement optional render method that displays a given preparation value along with ingredient name.
| JSX | mit | JAC-Labs/SkilletHub,JAC-Labs/SkilletHub | ---
+++
@@ -1,35 +1,57 @@
import React, {Component} from 'react';
import { Grid, Row, Col, Table } from 'react-bootstrap';
-
// TODO: Confirm ingredient object structure, ensure that key refers to the proper value
// TODO: Add headers for the 'Ingredient', 'Quantity', 'Unit' and other fields.
-export default ({ingredientList}) => {
- return (
- <Grid>
- <Col xs={8} md={8}>
- <Table bordered>
- <thead>
- <tr>
- <th data-field="ingredient">Ingredient</th>
- <th data-field="quantity">Quantity</th>
- <th data-field="unit">Unit</th>
- </tr>
- </thead>
- <tbody>
- {ingredientList.map((ingredient) => {
- return (
- <tr key={ingredient.position}>
- <td> {ingredient.name} </td>
- <td> {ingredient.amount} </td>
- <td> {ingredient.unit} </td>
- </tr>
- )
- })}
- </tbody>
- </Table>
- </Col>
- </Grid>
- );
+class RecipeIngredients extends React.Component {
+
+ constructor(props) {
+ super(props);
+ }
+
+ _renderIngredientName(ingredient){
+ console.log('Firing render function!');
+ if (ingredient.prep) {
+ return (
+ <p> {`${ingredient.name}, ${ingredient.prep}`} </p>
+ )
+ } else {
+ return (
+ <p> {`${ingredient.name}`} </p>
+ )
+ }
+ }
+
+ render() {
+ return (
+ <Grid>
+ <Col xs={12} md={12}>
+ <Table bordered>
+ <thead>
+ <tr>
+ <th data-field="ingredient">Ingredient</th>
+ <th data-field="quantity">Quantity</th>
+ <th data-field="unit">Unit</th>
+ </tr>
+ </thead>
+ <tbody>
+ {this.props.ingredientList.map((ingredient) => {
+ return (
+ <tr key={ingredient.position}>
+ <td> {this._renderIngredientName(ingredient)} </td>
+ <td> {ingredient.amount} </td>
+ <td> {ingredient.unit} </td>
+ </tr>
+ )
+ })}
+ </tbody>
+ </Table>
+ </Col>
+ </Grid>
+ );
+ }
+
}
+
+export default RecipeIngredients; |
291e91e24b0494ce61c101b68271cfabefeb39a6 | app/components/Statements/SpeakerComments.jsx | app/components/Statements/SpeakerComments.jsx | import React from 'react'
import { translate } from 'react-i18next'
import VerificationsOriginHeader from './VerificationsOriginHeader'
import { SpeakerPreview } from '../Speakers/SpeakerPreview'
import { CommentsList } from '../Comments/CommentsList'
export default translate('videoDebate')(({t, speaker, comments}) => {
return comments.size === 0 ? null : (
<div className="self-comments columns is-gapless">
<div className="column is-narrow">
<VerificationsOriginHeader iconName="user" label={t('speaker.one')} />
<SpeakerPreview speaker={speaker} withoutActions/>
</div>
<div className="column">
<CommentsList comments={comments}/>
</div>
</div>
)
})
| import React from 'react'
import { translate } from 'react-i18next'
import VerificationsOriginHeader from './VerificationsOriginHeader'
import { SpeakerPreview } from '../Speakers/SpeakerPreview'
import { CommentsList } from '../Comments/CommentsList'
export default translate('videoDebate')(({t, speaker, comments}) => {
return comments.size === 0 ? null : (
<div className="self-comments columns is-gapless">
<div className="column is-narrow">
<VerificationsOriginHeader iconName="user" label={t('speaker.one')} />
{speaker && <SpeakerPreview speaker={speaker} withoutActions/>}
</div>
<div className="column">
<CommentsList comments={comments}/>
</div>
</div>
)
})
| Fix a crash that was occuring when deleting speaker with self-comments | Fix a crash that was occuring when deleting speaker with self-comments
| JSX | agpl-3.0 | CaptainFact/captain-fact-frontend,CaptainFact/captain-fact-frontend,CaptainFact/captain-fact-frontend | ---
+++
@@ -11,7 +11,7 @@
<div className="self-comments columns is-gapless">
<div className="column is-narrow">
<VerificationsOriginHeader iconName="user" label={t('speaker.one')} />
- <SpeakerPreview speaker={speaker} withoutActions/>
+ {speaker && <SpeakerPreview speaker={speaker} withoutActions/>}
</div>
<div className="column">
<CommentsList comments={comments}/> |
3702462f173208da75f36dd2eefb8d2910e24ee2 | app/assets/javascripts/components/upvote.js.jsx | app/assets/javascripts/components/upvote.js.jsx | var Upvote = React.createClass({
propTypes: {
game: React.PropTypes.shape({
votes_up: React.PropTypes.number.isRequired
}),
hasCurrentUserVotedForGame: React.PropTypes.bool.isRequired
},
render: function() {
var game = this.props.game
if (this.props.hasCurrentUserVotedForGame) {
return (
<a className="upvote-block -voted block px2 py1" href={game.url + '/unupvote'} data-method="post">
<p className="voteicon">▲</p>
<p className="m0">{game.votes_up}</p>
</a>
)
} else {
return (
<a className="upvote-block block px2 py1 light-gray" href={game.url + '/upvote'} data-method="post">
<p className="voteicon">▲</p>
<p className="m0">{game.votes_up}</p>
</a>
)
}
}
})
window.Upvote = Upvote
| var Upvote = React.createClass({
propTypes: {
game: React.PropTypes.shape({
votes_up: React.PropTypes.number.isRequired
}),
hasCurrentUserVotedForGame: React.PropTypes.bool.isRequired
},
render: function() {
var game = this.props.game
if (this.props.hasCurrentUserVotedForGame) {
return (
<a className="upvote-block block px2 py1" href={game.url + '/unupvote'} data-method="post">
<p className="voteicon">▲</p>
<p className="m0">{game.votes_up}</p>
</a>
)
} else {
return (
<a className="upvote-block -voted block px2 py1 light-gray" href={game.url + '/upvote'} data-method="post">
<p className="voteicon">▲</p>
<p className="m0">{game.votes_up}</p>
</a>
)
}
}
})
window.Upvote = Upvote
| Swap colors on voting module. | Swap colors on voting module.
Blue = link, gray = disabled. Got!
| JSX | agpl-3.0 | asm-products/gamamia,asm-products/gamamia,asm-products/gamamia,asm-products/gamamia | ---
+++
@@ -12,14 +12,14 @@
if (this.props.hasCurrentUserVotedForGame) {
return (
- <a className="upvote-block -voted block px2 py1" href={game.url + '/unupvote'} data-method="post">
+ <a className="upvote-block block px2 py1" href={game.url + '/unupvote'} data-method="post">
<p className="voteicon">▲</p>
<p className="m0">{game.votes_up}</p>
</a>
)
} else {
return (
- <a className="upvote-block block px2 py1 light-gray" href={game.url + '/upvote'} data-method="post">
+ <a className="upvote-block -voted block px2 py1 light-gray" href={game.url + '/upvote'} data-method="post">
<p className="voteicon">▲</p>
<p className="m0">{game.votes_up}</p>
</a> |
d86051cd0cda28a5d0b59312a4401953cdf7831e | ui/src/components/Footer/Footer.jsx | ui/src/components/Footer/Footer.jsx | import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Icon } from '@blueprintjs/core';
import './Footer.scss';
export default function Footer(props) {
const { metadata } = props;
return (
<footer id="Footer" className="Footer">
<div className="info">
<FormattedMessage
id="footer.aleph"
defaultMessage="Aleph {version}"
values={{
version: metadata.app.version,
}}
/>
<span className="bp3-text-muted"> • </span>
<span>
<a href="https://docs.alephdata.org/guide/getting-started">
<Icon icon="help" iconSize={14} />
</a>
{' '}
<a href="https://docs.alephdata.org/guide/getting-started">
<FormattedMessage
id="footer.help"
defaultMessage="Help"
/>
</a>
</span>
<span className="bp3-text-muted"> • </span>
<span>
<a href="https://github.com/alephdata/aleph">
<Icon icon="git-repo" iconSize={14} />
</a>
{' '}
<a href="https://github.com/alephdata/aleph">
<FormattedMessage
id="footer.code"
defaultMessage="Code"
/>
</a>
</span>
</div>
</footer>
);
}
| import React, { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
import './Footer.scss';
export default class Footer extends PureComponent {
render() {
const { metadata } = this.props;
return (
<footer id="Footer" className="Footer">
<div className="info">
<FormattedMessage
id="footer.aleph"
defaultMessage="Aleph {version}"
values={{
version: metadata.app.version,
}}
/>
<span className="bp3-text-muted"> • </span>
<span>
<a href="https://docs.alephdata.org/guide/getting-started">
<FormattedMessage
id="footer.help"
defaultMessage="Help"
/>
</a>
</span>
<span className="bp3-text-muted"> • </span>
<span>
<a href="https://github.com/alephdata/aleph">
<FormattedMessage
id="footer.code"
defaultMessage="Code"
/>
</a>
</span>
</div>
</footer>
);
}
}
| Make footer immutable, remove icons | Make footer immutable, remove icons
| JSX | mit | alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph | ---
+++
@@ -1,49 +1,42 @@
-import React from 'react';
+import React, { PureComponent } from 'react';
import { FormattedMessage } from 'react-intl';
-import { Icon } from '@blueprintjs/core';
import './Footer.scss';
-export default function Footer(props) {
- const { metadata } = props;
- return (
- <footer id="Footer" className="Footer">
- <div className="info">
- <FormattedMessage
- id="footer.aleph"
- defaultMessage="Aleph {version}"
- values={{
- version: metadata.app.version,
- }}
- />
- <span className="bp3-text-muted"> • </span>
- <span>
- <a href="https://docs.alephdata.org/guide/getting-started">
- <Icon icon="help" iconSize={14} />
- </a>
- {' '}
- <a href="https://docs.alephdata.org/guide/getting-started">
- <FormattedMessage
- id="footer.help"
- defaultMessage="Help"
- />
- </a>
- </span>
- <span className="bp3-text-muted"> • </span>
- <span>
- <a href="https://github.com/alephdata/aleph">
- <Icon icon="git-repo" iconSize={14} />
- </a>
- {' '}
- <a href="https://github.com/alephdata/aleph">
- <FormattedMessage
- id="footer.code"
- defaultMessage="Code"
- />
- </a>
- </span>
- </div>
- </footer>
- );
+export default class Footer extends PureComponent {
+ render() {
+ const { metadata } = this.props;
+ return (
+ <footer id="Footer" className="Footer">
+ <div className="info">
+ <FormattedMessage
+ id="footer.aleph"
+ defaultMessage="Aleph {version}"
+ values={{
+ version: metadata.app.version,
+ }}
+ />
+ <span className="bp3-text-muted"> • </span>
+ <span>
+ <a href="https://docs.alephdata.org/guide/getting-started">
+ <FormattedMessage
+ id="footer.help"
+ defaultMessage="Help"
+ />
+ </a>
+ </span>
+ <span className="bp3-text-muted"> • </span>
+ <span>
+ <a href="https://github.com/alephdata/aleph">
+ <FormattedMessage
+ id="footer.code"
+ defaultMessage="Code"
+ />
+ </a>
+ </span>
+ </div>
+ </footer>
+ );
+ }
} |
2c65a0c6b11338730b5f922b6ae2732f728c2a9b | src/components/PostCover/PostCover.jsx | src/components/PostCover/PostCover.jsx | import React, { Component } from "react";
import Img from "gatsby-image";
import path from "path";
import "./PostCover.scss";
class PostCover extends Component {
render() {
const { fileEdges, postNode, coverHeight, coverClassName } = this.props;
const post = postNode.frontmatter ? postNode.frontmatter : postNode;
const coverNodeList = fileEdges.filter(fileNode => {
if (fileNode.node.childImageSharp === null) return false;
if (
fileNode.node.absolutePath.indexOf(
path.join("/static/", post.cover)
) !== -1
)
return true;
return false;
});
if (coverNodeList.length === 1) {
return (
<Img
sizes={coverNodeList[0].node.childImageSharp.sizes}
outerWrapperClassName={coverClassName}
style={{ height: coverHeight, width: "100%" }}
/>
);
}
/* eslint no-undef: "off" */
const coverURL =
post.cover.substring(0, 1) === "/"
? __PATH_PREFIX__ + post.cover
: post.cover;
return (
<div
style={{
backgroundImage: `url(${coverURL})`,
height: `${coverHeight}px`
}}
className={coverClassName}
/>
);
}
}
export default PostCover;
| import React, { Component } from "react";
import Img from "gatsby-image";
import path from "path";
import "./PostCover.scss";
class PostCover extends Component {
render() {
const { fileEdges, postNode, coverHeight, coverClassName } = this.props;
const post = postNode.frontmatter ? postNode.frontmatter : postNode;
const coverNodeList = fileEdges.filter(fileNode => {
if (fileNode.node.childImageSharp === null) return false;
if (
fileNode.node.absolutePath.indexOf(
path.join("/static/assets/", post.cover)
) !== -1
)
return true;
return false;
});
if (coverNodeList.length === 1) {
return (
<Img
sizes={coverNodeList[0].node.childImageSharp.sizes}
outerWrapperClassName={coverClassName}
style={{ height: coverHeight, width: "100%" }}
/>
);
}
/* eslint no-undef: "off" */
const coverURL =
post.cover.substring(0, 1) === "/"
? __PATH_PREFIX__ + post.cover
: post.cover;
return (
<div
style={{
backgroundImage: `url(${coverURL})`,
height: `${coverHeight}px`
}}
className={coverClassName}
/>
);
}
}
export default PostCover;
| Fix cover images not being loaded due to path changes. | Fix cover images not being loaded due to path changes.
| JSX | mit | Vagr9K/gatsby-material-starter,Vagr9K/gatsby-material-starter | ---
+++
@@ -12,7 +12,7 @@
if (
fileNode.node.absolutePath.indexOf(
- path.join("/static/", post.cover)
+ path.join("/static/assets/", post.cover)
) !== -1
)
return true; |
17d4c4badb74a37ac2cec2fc952ed13976c6472f | example/example/static/example/HelloWorld.jsx | example/example/static/example/HelloWorld.jsx | var React = require('react');
if (typeof window !== 'undefined') { window.React = React; }
var HelloWorld = React.createClass({
render: function() {
return <span>Hello, {this.props.name}!</span>;
}
});
module.exports = HelloWorld; | /**
* Begin by naming your bridge module the same as the component name
* in your `ReactComponent` subclass.
*
* Then, require React itself.
*
* When mounting a React component into a Django page using django-react,
* the component and its module act as a "bridge"
* between rendering of the component on the server
* and mounting and lifecycle management of the component on the client.
*
* In a typical project, you'd also require subcomponents here,
* and any other packages that your bridge module needs
* to successfully render on the server and manage lifecycle on the client.
*/
var React = require('react');
/**
* django-react produces code to initialize such bridge components,
* and needs access to React in order to do so.
*
* React is bundled with your component during the build process,
* so the bridge component's module needs to expose React.
*
* When rendering on the server, `window` doesn't exist,
* so we check for its existence first before setting it.
*/
if (typeof window !== 'undefined') { window.React = React; }
/**
* Create your bridge component as you would any other React component.
*/
var HelloWorld = React.createClass({
render: function() {
/**
* On the server side, props will be set to the values you provided
* when instantiating the component in Python.
*
* On the client side, props will be set to those same values,
* as they will have been serialized, and sent to the client
* along with initialization code via `{{ component.render_js }}`
*
* See also `example.views.index` Python module,
* and `example/index.html` Django template.
*/
return <span>Hello, {this.props.name}!</span>;
}
});
module.exports = HelloWorld; | Add some explanatory text about "bridge" components | Add some explanatory text about "bridge" components
| JSX | mit | HorizonXP/python-react-router,abdelouahabb/python-react,markfinger/python-react,acrispin/python-react,markfinger/python-react,HorizonXP/python-react-router,acrispin/python-react,abdelouahabb/python-react,arceduardvincent/python-react,mic159/react-render,mic159/react-render,arceduardvincent/python-react,HorizonXP/python-react-router,mic159/react-render | ---
+++
@@ -1,11 +1,56 @@
+/**
+ * Begin by naming your bridge module the same as the component name
+ * in your `ReactComponent` subclass.
+ *
+ * Then, require React itself.
+ *
+ * When mounting a React component into a Django page using django-react,
+ * the component and its module act as a "bridge"
+ * between rendering of the component on the server
+ * and mounting and lifecycle management of the component on the client.
+ *
+ * In a typical project, you'd also require subcomponents here,
+ * and any other packages that your bridge module needs
+ * to successfully render on the server and manage lifecycle on the client.
+ */
var React = require('react');
+
+/**
+ * django-react produces code to initialize such bridge components,
+ * and needs access to React in order to do so.
+ *
+ * React is bundled with your component during the build process,
+ * so the bridge component's module needs to expose React.
+ *
+ * When rendering on the server, `window` doesn't exist,
+ * so we check for its existence first before setting it.
+ */
if (typeof window !== 'undefined') { window.React = React; }
+
+/**
+ * Create your bridge component as you would any other React component.
+ */
var HelloWorld = React.createClass({
+
render: function() {
+
+ /**
+ * On the server side, props will be set to the values you provided
+ * when instantiating the component in Python.
+ *
+ * On the client side, props will be set to those same values,
+ * as they will have been serialized, and sent to the client
+ * along with initialization code via `{{ component.render_js }}`
+ *
+ * See also `example.views.index` Python module,
+ * and `example/index.html` Django template.
+ */
return <span>Hello, {this.props.name}!</span>;
+
}
+
});
module.exports = HelloWorld; |
33c8ede50fa9b853caec7ef9dafa35d4126db660 | imports/ui/components/common/ModalContainer.jsx | imports/ui/components/common/ModalContainer.jsx | import React from 'react'
import { Modal } from 'react-bootstrap'
/**
* Modal window with animations resembling Bootstrap modal windows
* Animations for the window are applied once this component is mounted.
*/
export default class ModalContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
show: false
}
}
componentDidMount() {
this.setState({ show: true });
}
/**
* Hides this modal if the disableHide flag is off
*/
hide() {
if(!this.props.disableHide){
this.props.onHidden();
this.setState({ show: false });
}
}
render() {
return (
<Modal dialogClassName="custom-modal"
show={this.state.show}
onHide={this.hide.bind(this)}>
<Modal.Body>
{this.props.content}
</Modal.Body>
</Modal>
)
}
}
ModalContainer.propTypes = {
// Content of this ModalContainer. Can be any JSX element
content: React.PropTypes.node,
// Set to true if you want to prevent this Modal from being hidden by
// the user (e.g. by clicking outside the Modal window), false otherwise.
disableHide: React.PropTypes.bool,
// Listener for when user clicks to hide this Modal
onHidden: React.PropTypes.func
}
| import React from 'react'
import { Modal } from 'react-bootstrap'
/**
* Modal window with animations resembling Bootstrap modal windows
* Animations for the window are applied once this component is mounted.
*/
export default class ModalContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
show: false
}
}
/**
* Show component when successfully mounted
*/
componentDidMount() {
this.setState({ show: true });
}
/**
* Hides this modal if the disableHide flag is off
*/
hide() {
if(!this.props.disableHide){
this.props.onHidden();
this.setState({ show: false });
}
}
render() {
return (
<Modal dialogClassName="custom-modal"
show={this.state.show}
onHide={this.hide.bind(this)}>
<Modal.Body>
{this.props.content}
</Modal.Body>
</Modal>
)
}
}
ModalContainer.propTypes = {
// Content of this ModalContainer. Can be any JSX element
content: React.PropTypes.node,
// Set to true if you want to prevent this Modal from being hidden by
// the user (e.g. by clicking outside the Modal window), false otherwise.
disableHide: React.PropTypes.bool,
// Listener for when user clicks to hide this Modal
onHidden: React.PropTypes.func
}
| ADD comments for modal container | ADD comments for modal container
| JSX | mit | nus-mtp/nus-oracle,nus-mtp/nus-oracle | ---
+++
@@ -13,6 +13,9 @@
}
}
+/**
+ * Show component when successfully mounted
+ */
componentDidMount() {
this.setState({ show: true });
} |
3224dbeb5b51a8f8ab3ee2f3256267e831bea756 | app/assets/javascripts/components/static_map.es6.jsx | app/assets/javascripts/components/static_map.es6.jsx | class StaticMap extends React.Component {
componentDidMount() {
this.createGmapsIntegration();
}
componentDidUpdate() {
this.createGmapsIntegration();
}
createGmapsIntegration() {
GoogleMapsAPI.then((google) => {
let centerLocation = {
lat : this.props.latitude,
lng: this.props.longitude
};
if(!this.map) {
this.map = new google.maps.Map(
this.refs.map,
{
draggable: false,
scrollwheel: false,
mapTypeControl: false,
panControl: false,
zoomControl: false,
streetViewControl: false
}
);
this.props.onMapInit(this.map);
}
this.map.panTo(centerLocation);
this.map.setZoom(this.props.zoom);
if (!this.marker) {
this.marker = new google.maps.Marker({
animation: google.maps.Animation.DROP,
map: this.map
});
}
this.marker.setPosition(centerLocation);
});
}
render() {
return (
<div ref="map" className="static-map"></div>
);
}
}
| class StaticMap extends React.Component {
componentDidMount() {
this.createGmapsIntegration();
}
componentDidUpdate() {
this.createGmapsIntegration();
}
createGmapsIntegration() {
GoogleMapsAPI.then((google) => {
let centerLocation = {
lat : this.props.latitude,
lng: this.props.longitude
};
if(!this.map) {
this.map = new google.maps.Map(
this.refs.map,
{
draggable: false,
scrollwheel: false,
mapTypeControl: false,
panControl: false,
zoomControl: false,
streetViewControl: false
}
);
if(this.props.onMapInit) {
this.props.onMapInit(this.map);
}
}
this.map.panTo(centerLocation);
this.map.setZoom(this.props.zoom);
if (!this.marker) {
this.marker = new google.maps.Marker({
animation: google.maps.Animation.DROP,
map: this.map
});
}
this.marker.setPosition(centerLocation);
});
}
render() {
return (
<div ref="map" className="static-map"></div>
);
}
}
| Fix static map component when onInit is undefined | Fix static map component when onInit is undefined
| JSX | agpl-3.0 | AjuntamentdeBarcelona/decidim.barcelona-legacy,AjuntamentdeBarcelona/barcelona-participa,AjuntamentdeBarcelona/decidimbcn,AjuntamentdeBarcelona/decidim.barcelona,AjuntamentdeBarcelona/decidim.barcelona-legacy,AjuntamentdeBarcelona/decidim.barcelona-legacy,AjuntamentdeBarcelona/decidimbcn,AjuntamentdeBarcelona/decidim.barcelona-legacy,AjuntamentdeBarcelona/barcelona-participa,AjuntamentdeBarcelona/decidimbcn,AjuntamentdeBarcelona/decidim.barcelona,AjuntamentdeBarcelona/decidim.barcelona,AjuntamentdeBarcelona/barcelona-participa,AjuntamentdeBarcelona/decidim.barcelona | ---
+++
@@ -27,7 +27,9 @@
}
);
- this.props.onMapInit(this.map);
+ if(this.props.onMapInit) {
+ this.props.onMapInit(this.map);
+ }
}
this.map.panTo(centerLocation); |
d0379710e24a58a52567783c1b26dc6498ad3428 | packages/richtext/src/components/StyleButton.jsx | packages/richtext/src/components/StyleButton.jsx | import React from 'react'
import IconButton from 'material-ui/IconButton'
import compose from 'recompose/compose'
import { injectButtonStyles } from './EditorStyles'
const preventDefault = event => event.preventDefault()
const wrapPrevent = callback =>
(event) => {
event.preventDefault()
callback()
}
const StyleButton = ({
toggleStyle,
inlineStyle,
children,
styles,
theme,
prepareStyles,
editorState: omitEditorState,
focused: omitFocused,
...other,
}) =>
<IconButton
iconStyle={styles.icon}
style={styles.button}
onTouchTap={wrapPrevent(() => toggleStyle(inlineStyle))}
onMouseDown={preventDefault}
{...other}
>
{React.cloneElement(children, {
color: styles.color,
hoverColor: styles.focusColor,
})}
</IconButton>
export default compose(
injectButtonStyles,
)(StyleButton)
| import React from 'react'
import IconButton from 'material-ui/IconButton'
import compose from 'recompose/compose'
import mapProps from 'recompose/mapProps'
import { injectButtonStyles } from './EditorStyles'
const preventDefault = event => event.preventDefault()
const wrapPrevent = callback =>
(event) => {
event.preventDefault()
callback()
}
const StyleButton = ({
styles,
onTouchTap,
children,
...other
}) =>
<IconButton
iconStyle={styles.icon}
style={styles.button}
onTouchTap={onTouchTap}
onMouseDown={preventDefault}
{...other}
>
{React.cloneElement(children, {
color: styles.color,
hoverColor: styles.focusColor,
})}
</IconButton>
export default compose(
injectButtonStyles,
mapProps(({
toggleStyle,
inlineStyle,
children,
styles,
...other
}) => ({
styles,
onTouchTap: wrapPrevent(() => toggleStyle(inlineStyle)),
children,
...other,
}))
)(StyleButton)
| Refactor DraftEditor to use JSS | Refactor DraftEditor to use JSS
| JSX | mit | mindhivenz/packages,mindhivenz/packages | ---
+++
@@ -1,6 +1,7 @@
import React from 'react'
import IconButton from 'material-ui/IconButton'
import compose from 'recompose/compose'
+import mapProps from 'recompose/mapProps'
import { injectButtonStyles } from './EditorStyles'
const preventDefault = event => event.preventDefault()
@@ -13,23 +14,15 @@
const StyleButton = ({
- toggleStyle,
- inlineStyle,
+ styles,
+ onTouchTap,
children,
-
- styles,
- theme,
- prepareStyles,
-
- editorState: omitEditorState,
- focused: omitFocused,
-
- ...other,
+ ...other
}) =>
<IconButton
iconStyle={styles.icon}
style={styles.button}
- onTouchTap={wrapPrevent(() => toggleStyle(inlineStyle))}
+ onTouchTap={onTouchTap}
onMouseDown={preventDefault}
{...other}
>
@@ -41,4 +34,16 @@
export default compose(
injectButtonStyles,
+ mapProps(({
+ toggleStyle,
+ inlineStyle,
+ children,
+ styles,
+ ...other
+ }) => ({
+ styles,
+ onTouchTap: wrapPrevent(() => toggleStyle(inlineStyle)),
+ children,
+ ...other,
+ }))
)(StyleButton) |
9da6e3d801c963de0ed4b8b320ea1f6302cd0006 | src/Button.jsx | src/Button.jsx | /**
* Created by Suhair Zain on 11/6/16.
*/
import React, {Component} from 'react';
import {
COLOR_ACCENT,
COLOR_TEXT
} from './utils/colors';
const styles = {
root: {
background: COLOR_ACCENT,
borderRadius: 2,
MozBorderRadius: 2,
WebkitBorderRadius: 2,
color: COLOR_TEXT,
cursor: 'pointer',
display: 'flex',
justifyContent: 'center',
margin: '0 10px',
padding: '10px 20px 10px 20px',
textDecoration: 'none',
width: '100%'
}
};
const getStyle = function(styles, disabled){
return disabled?{
...styles,
backgroundColor: '#B6B6B6',
cursor: 'normal'
}:styles;
};
const Button = ({text, disabled, margin, onClick}) => (
<div style={{...getStyle(styles.root, disabled), margin: margin}} onClick={disabled?null:onClick}>
<span>{text}</span>
</div>
);
export default Button; | /**
* Created by Suhair Zain on 11/6/16.
*/
import React, {Component} from 'react';
import {
COLOR_ACCENT,
COLOR_TEXT
} from './utils/colors';
const styles = {
root: {
borderRadius: 2,
MozBorderRadius: 2,
WebkitBorderRadius: 2,
color: COLOR_TEXT,
display: 'flex',
justifyContent: 'center',
margin: '0 10px',
padding: '10px 20px 10px 20px',
textDecoration: 'none',
width: '100%'
}
};
const getStyle = function(styles, disabled){
return {
...styles,
backgroundColor: disabled?'#B6B6B6':COLOR_ACCENT,
cursor: disabled?'normal':'pointer'
};
};
const Button = ({text, disabled, margin, onClick}) => (
<div style={{...getStyle(styles.root, disabled), margin: margin}} onClick={disabled?null:onClick}>
<span>{text}</span>
</div>
);
export default Button; | Fix for disabled style overwrite | Fix for disabled style overwrite
| JSX | mit | SuhairZain/google-suggestion-maker,SuhairZain/google-suggestion-maker | ---
+++
@@ -11,12 +11,10 @@
const styles = {
root: {
- background: COLOR_ACCENT,
borderRadius: 2,
MozBorderRadius: 2,
WebkitBorderRadius: 2,
color: COLOR_TEXT,
- cursor: 'pointer',
display: 'flex',
justifyContent: 'center',
margin: '0 10px',
@@ -27,11 +25,11 @@
};
const getStyle = function(styles, disabled){
- return disabled?{
+ return {
...styles,
- backgroundColor: '#B6B6B6',
- cursor: 'normal'
- }:styles;
+ backgroundColor: disabled?'#B6B6B6':COLOR_ACCENT,
+ cursor: disabled?'normal':'pointer'
+ };
};
const Button = ({text, disabled, margin, onClick}) => ( |
96f34ba90b4d3f3c1d051c5c21e9ef48a357943e | src/swx/fs/github.jsx | src/swx/fs/github.jsx | /*
* Pseudo-HTTP github project access.
*/
import { Base } from './base.jsx'
export class Filesystem extends Base {
constructor(path, options) {
super(path, options)
if(options.repo) {
this.repo = options.repo
} else {
throw new Error("[github] repo option required")
}
}
read(path) {
return self.fetch('https://api.github.com/repos/' + this.repo + '/contents/' + path)
.then(Response.ok)
.then((result) => result.json())
.then((json) => {
if(json instanceof Array) {
return JSON.stringify({
contents: json.map((item) => {
return {name: item['name']}
})
})
} else {
return atob(json['content'])
}
}).catch((err) => {
console.error(err)
return new Response(err, {status: 500})
})
}
}
| /*
* HTTP GitHub project access.
*/
import { Base } from './base.jsx'
export class Filesystem extends Base {
constructor(path, options) {
super(path, options)
if(options.repo) {
this.repo = options.repo
} else {
throw new Error("[github] repo option required")
}
}
read(path) {
return self.fetch('https://api.github.com/repos/' + this.repo + '/contents/' + path)
.then((response) => {
if(response.status >= 200 && response.status < 300) {
return response
} else {
throw new Error(response.statusText)
}
})
.then((result) => result.json())
.then((json) => {
if(json instanceof Array) {
return JSON.stringify({
contents: json.map((item) => {
return {name: item['name']}
})
})
} else {
return atob(json['content'])
}
}).catch((err) => {
console.error(err)
return new Response(err, {status: 500})
})
}
}
| Fix Github file system status code handling | Fix Github file system status code handling
| JSX | mit | LivelyKernel/lively4-core,LivelyKernel/lively4-core | ---
+++
@@ -1,5 +1,5 @@
/*
- * Pseudo-HTTP github project access.
+ * HTTP GitHub project access.
*/
import { Base } from './base.jsx'
@@ -17,7 +17,13 @@
read(path) {
return self.fetch('https://api.github.com/repos/' + this.repo + '/contents/' + path)
- .then(Response.ok)
+ .then((response) => {
+ if(response.status >= 200 && response.status < 300) {
+ return response
+ } else {
+ throw new Error(response.statusText)
+ }
+ })
.then((result) => result.json())
.then((json) => {
if(json instanceof Array) { |
dc1d40d90f604eefbee96835ed1d04224d094722 | client/app/views/App.jsx | client/app/views/App.jsx | import React from 'react';
import axios from 'axios';
import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import injectTapEventPlugin from 'react-tap-event-plugin';
import NavBar from './Navbar/Navbar.jsx';
injectTapEventPlugin();
class App extends React.Component {
constructor() {
super();
axios.get('/login')
.then((response) => {
if (!response.data.loggedIn) {
this.state = {
loggedIn: false,
userName: '',
};
}
else {
this.state = {
loggedIn: response.data.loggedIn,
userName: response.data.userName,
};
}
});
}
componentDidMount() {
}
render() {
return (
<MuiThemeProvider muiTheme={getMuiTheme(lightBaseTheme)}>
<div className="app-container">
<section className="navbar-container">
<NavBar />
</section>
<section className="props-container">
{this.props.children}
</section>
</div>
</MuiThemeProvider>
)
}
}
export default App;
| import React from 'react';
import axios from 'axios';
import lightBaseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import injectTapEventPlugin from 'react-tap-event-plugin';
import NavBar from './Navbar/Navbar.jsx';
injectTapEventPlugin();
class App extends React.Component {
constructor() {
super();
this.state = {
loggedIn: false,
userName: '',
};
}
componentDidMount() {
axios.get('/login')
.then((response) => {
if (!response.data.loggedIn) {
this.setState({
loggedIn: false,
userName: '',
});
}
else {
this.setState({
loggedIn: response.data.loggedIn,
userName: response.data.userName,
});
}
});
}
render() {
return (
<MuiThemeProvider muiTheme={getMuiTheme(lightBaseTheme)}>
<div className="app-container">
<section className="navbar-container">
<NavBar />
</section>
<section className="props-container">
{React.cloneElement(this.props.children, {
loggedIn: this.state.loggedIn,
userName: this.state.userName,
})}
</section>
</div>
</MuiThemeProvider>
);
}
}
export default App;
| Refactor set state in app parent component | Refactor set state in app parent component
| JSX | mit | AlbertoALopez/polling,AlbertoALopez/polling | ---
+++
@@ -11,24 +11,27 @@
class App extends React.Component {
constructor() {
super();
+ this.state = {
+ loggedIn: false,
+ userName: '',
+ };
+ }
+ componentDidMount() {
axios.get('/login')
.then((response) => {
if (!response.data.loggedIn) {
- this.state = {
+ this.setState({
loggedIn: false,
userName: '',
- };
+ });
}
else {
- this.state = {
+ this.setState({
loggedIn: response.data.loggedIn,
userName: response.data.userName,
- };
+ });
}
});
- }
- componentDidMount() {
-
}
render() {
return (
@@ -38,11 +41,14 @@
<NavBar />
</section>
<section className="props-container">
- {this.props.children}
+ {React.cloneElement(this.props.children, {
+ loggedIn: this.state.loggedIn,
+ userName: this.state.userName,
+ })}
</section>
</div>
</MuiThemeProvider>
- )
+ );
}
}
|
c7b4fffa556794c4416605f01e9f5ea5a7799317 | client/src/app/PageComponents/HouseHoldList.jsx | client/src/app/PageComponents/HouseHoldList.jsx | import React from 'react';
import HouseHoldCard from '../Components/HouseHoldCard.jsx';
/*
HouseHoldList Component
Props: {
userid: INT
}
*/
const HouseHoldList = React.createClass({
render: function() {
return ();
},
});
module.exports = {
HouseHoldList: HouseHoldList,
}; | Add some structure to householdlist | Add some structure to householdlist
| JSX | mit | Squarific/SmartHome,Squarific/SmartHome,Squarific/SmartHome | ---
+++
@@ -0,0 +1,20 @@
+import React from 'react';
+import HouseHoldCard from '../Components/HouseHoldCard.jsx';
+
+/*
+ HouseHoldList Component
+
+ Props: {
+ userid: INT
+ }
+*/
+
+const HouseHoldList = React.createClass({
+ render: function() {
+ return ();
+ },
+});
+
+module.exports = {
+ HouseHoldList: HouseHoldList,
+}; |
|
8ff84e46c886b89991044ed72411064d62bef530 | lib/search-bar.jsx | lib/search-bar.jsx | var React = require('react');
var debounce = require('debounce');
var noop = require('./noop.js');
var SearchBar = React.createClass({
getDefaultProps: function() {
return {
timeout: 20,
onChange: noop
};
},
render: function() {
return <input
className='json-inspector__search'
type='search'
placeholder='Search'
ref='query'
onChange={ debounce(this.update, this.props.timeout) } />;
},
update: function() {
this.props.onChange(this.refs.query.getDOMNode().value);
}
});
module.exports = SearchBar;
| var React = require('react');
var debounce = require('debounce');
var noop = require('./noop.js');
var SearchBar = React.createClass({
getDefaultProps: function() {
return {
timeout: 100,
onChange: noop
};
},
render: function() {
return <input
className='json-inspector__search'
type='search'
placeholder='Search'
ref='query'
onChange={ debounce(this.update, this.props.timeout) } />;
},
update: function() {
this.props.onChange(this.refs.query.getDOMNode().value);
}
});
module.exports = SearchBar;
| Increase default timeout to 100ms | Increase default timeout to 100ms
| JSX | mit | meirwah/react-json-inspector,meirwah/react-json-inspector | ---
+++
@@ -6,7 +6,7 @@
var SearchBar = React.createClass({
getDefaultProps: function() {
return {
- timeout: 20,
+ timeout: 100,
onChange: noop
};
}, |
3c68aa706d8c7dca0ee3f6caaaeff3b7f62ac95b | packages/lesswrong/components/posts/BookmarksList.jsx | packages/lesswrong/components/posts/BookmarksList.jsx | import { registerComponent, Components, useSingle } from 'meteor/vulcan:core';
import React from 'react';
import withUser from '../common/withUser';
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';
const BookmarksList = ({currentUser, limit=50 }) => {
const { PostsItem2, Loading } = Components
const { document: user, loading } = useSingle({
collection: Users,
queryName: "postLinkPreview",
fragmentName: 'UserBookmarks',
fetchPolicy: 'cache-then-network',
documentId: currentUser._id,
});
let bookmarkedPosts = user?.bookmarkedPosts || []
bookmarkedPosts = bookmarkedPosts.slice(0, limit)
if (loading) return <Loading/>
return (
<div>
{bookmarkedPosts.map((post) => <PostsItem2 key={post._id} post={post} bookmark/>)}
</div>
)
}
registerComponent('BookmarksList', BookmarksList, withUser, withErrorBoundary);
| import { registerComponent, Components, useSingle } from 'meteor/vulcan:core';
import React from 'react';
import withUser from '../common/withUser';
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';
const BookmarksList = ({currentUser, limit=50 }) => {
const { PostsItem2, Loading } = Components
const { document: user, loading } = useSingle({
collection: Users,
queryName: "postLinkPreview",
fragmentName: 'UserBookmarks',
fetchPolicy: 'cache-then-network',
documentId: currentUser._id,
});
let bookmarkedPosts = user?.bookmarkedPosts || []
bookmarkedPosts = bookmarkedPosts.reverse().slice(0, limit)
if (loading) return <Loading/>
return (
<div>
{bookmarkedPosts.map((post) => <PostsItem2 key={post._id} post={post} bookmark/>)}
</div>
)
}
registerComponent('BookmarksList', BookmarksList, withUser, withErrorBoundary);
| Change so most recently added bookmarks display first. | Change so most recently added bookmarks display first.
| JSX | mit | Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2 | ---
+++
@@ -16,7 +16,7 @@
});
let bookmarkedPosts = user?.bookmarkedPosts || []
- bookmarkedPosts = bookmarkedPosts.slice(0, limit)
+ bookmarkedPosts = bookmarkedPosts.reverse().slice(0, limit)
if (loading) return <Loading/>
|
d8b8133ecca835abb65e5c2ba08e1356d96e7d6e | src/renderer/component/video/internal/play-button.jsx | src/renderer/component/video/internal/play-button.jsx | import React from 'react';
import Link from 'component/link';
class VideoPlayButton extends React.PureComponent {
componentDidMount() {
this.keyDownListener = this.onKeyDown.bind(this);
document.addEventListener('keydown', this.keyDownListener);
}
componentWillUnmount() {
document.removeEventListener('keydown', this.keyDownListener);
}
onKeyDown(event) {
if (event.target.tagName.toLowerCase() !== 'input' && event.code === 'Space') {
event.preventDefault();
this.watch();
}
}
watch() {
this.props.play(this.props.uri);
}
render() {
const { button, label, isLoading, fileInfo, mediaType } = this.props;
/*
title={
isLoading ? "Video is Loading" :
!costInfo ? "Waiting on cost info..." :
fileInfo === undefined ? "Waiting on file info..." : ""
}
*/
const disabled = isLoading || fileInfo === undefined;
const icon = ['audio', 'video'].indexOf(mediaType) !== -1 ? 'icon-play' : 'icon-folder-o';
return (
<Link
button={button || null}
disabled={disabled}
label={label || ''}
className="video__play-button"
icon={icon}
onClick={() => this.watch()}
/>
);
}
}
export default VideoPlayButton;
| import React from 'react';
import Link from 'component/link';
class VideoPlayButton extends React.PureComponent {
componentDidMount() {
this.keyDownListener = this.onKeyDown.bind(this);
document.addEventListener('keydown', this.keyDownListener);
}
componentWillUnmount() {
document.removeEventListener('keydown', this.keyDownListener);
}
onKeyDown(event) {
if (event.target.tagName.toLowerCase() !== 'input' && event.code === 'Space') {
event.preventDefault();
this.watch();
}
}
watch() {
this.props.play(this.props.uri);
}
render() {
const { button, label, fileInfo, mediaType } = this.props;
/*
title={
isLoading ? "Video is Loading" :
!costInfo ? "Waiting on cost info..." :
fileInfo === undefined ? "Waiting on file info..." : ""
}
*/
const icon = ['audio', 'video'].indexOf(mediaType) !== -1 ? 'icon-play' : 'icon-folder-o';
return (
<Link
button={button || null}
disabled={fileInfo === undefined}
label={label || ''}
className="video__play-button"
icon={icon}
onClick={() => this.watch()}
/>
);
}
}
export default VideoPlayButton;
| Enable play button after clicking download | Enable play button after clicking download
| JSX | mit | lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron,lbryio/lbry-app | ---
+++
@@ -23,7 +23,7 @@
}
render() {
- const { button, label, isLoading, fileInfo, mediaType } = this.props;
+ const { button, label, fileInfo, mediaType } = this.props;
/*
title={
@@ -33,13 +33,12 @@
}
*/
- const disabled = isLoading || fileInfo === undefined;
const icon = ['audio', 'video'].indexOf(mediaType) !== -1 ? 'icon-play' : 'icon-folder-o';
return (
<Link
button={button || null}
- disabled={disabled}
+ disabled={fileInfo === undefined}
label={label || ''}
className="video__play-button"
icon={icon} |
7f73546f40614ec8ae676cd5e0047feba8955f21 | src/Highcharts.jsx | src/Highcharts.jsx | global.HighchartsAdapter = require('exports?HighchartsAdapter!highcharts-standalone-adapter');
var Highcharts = require("exports?Highcharts!highcharts");
var React = require('react');
module.exports = React.createClass({
displayName: 'Highcharts',
renderChart: function () {
if (!this.props.config) {
throw new Error('Config must be specified for the Highchart component');
}
var config = this.props.config;
let chartConfig = config.chart;
this.chart = new Highcharts.Chart({
...config,
chart: {
...chartConfig,
renderTo: this.refs.chart.getDOMNode()
}
});
},
getChart: function () {
if (!this.chart) {
throw new Error('getChart() should not be called before the component is mounted');
}
return this.chart;
},
componentDidMount: function () {
this.renderChart();
},
componentDidUpdate: function () {
this.renderChart();
},
render: function () {
let props = this.props;
props = {
...props,
ref: 'chart'
};
return <div {...props} />;
}
});
module.exports.Highcharts = Highcharts; | global.HighchartsAdapter = require('exports?HighchartsAdapter!highcharts-standalone-adapter');
var Highcharts = require("exports?Highcharts!highcharts");
var React = require('react');
module.exports = React.createClass({
displayName: 'Highcharts',
propTypes: {
config: React.PropTypes.object.isRequired,
isPureConfig: React.PropTypes.boolean
},
renderChart: function () {
if (!this.props.config) {
throw new Error('Config must be specified for the Highchart component');
}
var {config} = this.props;
let chartConfig = config.chart;
this.chart = new Highcharts.Chart({
...config,
chart: {
...chartConfig,
renderTo: this.refs.chart.getDOMNode()
}
});
},
shouldComponentUpdate(nextProps) {
if (!this.props.isPureConfig || !(this.props.config === nextProps.config)) {
this.renderChart();
}
return true;
},
getChart: function () {
if (!this.chart) {
throw new Error('getChart() should not be called before the component is mounted');
}
return this.chart;
},
componentDidMount: function () {
this.renderChart();
},
render: function () {
let props = this.props;
props = {
...props,
ref: 'chart'
};
return <div {...props} />;
}
});
module.exports.Highcharts = Highcharts; | Add `isPureConfig` prop making it easy to avoid unecessary graph rerenders, since re-rendering a highcharts graph is expensive. | Add `isPureConfig` prop making it easy to avoid unecessary graph rerenders, since re-rendering a highcharts graph is expensive.
| JSX | mit | kirjs/react-highcharts,kirjs/react-highcharts | ---
+++
@@ -6,11 +6,16 @@
module.exports = React.createClass({
displayName: 'Highcharts',
+ propTypes: {
+ config: React.PropTypes.object.isRequired,
+ isPureConfig: React.PropTypes.boolean
+ },
+
renderChart: function () {
if (!this.props.config) {
throw new Error('Config must be specified for the Highchart component');
}
- var config = this.props.config;
+ var {config} = this.props;
let chartConfig = config.chart;
this.chart = new Highcharts.Chart({
...config,
@@ -21,6 +26,13 @@
});
},
+ shouldComponentUpdate(nextProps) {
+ if (!this.props.isPureConfig || !(this.props.config === nextProps.config)) {
+ this.renderChart();
+ }
+ return true;
+ },
+
getChart: function () {
if (!this.chart) {
throw new Error('getChart() should not be called before the component is mounted');
@@ -29,10 +41,6 @@
},
componentDidMount: function () {
- this.renderChart();
- },
-
- componentDidUpdate: function () {
this.renderChart();
},
|
20a656dafbd89b407f53ac4f3b5500f0ebe10562 | src/presentations/reactDay/reactRouter/reactRouter.jsx | src/presentations/reactDay/reactRouter/reactRouter.jsx | import React, { Component } from 'react';
// import {
// Appear, BlockQuote, Cite, CodePane, Code, Deck, Fill, Fit,
// Heading, Image, Layout, ListItem, List, Quote, Slide, Text,
// } from 'spectacle';
import { Deck, Slide, Text, BlockQuote, Quote } from 'spectacle';
import { theme } from "../common/themes/darkTheme.js";
export default class ReactRouter extends Component {
render() {
return (
<Deck theme={theme} transition="slide" progress="pacman">
<Slide id="slide1">
<BlockQuote>
<Quote textColor="#FFF">"React Router"</Quote>
</BlockQuote>
</Slide>
<Slide id="slide2">
<Text>ReactRouter 2</Text>
</Slide>
<Slide id="slide3">
<Text>ReactRouter 3</Text>
</Slide>
<Slide id="slide4">
<Text>ReactRouter 4</Text>
</Slide>
</Deck>
);
}
}
| import React, { Component } from 'react';
// import {
// Appear, BlockQuote, Cite, CodePane, Code, Deck, Fill, Fit,
// Heading, Image, Layout, ListItem, List, Quote, Slide, Text,
// } from 'spectacle';
import { Deck, Slide, Text, Appear, List, ListItem, Heading } from 'spectacle';
import { theme } from '../common/themes/darkTheme';
export default class ReactRouter extends Component {
render() {
return (
<Deck theme={theme} transition="slide" progress="pacman">
<Slide transition={['fade']} bgColor="primary">
<Heading>React Router v4</Heading>
<List>
<Appear><ListItem>What is it. (Do I need it?)</ListItem></Appear>
<Appear><ListItem>How we can use it.</ListItem></Appear>
<Appear><ListItem>Analyze all the different types of components that we can use for declaring routes.</ListItem></Appear>
<Appear><ListItem>Route auth, prompts and redirects.</ListItem></Appear>
<Appear><ListItem>How can I get the Router's params in a deeply nested component.</ListItem></Appear>
<Appear><ListItem>Animated route changing.</ListItem></Appear>
</List>
</Slide>
<Slide transition={['fade']} bgColor="primary">
<Heading>React Router v4</Heading>
<List>
<Appear><ListItem>Industry standard for client side routing with React.</ListItem></Appear>
<Appear><ListItem>JSX and Virtual DOM</ListItem></Appear>
<Appear><ListItem>State & Events</ListItem></Appear>
<Appear><ListItem>Going Large Scale with React JS</ListItem></Appear>
</List>
</Slide>
<Slide id="slide2">
<Text>ReactRouter 2</Text>
</Slide>
<Slide id="slide3">
<Text>ReactRouter 3</Text>
</Slide>
<Slide id="slide4">
<Text>ReactRouter 4</Text>
</Slide>
</Deck>
);
}
}
| Add presentation slide and its contents | Add presentation slide and its contents
| JSX | mit | react-skg/meetup,react-skg/meetup | ---
+++
@@ -5,18 +5,33 @@
// Heading, Image, Layout, ListItem, List, Quote, Slide, Text,
// } from 'spectacle';
-import { Deck, Slide, Text, BlockQuote, Quote } from 'spectacle';
+import { Deck, Slide, Text, Appear, List, ListItem, Heading } from 'spectacle';
-import { theme } from "../common/themes/darkTheme.js";
+import { theme } from '../common/themes/darkTheme';
export default class ReactRouter extends Component {
render() {
return (
<Deck theme={theme} transition="slide" progress="pacman">
- <Slide id="slide1">
- <BlockQuote>
- <Quote textColor="#FFF">"React Router"</Quote>
- </BlockQuote>
+ <Slide transition={['fade']} bgColor="primary">
+ <Heading>React Router v4</Heading>
+ <List>
+ <Appear><ListItem>What is it. (Do I need it?)</ListItem></Appear>
+ <Appear><ListItem>How we can use it.</ListItem></Appear>
+ <Appear><ListItem>Analyze all the different types of components that we can use for declaring routes.</ListItem></Appear>
+ <Appear><ListItem>Route auth, prompts and redirects.</ListItem></Appear>
+ <Appear><ListItem>How can I get the Router's params in a deeply nested component.</ListItem></Appear>
+ <Appear><ListItem>Animated route changing.</ListItem></Appear>
+ </List>
+ </Slide>
+ <Slide transition={['fade']} bgColor="primary">
+ <Heading>React Router v4</Heading>
+ <List>
+ <Appear><ListItem>Industry standard for client side routing with React.</ListItem></Appear>
+ <Appear><ListItem>JSX and Virtual DOM</ListItem></Appear>
+ <Appear><ListItem>State & Events</ListItem></Appear>
+ <Appear><ListItem>Going Large Scale with React JS</ListItem></Appear>
+ </List>
</Slide>
<Slide id="slide2">
<Text>ReactRouter 2</Text> |
f35f976e81ca910ec677c64c5b10e9451ed1e4f3 | src/react-chayns-contextmenu/component/ContextMenu.jsx | src/react-chayns-contextmenu/component/ContextMenu.jsx | import React from 'react';
import PropTypes from 'prop-types';
import ContextMenuItem from './ContextMenuItem';
const ContextMenu = ({hide, onLayerClick, x, y, items}) => {
const contextMenuClass = hide ? "context-menu" : "context-menu context-menu--active";
return (
<div className={contextMenuClass}>
<div className="context-menu__page-block" onClick={onLayerClick}></div>
<div className="context-menu__body" style={{
position: 'absolute',
left: x,
top: y
}}>
<ul className="context-menu__item-list">
{items.map((item, index) => {
return (
<ContextMenuItem
key={index}
iconClassName={item.className}
text={item.text}
onClick={item.onClick}
/>
)
})}
</ul>
</div>
</div>
)
};
ContextMenu.defaultProps = {
hide: true,
onLayerClick: () => {},
};
ContextMenu.propTypes = {
hide: PropTypes.bool,
onLayerClick: PropTypes.func,
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
items: PropTypes.arrayOf(
PropTypes.shape({
className: PropTypes.string,
onClick: PropTypes.func,
text: PropTypes.string
})
)
};
export default ContextMenu; | import React from 'react';
import PropTypes from 'prop-types';
import ContextMenuItem from './ContextMenuItem';
const ContextMenu = ({hide, onLayerClick, x, y, items}) => {
const contextMenuClass = hide ? "context-menu" : "context-menu context-menu--active";
return (
<div className={contextMenuClass}>
<div className="context-menu__page-block" onClick={onLayerClick}></div>
<div className="context-menu__body" style={{
position: 'absolute',
left: x,
top: y
}}>
<ul className="context-menu__item-list">
{items.map((item, index) => {
return (
<ContextMenuItem
key={index}
iconClassName={item.className}
text={item.text}
onClick={item.onClick}
/>
)
})}
</ul>
</div>
</div>
)
};
ContextMenu.defaultProps = {
hide: true,
onLayerClick: () => {},
x: undefined,
y: undefined
};
ContextMenu.propTypes = {
hide: PropTypes.bool,
onLayerClick: PropTypes.func,
x: PropTypes.number,
y: PropTypes.number,
items: PropTypes.arrayOf(
PropTypes.shape({
className: PropTypes.string,
onClick: PropTypes.func,
text: PropTypes.string
})
)
};
export default ContextMenu; | Change context menu position props (remove require, add default value) | Change context menu position props (remove require, add default value)
| JSX | mit | TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components | ---
+++
@@ -33,13 +33,15 @@
ContextMenu.defaultProps = {
hide: true,
onLayerClick: () => {},
+ x: undefined,
+ y: undefined
};
ContextMenu.propTypes = {
hide: PropTypes.bool,
onLayerClick: PropTypes.func,
- x: PropTypes.number.isRequired,
- y: PropTypes.number.isRequired,
+ x: PropTypes.number,
+ y: PropTypes.number,
items: PropTypes.arrayOf(
PropTypes.shape({
className: PropTypes.string, |
89cfe760ae62378ca5cb94b380f35f51cad2ff44 | web/static/js/components/action_item_toggle.jsx | web/static/js/components/action_item_toggle.jsx | import React, { Component } from "react"
class ActionItemToggle extends Component {
constructor(props) {
super(props)
this.handleToggleChange = this.handleToggleChange.bind(this)
}
handleToggleChange() {
this.props.onToggleActionItem()
}
render() {
return (
<div className="ui toggle checkbox field">
<input type="checkbox" onChange={this.handleToggleChange} id="action-item-toggle" />
<label htmlFor="action-item-toggle">Toggle Action Items</label>
</div>
)
}
}
ActionItemToggle.propTypes = {
onToggleActionItem: React.PropTypes.func.isRequired,
}
export default ActionItemToggle
| import React, { Component } from "react"
class ActionItemToggle extends Component {
constructor(props) {
super(props)
this.handleToggleChange = this.handleToggleChange.bind(this)
}
handleToggleChange() {
this.props.onToggleActionItem()
}
render() {
return (
<input type="checkbox" onChange={this.handleToggleChange} id="action-item-toggle" />
<label htmlFor="action-item-toggle">Toggle Action Items</label>
</div>
)
}
}
ActionItemToggle.propTypes = {
onToggleActionItem: React.PropTypes.func.isRequired,
}
export default ActionItemToggle
| Remove now unused field class on input | Remove now unused field class on input
| JSX | mit | stride-nyc/remote_retro,tnewell5/remote_retro,samdec11/remote_retro,stride-nyc/remote_retro,tnewell5/remote_retro,stride-nyc/remote_retro | ---
+++
@@ -12,7 +12,6 @@
render() {
return (
- <div className="ui toggle checkbox field">
<input type="checkbox" onChange={this.handleToggleChange} id="action-item-toggle" />
<label htmlFor="action-item-toggle">Toggle Action Items</label>
</div> |
bc9c3d525d0941fac618f8fe3211def338f3116c | src/server/static-app.jsx | src/server/static-app.jsx | import React from 'react'
import ReactDOMServer from 'react-dom/server'
import { StaticRouter } from 'react-router'
import { Provider } from 'react-redux'
import App from './../shared/app'
export default (location: string, store: Object) =>
ReactDOMServer.renderToString(
<Provider store={store}>
<StaticRouter location={location} context={{}}>
<App />
</StaticRouter>
</Provider>)
| import React from 'react'
import ReactDOMServer from 'react-dom/server'
import { StaticRouter } from 'react-router'
import { Provider } from 'react-redux'
import App from './../shared/app'
export default (location: string, store: Object) =>
ReactDOMServer.renderToString(
<Provider store={store}>
<StaticRouter location={location} context={{}}>
<App />
</StaticRouter>
</Provider>,
// Temporary fix until react-router/pull/4484 is released
).replace(/<a href="\/\//g, '<a href="/')
| Add temporary fix for react-router double-slash issue | Add temporary fix for react-router double-slash issue
| JSX | mit | verekia/js-stack-boilerplate,verekia/js-stack-boilerplate | ---
+++
@@ -11,4 +11,6 @@
<StaticRouter location={location} context={{}}>
<App />
</StaticRouter>
- </Provider>)
+ </Provider>,
+// Temporary fix until react-router/pull/4484 is released
+).replace(/<a href="\/\//g, '<a href="/') |
4c0099ee3b8ef6a23c6b74968cfb2fa63a75af3f | src/components/Markets.jsx | src/components/Markets.jsx | const React = window.React = require('react');
import AssetCard from './AssetCard.jsx';
import AssetPair from './AssetPair.jsx';
import AssetList from './AssetList.jsx';
import CustomMarketPicker from './CustomMarketPicker.jsx';
import Stellarify from '../lib/Stellarify';
import ErrorBoundary from './ErrorBoundary.jsx';
import _ from 'lodash';
export default class Markets extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<div className="so-back islandBack islandBack--t">
<div className="island">
<div className="island__header">
Stellar Asset Directory
</div>
<AssetList d={this.props.d}></AssetList>
<div className="AssetListFooter">
StellarTerm does not endorse any of these issuers. They are here for informational purposes only.
<br />
To get listed on StellarTerm, <a href="https://github.com/irisli/stellarterm/tree/master/directory" target="_blank" rel="nofollow noopener noreferrer">please read the instructions on GitHub</a>.
</div>
</div>
</div>
<ErrorBoundary>
<div className="so-back islandBack">
<CustomMarketPicker row={true}></CustomMarketPicker>
</div>
</ErrorBoundary>
</div>
);
}
};
| const React = window.React = require('react');
import AssetCard from './AssetCard.jsx';
import AssetPair from './AssetPair.jsx';
import AssetList from './AssetList.jsx';
import CustomMarketPicker from './CustomMarketPicker.jsx';
import Stellarify from '../lib/Stellarify';
import ErrorBoundary from './ErrorBoundary.jsx';
import _ from 'lodash';
export default class Markets extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<div className="so-back islandBack islandBack--t">
<div className="island">
<AssetList d={this.props.d}></AssetList>
<div className="AssetListFooter">
StellarTerm does not endorse any of these issuers. They are here for informational purposes only.
<br />
To get listed on StellarTerm, <a href="https://github.com/irisli/stellarterm/tree/master/directory" target="_blank" rel="nofollow noopener noreferrer">please read the instructions on GitHub</a>.
</div>
</div>
</div>
<ErrorBoundary>
<div className="so-back islandBack">
<CustomMarketPicker row={true}></CustomMarketPicker>
</div>
</ErrorBoundary>
</div>
);
}
};
| Remove header from markets page | Remove header from markets page
| JSX | apache-2.0 | irisli/stellarterm,irisli/stellarterm,irisli/stellarterm | ---
+++
@@ -17,9 +17,6 @@
<div>
<div className="so-back islandBack islandBack--t">
<div className="island">
- <div className="island__header">
- Stellar Asset Directory
- </div>
<AssetList d={this.props.d}></AssetList>
<div className="AssetListFooter">
StellarTerm does not endorse any of these issuers. They are here for informational purposes only. |
c47da17764b350b931856f456938b9bb9029874f | src/colorPalette/containers/colorPalette.container.jsx | src/colorPalette/containers/colorPalette.container.jsx | import React, {Component} from 'react';
// import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
class ColorPalette extends Component {
buildPalette() {
let roomSelected = this.props.roomSelected;
let colors;
if (this.props.rooms[roomSelected]) {
colors = this.props.rooms[roomSelected].colors;
};
let rectWidth = 100;
let rects;
if (colors && colors.length) {
rects = colors.map((color, i) => (
<rect key={i} x={i*rectWidth} y="0" fill={color} width={rectWidth} height="50" />
));
rects.push(<rect key={rects.length} stroke="black" width={rects.length * rectWidth} height="50" fill="transparent"/>)
} else { // If there were no colors passed to props
rects = <rect x="0" y="0" fill="white" width={rectWidth} height="50"></rect>
}
return rects
}
render() {
let rects;
let rectWidth = 100;
rects = this.buildPalette();
return (
<div>
<svg width={rectWidth * (rects.length - 1) || rectWidth}>
<g>
{rects}
</g>
</svg>
</div>
)
}
};
function mapStateToProps({ rooms, roomSelected }) {
return { rooms, roomSelected };
}
// function mapDispatchToProps(dispatch) {
// return bindActionCreators({selectRoom}, dispatch);
// }
export default connect(mapStateToProps)(ColorPalette);
| import React, {Component} from 'react';
// import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
class ColorPalette extends Component {
buildPalette() {
let roomSelected = this.props.roomSelected;
const color = this.props.rooms[roomSelected].color && this.props.rooms[roomSelected].color.hex;
let rectWidth = 100;
return <rect x="0" y="0" fill={color || 'white'} width={rectWidth} height="50" />
}
render() {
let rects;
let rectWidth = 100;
rects = this.buildPalette();
return (
<div>
<svg width={rectWidth * (rects.length - 1) || rectWidth}>
<g>
{rects}
</g>
</svg>
</div>
)
}
};
function mapStateToProps({ rooms, roomSelected }) {
return { rooms, roomSelected };
}
// function mapDispatchToProps(dispatch) {
// return bindActionCreators({selectRoom}, dispatch);
// }
export default connect(mapStateToProps)(ColorPalette);
| Make ColorPalette display the room's current color | feat: Make ColorPalette display the room's current color
ColorPalette used to display each room's color array. Now that we're storing only one color per room, it wasn't working. This commit rewrites ColorPalette to display each room's color.
| JSX | mit | Nailed-it/Designify,Nailed-it/Designify | ---
+++
@@ -5,23 +5,9 @@
class ColorPalette extends Component {
buildPalette() {
let roomSelected = this.props.roomSelected;
- let colors;
- if (this.props.rooms[roomSelected]) {
- colors = this.props.rooms[roomSelected].colors;
- };
+ const color = this.props.rooms[roomSelected].color && this.props.rooms[roomSelected].color.hex;
let rectWidth = 100;
- let rects;
- if (colors && colors.length) {
-
- rects = colors.map((color, i) => (
-
- <rect key={i} x={i*rectWidth} y="0" fill={color} width={rectWidth} height="50" />
- ));
- rects.push(<rect key={rects.length} stroke="black" width={rects.length * rectWidth} height="50" fill="transparent"/>)
- } else { // If there were no colors passed to props
- rects = <rect x="0" y="0" fill="white" width={rectWidth} height="50"></rect>
- }
- return rects
+ return <rect x="0" y="0" fill={color || 'white'} width={rectWidth} height="50" />
}
render() { |
b562d8a35ed75afe982b8d366d9632f9fa60e93b | app/Routes.jsx | app/Routes.jsx | import React from 'react';
import {
HashRouter as Router,
Route,
Switch
} from 'react-router-dom';
import NavBar from './components/NavBar';
import Home from './containers/Home';
import Forecast from './containers/Forecast';
import Detail from './containers/Detail';
import NotFound from './containers/NotFound';
const Routes = () => (
<Router>
<div className="container">
<NavBar />
<Switch>
<Route exact path="/" component={Home} />
<Route path="/forecast/:city" component={Forecast} />
<Route path="/detail/:city" component={Detail} />
<Route component={NotFound} />
</Switch>
</div>
</Router>
);
export default Routes;
| import React from 'react';
import {
BrowserRouter as Router,
Route,
Switch
} from 'react-router-dom';
import NavBar from './components/NavBar';
import Home from './containers/Home';
import Forecast from './containers/Forecast';
import Detail from './containers/Detail';
import NotFound from './containers/NotFound';
const Routes = () => (
<Router>
<div className="container">
<NavBar />
<Switch>
<Route exact path="/" component={Home} />
<Route path="/forecast/:city" component={Forecast} />
<Route path="/detail/:city" component={Detail} />
<Route component={NotFound} />
</Switch>
</div>
</Router>
);
export default Routes;
| Use BrowserRouter because HashRouter can't push state | Use BrowserRouter because HashRouter can't push state
| JSX | mit | FalloutX/50-degrees,FalloutX/50-degrees | ---
+++
@@ -1,6 +1,6 @@
import React from 'react';
import {
- HashRouter as Router,
+ BrowserRouter as Router,
Route,
Switch
} from 'react-router-dom'; |
70b20fb76f034bacdcb9e91d8a2208d7054f3bff | app/javascript/app/pages/country-compare/country-compare-component.jsx | app/javascript/app/pages/country-compare/country-compare-component.jsx | import React from 'react';
import PropTypes from 'prop-types';
import Sticky from 'react-stickynode';
import Header from 'components/header';
import Intro from 'components/intro';
import AnchorNav from 'components/anchor-nav';
import CountryCompareSelector from 'components/country-compare/country-compare-selector';
import layout from 'styles/layout.scss';
import anchorNavRegularTheme from 'styles/themes/anchor-nav/anchor-nav-regular.scss';
import styles from './country-compare-styles.scss';
const CountryCompare = ({ route, anchorLinks }) => (
<div>
<Header route={route}>
<div className={layout.content}>
<Intro title={'Country Comparison'} />
</div>
<Sticky activeClass="sticky -country-compare" top="#navBarMobile">
<AnchorNav
links={anchorLinks}
className={layout.content}
theme={anchorNavRegularTheme}
gradientColor={route.headerColor}
/>
</Sticky>
</Header>
<CountryCompareSelector className={styles.countrySelectors} />
{route.sections &&
route.sections.length > 0 &&
route.sections.map(section => (
<section key={section.hash} id={section.hash}>
{section.component && <section.component />}
</section>
))}
</div>
);
CountryCompare.propTypes = {
route: PropTypes.object.isRequired,
anchorLinks: PropTypes.array.isRequired
};
export default CountryCompare;
| import React from 'react';
import PropTypes from 'prop-types';
import Sticky from 'react-stickynode';
import Header from 'components/header';
import Intro from 'components/intro';
import AnchorNav from 'components/anchor-nav';
import CountryCompareSelector from 'components/country-compare/country-compare-selector';
import ModalMetadata from 'components/modal-metadata';
import layout from 'styles/layout.scss';
import anchorNavRegularTheme from 'styles/themes/anchor-nav/anchor-nav-regular.scss';
import styles from './country-compare-styles.scss';
const CountryCompare = ({ route, anchorLinks }) => (
<div>
<Header route={route}>
<div className={layout.content}>
<Intro title={'Country Comparison'} />
</div>
<Sticky activeClass="sticky -country-compare" top="#navBarMobile">
<AnchorNav
links={anchorLinks}
className={layout.content}
theme={anchorNavRegularTheme}
gradientColor={route.headerColor}
/>
</Sticky>
</Header>
<CountryCompareSelector className={styles.countrySelectors} />
{route.sections &&
route.sections.length > 0 &&
route.sections.map(section => (
<section key={section.hash} id={section.hash}>
{section.component && <section.component />}
</section>
))}
<ModalMetadata />
</div>
);
CountryCompare.propTypes = {
route: PropTypes.object.isRequired,
anchorLinks: PropTypes.array.isRequired
};
export default CountryCompare;
| Add modalMetadata to country compare | Add modalMetadata to country compare
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -6,6 +6,7 @@
import Intro from 'components/intro';
import AnchorNav from 'components/anchor-nav';
import CountryCompareSelector from 'components/country-compare/country-compare-selector';
+import ModalMetadata from 'components/modal-metadata';
import layout from 'styles/layout.scss';
import anchorNavRegularTheme from 'styles/themes/anchor-nav/anchor-nav-regular.scss';
@@ -34,6 +35,7 @@
{section.component && <section.component />}
</section>
))}
+ <ModalMetadata />
</div>
);
|
124ea02d601a2c007722f79d34c8f3e5d613bb27 | packages/lesswrong/components/common/Error404.jsx | packages/lesswrong/components/common/Error404.jsx | import { registerComponent } from 'meteor/vulcan:lib';
import React from 'react';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { useServerRequestStatus } from '../../lib/routeUtil'
const Error404 = () => {
const serverRequestStatus = useServerRequestStatus()
if (serverRequestStatus) serverRequestStatus.status = 404
return (
<div className="error404">
<h3><FormattedMessage id="app.404"/></h3>
</div>
);
};
Error404.displayName = 'Error404';
registerComponent('Error404', Error404);
export default Error404; | import { Components, registerComponent } from 'meteor/vulcan:lib';
import React from 'react';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { useServerRequestStatus } from '../../lib/routeUtil'
const Error404 = () => {
const { SingleColumnSection } = Components;
const serverRequestStatus = useServerRequestStatus()
if (serverRequestStatus) serverRequestStatus.status = 404
return (
<SingleColumnSection>
<h2>404 Not Found</h2>
<h3>Sorry, we couldn't find what you were looking for.</h3>
</SingleColumnSection>
);
};
Error404.displayName = 'Error404';
registerComponent('Error404', Error404);
export default Error404; | Make 404 page not completely terrible | Make 404 page not completely terrible
| JSX | mit | Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2 | ---
+++
@@ -1,15 +1,18 @@
-import { registerComponent } from 'meteor/vulcan:lib';
+import { Components, registerComponent } from 'meteor/vulcan:lib';
import React from 'react';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { useServerRequestStatus } from '../../lib/routeUtil'
const Error404 = () => {
+ const { SingleColumnSection } = Components;
const serverRequestStatus = useServerRequestStatus()
if (serverRequestStatus) serverRequestStatus.status = 404
+
return (
- <div className="error404">
- <h3><FormattedMessage id="app.404"/></h3>
- </div>
+ <SingleColumnSection>
+ <h2>404 Not Found</h2>
+ <h3>Sorry, we couldn't find what you were looking for.</h3>
+ </SingleColumnSection>
);
};
|
03feeba4b1aa70633e08681547e3ef4df983c6b1 | src/components/FullsizePicture.jsx | src/components/FullsizePicture.jsx | import React from "react";
import Radium from "radium";
import Picture from "./Picture";
class FullSizePicture extends React.PureComponent {
getStyles() {
const styles = {
overflow: "hidden",
width: "100%",
position: "relative",
};
return [
styles,
this.props.style,
];
}
getImageWrapperStyles() {
return {
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0,
};
}
getImageStyles() {
return {
position: "absolute",
top: "50%",
left: "50%",
margin: "auto",
width: "auto",
height: "auto",
minWidth: "100%",
minHeight: "100%",
maxWidth: "none",
maxHeight: "none",
transform: "translate3d(-50%, -50%, 0)",
};
}
render() {
return (
<div style={this.getStyles()}>
<div style={this.getImageWrapperStyles()}>
<Picture
src={this.props.src}
sources={this.props.sources}
style={this.getImageStyles()}
/>
</div>
</div>
);
}
}
FullSizePicture.propTypes = {
sources: React.PropTypes.array,
src: React.PropTypes.string,
style: React.PropTypes.array,
};
export default Radium(FullSizePicture);
| import React from "react";
import Radium from "radium";
import Picture from "./Picture";
class FullSizePicture extends React.PureComponent {
getStyles() {
const styles = {
overflow: "hidden",
width: "100%",
position: "relative",
};
return [
styles,
this.props.style,
];
}
getImageWrapperStyles() {
return {
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0,
};
}
getImageStyles() {
return {
position: "absolute",
top: "50%",
left: "50%",
margin: "auto",
width: "auto",
height: "auto",
minWidth: "100%",
minHeight: "100%",
maxWidth: "none",
maxHeight: "none",
transform: "translate3d(-50%, -50%, 0)",
};
}
render() {
return (
<div style={this.getStyles()}>
<div style={this.getImageWrapperStyles()}>
<Picture
src={this.props.src}
sources={this.props.sources}
style={this.getImageStyles()}
/>
</div>
</div>
);
}
}
FullSizePicture.propTypes = {
sources: React.PropTypes.array,
src: React.PropTypes.string,
style: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.object,
]),
};
export default Radium(FullSizePicture);
| Fix the propTypes becasue style can be either array or object | Fix the propTypes becasue style can be either array or object
| JSX | mit | EDITD/react-responsive-picture | ---
+++
@@ -60,7 +60,10 @@
FullSizePicture.propTypes = {
sources: React.PropTypes.array,
src: React.PropTypes.string,
- style: React.PropTypes.array,
+ style: React.PropTypes.oneOfType([
+ React.PropTypes.array,
+ React.PropTypes.object,
+ ]),
};
export default Radium(FullSizePicture); |
7bf603a86f82e105ff148d3e6c5221468d81cd94 | src/components/controls/Textly.jsx | src/components/controls/Textly.jsx | // @flow
import React from "react";
import s from "./styles.scss";
const Textly = (props: {
name: string,
value: string,
onSetFilterOption: (string, any) => {}
}) => (
<div>
<div className={s.label}>{props.name}</div>
<textarea
type="text"
value={props.value}
wrap="off"
onChange={e => props.onSetFilterOption(props.name, e.target.value)}
/>
</div>
);
export default Textly;
| // @flow
import React from "react";
import s from "./styles.scss";
const Textly = (props: {
name: string,
value: string,
onSetFilterOption: (string, any) => {}
}) => (
<div>
<div className={s.label}>{props.name}</div>
<textarea
type="text"
value={props.value}
wrap="off"
spellcheck="false"
onChange={e => props.onSetFilterOption(props.name, e.target.value)}
/>
</div>
);
export default Textly;
| Disable spellcheck on textarea controls | Disable spellcheck on textarea controls
| JSX | mit | gyng/ditherer,gyng/ditherer,gyng/ditherer | ---
+++
@@ -15,6 +15,7 @@
type="text"
value={props.value}
wrap="off"
+ spellcheck="false"
onChange={e => props.onSetFilterOption(props.name, e.target.value)}
/>
</div> |
f5a79b1ceb1efda37a9f174a6c8dd09e914406f4 | themes/janeswalk/js/views/FacebookShareDialog.jsx | themes/janeswalk/js/views/FacebookShareDialog.jsx | 'use strict';
/**
* The dialogue to share on facebook
*
* @public
* @param Object shareObj
* @return void
*/
var FacebookShareDialog = function(shareObj) {
this._shareObj = shareObj;
this._shareObj.method = 'feed';
};
FacebookShareDialog.prototype = {
/**
* _shareObj
*
* @protected
* @var Object (default: null)
*/
_shareObj: null,
/**
* show
*
* @public
* @param Function failed
* @param Function successful
* @return void
*/
show: function(failed, successful) {
var _this = this;
FB.ui(
this._shareObj,
function(response) {
if (response !== undefined) {
if (response === null) {
if (failed) failed();
} else {
if (successful) successful();
}
}
}
);
}
};
module.exports = FacebookShareDialog;
| 'use strict';
/**
* The dialogue to share on facebook
*
* @public
* @param Object shareObj
* @return void
*/
var FacebookShareDialog = function(shareObj) {
this._shareObj = shareObj;
this._shareObj.method = 'feed';
};
Object.defineProperties(FacebookShareDialog.prototype, {
/**
* _shareObj
*
* @protected
* @var Object (default: null)
*/
_shareObj: {value: null, writable: true},
/**
* show
*
* @public
* @param Function failed
* @param Function successful
* @return void
*/
show: {
value: function(failed, successful) {
var _this = this;
FB.ui(
this._shareObj,
function(response) {
if (response !== undefined) {
if (response === null) {
if (failed) failed();
} else {
if (successful) successful();
}
}
}
);
}
}
});
module.exports = FacebookShareDialog;
| Use defineproperties to set facebook share prototype | Use defineproperties to set facebook share prototype
| JSX | mit | jkoudys/janeswalk-web,jkoudys/janeswalk-web,jkoudys/janeswalk-web | ---
+++
@@ -10,14 +10,14 @@
this._shareObj = shareObj;
this._shareObj.method = 'feed';
};
-FacebookShareDialog.prototype = {
+Object.defineProperties(FacebookShareDialog.prototype, {
/**
* _shareObj
*
* @protected
* @var Object (default: null)
*/
- _shareObj: null,
+ _shareObj: {value: null, writable: true},
/**
* show
@@ -27,22 +27,24 @@
* @param Function successful
* @return void
*/
- show: function(failed, successful) {
- var _this = this;
- FB.ui(
- this._shareObj,
- function(response) {
- if (response !== undefined) {
- if (response === null) {
- if (failed) failed();
- } else {
- if (successful) successful();
+ show: {
+ value: function(failed, successful) {
+ var _this = this;
+ FB.ui(
+ this._shareObj,
+ function(response) {
+ if (response !== undefined) {
+ if (response === null) {
+ if (failed) failed();
+ } else {
+ if (successful) successful();
+ }
}
}
- }
- );
+ );
+ }
}
-};
+});
module.exports = FacebookShareDialog;
|
bcd312638dd8317e5574d1c2130b59fe921b8a67 | app/assets/javascripts/components/bible_autocomplete.jsx | app/assets/javascripts/components/bible_autocomplete.jsx | var BibleAutocomplete = React.createClass({
getDefaultProps() {
return {
name: "query_string",
}
},
getInitialState() {
return {
value: "",
}
},
render() {
return (
<div>
<input
ref="input"
autoFocus
autoComplete="off"
value={this.state.value}
onChange={this.handleChange}
name={this.props.name}
placeholder="Isaiah 40:8"
/>
<div>
{this.getSuggestions().normalized}
</div>
<div>
{this.getSuggestions().suggesting}
</div>
{this.getSuggestions().suggestions.map(({ abbreviated, normalized }) => (
<div key={abbreviated}>
<a
href="javascript://"
onClick={this.handleClick(normalized)}
>
{abbreviated}
</a>
</div>
))}
</div>
)
},
handleClick(value) {
return () => {
this.setState({ value: `${value} ` }, () => this.refs.input.focus())
}
},
handleChange({ target: { value }}) {
this.setState({ value })
},
getSuggestions() {
return suggestions(this.state.value)
}
})
| var BibleAutocomplete = React.createClass({
getDefaultProps() {
return {
name: "query_string",
}
},
getInitialState() {
return {
value: "",
}
},
render() {
return (
<div>
<input
ref="input"
autoFocus
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
value={this.state.value}
onChange={this.handleChange}
name={this.props.name}
placeholder="Isaiah 40:8"
/>
<div>
{this.getSuggestions().normalized}
</div>
<div>
{this.getSuggestions().suggesting}
</div>
{this.getSuggestions().suggestions.map(({ abbreviated, normalized }) => (
<div key={abbreviated}>
<a
href="javascript://"
onClick={this.handleClick(normalized)}
>
{abbreviated}
</a>
</div>
))}
</div>
)
},
handleClick(value) {
return () => {
this.setState({ value: `${value} ` }, () => this.refs.input.focus())
}
},
handleChange({ target: { value }}) {
this.setState({ value })
},
getSuggestions() {
return suggestions(this.state.value)
}
})
| Disable autocomplete, autocorrect, and autocapitalize | Disable autocomplete, autocorrect, and autocapitalize
| JSX | mit | danott/scabbard,danott/scabbard,danott/scabbard | ---
+++
@@ -18,6 +18,8 @@
ref="input"
autoFocus
autoComplete="off"
+ autoCorrect="off"
+ autoCapitalize="off"
value={this.state.value}
onChange={this.handleChange}
name={this.props.name} |
8165ee936b6aeae0643650c2bb2cf5686a8db908 | app/components/navbar/navbar.jsx | app/components/navbar/navbar.jsx | import React from 'react'
import { Link } from 'react-router'
export default React.createClass({
render: function () {
return (
<header className="header">
<div className="container">
<div className="header-left">
<Link to={'/'} className="header-item">Quill Connect</Link>
<Link to={'/play'} className="header-tab" activeClassName="is-active">Play</Link>
<Link to={'/results'} className="header-tab" activeClassName="is-active">Results</Link>
</div>
<span className="header-toggle">
<span />
<span />
<span />
</span>
<div className="header-right header-menu">
<span className="header-item">
<Link to={'/admin'} className="header-item" activeClassName="is-active">Admin</Link>
</span>
<span className="header-item">
<a href="#">
Help
</a>
</span>
<span className="header-item">
<a className="button" href="#">Button</a>
</span>
</div>
</div>
</header>
)
}
})
| import React from 'react'
import { Link } from 'react-router'
export default React.createClass({
render: function () {
return (
<header className="header">
<div className="container">
<div className="header-left">
<Link to={'/'} className="header-item">Quill Connect</Link>
<Link to={'/play'} className="header-tab" activeClassName="is-active">Play</Link>
</div>
<span className="header-toggle">
<span />
<span />
<span />
</span>
</div>
</header>
)
}
})
const rightNav = (<div className="header-right header-menu">
<span className="header-item">
<Link to={'/admin'} className="header-item" activeClassName="is-active">Admin</Link>
</span>
<span className="header-item">
<a href="#">
Help
</a>
</span>
<span className="header-item">
<a className="button" href="#">Button</a>
</span>
</div>)
| Tidy up the nav bar for now | Tidy up the nav bar for now | JSX | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | ---
+++
@@ -9,28 +9,28 @@
<div className="header-left">
<Link to={'/'} className="header-item">Quill Connect</Link>
<Link to={'/play'} className="header-tab" activeClassName="is-active">Play</Link>
- <Link to={'/results'} className="header-tab" activeClassName="is-active">Results</Link>
</div>
<span className="header-toggle">
<span />
<span />
<span />
</span>
- <div className="header-right header-menu">
- <span className="header-item">
- <Link to={'/admin'} className="header-item" activeClassName="is-active">Admin</Link>
- </span>
- <span className="header-item">
- <a href="#">
- Help
- </a>
- </span>
- <span className="header-item">
- <a className="button" href="#">Button</a>
- </span>
- </div>
</div>
</header>
)
}
})
+
+const rightNav = (<div className="header-right header-menu">
+ <span className="header-item">
+ <Link to={'/admin'} className="header-item" activeClassName="is-active">Admin</Link>
+ </span>
+ <span className="header-item">
+ <a href="#">
+ Help
+ </a>
+ </span>
+ <span className="header-item">
+ <a className="button" href="#">Button</a>
+ </span>
+</div>) |
dee49e14ee47ca265a3faeb9ffb0dd0d204f67ec | app/assets/javascripts/components/LayoutComponents/Header.js.jsx | app/assets/javascripts/components/LayoutComponents/Header.js.jsx | var Header = React.createClass({
render: function(){
return (
<div id="header">
<Sidebar />
<div id="mainHead">
<FixedMenuTemplate />
<MobileMenu />
<div className="ui huge icon header inverted">
<a href="/dashboard"> <i className="circular configure icon inverted"></i></a> <span className="header_text">MeToo</span>
</div>
<h2 className="ui header inverted">
<span className="header_text">MeToo</span>
</h2>
</div>
<img id="mainImage" src="http://i.imgur.com/LnTYPZ2.jpg" />
</div>
)
}
})
| var Header = React.createClass({
render: function(){
return (
<div id="header">
<Sidebar />
<div id="mainHead">
<FixedMenuTemplate />
<MobileMenu />
<div className="ui huge icon header inverted">
<a href="/dashboard"> <i className="circular configure icon inverted"></i></a> <span className="header_text">MeToo</span>
</div>
<h2 className="ui header inverted">
<span className="header_text">MeToo</span>
</h2>
</div>
<img id="mainImage" src="http://i.imgur.com/VYcXx10.jpg" />
</div>
)
}
})
| Update header image to person on city street | Update header image to person on city street
| JSX | mit | acoravos/metoo,acoravos/metoo,acoravos/metoo | ---
+++
@@ -20,7 +20,7 @@
</h2>
</div>
- <img id="mainImage" src="http://i.imgur.com/LnTYPZ2.jpg" />
+ <img id="mainImage" src="http://i.imgur.com/VYcXx10.jpg" />
</div>
) |
bebc0834c7c8def73ab7bfcf72aad97b55d570c3 | src/react-chayns-tapp_portal/component/TappPortal.jsx | src/react-chayns-tapp_portal/component/TappPortal.jsx | import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
let wasRendered = false;
let isDestroyed = false;
let lastParent = null;
const TappPortal = ({ children, parent }) => {
let parentToUse = document.getElementsByClassName('tapp')[0] || document.body;
if (!parent && wasRendered && parentToUse !== lastParent) {
isDestroyed = true;
}
if (!parent && isDestroyed) {
return null;
}
if (parent) {
parentToUse = parent;
}
if (!wasRendered) {
wasRendered = true;
}
lastParent = parentToUse;
return createPortal(children, parentToUse);
};
TappPortal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
parent: PropTypes.instanceOf(Element),
};
export default TappPortal;
| import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
let wasRendered = false;
let isDestroyed = false;
let lastParent = null;
const TappPortal = ({ children, parent }) => {
let parentToUse = document.getElementsByClassName('tapp')[0] || document.body;
if (!parent && wasRendered && parentToUse !== lastParent) {
// destroy old tapp portals in tapp DIVs to prevent duplicates after switching tapp
isDestroyed = true;
}
if (!parent && isDestroyed) {
return null;
}
if (parent) {
parentToUse = parent;
}
if (!wasRendered) {
wasRendered = true;
}
lastParent = parentToUse;
return createPortal(children, parentToUse);
};
TappPortal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
parent: PropTypes.instanceOf(Element),
};
export default TappPortal;
| Document tapp portal source code | :bulb: Document tapp portal source code
| JSX | mit | TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components | ---
+++
@@ -10,6 +10,7 @@
let parentToUse = document.getElementsByClassName('tapp')[0] || document.body;
if (!parent && wasRendered && parentToUse !== lastParent) {
+ // destroy old tapp portals in tapp DIVs to prevent duplicates after switching tapp
isDestroyed = true;
}
|
d2d43cc1bc437a3ccae77bf534a4c3d4c2a54382 | src/react-chayns-tapp_portal/component/TappPortal.jsx | src/react-chayns-tapp_portal/component/TappPortal.jsx | import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
let wasRendered = false;
let isDestroyed = false;
let lastParent = null;
const TappPortal = ({ children, parent }) => {
let parentToUse = document.getElementsByClassName('tapp')[0] || document.body;
if (!parent && wasRendered && parentToUse !== lastParent) {
// destroy old tapp portals in tapp DIVs to prevent duplicates after switching tapp
isDestroyed = true;
}
if (!parent && isDestroyed) {
return null;
}
if (parent) {
parentToUse = parent;
}
if (!wasRendered) {
wasRendered = true;
}
lastParent = parentToUse;
return createPortal(children, parentToUse);
};
TappPortal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
parent: PropTypes.instanceOf(Element),
};
export default TappPortal;
| import { useState } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
const TappPortal = ({ children, parent }) => {
let parentToUse = document.getElementsByClassName('tapp')[0] || document.body;
const [wasRendered, setWasRendered] = useState(false);
const [lastParent, setLastParent] = useState(null);
if (!parent && wasRendered && parentToUse !== lastParent) {
// destroy old tapp portals in tapp DIVs to prevent duplicates after switching tapp
return null;
}
if (parent) {
parentToUse = parent;
}
if (!wasRendered) {
setWasRendered(true);
}
if (lastParent !== parentToUse) {
setLastParent(parentToUse);
}
return createPortal(children, parentToUse);
};
TappPortal.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.arrayOf(PropTypes.node),
]),
parent: PropTypes.instanceOf(Element),
};
export default TappPortal;
| Use state instead of global variable | :bug: Use state instead of global variable
| JSX | mit | TobitSoftware/chayns-components,TobitSoftware/chayns-components,TobitSoftware/chayns-components | ---
+++
@@ -1,20 +1,15 @@
+import { useState } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
-
-let wasRendered = false;
-let isDestroyed = false;
-
-let lastParent = null;
const TappPortal = ({ children, parent }) => {
let parentToUse = document.getElementsByClassName('tapp')[0] || document.body;
+ const [wasRendered, setWasRendered] = useState(false);
+ const [lastParent, setLastParent] = useState(null);
+
if (!parent && wasRendered && parentToUse !== lastParent) {
// destroy old tapp portals in tapp DIVs to prevent duplicates after switching tapp
- isDestroyed = true;
- }
-
- if (!parent && isDestroyed) {
return null;
}
@@ -23,10 +18,12 @@
}
if (!wasRendered) {
- wasRendered = true;
+ setWasRendered(true);
}
- lastParent = parentToUse;
+ if (lastParent !== parentToUse) {
+ setLastParent(parentToUse);
+ }
return createPortal(children, parentToUse);
}; |
6cbfa2772b068318af6dd5a0efc03f62ee686400 | javascript/main.jsx | javascript/main.jsx | require('./styles/main');
require('./components/Routes.react');
| require('./styles/main');
require('./components/Routes.react');
document.body.addEventListener('contextmenu', e => e.preventDefault(), false);
| Disable right click on webview | Disable right click on webview
| JSX | mit | wfalkwallace/GithubPulse,rafaelstz/GithubPulse,rafaelstz/GithubPulse,rafaell-lycan/GithubPulse,rafaelstz/GithubPulse,rafaell-lycan/GithubPulse,rafaell-lycan/GithubPulse,wfalkwallace/GithubPulse,tadeuzagallo/GithubPulse,tadeuzagallo/GithubPulse,DarthMike/GithubPulse,tadeuzagallo/GithubPulse,tadeuzagallo/GithubPulse,DarthMike/GithubPulse,DarthMike/GithubPulse,DarthMike/GithubPulse,rafaelstz/GithubPulse,wfalkwallace/GithubPulse,rafaell-lycan/GithubPulse,wfalkwallace/GithubPulse | ---
+++
@@ -1,2 +1,4 @@
require('./styles/main');
require('./components/Routes.react');
+
+document.body.addEventListener('contextmenu', e => e.preventDefault(), false); |
f34b512b84c22a16183aeb89dc56f2426ea12191 | src/app/global/Layout.jsx | src/app/global/Layout.jsx | import React, { Component } from 'react';
import { connect } from 'react-redux'
import NavBar from './NavBar';
class Layout extends Component {
constructor(props) {
super(props)
}
render() {
return (
<div>
<NavBar />
{this.props.children}
</div>
)
}
}
export default connect()(Layout); | import React, { Component } from 'react';
import NavBar from './NavBar';
export default class Layout extends Component {
constructor(props) {
super(props)
}
render() {
return (
<div>
<NavBar />
{this.props.children}
</div>
)
}
} | Remove connect and export component instead | Remove connect and export component instead
| JSX | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -1,9 +1,8 @@
import React, { Component } from 'react';
-import { connect } from 'react-redux'
import NavBar from './NavBar';
-class Layout extends Component {
+export default class Layout extends Component {
constructor(props) {
super(props)
}
@@ -17,5 +16,3 @@
)
}
}
-
-export default connect()(Layout); |
4a275d159be9ad2fc03864769ba8bbd742c53fbc | public/app/screens/main/sections/devices/room/room.jsx | public/app/screens/main/sections/devices/room/room.jsx | var React = require('react');
var Reflux = require('reflux');
var styleMixin = require('mixins/style-mixin');
var _ = require('lodash');
var deviceListStore = require('stores/device-list');
var deviceActions = require('actions/device');
var Device = require('./device');
var Gateway = require('./gateway');
var Room = React.createClass({
mixins: [
Reflux.connect(deviceListStore),
styleMixin(require('./style.scss'))
],
componentDidMount: function componentDidMount () {
var REFETCH_INTERVAL = 1000;
// Refetch devices every some seconds as long as we have no push messages
this.refetchIntervalId = window.setInterval(() => {
deviceActions.fetchList();
}, REFETCH_INTERVAL);
},
componentWillUnmount: function componentWillUnmount () {
// Stop refetching devices
window.clearInterval(this.refetchIntervalId);
},
render: function render () {
var devices = _(this.state.devices)
.reject((device) => device.hidden)
.map((device, i) => <Device device={device} key={i}/>)
.value();
return (
<div className='cc-room'>
<div className='row fixed-height-1 group-header'>
<div className='column small-14 quarter-padded-left'>
<h3 className='align-text-top uppercase'>{this.props.title}</h3>
</div>
</div>
<Gateway/>
{devices}
</div>
);
}
});
module.exports = Room;
| var React = require('react');
var Reflux = require('reflux');
var styleMixin = require('mixins/style-mixin');
var _ = require('lodash');
var deviceListStore = require('stores/device-list');
var deviceActions = require('actions/device');
var Device = require('./device');
var Gateway = require('./gateway');
var Room = React.createClass({
mixins: [
Reflux.connect(deviceListStore),
styleMixin(require('./style.scss'))
],
componentDidMount: function componentDidMount () {
var REFETCH_INTERVAL = 2000;
// Refetch devices every some seconds as long as we have no push messages
this.refetchIntervalId = window.setInterval(() => {
deviceActions.fetchList();
}, REFETCH_INTERVAL);
},
componentWillUnmount: function componentWillUnmount () {
// Stop refetching devices
window.clearInterval(this.refetchIntervalId);
},
render: function render () {
var devices = _(this.state.devices)
.reject((device) => device.hidden)
.map((device, i) => <Device device={device} key={i}/>)
.value();
return (
<div className='cc-room'>
<div className='row fixed-height-1 group-header'>
<div className='column small-14 quarter-padded-left'>
<h3 className='align-text-top uppercase'>{this.props.title}</h3>
</div>
</div>
<Gateway/>
{devices}
</div>
);
}
});
module.exports = Room;
| Increase fetching interval to apprx. match gateway's response time | Increase fetching interval to apprx. match gateway's response time
| JSX | mit | yetu/controlcenter,yetu/controlcenter,yetu/controlcenter | ---
+++
@@ -17,7 +17,7 @@
],
componentDidMount: function componentDidMount () {
- var REFETCH_INTERVAL = 1000;
+ var REFETCH_INTERVAL = 2000;
// Refetch devices every some seconds as long as we have no push messages
this.refetchIntervalId = window.setInterval(() => { |
1ab8633c22e2636284c62363512db2e10b71f8c3 | src/sentry/static/sentry/app/components/events/interfaces/contexts/contextBlock.jsx | src/sentry/static/sentry/app/components/events/interfaces/contexts/contextBlock.jsx | import React from 'react';
import _ from 'underscore';
import {defined} from '../../../../utils';
import KeyValueList from '../keyValueList';
const ContextBlock = React.createClass({
propTypes: {
alias: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
data: React.PropTypes.object.isRequired,
knownData: React.PropTypes.array,
},
render() {
let data = [];
let className = `context-block context-block-${this.props.data.type}`;
let title = this.props.title || this.props.data.title;
let alias = null;
if (!title) {
title = this.props.alias;
} else {
alias = (
<small>{' ('}{this.props.alias})</small>
);
}
(this.props.knownData || []).forEach(([key, value]) => {
if (defined(value)) {
data.push([key, value]);
}
});
let extraData = [];
for (let key in this.props.data) {
if (key !== 'type') {
extraData.push([key, this.props.data[key]]);
}
}
if (extraData.length > 0) {
data = data.concat(_.sortBy(extraData, (key, value) => key));
}
return (
<div className={className}>
<h4>{title}{alias}</h4>
<KeyValueList data={data} isSorted={false} />
</div>
);
}
});
export default ContextBlock;
| import React from 'react';
import _ from 'underscore';
import {defined} from '../../../../utils';
import KeyValueList from '../keyValueList';
const ContextBlock = React.createClass({
propTypes: {
alias: React.PropTypes.string.isRequired,
title: React.PropTypes.string,
data: React.PropTypes.object.isRequired,
knownData: React.PropTypes.array,
},
render() {
let data = [];
let className = `context-block context-block-${this.props.data.type}`;
let title = this.props.title || this.props.data.title;
let alias = null;
if (!title) {
title = this.props.alias;
} else {
alias = (
<small>{' ('}{this.props.alias})</small>
);
}
(this.props.knownData || []).forEach(([key, value]) => {
if (defined(value)) {
data.push([key, value]);
}
});
let extraData = [];
for (let key in this.props.data) {
if (key !== 'type' && key !== 'title') {
extraData.push([key, this.props.data[key]]);
}
}
if (extraData.length > 0) {
data = data.concat(_.sortBy(extraData, (key, value) => key));
}
return (
<div className={className}>
<h4>{title}{alias}</h4>
<KeyValueList data={data} isSorted={false} />
</div>
);
}
});
export default ContextBlock;
| Remove title from data block | Remove title from data block
| JSX | bsd-3-clause | BuildingLink/sentry,zenefits/sentry,ifduyue/sentry,looker/sentry,JamesMura/sentry,alexm92/sentry,mvaled/sentry,JamesMura/sentry,JackDanger/sentry,beeftornado/sentry,mitsuhiko/sentry,gencer/sentry,fotinakis/sentry,BuildingLink/sentry,jean/sentry,JamesMura/sentry,ifduyue/sentry,alexm92/sentry,mvaled/sentry,fotinakis/sentry,gencer/sentry,mvaled/sentry,looker/sentry,jean/sentry,alexm92/sentry,JackDanger/sentry,looker/sentry,JamesMura/sentry,JamesMura/sentry,mvaled/sentry,JackDanger/sentry,jean/sentry,zenefits/sentry,BuildingLink/sentry,ifduyue/sentry,zenefits/sentry,gencer/sentry,gencer/sentry,jean/sentry,zenefits/sentry,beeftornado/sentry,zenefits/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,looker/sentry,BuildingLink/sentry,ifduyue/sentry,mitsuhiko/sentry,fotinakis/sentry,fotinakis/sentry,gencer/sentry,jean/sentry,ifduyue/sentry,looker/sentry,BuildingLink/sentry | ---
+++
@@ -35,7 +35,7 @@
let extraData = [];
for (let key in this.props.data) {
- if (key !== 'type') {
+ if (key !== 'type' && key !== 'title') {
extraData.push([key, this.props.data[key]]);
}
} |
de09f9054d2af6fc070d1ce66bb1918314867641 | services/QuillLMS/client/app/bundles/Teacher/components/dashboard/dashboard_footer.jsx | services/QuillLMS/client/app/bundles/Teacher/components/dashboard/dashboard_footer.jsx | 'use strict'
import React from 'react'
export default React.createClass({
render: function() {
return(
<div className='footer-row row'>
<div className='review-request col-md-1 col-sm-12'>
<i className="fa fa-heart"></i> Love Quill? <a href='https://www.graphite.org/website/quill'>Please write a review.</a>
</div>
<div className='footer-img col-md-3 col-md-offset-8 col-sm-12'>
<a href='https://chrome.google.com/webstore/detail/quill/bponbohdnbmecjheeeagoigamblomimg'>
<img src='/chrome_badge.png'></img>
</a>
</div>
</div>
);
}
});
| import React from 'react';
export default () => (
<div className="footer-row row">
<div className="review-request col-md-1 col-sm-12">
<i className="fa fa-heart" /> Love Quill? <a href="https://www.commonsense.org/education/website/quill">Please write a review.</a>
</div>
<div className="footer-img col-md-3 col-md-offset-8 col-sm-12">
<a href="https://chrome.google.com/webstore/detail/quill/bponbohdnbmecjheeeagoigamblomimg">
<img src="/chrome_badge.png" />
</a>
</div>
</div>
);
| Update dashboard footer review link, and make into a dumb component | Update dashboard footer review link, and make into a dumb component
| JSX | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | ---
+++
@@ -1,21 +1,15 @@
-'use strict'
+import React from 'react';
- import React from 'react'
+export default () => (
+ <div className="footer-row row">
+ <div className="review-request col-md-1 col-sm-12">
+ <i className="fa fa-heart" /> Love Quill? <a href="https://www.commonsense.org/education/website/quill">Please write a review.</a>
+ </div>
+ <div className="footer-img col-md-3 col-md-offset-8 col-sm-12">
+ <a href="https://chrome.google.com/webstore/detail/quill/bponbohdnbmecjheeeagoigamblomimg">
+ <img src="/chrome_badge.png" />
+ </a>
+ </div>
+ </div>
+);
- export default React.createClass({
-
- render: function() {
- return(
- <div className='footer-row row'>
- <div className='review-request col-md-1 col-sm-12'>
- <i className="fa fa-heart"></i> Love Quill? <a href='https://www.graphite.org/website/quill'>Please write a review.</a>
- </div>
- <div className='footer-img col-md-3 col-md-offset-8 col-sm-12'>
- <a href='https://chrome.google.com/webstore/detail/quill/bponbohdnbmecjheeeagoigamblomimg'>
- <img src='/chrome_badge.png'></img>
- </a>
- </div>
- </div>
- );
- }
-}); |
a9ba4995caaedd1292b821e821235139b095090a | src/index.jsx | src/index.jsx | /* eslint no-underscore-dangle: "off" */
import React from 'react'
import ReactDom from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, compose } from 'redux'
import App from './components/App'
import reducer from './reducers/reducer'
import { remote } from 'electron'
import { persistStore, autoRehydrate } from 'redux-persist'
import { AsyncNodeStorage } from 'redux-persist-node-storage'
// This hack makes my blood boil. But without it the initial state is
// used instead of using the persisted state from AsyncNodeStorage. I'd prefer
// to use something other than setTimeout to make this work, but it works for
// now.
const hackToLoadEverything = store => {
const render = () => {
ReactDom.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('content')
)
}
setTimeout(render, 10)
}
window.onload = function() {
const reduxDevTools = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
const enhancers = compose(autoRehydrate(), reduxDevTools)
const store = createStore(reducer, undefined, enhancers)
const persistDir = remote.app.getPath('desktop')
const persistOptions = { storage: new AsyncNodeStorage(persistDir) }
persistStore(store, persistOptions)
hackToLoadEverything(store)
}
| /* eslint no-underscore-dangle: "off" */
import React from 'react'
import ReactDom from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, compose } from 'redux'
import App from './components/App'
import reducer from './reducers/reducer'
import { remote } from 'electron'
import { persistStore, autoRehydrate } from 'redux-persist'
import { AsyncNodeStorage } from 'redux-persist-node-storage'
// This hack makes my blood boil. But without it the initial state is
// used instead of using the persisted state from AsyncNodeStorage. I'd prefer
// to use something other than setTimeout to make this work, but it works for
// now.
const hackToLoadEverything = store => {
const render = () => {
ReactDom.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('content')
)
}
setTimeout(render, 10)
}
window.onload = function() {
const reduxDevTools = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
const enhancers = compose(autoRehydrate(), reduxDevTools)
const store = createStore(reducer, undefined, enhancers)
let persistDir = remote.app.getPath('userData')
if (process.env.SNOOZER_ENV) {
persistDir = remote.app.getPath('desktop')
}
const persistOptions = { storage: new AsyncNodeStorage(persistDir) }
persistStore(store, persistOptions)
hackToLoadEverything(store)
}
| Use different redux store in dev mode | Use different redux store in dev mode
| JSX | mit | cheshire137/gh-notifications-snoozer,cheshire137/gh-notifications-snoozer | ---
+++
@@ -31,7 +31,12 @@
const reduxDevTools = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
const enhancers = compose(autoRehydrate(), reduxDevTools)
const store = createStore(reducer, undefined, enhancers)
- const persistDir = remote.app.getPath('desktop')
+
+ let persistDir = remote.app.getPath('userData')
+ if (process.env.SNOOZER_ENV) {
+ persistDir = remote.app.getPath('desktop')
+ }
+
const persistOptions = { storage: new AsyncNodeStorage(persistDir) }
persistStore(store, persistOptions)
|
52cf2209b1022d14db9b7ab892ccc3ca158110b5 | src/js/components/addData/AddDataPage.jsx | src/js/components/addData/AddDataPage.jsx | /**
* AddDataPage.jsx
* Created by Katie Rose 12/7/15
**/
import React from 'react';
import Navbar from '../SharedComponents/NavigationComponent.jsx';
import SubmissionPageHeader from 'SubmissionPageHeader.jsx';
import SubmissionContent from 'SubmissionContent.jsx';
export default class SubmissionPage extends React.Component {
render() {
return (
<div>
<Navbar activeTab="addData"/>
<SubmissionPageHeader />
<SubmissionContent />
</div>
);
}
}
| /**
* AddDataPage.jsx
* Created by Katie Rose 12/7/15
**/
import React from 'react';
import Navbar from '../SharedComponents/NavigationComponent.jsx';
import SubmissionPageHeader from './SubmissionPageHeader.jsx';
import SubmissionContent from './SubmissionContent.jsx';
export default class SubmissionPage extends React.Component {
render() {
return (
<div>
<Navbar activeTab="addData"/>
<SubmissionPageHeader />
<SubmissionContent />
</div>
);
}
}
| Fix paths for Submission components | Fix paths for Submission components
| JSX | cc0-1.0 | fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app | ---
+++
@@ -5,8 +5,8 @@
import React from 'react';
import Navbar from '../SharedComponents/NavigationComponent.jsx';
-import SubmissionPageHeader from 'SubmissionPageHeader.jsx';
-import SubmissionContent from 'SubmissionContent.jsx';
+import SubmissionPageHeader from './SubmissionPageHeader.jsx';
+import SubmissionContent from './SubmissionContent.jsx';
export default class SubmissionPage extends React.Component {
render() { |
7af6c1588e78761efebdf2c0507887020be4e8fa | src/graph-table.jsx | src/graph-table.jsx | import React from 'react';
var _ = require('lodash');
var classNames = require('classnames');
//import WayPoint from 'react-waypoint';
var randomId = function() {
return "MY" + (Math.random() * 1e32).toString(12);
};
//****************************************
//
// Common graph containers
//
//****************************************
var GraphDatatable = React.createClass({
render: function() {
const fields = this.props.data.map((d) => {
var randomKey = randomId();
return (
<tr key={randomKey}><td>
{d.year}
</td><td>
{d.value}
</td><td>
{d.country}
</td></tr>
);
});
return (
<div>
<figure id={this.props.containerId}>
<figcaption>{this.props.title}</figcaption>
<table className="table table-responsive table-striped">
<thead>
<th>Year</th>
<th>Value</th>
<th>Country</th>
</thead>
<tbody>
{fields}
</tbody>
</table>
</figure>
</div>
);
}
});
module.exports = GraphDatatable;
| import React from 'react';
var _ = require('lodash');
var classNames = require('classnames');
//import WayPoint from 'react-waypoint';
var randomId = function() {
return "MY" + (Math.random() * 1e32).toString(12);
};
//****************************************
//
// Common graph containers
//
//****************************************
var GraphDatatable = React.createClass({
render: function() {
const headers = this.props.unifiedData.categories.map((h) => {
return (
<th key={randomId()}>
{h}
</th>
)
});
const fields = this.props.unifiedData.datatable.map((rows) => {
var randomKey = randomId();
const values = rows.map( (val) => {
return (
<td key={randomId()}>
{val}
</td>
);
});
return (
<tr key={randomKey}>
{values}
</tr>
);
});
return (
<div>
<figure id={this.props.containerId}>
<figcaption>{this.props.title}</figcaption>
<table className="table table-responsive table-striped">
<thead>
<th>Year</th>
{headers}
</thead>
<tbody>
{fields}
</tbody>
</table>
</figure>
</div>
);
}
});
module.exports = GraphDatatable;
| Update graph data table to use unified data format. | Update graph data table to use unified data format.
| JSX | mit | fengxia41103/worldsnapshot,fengxia41103/worldsnapshot | ---
+++
@@ -16,16 +16,26 @@
var GraphDatatable = React.createClass({
render: function() {
- const fields = this.props.data.map((d) => {
+ const headers = this.props.unifiedData.categories.map((h) => {
+ return (
+ <th key={randomId()}>
+ {h}
+ </th>
+ )
+ });
+ const fields = this.props.unifiedData.datatable.map((rows) => {
var randomKey = randomId();
+ const values = rows.map( (val) => {
+ return (
+ <td key={randomId()}>
+ {val}
+ </td>
+ );
+ });
return (
- <tr key={randomKey}><td>
- {d.year}
- </td><td>
- {d.value}
- </td><td>
- {d.country}
- </td></tr>
+ <tr key={randomKey}>
+ {values}
+ </tr>
);
});
@@ -36,8 +46,7 @@
<table className="table table-responsive table-striped">
<thead>
<th>Year</th>
- <th>Value</th>
- <th>Country</th>
+ {headers}
</thead>
<tbody>
{fields} |
0226f4e9d5fae99aaf69fcf359ff65f34aab6880 | assets/scripts/components/musters/district-group.jsx | assets/scripts/components/musters/district-group.jsx | 'use strict';
import React from 'react';
import DistrictCard from './district-card.jsx';
const BlockGroup = React.createClass({
filterCards: function(event){
var updatedList = this.props.data.cards;
updatedList = updatedList.filter(function(item){
return item.name.toLowerCase().search(event.target.value.toLowerCase()) !== -1;
});
this.setState({cards: updatedList});
},
getInitialState: function(){
return {
cards: []
};
},
componentWillMount: function(){
this.setState({cards: this.props.data.cards});
},
render: function(){
var _this = this;
return (
<div>
<div className="group-head">
<input className="search-bar u-pull-right" type="text" placeholder="Search" onChange={this.filterCards}/>
<h1 className="u-inline-block">{this.props.data.region_name}</h1>
</div>
<div className="pure-g">
{
this.state.cards.map(function(data, i) {
return <DistrictCard key={i} data={data}></DistrictCard>;
})
}
</div>
</div>
);
}
});
export default BlockGroup;
| 'use strict';
import React from 'react';
import DistrictCard from './district-card.jsx';
const BlockGroup = React.createClass({
filterCards: function(event){
var updatedList = this.props.data.cards;
updatedList = updatedList.filter(function(item){
return item.block_name.toLowerCase().search(event.target.value.toLowerCase()) !== -1;
});
this.setState({cards: updatedList});
},
getInitialState: function(){
return {
cards: []
};
},
componentWillMount: function(){
this.setState({cards: this.props.data.cards});
},
render: function(){
var _this = this;
return (
<div>
<div className="group-head">
<input className="search-bar u-pull-right" type="text" placeholder="Search" onChange={this.filterCards}/>
<h1 className="u-inline-block">{this.props.data.region_name}</h1>
</div>
<div className="pure-g">
{
this.state.cards.map(function(data, i) {
return <DistrictCard key={i} data={data}></DistrictCard>;
})
}
</div>
</div>
);
}
});
export default BlockGroup;
| Apply search for district musters | Apply search for district musters
| JSX | mit | hks-epod/paydash | ---
+++
@@ -8,7 +8,7 @@
filterCards: function(event){
var updatedList = this.props.data.cards;
updatedList = updatedList.filter(function(item){
- return item.name.toLowerCase().search(event.target.value.toLowerCase()) !== -1;
+ return item.block_name.toLowerCase().search(event.target.value.toLowerCase()) !== -1;
});
this.setState({cards: updatedList});
}, |
5fc6364a1b8bac29fe10c6acc3d69138125d9028 | packages/vulcan-ui-material/lib/components/forms/FormNestedArrayLayout.jsx | packages/vulcan-ui-material/lib/components/forms/FormNestedArrayLayout.jsx | import React from 'react';
import PropTypes from 'prop-types';
import { replaceComponent } from 'meteor/vulcan:core';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
const FormNestedArrayLayout = ({ hasErrors, label, content }) => (
<div>
<Typography component="label" variant="caption" style={{ fontSize: 16 }}>
{label}
</Typography>
<div>{content}</div>
</div>
);
FormNestedArrayLayout.propTypes = {
hasErrors: PropTypes.number,
label: PropTypes.node,
content: PropTypes.node,
};
replaceComponent({
name: 'FormNestedArrayLayout',
component: FormNestedArrayLayout,
});
| import React from 'react';
import PropTypes from 'prop-types';
import { replaceComponent } from 'meteor/vulcan:core';
import Grid from '@material-ui/core/Grid';
import Typography from '@material-ui/core/Typography';
const FormNestedArrayLayout = ({ hasErrors, label, content }) => (
<div>
<Typography component="label" variant="caption" style={{ fontSize: 16 }}>
{label}
</Typography>
<div>{content}</div>
</div>
);
FormNestedArrayLayout.propTypes = {
hasErrors: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
label: PropTypes.node,
content: PropTypes.node,
};
replaceComponent({
name: 'FormNestedArrayLayout',
component: FormNestedArrayLayout,
});
| Change hasErrors propTypes to "oneOfType" | Change hasErrors propTypes to "oneOfType" | JSX | mit | VulcanJS/Vulcan,VulcanJS/Vulcan | ---
+++
@@ -14,7 +14,7 @@
</div>
);
FormNestedArrayLayout.propTypes = {
- hasErrors: PropTypes.number,
+ hasErrors: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
label: PropTypes.node,
content: PropTypes.node,
}; |
d30d6c32e41ac42d6f90daab1e0ab1323c16ae30 | imports/ui/ReceivePayment.jsx | imports/ui/ReceivePayment.jsx | import QRCode from 'qrcode.react'
import React from 'react'
import createReactClass from 'create-react-class'
import {Button, Modal, ModalBody, ModalHeader} from 'reactstrap'
const ReceivePayment = createReactClass({
getInitialState: () => ({modal: false}),
toggle: function () {
this.setState({
modal: !this.state.modal
})
},
render: function () {
return (
<div>
<Button color='primary' onClick={this.toggle} block> Receive </Button>
<Modal isOpen={this.state.modal} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
{this.props.address}
</ModalHeader>
<ModalBody>
<div className='d-flex justify-content-center'>
<QRCode value={this.props.address} size={256} />
</div>
</ModalBody>
</Modal>
</div>
)
}
})
export default ReceivePayment
| import QRCode from 'qrcode.react'
import React from 'react'
import createReactClass from 'create-react-class'
import {Button, Modal, ModalBody, ModalHeader} from 'reactstrap'
const ReceivePayment = createReactClass({
getInitialState: () => ({modal: false}),
toggle: function () {
this.setState({
modal: !this.state.modal
})
},
render: function () {
return (
<div>
<Button color='primary' onClick={this.toggle} block> Fund Wallet </Button>
<Modal isOpen={this.state.modal} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
{this.props.address}
</ModalHeader>
<ModalBody>
<div className='d-flex justify-content-center'>
<QRCode value={this.props.address} size={256} />
</div>
</ModalBody>
</Modal>
</div>
)
}
})
export default ReceivePayment
| Rename the button to fund the wallet | Rename the button to fund the wallet
| JSX | mit | SpidChain/spidchain-btcr,SpidChain/spidchain-btcr | ---
+++
@@ -16,7 +16,7 @@
render: function () {
return (
<div>
- <Button color='primary' onClick={this.toggle} block> Receive </Button>
+ <Button color='primary' onClick={this.toggle} block> Fund Wallet </Button>
<Modal isOpen={this.state.modal} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
{this.props.address} |
7137b83be48cf0ded8fd0462721cae05231009db | src/containers/SingleSignOn/SingleSignOnRedirectCallback.jsx | src/containers/SingleSignOn/SingleSignOnRedirectCallback.jsx | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { replace } from 'react-router-redux';
import userManager from './userManager';
class SingleSignOnRedirectCallback extends Component {
componentDidMount() {
userManager.signinRedirectCallback() // TODO What if it fails?
.then(() => {
this.props.dispatch(replace(sessionStorage.lastUrlPath || ''));
});
}
render() {
return null;
}
}
SingleSignOnRedirectCallback.propTypes = {
dispatch: React.PropTypes.func.isRequired,
};
export default connect()(SingleSignOnRedirectCallback);
| import { Component } from 'react';
import userManager from './userManager';
class SingleSignOnRedirectCallback extends Component {
componentDidMount() {
userManager.signinRedirectCallback();
}
render() {
return null;
}
}
export default SingleSignOnRedirectCallback;
| Revert "Added the redirection back to the app after successful login" | Revert "Added the redirection back to the app after successful login"
This reverts commit c2ecd0c222d182a019fde099aaf2525b8cb9b251.
| JSX | mit | e1-bsd/omni-common-ui,e1-bsd/omni-common-ui | ---
+++
@@ -1,14 +1,9 @@
-import React, { Component } from 'react';
-import { connect } from 'react-redux';
-import { replace } from 'react-router-redux';
+import { Component } from 'react';
import userManager from './userManager';
class SingleSignOnRedirectCallback extends Component {
componentDidMount() {
- userManager.signinRedirectCallback() // TODO What if it fails?
- .then(() => {
- this.props.dispatch(replace(sessionStorage.lastUrlPath || ''));
- });
+ userManager.signinRedirectCallback();
}
render() {
@@ -16,8 +11,4 @@
}
}
-SingleSignOnRedirectCallback.propTypes = {
- dispatch: React.PropTypes.func.isRequired,
-};
-
-export default connect()(SingleSignOnRedirectCallback);
+export default SingleSignOnRedirectCallback; |
19ad34312e42392c5eacbe02c0a3e69eeda5b06e | packages/vulcan-ui-bootstrap/lib/components/forms/FormItem.jsx | packages/vulcan-ui-bootstrap/lib/components/forms/FormItem.jsx | /*
Layout for a single form item
*/
import React from 'react';
import Form from 'react-bootstrap/Form';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import { registerComponent } from 'meteor/vulcan:core';
const FormItem = ({ path, label, children, beforeInput, afterInput, ...rest }) => {
if (label) {
return (
<Form.Group as={Row} controlId={path} {...rest}>
<Form.Label column sm={3}>
{label}
</Form.Label>
<Col sm={9}>
{beforeInput}
{children}
{afterInput}
</Col>
</Form.Group>
);
} else {
return (
<Form.Group controlId={path} {...rest}>
{beforeInput}
{children}
{afterInput}
</Form.Group>
);
}
};
registerComponent('FormItem', FormItem);
| /*
Layout for a single form item
*/
import React from 'react';
import Form from 'react-bootstrap/Form';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import { registerComponent } from 'meteor/vulcan:core';
const FormItem = ({ path, label, children, beforeInput, afterInput, layout = 'horizontal', ...rest }) => {
if (layout === 'inputOnly' || !label) { // input only layout
return (
<Form.Group controlId={path} {...rest}>
{beforeInput}
{children}
{afterInput}
</Form.Group>
);
} else if (layout === 'vertical') { // vertical layout
return <div>TODO</div>;
} else { // horizontal layout (default)
return (
<Form.Group as={Row} controlId={path} {...rest}>
<Form.Label column sm={3}>
{label}
</Form.Label>
<Col sm={9}>
{beforeInput}
{children}
{afterInput}
</Col>
</Form.Group>
);
}
};
registerComponent('FormItem', FormItem);
| Add layout prop for Formitem | Add layout prop for Formitem
| JSX | mit | VulcanJS/Vulcan,VulcanJS/Vulcan | ---
+++
@@ -10,8 +10,18 @@
import Col from 'react-bootstrap/Col';
import { registerComponent } from 'meteor/vulcan:core';
-const FormItem = ({ path, label, children, beforeInput, afterInput, ...rest }) => {
- if (label) {
+const FormItem = ({ path, label, children, beforeInput, afterInput, layout = 'horizontal', ...rest }) => {
+ if (layout === 'inputOnly' || !label) { // input only layout
+ return (
+ <Form.Group controlId={path} {...rest}>
+ {beforeInput}
+ {children}
+ {afterInput}
+ </Form.Group>
+ );
+ } else if (layout === 'vertical') { // vertical layout
+ return <div>TODO</div>;
+ } else { // horizontal layout (default)
return (
<Form.Group as={Row} controlId={path} {...rest}>
<Form.Label column sm={3}>
@@ -24,14 +34,6 @@
</Col>
</Form.Group>
);
- } else {
- return (
- <Form.Group controlId={path} {...rest}>
- {beforeInput}
- {children}
- {afterInput}
- </Form.Group>
- );
}
};
|
88360acc80d75f44fd1aa202c18e747eaba0e016 | src/screens/rename/views/browse/components/folder.jsx | src/screens/rename/views/browse/components/folder.jsx | //React modules
import PropTypes from 'prop-types';
import React from 'react';
const Folder = ({ position, extention, match }) => {
return (
<div class={`folder ${match ? 'active' : 'inactive'}`} style={position}>
<svg version='1.1' x='0px' y='0px' viewBox='0 0 55 75' enableBackground='new 0 0 55 75'>
<path
class='folder-edge'
fill='#141B23'
d='M54.5,75h-54C0.224,75,0,74.776,0,74.5v-74C0,0.224,0.224,0,0.5,0h40.125C46.239,5.614,49.386,8.761,55,14.375V74.5C55,74.776,54.776,75,54.5,75z'
/>
</svg>
<h2 class='folder-name'>{extention}</h2>
</div>
);
};
Folder.propTypes = {
extention: PropTypes.string.isRequired,
match: PropTypes.bool.isRequired,
position: PropTypes.object.isRequired,
};
export default Folder;
| //React modules
import PropTypes from 'prop-types';
import React from 'react';
const Folder = ({ extention, match }) => {
return (
<div class={`folder ${match ? 'active' : 'inactive'}`}>
<svg version='1.1' x='0px' y='0px' viewBox='0 0 55 75' enableBackground='new 0 0 55 75'>
<path
class='folder-edge'
fill='#141B23'
d='M54.5,75h-54C0.224,75,0,74.776,0,74.5v-74C0,0.224,0.224,0,0.5,0h40.125C46.239,5.614,49.386,8.761,55,14.375V74.5C55,74.776,54.776,75,54.5,75z'
/>
</svg>
<h2 class='folder-name'>{extention}</h2>
</div>
);
};
Folder.propTypes = {
extention: PropTypes.string.isRequired,
match: PropTypes.bool.isRequired,
};
export default Folder;
| Remove positioning object in place of css | Remove positioning object in place of css
| JSX | mit | radencode/reflow,radencode/reflow-client,radencode/reflow,radencode/reflow-client | ---
+++
@@ -2,9 +2,9 @@
import PropTypes from 'prop-types';
import React from 'react';
-const Folder = ({ position, extention, match }) => {
+const Folder = ({ extention, match }) => {
return (
- <div class={`folder ${match ? 'active' : 'inactive'}`} style={position}>
+ <div class={`folder ${match ? 'active' : 'inactive'}`}>
<svg version='1.1' x='0px' y='0px' viewBox='0 0 55 75' enableBackground='new 0 0 55 75'>
<path
class='folder-edge'
@@ -20,7 +20,6 @@
Folder.propTypes = {
extention: PropTypes.string.isRequired,
match: PropTypes.bool.isRequired,
- position: PropTypes.object.isRequired,
};
export default Folder; |
8b9069e505125467283960c54d7960392da642d9 | app/jsx/external_apps/components/ConfigOptionField.jsx | app/jsx/external_apps/components/ConfigOptionField.jsx | /** @jsx React.DOM */
define([
'react'
], function (React) {
return React.createClass({
displayName: 'ConfigOptionField',
propTypes: {
handleChange: React.PropTypes.func.isRequired,
name: React.PropTypes.string.isRequired,
type: React.PropTypes.string.isRequired,
value: React.PropTypes.any,
required: React.PropTypes.bool,
description: React.PropTypes.string.isRequired
},
checkbox() {
return (
<div className="grid-row">
<div className="col-xs-12">
<label className="checkbox text-left">
<input type="checkbox" data-rel={this.props.name} onChange={this.props.handleChange} /> {this.props.description}
</label>
</div>
</div>
);
},
text() {
return (
<div className="grid-row">
<div className="col-xs-12">
<label className="text-left">{this.props.description}</label>
<input type="text"
className="form-control input-block-level"
placeholder={this.props.description}
defaultValue={this.props.value}
required={this.props.required}
data-rel={this.props.name}
onChange={this.props.handleChange} />
</div>
</div>
);
},
render() {
return (
<div className="form-group">
{this.props.type === 'checkbox' ? this.checkbox() : this.text()}
</div>
)
}
});
}); | /** @jsx React.DOM */
define([
'react'
], function (React) {
return React.createClass({
displayName: 'ConfigOptionField',
propTypes: {
handleChange: React.PropTypes.func.isRequired,
name: React.PropTypes.string.isRequired,
type: React.PropTypes.string.isRequired,
value: React.PropTypes.any,
required: React.PropTypes.bool,
description: React.PropTypes.string.isRequired
},
checkbox() {
return (
<div className="grid-row">
<div className="col-xs-12">
<label className="checkbox">
<input type="checkbox" data-rel={this.props.name} onChange={this.props.handleChange} /> {this.props.description}
</label>
</div>
</div>
);
},
text() {
return (
<div className="grid-row">
<div className="col-xs-12">
<label>
{this.props.description}
<input type="text"
className="form-control input-block-level"
placeholder={this.props.description}
defaultValue={this.props.value}
required={this.props.required}
data-rel={this.props.name}
onChange={this.props.handleChange} />
</label>
</div>
</div>
);
},
render() {
return (
<div className="form-group">
{this.props.type === 'checkbox' ? this.checkbox() : this.text()}
</div>
)
}
});
}); | Fix style on add app form in app center | Fix style on add app form in app center
fixes PLAT-834
Test steps:
- The best app to test the form (has the most fields) is
Blackboard Collaborate
Change-Id: I28ea6866fea7af357aac2958ec44f74f93f0eeb4
Reviewed-on: https://gerrit.instructure.com/47312
Tested-by: Jenkins <[email protected]>
Reviewed-by: Brad Humphrey <[email protected]>
QA-Review: August Thornton <[email protected]>
Product-Review: Eric Berry <[email protected]>
| JSX | agpl-3.0 | roxolan/canvas-lms,Jyaasa/canvas-lms,greyhwndz/canvas-lms,kyroskoh/canvas-lms,utkarshx/canvas-lms,kyroskoh/canvas-lms,juoni/canvas-lms,greyhwndz/canvas-lms,SwinburneOnline/canvas-lms,fronteerio/canvas-lms,HotChalk/canvas-lms,juoni/canvas-lms,redconfetti/canvas-lms,djbender/canvas-lms,dgynn/canvas-lms,snehakachroo1/LSI_replica,samuels410/greatlakes-lms,instructure/canvas-lms,snehakachroo1/LSI_replica,matematikk-mooc/canvas-lms,Rvor/canvas-lms,narigone/canvas,skmezanul/canvas-lms,Rvor/canvas-lms,sfu/canvas-lms,efrj/canvas-lms,snehakachroo1/LSI_replica,sdeleon28/canvas-lms,redconfetti/canvas-lms,sfu/canvas-lms,instructure/canvas-lms,shidao-fm/canvas-lms,venturehive/canvas-lms,jay3126/canvas-lms,efrj/canvas-lms,Jyaasa/canvas-lms,sfu/canvas-lms,narigone/canvas,tgroshon/canvas-lms,shidao-fm/canvas-lms,shidao-fm/canvas-lms,venturehive/canvas-lms,matematikk-mooc/canvas-lms,jay3126/canvas-lms,va7map/canvas-lms,wrdsb/canvas-lms,djbender/canvas-lms,ShreniiNepal/shrenii_lmp,eCNAP/CANVAS,utkarshx/canvas-lms,eCNAP/CANVAS,sdeleon28/canvas-lms,skmezanul/canvas-lms,matematikk-mooc/canvas-lms,va7map/canvas-lms,narigone/canvas,HotChalk/canvas-lms,wrdsb/canvas-lms,skmezanul/canvas-lms,Rvor/canvas-lms,ShreniiNepal/shrenii_lmp,fronteerio/canvas-lms,HotChalk/canvas-lms,whalejasmine/canvas-lms,venturehive/canvas-lms,SwinburneOnline/canvas-lms,tgroshon/canvas-lms,eCNAP/CANVAS,grahamb/canvas-lms,grahamb/canvas-lms,greyhwndz/canvas-lms,instructure/canvas-lms,sdeleon28/canvas-lms,antoniuslin/canvas-lms,dgynn/canvas-lms,jay3126/canvas-lms,instructure/canvas-lms,fronteerio/canvas-lms,AndranikMarkosyan/lms,matematikk-mooc/canvas-lms,SwinburneOnline/canvas-lms,leftplusrightllc/canvas-lms,AndranikMarkosyan/lms,roxolan/canvas-lms,Rvor/canvas-lms,tgroshon/canvas-lms,redconfetti/canvas-lms,fronteerio/canvas-lms,eCNAP/CANVAS,narigone/canvas,utkarshx/canvas-lms,efrj/canvas-lms,va7map/canvas-lms,wrdsb/canvas-lms,grahamb/canvas-lms,sdeleon28/canvas-lms,AndranikMarkosyan/lms,whalejasmine/canvas-lms,wrdsb/canvas-lms,samuels410/greatlakes-lms,instructure/canvas-lms,venturehive/canvas-lms,samuels410/greatlakes-lms,dgynn/canvas-lms,whalejasmine/canvas-lms,leftplusrightllc/canvas-lms,whalejasmine/canvas-lms,kyroskoh/canvas-lms,jay3126/canvas-lms,djbender/canvas-lms,juoni/canvas-lms,AndranikMarkosyan/lms,sfu/canvas-lms,ShreniiNepal/shrenii_lmp,snehakachroo1/LSI_replica,skmezanul/canvas-lms,Jyaasa/canvas-lms,roxolan/canvas-lms,Jyaasa/canvas-lms,SwinburneOnline/canvas-lms,antoniuslin/canvas-lms,samuels410/greatlakes-lms,leftplusrightllc/canvas-lms,shidao-fm/canvas-lms,ShreniiNepal/shrenii_lmp,juoni/canvas-lms,kyroskoh/canvas-lms,instructure/canvas-lms,grahamb/canvas-lms,leftplusrightllc/canvas-lms,antoniuslin/canvas-lms,HotChalk/canvas-lms,redconfetti/canvas-lms,sfu/canvas-lms,antoniuslin/canvas-lms,sfu/canvas-lms,tgroshon/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms,dgynn/canvas-lms,utkarshx/canvas-lms,efrj/canvas-lms,va7map/canvas-lms,grahamb/canvas-lms,djbender/canvas-lms,instructure/canvas-lms,greyhwndz/canvas-lms | ---
+++
@@ -20,7 +20,7 @@
return (
<div className="grid-row">
<div className="col-xs-12">
- <label className="checkbox text-left">
+ <label className="checkbox">
<input type="checkbox" data-rel={this.props.name} onChange={this.props.handleChange} /> {this.props.description}
</label>
</div>
@@ -32,14 +32,16 @@
return (
<div className="grid-row">
<div className="col-xs-12">
- <label className="text-left">{this.props.description}</label>
- <input type="text"
- className="form-control input-block-level"
- placeholder={this.props.description}
- defaultValue={this.props.value}
- required={this.props.required}
- data-rel={this.props.name}
- onChange={this.props.handleChange} />
+ <label>
+ {this.props.description}
+ <input type="text"
+ className="form-control input-block-level"
+ placeholder={this.props.description}
+ defaultValue={this.props.value}
+ required={this.props.required}
+ data-rel={this.props.name}
+ onChange={this.props.handleChange} />
+ </label>
</div>
</div>
); |
84ea6d878971eded95f81afa36fb867fb1dbf94f | packages/vulcan-ui-bootstrap/lib/components/forms/StaticText.jsx | packages/vulcan-ui-bootstrap/lib/components/forms/StaticText.jsx | import React from 'react';
import { registerComponent } from 'meteor/vulcan:core';
const parseUrl = value => {
return value.slice(0,4) === 'http' ? <a href={value} target="_blank">{value}</a> : value;
}
const StaticComponent = ({ value, label }) => (
<div className="form-group row">
<label className="control-label col-sm-3">{label}</label>
<div className="col-sm-9">{parseUrl(value)}</div>
</div>
);
registerComponent('FormComponentStaticText', StaticComponent);
| import React from 'react';
import { registerComponent } from 'meteor/vulcan:core';
const parseUrl = value => {
return value && value.toString().slice(0,4) === 'http' ? <a href={value} target="_blank">{value}</a> : value;
}
const StaticComponent = ({ value, label }) => (
<div className="form-group row">
<label className="control-label col-sm-3">{label}</label>
<div className="col-sm-9">{parseUrl(value)}</div>
</div>
);
registerComponent('FormComponentStaticText', StaticComponent);
| Make static text work for empty values and numbers | Make static text work for empty values and numbers
| JSX | mit | VulcanJS/Vulcan,VulcanJS/Vulcan | ---
+++
@@ -2,7 +2,7 @@
import { registerComponent } from 'meteor/vulcan:core';
const parseUrl = value => {
- return value.slice(0,4) === 'http' ? <a href={value} target="_blank">{value}</a> : value;
+ return value && value.toString().slice(0,4) === 'http' ? <a href={value} target="_blank">{value}</a> : value;
}
const StaticComponent = ({ value, label }) => ( |
ea681ccea249ff90f6972a24d33f010ec9721718 | src/section.jsx | src/section.jsx | import React from "react"
import Prism from "prismjs"
import "prismjs/components/prism-javascript.js"
class Section extends React.Component {
componentDidMount() {
Prism.highlightAll()
}
componentDidUpdate() {
Prism.highlightAll()
}
render() {
let example = this.props.component.example
example = example.replace(/ /g, "\u00a0").replace(/</g, "<").replace(/>/g, ">")
return (
<li>
<h2 className="section-description">{this.props.component.description}</h2>
<span className="section-path">{this.props.component.path}</span>
<p className="section-example">
<code style={{whiteSpace: "pre"}} className="language-javascript">
<div dangerouslySetInnerHTML={ {__html: example} } />
</code>
</p>
</li>
)
}
}
export default Section
| import React from "react"
import Prism from "prismjs"
import "prismjs/components/prism-javascript.js"
class Section extends React.Component {
componentDidMount() {
Prism.highlightAll()
}
componentDidUpdate() {
Prism.highlightAll()
}
render() {
let example = this.props.component.example
example = example.replace(/ /g, "\u00a0").replace(/</g, "<").replace(/>/g, ">")
return (
<li>
<h2 className="section-description">{this.props.component.description}</h2>
<span className="section-path">{this.props.component.path}</span>
<div className="section-example">
<code style={{whiteSpace: "pre"}} className="language-javascript">
<div dangerouslySetInnerHTML={ {__html: example} } />
</code>
</div>
</li>
)
}
}
export default Section
| Fix div cannot appear as child of p tag warning. | Fix div cannot appear as child of p tag warning.
| JSX | mit | mavenlink/mavenlink-ui-concept | ---
+++
@@ -16,11 +16,11 @@
<li>
<h2 className="section-description">{this.props.component.description}</h2>
<span className="section-path">{this.props.component.path}</span>
- <p className="section-example">
+ <div className="section-example">
<code style={{whiteSpace: "pre"}} className="language-javascript">
<div dangerouslySetInnerHTML={ {__html: example} } />
</code>
- </p>
+ </div>
</li>
)
} |
dea6a7a207157a1d4fe85c29a66d8254e604a21a | packages/lesswrong/components/shortform/ShortformThreadList.jsx | packages/lesswrong/components/shortform/ShortformThreadList.jsx | import React from 'react';
import { Components, registerComponent, withList } from 'meteor/vulcan:core';
import { Comments } from '../../lib/collections/comments';
import withUser from '../common/withUser';
const ShortformThreadList = ({ results, loading, loadMore, networkStatus, data: {refetch} }) => {
const { LoadMore, ShortformThread, ShortformSubmitForm, Loading } = Components
if (!loading && results && !results.length) {
return null
}
const loadingMore = networkStatus === 2;
return (
<div>
<ShortformSubmitForm successCallback={refetch} />
{loading || !results ? <Loading /> :
<div>
{results.map((comment, i) => {
return <ShortformThread key={comment._id} comment={comment} refetch={refetch}/>
})}
{ loadMore && <LoadMore loading={loadingMore || loading} loadMore={loadMore} /> }
{ loadingMore && <Loading />}
</div>}
</div>)
}
const discussionThreadsOptions = {
collection: Comments,
queryName: 'ShortformThreadListQuery',
fragmentName: 'ShortformCommentsList',
enableTotal: false,
pollInterval: 0,
enableCache: true,
};
registerComponent('ShortformThreadList', ShortformThreadList, [withList, discussionThreadsOptions], withUser);
| import React from 'react';
import { Components, registerComponent, withList } from 'meteor/vulcan:core';
import { Comments } from '../../lib/collections/comments';
import withUser from '../common/withUser';
const ShortformThreadList = ({ results, loading, loadMore, networkStatus, data: {refetch} }) => {
const { LoadMore, ShortformThread, ShortformSubmitForm, Loading } = Components
if (!loading && results && !results.length) {
return null
}
const loadingMore = networkStatus === 2;
return (
<div>
<ShortformSubmitForm successCallback={refetch} />
{loading || !results ? <Loading /> :
<div>
{results.map((comment, i) => {
return <ShortformThread key={comment._id} comment={comment} refetch={refetch}/>
})}
{ loadMore && <LoadMore loading={loadingMore || loading} loadMore={loadMore} /> }
{ loadingMore && <Loading />}
</div>}
</div>)
}
const discussionThreadsOptions = {
collection: Comments,
queryName: 'ShortformThreadListQuery',
fragmentName: 'ShortformCommentsList',
fetchPolicy: 'cache-and-network',
enableTotal: false,
pollInterval: 0,
enableCache: true,
};
registerComponent('ShortformThreadList', ShortformThreadList, [withList, discussionThreadsOptions], withUser);
| Change shortform page fetch policy | Change shortform page fetch policy
| JSX | mit | Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope | ---
+++
@@ -31,6 +31,7 @@
collection: Comments,
queryName: 'ShortformThreadListQuery',
fragmentName: 'ShortformCommentsList',
+ fetchPolicy: 'cache-and-network',
enableTotal: false,
pollInterval: 0,
enableCache: true, |
ec31899a961a7b25b7d86b73b6e787a2b1ece15f | app/Resources/client/jsx/helpers/traitEntryfilters.jsx | app/Resources/client/jsx/helpers/traitEntryfilters.jsx | export class TraitEntryFilter {
fullData
_filter
constructor(fullData) {
this.fullData = fullData
this.filter = {
providerBlacklist: [],
userBlacklist: []
}
}
get filter(){
return this._filter
}
set filter(filter){
this._filter = filter
}
applyFilter(){
let filteredData = this.fullData
if(this.filter.providerBlacklist.length > 0){
filteredData = filteredData.map(traitType => {
return {
traitType: traitType.traitType,
entries: traitType.entries.filter(e => !this.filter.providerBlacklist.includes(e.provider))
}
})
}
if(this.filter.userBlacklist.length > 0 && !this.filter.providerBlacklist.includes('userImport')){
filteredData = filteredData.map(traitType => {
return {
traitType: traitType.traitType,
entries: traitType.entries.filter(e => !this.filter.userBlacklist.includes(e.user))
}
})
}
filteredData = filteredData.filter(x => x.entries.length > 0)
return filteredData
}
}
// export globally
window.TraitEntryFilter = TraitEntryFilter;
| export class TraitEntryFilter {
fullData
_filter
constructor(fullData) {
this.fullData = fullData
this.filter = {
providerBlacklist: [],
userBlacklist: []
}
}
get filter(){
return this._filter
}
set filter(filter){
if(typeof(this.filter) === 'undefined'){
this._filter = filter;
return;
}
Object.assign(this.filter, filter)
}
applyFilter(){
let filteredData = this.fullData
if(this.filter.providerBlacklist.length > 0){
filteredData = filteredData.map(traitType => {
return {
traitType: traitType.traitType,
entries: traitType.entries.filter(e => !this.filter.providerBlacklist.includes(e.provider))
}
})
}
if(this.filter.userBlacklist.length > 0 && !this.filter.providerBlacklist.includes('userImport')){
filteredData = filteredData.map(traitType => {
return {
traitType: traitType.traitType,
entries: traitType.entries.filter(e => !this.filter.userBlacklist.includes(e.user))
}
})
}
filteredData = filteredData.filter(x => x.entries.length > 0)
return filteredData
}
}
// export globally
window.TraitEntryFilter = TraitEntryFilter;
| Fix initialization of filter setter | Fix initialization of filter setter
| JSX | mit | molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec,molbiodiv/fennec | ---
+++
@@ -15,7 +15,11 @@
}
set filter(filter){
- this._filter = filter
+ if(typeof(this.filter) === 'undefined'){
+ this._filter = filter;
+ return;
+ }
+ Object.assign(this.filter, filter)
}
applyFilter(){ |
e68fd048262a6267921fd31a17f12c4a710929dc | src/frontend/components/admin/DeleteGroupButton.jsx | src/frontend/components/admin/DeleteGroupButton.jsx | 'use strict';
import React from 'react';
export default ({ onDelete, group }) => {
var deleteGroup = () => {
onDelete(group);
};
return (<button onClick={deleteGroup} className="deleteGroup" title="Delete group"><span>Delete group</span></button>)
}
| 'use strict';
import React from 'react';
export default ({ onDelete, group }) => {
var deleteGroup = () => {
if(confirm('Are you sure you want to delete the current group?')){
onDelete(group);
}
};
return (<button onClick={deleteGroup} className="deleteGroup" title="Delete group"><span>Delete group</span></button>)
}
| Add confirm prompt for delete. Should be fancied if an opportunity presents | Add confirm prompt for delete. Should be fancied if an opportunity presents
| JSX | agpl-3.0 | rabblerouser/core,rabblerouser/core,rabblerouser/core | ---
+++
@@ -4,7 +4,10 @@
export default ({ onDelete, group }) => {
var deleteGroup = () => {
- onDelete(group);
+ if(confirm('Are you sure you want to delete the current group?')){
+ onDelete(group);
+ }
};
+
return (<button onClick={deleteGroup} className="deleteGroup" title="Delete group"><span>Delete group</span></button>)
} |
9dddd44dbd72e332917dfd9989c679271624176a | src/components/list.jsx | src/components/list.jsx | import React from 'react';
const style = {
width: '30%',
margin: '2px',
display: 'inline-block',
textDecoration: 'none',
color: 'white'
}
export default class ListColors extends React.Component {
render () {
return (
<ul>
{
this.props.colors.map((color, index) => {
return <li key={index} style={Object.assign({}, style, {backgroundColor: color})}>{color}</li>
})
}
</ul>
);
}
};
| import React from 'react';
const style = {
width: '50%',
margin: '4px',
textDecoration: 'none',
color: 'white'
}
export default class ListColors extends React.Component {
render () {
return (
<section>
<ul>
{
this.props.colors.map((color, index) => {
return <li key={index} style={Object.assign({}, style, {backgroundColor: color})}>{color}</li>
})
}
</ul>
</section>
);
}
};
| Change style and adds section tag | Change style and adds section tag
| JSX | mit | Juan1ll0/es6-react-server-side-render,Juan1ll0/es6-react-server-side-render | ---
+++
@@ -1,9 +1,8 @@
import React from 'react';
const style = {
- width: '30%',
- margin: '2px',
- display: 'inline-block',
+ width: '50%',
+ margin: '4px',
textDecoration: 'none',
color: 'white'
}
@@ -11,13 +10,15 @@
export default class ListColors extends React.Component {
render () {
return (
- <ul>
- {
- this.props.colors.map((color, index) => {
- return <li key={index} style={Object.assign({}, style, {backgroundColor: color})}>{color}</li>
- })
- }
- </ul>
+ <section>
+ <ul>
+ {
+ this.props.colors.map((color, index) => {
+ return <li key={index} style={Object.assign({}, style, {backgroundColor: color})}>{color}</li>
+ })
+ }
+ </ul>
+ </section>
);
}
}; |
3bf7f7b011be7a9cdb352c20ce5927338ae0931c | src/index.jsx | src/index.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import * as commutable from 'commutable';
import Notebook from './components/Notebook';
require.extensions['.ipynb'] = require.extensions['.json'];
const notebook = require('../test-notebooks/multiples.ipynb');
const immutableNotebook = commutable.fromJS(notebook);
ReactDOM.render(
<Notebook cells={immutableNotebook.get('cells')}
language={immutableNotebook.getIn(['metadata', 'language_info', 'name'])} />
, document.querySelector('#app'));
| import React from 'react';
import ReactDOM from 'react-dom';
import fs from 'fs';
import * as commutable from 'commutable';
import Notebook from './components/Notebook';
function readJSON(filepath) {
return new Promise((resolve, reject) => {
return fs.readFile(filepath, {}, (err, data) => {
if(err) {
reject(err);
return;
}
try {
const nb = JSON.parse(data);
resolve(nb);
return;
}
catch (e) {
reject(e);
}
});
});
}
readJSON('./test-notebooks/multiples.ipynb')
.then((notebook) => {
const immutableNotebook = commutable.fromJS(notebook);
ReactDOM.render(
<Notebook cells={immutableNotebook.get('cells')}
language={immutableNotebook.getIn(['metadata', 'language_info', 'name'])} />
, document.querySelector('#app'));
}).catch(err => {
ReactDOM.render(
<pre>{err.toString()}</pre>
, document.querySelector('#app'));
});
| Read the notebook then render. | Read the notebook then render.
I should have done this a while ago.
| JSX | bsd-3-clause | rgbkrk/nteract,captainsafia/nteract,captainsafia/nteract,jdfreder/nteract,jdetle/nteract,nteract/nteract,nteract/nteract,0u812/nteract,jdfreder/nteract,temogen/nteract,temogen/nteract,nteract/composition,jdfreder/nteract,captainsafia/nteract,temogen/nteract,rgbkrk/nteract,nteract/nteract,jdetle/nteract,nteract/composition,captainsafia/nteract,jdetle/nteract,jdfreder/nteract,0u812/nteract,rgbkrk/nteract,nteract/nteract,rgbkrk/nteract,nteract/composition,jdetle/nteract,0u812/nteract,nteract/nteract,rgbkrk/nteract,0u812/nteract | ---
+++
@@ -1,15 +1,40 @@
import React from 'react';
import ReactDOM from 'react-dom';
+
+import fs from 'fs';
import * as commutable from 'commutable';
import Notebook from './components/Notebook';
-require.extensions['.ipynb'] = require.extensions['.json'];
-const notebook = require('../test-notebooks/multiples.ipynb');
-const immutableNotebook = commutable.fromJS(notebook);
+function readJSON(filepath) {
+ return new Promise((resolve, reject) => {
+ return fs.readFile(filepath, {}, (err, data) => {
+ if(err) {
+ reject(err);
+ return;
+ }
+ try {
+ const nb = JSON.parse(data);
+ resolve(nb);
+ return;
+ }
+ catch (e) {
+ reject(e);
+ }
+ });
+ });
+}
-ReactDOM.render(
- <Notebook cells={immutableNotebook.get('cells')}
- language={immutableNotebook.getIn(['metadata', 'language_info', 'name'])} />
-, document.querySelector('#app'));
+readJSON('./test-notebooks/multiples.ipynb')
+ .then((notebook) => {
+ const immutableNotebook = commutable.fromJS(notebook);
+ ReactDOM.render(
+ <Notebook cells={immutableNotebook.get('cells')}
+ language={immutableNotebook.getIn(['metadata', 'language_info', 'name'])} />
+ , document.querySelector('#app'));
+ }).catch(err => {
+ ReactDOM.render(
+ <pre>{err.toString()}</pre>
+ , document.querySelector('#app'));
+ }); |
fac501d6b7277937806a84b25a6ab79d0d3e50a1 | src/js/components/session-list/index.jsx | src/js/components/session-list/index.jsx | import debug from "debug";
import React, { Component, PropTypes } from "react";
import Session from "../session";
const log = debug("schedule:components:session-list");
const MARGIN = 60 * 5 * 1000; // Display started events for 5 mins
export class SessionList extends Component {
render() {
const { sessions } = this.props;
let now = Date.now();
let sessionComps = sessions.
filter(s => now <= Number(s.start) + MARGIN).
map(s => {
return (
<div className="session-list__session">
<Session session={s} />
</div>
);
});
return (
<div className="session-list">
{sessionComps}
</div>
);
}
}
SessionList.propTypes = {
getState: PropTypes.func.isRequired
};
export default SessionList;
| import debug from "debug";
import React, { Component, PropTypes } from "react";
import Session from "../session";
const log = debug("schedule:components:session-list");
const MARGIN = 60 * 5 * 1000; // Display started events for 5 mins
export class SessionList extends Component {
render() {
const { sessions } = this.props;
let now = Date.now();
let sessionComps = sessions.
filter(s => now <= Number(s.start) + MARGIN).
map(s => {
return (
<div className="session-list__session">
<Session session={s} />
</div>
);
});
return (
<div className="session-list">
{sessionComps}
</div>
);
}
}
SessionList.propTypes = {
sessions: PropTypes.array.isRequired
};
export default SessionList;
| Fix proptypes had incorrect propnames | Fix proptypes had incorrect propnames
| JSX | mit | orangecms/schedule,nikcorg/schedule,orangecms/schedule,nikcorg/schedule,orangecms/schedule,nikcorg/schedule | ---
+++
@@ -30,7 +30,7 @@
}
SessionList.propTypes = {
- getState: PropTypes.func.isRequired
+ sessions: PropTypes.array.isRequired
};
export default SessionList; |
1d7bc7d8c26e0ad1cb60735281ab78f7ea4da824 | src/request/components/request-detail-panel-messages.jsx | src/request/components/request-detail-panel-messages.jsx | 'use strict';
var _ = require('lodash');
var React = require('react');
var PanelGeneric = require('./request-detail-panel-generic');
module.exports = React.createClass({
render: function () {
return (
<table>
<thead>
<th>Type</th>
<th>Index</th>
<th>Abstract</th>
<th>Payload</th>
</thead>
{_.map(this.props.data.payload, function (item) {
var index = item.index ? <PanelGeneric payload={item.index} /> : '--';
var abstract = item.abstract ? <PanelGeneric payload={item.abstract} /> : '--';
var payload = item.payload ? <PanelGeneric payload={item.payload} /> : '--';
return (
<tr>
<td>{item.type}</td>
<td>{index}</td>
<td>{abstract}</td>
<td>{payload}</td>
</tr>
);
})}
</table>
);
}
});
// TODO: Need to come up with a better self registration process
(function () {
var requestTabController = require('../request-tab');
requestTabController.registerTab({
key: 'tab.messages',
component: module.exports
});
})()
| 'use strict';
var _ = require('lodash');
var React = require('react');
var PanelGeneric = require('./request-detail-panel-generic');
module.exports = React.createClass({
render: function () {
return (
<table>
<thead>
<th>Type</th>
<th>Details</th>
</thead>
{_.map(this.props.data.payload, function (item) {
var index = item.index ? <PanelGeneric payload={item.index} /> : '--';
var abstract = item.abstract ? <PanelGeneric payload={item.abstract} /> : '--';
var payload = item.payload ? <PanelGeneric payload={item.payload} /> : '--';
return (
<tr>
<th>{item.type} ({item.count})</th>
<td>
<h4>Index</h4>
<div>{index}</div>
<h4>Abstract</h4>
<div>{abstract}</div>
<h4>Payload</h4>
<div>{payload}</div>
</td>
</tr>
);
})}
</table>
);
}
});
// TODO: Need to come up with a better self registration process
(function () {
var requestTabController = require('../request-tab');
requestTabController.registerTab({
key: 'tab.messages',
component: module.exports
});
})()
| Update layout of message tab | Update layout of message tab
| JSX | unknown | avanderhoorn/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,Glimpse/Glimpse.Client.Prototype,avanderhoorn/Glimpse.Client.Prototype | ---
+++
@@ -10,9 +10,7 @@
<table>
<thead>
<th>Type</th>
- <th>Index</th>
- <th>Abstract</th>
- <th>Payload</th>
+ <th>Details</th>
</thead>
{_.map(this.props.data.payload, function (item) {
var index = item.index ? <PanelGeneric payload={item.index} /> : '--';
@@ -20,10 +18,15 @@
var payload = item.payload ? <PanelGeneric payload={item.payload} /> : '--';
return (
<tr>
- <td>{item.type}</td>
- <td>{index}</td>
- <td>{abstract}</td>
- <td>{payload}</td>
+ <th>{item.type} ({item.count})</th>
+ <td>
+ <h4>Index</h4>
+ <div>{index}</div>
+ <h4>Abstract</h4>
+ <div>{abstract}</div>
+ <h4>Payload</h4>
+ <div>{payload}</div>
+ </td>
</tr>
);
})} |
c2d655db800bf57c97d10dcf609b118098d8f886 | app/components/Quiz.jsx | app/components/Quiz.jsx | import React from 'react'
import { Field, reduxForm } from 'redux-form'
const renderError = ({ meta: { touched, error } }) => touched && error ?
<span>{error}</span> : false
const required = value => (value || value === 0) ? undefined : 'Required'
const Quiz = ({ handleSubmit, quiz, gradeQuiz, quizForm }) => {
console.log('form data', quizForm)
return (
<form className="quiz" onSubmit={handleSubmit(gradeQuiz)}>
{quiz.questions.map((question, indexNum) => {
let questionNum = indexNum + 1;
return (
<div key={question.id} className="question-group">
<h4 className="inquiry">{questionNum}. {question.inquiry}</h4>
<ul className="inquiry-options">
{question.answer.map((answer, idx) =>{
return (
<li key={answer} className="inquiry-option">
<label>
<Field name={'q_'+question.id} component="input" type="radio" value={idx} checked={quizForm && quizForm.values && quizForm.values['q_'+question.id] == idx} />
{answer}
</label>
</li>
)
})}
<Field name={'q_'+question.id} component={renderError} validate={required} />
</ul>
</div>
)
})}
<div>
<button className="btn btn-primary" type="submit">Submit Quiz</button>
</div>
</form>
)
}
export default Quiz
| import React from 'react'
import { Field, reduxForm } from 'redux-form'
const renderError = ({ meta: { touched, error } }) => touched && error ?
<span>{error}</span> : false
const required = value => (value || value === 0) ? undefined : 'Required'
const Quiz = ({ handleSubmit, quiz, gradeQuiz, quizForm }) => {
return (
<form className="quiz" onSubmit={handleSubmit(gradeQuiz)}>
<p>{ quiz.description }</p>
{quiz.questions.map((question, indexNum) => {
let questionNum = indexNum + 1;
return (
<div key={question.id} className="question-group">
<h4 className="inquiry">{questionNum}. {question.inquiry}</h4>
<ul className="inquiry-options">
{question.answer.map((answer, idx) =>{
return (
<li key={answer} className="inquiry-option">
<label>
<Field name={'q_'+question.id} component="input" type="radio" value={idx} checked={quizForm && quizForm.values && quizForm.values['q_'+question.id] == idx} />
{answer}
</label>
</li>
)
})}
<Field name={'q_'+question.id} component={renderError} validate={required} />
</ul>
</div>
)
})}
<div>
<button className="btn btn-primary" type="submit">Submit Quiz</button>
</div>
</form>
)
}
export default Quiz
| Add description to quiz page | Add description to quiz page
| JSX | mit | galxzx/pegma,galxzx/pegma,galxzx/pegma | ---
+++
@@ -9,9 +9,9 @@
const Quiz = ({ handleSubmit, quiz, gradeQuiz, quizForm }) => {
- console.log('form data', quizForm)
return (
<form className="quiz" onSubmit={handleSubmit(gradeQuiz)}>
+ <p>{ quiz.description }</p>
{quiz.questions.map((question, indexNum) => {
let questionNum = indexNum + 1;
return ( |
4eb08806383e14a7f7715d7f464c8271e6e2d73e | app/assets/javascripts/components/CommentsSection.jsx | app/assets/javascripts/components/CommentsSection.jsx | class CommentsSection extends React.Component {
constructor(props) {
super(props);
this.state = { comments: this.props.current_comments };
}
saveNewComment(e) {
e.preventDefault();
let $form = $(e.target);
$.post(`/grants/${this.props.grant.id}/add_comment`, { body: $form.find("#gc-text").val() })
.done(resp => {
let currentComments = this.state.comments;
currentComments.unshift(resp);
this.setState({ comments: currentComments });
})
.fail(errors => console.log(errors));
}
render() {
return (
<div className="well">
<h4>Comments</h4>
<CommentForm handleSubmit={this.saveNewComment.bind(this)} />
{this.state.comments.map(comment => <Comment key={comment.id} {...comment} />)}
</div>
);
}
}
| class CommentsSection extends React.Component {
constructor(props) {
super(props);
this.state = { comments: this.props.current_comments };
}
saveNewComment(e) {
e.preventDefault();
let $form = $(e.target);
let $gcText = $form.find("#gc-text");
$.post(`/grants/${this.props.grant.id}/add_comment`, { body: $gcText.val() })
.done(resp => {
let currentComments = this.state.comments;
currentComments.unshift(resp);
this.setState({ comments: currentComments });
$gcText.val("");
})
.fail(errors => console.log(errors));
}
render() {
return (
<div className="well">
<h4>Comments</h4>
<CommentForm handleSubmit={this.saveNewComment.bind(this)} />
{this.state.comments.map(comment => <Comment key={comment.id} {...comment} />)}
</div>
);
}
}
| Clear comment textarea after saving | Clear comment textarea after saving
| JSX | mit | samerbuna/Grantzilla,samerbuna/Grantzilla,on-site/Grantzilla,on-site/Grantzilla,on-site/Grantzilla,samerbuna/Grantzilla | ---
+++
@@ -6,11 +6,13 @@
saveNewComment(e) {
e.preventDefault();
let $form = $(e.target);
- $.post(`/grants/${this.props.grant.id}/add_comment`, { body: $form.find("#gc-text").val() })
+ let $gcText = $form.find("#gc-text");
+ $.post(`/grants/${this.props.grant.id}/add_comment`, { body: $gcText.val() })
.done(resp => {
let currentComments = this.state.comments;
currentComments.unshift(resp);
this.setState({ comments: currentComments });
+ $gcText.val("");
})
.fail(errors => console.log(errors));
} |
478c92671329d9acb912497d605799799a76174f | app/components/Error404.jsx | app/components/Error404.jsx | 'use strict';
import React from 'react';
const Error404 = () => (
<div className="error-wrapper">
<img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQAQMAAADdiHD7AAAABlBMVEUAAABTU1OoaSf/AAAAAXRSTlMAQObYZgAAAFJJREFUeF7t0cENgDAMQ9FwYgxG6WjpaIzCCAxQxVggFuDiCvlLOeRdHR9yzjncHVoq3npu+wQUrUuJHylSTmBaespJyJQoObUeyxDQb3bEm5Au81c0pSCD8HYAAAAASUVORK5CYII="
alt="Error 404 Frowny Face Image Blob" />
<br /><hr /><br />
<h2>404... This page is not found!</h2>
</div>
);
export default Error404;
// src2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABIAQMAAABvIyEEAAAABlBMVEUAAABTU1OoaSf/AAAAAXRSTlMAQObYZgAAAENJREFUeF7tzbEJACEQRNGBLeAasBCza2lLEGx0CxFGG9hBMDDxRy/72O9FMnIFapGylsu1fgoBdkXfUHLrQgdfrlJN1BdYBjQQm3UAAAAASUVORK5CYII="
| 'use strict';
import React from 'react';
import { Link } from 'react-router';
import ErrorFace from '../../public/images/error_face.svg';
const Error404 = () => (
<div className="error-wrapper">
<img
src={ ErrorFace }
alt="Error 404 Frowny Face Image Blob (Gray)." />
<div>
<h3>404 Error... Looks like this page can't be found right now!</h3>
<hr />
<p>In the meantime, you can try <Link to="/">going back home</Link> to find what you need, or you can <a href="mailto:[email protected]">drop us a line</a> and we'll see if we can help resolve this issue.</p>
</div>
</div>
);
export default Error404;
| Build out helpful support content for 404 errors | feat: Build out helpful support content for 404 errors
| JSX | mit | IsenrichO/DaviePoplarCapital,IsenrichO/DaviePoplarCapital | ---
+++
@@ -1,18 +1,21 @@
'use strict';
import React from 'react';
+import { Link } from 'react-router';
+
+import ErrorFace from '../../public/images/error_face.svg';
const Error404 = () => (
<div className="error-wrapper">
<img
- src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQAQMAAADdiHD7AAAABlBMVEUAAABTU1OoaSf/AAAAAXRSTlMAQObYZgAAAFJJREFUeF7t0cENgDAMQ9FwYgxG6WjpaIzCCAxQxVggFuDiCvlLOeRdHR9yzjncHVoq3npu+wQUrUuJHylSTmBaespJyJQoObUeyxDQb3bEm5Au81c0pSCD8HYAAAAASUVORK5CYII="
- alt="Error 404 Frowny Face Image Blob" />
- <br /><hr /><br />
- <h2>404... This page is not found!</h2>
+ src={ ErrorFace }
+ alt="Error 404 Frowny Face Image Blob (Gray)." />
+ <div>
+ <h3>404 Error... Looks like this page can't be found right now!</h3>
+ <hr />
+ <p>In the meantime, you can try <Link to="/">going back home</Link> to find what you need, or you can <a href="mailto:[email protected]">drop us a line</a> and we'll see if we can help resolve this issue.</p>
+ </div>
</div>
);
export default Error404;
-
-
-// src2="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABIAQMAAABvIyEEAAAABlBMVEUAAABTU1OoaSf/AAAAAXRSTlMAQObYZgAAAENJREFUeF7tzbEJACEQRNGBLeAasBCza2lLEGx0CxFGG9hBMDDxRy/72O9FMnIFapGylsu1fgoBdkXfUHLrQgdfrlJN1BdYBjQQm3UAAAAASUVORK5CYII=" |
a3fa65f76c32ec53ba857c0f1e5de674d8e32a3c | app/javascript/app/components/my-climate-watch/viz-creator/components/charts/line/line-component.jsx | app/javascript/app/components/my-climate-watch/viz-creator/components/charts/line/line-component.jsx | import React from 'react';
import PropTypes from 'prop-types';
import {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
ResponsiveContainer
} from 'recharts';
const ChartLine = ({ width, height, className, config }) => (
<ResponsiveContainer className={className} width={width} height={height}>
<LineChart {...config.chart}>
{config.cartesianGrid && <CartesianGrid {...config.cartesianGrid} />}
{config.columns &&
config.columns.y.map(y => (
<Line dataKey={y} key={y} {...config.theme[y]} />
))}
{config.xAxis && <XAxis {...config.xAxis} />}
{config.yAxis && <YAxis {...config.yAxis} />}
</LineChart>
</ResponsiveContainer>
);
ChartLine.defaultProps = {
width: '100%',
height: '300px'
};
ChartLine.propTypes = {
className: PropTypes.string,
width: PropTypes.any,
height: PropTypes.any,
chart: PropTypes.PropTypes.object,
config: PropTypes.object
};
export default ChartLine;
| import React from 'react';
import PropTypes from 'prop-types';
import {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
ResponsiveContainer,
Tooltip
} from 'recharts';
import CustomTooltip from '../tooltip';
const ChartLine = ({ width, height, className, config }) => (
<ResponsiveContainer className={className} width={width} height={height}>
<LineChart {...config.chart}>
{config.cartesianGrid && <CartesianGrid {...config.cartesianGrid} />}
{config.columns &&
config.columns.y.map(y => (
<Line dataKey={y} key={y} {...config.theme[y]} />
))}
{config.xAxis && <XAxis {...config.xAxis} />}
{config.yAxis && <YAxis {...config.yAxis} />}
<Tooltip
cursor={{ stroke: '#113750', strokeWidth: 2 }}
content={<CustomTooltip active {...config} />}
/>
</LineChart>
</ResponsiveContainer>
);
ChartLine.defaultProps = {
width: '100%',
height: '300px'
};
ChartLine.propTypes = {
className: PropTypes.string,
width: PropTypes.any,
height: PropTypes.any,
chart: PropTypes.PropTypes.object,
config: PropTypes.object
};
export default ChartLine;
| Add tooltip to line chart | Add tooltip to line chart
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -7,8 +7,11 @@
XAxis,
YAxis,
CartesianGrid,
- ResponsiveContainer
+ ResponsiveContainer,
+ Tooltip
} from 'recharts';
+
+import CustomTooltip from '../tooltip';
const ChartLine = ({ width, height, className, config }) => (
<ResponsiveContainer className={className} width={width} height={height}>
@@ -20,6 +23,10 @@
))}
{config.xAxis && <XAxis {...config.xAxis} />}
{config.yAxis && <YAxis {...config.yAxis} />}
+ <Tooltip
+ cursor={{ stroke: '#113750', strokeWidth: 2 }}
+ content={<CustomTooltip active {...config} />}
+ />
</LineChart>
</ResponsiveContainer>
); |
78d2bef38d109329ddd772d9b84fea7e5a3c8c6f | packages/lesswrong/components/recommendations/RecommendationsList.jsx | packages/lesswrong/components/recommendations/RecommendationsList.jsx | import React from 'react';
import { Components, registerComponent } from 'meteor/vulcan:core';
import { getFragment } from 'meteor/vulcan:core';
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import withUser from '../common/withUser';
const withRecommendations = component => {
const recommendationsQuery = gql`
query RecommendationsQuery($count: Int, $algorithm: JSON) {
Recommendations(count: $count, algorithm: $algorithm) {
...PostsList
}
}
${getFragment("PostsList")}
`;
return graphql(recommendationsQuery,
{
alias: "withRecommendations",
options: (props) => ({
variables: {
count: props.algorithm.count || 10,
algorithm: props.algorithm || "top",
}
}),
props(props) {
return {
recommendationsLoading: props.data.loading,
recommendations: props.data.Recommendations,
}
}
}
)(component);
}
const RecommendationsList = ({ recommendations, recommendationsLoading, currentUser }) => {
const { PostsItem2 } = Components;
if (recommendationsLoading || !recommendations)
return <Components.PostsLoading/>
return <div>{recommendations.map(post => <PostsItem2 post={post} key={post._id} currentUser={currentUser}/>)}</div>
}
registerComponent('RecommendationsList', RecommendationsList,
withRecommendations,
withUser
);
| import React from 'react';
import { Components, registerComponent } from 'meteor/vulcan:core';
import { getFragment } from 'meteor/vulcan:core';
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import withUser from '../common/withUser';
const withRecommendations = component => {
const recommendationsQuery = gql`
query RecommendationsQuery($count: Int, $algorithm: JSON) {
Recommendations(count: $count, algorithm: $algorithm) {
...PostsList
}
}
${getFragment("PostsList")}
`;
return graphql(recommendationsQuery,
{
alias: "withRecommendations",
options: (props) => ({
variables: {
count: props.algorithm.count || 10,
algorithm: props.algorithm || "top",
}
}),
props(props) {
return {
recommendationsLoading: props.data.loading,
recommendations: props.data.Recommendations,
}
}
}
)(component);
}
const RecommendationsList = ({ recommendations, recommendationsLoading, currentUser }) => {
const { PostsItem2 } = Components;
if (recommendationsLoading || !recommendations)
return <Components.PostsLoading/>
return <div>
{recommendations.map(post => <PostsItem2 post={post} key={post._id} currentUser={currentUser}/>)}
{recommendations.length===0 && <span>There are no more recommendations left.</span>}
</div>
}
registerComponent('RecommendationsList', RecommendationsList,
withRecommendations,
withUser
);
| Add message when there are no more recommendations | Add message when there are no more recommendations
| JSX | mit | Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope | ---
+++
@@ -39,7 +39,10 @@
if (recommendationsLoading || !recommendations)
return <Components.PostsLoading/>
- return <div>{recommendations.map(post => <PostsItem2 post={post} key={post._id} currentUser={currentUser}/>)}</div>
+ return <div>
+ {recommendations.map(post => <PostsItem2 post={post} key={post._id} currentUser={currentUser}/>)}
+ {recommendations.length===0 && <span>There are no more recommendations left.</span>}
+ </div>
}
registerComponent('RecommendationsList', RecommendationsList, |
085ee8c27f61ee8af6a68bb4c6567cf1eea5ffe9 | __tests__/MenuItem.test.jsx | __tests__/MenuItem.test.jsx | // don"t mock our CUT or components it depends on
jest.dontMock("../src/components/MenuItem");
import React from "react";
import ReactDOM from "react-dom";
import TestUtils from "react-addons-test-utils";
// TODO: move this to es6 style import when its implemented in jest
const MenuItem = require("../src/components/MenuItem").default;
describe("MenuItem", () => {
it("Renders a MenuItem", () => {
const text = "howdy";
// Render a MenuItem with no style
const menuItem = TestUtils.renderIntoDocument(
<MenuItem text= {text} />
);
// grab the DOM node so we can inspect it
const menuItemNode = ReactDOM.findDOMNode(menuItem);
// Verify that it"s rendered with the right text
expect(menuItemNode.textContent).toEqual(text);
});
});
| // don"t mock our CUT or components it depends on
jest.dontMock("../src/components/MenuItem");
import React from "react";
import ReactDOM from "react-dom";
import TestUtils from "react-addons-test-utils";
// TODO: move this to es6 style import when its implemented in jest
const MenuItem = require("../src/components/MenuItem").default;
describe("MenuItem", () => {
it("Does render a MenuItem", () => {
const text = "howdy";
// Render a MenuItem with no style
const menuItem = TestUtils.renderIntoDocument(
<MenuItem text= {text} />
);
// grab the DOM node so we can inspect it
const menuItemNode = ReactDOM.findDOMNode(menuItem);
// Verify that it"s rendered with the right text
expect(menuItemNode.textContent).toEqual(text);
});
it("Does trigger an event when clicked", (done) => {
function clickEvent() {
done();
}
const menuItem = TestUtils.renderIntoDocument(
<MenuItem handleClick={clickEvent} />
);
const menuItemNode = ReactDOM.findDOMNode(menuItem);
TestUtils.Simulate.click(menuItemNode);
});
});
| Test to ensure that click events are fired for Menu items | Test to ensure that click events are fired for Menu items
| JSX | mit | signal/sprinkles-ui,signal/sprinkles-ui | ---
+++
@@ -10,7 +10,7 @@
describe("MenuItem", () => {
- it("Renders a MenuItem", () => {
+ it("Does render a MenuItem", () => {
const text = "howdy";
// Render a MenuItem with no style
@@ -25,4 +25,18 @@
});
+ it("Does trigger an event when clicked", (done) => {
+ function clickEvent() {
+ done();
+ }
+
+ const menuItem = TestUtils.renderIntoDocument(
+ <MenuItem handleClick={clickEvent} />
+ );
+
+ const menuItemNode = ReactDOM.findDOMNode(menuItem);
+
+ TestUtils.Simulate.click(menuItemNode);
+ });
+
}); |
093a5d0517ddd480efa456f9726f6fb17099e885 | app/components/LoggedInUser/UserLanguageSelector.jsx | app/components/LoggedInUser/UserLanguageSelector.jsx | import React from 'react'
import LanguageSelector from '../App/LanguageSelector'
import i18n from '../../i18n/i18n'
import { withLoggedInUser } from './UserProvider'
import { updateUserInfo } from '../../API/http_api/current_user'
/**
* Updates the locale for loggedInUser, notify i18n to refresh the
* interface.
*/
const UserLanguageSelector = ({
isAuthenticated,
updateLoggedInUser,
className,
size
}) => {
return (
<LanguageSelector
className={className}
value={i18n.language}
size={size}
withIcon
handleChange={locale => {
i18n.changeLanguage(locale)
if (isAuthenticated) {
updateUserInfo.then(user => {
updateLoggedInUser(user)
})
}
}}
/>
)
}
export default withLoggedInUser(UserLanguageSelector)
| import React from 'react'
import LanguageSelector from '../App/LanguageSelector'
import i18n from '../../i18n/i18n'
import { withLoggedInUser } from './UserProvider'
import { updateUserInfo } from '../../API/http_api/current_user'
/**
* Updates the locale for loggedInUser, notify i18n to refresh the
* interface.
*/
const UserLanguageSelector = ({
isAuthenticated,
updateLoggedInUser,
className,
size
}) => {
return (
<LanguageSelector
className={className}
value={i18n.language}
size={size}
withIcon
handleChange={locale => {
i18n.changeLanguage(locale)
if (isAuthenticated) {
return updateUserInfo({ locale }).then(user => {
updateLoggedInUser(user)
})
}
}}
/>
)
}
export default withLoggedInUser(UserLanguageSelector)
| Save locale in API when changing it | fix(LanguageSelector): Save locale in API when changing it | JSX | agpl-3.0 | CaptainFact/captain-fact-frontend,CaptainFact/captain-fact-frontend,CaptainFact/captain-fact-frontend | ---
+++
@@ -23,7 +23,7 @@
handleChange={locale => {
i18n.changeLanguage(locale)
if (isAuthenticated) {
- updateUserInfo.then(user => {
+ return updateUserInfo({ locale }).then(user => {
updateLoggedInUser(user)
})
} |
076f6a061316bafbc5795882cf9ce04034cc2530 | client/src/components/Nav.jsx | client/src/components/Nav.jsx | import React from 'react';
import { Link } from 'react-router-dom';
import { Tabs, Tab } from 'material-ui/Tabs';
class Nav extends React.Component {
constructor(props) {
super(props);
this.state = {
open: false,
page: this.props.page,
value: 0
};
}
componentDidMount() {
if (this.state.page === 'inventory') {
this.setState({
value: 0
});
} else if (this.state.page === 'shop') {
this.setState({
value: 1
});
}
}
handleToggle(event) {
this.setState({ open: !this.state.open });
}
handleClose() {
this.setState({open: false});
}
changeTab(event) {
this.setState({
value: event
});
}
render() {
return (
<div>
<Tabs onChange={this.changeTab.bind(this)} value={this.state.value}>
<Tab value={0} label='House Inventory' containerElement={<Link to="/inventory"/>}/>
<Tab value={1} label='My Shopping List' containerElement={<Link to="/shop"/>}/>
</Tabs>
</div>
);
}
}
export default Nav;
| import React from 'react';
import { Link } from 'react-router-dom';
import { Tabs, Tab } from 'material-ui/Tabs';
class Nav extends React.Component {
constructor(props) {
super(props);
this.state = {
open: false,
page: this.props.page,
value: 0
};
}
componentDidMount() {
if (this.state.page === 'inventory') {
this.setState({
value: 0
});
} else if (this.state.page === 'shop') {
this.setState({
value: 1
});
} else if (this.state.page === 'home') {
this.setState({
value: -1
});
}
}
handleToggle(event) {
this.setState({ open: !this.state.open });
}
handleClose() {
this.setState({open: false});
}
changeTab(event) {
this.setState({
value: event
});
}
render() {
return (
<div>
<Tabs onChange={this.changeTab.bind(this)} value={this.state.value}>
<Tab value={0} label='House Inventory' containerElement={<Link to="/inventory"/>}/>
<Tab value={1} label='My Shopping List' containerElement={<Link to="/shop"/>}/>
</Tabs>
</div>
);
}
}
export default Nav;
| Change to initialize without selected tab for rendering on the HomePage | Change to initialize without selected tab for rendering on the HomePage
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -21,6 +21,10 @@
} else if (this.state.page === 'shop') {
this.setState({
value: 1
+ });
+ } else if (this.state.page === 'home') {
+ this.setState({
+ value: -1
});
}
} |
75252422a6a1a70d596422bd2d253b4b7234169a | client/components/index.jsx | client/components/index.jsx | var React = require('react');
var ReactDOM = require('react-dom');
var sharedb = require('sharedb/lib/client');
var App = require('./App.jsx');
var Init = require('./initdoc');
/* global window, document; */
// Open WebSocket connection to ShareDB server
// let connection = new sharedb.Connection(
// new WebSocket('ws://' + window.location.host));
// Use this when committing to heroku and lose the commit
let connection = new sharedb.Connection(
new WebSocket('wss://' + window.location.host));
// Expose to index.html
window.renderApp = function () {
// Init();
ReactDOM.render(<App connection={connection}/>,
document.querySelector('#app'));
};
| var React = require('react');
var ReactDOM = require('react-dom');
var sharedb = require('sharedb/lib/client');
var App = require('./App.jsx');
var Init = require('./initdoc');
/* global window, document; */
// Open WebSocket connection to ShareDB server
let connection = new sharedb.Connection(
new WebSocket('ws://' + window.location.host));
// Use this when committing to heroku and lose the commit
// let connection = new sharedb.Connection(
// new WebSocket('wss://' + window.location.host));
// Expose to index.html
window.renderApp = function () {
// Init();
ReactDOM.render(<App connection={connection}/>,
document.querySelector('#app'));
};
| Revert WSS change from the last successful Heroku commit | Revert WSS change from the last successful Heroku commit
| JSX | mit | venugos/sharegeom,venugos/sharegeom | ---
+++
@@ -7,12 +7,12 @@
/* global window, document; */
// Open WebSocket connection to ShareDB server
-// let connection = new sharedb.Connection(
-// new WebSocket('ws://' + window.location.host));
+let connection = new sharedb.Connection(
+ new WebSocket('ws://' + window.location.host));
// Use this when committing to heroku and lose the commit
-let connection = new sharedb.Connection(
-new WebSocket('wss://' + window.location.host));
+// let connection = new sharedb.Connection(
+// new WebSocket('wss://' + window.location.host));
// Expose to index.html
window.renderApp = function () { |
ee72c4623a1cd8148d9445d5bda833e45f0bb122 | manoseimas/compatibility_test/client/app/TestView/Topic/Arguments/index.jsx | manoseimas/compatibility_test/client/app/TestView/Topic/Arguments/index.jsx | import React from 'react'
import styles from './styles.css'
const Arguments = (props) =>
<div className={styles.arguments}>
<div className={styles.box}>
<div className={styles['positive-head']}>Už</div>
{props.arguments.map(argument => {
if (argument.supporting)
return <div className={styles.argument}>
<h3>{argument.name}</h3>
<p>{argument.description}</p>
</div>
})}
</div>
<div className={styles['negative-box']}>
<div className={styles['negative-head']}>Prieš</div>
{props.arguments.map(argument => {
if (!argument.supporting)
return <div className={styles.argument}>
<h3>{argument.name}</h3>
<p>{argument.description}</p>
</div>
})}
</div>
</div>
Arguments.propTypes = {
arguments: React.PropTypes.object.isRequired
}
export default Arguments | import React from 'react'
import styles from './styles.css'
const Arguments = (props) =>
<div className={styles.arguments}>
<div className={styles.box}>
<div className={styles['positive-head']}>Už</div>
{props.arguments.map(argument => {
if (argument.supporting)
return <div className={styles.argument} key={argument.id}>
<h3>{argument.name}</h3>
<p>{argument.description}</p>
</div>
})}
</div>
<div className={styles['negative-box']}>
<div className={styles['negative-head']}>Prieš</div>
{props.arguments.map(argument => {
if (!argument.supporting)
return <div className={styles.argument} key={argument.id}>
<h3>{argument.name}</h3>
<p>{argument.description}</p>
</div>
})}
</div>
</div>
Arguments.propTypes = {
arguments: React.PropTypes.object.isRequired
}
export default Arguments | Add key for iterator items | Add key for iterator items | JSX | agpl-3.0 | ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt | ---
+++
@@ -7,7 +7,7 @@
<div className={styles['positive-head']}>Už</div>
{props.arguments.map(argument => {
if (argument.supporting)
- return <div className={styles.argument}>
+ return <div className={styles.argument} key={argument.id}>
<h3>{argument.name}</h3>
<p>{argument.description}</p>
</div>
@@ -17,7 +17,7 @@
<div className={styles['negative-head']}>Prieš</div>
{props.arguments.map(argument => {
if (!argument.supporting)
- return <div className={styles.argument}>
+ return <div className={styles.argument} key={argument.id}>
<h3>{argument.name}</h3>
<p>{argument.description}</p>
</div> |
9cf27c966b3aecb251149c71a26eadc58f0d7dca | client/app/bundles/RentersRights/components/ResourceIndexItem.jsx | client/app/bundles/RentersRights/components/ResourceIndexItem.jsx | import React from 'react';
export default class ResourceIndexItem extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
organization,
phone,
email,
website,
region,
description,
address,
} = this.props.resource;
return (
<div>
<a href={website}><h3>{organization}</h3></a>
<p>{description}</p>
<p>Contact: </p>
<p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
<p> Address: {address}</p>
</div>
)
}
}
| import React from 'react';
export default class ResourceIndexItem extends React.Component {
constructor(props) {
super(props);
}
render() {
const {
organization,
phone,
email,
website,
region,
description,
address,
} = this.props.resource;
return (
<div>
<a href={website} target="_blank"><h3>{organization}</h3></a>
<p>{description}</p>
<p>Contact: </p>
<p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
<p> Address: {address}</p>
</div>
)
}
}
| Add target=_blank to a tags to open link in new window | Add target=_blank to a tags to open link in new window
| JSX | mit | codeforsanjose/renters-rights,codeforsanjose/renters-rights,codeforsanjose/renters-rights | ---
+++
@@ -18,7 +18,7 @@
return (
<div>
- <a href={website}><h3>{organization}</h3></a>
+ <a href={website} target="_blank"><h3>{organization}</h3></a>
<p>{description}</p>
<p>Contact: </p>
<p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p> |
3690fff3f528cd6e28a2f6eaf19a893ccb2f79db | html.jsx | html.jsx | import React from 'react'
import DocumentTitle from 'react-document-title'
import { link } from 'gatsby-helpers'
import { TypographyStyle } from 'utils/typography'
module.exports = React.createClass({
propTypes () {
return {
title: React.PropTypes.string,
}
},
render () {
let title = DocumentTitle.rewind()
if (this.props.title) {
title = this.props.title
}
return (
<html lang="en">
<head>
<meta charSet="utf-8"/>
<meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0 maximum-scale=1.0"
/>
<title>{title}</title>
<link rel="shortcut icon" href={this.props.favicon}/>
<TypographyStyle/>
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
<script src={link('/bundle.js')}/>
</body>
</html>
)
},
})
| import React from 'react'
import DocumentTitle from 'react-document-title'
import { link } from 'gatsby-helpers'
import { TypographyStyle } from 'utils/typography'
module.exports = React.createClass({
propTypes () {
return {
title: React.PropTypes.string,
}
},
render () {
let title = DocumentTitle.rewind()
if (this.props.title) {
title = this.props.title
}
let cssLink
if (process.env.NODE_ENV === 'production') {
cssLink = <link rel="stylesheet" href={link('/styles.css')} />
}
return (
<html lang="en">
<head>
<meta charSet="utf-8"/>
<meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0 maximum-scale=1.0"
/>
<title>{title}</title>
<link rel="shortcut icon" href={this.props.favicon}/>
<TypographyStyle/>
{cssLink}
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
<script src={link('/bundle.js')}/>
</body>
</html>
)
},
})
| Add link to styles.css on production builds | Add link to styles.css on production builds
| JSX | mit | ni-tta/irc,dearwish/gatsby-starter-clean,kepatopoc/gatsby-starter-clean,TasGuerciMaia/tasguercimaia.github.io,MeganKeesee/personal-site,peterqiu1997/irc,InnoD-WebTier/irc,roslaneshellanoo/gatsby-starter-clean,jmcorona/jmcorona-netlify,jmcorona/jmcorona-netlify,benruehl/gatsby-kruemelkiste,sarahxy/irc,MeganKeesee/personal-site,byronnewmedia/deanpower,peterqiu1997/irc,karolklp/slonecznikowe2,ivygong/irc,InnoD-WebTier/irc,sarahxy/irc,futuregerald/NetlifyApp,immato/website,ivygong/irc,karolklp/slonecznikowe2,futuregerald/NetlifyApp,ni-tta/irc | ---
+++
@@ -17,6 +17,11 @@
title = this.props.title
}
+ let cssLink
+ if (process.env.NODE_ENV === 'production') {
+ cssLink = <link rel="stylesheet" href={link('/styles.css')} />
+ }
+
return (
<html lang="en">
<head>
@@ -29,6 +34,7 @@
<title>{title}</title>
<link rel="shortcut icon" href={this.props.favicon}/>
<TypographyStyle/>
+ {cssLink}
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} /> |
35b2d2d3ecf1a0e764c070335f6af743c66afae8 | client/components/App.jsx | client/components/App.jsx | import React from 'react';
import ReactDom from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import MainLayout from './main-layout/Mainlayout.jsx';
import HomeView from './home-view/HomeView.jsx';
import RecordView from './record-view/RecordView.jsx';
import SessionsView from './sessions-view/SessionsView.jsx';
import ReportView from './report-view/ReportView.jsx';
import SettingsView from './settings-view/SettingsView.jsx';
export default class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Router history={browserHistory}>
<Route path="/" component={MainLayout}>
<IndexRoute component={HomeView} />
<Route path="record" component={RecordView} />
<Route path="sessions" component={SessionsView} />
<Route path="reports/:sessionId" component={ReportView} />
<Route path="settings" component={SettingsView} />
</Route>
</Router>
)
}
} | import React from 'react';
import ReactDom from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import MainLayout from './main-layout/MainLayout.jsx';
import HomeView from './home-view/HomeView.jsx';
import RecordView from './record-view/RecordView.jsx';
import SessionsView from './sessions-view/SessionsView.jsx';
import ReportView from './report-view/ReportView.jsx';
import SettingsView from './settings-view/SettingsView.jsx';
export default class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Router history={browserHistory}>
<Route path="/" component={MainLayout}>
<IndexRoute component={HomeView} />
<Route path="record" component={RecordView} />
<Route path="sessions" component={SessionsView} />
<Route path="reports/:sessionId" component={ReportView} />
<Route path="settings" component={SettingsView} />
</Route>
</Router>
)
}
} | Correct case sensitivity on Main Layout component import | Correct case sensitivity on Main Layout component import
| JSX | mit | chkakaja/sentimize,chkakaja/sentimize,formidable-coffee/masterfully,formidable-coffee/masterfully | ---
+++
@@ -2,7 +2,7 @@
import ReactDom from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
-import MainLayout from './main-layout/Mainlayout.jsx';
+import MainLayout from './main-layout/MainLayout.jsx';
import HomeView from './home-view/HomeView.jsx';
import RecordView from './record-view/RecordView.jsx';
import SessionsView from './sessions-view/SessionsView.jsx'; |
43e058602454ffdc2838e4bb8866a9a908a372eb | app/components/date-list/index.jsx | app/components/date-list/index.jsx | require("./date-list.styl")
import React from "react"
import {COMMON_DATE} from "../../resources/date-formats"
function renderDayListItem (day, i) {
return <li key={i}>
{this.formatDate(day)}
</li>
}
export default class DateList extends React.Component {
formatDate(date) {
return date.format(COMMON_DATE)
}
renderDays() {
return this.props.lastWeek.map(renderDayListItem.bind(this))
}
render() {
return <div>
<ul>
{this.renderDays()}
</ul>
</div>
}
}
| require("./date-list.styl")
import React from "react"
import {COMMON_DATE} from "../../resources/date-formats"
function renderDayListItem (day, i) {
return <li className="day-list-item" key={i}>
{this.formatDate(day)}
</li>
}
export default React.createClass({
formatDate(date) {
return date.date.format(COMMON_DATE)
},
renderDays() {
return this.props.lastWeek.map(renderDayListItem.bind(this))
},
render(){
return (
<div className="date-list">
<ol>
{this.renderDays()}
</ol>
</div>
)
}
}); | Replace hide and reveal buttons with a single toggle button. | Replace hide and reveal buttons with a single toggle button.
Debug add-item to cycle properly through the current day index.
| JSX | unlicense | babadoozep/ema,babadoozep/ema | ---
+++
@@ -4,25 +4,27 @@
import {COMMON_DATE} from "../../resources/date-formats"
function renderDayListItem (day, i) {
- return <li key={i}>
+ return <li className="day-list-item" key={i}>
{this.formatDate(day)}
</li>
}
-export default class DateList extends React.Component {
+export default React.createClass({
formatDate(date) {
- return date.format(COMMON_DATE)
- }
+ return date.date.format(COMMON_DATE)
+ },
renderDays() {
return this.props.lastWeek.map(renderDayListItem.bind(this))
+ },
+ render(){
+
+ return (
+ <div className="date-list">
+ <ol>
+ {this.renderDays()}
+ </ol>
+ </div>
+ )
}
-
- render() {
- return <div>
- <ul>
- {this.renderDays()}
- </ul>
- </div>
- }
-}
+}); |
d1229c841fc129b568b2cb20e16d9d684a950103 | app/assets/javascripts/scorebook/progress_reports/export_csv_modal.jsx | app/assets/javascripts/scorebook/progress_reports/export_csv_modal.jsx | "use strict";
EC.ExportCsvModal = React.createClass({
propTypes: {
email: React.PropTypes.string.isRequired
},
render: function() {
return (
<div className="modal fade">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i className="fa fa-close"></i></span></button>
<h4 className="modal-title"><strong>Your reports are on the way!</strong></h4>
</div>
<div className="modal-body">
<p>Your Quill Progress Report is being emailed to you. It should arrive within the next five minutes.</p>
<p>Please Check: <strong>{this.props.email}</strong></p>
</div>
<div className="modal-footer">
<button type="button" className="button-green" data-dismiss="modal">Got It</button>
</div>
</div>
</div>
</div>
);
}
}); | "use strict";
EC.ExportCsvModal = React.createClass({
propTypes: {
email: React.PropTypes.string
},
render: function() {
return (
<div className="modal fade">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<button type="button" className="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i className="fa fa-close"></i></span></button>
<h4 className="modal-title"><strong>Your reports are on the way!</strong></h4>
</div>
<div className="modal-body">
<p>Your Quill Progress Report is being emailed to you. It should arrive within the next five minutes.</p>
<p>Please Check: <strong>{this.props.email}</strong></p>
</div>
<div className="modal-footer">
<button type="button" className="button-green" data-dismiss="modal">Got It</button>
</div>
</div>
</div>
</div>
);
}
}); | Fix React JS console warning for missing email prop | Fix React JS console warning for missing email prop
| JSX | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | ---
+++
@@ -2,7 +2,7 @@
EC.ExportCsvModal = React.createClass({
propTypes: {
- email: React.PropTypes.string.isRequired
+ email: React.PropTypes.string
},
render: function() { |
3de87d726efd4a735201eb3e1ec0705550cc21df | webapp/index.jsx | webapp/index.jsx | import React from 'react';
import {Router, browserHistory} from 'react-router';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {setAuth} from './actions/auth';
import routes from './routes';
import store from './store';
import 'react-select/dist/react-select.css';
import './index.css';
// we cache the user details in localStorage, but its still fetched on
// the initial load to update/validate
let auth = localStorage.getItem('auth');
if (auth) {
try {
store.dispatch(setAuth(JSON.parse(auth)));
} catch (ex) {
console.error(ex);
localStorage.removeItem('auth');
}
}
import {registerLanguage} from 'react-syntax-highlighter/dist/light';
import diff from 'react-syntax-highlighter/dist/languages/diff';
registerLanguage('diff', diff);
render(
<Provider store={store}>
<Router history={browserHistory} routes={routes} />
</Provider>,
document.getElementById('root')
);
| import React from 'react';
import {Router, browserHistory} from 'react-router';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {setAuth} from './actions/auth';
import routes from './routes';
import store from './store';
import 'react-select/dist/react-select.css';
import './index.css';
// we cache the user details in localStorage, but its still fetched on
// the initial load to update/validate
let auth = localStorage.getItem('auth');
if (auth) {
try {
store.dispatch(setAuth(JSON.parse(auth)));
} catch (ex) {
console.error(ex);
localStorage.removeItem('auth');
}
}
// import {registerLanguage} from 'react-syntax-highlighter/dist/light';
// import diff from 'react-syntax-highlighter/dist/languages/diff';
// registerLanguage('diff', diff);
render(
<Provider store={store}>
<Router history={browserHistory} routes={routes} />
</Provider>,
document.getElementById('root')
);
| Remove unused light build of syntax highlighter | fix: Remove unused light build of syntax highlighter
| JSX | apache-2.0 | getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus | ---
+++
@@ -24,10 +24,9 @@
}
}
-import {registerLanguage} from 'react-syntax-highlighter/dist/light';
-import diff from 'react-syntax-highlighter/dist/languages/diff';
-
-registerLanguage('diff', diff);
+// import {registerLanguage} from 'react-syntax-highlighter/dist/light';
+// import diff from 'react-syntax-highlighter/dist/languages/diff';
+// registerLanguage('diff', diff);
render(
<Provider store={store}> |
088f55774042fdce45d69ad563b5609d2c9ca0ab | zucchini-ui-frontend-react/src/scenario/components/StepAttachments.jsx | zucchini-ui-frontend-react/src/scenario/components/StepAttachments.jsx | import PropTypes from 'prop-types';
import React from 'react';
import ListGroup from 'react-bootstrap/lib/ListGroup';
import ListGroupItem from 'react-bootstrap/lib/ListGroupItem';
import PanelWithTitle from '../../ui/components/PanelWithTitle';
export default class StepAttachments extends React.PureComponent {
buildUrlForAttachment = (attachmentId) => {
const { scenarioId } = this.props;
// TODO Find a better way to build the URL
return `${configuration.ui.backendBaseUri}/api/scenarii/${scenarioId}/attachments/${attachmentId}`;
};
render() {
const { attachments } = this.props;
const items = attachments.map((attachment, index) => {
return (
<ListGroupItem key={attachment.id}>
<a href={this.buildUrlForAttachment(attachment.id)} download>
Pièce-jointe #{index + 1}
</a>
</ListGroupItem>
);
});
return (
<PanelWithTitle title="Pièces jointes" bsStyle="default">
<ListGroup fill>
{items}
</ListGroup>
</PanelWithTitle>
);
}
}
StepAttachments.propTypes = {
scenarioId: PropTypes.string.isRequired,
attachments: PropTypes.array.isRequired,
};
| import PropTypes from 'prop-types';
import React from 'react';
import ListGroup from 'react-bootstrap/lib/ListGroup';
import ListGroupItem from 'react-bootstrap/lib/ListGroupItem';
import PanelWithTitle from '../../ui/components/PanelWithTitle';
export default class StepAttachments extends React.PureComponent {
buildUrlForAttachment = (attachmentId) => {
const { scenarioId } = this.props;
// TODO Find a better way to build the URL
return `${configuration.backendBaseUri}/api/scenarii/${scenarioId}/attachments/${attachmentId}`;
};
render() {
const { attachments } = this.props;
const items = attachments.map((attachment, index) => {
return (
<ListGroupItem key={attachment.id}>
<a href={this.buildUrlForAttachment(attachment.id)} download>
Pièce-jointe #{index + 1}
</a>
</ListGroupItem>
);
});
return (
<PanelWithTitle title="Pièces jointes" bsStyle="default">
<ListGroup fill>
{items}
</ListGroup>
</PanelWithTitle>
);
}
}
StepAttachments.propTypes = {
scenarioId: PropTypes.string.isRequired,
attachments: PropTypes.array.isRequired,
};
| Fix backend URI on attachments | Fix backend URI on attachments
| JSX | mit | pgentile/tests-cucumber,pgentile/tests-cucumber,pgentile/zucchini-ui,pgentile/tests-cucumber,pgentile/zucchini-ui,pgentile/tests-cucumber,pgentile/zucchini-ui,pgentile/zucchini-ui,pgentile/zucchini-ui,jeremiemarc/zucchini-ui,jeremiemarc/zucchini-ui,jeremiemarc/zucchini-ui,jeremiemarc/zucchini-ui | ---
+++
@@ -11,7 +11,7 @@
buildUrlForAttachment = (attachmentId) => {
const { scenarioId } = this.props;
// TODO Find a better way to build the URL
- return `${configuration.ui.backendBaseUri}/api/scenarii/${scenarioId}/attachments/${attachmentId}`;
+ return `${configuration.backendBaseUri}/api/scenarii/${scenarioId}/attachments/${attachmentId}`;
};
render() { |
f9210012377e5ec21d06abb2d7ae3a6637b6b1d6 | src/main.jsx | src/main.jsx | import 'babel-polyfill'
import './styles/main'
import React from 'react'
import { render } from 'react-dom'
import { I18n } from './lib/I18n'
import App from './components/App'
const context = window.context
const lang = document.documentElement.getAttribute('lang') || 'en'
document.addEventListener('DOMContentLoaded', () => {
const context = window.context
const root = document.querySelector('[role=application]')
const data = root.dataset
cozy.client.init({
//cozyURL: '//' + data.cozyDomain,
cozyURL: 'http://cozy1.local:8080',
oauth: {
clientParams: {/*...*/},
scopes: ["io.cozy.files:GET"],
onRegistered: (client, url) => { /* */ },
//storage: new cozy.auth.LocalStorage(window.localStorage)
}
//token: data.cozyToken
})
cozy.bar.init({
appName: 'sharing',
lang: data.cozyLocale
})
render((
<I18n context={context} lang={lang}>
<App />
</I18n>
), document.querySelector('[role=application]'))
})
| import 'babel-polyfill'
import './styles/main'
import React from 'react'
import { render } from 'react-dom'
import { I18n } from './lib/I18n'
import App from './components/App'
const context = window.context
const lang = document.documentElement.getAttribute('lang') || 'en'
document.addEventListener('DOMContentLoaded', () => {
const data = document.querySelector('[role=application]').dataset
cozy.client.init({
cozyURL: '//' + data.cozyDomain,
token: data.cozyToken
})
cozy.bar.init({
appName: data.cozyAppName,
iconPath: data.cozyIconPath
})
render((
<I18n context={context} lang={lang}>
<App />
</I18n>
), document.querySelector('[role=application]'))
})
| Add cozy bar and cozy client | Add cozy bar and cozy client
| JSX | agpl-3.0 | Gara64/Sharotronic,Gara64/Sharotronic | ---
+++
@@ -12,29 +12,20 @@
const lang = document.documentElement.getAttribute('lang') || 'en'
document.addEventListener('DOMContentLoaded', () => {
- const context = window.context
- const root = document.querySelector('[role=application]')
- const data = root.dataset
-
+ const data = document.querySelector('[role=application]').dataset
cozy.client.init({
- //cozyURL: '//' + data.cozyDomain,
- cozyURL: 'http://cozy1.local:8080',
- oauth: {
- clientParams: {/*...*/},
- scopes: ["io.cozy.files:GET"],
- onRegistered: (client, url) => { /* */ },
- //storage: new cozy.auth.LocalStorage(window.localStorage)
- }
- //token: data.cozyToken
+ cozyURL: '//' + data.cozyDomain,
+ token: data.cozyToken
})
cozy.bar.init({
- appName: 'sharing',
- lang: data.cozyLocale
+ appName: data.cozyAppName,
+ iconPath: data.cozyIconPath
})
- render((
- <I18n context={context} lang={lang}>
- <App />
- </I18n>
- ), document.querySelector('[role=application]'))
+
+ render((
+ <I18n context={context} lang={lang}>
+ <App />
+ </I18n>
+ ), document.querySelector('[role=application]'))
}) |
a226dbf81adf06134e3404a3f9d6ce3ffac089ac | BlazarUI/app/scripts/components/shared/ModuleSelectWrapper.jsx | BlazarUI/app/scripts/components/shared/ModuleSelectWrapper.jsx | import React, {Component, PropTypes} from 'react';
import Select from 'react-select';
class ModuleSelectWrapper extends Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(value) {
// react-select returns an empty string if nothing is selected
const moduleIds = value ? value.split(',').map(Number) : [];
this.props.onUpdateSelectedModuleIds(moduleIds);
}
createModuleSelectOptions(modules) {
return modules.map((m) => {
return {
value: m.id || m.value,
label: m.name || m.label
};
});
}
render() {
return (
<div className="module-select">
<Select
placeholder="No modules selected."
className="module-select__input"
name="moduleSelect"
clearAllText="None"
noResultsText="All modules have been selected."
multi={true}
value={this.props.selectedModuleIds}
options={this.createModuleSelectOptions(this.props.modules)}
onChange={this.handleChange}
/>
</div>
);
}
}
ModuleSelectWrapper.propTypes = {
modules: PropTypes.array.isRequired,
selectedModuleIds: PropTypes.arrayOf(PropTypes.number).isRequired,
onUpdateSelectedModuleIds: PropTypes.func.isRequired
};
export default ModuleSelectWrapper;
| import React, {Component, PropTypes} from 'react';
import Select from 'react-select';
class ModuleSelectWrapper extends Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(value) {
// react-select returns an empty string if nothing is selected
const moduleIds = value ? value.split(',').map(Number) : [];
this.props.onUpdateSelectedModuleIds(moduleIds);
}
createModuleSelectOptions(modules) {
return modules.map((m) => {
return {
value: m.id || m.value,
label: m.name || m.label
};
});
}
render() {
return (
<div className="module-select">
<Select
placeholder="No modules selected."
className="module-select__input"
name="moduleSelect"
clearAllText="None"
noResultsText="All modules have been selected."
multi={true}
value={this.props.selectedModuleIds.join(',')}
options={this.createModuleSelectOptions(this.props.modules)}
onChange={this.handleChange}
/>
</div>
);
}
}
ModuleSelectWrapper.propTypes = {
modules: PropTypes.array.isRequired,
selectedModuleIds: PropTypes.arrayOf(PropTypes.number).isRequired,
onUpdateSelectedModuleIds: PropTypes.func.isRequired
};
export default ModuleSelectWrapper;
| Fix resetting of build now module select when branch status gets polled | Fix resetting of build now module select when branch status gets polled
| JSX | apache-2.0 | HubSpot/Blazar,HubSpot/Blazar,HubSpot/Blazar,HubSpot/Blazar | ---
+++
@@ -33,7 +33,7 @@
clearAllText="None"
noResultsText="All modules have been selected."
multi={true}
- value={this.props.selectedModuleIds}
+ value={this.props.selectedModuleIds.join(',')}
options={this.createModuleSelectOptions(this.props.modules)}
onChange={this.handleChange}
/> |
34e1c121c4d6348b08352624e42cd16db3020d83 | test/specs/StarterComponent.jsx | test/specs/StarterComponent.jsx | import {StarterComponent} from '../src';
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
describe('StarterComponent', function() {
it('should be a function', function() {
expect(StarterComponent).to.be.a('function');
});
it('should be a React component', function() {
expect(new StarterComponent()).to.be.an.instanceof(React.Component);
});
it('should render a div', function() {
const renderer = ReactTestUtils.createRenderer();
renderer.render(<StarterComponent />);
const result = renderer.getRenderOutput();
expect(result.type).to.equal('div');
});
});
| import {StarterComponent} from '../../src';
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
describe('StarterComponent', function() {
it('should be a function', function() {
expect(StarterComponent).to.be.a('function');
});
it('should be a React component', function() {
expect(new StarterComponent()).to.be.an.instanceof(React.Component);
});
it('should render a div', function() {
const renderer = ReactTestUtils.createRenderer();
renderer.render(<StarterComponent />);
const result = renderer.getRenderOutput();
expect(result.type).to.equal('div');
});
});
| Fix import path in test | Fix import path in test
| JSX | mit | motiz88/react-dygraphs,motiz88/yet-another-react-component-starter | ---
+++
@@ -1,4 +1,4 @@
-import {StarterComponent} from '../src';
+import {StarterComponent} from '../../src';
import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';
|
936786f816e16d00a2a251a780bd2c6cafbae3af | src/components/Windspeed.jsx | src/components/Windspeed.jsx | import React from 'react';
import { connect } from 'react-redux';
import LineChart from 'LineChart';
import { selectConditions } from 'selectConditionsActions';
class Windspeed extends React.Component {
constructor(props) {
super(props);
this.state = {selectedInfo: {}};
this.displayConditions = this.displayConditions.bind(this);
}
displayConditions(d, i) {
this.props.dispatch(selectConditions(this.props.forecast[i]));
}
renderLineChart() {
if (!this.props.forecast.length) return null;
const units = this.props.app.unitType === 'imperial' ? 'mph' : 'kph';
const barData = this.props.forecast.map(d => {
return {
xValue: new Date(d.date.epoch * 1000),
yValue: d.maxwind[units]
};
});
return (
<div>
<h1>5 Day Windspeed</h1>
<LineChart
data={barData}
onBarClick={this.displayConditions}
onBarMouseenter={this.displayConditions}
yAxisLabel={'In ' + units}
yMin={0}
/>
</div>
);
}
render() {
return (
<div>
{this.renderLineChart()}
</div>
);
}
}
export default connect(state => {
return {
app: state.app,
forecast: state.forecast
};
})(Windspeed);
| import React from 'react';
import { connect } from 'react-redux';
import LineChart from 'LineChart';
import { selectConditions } from 'selectConditionsActions';
class Windspeed extends React.Component {
constructor(props) {
super(props);
this.state = {selectedInfo: {}};
this.displayConditions = this.displayConditions.bind(this);
}
displayConditions(d, i) {
this.props.dispatch(selectConditions(this.props.forecast[i]));
}
renderLineChart() {
if (!this.props.forecast.length) return null;
const units = this.props.app.unitType === 'imperial' ? 'mph' : 'kph';
const barData = this.props.forecast.map(d => {
return {
xValue: new Date(d.date.epoch * 1000),
yValue: d.maxwind[units]
};
});
return (
<div>
<h1>5 Day Windspeed</h1>
<LineChart
data={barData}
onDotClick={this.displayConditions}
onDotMouseenter={this.displayConditions}
yAxisLabel={'In ' + units}
yMin={0}
/>
</div>
);
}
render() {
return (
<div>
{this.renderLineChart()}
</div>
);
}
}
export default connect(state => {
return {
app: state.app,
forecast: state.forecast
};
})(Windspeed);
| Fix mouse events for windspeeds | Fix mouse events for windspeeds
| JSX | mit | JavierPDev/Weather-D3,JavierPDev/Weather-D3 | ---
+++
@@ -32,8 +32,8 @@
<h1>5 Day Windspeed</h1>
<LineChart
data={barData}
- onBarClick={this.displayConditions}
- onBarMouseenter={this.displayConditions}
+ onDotClick={this.displayConditions}
+ onDotMouseenter={this.displayConditions}
yAxisLabel={'In ' + units}
yMin={0}
/> |
da4d325a6ee95a694acfa45fa5d3e11ad2428ece | app/javascript/app/components/ndcs/ndcs-search-map/ndcs-search-map-component.jsx | app/javascript/app/components/ndcs/ndcs-search-map/ndcs-search-map-component.jsx | import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import Map from 'components/map';
import styles from './ndcs-search-map-styles.scss';
const NDCSearchMap = props => (
<div className={styles.mapWrapper}>
{!props.loading && (
<div className={styles.countriesCount}>
{props.includedDocumentsNumber && props.includedDocumentsNumber > 0 ? (
<Fragment>
<span className={styles.includedCountriesCount}>
{props.includedDocumentsNumber || '-'}
</span>
{` of ${props.totalDocumentsNumber || '-'}
documents representing
${props.includedCountriesNumber || '-'}
of ${props.totalCountriesNumber || '-'}
parties to the UNFCCC mention this`}
</Fragment>
) : null}
</div>
)}
<Map
cache={false}
paths={props.paths}
onCountryClick={props.handleCountryClick}
customCenter={[20, -30]}
zoomEnable
/>
</div>
);
NDCSearchMap.propTypes = {
paths: PropTypes.array.isRequired,
totalDocumentsNumber: PropTypes.number,
totalCountriesNumber: PropTypes.number,
includedDocumentsNumber: PropTypes.number,
includedCountriesNumber: PropTypes.number,
loading: PropTypes.bool,
handleCountryClick: PropTypes.func.isRequired
};
export default NDCSearchMap;
| import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import Map from 'components/map';
import newMapTheme from 'styles/themes/map/map-new-zoom-controls.scss';
import styles from './ndcs-search-map-styles.scss';
const NDCSearchMap = props => (
<div className={styles.mapWrapper}>
{!props.loading && (
<div className={styles.countriesCount}>
{props.includedDocumentsNumber && props.includedDocumentsNumber > 0 ? (
<Fragment>
<span className={styles.includedCountriesCount}>
{props.includedDocumentsNumber || '-'}
</span>
{` of ${props.totalDocumentsNumber || '-'}
documents representing
${props.includedCountriesNumber || '-'}
of ${props.totalCountriesNumber || '-'}
parties to the UNFCCC mention this`}
</Fragment>
) : null}
</div>
)}
<Map
cache={false}
paths={props.paths}
onCountryClick={props.handleCountryClick}
customCenter={[20, -30]}
zoomEnable
theme={newMapTheme}
/>
</div>
);
NDCSearchMap.propTypes = {
paths: PropTypes.array.isRequired,
totalDocumentsNumber: PropTypes.number,
totalCountriesNumber: PropTypes.number,
includedDocumentsNumber: PropTypes.number,
includedCountriesNumber: PropTypes.number,
loading: PropTypes.bool,
handleCountryClick: PropTypes.func.isRequired
};
export default NDCSearchMap;
| Use new buttons on NDC search map | Use new buttons on NDC search map
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -1,6 +1,7 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import Map from 'components/map';
+import newMapTheme from 'styles/themes/map/map-new-zoom-controls.scss';
import styles from './ndcs-search-map-styles.scss';
const NDCSearchMap = props => (
@@ -27,6 +28,7 @@
onCountryClick={props.handleCountryClick}
customCenter={[20, -30]}
zoomEnable
+ theme={newMapTheme}
/>
</div>
); |
bb244714de1892ae67b991ca5f2b742eab262362 | _health-care/_js/components/personal-information/VAInformationSection.jsx | _health-care/_js/components/personal-information/VAInformationSection.jsx | import React from 'react';
import ErrorableCheckbox from '../form-elements/ErrorableCheckbox';
class VaInformationSection extends React.Component {
render() {
return (
<div className="row">
<div className="small-12 columns">
<h4>Veteran</h4>
<p>
Please review the following list and select all the responses that apply to you.
This information will be used to determine which sections of the Application for
Health Benefits you should complete.
</p>
<ErrorableCheckbox
label="Are you VA Service Connected 50% to 100% Disabled?"
checked={this.props.data.isVaServiceConnected}
onValueChange={(update) => {this.props.onStateChange('isVaServiceConnected', update);}}/>
<ErrorableCheckbox
label="Are you compensable VA Service Connected 0% - 40%?"
checked={this.props.data.compensableVaServiceConnected}
onValueChange={(update) => {this.props.onStateChange('compensableVaServiceConnected', update);}}/>
<ErrorableCheckbox
label="Do you receive a VA pension?"
checked={this.props.data.receivesVaPension}
onValueChange={(update) => {this.props.onStateChange('receivesVaPension', update);}}/>
</div>
</div>
);
}
}
export default VaInformationSection;
| import React from 'react';
import ErrorableCheckbox from '../form-elements/ErrorableCheckbox';
class VaInformationSection extends React.Component {
render() {
return (
<div className="row">
<div className="small-12 columns">
<h4>Veteran</h4>
<p>
Please review the following list and select all the responses that apply to you.
This information will be used to determine which sections of the Application for
Health Benefits you should complete.
</p>
<ErrorableCheckbox
label="Are you VA Service Connected 50% to 100% Disabled?"
checked={this.props.data.isVaServiceConnected}
onValueChange={(update) => {this.props.onStateChange('isVaServiceConnected', update);}}/>
{this.props.data.isVaServiceConnected === true &&
<div>
<ErrorableCheckbox
label="Are you compensable VA Service Connected 0% - 40%?"
checked={this.props.data.compensableVaServiceConnected}
onValueChange={(update) => {this.props.onStateChange('compensableVaServiceConnected', update);}}/>
<p>
A VA determination that a Service-connected disability is severe enough to warrant monetary compensation.
</p>
</div>
}
{this.props.data.isVaServiceConnected === true && this.props.data.compensableVaServiceConnected === true &&
<ErrorableCheckbox
label="Do you receive a VA pension?"
checked={this.props.data.receivesVaPension}
onValueChange={(update) => {this.props.onStateChange('receivesVaPension', update);}}/>
}
</div>
</div>
);
}
}
export default VaInformationSection;
| Make VA information checkboxes display conditionally | Make VA information checkboxes display conditionally
Fixed based on PR comments.
| JSX | cc0-1.0 | department-of-veterans-affairs/vets-website,department-of-veterans-affairs/vets-website | ---
+++
@@ -18,16 +18,23 @@
label="Are you VA Service Connected 50% to 100% Disabled?"
checked={this.props.data.isVaServiceConnected}
onValueChange={(update) => {this.props.onStateChange('isVaServiceConnected', update);}}/>
-
- <ErrorableCheckbox
- label="Are you compensable VA Service Connected 0% - 40%?"
- checked={this.props.data.compensableVaServiceConnected}
- onValueChange={(update) => {this.props.onStateChange('compensableVaServiceConnected', update);}}/>
-
- <ErrorableCheckbox
- label="Do you receive a VA pension?"
- checked={this.props.data.receivesVaPension}
- onValueChange={(update) => {this.props.onStateChange('receivesVaPension', update);}}/>
+ {this.props.data.isVaServiceConnected === true &&
+ <div>
+ <ErrorableCheckbox
+ label="Are you compensable VA Service Connected 0% - 40%?"
+ checked={this.props.data.compensableVaServiceConnected}
+ onValueChange={(update) => {this.props.onStateChange('compensableVaServiceConnected', update);}}/>
+ <p>
+ A VA determination that a Service-connected disability is severe enough to warrant monetary compensation.
+ </p>
+ </div>
+ }
+ {this.props.data.isVaServiceConnected === true && this.props.data.compensableVaServiceConnected === true &&
+ <ErrorableCheckbox
+ label="Do you receive a VA pension?"
+ checked={this.props.data.receivesVaPension}
+ onValueChange={(update) => {this.props.onStateChange('receivesVaPension', update);}}/>
+ }
</div>
</div>
); |
96d51e11c5ba0e0ae36451af7bfab339551f1a93 | client/auth/containers/AuthMenu.jsx | client/auth/containers/AuthMenu.jsx | import React, { Component, PropTypes } from "react";
import { connect } from "react-redux";
import { Link } from "react-router";
import { logout } from "techbikers/auth/actions";
import { getCurrentPathname } from "techbikers/app/selectors";
import { getAuthenticatedUserId } from "techbikers/auth/selectors";
const mapStateToProps = state => {
const { state: authState } = state.auth;
const isAuthenticated = authState === "authenticated";
const pathname = getCurrentPathname(state);
const userId = getAuthenticatedUserId(state);
return { isAuthenticated, pathname, userId };
};
const mapDispatchToProps = {
logout
};
@connect(mapStateToProps, mapDispatchToProps)
export default class AuthMenu extends Component {
static propTypes = {
pathname: PropTypes.string,
isAuthenticated: PropTypes.bool,
logout: PropTypes.func.isRequired,
userId: PropTypes.number
};
render() {
const { isAuthenticated, pathname, userId } = this.props;
if (isAuthenticated) {
return (
<div className="span2">
<a className="userAuth" onClick={() => this.props.logout()}>Log out</a>
<Link to={`/riders/${userId}`} className="userAuth">Profile</Link>
</div>
);
} else {
return (
<Link className="userAuth" to={{
pathname: "/login",
state: { modal: true, returnTo: pathname }
}}>
Login to Techbikers
</Link>
);
}
}
}
| import React, { Component, PropTypes } from "react";
import { connect } from "react-redux";
import { Link } from "react-router";
import styled from "styled-components";
import { logout } from "techbikers/auth/actions";
import { getCurrentPathname } from "techbikers/app/selectors";
import { getAuthenticatedUserId } from "techbikers/auth/selectors";
const mapStateToProps = state => {
const { state: authState } = state.auth;
const isAuthenticated = authState === "authenticated";
const pathname = getCurrentPathname(state);
const userId = getAuthenticatedUserId(state);
return { isAuthenticated, pathname, userId };
};
const mapDispatchToProps = {
logout
};
const LogOutLink = styled.a`
margin-right: 20px;
`;
@connect(mapStateToProps, mapDispatchToProps)
export default class AuthMenu extends Component {
static propTypes = {
pathname: PropTypes.string,
isAuthenticated: PropTypes.bool,
logout: PropTypes.func.isRequired,
userId: PropTypes.number
};
render() {
const { isAuthenticated, pathname, userId } = this.props;
if (isAuthenticated) {
return (
<div className="span2">
<LogOutLink onClick={() => this.props.logout()}>Log out</LogOutLink>
<Link to={`/riders/${userId}`}>Profile</Link>
</div>
);
} else {
return (
<Link to={{
pathname: "/login",
state: { modal: true, returnTo: pathname }
}}>
Login to Techbikers
</Link>
);
}
}
}
| Introduce margin between Log out and Profile links | Introduce margin between Log out and Profile links
| JSX | mit | Techbikers/techbikers,mwillmott/techbikers,mwillmott/techbikers,Techbikers/techbikers,mwillmott/techbikers,Techbikers/techbikers,mwillmott/techbikers,Techbikers/techbikers | ---
+++
@@ -1,6 +1,7 @@
import React, { Component, PropTypes } from "react";
import { connect } from "react-redux";
import { Link } from "react-router";
+import styled from "styled-components";
import { logout } from "techbikers/auth/actions";
import { getCurrentPathname } from "techbikers/app/selectors";
@@ -19,6 +20,10 @@
logout
};
+const LogOutLink = styled.a`
+ margin-right: 20px;
+`;
+
@connect(mapStateToProps, mapDispatchToProps)
export default class AuthMenu extends Component {
static propTypes = {
@@ -34,13 +39,13 @@
if (isAuthenticated) {
return (
<div className="span2">
- <a className="userAuth" onClick={() => this.props.logout()}>Log out</a>
- <Link to={`/riders/${userId}`} className="userAuth">Profile</Link>
+ <LogOutLink onClick={() => this.props.logout()}>Log out</LogOutLink>
+ <Link to={`/riders/${userId}`}>Profile</Link>
</div>
);
} else {
return (
- <Link className="userAuth" to={{
+ <Link to={{
pathname: "/login",
state: { modal: true, returnTo: pathname }
}}> |
19c5132ac5409a25cf7112d25227e01f080f3c97 | ui/component/common/status-bar.jsx | ui/component/common/status-bar.jsx | // @flow
import React from 'react';
import { ipcRenderer } from 'electron';
import classnames from 'classnames';
type Props = {};
type State = {
hoverUrl: string,
show: boolean,
};
class StatusBar extends React.PureComponent<Props, State> {
constructor() {
super();
this.state = {
hoverUrl: '',
show: false,
};
(this: any).handleUrlChange = this.handleUrlChange.bind(this);
}
componentDidMount() {
ipcRenderer.on('update-target-url', this.handleUrlChange);
}
componentWillUnmount() {
ipcRenderer.removeListener('update-target-url', this.handleUrlChange);
}
handleUrlChange(event: any, url: string) {
// We want to retain the previous URL so that it can fade out
// without the component collapsing.
if (url === '') {
this.setState({ show: false });
} else {
this.setState({ show: true });
this.setState({ hoverUrl: url });
}
}
render() {
const { hoverUrl, show } = this.state;
return <div className={classnames('status-bar', { visible: show })}>{hoverUrl}</div>;
}
}
export default StatusBar;
| // @flow
import React from 'react';
import { ipcRenderer } from 'electron';
import classnames from 'classnames';
type Props = {};
type State = {
hoverUrl: string,
show: boolean,
};
class StatusBar extends React.PureComponent<Props, State> {
constructor() {
super();
this.state = {
hoverUrl: '',
show: false,
};
(this: any).handleUrlChange = this.handleUrlChange.bind(this);
}
componentDidMount() {
ipcRenderer.on('update-target-url', this.handleUrlChange);
}
componentWillUnmount() {
ipcRenderer.removeListener('update-target-url', this.handleUrlChange);
}
handleUrlChange(event: any, url: string) {
// We want to retain the previous URL so that it can fade out
// without the component collapsing.
if (url === '') {
this.setState({ show: false });
} else {
this.setState({ show: true });
this.setState({ hoverUrl: url });
}
}
render() {
const { hoverUrl, show } = this.state;
return <div className={classnames('status-bar', { visible: show })}>{decodeURI(hoverUrl)}</div>;
}
}
export default StatusBar;
| Fix unencoded StatusBar on Desktop | Fix unencoded StatusBar on Desktop
| JSX | mit | lbryio/lbry-app,lbryio/lbry-app | ---
+++
@@ -41,7 +41,7 @@
render() {
const { hoverUrl, show } = this.state;
- return <div className={classnames('status-bar', { visible: show })}>{hoverUrl}</div>;
+ return <div className={classnames('status-bar', { visible: show })}>{decodeURI(hoverUrl)}</div>;
}
}
|
fefbfc4a425fa9feeeab23d9c0b8151224e875b8 | app/assets/javascripts/components/UserShowComponents/UserWatchingItem.js.jsx | app/assets/javascripts/components/UserShowComponents/UserWatchingItem.js.jsx | var UserWatchingItem = React.createClass({
render: function(){
return (
<div className="event">
<div className="label">
<a href={"/issues/"+this.props.id} > <img src={this.props.image_url} /> </a>
</div>
<div className="content">
<div className="summary">
<a href={"/issues/"+this.props.id} > {this.props.title} </a>
<div className="date">
<b>Status:</b> {this.props.status}
</div>
</div>
</div>
</div>
)
}
})
| var UserWatchingItem = React.createClass({
render: function(){
return (
<div className="event">
<div className="label">
<a href={"/issues/"+this.props.id} > <img src={this.props.image_url} /> </a>
</div>
<div className="content">
<div className="summary">
<a href={"/issues/"+this.props.issue_id} > {this.props.title} </a>
<div className="date">
<b>Status:</b> {this.props.status}
</div>
</div>
</div>
</div>
)
}
})
| Fix bug on user watch feed that now will properly route to the issue in link | Fix bug on user watch feed that now will properly route to the issue in link
| JSX | mit | TimCannady/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter | ---
+++
@@ -9,7 +9,7 @@
<div className="content">
<div className="summary">
- <a href={"/issues/"+this.props.id} > {this.props.title} </a>
+ <a href={"/issues/"+this.props.issue_id} > {this.props.title} </a>
<div className="date">
<b>Status:</b> {this.props.status}
</div> |
2c615a9106a056446f6332ce920e9592487ea50a | app/javascript/app/components/my-climate-watch/viz-creator/components/charts/tooltip/tooltip-component.jsx | app/javascript/app/components/my-climate-watch/viz-creator/components/charts/tooltip/tooltip-component.jsx | import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { themr } from 'react-css-themr';
import theme from 'styles/themes/chart-tooltip/chart-tooltip.scss';
const Tooltip = ({ label, tooltip }) => (
<div className={theme.tooltip}>
<div className={theme.tooltipHeader}>
<span className={cx(theme.labelName, theme.labelNameBold)}>{label}</span>
<span className={theme.unit}>{tooltip[0].unit}</span>
</div>
{tooltip.map(l => (
<div className={theme.label} key={l.label}>
<div className={theme.legend}>
<span
className={theme.labelDot}
style={{ backgroundColor: l.color }}
/>
<p className={theme.labelName}>{l.label}</p>
</div>
<p className={theme.labelValue}>{l.value}</p>
</div>
))}
</div>
);
Tooltip.propTypes = {
label: PropTypes.any,
tooltip: PropTypes.array
};
export default themr('Tooltip', theme)(Tooltip);
| import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { themr } from 'react-css-themr';
import theme from 'styles/themes/chart-tooltip/chart-tooltip.scss';
const Tooltip = ({ label, tooltip, payload }) => (
<div className={theme.tooltip}>
<div className={theme.tooltipHeader}>
<span className={cx(theme.labelName, theme.labelNameBold)}>{label}</span>
<span className={theme.unit}>{tooltip[0].unit}</span>
</div>
{tooltip.map((l, i) => (
<div className={theme.label} key={l.label}>
<div className={theme.legend}>
<span
className={theme.labelDot}
style={{ backgroundColor: l.color }}
/>
<p className={theme.labelName}>{l.label}</p>
</div>
{l.value ? <p className={theme.labelValue}>{l.value}</p> : null}
{!l.value &&
payload.length &&
payload.length > 1 && (
<p className={theme.labelValue}>{payload[i].value}</p>
)}
{!l.value &&
payload.length &&
payload.length === 1 && (
<p className={theme.labelValue}>{payload[0].value}</p>
)}
</div>
))}
</div>
);
Tooltip.propTypes = {
label: PropTypes.any,
tooltip: PropTypes.array,
payload: PropTypes.array
};
export default themr('Tooltip', theme)(Tooltip);
| Add payload to render values | Add payload to render values
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -5,13 +5,13 @@
import theme from 'styles/themes/chart-tooltip/chart-tooltip.scss';
-const Tooltip = ({ label, tooltip }) => (
+const Tooltip = ({ label, tooltip, payload }) => (
<div className={theme.tooltip}>
<div className={theme.tooltipHeader}>
<span className={cx(theme.labelName, theme.labelNameBold)}>{label}</span>
<span className={theme.unit}>{tooltip[0].unit}</span>
</div>
- {tooltip.map(l => (
+ {tooltip.map((l, i) => (
<div className={theme.label} key={l.label}>
<div className={theme.legend}>
<span
@@ -20,7 +20,17 @@
/>
<p className={theme.labelName}>{l.label}</p>
</div>
- <p className={theme.labelValue}>{l.value}</p>
+ {l.value ? <p className={theme.labelValue}>{l.value}</p> : null}
+ {!l.value &&
+ payload.length &&
+ payload.length > 1 && (
+ <p className={theme.labelValue}>{payload[i].value}</p>
+ )}
+ {!l.value &&
+ payload.length &&
+ payload.length === 1 && (
+ <p className={theme.labelValue}>{payload[0].value}</p>
+ )}
</div>
))}
</div>
@@ -28,7 +38,8 @@
Tooltip.propTypes = {
label: PropTypes.any,
- tooltip: PropTypes.array
+ tooltip: PropTypes.array,
+ payload: PropTypes.array
};
export default themr('Tooltip', theme)(Tooltip); |
2a4fe9fdc22ad1ad6b87055db1e67f0add1bc985 | app/javascript/app/components/my-climate-watch/my-account/my-account-component.jsx | app/javascript/app/components/my-climate-watch/my-account/my-account-component.jsx | import React from 'react';
import PropTypes from 'prop-types';
const MyAccount = ({ user }) => (
<div>
<h1>User details</h1>
<span>Email:</span>
<span>{user.email}</span>
</div>
);
MyAccount.propTypes = {
user: PropTypes.object.isRequired
};
export default MyAccount;
| import React, { Component } from 'react';
import PropTypes from 'prop-types';
import TextInput from 'components/text-input';
import Button from 'components/button';
import theme from 'styles/themes/input/text-input-theme.scss';
import styles from './my-account-styles.scss';
class MyAccount extends Component {
constructor(props) {
super(props);
this.state = {
name: '',
organization: '',
workArea: ''
};
}
render() {
const { user, id, updateUser } = this.props;
return (
<div>
<h1 className={styles.title}>User Profile</h1>
<div className={styles.personalInfo}>
<TextInput
className={styles.input}
theme={theme}
placeholder={user.user_id.name || 'Add a name'}
label={'Name'}
inputType={'text'}
onChange={value => this.setState({ name: value })}
/>
<TextInput
className={styles.input}
theme={theme}
value={user.email}
inputType={'text'}
label={'Email'}
disabled
/>
</div>
<div className={styles.organizationalInfo}>
<TextInput
className={styles.input}
theme={theme}
placeholder={user.user_id.organization || 'Add an organization'}
label={'Organization'}
inputType={'text'}
focus
onChange={value => this.setState({ organization: value })}
/>
<TextInput
className={styles.input}
theme={theme}
placeholder={user.user_id.work_area || 'Add an area of work'}
label={'Area of work'}
inputType={'text'}
onChange={value => this.setState({ workArea: value })}
/>
</div>
<div className={styles.updateButton}>
<Button
color={'yellow'}
onClick={() => {
updateUser(id, {
name: this.state.name,
organization: this.state.organization
});
}}
>
<span>Update profile</span>
</Button>
</div>
</div>
);
}
}
MyAccount.propTypes = {
user: PropTypes.object.isRequired,
id: PropTypes.string.isRequired,
updateUser: PropTypes.func.isRequired
};
export default MyAccount;
| Add new fields to account view | Add new fields to account view
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -1,16 +1,86 @@
-import React from 'react';
+import React, { Component } from 'react';
import PropTypes from 'prop-types';
+import TextInput from 'components/text-input';
+import Button from 'components/button';
-const MyAccount = ({ user }) => (
- <div>
- <h1>User details</h1>
- <span>Email:</span>
- <span>{user.email}</span>
- </div>
-);
+import theme from 'styles/themes/input/text-input-theme.scss';
+import styles from './my-account-styles.scss';
+
+class MyAccount extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ name: '',
+ organization: '',
+ workArea: ''
+ };
+ }
+
+ render() {
+ const { user, id, updateUser } = this.props;
+
+ return (
+ <div>
+ <h1 className={styles.title}>User Profile</h1>
+ <div className={styles.personalInfo}>
+ <TextInput
+ className={styles.input}
+ theme={theme}
+ placeholder={user.user_id.name || 'Add a name'}
+ label={'Name'}
+ inputType={'text'}
+ onChange={value => this.setState({ name: value })}
+ />
+ <TextInput
+ className={styles.input}
+ theme={theme}
+ value={user.email}
+ inputType={'text'}
+ label={'Email'}
+ disabled
+ />
+ </div>
+ <div className={styles.organizationalInfo}>
+ <TextInput
+ className={styles.input}
+ theme={theme}
+ placeholder={user.user_id.organization || 'Add an organization'}
+ label={'Organization'}
+ inputType={'text'}
+ focus
+ onChange={value => this.setState({ organization: value })}
+ />
+ <TextInput
+ className={styles.input}
+ theme={theme}
+ placeholder={user.user_id.work_area || 'Add an area of work'}
+ label={'Area of work'}
+ inputType={'text'}
+ onChange={value => this.setState({ workArea: value })}
+ />
+ </div>
+ <div className={styles.updateButton}>
+ <Button
+ color={'yellow'}
+ onClick={() => {
+ updateUser(id, {
+ name: this.state.name,
+ organization: this.state.organization
+ });
+ }}
+ >
+ <span>Update profile</span>
+ </Button>
+ </div>
+ </div>
+ );
+ }
+}
MyAccount.propTypes = {
- user: PropTypes.object.isRequired
+ user: PropTypes.object.isRequired,
+ id: PropTypes.string.isRequired,
+ updateUser: PropTypes.func.isRequired
};
export default MyAccount; |
1764c5022736565ce0c5998022556d069f3ad513 | client/components/Article.jsx | client/components/Article.jsx | import React, { Component } from 'react';
import { Row, Col, Jumbotron } from 'react-bootstrap';
const Article = ({link, description, title, display_date}) => {
description = description && description.replace(/<\/?[^>]+(>|$)/g, "");
return(
<article>
<h4>
<a href={link} target="_blank">{title}</a>
<small>{display_date}</small>
</h4>
<p>{description}</p>
</article>
);
};
export default Article;
| import React, { Component } from 'react';
const scrubText = (text) => text && text.replace(/(<\/?[^>]+(>|$))|(&(.*?);)/g, "");
const Article = ({link, description, title, display_date}) => {
return(
<article>
<h4>
<a href={link} target="_blank">{scrubText(title)}</a>
<small>{display_date}</small>
</h4>
<p>{scrubText(description)}</p>
</article>
);
};
export default Article;
| Scrub article title and description Remove tags and character codes | Scrub article title and description
Remove tags and character codes
| JSX | mit | andy-j-d/simply-news-ui,andy-j-d/simply-news-ui | ---
+++
@@ -1,18 +1,16 @@
import React, { Component } from 'react';
-import { Row, Col, Jumbotron } from 'react-bootstrap';
+const scrubText = (text) => text && text.replace(/(<\/?[^>]+(>|$))|(&(.*?);)/g, "");
const Article = ({link, description, title, display_date}) => {
-
- description = description && description.replace(/<\/?[^>]+(>|$)/g, "");
return(
<article>
<h4>
- <a href={link} target="_blank">{title}</a>
+ <a href={link} target="_blank">{scrubText(title)}</a>
<small>{display_date}</small>
</h4>
- <p>{description}</p>
+ <p>{scrubText(description)}</p>
</article>
);
}; |
6bc463c83ee211ff00b3ad253cb77d6010ffbcb5 | app/Routes.jsx | app/Routes.jsx | import React from 'react'
import {Route, Redirect, IndexRoute} from 'react-router'
import Layout from './layout/Layout.jsx'
import Home from './pages/Home.jsx'
import Login from './pages/Login.jsx'
const Routes = (
<Route>
<Route path="/" component={Layout}>
<Redirect from="/" to="/home"/>
<IndexRoute component={Home}/>
<Route path="home" component={Home}/>
</Route>
<Route path="/login" component={Login}/>
</Route>);
export default Routes
| import React from 'react'
import {Route, Redirect, IndexRoute} from 'react-router'
import Layout from './layout/Layout.jsx'
import Home from './pages/Home.jsx'
import Counter from './pages/Counter.jsx'
import Login from './pages/Login.jsx'
const Routes = (
<Route>
<Route path="/" component={Layout}>
<Redirect from="/" to="/home"/>
<IndexRoute component={Home}/>
<Route path="home" component={Home}/>
</Route>
<Route path="/counter" component={Layout}>
<IndexRoute component={Counter}/>
</Route>
<Route path="/login" component={Login}/>
</Route>);
export default Routes
| Update routes for new component | Update routes for new component
| JSX | agpl-3.0 | mbrossard/go-experiments,mbrossard/go-experiments,mbrossard/go-experiments | ---
+++
@@ -3,6 +3,7 @@
import Layout from './layout/Layout.jsx'
import Home from './pages/Home.jsx'
+import Counter from './pages/Counter.jsx'
import Login from './pages/Login.jsx'
const Routes = (
@@ -12,6 +13,9 @@
<IndexRoute component={Home}/>
<Route path="home" component={Home}/>
</Route>
+ <Route path="/counter" component={Layout}>
+ <IndexRoute component={Counter}/>
+ </Route>
<Route path="/login" component={Login}/>
</Route>);
|
7f1b4d7d70cf364448ea2e829a7ad8c48080a692 | src/js/components/Tasks.jsx | src/js/components/Tasks.jsx | import React, { PropTypes } from 'react';
import Task from './Task.jsx';
const propTypes = {
label: PropTypes.string.isRequired,
tasks: PropTypes.array,
};
export default class Tasks extends React.Component {
render() {
const tasks = this.props.tasks.map(task => <Task key={task.id} task={task} />);
return (
<div className="content">
<h3>{this.props.label}</h3>
<table className="table">
<tbody>
{tasks}
</tbody>
</table>
</div>
);
}
}
Tasks.propTypes = propTypes;
| import React, { PropTypes } from 'react';
import Task from './Task.jsx';
const propTypes = {
label: PropTypes.string.isRequired,
tasks: PropTypes.array,
};
export default class Tasks extends React.Component {
render() {
const tasks = this.props.tasks.map(task => <Task key={task.id} task={task} />);
const clx = () => {
switch (this.props.label) {
case 'TODO':
return 'is-danger';
case 'DOING':
return 'is-warning';
case 'DONE':
return 'is-success';
default:
return '';
}
};
return (
<article className={`message ${clx()}`}>
<h3 className="message-header">{this.props.label}</h3>
<div className="message-body">
<table className="table">
<tbody>
{tasks}
</tbody>
</table>
</div>
</article>
// <div className="content">
// <h3>{this.props.label}</h3>
// <table className="table">
// <tbody>
// {tasks}
// </tbody>
// </table>
// </div>
);
}
}
Tasks.propTypes = propTypes;
| Change tasks div color by status | Change tasks div color by status
| JSX | mit | tanaka0325/nippo-web,tanaka0325/nippo-web | ---
+++
@@ -11,15 +11,38 @@
render() {
const tasks = this.props.tasks.map(task => <Task key={task.id} task={task} />);
+ const clx = () => {
+ switch (this.props.label) {
+ case 'TODO':
+ return 'is-danger';
+ case 'DOING':
+ return 'is-warning';
+ case 'DONE':
+ return 'is-success';
+ default:
+ return '';
+ }
+ };
+
return (
- <div className="content">
- <h3>{this.props.label}</h3>
- <table className="table">
- <tbody>
- {tasks}
- </tbody>
- </table>
- </div>
+ <article className={`message ${clx()}`}>
+ <h3 className="message-header">{this.props.label}</h3>
+ <div className="message-body">
+ <table className="table">
+ <tbody>
+ {tasks}
+ </tbody>
+ </table>
+ </div>
+ </article>
+ // <div className="content">
+ // <h3>{this.props.label}</h3>
+ // <table className="table">
+ // <tbody>
+ // {tasks}
+ // </tbody>
+ // </table>
+ // </div>
);
}
} |
849663207caf4b55f8c54f0fa2b01f05952d54dd | client/components/NoteList.jsx | client/components/NoteList.jsx | import React from 'react';
// import SearchBar from './SearchBar.jsx';
// Eventually use searchbar inside browse notes?
// Is styling better that way?
import NoteItem from './NoteItem.jsx';
const NoteList = props => (
<div className="notes-list">
<ul>
{props.notes.map(element =>
<NoteItem
store={props.store}
key={element._id}
noteId={element._id}
title={element.title}
text={element.text}
username={props.username}
/>
)}
</ul>
</div>
);
NoteList.propTypes = {
notes: React.PropTypes.arrayOf(React.PropTypes.object),
username: React.PropTypes.string
};
export default NoteList;
| import React from 'react';
// import SearchBar from './SearchBar.jsx';
// Eventually use searchbar inside browse notes?
// Is styling better that way?
import NoteItem from './NoteItem.jsx';
const NoteList = props => (
<div className="notes-list">
<ul>
{props.notes.map(element =>
<NoteItem
store={props.store}
key={element._id}
noteId={element._id}
title={element.title}
text={element.text}
username={props.username}
/>
)}
</ul>
</div>
);
NoteList.propTypes = {
notes: React.PropTypes.arrayOf(React.PropTypes.object),
username: React.PropTypes.string,
};
export default NoteList;
| Fix some linting errors with React proptypes | Fix some linting errors with React proptypes
| JSX | mit | enchanted-spotlight/Plato,enchanted-spotlight/Plato | ---
+++
@@ -25,7 +25,7 @@
NoteList.propTypes = {
notes: React.PropTypes.arrayOf(React.PropTypes.object),
- username: React.PropTypes.string
+ username: React.PropTypes.string,
};
export default NoteList; |
23eaf628e42251cc158d7591058d3ce5112d215c | client/src/HouseInventoryListItem.jsx | client/src/HouseInventoryListItem.jsx | import React from 'react';
class HouseInventoryListItem extends React.Component {
constructor(props) {
super(props);
this.state = {
item: this.props.item
};
}
render() {
return (
<div>
</div>
);
}
}
export default HouseInventoryListItem;
| import React from 'react';
class HouseInventoryListItem extends React.Component {
constructor(props) {
super(props);
this.state = {
item: this.props.item,
needToRestock: this.props.item.need_to_restock,
userId: this.props.item.user_id,
username: ''
};
}
clickRestock(event) {
// post request to the db
this.setState({
needToRestock: true
});
}
clickClaim(event) {
// get request to db to see who is signed in
// post request to the db
this.setState({
userId: 1,
username: 'April'
});
}
clickDelete(event) {
// post request to the db
console.log('deleting');
}
render() {
if (!this.state.needToRestock) {
return (
<div>
<div className="item-name">Name: {this.state.item.name}</div>
<div className="item-notes">Notes: {this.state.item.notes}</div>
<button type="button" className="restock-button" onClick={this.clickRestock.bind(this)}>Need to Restock</button>
</div>
);
} else if (this.state.needToRestock && this.state.userId === null) {
return (
<div>
<div className="item-name">Name: {this.state.item.name}</div>
<div className="item-notes">Notes: {this.state.item.notes}</div>
<button type="button" className="claim-button" onClick={this.clickClaim.bind(this)}>Add to My Shopping List</button>
<button type="button" className="delete-button" onClick={this.clickDelete.bind(this)}>Delete</button>
</div>
);
} else if (this.state.needToRestock && typeof this.state.userId === 'number') {
return (
<div>
<div className="item-name">Name: {this.state.item.name}</div>
<div className="item-notes">Notes: {this.state.item.notes}</div>
<button type="button" className="claimed">Claimed by {this.state.username}</button>
</div>
);
}
}
}
export default HouseInventoryListItem;
| Add basic conditional rendering for button clicks using dummy data | Add basic conditional rendering for button clicks using dummy data
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -5,15 +5,61 @@
super(props);
this.state = {
- item: this.props.item
+ item: this.props.item,
+ needToRestock: this.props.item.need_to_restock,
+ userId: this.props.item.user_id,
+ username: ''
};
}
+ clickRestock(event) {
+ // post request to the db
+ this.setState({
+ needToRestock: true
+ });
+ }
+
+ clickClaim(event) {
+ // get request to db to see who is signed in
+ // post request to the db
+ this.setState({
+ userId: 1,
+ username: 'April'
+ });
+ }
+
+ clickDelete(event) {
+ // post request to the db
+ console.log('deleting');
+ }
+
render() {
- return (
- <div>
- </div>
- );
+ if (!this.state.needToRestock) {
+ return (
+ <div>
+ <div className="item-name">Name: {this.state.item.name}</div>
+ <div className="item-notes">Notes: {this.state.item.notes}</div>
+ <button type="button" className="restock-button" onClick={this.clickRestock.bind(this)}>Need to Restock</button>
+ </div>
+ );
+ } else if (this.state.needToRestock && this.state.userId === null) {
+ return (
+ <div>
+ <div className="item-name">Name: {this.state.item.name}</div>
+ <div className="item-notes">Notes: {this.state.item.notes}</div>
+ <button type="button" className="claim-button" onClick={this.clickClaim.bind(this)}>Add to My Shopping List</button>
+ <button type="button" className="delete-button" onClick={this.clickDelete.bind(this)}>Delete</button>
+ </div>
+ );
+ } else if (this.state.needToRestock && typeof this.state.userId === 'number') {
+ return (
+ <div>
+ <div className="item-name">Name: {this.state.item.name}</div>
+ <div className="item-notes">Notes: {this.state.item.notes}</div>
+ <button type="button" className="claimed">Claimed by {this.state.username}</button>
+ </div>
+ );
+ }
}
}
|
2d9281c9fa73231fb1c55d981bd2251c9ee2b669 | client/src/houseInventory.jsx | client/src/houseInventory.jsx | import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
import HouseInventoryList from './HouseInventoryList.jsx';
class HouseInventory extends React.Component {
constructor(props) {
super(props);
this.state({
items: []
});
}
componentDidMount() {
this.getItems(this.updateItems.bind(this));
}
getItems(callback) {
$.ajax({
type: 'GET',
url: '/inventory',
success: function(data) {
console.log('Successful GET request - house inventory items retrieved');
callback(data);
},
error: function() {
console.log('Unable to GET house inventory items');
}
});
}
updateItems(data) {
this.setState({
items: data
});
}
render() {
return (
<div>
<h1>House Inventory</h1>
<Nav />
<HouseInventoryList items={this.state.items}/>
</div>
);
}
}
ReactDOM.render(<Inventory />, document.getElementById('inventory'));
| import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
import HouseInventoryList from './HouseInventoryList.jsx';
import Nav from './Nav.jsx';
class HouseInventory extends React.Component {
constructor(props) {
super(props);
this.state({
items: []
});
}
componentDidMount() {
this.getItems(this.updateItems.bind(this));
}
getItems(callback) {
$.ajax({
type: 'GET',
url: '/inventory',
success: function(data) {
console.log('Successful GET request - house inventory items retrieved');
callback(data);
},
error: function() {
console.log('Unable to GET house inventory items');
}
});
}
updateItems(data) {
this.setState({
items: data
});
}
render() {
return (
<div>
<h1>House Inventory</h1>
<Nav />
<HouseInventoryList items={this.state.items}/>
</div>
);
}
}
ReactDOM.render(<Inventory />, document.getElementById('inventory'));
| Change to import Nav component | Change to import Nav component
| JSX | mit | SentinelsOfMagic/SentinelsOfMagic | ---
+++
@@ -2,6 +2,7 @@
import ReactDOM from 'react-dom';
import $ from 'jquery';
import HouseInventoryList from './HouseInventoryList.jsx';
+import Nav from './Nav.jsx';
class HouseInventory extends React.Component {
constructor(props) { |
9693cbb26c6a94b6210267efe2a5dece9ad36f2b | js/Landing.jsx | js/Landing.jsx | const React = require('react')
const { Link } = require('react-router')
// stateless component
// </> slash is necessary because it says don'tlook for closing tag
// Lowercase says you want to use something native from React
// Caps state a component you made
// class is reserved in js, so we need to use className for css
const Landing = () => (
<div className='app-container'>
<div className='home-info'>
<h1 className='title'>svideo</h1>
<input className='search' type='text' placeholder='Search' />
<Link to='/search' className='browse-all'>or Browse All</Link>
</div>
</div>
)
module.exports = Landing
| const React = require('react')
const { Link } = require('react-router')
// stateless component
// </> slash is necessary because it says don'tlook for closing tag
// Lowercase says you want to use something native from React
// Caps state a component you made
// class is reserved in js, so we need to use className for css
const Landing = () => (
<div className='home-info'>
<h1 className='title'>svideo</h1>
<input className='search' type='text' placeholder='Search' />
<Link to='/search' className='browse-all'>or Browse All</Link>
</div>
)
module.exports = Landing
| Remove app container from landing | Remove app container from landing
| JSX | mit | teatreelee/complete-react,teatreelee/complete-react | ---
+++
@@ -9,13 +9,11 @@
// class is reserved in js, so we need to use className for css
const Landing = () => (
- <div className='app-container'>
<div className='home-info'>
<h1 className='title'>svideo</h1>
<input className='search' type='text' placeholder='Search' />
<Link to='/search' className='browse-all'>or Browse All</Link>
</div>
- </div>
)
module.exports = Landing |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.