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
|
---|---|---|---|---|---|---|---|---|---|---|
4d7706a2c0271850d7f39b161063ae9e775d1f02 | src/components/Session/AddTrustFromDirectory.jsx | src/components/Session/AddTrustFromDirectory.jsx | const React = window.React = require('react');
import AssetCard from '../AssetCard.jsx';
import AddTrustRow from './AddTrustRow.jsx';
import directory from '../../directory';
import _ from 'lodash';
export default class AddTrustFromDirectory extends React.Component {
constructor(props) {
super(props);
}
render() {
let rows = [];
_.each(directory.assets, assetObj => {
let asset = new StellarSdk.Asset(assetObj.code, assetObj.issuer);
const key = assetObj.code + assetObj.issuer;
rows.push(<AddTrustRow key={key} d={this.props.d} asset={asset}></AddTrustRow>);
})
return <div className="island">
<div className="island__header">
Accept more assets
</div>
<div className="island__paddedContent">
<p>This is a list of anchors from the Stellar community.<br />Note: StellarTerm does not endorse any of these anchors.</p>
</div>
<div className="AddTrustFromDirectory">
{rows}
</div>
</div>
}
}
| const React = window.React = require('react');
import AssetCard from '../AssetCard.jsx';
import AddTrustRow from './AddTrustRow.jsx';
import directory from '../../directory';
import _ from 'lodash';
export default class AddTrustFromDirectory extends React.Component {
constructor(props) {
super(props);
}
render() {
let rows = [];
let added = {}; // Don't duplicate items
let ticker = this.props.d.ticker;
if (ticker.ready) {
for (let i in ticker.data.assets) {
let tickerAsset = ticker.data.assets[i];
if (tickerAsset.id !== 'XLM-native') {
added[tickerAsset.id] = true;
let sdkAsset = new StellarSdk.Asset(tickerAsset.code, tickerAsset.issuer);
rows.push(<AddTrustRow key={tickerAsset.id} d={this.props.d} asset={sdkAsset}></AddTrustRow>);
}
}
}
_.each(directory.assets, assetObj => {
let basicSlug = assetObj.code + '-' + assetObj.issuer;
if (!(basicSlug in added)) {
let asset = new StellarSdk.Asset(assetObj.code, assetObj.issuer);
rows.push(<AddTrustRow key={basicSlug} d={this.props.d} asset={asset}></AddTrustRow>);
}
})
return <div className="island">
<div className="island__header">
Accept more assets
</div>
<div className="island__paddedContent">
<p>This is a list of anchors from the Stellar community.<br />Note: StellarTerm does not endorse any of these anchors.</p>
</div>
<div className="AddTrustFromDirectory">
{rows}
</div>
</div>
}
}
| Change ordering of accepting new assets based on ticker | Change ordering of accepting new assets based on ticker
| JSX | apache-2.0 | irisli/stellarterm,irisli/stellarterm,irisli/stellarterm | ---
+++
@@ -10,10 +10,25 @@
}
render() {
let rows = [];
+ let added = {}; // Don't duplicate items
+ let ticker = this.props.d.ticker;
+ if (ticker.ready) {
+ for (let i in ticker.data.assets) {
+ let tickerAsset = ticker.data.assets[i];
+ if (tickerAsset.id !== 'XLM-native') {
+ added[tickerAsset.id] = true;
+ let sdkAsset = new StellarSdk.Asset(tickerAsset.code, tickerAsset.issuer);
+ rows.push(<AddTrustRow key={tickerAsset.id} d={this.props.d} asset={sdkAsset}></AddTrustRow>);
+ }
+ }
+ }
+
_.each(directory.assets, assetObj => {
- let asset = new StellarSdk.Asset(assetObj.code, assetObj.issuer);
- const key = assetObj.code + assetObj.issuer;
- rows.push(<AddTrustRow key={key} d={this.props.d} asset={asset}></AddTrustRow>);
+ let basicSlug = assetObj.code + '-' + assetObj.issuer;
+ if (!(basicSlug in added)) {
+ let asset = new StellarSdk.Asset(assetObj.code, assetObj.issuer);
+ rows.push(<AddTrustRow key={basicSlug} d={this.props.d} asset={asset}></AddTrustRow>);
+ }
})
return <div className="island">
<div className="island__header"> |
41e5e7fcff622ccdc2cbf18d5046f844860d375b | app/js/components/dashboard_panel/dashboard_panel.jsx | app/js/components/dashboard_panel/dashboard_panel.jsx | import React, { PropTypes } from 'react'
import { TABLEAU_HOST } from '../../constants/app_constants'
import './dashboard_panel.scss'
const DashboardPanel = ({leftHandNavVisible, dashboard, token}) => {
return token && dashboard
? <div className={`dashboard-panel ${leftHandNavVisible ? 'collapsed' : 'expanded'}`}>
<iframe
src={`${TABLEAU_HOST}trusted/${token}/views/${dashboard.views[0].replace('sheets/', '')}?:embed=yes&:toolbar=no&:showShareOptions=no&:record_performance=yes`} />
</div>
: null
}
DashboardPanel.propTypes = {
leftHandNavVisible: PropTypes.bool.isRequired,
dashboard: PropTypes.object,
token: PropTypes.string,
}
export default DashboardPanel
| import React, { PropTypes } from 'react'
import { TABLEAU_HOST } from '../../constants/app_constants'
import './dashboard_panel.scss'
const DashboardPanel = ({ leftHandNavVisible, dashboard, token, userId }) => {
return dashboard && token
? <div className={`dashboard-panel ${leftHandNavVisible ? 'collapsed' : 'expanded'}`}>
<iframe
src={`${TABLEAU_HOST}trusted/${token}/views/${dashboard.views[0].replace('sheets/', '')}?:embed=yes&:toolbar=no&:showShareOptions=no&:record_performance=yes&UUID=${userId}`} />
</div>
: null
}
DashboardPanel.propTypes = {
leftHandNavVisible: PropTypes.bool.isRequired,
dashboard: PropTypes.object,
token: PropTypes.string,
userId: PropTypes.string,
}
export default DashboardPanel
| Add userId to UUID param in iframe URL | Add userId to UUID param in iframe URL
| JSX | mit | reevoo/client_portal-analytics_frontend,reevoo/client_portal-analytics_frontend,reevoo/client_portal-analytics_frontend,reevoo/client_portal-analytics_frontend | ---
+++
@@ -2,11 +2,11 @@
import { TABLEAU_HOST } from '../../constants/app_constants'
import './dashboard_panel.scss'
-const DashboardPanel = ({leftHandNavVisible, dashboard, token}) => {
- return token && dashboard
+const DashboardPanel = ({ leftHandNavVisible, dashboard, token, userId }) => {
+ return dashboard && token
? <div className={`dashboard-panel ${leftHandNavVisible ? 'collapsed' : 'expanded'}`}>
<iframe
- src={`${TABLEAU_HOST}trusted/${token}/views/${dashboard.views[0].replace('sheets/', '')}?:embed=yes&:toolbar=no&:showShareOptions=no&:record_performance=yes`} />
+ src={`${TABLEAU_HOST}trusted/${token}/views/${dashboard.views[0].replace('sheets/', '')}?:embed=yes&:toolbar=no&:showShareOptions=no&:record_performance=yes&UUID=${userId}`} />
</div>
: null
}
@@ -15,6 +15,7 @@
leftHandNavVisible: PropTypes.bool.isRequired,
dashboard: PropTypes.object,
token: PropTypes.string,
+ userId: PropTypes.string,
}
export default DashboardPanel |
27da0e5e7e75bf1a86938f7d0ce1454989d26a33 | components/AuthorCard/index.jsx | components/AuthorCard/index.jsx | import React, { Component } from 'react'
import { prefixLink } from 'gatsby-helpers'
import markdown from 'markdown-it'
export default class AuthorCard extends Component {
render() {
const { name, username, avatar, twitterLink, children } = this.props
return (
<div style={{display: 'flex'}}>
<img style={{margin: '20px'}} src={prefixLink(`/${avatar}`)} width='75' height='75' alt={username} className="floatLeft" />
<p style={{flex: '1'}}>
<strong>{name}</strong> - @<a href={twitterLink} title={`${username} on Twitter`}>{username}</a>
<span dangerouslySetInnerHTML={{ __html: markdown().render(children).match(/<p>([^]+)<\/p>/)[1] }} />
</p>
</div>
)
}
}
| import React, { Component } from 'react'
import { prefixLink } from 'gatsby-helpers'
import markdown from 'markdown-it'
export default class AuthorCard extends Component {
render() {
const { name, username, avatar, twitterLink, children } = this.props
return (
<div style={{display: 'flex'}}>
<img style={{margin: '20px'}} src={prefixLink(`/${avatar}`)} width='75' height='75' alt={username} />
<div style={{flex: '1'}}>
<strong>{name}</strong> - @<a href={twitterLink} title={`${username} on Twitter`}>{username}</a>
<p style={{margin: '0'}} dangerouslySetInnerHTML={{ __html: markdown().render(children).match(/<p>([^]+)<\/p>/)[1] }} />
</div>
</div>
)
}
}
| Fix HTML semantic and remove useless float | Fix HTML semantic and remove useless float
| JSX | mit | YoruNoHikage/blog,YoruNoHikage/yorunohikage.github.io,YoruNoHikage/yorunohikage.github.io | ---
+++
@@ -8,11 +8,11 @@
return (
<div style={{display: 'flex'}}>
- <img style={{margin: '20px'}} src={prefixLink(`/${avatar}`)} width='75' height='75' alt={username} className="floatLeft" />
- <p style={{flex: '1'}}>
+ <img style={{margin: '20px'}} src={prefixLink(`/${avatar}`)} width='75' height='75' alt={username} />
+ <div style={{flex: '1'}}>
<strong>{name}</strong> - @<a href={twitterLink} title={`${username} on Twitter`}>{username}</a>
- <span dangerouslySetInnerHTML={{ __html: markdown().render(children).match(/<p>([^]+)<\/p>/)[1] }} />
- </p>
+ <p style={{margin: '0'}} dangerouslySetInnerHTML={{ __html: markdown().render(children).match(/<p>([^]+)<\/p>/)[1] }} />
+ </div>
</div>
)
} |
a57255d88ea15f60a450f21cd021bd1d0040e541 | main.jsx | main.jsx | 'use strict';
import React from 'react';
import DashboardRow from './src/dashboard.jsx';
const repo = 'lowsky/dashboard';
let branchesTable = document.getElementById('branchesTable');
let renderOrUpdateBranches = (branches) => {
React.render(
<tbody>
{
branches.map(function (branch) {
return <DashboardRow branch={branch} key={branch}/>;
})
}
</tbody>,
branchesTable);
};
let requestAndShowBranches = () => {
let url = 'https://api.github.com/repos/' + repo + '/branches';
let request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
let data = JSON.parse(request.responseText);
console.log(data);
let branchNames = data.map(function (item) {
return item.name;
});
console.log(branchNames);
renderOrUpdateBranches(branchNames);
} else {
alert('Load error, while trying to retrieve data from ' + url +
' Server respond: ' + request.responseText);
}
};
request.onerror = function () {
console.error(request);
alert('Load error, while trying to retrieve data from ' + url);
};
return request;
};
renderOrUpdateBranches([]);
requestAndShowBranches().send();
| 'use strict';
import React from 'react';
import DashboardRow from './src/dashboard.jsx';
const repo = 'lowsky/dashboard';
let branchesTable = document.getElementById('branchesTable');
let renderOrUpdateBranches = (branches) => {
React.render(
<tbody>
{
branches.map(function (branch) {
return <DashboardRow branch={branch} key={branch}/>;
})
}
</tbody>,
branchesTable);
};
let requestAndShowBranches = () => {
let url = `https://api.github.com/repos/${repo}/branches`;
let request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = function () {
if (request.status >= 200 && request.status < 400) {
let data = JSON.parse(request.responseText);
console.log(data);
let branchNames = data.map(function (item) {
return item.name;
});
console.log(branchNames);
renderOrUpdateBranches(branchNames);
} else {
alert(`Load error, while trying to retrieve data from $url - respond status: `, request.status);
}
};
request.onerror = () => {
console.error('Error occured', request);
alert(`Load error, while trying to retrieve data from $url`);
};
return request;
};
renderOrUpdateBranches([]);
requestAndShowBranches().send();
| Use ES6 string templating with backticks ` ! | Use ES6 string templating with backticks ` !
| JSX | apache-2.0 | lowsky/dashboard,lowsky/dashboard,lowsky/dashboard | ---
+++
@@ -20,7 +20,7 @@
};
let requestAndShowBranches = () => {
- let url = 'https://api.github.com/repos/' + repo + '/branches';
+ let url = `https://api.github.com/repos/${repo}/branches`;
let request = new XMLHttpRequest();
request.open('GET', url, true);
request.onload = function () {
@@ -37,13 +37,12 @@
renderOrUpdateBranches(branchNames);
} else {
- alert('Load error, while trying to retrieve data from ' + url +
- ' Server respond: ' + request.responseText);
+ alert(`Load error, while trying to retrieve data from $url - respond status: `, request.status);
}
};
- request.onerror = function () {
- console.error(request);
- alert('Load error, while trying to retrieve data from ' + url);
+ request.onerror = () => {
+ console.error('Error occured', request);
+ alert(`Load error, while trying to retrieve data from $url`);
};
return request;
}; |
9c0596b205e471627306da7c0878847e0190341f | src/components/Sidebar/CategoryFilterSearch.jsx | src/components/Sidebar/CategoryFilterSearch.jsx | import React from 'react';
import { connect } from 'react-redux';
import pluralize from '../../utils/pluralRules';
import { setSearchCategory } from '../../actions/filtersData';
const propTypes = {
category: React.PropTypes.string,
setSearchCategory: React.PropTypes.func,
};
const updateCategorySearch = (evt, props) => {
const search = evt.target.value;
props.setSearchCategory(search, props.category);
};
const CategoryFilterSearch = props => (
<div className="CategoryFilter__category-catalogue-search">
<input
type="text"
placeholder={`Enter ${pluralize(props.category, 1)} name`}
onChange={evt => updateCategorySearch(evt, props)}
/>
</div>
);
const makeMapStateToProps = (_, ownProps) => {
const { category } = ownProps;
return (state) => {
const currentSearch = state.filtersData.searchedData[category];
return { category, currentSearch };
};
};
CategoryFilterSearch.propTypes = propTypes;
export default connect(makeMapStateToProps, { setSearchCategory })(CategoryFilterSearch);
| import React from 'react';
import { connect } from 'react-redux';
import pluralize from '../../utils/pluralRules';
import { setSearchCategory, resetSearchCategory } from '../../actions/filtersData';
const propTypes = {
category: React.PropTypes.string,
currentSearch: React.PropTypes.string,
setSearchCategory: React.PropTypes.func,
resetSearchCategory: React.PropTypes.func,
};
const updateCategorySearch = (evt, category, setSearch) => {
const search = evt.target.value;
setSearch(search, category);
};
const CategoryFilterSearch = props => (
<div className="CategoryFilter__category-catalogue-search">
<input
type="text"
placeholder={`Enter ${pluralize(props.category, 1)} name`}
onChange={evt => updateCategorySearch(evt, props.category, props.setSearchCategory)}
value={props.currentSearch}
onBlur={() => props.resetSearchCategory(props.category)}
onKeyDown={(evt) => {
if (evt.keyCode === 27) {
// reset search when pressing escape
props.resetSearchCategory(props.category);
}
}}
/>
</div>
);
const makeMapStateToProps = (_, ownProps) => {
const { category } = ownProps;
return (state) => {
const currentSearch = state.filtersData.searchedData[category];
return { category, currentSearch };
};
};
CategoryFilterSearch.propTypes = propTypes;
export default connect(makeMapStateToProps, {
setSearchCategory,
resetSearchCategory,
})(CategoryFilterSearch);
| Improve behaviour of search component | Improve behaviour of search component
| JSX | mit | giuband/dunya-frontend,giuband/dunya-frontend | ---
+++
@@ -1,16 +1,18 @@
import React from 'react';
import { connect } from 'react-redux';
import pluralize from '../../utils/pluralRules';
-import { setSearchCategory } from '../../actions/filtersData';
+import { setSearchCategory, resetSearchCategory } from '../../actions/filtersData';
const propTypes = {
category: React.PropTypes.string,
+ currentSearch: React.PropTypes.string,
setSearchCategory: React.PropTypes.func,
+ resetSearchCategory: React.PropTypes.func,
};
-const updateCategorySearch = (evt, props) => {
+const updateCategorySearch = (evt, category, setSearch) => {
const search = evt.target.value;
- props.setSearchCategory(search, props.category);
+ setSearch(search, category);
};
const CategoryFilterSearch = props => (
@@ -18,7 +20,15 @@
<input
type="text"
placeholder={`Enter ${pluralize(props.category, 1)} name`}
- onChange={evt => updateCategorySearch(evt, props)}
+ onChange={evt => updateCategorySearch(evt, props.category, props.setSearchCategory)}
+ value={props.currentSearch}
+ onBlur={() => props.resetSearchCategory(props.category)}
+ onKeyDown={(evt) => {
+ if (evt.keyCode === 27) {
+ // reset search when pressing escape
+ props.resetSearchCategory(props.category);
+ }
+ }}
/>
</div>
);
@@ -32,4 +42,7 @@
};
CategoryFilterSearch.propTypes = propTypes;
-export default connect(makeMapStateToProps, { setSearchCategory })(CategoryFilterSearch);
+export default connect(makeMapStateToProps, {
+ setSearchCategory,
+ resetSearchCategory,
+})(CategoryFilterSearch); |
e45098d663862b77ea17c441d6ae306ed7efbdcc | src/handlers/Profile.jsx | src/handlers/Profile.jsx | import React, { Component } from 'react'
import Radium from 'radium'
class Profile extends Component {
render () {
return <div>
Hello world!
</div>
}
}
export default Radium(Profile)
| import React, { Component } from 'react'
import Radium from 'radium'
import gravatar from 'gravatar'
import {
Card,
CardHeader,
CardText,
RaisedButton,
TextField
} from 'material-ui'
class Profile extends Component {
getStyles () {
return {
margin: '0 auto',
maxWidth: '600px',
padding: '0 10px 10px 10px'
}
}
render () {
const email = '[email protected]'
const avatarUrl = gravatar.imageUrl(email)
return <div style={ this.getStyles() }>
<h1>Profile</h1>
<Card style={{ paddingBottom: '16px' }}>
<CardHeader
avatar={ avatarUrl }
subtitle={ <TextField
hintText='Title and Company'
style={{
fontSize: '13px',
lineHeight: '14px',
height: '38px'
}}
/> }
title={ email }
/>
<CardText style={{ clear: 'both' }}>
<br />
<TextField
hintText='Enter a brief description about yourself.'
multiLine={ true }
/><br />
<RaisedButton
label='Save'
primary={ true }
style={{ float: 'right' }}
/>
</CardText>
</Card>
</div>
}
}
export default Radium(Profile)
| Add text fields to profile page. | Add text fields to profile page.
| JSX | mit | tvararu/peak-meteor,tvararu/peak-meteor | ---
+++
@@ -1,10 +1,55 @@
import React, { Component } from 'react'
import Radium from 'radium'
+import gravatar from 'gravatar'
+import {
+ Card,
+ CardHeader,
+ CardText,
+ RaisedButton,
+ TextField
+} from 'material-ui'
class Profile extends Component {
+ getStyles () {
+ return {
+ margin: '0 auto',
+ maxWidth: '600px',
+ padding: '0 10px 10px 10px'
+ }
+ }
+
render () {
- return <div>
- Hello world!
+ const email = '[email protected]'
+ const avatarUrl = gravatar.imageUrl(email)
+
+ return <div style={ this.getStyles() }>
+ <h1>Profile</h1>
+ <Card style={{ paddingBottom: '16px' }}>
+ <CardHeader
+ avatar={ avatarUrl }
+ subtitle={ <TextField
+ hintText='Title and Company'
+ style={{
+ fontSize: '13px',
+ lineHeight: '14px',
+ height: '38px'
+ }}
+ /> }
+ title={ email }
+ />
+ <CardText style={{ clear: 'both' }}>
+ <br />
+ <TextField
+ hintText='Enter a brief description about yourself.'
+ multiLine={ true }
+ /><br />
+ <RaisedButton
+ label='Save'
+ primary={ true }
+ style={{ float: 'right' }}
+ />
+ </CardText>
+ </Card>
</div>
}
} |
4a015a2c4d0d8a2e9fbe267e10c8377d8980711f | src/components/AdditionalPropertiesEditor.jsx | src/components/AdditionalPropertiesEditor.jsx | import React from 'react'
import {connect} from 'react-redux'
import {matchSchema} from '../utilities'
import {INTERNAL_ID} from '../utilities/data'
import {subpath, last} from '../utilities/path'
import PropertyEditor from './PropertyEditor'
const AdditionalPropertiesEditor = ({schema, data, path, rootSchema}) => {
if (schema == null || schema === false || data == null) {
return null
}
return (
<div>
{Object.keys(data).filter(key => key !== INTERNAL_ID).map(key => {
const sub = subpath(path, key)
const title = last(sub)
return <PropertyEditor key={data[key].__id || sub} schema={matchSchema(schema.anyOf || [schema], data[key], rootSchema)} data={data[key]} title={title} path={sub} canEditKey={true} canRemove={true} />
})}
</div>
)
}
export default connect(({rootSchema}) => ({rootSchema}))(AdditionalPropertiesEditor)
| import React from 'react'
import {connect} from 'react-redux'
import {matchSchema} from '../utilities'
import {INTERNAL_ID} from '../utilities/data'
import {subpath, last} from '../utilities/path'
import PropertyEditor from './PropertyEditor'
const AdditionalPropertiesEditor = ({schema, data, path, rootSchema}) => {
if (schema == null || schema === false || data == null) {
return null
}
return (
<div>
{Object.keys(data).filter(key => key !== INTERNAL_ID).map(key => {
const sub = subpath(path, key)
const title = last(sub)
return <PropertyEditor key={data[key].__id || sub} schema={matchSchema(schema.anyOf || [schema], data[key], rootSchema)} data={data[key]} title={title} path={sub} canEditKey={data[key].__id} canRemove={true} />
})}
</div>
)
}
export default connect(({rootSchema}) => ({rootSchema}))(AdditionalPropertiesEditor)
| Make primitive property keys non-editable | Make primitive property keys non-editable
| JSX | mit | IngloriousCoderz/react-property-grid,IngloriousCoderz/react-property-grid | ---
+++
@@ -16,7 +16,7 @@
{Object.keys(data).filter(key => key !== INTERNAL_ID).map(key => {
const sub = subpath(path, key)
const title = last(sub)
- return <PropertyEditor key={data[key].__id || sub} schema={matchSchema(schema.anyOf || [schema], data[key], rootSchema)} data={data[key]} title={title} path={sub} canEditKey={true} canRemove={true} />
+ return <PropertyEditor key={data[key].__id || sub} schema={matchSchema(schema.anyOf || [schema], data[key], rootSchema)} data={data[key]} title={title} path={sub} canEditKey={data[key].__id} canRemove={true} />
})}
</div>
) |
e4749a9439c624945408ed3f00fb42d0462f5906 | app/assets/javascripts/Components/Helpers/data_chart.jsx | app/assets/javascripts/Components/Helpers/data_chart.jsx | import React from "react";
import {render} from "react-dom";
import {Bar} from "react-chartjs-2";
export class DataChart extends React.Component {
static defaultProps = {
legend: true,
width: "auto",
height: 500,
};
render() {
let options = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: this.props.legend,
},
},
scales: {
y: {
gridLines: {
color: document.documentElement.style.getPropertyValue("--gridline"),
},
ticks: {
beginAtZero: true,
min: 0,
max: 100,
},
scaleLabel: {
display: true,
labelString: this.props.yTitle,
},
},
x: {
gridLines: {
offsetGridLines: true,
color: document.documentElement.style.getPropertyValue("--gridline"),
},
scaleLabel: {
display: true,
labelString: this.props.xTitle,
},
offset: true,
},
},
};
return (
<Bar
id={"term_marks"}
data={this.props}
options={options}
width={this.props.width}
height={this.props.height}
style={{display: "inline-flex", margin: "10px"}}
/>
);
}
}
export function makeDataChart(elem, props) {
render(<DataChart {...props} />, elem);
}
| import React from "react";
import {render} from "react-dom";
import {Bar} from "react-chartjs-2";
import {Chart, registerables} from "chart.js";
Chart.register(...registerables);
export class DataChart extends React.Component {
static defaultProps = {
legend: true,
width: "auto",
height: 500,
};
render() {
let options = {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: this.props.legend,
},
},
scales: {
y: {
gridLines: {
color: document.documentElement.style.getPropertyValue("--gridline"),
},
ticks: {
beginAtZero: true,
min: 0,
max: 100,
},
scaleLabel: {
display: true,
labelString: this.props.yTitle,
},
},
x: {
gridLines: {
offsetGridLines: true,
color: document.documentElement.style.getPropertyValue("--gridline"),
},
scaleLabel: {
display: true,
labelString: this.props.xTitle,
},
offset: true,
},
},
};
return (
<Bar
id={"term_marks"}
data={this.props}
options={options}
width={this.props.width}
height={this.props.height}
style={{display: "inline-flex", margin: "10px"}}
/>
);
}
}
export function makeDataChart(elem, props) {
render(<DataChart {...props} />, elem);
}
| Fix registering scales for DataChart component | chart-js: Fix registering scales for DataChart component
| JSX | mit | MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus,MarkUsProject/Markus | ---
+++
@@ -1,6 +1,9 @@
import React from "react";
import {render} from "react-dom";
import {Bar} from "react-chartjs-2";
+
+import {Chart, registerables} from "chart.js";
+Chart.register(...registerables);
export class DataChart extends React.Component {
static defaultProps = { |
c09bb456f81e9b9f3dac4a3ac6769373cfeb8c39 | client/modules/core/components/main_layout.jsx | client/modules/core/components/main_layout.jsx | import React from 'react';
import Helmet from 'react-helmet';
const Layout = ({content = () => null }) => (
<div>
<Helmet
defaultTitle="voting-app"
titleTemplate="voting-app | %s"
meta={[
{name: 'viewport', content: 'width=device-width, initial-scale=1'}
]}
/>
<div>
{content()}
</div>
</div>
);
export default Layout;
| import React from 'react';
import Helmet from 'react-helmet';
import Header from './header.jsx';
import Footer from './footer.jsx';
const Layout = ({content = () => null }) => (
<div>
<Helmet
defaultTitle="voting-app"
titleTemplate="voting-app | %s"
meta={[
{name: 'viewport', content: 'width=device-width, initial-scale=1'}
]}
/>
<Header />
<div>
{content()}
</div>
<Footer />
</div>
);
export default Layout;
| Add Header and Footer to MainLayout | Add Header and Footer to MainLayout
| JSX | mit | thancock20/voting-app,thancock20/voting-app | ---
+++
@@ -1,5 +1,7 @@
import React from 'react';
import Helmet from 'react-helmet';
+import Header from './header.jsx';
+import Footer from './footer.jsx';
const Layout = ({content = () => null }) => (
<div>
@@ -10,9 +12,11 @@
{name: 'viewport', content: 'width=device-width, initial-scale=1'}
]}
/>
+ <Header />
<div>
{content()}
</div>
+ <Footer />
</div>
);
|
c634e79286218d85e499c80ff94e0b38b8542838 | src/stores/UserStore.jsx | src/stores/UserStore.jsx | 'use strict';
import Immutable from 'immutable';
import Reflux from 'reflux';
import UserActions from 'actions/UserActionCreators';
import TimezoneStore from 'stores/TimezoneStore';
const UserStore = Reflux.createStore({
listenables: UserActions,
init() {
let storage;
try {
let fromLocalStorage = localStorage.getItem('clockette');
if (fromLocalStorage) {
let arr = JSON.parse(fromLocalStorage);
if (Array.isArray(arr)) {
storage = arr;
}
else {
throw new Error('localStorage data wasn\'t readable');
}
}
else {
throw new Error('No localStorage found');
}
}
catch (e) {
storage = [];
}
this.data = Immutable.List(
storage.map((tz) => {
return TimezoneStore.getBy('zone', tz.zone).first();
})
);
},
save() {
localStorage.setItem('clockette', JSON.stringify(this.data.toArray()));
this.trigger(this.data);
},
onAdd(zone) {
this.data = this.data.add(zone);
this.save();
},
onRemove(zone) {
this.data = this.data.delete(this.data.indexOf(zone));
this.save();
},
});
export default UserStore;
| 'use strict';
import Immutable from 'immutable';
import Reflux from 'reflux';
import UserActions from 'actions/UserActionCreators';
import TimezoneStore from 'stores/TimezoneStore';
const UserStore = Reflux.createStore({
listenables: UserActions,
init() {
let storage;
try {
let fromLocalStorage = localStorage.getItem('clockette');
if (fromLocalStorage) {
let arr = JSON.parse(fromLocalStorage);
if (Array.isArray(arr)) {
storage = arr;
}
else {
throw new Error('localStorage data wasn\'t readable');
}
}
else {
throw new Error('No localStorage found');
}
}
catch (e) {
storage = [];
}
this.data = Immutable.List(
storage.map((tz) => {
return TimezoneStore.getBy('zone', tz.zone).first();
})
);
},
save() {
localStorage.setItem('clockette', JSON.stringify(this.data.toArray()));
this.trigger(this.data);
},
onAdd(zone) {
this.data = this.data.push(zone);
this.save();
},
onRemove(zone) {
this.data = this.data.delete(this.data.indexOf(zone));
this.save();
},
});
export default UserStore;
| Fix onAdd method to match Immutable.List interface | Fix onAdd method to match Immutable.List interface
| JSX | mit | rhumlover/clockette,rhumlover/clockette | ---
+++
@@ -46,7 +46,7 @@
},
onAdd(zone) {
- this.data = this.data.add(zone);
+ this.data = this.data.push(zone);
this.save();
},
|
0a161f6acb3b5bc6a4f65b38817218409365b0c2 | frontend/learning-circle-feedback.jsx | frontend/learning-circle-feedback.jsx | import React from 'react'
import ReactDOM from 'react-dom'
import MeetingFeedback from './components/meeting-feedback'
import LearningCircleFeedbackForm from './components/learning-circle-feedback-form'
import CourseFeedbackForm from './components/course-feedback-form'
import 'components/stylesheets/learning-circle-feedback.scss'
// Replace feedback form for earch meeting
const elements = document.getElementsByClassName('meeting-feedback-form');
for (let el of elements){
ReactDOM.render(<MeetingFeedback {...el.dataset} />, el);
}
// Replace feedback form for learning circle
const element = document.getElementById('learning-circle-feedback-form');
ReactDOM.render(<LearningCircleFeedbackForm {...element.dataset} />, element);
let courseFeedbackDiv = document.getElementById('course-feedback-form');
ReactDOM.render(
<CourseFeedbackForm {...courseFeedbackDiv.dataset} />,
courseFeedbackDiv
);
| import React from 'react'
import ReactDOM from 'react-dom'
import MeetingFeedback from './components/meeting-feedback'
import LearningCircleFeedbackForm from './components/learning-circle-feedback-form'
import CourseFeedbackForm from './components/course-feedback-form'
import 'components/stylesheets/learning-circle-feedback.scss'
// Replace feedback form for earch meeting
const elements = document.getElementsByClassName('meeting-feedback-form');
for (let el of elements){
ReactDOM.render(<MeetingFeedback {...el.dataset} />, el);
}
// Replace feedback form for learning circle
const element = document.getElementById('learning-circle-feedback-form');
if (element) {
ReactDOM.render(<LearningCircleFeedbackForm {...element.dataset} />, element);
}
let courseFeedbackDiv = document.getElementById('course-feedback-form');
ReactDOM.render(
<CourseFeedbackForm {...courseFeedbackDiv.dataset} />,
courseFeedbackDiv
);
| Check if learning circle feedback element exists | Check if learning circle feedback element exists
| JSX | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -15,7 +15,9 @@
// Replace feedback form for learning circle
const element = document.getElementById('learning-circle-feedback-form');
-ReactDOM.render(<LearningCircleFeedbackForm {...element.dataset} />, element);
+if (element) {
+ ReactDOM.render(<LearningCircleFeedbackForm {...element.dataset} />, element);
+}
let courseFeedbackDiv = document.getElementById('course-feedback-form');
ReactDOM.render( |
afd684c38202b4242c1170cb0fbe26f6965f8ad8 | web/static/js/components/category_column.jsx | web/static/js/components/category_column.jsx | import React from "react"
import styles from "./css_modules/category_column.css"
function CategoryColumn(props) {
const categoryToEmoticonUnicodeMap = {
happy: "π",
sad: "π₯",
confused: "π",
"action-item": "π",
}
const emoticonUnicode = categoryToEmoticonUnicodeMap[props.category]
const filteredIdeas = props.ideas.filter(idea => idea.category === props.category)
const filteredIdeasList = filteredIdeas.map(idea =>
<li className="item" key={`${idea.body}`}>{idea.body}</li>,
)
return (
<section className="column">
<div className="ui center aligned basic segment">
<i className={styles.icon}>{emoticonUnicode}</i>
<p><a>@{props.category}</a></p>
</div>
<div className="ui divider" />
<ul className={`${props.category} ideas ui divided list`}>
{filteredIdeasList}
</ul>
</section>
)
}
CategoryColumn.propTypes = {
ideas: React.PropTypes.arrayOf(
React.PropTypes.shape({
category: React.PropTypes.string,
body: React.PropTypes.string,
}),
).isRequired,
category: React.PropTypes.string.isRequired,
}
export default CategoryColumn
| import React from "react"
import styles from "./css_modules/category_column.css"
function CategoryColumn(props) {
const categoryToEmoticonUnicodeMap = {
happy: "π",
sad: "π₯",
confused: "π",
"action-item": "π",
}
const emoticonUnicode = categoryToEmoticonUnicodeMap[props.category]
const filteredIdeas = props.ideas.filter(idea => idea.category === props.category)
const filteredIdeasList = filteredIdeas.map(idea =>
<li className="item" title={idea.body} key={`${idea.body}`}>{idea.body}</li>,
)
return (
<section className="column">
<div className="ui center aligned basic segment">
<i className={styles.icon}>{emoticonUnicode}</i>
<p><a>@{props.category}</a></p>
</div>
<div className="ui divider" />
<ul className={`${props.category} ideas ui divided list`}>
{filteredIdeasList}
</ul>
</section>
)
}
CategoryColumn.propTypes = {
ideas: React.PropTypes.arrayOf(
React.PropTypes.shape({
category: React.PropTypes.string,
body: React.PropTypes.string,
}),
).isRequired,
category: React.PropTypes.string.isRequired,
}
export default CategoryColumn
| Add attribute to idea list items | Add attribute to idea list items
- reveals full text on hover
| JSX | mit | stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro,samdec11/remote_retro,tnewell5/remote_retro,tnewell5/remote_retro | ---
+++
@@ -12,7 +12,7 @@
const emoticonUnicode = categoryToEmoticonUnicodeMap[props.category]
const filteredIdeas = props.ideas.filter(idea => idea.category === props.category)
const filteredIdeasList = filteredIdeas.map(idea =>
- <li className="item" key={`${idea.body}`}>{idea.body}</li>,
+ <li className="item" title={idea.body} key={`${idea.body}`}>{idea.body}</li>,
)
return ( |
8c193c9a84dc6982028a540d894114d3693d1bec | src/components/Results.jsx | src/components/Results.jsx | import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Winner from './Winner';
import Tally from './Tally';
export const VOTE_WIDTH_PERCENT = 8;
export default React.createClass({
displayName: 'Results',
propTypes: {
next: React.PropTypes.func,
pair: React.PropTypes.any,
tally: React.PropTypes.any,
winner: React.PropTypes.string,
},
mixins: [PureRenderMixin],
render() {
return this.props.winner ?
<Winner ref='winner' winner={this.props.winner} /> :
<div className='results'>
<Tally {...this.props} />
<div className='management'>
<button ref='next'
className='next'
onClick={this.props.next}>
Next
</button>
</div>
</div>;
},
});
| import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import Winner from './Winner';
import Tally from './Tally';
export const VOTE_WIDTH_PERCENT = 8;
export default React.createClass({
displayName: 'Results',
propTypes: {
next: React.PropTypes.func,
pair: React.PropTypes.any,
tally: React.PropTypes.any,
winner: React.PropTypes.string,
},
mixins: [PureRenderMixin],
render() {
return this.props.winner ?
<Winner ref='winner' winner={this.props.winner} /> :
<div className='results'>
<Tally {...this.props} />
<div className='management'>
<button ref='next'
className='next'
onClick={this.props.next}>
Next
</button>
</div>
</div>;
},
});
| Remove no longer used ImmutablePropTypes | Remove no longer used ImmutablePropTypes
| JSX | apache-2.0 | rgbkrk/voting-client,rgbkrk/voting-client | ---
+++
@@ -1,6 +1,5 @@
import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';
-import ImmutablePropTypes from 'react-immutable-proptypes';
import Winner from './Winner';
import Tally from './Tally'; |
fea5eb0f1601ad05b2925eb0b14c46196881dc87 | js/landing.jsx | js/landing.jsx | const React = require('react')
const Landing = () => (
<div className='app-container'>
<div className='home-info'>
<h1 className='title'>svideo</h1>
<input className='search' type='text' placeholder='search' />
<button className='browse-all'> or Browse All</button>
</div>
</div>
)
module.exports = Landing | const React = require('react')
const { Link } = require('react-router')
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 | Set up search route link | Set up search route link
| JSX | mit | michaeldumalag/ReactSelfLearning,michaeldumalag/ReactSelfLearning | ---
+++
@@ -1,11 +1,12 @@
const React = require('react')
+const { Link } = require('react-router')
const Landing = () => (
<div className='app-container'>
<div className='home-info'>
<h1 className='title'>svideo</h1>
<input className='search' type='text' placeholder='search' />
- <button className='browse-all'> or Browse All</button>
+ <Link to='/search' className='browse-all'> or Browse All</Link>
</div>
</div>
) |
5631da38e59ca6c9ba6113564630d001f8100275 | app/js/home/components/Hero.jsx | app/js/home/components/Hero.jsx | import React from 'react';
import SmoothImageDiv from 'common/components/SmoothImageDiv';
import LabImg from 'img/betterLab.jpg';
import RapDevImg from 'img/rapdev.jpg';
class Hero extends React.Component {
constructor(props) {
super(props);
this.state = {
img1Loaded: false,
img2Loaded: false,
};
}
handleImageLoad = (key) => {
this.setState({
[key]: true,
});
}
render() {
const allLoaded = (this.state.img1Loaded && this.state.img2Loaded);
return (
<div className="hero">
<SmoothImageDiv
className="hero-img left"
imageUrl={LabImg}
delayMs={1200}
forceLoad={allLoaded}
onLoad={() => this.handleImageLoad('img1Loaded')}
/>
<div className="hero-content-container">
<div className="fancy-hero-container" />
<div className="hero-content">
<h3>Weekly Meetings</h3>
<h6>Thursdays @ 4:00pm</h6>
<h6>GOL-1670</h6>
<h6>All Are Welcome!</h6>
</div>
</div>
<SmoothImageDiv
className="hero-img right"
imageUrl={RapDevImg}
delayMs={1200}
forceLoad={allLoaded}
onLoad={() => this.handleImageLoad('img2Loaded')}
/>
</div>
);
}
}
export default Hero;
| import React from 'react';
import SmoothImageDiv from 'common/components/SmoothImageDiv';
import LabImg from 'img/betterLab.jpg';
import RapDevImg from 'img/rapdev.jpg';
class Hero extends React.Component {
constructor(props) {
super(props);
this.state = {
img1Loaded: false,
img2Loaded: false,
};
}
handleImageLoad = (key) => {
this.setState({
[key]: true,
});
}
render() {
const allLoaded = (this.state.img1Loaded && this.state.img2Loaded);
return (
<div className="hero">
<SmoothImageDiv
className="hero-img left"
imageUrl={LabImg}
delayMs={1200}
forceLoad={allLoaded}
onLoad={() => this.handleImageLoad('img1Loaded')}
/>
<div className="hero-content-container">
<div className="fancy-hero-container" />
<div className="hero-content">
<h3>Weekly Meetings</h3>
<h6>Mondays @ 4:30pm</h6>
<h6>GOL-1670</h6>
<h6>All Are Welcome!</h6>
</div>
</div>
<SmoothImageDiv
className="hero-img right"
imageUrl={RapDevImg}
delayMs={1200}
forceLoad={allLoaded}
onLoad={() => this.handleImageLoad('img2Loaded')}
/>
</div>
);
}
}
export default Hero;
| Update meeting times for this semester | Update meeting times for this semester
| JSX | mit | rit-sse/OneRepoToRuleThemAll | ---
+++
@@ -33,7 +33,7 @@
<div className="fancy-hero-container" />
<div className="hero-content">
<h3>Weekly Meetings</h3>
- <h6>Thursdays @ 4:00pm</h6>
+ <h6>Mondays @ 4:30pm</h6>
<h6>GOL-1670</h6>
<h6>All Are Welcome!</h6>
</div> |
c7242c95559639d5ad85cfa225dfb8533c1cd1a1 | importJsonData/importJsonData.jsx | importJsonData/importJsonData.jsx | // Import JSON Data into Illustrator
// #include "json2.js"
// Returns the layer with the given name
function getLayerNamed(doc, nameOfTheLayer) {
// Only search the document if it is given
if ( doc != undefined ) {
// Get the layer with the given name
var layers = doc.layers;
if ( layers.length > 0 ) {
for (var i = 0; i < layers.length; i++) {
var layer = layers[i];
if ( layer.name == nameOfTheLayer ) {
return layer;
}
}
}
}
return null;
}
// Get the active document
if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
var textLayer = getLayerNamed(doc, "TextLayer");
// Print all texts in the textLayer
var textObjects = textLayer.textFrames;
if ( textObjects.length > 0 ) {
for (var i = 0; i < textObjects.length; i++) {
var textObj = textObjects[i];
$.writeln(textObj.contents);
textObj.contents = "New text" + i.toString();
}
}
} | // Import JSON Data into Illustrator
// #include "json2.js"
// Returns the layer with the given name
function getLayerNamed(doc, nameOfTheLayer) {
// Only search the document if it is given
if ( doc != undefined ) {
// Get the layer with the given name
var layers = doc.layers;
if ( layers.length > 0 ) {
for (var i = 0; i < layers.length; i++) {
var layer = layers[i];
if ( layer.name == nameOfTheLayer ) {
return layer;
}
}
}
}
return null;
}
// Get the active document
if ( app.documents.length > 0 ) {
var doc = app.activeDocument;
var textLayer = getLayerNamed(doc, "TextLayer");
// Print all texts in the textLayer
var textObjects = textLayer.textFrames;
if ( textObjects.length > 0 ) {
for (var i = 0; i < textObjects.length; i++) {
var textObj = textObjects[textObjects.length - (i + 1)];
$.writeln(textObj.contents);
textObj.contents = "New text" + i.toString();
}
}
} | Change the order of the text modifications | Change the order of the text modifications
| JSX | mit | ArtezGDA/illustratorMoutains,ArtezGDA/illustratorPlugin-Examples | ---
+++
@@ -33,7 +33,7 @@
var textObjects = textLayer.textFrames;
if ( textObjects.length > 0 ) {
for (var i = 0; i < textObjects.length; i++) {
- var textObj = textObjects[i];
+ var textObj = textObjects[textObjects.length - (i + 1)];
$.writeln(textObj.contents);
textObj.contents = "New text" + i.toString(); |
5040fd2e519799695b3444ba62405f233348eb08 | components/icon-settings/__docs__/storybook-stories.jsx | components/icon-settings/__docs__/storybook-stories.jsx | import React from 'react';
import { storiesOf } from '@storybook/react';
import { ICON_SETTINGS } from '../../../utilities/constants';
import Sprite from '../__examples__/sprite';
import IconPath from '../__examples__/icon-path';
import OnRequestIconPath from '../__examples__/on-request-icon-path';
storiesOf(ICON_SETTINGS, module)
.addDecorator((getStory) => (
<div className="slds-p-around_medium">{getStory()}</div>
))
.add('Base: Icon path', () => <IconPath />)
.add('Base: Sprite imports RemoveTest', () => <Sprite />)
.add('Base: OnRequestIconPath RemoveTest', () => <OnRequestIconPath />);
| import React from 'react';
import { storiesOf } from '@storybook/react';
import { ICON_SETTINGS } from '../../../utilities/constants';
import Sprite from '../__examples__/sprite';
import IconPath from '../__examples__/icon-path';
import OnRequestIconPath from '../__examples__/on-request-icon-path';
storiesOf(ICON_SETTINGS, module)
.addDecorator((getStory) => (
<div className="slds-p-around_medium">{getStory()}</div>
))
.add('Base: Icon path', () => <IconPath />)
.add('Base: Sprite imports NoTest', () => <Sprite />)
.add('Base: OnRequestIconPath NoTest', () => <OnRequestIconPath />);
| Remove IconSettings sprite Example from Snapshot tests | Remove IconSettings sprite Example from Snapshot tests
| JSX | bsd-3-clause | salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react | ---
+++
@@ -12,5 +12,5 @@
<div className="slds-p-around_medium">{getStory()}</div>
))
.add('Base: Icon path', () => <IconPath />)
- .add('Base: Sprite imports RemoveTest', () => <Sprite />)
- .add('Base: OnRequestIconPath RemoveTest', () => <OnRequestIconPath />);
+ .add('Base: Sprite imports NoTest', () => <Sprite />)
+ .add('Base: OnRequestIconPath NoTest', () => <OnRequestIconPath />); |
554a4dae5e916fc9e717dafa092973e6bd38e499 | src/client/index.jsx | src/client/index.jsx | import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import '../styles/index'
import App from './containers/App';
import configureStore from './store';
import { loadState, saveState } from './store/localStorage';
const isProd = process.env.NODE_ENV === "production"
const preloadedState = isProd ? loadState() : undefined;
const store = configureStore(preloadedState);
// Saves changes to localstorage
store.subscribe( () => {
saveState(store.getState());
})
// Enable checking the store start at any point
window.storeState = store.getState();
console.info('Initial store:', store.getState());
ReactDOM.render(
<Provider store={store}>
<App/>
</Provider>,
document.querySelector('#App')
); | import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import '../styles/index'
import App from './containers/App';
import configureStore from './store';
import { loadState, saveState } from './store/localStorage';
const isProd = process.env.NODE_ENV === "production"
const preloadedState = isProd ? loadState() : undefined;
const store = configureStore(preloadedState);
// Save changes to localstorage
store.subscribe( () => {
saveState(store.getState());
})
// Enable checking the store at any point
if (!isProd) window.storeState = store.getState;
console.info('Initial store:', store.getState());
ReactDOM.render(
<Provider store={store}>
<App/>
</Provider>,
document.querySelector('#App')
); | Fix store result added to window instead of fn | Fix store result added to window instead of fn
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -12,13 +12,13 @@
const preloadedState = isProd ? loadState() : undefined;
const store = configureStore(preloadedState);
-// Saves changes to localstorage
+// Save changes to localstorage
store.subscribe( () => {
saveState(store.getState());
})
-// Enable checking the store start at any point
-window.storeState = store.getState();
+// Enable checking the store at any point
+if (!isProd) window.storeState = store.getState;
console.info('Initial store:', store.getState());
ReactDOM.render( |
378b53dfe568be4c700e832add83f4d95ab55625 | src/js/gui/dialogs/addLayerDialog.jsx | src/js/gui/dialogs/addLayerDialog.jsx | import React from "react";
import { Button, TextInput } from "../guiComponents.jsx";
import PubSub from "../../event/pubSub.js";
import Events from "../../event/events.js";
export default class AddLayerDialog extends React.Component {
constructor(props) {
super(props);
this.state = { layerNameText: "New Layer" };
}
success(e) {
if (typeof e != "undefined") e.preventDefault();
PubSub.publish(Events.ADD_LAYER, this.state.layerNameText);
this.props.close();
}
abort() {
this.props.close();
}
onChange(e) {
this.setState({ layerNameText: e.target.value });
}
render() {
return (
<form onSubmit={ e => { this.success(e); } }>
<h2 className="primary">Add Layer</h2>
<TextInput name="layerName" label="Layer Name"
value={ this.state.layerNameText }
onChange={ this.onChange.bind(this) } />
<div className="actionButtonContainer">
<Button onClick={ () => this.abort() } text="Cancel" />
<Button onClick={ () => this.success() } text="Add" />
</div>
</form>
);
}
}
| import React from "react";
import { Button, TextInput } from "../guiComponents.jsx";
import PubSub from "../../event/pubSub.js";
import Events from "../../event/events.js";
export default class AddLayerDialog extends React.Component {
constructor(props) {
super(props);
this.state = { layerNameText: "New Layer" };
}
success(e) {
if (typeof e != "undefined") e.preventDefault();
PubSub.publish(Events.ADD_LAYER, this.state.layerNameText);
this.props.close();
}
abort() {
this.props.close();
}
onChange(e) {
this.setState({ layerNameText: e.target.value });
}
render() {
return (
<form onSubmit={ e => { this.success(e); } }>
<h2 className="primary">Add Layer</h2>
<TextInput name="layerName" label="Layer Name"
value={ this.state.layerNameText }
onChange={ this.onChange.bind(this) } />
<div className="actionButtonContainer">
<Button onClick={ () => this.abort() } text="Cancel" />
<Button onClick={ () => this.success() } text="Add"
disabled={ this.state.layerNameText == "" } />
</div>
</form>
);
}
}
| Disable add button on add layer dialog when no name is entered | Disable add button on add layer dialog when no name is entered
| JSX | unknown | MagnonGames/DTile,MagnonGames/DTile,theMagnon/DTile,theMagnon/DTile,MagnonGames/DTile,theMagnon/DTile | ---
+++
@@ -36,7 +36,8 @@
onChange={ this.onChange.bind(this) } />
<div className="actionButtonContainer">
<Button onClick={ () => this.abort() } text="Cancel" />
- <Button onClick={ () => this.success() } text="Add" />
+ <Button onClick={ () => this.success() } text="Add"
+ disabled={ this.state.layerNameText == "" } />
</div>
</form>
); |
3191cf38d3fe11a4e9f6ad8ca0db8179d128e110 | src/apps/freetext.jsx | src/apps/freetext.jsx | import React from 'react';
import { Link } from 'react-router';
import Grid from '../components/grid.jsx';
import { drawCharacter, getBits } from '../utils/grid_helper';
import { defaultGrid } from '../utils/configuration';
class FreeText extends React.Component {
constructor() {
super();
this.state = {
text: '',
};
}
render() {
const freetext = this.state.text
.split('')
.map(character => getBits(character, defaultGrid));
return (
<div>
<h2>Free input</h2>
<p>
<label htmlFor="text">text</label>
<input onChange={() => { this.setState({ text: this.refs.text.value }); }} id="text" type="text" ref="text" defaultValue={this.state.text} />
</p>
<Grid>{freetext.map((character, index) => drawCharacter(character, index))}</Grid>
<Link to="/">Back</Link>
</div>
);
}
}
export default FreeText;
| import React from 'react';
import { Link } from 'react-router';
import Grid from '../components/grid.jsx';
import { drawCharacter, getBits } from '../utils/grid_helper';
import { defaultGrid } from '../utils/configuration';
class FreeText extends React.Component {
constructor() {
super();
this.state = {
text: '',
};
}
render() {
const freetext = this.state.text
.split('')
.map(character => getBits(character, defaultGrid));
return (
<div>
<h2>Free input</h2>
<p>
<label htmlFor="text">text</label>
<input
onChange={() => { this.setState({ text: this.refs.text.value }); }}
id="text"
type="text"
ref="text"
defaultValue={this.state.text}
autoFocus
/>
</p>
<Grid>{freetext.map((character, index) => drawCharacter(character, index))}</Grid>
<Link to="/">Back</Link>
</div>
);
}
}
export default FreeText;
| Use autofocus for better UX :D | Use autofocus for better UX :D
| JSX | mit | jonathanweiss/pixelboard,jonathanweiss/pixelboard | ---
+++
@@ -24,7 +24,14 @@
<h2>Free input</h2>
<p>
<label htmlFor="text">text</label>
- <input onChange={() => { this.setState({ text: this.refs.text.value }); }} id="text" type="text" ref="text" defaultValue={this.state.text} />
+ <input
+ onChange={() => { this.setState({ text: this.refs.text.value }); }}
+ id="text"
+ type="text"
+ ref="text"
+ defaultValue={this.state.text}
+ autoFocus
+ />
</p>
<Grid>{freetext.map((character, index) => drawCharacter(character, index))}</Grid>
|
af39a4c16e6e1a93cfb33343eefa5eca6aed204f | client/views/app.jsx | client/views/app.jsx | /** @jsx React.DOM */
define(function(require, exports, module) {
var Tracks = require("views/tracks").TrackList;
var Queue = require("views/queue").Queue;
var Albums = require("views/albums").Albums;
var Album = require("views/albums").Album;
var stateTree = require("flux/state");
var Dispatcher = require("flux/dispatcher");
var dispatcherMixin = Dispatcher.mixin(stateTree);
var App = React.createClass({
mixins: [stateTree.mixin],
cursor: ['panel'],
render: function() {
return (
<article>
<Albums/>
<Tracks/>
<Queue/>
<Album/>
</article>
);
}
});
return App;
});
| /** @jsx React.DOM */
define(function(require, exports, module) {
var Albums = require("views/albums").Albums;
var Album = require("views/albums").Album;
var Tracks = require("views/tracks").TrackList;
var Queue = require("views/queue").Queue;
var App = React.createClass({
render: function() {
return (
<article>
<Albums/>
<Tracks/>
<Queue/>
<Album/>
</article>
);
}
});
return App;
});
| Clean up the App view | Clean up the App view
| JSX | agpl-3.0 | tOkeshu/GhettoBlaster,tOkeshu/GhettoBlaster | ---
+++
@@ -1,19 +1,12 @@
/** @jsx React.DOM */
define(function(require, exports, module) {
+ var Albums = require("views/albums").Albums;
+ var Album = require("views/albums").Album;
var Tracks = require("views/tracks").TrackList;
var Queue = require("views/queue").Queue;
- var Albums = require("views/albums").Albums;
- var Album = require("views/albums").Album;
-
- var stateTree = require("flux/state");
- var Dispatcher = require("flux/dispatcher");
- var dispatcherMixin = Dispatcher.mixin(stateTree);
var App = React.createClass({
- mixins: [stateTree.mixin],
- cursor: ['panel'],
-
render: function() {
return (
<article> |
9f0ce112a2bb5c0d418a4b75407dd442aa0acdf4 | src/jsx/components/ProjectTile.jsx | src/jsx/components/ProjectTile.jsx | import React, { PropTypes } from 'react';
import { Link } from 'react-router';
export default function ProjectTile(props) {
return (
<Link to={`/projects/${props.slug}`} className='project-tile'>
<p className="project-tile__title">{props.name}</p>
<img className="project-tile__image" src={props.images[0]} />
</Link>
);
}
ProjectTile.propTypes = {
name: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
images: PropTypes.array
};
| import React, { PropTypes } from 'react';
import { Link } from 'react-router';
export default function ProjectTile(props) {
return (
<Link to={`/projects/${props.slug}`} className='project-tile'>
<h1 className="project-tile__title">{props.name}</h1>
<img className="project-tile__image" src={props.images[0]} />
</Link>
);
}
ProjectTile.propTypes = {
name: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
images: PropTypes.array
};
| Use an h1 for project tile headers | Use an h1 for project tile headers
| JSX | mit | VoxelDavid/voxeldavid-website,vocksel/my-website,VoxelDavid/voxeldavid-website,vocksel/my-website | ---
+++
@@ -4,7 +4,7 @@
export default function ProjectTile(props) {
return (
<Link to={`/projects/${props.slug}`} className='project-tile'>
- <p className="project-tile__title">{props.name}</p>
+ <h1 className="project-tile__title">{props.name}</h1>
<img className="project-tile__image" src={props.images[0]} />
</Link>
); |
87a80d01e31aacf3a19ce9d1e837ec03f96f01dd | public/jsx/revonarchy.jsx | public/jsx/revonarchy.jsx | var Application = React.createClass({
getInitialState: function() {
return {
content: []
};
},
render: function() {
var PageHeader = ReactBootstrap.PageHeader;
return (
<div className="container">
<PageHeader>Revonarchy <small>Who will rule this day?</small></PageHeader>
</div>
);
}
});
$(document).ready(function() {
React.render(<Application />, document.body);
});
| var Application = function() {
var CreateUser = React.createClass({
render: function() {
var Input = ReactBootstrap.Input;
return (
<form>
<Input
type='text'
placeholder='Enter email'
label='Email Address'
value={this.props.userEmail}
ref='userEmailTextInput'
/>
<Input
type='text'
placeholder='Enter Nickname'
label='Nickname'
value={this.props.userNickname}
ref='userNicknameInput'
/>
<Input type='submit' value='Create User' />
</form>
);
}
});
var Application = React.createClass({
getInitialState: function() {
return {
content: []
};
},
render: function() {
var PageHeader = ReactBootstrap.PageHeader;
return (
<div className='container'>
<PageHeader>Revonarchy <small>Who will rule this day?</small></PageHeader>
<CreateUser userEmail={''} userNickname={''} />
</div>
);
}
});
return Application;
}();
$(document).ready(function() {
React.render(<Application />, document.body);
});
| Add a static version of create user form. | Add a static version of create user form.
| JSX | mit | coltonw/revonarchy,coltonw/revonarchy,coltonw/revonarchy | ---
+++
@@ -1,19 +1,51 @@
-var Application = React.createClass({
- getInitialState: function() {
- return {
- content: []
- };
- },
+var Application = function() {
- render: function() {
- var PageHeader = ReactBootstrap.PageHeader;
- return (
- <div className="container">
- <PageHeader>Revonarchy <small>Who will rule this day?</small></PageHeader>
- </div>
- );
- }
+ var CreateUser = React.createClass({
+ render: function() {
+ var Input = ReactBootstrap.Input;
+ return (
+ <form>
+ <Input
+ type='text'
+ placeholder='Enter email'
+ label='Email Address'
+ value={this.props.userEmail}
+ ref='userEmailTextInput'
+ />
+ <Input
+ type='text'
+ placeholder='Enter Nickname'
+ label='Nickname'
+ value={this.props.userNickname}
+ ref='userNicknameInput'
+ />
+ <Input type='submit' value='Create User' />
+ </form>
+ );
+ }
});
+
+
+ var Application = React.createClass({
+ getInitialState: function() {
+ return {
+ content: []
+ };
+ },
+
+ render: function() {
+ var PageHeader = ReactBootstrap.PageHeader;
+ return (
+ <div className='container'>
+ <PageHeader>Revonarchy <small>Who will rule this day?</small></PageHeader>
+ <CreateUser userEmail={''} userNickname={''} />
+ </div>
+ );
+ }
+ });
+
+ return Application;
+}();
$(document).ready(function() {
React.render(<Application />, document.body); |
9c06d404b72b66894efaefd88e81fc67818dfc78 | example/public/routes.jsx | example/public/routes.jsx | /*-------------------------------------------------------------------------------------------------------------------*\
| Copyright (C) 2016 PayPal |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance |
| with the License. |
| |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed |
| on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| the specific language governing permissions and limitations under the License. |
\*-------------------------------------------------------------------------------------------------------------------*/
'use strict';
import React from 'react';
import { Router, Route, IndexRoute, Redirect } from 'react-router';
import Layout from './views/layout.jsx';
import ListPage from './views/list.jsx';
import DetailPage from './views/detail.jsx';
var routes = module.exports = (
<Router>
<Route path='/' component={Layout}>
<IndexRoute component={ListPage} />
<Route path='/movie/:id' component={DetailPage} />
<Redirect from='/gohome' to='/' />
</Route>
</Router>
);
| /*-------------------------------------------------------------------------------------------------------------------*\
| Copyright (C) 2016 PayPal |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance |
| with the License. |
| |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed |
| on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| the specific language governing permissions and limitations under the License. |
\*-------------------------------------------------------------------------------------------------------------------*/
'use strict';
import React from 'react';
import { Router, Route, IndexRoute, Redirect, browserHistory } from 'react-router';
import Layout from './views/layout.jsx';
import ListPage from './views/list.jsx';
import DetailPage from './views/detail.jsx';
import Error404 from './views/404.jsx';
module.exports = (
<Router history={browserHistory}>
<Route path='/' component={Layout}>
<IndexRoute component={ListPage} />
<Route path='/movie/:id' component={DetailPage} />
<Redirect from='/gohome' to='/' />
</Route>
</Router>
);
| Use react-router `browserHistory` in example | Use react-router `browserHistory` in example
| JSX | apache-2.0 | vuhwang/react-engine,paypal/react-engine,samsel/react-engine | ---
+++
@@ -16,14 +16,15 @@
'use strict';
import React from 'react';
-import { Router, Route, IndexRoute, Redirect } from 'react-router';
+import { Router, Route, IndexRoute, Redirect, browserHistory } from 'react-router';
import Layout from './views/layout.jsx';
import ListPage from './views/list.jsx';
import DetailPage from './views/detail.jsx';
+import Error404 from './views/404.jsx';
-var routes = module.exports = (
- <Router>
+module.exports = (
+ <Router history={browserHistory}>
<Route path='/' component={Layout}>
<IndexRoute component={ListPage} />
<Route path='/movie/:id' component={DetailPage} /> |
3cb29bcca5830d6d356a470ac6a944265894deca | components/input/__examples__/inactiveInputs.jsx | components/input/__examples__/inactiveInputs.jsx | import React from 'react';
import IconSettings from '~/components/icon-settings';
import Input from '~/components/input'; // `~` is replaced with design-system-react at runtime
class Example extends React.Component {
static displayName = 'InactiveInputExamples';
render() {
return (
<IconSettings iconPath="/assets/icons">
<section className="slds-grid slds-grid_pull-padded slds-grid_vertical-align-center">
<div className="slds-col_padded">
<h1 className="slds-text-title_caps slds-p-vertical_medium">
Disabled Input
</h1>
<Input
id="disabled-input-id"
label="My Label"
disabled
value="Disabled value"
/>
</div>
<div className="slds-col_padded">
<h1 className="slds-text-title_caps slds-p-vertical_medium">
ReadOnly Input
</h1>
<Input
id="unique-id-3"
label="Input Label"
readOnly
value="Read Only Value"
/>
</div>
<div className="slds-col_padded">
<h1 className="slds-text-title_caps slds-p-vertical_medium">
Static Input
</h1>
<Input
id="unique-id-3"
label="Input Label"
isStatic
value="Read Only Value"
/>
</div>
</section>
</IconSettings>
);
}
}
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
| import React from 'react';
import IconSettings from '~/components/icon-settings';
import Input from '~/components/input'; // `~` is replaced with design-system-react at runtime
class Example extends React.Component {
static displayName = 'InactiveInputExamples';
render() {
return (
<IconSettings iconPath="/assets/icons">
<section className="slds-grid slds-grid_pull-padded slds-grid_vertical-align-center">
<div className="slds-col_padded">
<h1 className="slds-text-title_caps slds-p-vertical_medium">
Disabled Input
</h1>
<Input
id="disabled-input-id"
label="My Label"
disabled
value="Disabled value"
/>
</div>
<div className="slds-col_padded">
<h1 className="slds-text-title_caps slds-p-vertical_medium">
ReadOnly Input
</h1>
<Input
id="unique-id-3"
label="Input Label"
readOnly
value="Read Only Value"
/>
</div>
</section>
</IconSettings>
);
}
}
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
| Remove static input example from doc site | Remove static input example from doc site
| JSX | bsd-3-clause | salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react | ---
+++
@@ -32,17 +32,6 @@
value="Read Only Value"
/>
</div>
- <div className="slds-col_padded">
- <h1 className="slds-text-title_caps slds-p-vertical_medium">
- Static Input
- </h1>
- <Input
- id="unique-id-3"
- label="Input Label"
- isStatic
- value="Read Only Value"
- />
- </div>
</section>
</IconSettings>
); |
406601b246a468f1d21677bde28b8ecc6a3970eb | client/app.jsx | client/app.jsx | import React from 'react'
import Immutable from 'immutable'
import { applyMiddleware, createStore, combineReducers, compose } from 'redux'
import thunk from 'redux-thunk'
import promise from 'redux-promise'
import { reduxReactRouter, ReduxRouter } from 'redux-router'
import { batchedUpdatesMiddleware } from './dom/batched-updates'
import { Provider } from 'react-redux'
import { createHistory } from 'history'
import routes from './routes.jsx'
import * as reducers from './reducers'
import { registerDispatch } from './dispatch-registry'
const initData = window._sbInitData
if (initData && initData.auth) {
initData.auth = Immutable.fromJS(initData.auth)
}
const topLevelReducer = combineReducers(reducers)
const createMiddlewaredStore = compose(
applyMiddleware(thunk, promise, batchedUpdatesMiddleware),
reduxReactRouter({ routes, createHistory })
)(createStore)
const store = createMiddlewaredStore(topLevelReducer, window._sbInitData)
registerDispatch(store.dispatch)
import './network/socket-handlers'
if (module.hot) {
module.hot.accept('./reducers', () => {
const nextRootReducer = require('./reducers')
store.replaceReducer(nextRootReducer)
})
}
export default class App extends React.Component {
render() {
return <Provider store={store}><ReduxRouter routes={routes}/></Provider>
}
}
| import React from 'react'
import Immutable from 'immutable'
import { applyMiddleware, createStore, combineReducers, compose } from 'redux'
import thunk from 'redux-thunk'
import promise from 'redux-promise'
import { reduxReactRouter, ReduxRouter } from 'redux-router'
import { batchedUpdatesMiddleware } from './dom/batched-updates'
import { Provider } from 'react-redux'
import { createHistory } from 'history'
import routes from './routes.jsx'
import * as reducers from './reducers'
import { registerDispatch } from './dispatch-registry'
const initData = window._sbInitData
if (initData && initData.auth) {
initData.auth = Immutable.fromJS(initData.auth)
}
const isDev = (process.env.NODE_ENV || 'development') === 'development'
const topLevelReducer = combineReducers(reducers)
const createMiddlewaredStore = compose(
applyMiddleware(thunk, promise, batchedUpdatesMiddleware),
reduxReactRouter({ routes, createHistory }),
// Support for https://github.com/zalmoxisus/redux-devtools-extension
isDev && window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore)
const store = createMiddlewaredStore(topLevelReducer, window._sbInitData)
registerDispatch(store.dispatch)
import './network/socket-handlers'
if (module.hot) {
module.hot.accept('./reducers', () => {
const nextRootReducer = require('./reducers')
store.replaceReducer(nextRootReducer)
})
}
export default class App extends React.Component {
render() {
return <Provider store={store}><ReduxRouter routes={routes}/></Provider>
}
}
| Add support for chrome extensionified redux dev tools. | Add support for chrome extensionified redux dev tools.
| JSX | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery | ---
+++
@@ -16,10 +16,13 @@
initData.auth = Immutable.fromJS(initData.auth)
}
+const isDev = (process.env.NODE_ENV || 'development') === 'development'
const topLevelReducer = combineReducers(reducers)
const createMiddlewaredStore = compose(
applyMiddleware(thunk, promise, batchedUpdatesMiddleware),
- reduxReactRouter({ routes, createHistory })
+ reduxReactRouter({ routes, createHistory }),
+ // Support for https://github.com/zalmoxisus/redux-devtools-extension
+ isDev && window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore)
const store = createMiddlewaredStore(topLevelReducer, window._sbInitData)
registerDispatch(store.dispatch) |
068ccc6df7eabe1f5d6760038b3b132b89ac1ea2 | SingularityUI/app/components/common/statelessComponents.jsx | SingularityUI/app/components/common/statelessComponents.jsx | import React, { PropTypes } from 'react';
import { Panel, ProgressBar } from 'react-bootstrap';
export const DeployState = (props) => {
return (
<span className="deploy-state" data-state={props.state || 'PENDING'}>
{props.state}
</span>
);
};
DeployState.propTypes = {
state: PropTypes.string
};
export const InfoBox = (props) => {
return (
<li className="col-sm-6 col-md-3">
<div>
<h4>{props.name}<a className={props.copyableClassName} data-clipboard-text={props.value}>Copy</a></h4>
<p>{props.value}</p>
</div>
</li>
);
};
InfoBox.propTypes = {
name: PropTypes.string,
copyableClassName: PropTypes.string,
value: PropTypes.string
};
export const UsageInfo = (props) => {
return (
<Panel header={props.title}>
<ProgressBar active={true} bsStyle={props.style} max={props.total} now={props.used} />
<span>{props.text}</span>
</Panel>
);
};
UsageInfo.propTypes = {
title: PropTypes.string,
style: PropTypes.string,
total: PropTypes.number,
used: PropTypes.number,
text: PropTypes.string
};
| import React, { PropTypes } from 'react';
import { Panel, ProgressBar } from 'react-bootstrap';
import classNames from 'classnames';
export const DeployState = (props) => {
return (
<span className="deploy-state" data-state={props.state || 'PENDING'}>
{props.state}
</span>
);
};
DeployState.propTypes = {
state: PropTypes.string
};
export const InfoBox = (props) => {
return (
<li className="col-sm-6 col-md-3">
<div>
<h4>{props.name}<a className={classNames(props.copyableClassName, 'copy-btn')} data-clipboard-text={props.value}>Copy</a></h4>
<p>{props.value}</p>
</div>
</li>
);
};
InfoBox.propTypes = {
name: PropTypes.string,
copyableClassName: PropTypes.string,
value: PropTypes.string
};
export const UsageInfo = (props) => {
return (
<Panel header={props.title}>
<ProgressBar active={true} bsStyle={props.style} max={props.total} now={props.used} />
<span>{props.text}</span>
</Panel>
);
};
UsageInfo.propTypes = {
title: PropTypes.string,
style: PropTypes.string,
total: PropTypes.number,
used: PropTypes.number,
text: PropTypes.string
};
| Fix copy button in InfoBox component | Fix copy button in InfoBox component
| JSX | apache-2.0 | andrhamm/Singularity,HubSpot/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,HubSpot/Singularity,andrhamm/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity,HubSpot/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity,hs-jenkins-bot/Singularity,hs-jenkins-bot/Singularity,andrhamm/Singularity | ---
+++
@@ -1,5 +1,6 @@
import React, { PropTypes } from 'react';
import { Panel, ProgressBar } from 'react-bootstrap';
+import classNames from 'classnames';
export const DeployState = (props) => {
return (
@@ -17,7 +18,7 @@
return (
<li className="col-sm-6 col-md-3">
<div>
- <h4>{props.name}<a className={props.copyableClassName} data-clipboard-text={props.value}>Copy</a></h4>
+ <h4>{props.name}<a className={classNames(props.copyableClassName, 'copy-btn')} data-clipboard-text={props.value}>Copy</a></h4>
<p>{props.value}</p>
</div>
</li> |
1b4b50b09a8ae03298786fb26a404ca144743d07 | src/components/delete-button/delete-button.jsx | src/components/delete-button/delete-button.jsx | import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import styles from './delete-button.css';
import deleteIcon from './icon--delete.svg';
const DeleteButton = props => (
<div
aria-label="Delete"
className={classNames(
styles.deleteButton,
props.className
)}
role="button"
tabIndex={props.tabIndex}
onClick={props.onClick}
>
<div className={styles.deleteButtonVisible}>
<img
className={styles.deleteIcon}
draggable={false}
src={deleteIcon}
/>
</div>
</div>
);
DeleteButton.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func.isRequired,
tabIndex: PropTypes.number
};
DeleteButton.defaultProps = {
tabIndex: 0
};
export default DeleteButton;
| import PropTypes from 'prop-types';
import React from 'react';
import bindAll from 'lodash.bindall';
import classNames from 'classnames';
import styles from './delete-button.css';
import deleteIcon from './icon--delete.svg';
class DeleteButton extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleKeyPress',
'setRef'
]);
}
componentDidMount () {
document.addEventListener('keydown', this.handleKeyPress);
}
componentWillUnmount () {
document.removeEventListener('keydown', this.handleKeyPress);
}
setRef (ref) {
this.ref = ref;
}
handleKeyPress (event) {
if (this.ref === event.currentTarget.activeElement && (event.key === 'Enter' || event.key === ' ')) {
this.props.onClick(event);
event.preventDefault();
}
}
render () {
return (
<div
aria-label="Delete"
className={classNames(
styles.deleteButton,
this.props.className
)}
ref={this.setRef}
role="button"
tabIndex={this.props.tabIndex}
onClick={this.props.onClick}
>
<div className={styles.deleteButtonVisible}>
<img
className={styles.deleteIcon}
draggable={false}
src={deleteIcon}
/>
</div>
</div>
);
}
}
DeleteButton.propTypes = {
className: PropTypes.string,
onClick: PropTypes.func.isRequired,
tabIndex: PropTypes.number
};
DeleteButton.defaultProps = {
tabIndex: 0
};
export default DeleteButton;
| Make space and enter actually work if focused | Make space and enter actually work if focused
If the delete button is the current active element (e.g. focused by tab) make hitting βspaceβ or βEnterβ do the actual delete.
| JSX | bsd-3-clause | LLK/scratch-gui,LLK/scratch-gui | ---
+++
@@ -1,31 +1,58 @@
import PropTypes from 'prop-types';
import React from 'react';
+import bindAll from 'lodash.bindall';
import classNames from 'classnames';
import styles from './delete-button.css';
import deleteIcon from './icon--delete.svg';
-const DeleteButton = props => (
- <div
- aria-label="Delete"
- className={classNames(
- styles.deleteButton,
- props.className
- )}
- role="button"
- tabIndex={props.tabIndex}
- onClick={props.onClick}
- >
- <div className={styles.deleteButtonVisible}>
- <img
- className={styles.deleteIcon}
- draggable={false}
- src={deleteIcon}
- />
- </div>
- </div>
-
-);
+class DeleteButton extends React.Component {
+ constructor (props) {
+ super(props);
+ bindAll(this, [
+ 'handleKeyPress',
+ 'setRef'
+ ]);
+ }
+ componentDidMount () {
+ document.addEventListener('keydown', this.handleKeyPress);
+ }
+ componentWillUnmount () {
+ document.removeEventListener('keydown', this.handleKeyPress);
+ }
+ setRef (ref) {
+ this.ref = ref;
+ }
+ handleKeyPress (event) {
+ if (this.ref === event.currentTarget.activeElement && (event.key === 'Enter' || event.key === ' ')) {
+ this.props.onClick(event);
+ event.preventDefault();
+ }
+ }
+ render () {
+ return (
+ <div
+ aria-label="Delete"
+ className={classNames(
+ styles.deleteButton,
+ this.props.className
+ )}
+ ref={this.setRef}
+ role="button"
+ tabIndex={this.props.tabIndex}
+ onClick={this.props.onClick}
+ >
+ <div className={styles.deleteButtonVisible}>
+ <img
+ className={styles.deleteIcon}
+ draggable={false}
+ src={deleteIcon}
+ />
+ </div>
+ </div>
+ );
+ }
+}
DeleteButton.propTypes = {
className: PropTypes.string, |
9da05855f0946436c3ae895e19a9ced2056fa237 | webapp/src/components/molecules/highcharts/BubbleMapChart.jsx | webapp/src/components/molecules/highcharts/BubbleMapChart.jsx | import React from 'react'
import HighChart from 'components/molecules/highcharts/HighChart'
import palettes from 'utilities/palettes'
import format from 'utilities/format'
class BubbleMap extends HighChart {
setConfig = function () {
this.config = {
legend: {
enabled: false
},
series: this.setSeries(),
mapNavigation: {
enabled: false,
enableTouchZoom: false,
enableDoubleClickZoom: false,
enableMouseWheelZoom: false,
enableButtons: false
}
}
}
setSeries = function () {
const props = this.props
const current_indicator = this.props.selected_indicators[0]
return [{
mapData: {'features': this.props.features, 'type': 'FeatureCollection'},
color: '#E0E0E0',
enableMouseTracking: false
}, {
name: current_indicator.name,
type: 'mapbubble',
mapData: {'features': this.props.features, 'type': 'FeatureCollection'},
data: this.props.datapoints.meta.chart_data,
joinBy: 'location_id',
minSize: 4,
maxSize: '12%',
tooltip: {
pointFormatter: function() {
return (
`<span> ${props.locations_index[this.location_id].name}:
<strong> ${format.autoFormat(this.z, current_indicator.data_format)} </strong>
</span>`
)
}
}
}]
}
}
export default BubbleMap
| import React from 'react'
import HighChart from 'components/molecules/highcharts/HighChart'
import palettes from 'utilities/palettes'
import format from 'utilities/format'
class BubbleMap extends HighChart {
setConfig = function () {
this.config = {
legend: {
enabled: false
},
series: this.setSeries(),
mapNavigation: {
enabled: false,
enableTouchZoom: false,
enableDoubleClickZoom: false,
enableMouseWheelZoom: false,
enableButtons: false
}
}
}
setSeries = function () {
const props = this.props
const current_indicator = this.props.selected_indicators[0]
const color = this.props.indicator_colors[current_indicator.id]
return [{
mapData: {'features': this.props.features, 'type': 'FeatureCollection'},
color: '#E0E0E0',
enableMouseTracking: false
}, {
name: current_indicator.name,
type: 'mapbubble',
mapData: {'features': this.props.features, 'type': 'FeatureCollection'},
data: this.props.datapoints.meta.chart_data,
joinBy: 'location_id',
minSize: 4,
maxSize: '12%',
color: color,
tooltip: {
pointFormatter: function() {
return (
`<span> ${props.locations_index[this.location_id].name}:
<strong> ${format.autoFormat(this.z, current_indicator.data_format)} </strong>
</span>`
)
}
}
}]
}
}
export default BubbleMap
| Update bubble map to render indicator color. | Update bubble map to render indicator color.
| JSX | agpl-3.0 | unicef/rhizome,unicef/rhizome,unicef/rhizome,unicef/rhizome | ---
+++
@@ -24,6 +24,7 @@
setSeries = function () {
const props = this.props
const current_indicator = this.props.selected_indicators[0]
+ const color = this.props.indicator_colors[current_indicator.id]
return [{
mapData: {'features': this.props.features, 'type': 'FeatureCollection'},
color: '#E0E0E0',
@@ -36,6 +37,7 @@
joinBy: 'location_id',
minSize: 4,
maxSize: '12%',
+ color: color,
tooltip: {
pointFormatter: function() {
return ( |
558660cf3eb5df4ad7319ee00a5698e697552ff6 | app/assets/javascripts/components/footer.js.jsx | app/assets/javascripts/components/footer.js.jsx | if (typeof require == 'function') { var React = require("react"); }
var Footer = React.createClass({
render: function() {
return (
<footer className="rnplay-footer">
<div className="row">
<div className="col-xs-12">
<p className="footer-links">
<a href="/about">About</a>
<a href="/contact">Contact</a>
<a href="/privacy">Privacy</a>
<a href="https://github.com/rnplay">We're on Github!</a>
</p>
<p>Simulator by <a href="http://appetize.io">appetize.io</a>.</p>
</div>
</div>
</footer>
)
}
});
if (typeof module !== 'undefined') {
module.exports = Footer;
}
| if (typeof require == 'function') { var React = require("react"); }
var Footer = React.createClass({
render: function() {
return (
<footer className="rnplay-footer">
<div className="row">
<div className="col-xs-12">
<p className="footer-links">
<a href="/about">About</a>
<a href="/privacy">Privacy</a>
<a href="https://github.com/rnplay">We're on Github!</a>
</p>
<p>Simulator by <a href="http://appetize.io">appetize.io</a>.</p>
</div>
</div>
</footer>
)
}
});
if (typeof module !== 'undefined') {
module.exports = Footer;
}
| Remove contact link from footer, it doesn't work | Remove contact link from footer, it doesn't work
| JSX | mit | rnplay/rnplay-web,rnplay/rnplay-web,rnplay/rnplay-web,rnplay/rnplay-web | ---
+++
@@ -8,7 +8,6 @@
<div className="col-xs-12">
<p className="footer-links">
<a href="/about">About</a>
- <a href="/contact">Contact</a>
<a href="/privacy">Privacy</a>
<a href="https://github.com/rnplay">We're on Github!</a>
</p> |
f9b43e8b06c15c097240b6f99275799f9cecaf73 | app/core/pluginHandler.jsx | app/core/pluginHandler.jsx |
import _ from 'lodash';
import State from '../scripts/stores/state';
const plugins = _(require('require-dir')('../plugins'))
.values()
.map(plugin => {
return _(plugin)
.keys()
.map(key => {
const initializedPlugin = plugin[key](State);
return _.extend({ name: key }, initializedPlugin);
})
.value();
})
.flatten()
.value();
console.info(`Loaded plugins: ${_.pluck(plugins, 'name')}`);
export default class PluginHandler {
static hasCommand(msg) {
return _.startsWith(msg, '/');
}
static getCommandName(msg) {
return msg.substr(1).split(' ')[0];
}
static getCommandArgs(msg) {
return msg.split(' ')[1];
}
static getCommandByName(command) {
const foundCommand = _.findWhere(plugins, { name: command });
return foundCommand && foundCommand.run ? foundCommand : null;
}
static hasValidCommand(msg) {
const command = this.getCommandName(msg);
return this.getCommandByName(command);
}
static _runCommand(command, args) {
const foundCommand = this.getCommandByName(command);
return foundCommand.run(args);
}
static runCommand(msg) {
return this._runCommand(this.getCommandName(msg), this.getCommandArgs(msg));
}
}
|
import _ from 'lodash';
import State from '../scripts/stores/state';
const plugins = _(require('require-dir')('../plugins'))
.values()
.map(plugin => {
return _(plugin)
.keys()
.map(key => {
const initializedPlugin = plugin[key](State.get());
return _.extend({ name: key }, initializedPlugin);
})
.value();
})
.flatten()
.value();
console.info(`Loaded plugins: ${_.pluck(plugins, 'name')}`);
export default class PluginHandler {
static hasCommand(msg) {
return _.startsWith(msg, '/');
}
static getCommandName(msg) {
return msg.substr(1).split(' ')[0];
}
static getCommandArgs(msg) {
return msg.split(' ')[1];
}
static getCommandByName(command) {
const foundCommand = _.findWhere(plugins, { name: command });
return foundCommand && foundCommand.run ? foundCommand : null;
}
static hasValidCommand(msg) {
const command = this.getCommandName(msg);
return this.getCommandByName(command);
}
static _runCommand(command, args) {
const foundCommand = this.getCommandByName(command);
return foundCommand.run(args);
}
static runCommand(msg) {
return this._runCommand(this.getCommandName(msg), this.getCommandArgs(msg));
}
}
| Revert "send State instead of State.get()" | Revert "send State instead of State.get()"
This reverts commit 5922ca2d45ab525ab144bd73c8d4935f0f4769b5.
| JSX | mit | squelch-irc/squelch,squelch-irc/squelch | ---
+++
@@ -8,7 +8,7 @@
return _(plugin)
.keys()
.map(key => {
- const initializedPlugin = plugin[key](State);
+ const initializedPlugin = plugin[key](State.get());
return _.extend({ name: key }, initializedPlugin);
})
.value(); |
8929e9ee1539e39f03d032454fee12a2b7d0c9ac | src/js/components/validateData/treemap/TreemapCell.jsx | src/js/components/validateData/treemap/TreemapCell.jsx | /**
* TreemapCell.jsx
* Created by Kevin Li 4/11/2016
*/
import React from 'react';
import d3 from 'd3';
import tinycolor from 'tinycolor2';
export default class TreemapCell extends React.Component {
constructor(props) {
super(props);
this.state = {
hover: false
};
}
mouseOver(e) {
this.setState({
hover: true
});
}
mouseOut(e) {
this.setState({
hover: false
});
}
clickEvent(e) {
this.props.clickedItem(this.props);
}
render() {
const style = {
top: this.props.y,
left: this.props.x,
height: this.props.height,
width: this.props.width,
backgroundColor: this.props.color
};
if (this.state.hover) {
style.backgroundColor = tinycolor(this.props.color).lighten().desaturate().toString();
}
return (
<div className="usa-da-treemap-cell" style={style} onMouseOver={this.mouseOver.bind(this)} onMouseOut={this.mouseOut.bind(this)} onClick={this.clickEvent.bind(this)}>
<div className="treemap-rule">{this.props.rule}</div>
</div>
);
}
} | /**
* TreemapCell.jsx
* Created by Kevin Li 4/11/2016
*/
import React from 'react';
import d3 from 'd3';
import tinycolor from 'tinycolor2';
const defaultProps = {
rule: 'Unspecified'
};
export default class TreemapCell extends React.Component {
constructor(props) {
super(props);
this.state = {
hover: false
};
}
mouseOver(e) {
this.setState({
hover: true
});
}
mouseOut(e) {
this.setState({
hover: false
});
}
clickEvent(e) {
this.props.clickedItem(this.props);
}
render() {
const style = {
top: this.props.y,
left: this.props.x,
height: this.props.height,
width: this.props.width,
backgroundColor: this.props.color
};
if (this.state.hover) {
style.backgroundColor = tinycolor(this.props.color).lighten().desaturate().toString();
}
return (
<div className="usa-da-treemap-cell" style={style} onMouseOver={this.mouseOver.bind(this)} onMouseOut={this.mouseOut.bind(this)} onClick={this.clickEvent.bind(this)}>
<div className="treemap-rule">{this.props.rule}</div>
</div>
);
}
}
TreemapCell.defaultProps = defaultProps; | Set a default rule prop | Set a default rule prop
| JSX | cc0-1.0 | fedspendingtransparency/data-act-broker-web-app,fedspendingtransparency/data-act-broker-web-app | ---
+++
@@ -6,6 +6,10 @@
import React from 'react';
import d3 from 'd3';
import tinycolor from 'tinycolor2';
+
+const defaultProps = {
+ rule: 'Unspecified'
+};
export default class TreemapCell extends React.Component {
@@ -54,3 +58,5 @@
);
}
}
+
+TreemapCell.defaultProps = defaultProps; |
9c5f19ff4a25d52e0ab1ba02efebaf44df2ca595 | src/app.jsx | src/app.jsx | // Array.from polyfill
import 'core-js/fn/array/from';
// Object.assign polyfill
import 'core-js/es6/object';
// Symbol polyfill
import 'core-js/es6/symbol';
// React
import React from 'react';
import ReactRouter from 'react-router';
// App core
import App from './app/index.js';
// User routes
import routes from './routes.js';
import basePath from './helpers/base-path.js';
const appInstance = (
<ReactRouter.Route name="app" path={basePath} handler={App}>
{routes}
</ReactRouter.Route>
);
const Bootstrapper = {
start() {
ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler) {
React.render(<Handler />, document.getElementById('mainContainer'));
});
},
};
export default Bootstrapper;
| // Array.from polyfill
import 'core-js/fn/array/from';
// Object.assign polyfill
import 'core-js/es6/object';
// Symbol polyfill
import 'core-js/es6/symbol';
// React
import React from 'react';
import ReactRouter from 'react-router';
// App core
import App from './app/index.js';
// User routes
import routes from './routes.js';
import basePath from './helpers/base-path.js';
import analytics from './helpers/analytics.js';
const appInstance = (
<ReactRouter.Route name="app" path={basePath} handler={App}>
{routes}
</ReactRouter.Route>
);
const Bootstrapper = {
start() {
ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler, state) {
React.render(<Handler />, document.getElementById('mainContainer'));
analytics.addEvent('pageviews', {
path : state.path,
action : state.action,
});
});
},
};
export default Bootstrapper;
| Add basic pageview event tracking | :bar_chart: Add basic pageview event tracking
| JSX | cc0-1.0 | acusti/primal-multiplication,acusti/primal-multiplication | ---
+++
@@ -12,6 +12,7 @@
// User routes
import routes from './routes.js';
import basePath from './helpers/base-path.js';
+import analytics from './helpers/analytics.js';
const appInstance = (
<ReactRouter.Route name="app" path={basePath} handler={App}>
@@ -21,8 +22,12 @@
const Bootstrapper = {
start() {
- ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler) {
+ ReactRouter.run(appInstance, ReactRouter.HistoryLocation, function(Handler, state) {
React.render(<Handler />, document.getElementById('mainContainer'));
+ analytics.addEvent('pageviews', {
+ path : state.path,
+ action : state.action,
+ });
});
},
}; |
1675ff4c9b7e0be03ffce25bf85ef3d2a9b2f2fd | src/components/ClocketteApp.jsx | src/components/ClocketteApp.jsx | 'use strict';
import React from 'react';
import { RouteHandler } from 'react-router';
import 'normalize.css';
import 'styles/main.css';
const ClocketteApp = React.createClass({
getInitialState() {
this.interval = null;
return {
ts: Date.now()
};
},
componentDidMount() {
this.interval = setInterval(() => {
this.setState({
ts: Date.now()
});
}, 1000 * 30);
},
componentWillUnmount() {
clearInterval(this.interval);
},
render() {
return (
<RouteHandler ts={this.state.ts}/>
);
}
});
export default ClocketteApp;
| 'use strict';
import React from 'react';
import { RouteHandler } from 'react-router';
import 'normalize.css';
import 'styles/main.css';
const ClocketteApp = React.createClass({
getInitialState() {
this.interval = null;
return {
ts: Date.now()
};
},
componentDidMount() {
let adjustInterval = setInterval(() => {
const now = new Date();
if (now.getSeconds() === 0) {
clearInterval(adjustInterval);
this.updateTS();
this.interval = setInterval(this.updateTS, 1000 * 60);
}
}, 1000);
},
componentWillUnmount() {
clearInterval(this.interval);
},
updateTS() {
this.setState({ ts: Date.now() });
},
render() {
return (
<RouteHandler ts={this.state.ts}/>
);
}
});
export default ClocketteApp;
| Improve App refresh frequency to match user's device clock | Improve App refresh frequency to match user's device clock
| JSX | mit | rhumlover/clockette,rhumlover/clockette | ---
+++
@@ -18,15 +18,22 @@
},
componentDidMount() {
- this.interval = setInterval(() => {
- this.setState({
- ts: Date.now()
- });
- }, 1000 * 30);
+ let adjustInterval = setInterval(() => {
+ const now = new Date();
+ if (now.getSeconds() === 0) {
+ clearInterval(adjustInterval);
+ this.updateTS();
+ this.interval = setInterval(this.updateTS, 1000 * 60);
+ }
+ }, 1000);
},
componentWillUnmount() {
clearInterval(this.interval);
+ },
+
+ updateTS() {
+ this.setState({ ts: Date.now() });
},
render() { |
4cc3765a3b41e1cb97d22a1e230e91d37aa58489 | packages/lesswrong/components/posts/PostsDay.jsx | packages/lesswrong/components/posts/PostsDay.jsx | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Components, replaceComponent } from 'meteor/vulcan:core';
import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
dayTitle: {
marginTop: theme.spacing.unit*2,
marginBottom: theme.spacing.unit,
...theme.typography.postStyle
}
})
class PostsDay extends PureComponent {
render() {
const { date, posts, classes } = this.props;
const noPosts = posts.length === 0;
return (
<div className="posts-day">
<Typography variant="display2" className={classes.dayTitle} >{date.format('dddd, MMMM Do YYYY')}</Typography>
{ noPosts ? <Components.PostsNoMore /> :
<div className="posts-list">
<div className="posts-list-content">
{posts.map((post, index) => <Components.PostsItem post={post} key={post._id} index={index} currentUser={this.props.currentUser} />)}
</div>
</div>
}
</div>
);
}
}
PostsDay.propTypes = {
currentUser: PropTypes.object,
date: PropTypes.object,
number: PropTypes.number
};
replaceComponent('PostsDay', PostsDay, withStyles(styles));
| import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { Components, replaceComponent } from 'meteor/vulcan:core';
import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
dayTitle: {
marginTop: theme.spacing.unit*2,
marginBottom: theme.spacing.unit,
...theme.typography.postStyle
},
noPosts: {
marginLeft: "23px",
color: "rgba(0,0,0,0.5)",
},
})
class PostsDay extends PureComponent {
render() {
const { date, posts, classes } = this.props;
const noPosts = posts.length === 0;
return (
<div className="posts-day">
<Typography variant="display2" className={classes.dayTitle} >{date.format('dddd, MMMM Do YYYY')}</Typography>
{ noPosts ? (<div className={classes.noPosts}>No posts on {date.format('MMMM Do YYYY')}</div>) :
<div className="posts-list">
<div className="posts-list-content">
{posts.map((post, index) => <Components.PostsItem post={post} key={post._id} index={index} currentUser={this.props.currentUser} />)}
</div>
</div>
}
</div>
);
}
}
PostsDay.propTypes = {
currentUser: PropTypes.object,
date: PropTypes.object,
number: PropTypes.number
};
replaceComponent('PostsDay', PostsDay, withStyles(styles));
| Improve styling of Daily page days with no posts | Improve styling of Daily page days with no posts
| JSX | mit | Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope | ---
+++
@@ -9,7 +9,11 @@
marginTop: theme.spacing.unit*2,
marginBottom: theme.spacing.unit,
...theme.typography.postStyle
- }
+ },
+ noPosts: {
+ marginLeft: "23px",
+ color: "rgba(0,0,0,0.5)",
+ },
})
class PostsDay extends PureComponent {
@@ -21,7 +25,7 @@
return (
<div className="posts-day">
<Typography variant="display2" className={classes.dayTitle} >{date.format('dddd, MMMM Do YYYY')}</Typography>
- { noPosts ? <Components.PostsNoMore /> :
+ { noPosts ? (<div className={classes.noPosts}>No posts on {date.format('MMMM Do YYYY')}</div>) :
<div className="posts-list">
<div className="posts-list-content">
{posts.map((post, index) => <Components.PostsItem post={post} key={post._id} index={index} currentUser={this.props.currentUser} />)} |
0bed889319d8651734fbd6d17e9c30fa92f5267a | Todo-Redux/app/reducers/reducers.jsx | Todo-Redux/app/reducers/reducers.jsx | import UUID from 'node-uuid';
import moment from 'moment';
export function searchTextReducer(state = '', action) {
switch(action.type) {
case 'SET_SEARCH_TEXT':
return action.searchText;
default:
return state;
}
};
export function showCompletedReducer(state = false, action) {
switch(action.type) {
case 'TOGGLE_SHOW_COMPLETED':
return !state;
default:
return state;
}
};
export function tasksReducer(state = [], action) {
switch(action.type) {
case 'LOAD_TASKS':
return [...state, ...action.tasks];
case 'ADD_TASK':
return [...state, {
id: UUID(),
text: action.text,
completed: false,
createdAt: moment().unix(),
completedAt: undefined
}
];
case 'TOGGLE_TASK':
return state.map((task) => {
if(task.id === action.id) {
return { ...task,
completed: !task.completed,
completedAt: task.completed ? undefined : moment().unix()
}
}
return task;
});
default:
return state;
}
};
| import UUID from 'node-uuid';
import moment from 'moment';
export function searchTextReducer(state = '', action) {
switch(action.type) {
case 'SET_SEARCH_TEXT':
return action.searchText;
default:
return state;
}
};
export function showCompletedReducer(state = false, action) {
switch(action.type) {
case 'TOGGLE_SHOW_COMPLETED':
return !state;
default:
return state;
}
};
export function tasksReducer(state = [], action) {
switch(action.type) {
case 'LOAD_TASKS':
return [...state, ...action.tasks];
case 'ADD_TASK':
return [...state, {
id: UUID(),
text: action.text,
completed: false,
createdAt: moment().unix(),
completedAt: undefined,
priority: Math.floor(Math.random() * 5) + 1
}
];
case 'TOGGLE_TASK':
return state.map((task) => {
if(task.id === action.id) {
return { ...task,
completed: !task.completed,
completedAt: task.completed ? undefined : moment().unix()
}
}
return task;
});
default:
return state;
}
};
| Add a (currently random) priority to tasks | Add a (currently random) priority to tasks
| JSX | mit | JulianNicholls/Complete-React-Web-App,JulianNicholls/Complete-React-Web-App | ---
+++
@@ -32,7 +32,8 @@
text: action.text,
completed: false,
createdAt: moment().unix(),
- completedAt: undefined
+ completedAt: undefined,
+ priority: Math.floor(Math.random() * 5) + 1
}
];
|
57cd1f108cc8e69a4da9d386daca43794e3d731c | Loader/index.jsx | Loader/index.jsx | import React, { PropTypes } from 'react';
import { classNames } from '../lib/utils';
import Icon from '../Icon';
import Text from '../Text';
import styles from './style.css';
const Loader = ({ children }) => {
const classes = classNames(styles, 'loader');
return (
<div className={classes}>
<div className={styles.icon}>
<Icon type={'buffer-top'} className={styles.top} />
<Icon type={'buffer-middle'} className={styles.middle} />
<Icon type={'buffer-bottom'} className={styles.bottom} />
</div>
<Text>{children}</Text>
</div>
);
};
Loader.propTypes = {
children: PropTypes.node,
};
export default Loader;
| import React, { PropTypes } from 'react';
import Icon from '../Icon';
import Text from '../Text';
import styles from './style.css';
const Loader = ({ children }) =>
<div className={styles.loader}>
<div className={styles.icon}>
<Icon type={'buffer-top'} className={styles.top} />
<Icon type={'buffer-middle'} className={styles.middle} />
<Icon type={'buffer-bottom'} className={styles.bottom} />
</div>
<Text>{children}</Text>
</div>;
Loader.propTypes = {
children: PropTypes.node,
};
export default Loader;
| Remove utils import and use {styles} instead | Remove utils import and use {styles} instead
This commit removes the need to use the `classNames` utility. Removing
this gives us a single value that we're returning so removing the return
statement and {} syntax on our arrow function feels super clean! :D
| JSX | mit | bufferapp/buffer-components,bufferapp/buffer-components | ---
+++
@@ -1,22 +1,17 @@
import React, { PropTypes } from 'react';
-import { classNames } from '../lib/utils';
import Icon from '../Icon';
import Text from '../Text';
import styles from './style.css';
-const Loader = ({ children }) => {
- const classes = classNames(styles, 'loader');
- return (
- <div className={classes}>
- <div className={styles.icon}>
- <Icon type={'buffer-top'} className={styles.top} />
- <Icon type={'buffer-middle'} className={styles.middle} />
- <Icon type={'buffer-bottom'} className={styles.bottom} />
- </div>
- <Text>{children}</Text>
+const Loader = ({ children }) =>
+ <div className={styles.loader}>
+ <div className={styles.icon}>
+ <Icon type={'buffer-top'} className={styles.top} />
+ <Icon type={'buffer-middle'} className={styles.middle} />
+ <Icon type={'buffer-bottom'} className={styles.bottom} />
</div>
- );
-};
+ <Text>{children}</Text>
+ </div>;
Loader.propTypes = {
children: PropTypes.node, |
1d13ac0b944a2926fee4384668001ea5f9404c08 | app/assets/javascripts/components/forms/AvatarGrabber.jsx | app/assets/javascripts/components/forms/AvatarGrabber.jsx | var AvatarGrabber = React.createClass({
getInitialState: function() {
return {text: "", url: "https://i1.wp.com/design.atlassian.com/1.4/images/avatars/default-user/192/user-avatar-blue-96%402x.png?ssl=1"};
},
handleChange: function(e) {
console.log("CHANGE");
this.setState({text: e.target.value});
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(e.target.value)) {
console.log(e.target.value);
var url = get_gravatar(this.state.text);
$('#hidden-avatar-field').val(url);
this.setState({url: url, text: e.target.value});
}
},
render: function() {
return (
<div className="container">
<input onChange={this.handleChange} value={this.state.text} type="text" placeholder="Your Gravatar Email Address" id="select-box" className="form-control col-xs-6"/>
<img src={this.state.url} className="image-box col-xs-6" id="avatar-image"></img>
</div>
);
}
});
| var AvatarGrabber = React.createClass({
getInitialState: function() {
return {text: "", url: "https://i1.wp.com/design.atlassian.com/1.4/images/avatars/default-user/192/user-avatar-blue-96%402x.png?ssl=1"};
},
handleChange: function(e) {
this.setState({text: e.target.value});
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(e.target.value)) {
var url = get_gravatar(e.target.value);
$('#hidden-avatar-field').val(url);
this.setState({url: url, text: e.target.value});
}
},
render: function() {
return (
<div className="container">
<input onChange={this.handleChange} value={this.state.text} type="text" placeholder="Your Gravatar Email Address" id="select-box" className="form-control col-xs-6"/>
<img src={this.state.url} className="image-box col-xs-6" id="avatar-image"></img>
</div>
);
}
});
| Fix gravatar code to grab the correct target URL | Fix gravatar code to grab the correct target URL
| JSX | artistic-2.0 | tgoldenberg/Speak-It,nyc-dragonflies-2015/Speak-It,tgoldenberg/Speak-It,tgoldenberg/Speak-It,nyc-dragonflies-2015/Speak-It,nyc-dragonflies-2015/Speak-It | ---
+++
@@ -3,12 +3,10 @@
return {text: "", url: "https://i1.wp.com/design.atlassian.com/1.4/images/avatars/default-user/192/user-avatar-blue-96%402x.png?ssl=1"};
},
handleChange: function(e) {
- console.log("CHANGE");
this.setState({text: e.target.value});
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(e.target.value)) {
- console.log(e.target.value);
- var url = get_gravatar(this.state.text);
+ var url = get_gravatar(e.target.value);
$('#hidden-avatar-field').val(url);
this.setState({url: url, text: e.target.value});
} |
d7090ffe64ffb33f17633617dc491a5b4b96dca4 | packages/nova-base-components/lib/users/UsersAvatar.jsx | packages/nova-base-components/lib/users/UsersAvatar.jsx | import { registerComponent } from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import Users from 'meteor/nova:users';
import { Link } from 'react-router';
const UsersAvatar = ({user, size, link}) => {
const sizes = {
small: "20px",
medium: "30px",
large: "50px"
}
const aStyle = {
borderRadius: "100%",
display: "inline-block",
height: sizes[size],
width: sizes[size]
};
const imgStyle = {
borderRadius: "100%",
display: "block",
height: sizes[size],
width: sizes[size]
};
const avatarUrl = Users.avatar.getUrl(user);
const img = <img alt={Users.getDisplayName(user)} style={imgStyle} className="avatar" src={avatarUrl}/>;
const initials = <span className="avatar-initials"><span>{Users.avatar.getInitials(user)}</span></span>;
const avatar = avatarUrl ? img : initials;
return link ? <Link style={aStyle} className="users-avatar" to={Users.getProfileUrl(user)}>{avatar}</Link> : avatar;
}
UsersAvatar.propTypes = {
user: React.PropTypes.object.isRequired,
size: React.PropTypes.string,
link: React.PropTypes.bool
}
UsersAvatar.defaultProps = {
size: "medium",
link: true
}
UsersAvatar.displayName = "UsersAvatar";
registerComponent('UsersAvatar', UsersAvatar); | import { registerComponent } from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import Users from 'meteor/nova:users';
import { Link } from 'react-router';
const UsersAvatar = ({user, size, link}) => {
const sizes = {
small: "20px",
medium: "30px",
large: "50px"
}
const aStyle = {
borderRadius: "100%",
display: "inline-block",
height: sizes[size],
width: sizes[size]
};
const imgStyle = {
borderRadius: "100%",
display: "block",
height: sizes[size],
width: sizes[size]
};
const avatarUrl = Users.avatar.getUrl(user);
const img = <img alt={Users.getDisplayName(user)} style={imgStyle} className="avatar" src={avatarUrl} title={user.username}/>;
const initials = <span className="avatar-initials"><span>{Users.avatar.getInitials(user)}</span></span>;
const avatar = avatarUrl ? img : initials;
return link ? <Link style={aStyle} className="users-avatar" to={Users.getProfileUrl(user)}>{avatar}</Link> : avatar;
}
UsersAvatar.propTypes = {
user: React.PropTypes.object.isRequired,
size: React.PropTypes.string,
link: React.PropTypes.bool
}
UsersAvatar.defaultProps = {
size: "medium",
link: true
}
UsersAvatar.displayName = "UsersAvatar";
registerComponent('UsersAvatar', UsersAvatar);
| Add username tooltip to user's avatar. Nice in the commenters list of a PostItem. | Add username tooltip to user's avatar. Nice in the commenters list of a PostItem.
| JSX | mit | Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope | ---
+++
@@ -16,18 +16,18 @@
display: "inline-block",
height: sizes[size],
width: sizes[size]
- };
+ };
const imgStyle = {
borderRadius: "100%",
display: "block",
height: sizes[size],
width: sizes[size]
- };
+ };
const avatarUrl = Users.avatar.getUrl(user);
- const img = <img alt={Users.getDisplayName(user)} style={imgStyle} className="avatar" src={avatarUrl}/>;
+ const img = <img alt={Users.getDisplayName(user)} style={imgStyle} className="avatar" src={avatarUrl} title={user.username}/>;
const initials = <span className="avatar-initials"><span>{Users.avatar.getInitials(user)}</span></span>;
const avatar = avatarUrl ? img : initials; |
97a002f476793c44b853585b36730b074b06e202 | src/modules/Navigation/index.jsx | src/modules/Navigation/index.jsx | import React, {Component, PropTypes} from "react"
import cx from "classnames"
import Icon from "../Icon"
export default class Navigation extends Component {
static displayName = "Navigation"
static contextTypes = {
file: PropTypes.object,
i18n: PropTypes.object,
}
static items = [
{
url: "posts",
name: "Articles",
icon: "icons/bookmark.svg",
},
{
url: "c-est-quoi-putaindecode",
name: "Readme",
icon: "icons/text-file.svg",
},
{
url: "posts/comment-contribuer",
name: "Participer",
icon: "icons/pencil.svg",
},
{
url: "https://github.com/putaindecode/",
title: "GitHub",
icon: "icons/github.svg",
},
{
url: "https://twitter.com/putaindecode/",
title: "Twitter",
icon: "icons/twitter.svg",
},
]
render() {
const currentPage = this.context.file._filename
return (
<nav className="putainde-Nav">
{
Navigation.items.map((item) => {
const isActivePage = currentPage === item.url || currentPage === item.url + "/index.html"
return (
<a
key={item.url}
className={cx({
"putainde-Nav-item": true,
"putainde-Nav-item--current": isActivePage,
"putainde-Nav-item--icon r-Tooltip r-Tooltip--bottom": item.title,
})}
href={`/${item.url}`}
data-r-tooltip={item.title ? item.title : ""}
>
{/* @todo handle item.icon */}
{
item.icon &&
<Icon src={`/${item.icon}`} />
}
{item.name}
</a>
)
})
}
</nav>
)
}
}
| import React, {Component, PropTypes} from "react"
import cx from "classnames"
import Icon from "../Icon"
export default class Navigation extends Component {
static displayName = "Navigation"
static contextTypes = {
file: PropTypes.object,
i18n: PropTypes.object,
}
render() {
const currentPage = this.context.file._filename
return (
<nav className="putainde-Nav">
{
this.context.i18n.navigation.map((item) => {
const isActivePage = currentPage === item.url || currentPage === item.url + "/index.html"
return (
<a
key={item.url}
className={cx({
"putainde-Nav-item": true,
"putainde-Nav-item--current": isActivePage,
"putainde-Nav-item--icon r-Tooltip r-Tooltip--bottom": item.title,
})}
href={`/${item.url}`}
data-r-tooltip={item.title ? item.title : ""}
>
{/* @todo handle item.icon */}
{
item.icon &&
<Icon src={`${item.icon}`} />
}
{item.name}
</a>
)
})
}
</nav>
)
}
}
| Use navigation from i18n file | Use navigation from i18n file
| JSX | mit | putaindecode/putaindecode.io,putaindecode/putaindecode.fr,putaindecode/putaindecode.fr,revolunet/putaindecode.fr,revolunet/putaindecode.fr,revolunet/putaindecode.fr,putaindecode/putaindecode.fr | ---
+++
@@ -12,41 +12,13 @@
i18n: PropTypes.object,
}
- static items = [
- {
- url: "posts",
- name: "Articles",
- icon: "icons/bookmark.svg",
- },
- {
- url: "c-est-quoi-putaindecode",
- name: "Readme",
- icon: "icons/text-file.svg",
- },
- {
- url: "posts/comment-contribuer",
- name: "Participer",
- icon: "icons/pencil.svg",
- },
- {
- url: "https://github.com/putaindecode/",
- title: "GitHub",
- icon: "icons/github.svg",
- },
- {
- url: "https://twitter.com/putaindecode/",
- title: "Twitter",
- icon: "icons/twitter.svg",
- },
- ]
-
render() {
const currentPage = this.context.file._filename
return (
<nav className="putainde-Nav">
{
- Navigation.items.map((item) => {
+ this.context.i18n.navigation.map((item) => {
const isActivePage = currentPage === item.url || currentPage === item.url + "/index.html"
return (
@@ -63,7 +35,7 @@
{/* @todo handle item.icon */}
{
item.icon &&
- <Icon src={`/${item.icon}`} />
+ <Icon src={`${item.icon}`} />
}
{item.name}
</a> |
a2dd3f5119d4d806923e6a84b6667df9f6d5d1c1 | src/sentry/static/sentry/app/components/selectInput.jsx | src/sentry/static/sentry/app/components/selectInput.jsx | import React from 'react';
import jQuery from 'jquery';
const SelectInput = React.createClass({
getDefaultProps() {
return {
// HTML attrs
disabled: false,
multiple: false,
required: false,
// Extra options
placeholder: 'Select an option...',
// Component options
value: '',
onChange: $.noop
};
},
componentDidMount() {
this.create();
},
componentWillUpdate() {
this.destroy();
},
componentDidUpdate() {
this.create();
},
componentWillUnmount() {
this.destroy();
},
getValue() {
return this.select2.getValue();
},
create() {
this.select2 = jQuery(this.refs.select).select2();
this.select2.on('change', this.onChange);
},
destroy() {
jQuery(this.refs.select).select2('destroy');
},
onChange(...args) {
this.props.onChange.call(this, this.select2, ...args);
},
render() {
let opts = {
ref: 'select',
disabled: this.props.disabled,
required: this.props.required,
multiple: this.props.multiple,
placeholder: this.props.placeholder,
className: this.props.className
};
return (
<select {...opts}>
{this.props.children}
</select>
);
}
});
export default SelectInput;
| import React from 'react';
import jQuery from 'jquery';
const SelectInput = React.createClass({
getDefaultProps() {
return {
// HTML attrs
disabled: false,
multiple: false,
required: false,
// Extra options
placeholder: 'Select an option...',
// Component options
value: '',
onChange: $.noop
};
},
componentDidMount() {
this.create();
},
componentWillUpdate() {
this.destroy();
},
componentDidUpdate() {
this.create();
},
componentWillUnmount() {
this.destroy();
},
getValue() {
return this.select2.getValue();
},
create() {
this.select2 = jQuery(this.refs.select).select2();
this.select2.on('change', this.onChange);
},
destroy() {
jQuery(this.refs.select).select2('destroy');
},
onChange(...args) {
this.props.onChange.call(this, this.select2, ...args);
},
render() {
let opts = {
ref: 'select',
disabled: this.props.disabled,
required: this.props.required,
multiple: this.props.multiple,
placeholder: this.props.placeholder,
className: this.props.className,
value: this.props.value,
};
return (
<select {...opts}>
{this.props.children}
</select>
);
}
});
export default SelectInput;
| Correct default value on SelectInput | Correct default value on SelectInput
| JSX | bsd-3-clause | jean/sentry,daevaorn/sentry,JamesMura/sentry,gencer/sentry,JamesMura/sentry,mvaled/sentry,gencer/sentry,JackDanger/sentry,nicholasserra/sentry,jean/sentry,beeftornado/sentry,looker/sentry,jean/sentry,mitsuhiko/sentry,looker/sentry,fotinakis/sentry,zenefits/sentry,BuildingLink/sentry,ifduyue/sentry,mvaled/sentry,mvaled/sentry,ifduyue/sentry,BuildingLink/sentry,zenefits/sentry,looker/sentry,ifduyue/sentry,ifduyue/sentry,jean/sentry,ifduyue/sentry,looker/sentry,beeftornado/sentry,gencer/sentry,JamesMura/sentry,JamesMura/sentry,gencer/sentry,alexm92/sentry,zenefits/sentry,nicholasserra/sentry,mvaled/sentry,daevaorn/sentry,fotinakis/sentry,alexm92/sentry,BuildingLink/sentry,BuildingLink/sentry,fotinakis/sentry,nicholasserra/sentry,fotinakis/sentry,alexm92/sentry,daevaorn/sentry,beeftornado/sentry,JackDanger/sentry,JackDanger/sentry,JamesMura/sentry,mitsuhiko/sentry,BuildingLink/sentry,jean/sentry,gencer/sentry,mvaled/sentry,zenefits/sentry,zenefits/sentry,mvaled/sentry,looker/sentry,daevaorn/sentry | ---
+++
@@ -58,7 +58,8 @@
required: this.props.required,
multiple: this.props.multiple,
placeholder: this.props.placeholder,
- className: this.props.className
+ className: this.props.className,
+ value: this.props.value,
};
return (
<select {...opts}> |
8984c23d6b1965507bc953b5dedfac266c065125 | services/users/change-password-email.jsx | services/users/change-password-email.jsx | module.exports = (props) => {
<table align="center" width="600">
<tr>
<td style="text-align: center; font-family: Arial, sans-serif;" valign="top">
<h1>Hi</h1>
<p>A password change request has been initiated for your account at <a
href={props.site.url}>{props.site.title}</a>. Please follow the link below
to finalize the change:</p>
<p><a href={props.link}>{props.link}</a></p>
<p>This link is only active for 24 hours.</p>
<p><strong>This is an automated email, please do not reply to it.</strong></p>
</td>
</tr>
</table>
}
| module.exports = (props) => (
<table align="center" width="600">
<tr>
<td style="text-align: center; font-family: Arial, sans-serif;" valign="top">
<h1>Hi</h1>
<p>A password change request has been initiated for your account at <a
href={props.site.url}>{props.site.title}</a>. Please follow the link below
to finalize the change:</p>
<p><a href={props.link}>{props.link}</a></p>
<p>This link is only active for 24 hours.</p>
<p><strong>This is an automated email, please do not reply to it.</strong></p>
</td>
</tr>
</table>
);
| Fix template not returning any html | Fix template not returning any html
| JSX | mit | thebitmill/midwest-membership-services | ---
+++
@@ -1,4 +1,4 @@
-module.exports = (props) => {
+module.exports = (props) => (
<table align="center" width="600">
<tr>
<td style="text-align: center; font-family: Arial, sans-serif;" valign="top">
@@ -15,4 +15,4 @@
</td>
</tr>
</table>
-}
+); |
4317057d1fe5c7a80c72e6fa1f51946f6e290532 | waartaa/client/app/routes.jsx | waartaa/client/app/routes.jsx | import React from 'react';
import { Route } from 'react-router';
import MaterialApp from './containers/App.jsx';
import Chat from './containers/Chat.jsx';
export default (
<Route path="/" component={MaterialApp} />,
<Route path="/chat" component={Chat} />
)
| import React from 'react';
import { Route } from 'react-router';
import MaterialApp from './containers/App.jsx';
import Chat from './containers/Chat.jsx';
export default (
<Route>
<Route path="/" component={MaterialApp} />
<Route path="/chat" component={Chat} />
</Route>
)
| Fix the home path in react-router | Fix the home path in react-router
| JSX | mit | waartaa/waartaa,waartaa/waartaa,waartaa/waartaa | ---
+++
@@ -5,6 +5,8 @@
import Chat from './containers/Chat.jsx';
export default (
- <Route path="/" component={MaterialApp} />,
- <Route path="/chat" component={Chat} />
+ <Route>
+ <Route path="/" component={MaterialApp} />
+ <Route path="/chat" component={Chat} />
+ </Route>
) |
836e6e2eb471dd586c796139764b55266e645d5e | src/context/ScreenClassProvider/index.jsx | src/context/ScreenClassProvider/index.jsx | /* global window */
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { getScreenClass } from '../../utils';
import { getConfiguration } from '../../config';
export const NO_PROVIDER_FLAG = 'NO_PROVIDER_FLAG';
export const ScreenClassContext = React.createContext(NO_PROVIDER_FLAG);
export default class ScreenClassProvider extends PureComponent {
static propTypes = {
/**
* children of the ScreenClassProvider - this should be all your child React nodes that are using react-grid-system.
*/
children: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = {
screenClass: getConfiguration().defaultScreenClass,
};
this.setScreenClass = this.setScreenClass.bind(this);
}
componentDidMount() {
this.setScreenClass();
window.addEventListener('resize', this.setScreenClass, false);
}
componentWillUnmount() {
window.removeEventListener('resize', this.setScreenClass, false);
}
setScreenClass() {
const currScreenClass = getScreenClass();
if (currScreenClass !== this.state.screenClass) {
this.setState({ screenClass: currScreenClass });
}
}
render() {
const { screenClass } = this.state;
const { children } = this.props;
return (
<ScreenClassContext.Provider value={screenClass}>{children}</ScreenClassContext.Provider>
);
}
}
| /* global window */
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { getScreenClass } from '../../utils';
import { getConfiguration } from '../../config';
export const NO_PROVIDER_FLAG = 'NO_PROVIDER_FLAG';
export const ScreenClassContext = React.createContext(NO_PROVIDER_FLAG);
export default class ScreenClassProvider extends PureComponent {
static propTypes = {
/**
* Children of the ScreenClassProvider.
* This should be all your child React nodes that are using `react-grid-system`.
*/
children: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = {
screenClass: getConfiguration().defaultScreenClass,
};
this.setScreenClass = this.setScreenClass.bind(this);
}
componentDidMount() {
this.setScreenClass();
window.addEventListener('resize', this.setScreenClass, false);
}
componentWillUnmount() {
window.removeEventListener('resize', this.setScreenClass, false);
}
setScreenClass() {
const currScreenClass = getScreenClass();
if (currScreenClass !== this.state.screenClass) {
this.setState({ screenClass: currScreenClass });
}
}
render() {
const { screenClass } = this.state;
const { children } = this.props;
return (
<ScreenClassContext.Provider value={screenClass}>{children}</ScreenClassContext.Provider>
);
}
}
| Reduce a comment size to please the linter. | Reduce a comment size to please the linter.
| JSX | isc | zoover/react-grid-system,JSxMachina/react-grid-system,zoover/react-grid-system | ---
+++
@@ -11,7 +11,8 @@
export default class ScreenClassProvider extends PureComponent {
static propTypes = {
/**
- * children of the ScreenClassProvider - this should be all your child React nodes that are using react-grid-system.
+ * Children of the ScreenClassProvider.
+ * This should be all your child React nodes that are using `react-grid-system`.
*/
children: PropTypes.func.isRequired,
}; |
3a37ffdd452e5df97ec74b57acf2f25b1bb14c94 | packages/lesswrong/components/users/UserNameDeleted.jsx | packages/lesswrong/components/users/UserNameDeleted.jsx | import { registerComponent } from 'meteor/vulcan:core';
const UserNameDeleted = () => '[deleted]';
registerComponent('UserNameDeleted', UserNameDeleted); | import { registerComponent } from 'meteor/vulcan:core';
const UserNameDeleted = () => '[anonymous]';
registerComponent('UserNameDeleted', UserNameDeleted); | Change [deleted] to [anonymous] for deleted accounts | Change [deleted] to [anonymous] for deleted accounts
| JSX | mit | Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2 | ---
+++
@@ -1,5 +1,5 @@
import { registerComponent } from 'meteor/vulcan:core';
-const UserNameDeleted = () => '[deleted]';
+const UserNameDeleted = () => '[anonymous]';
registerComponent('UserNameDeleted', UserNameDeleted); |
996a106ba9d5de075aa19b7f378527cf9a20131c | src/main/webapp/javascript/index.jsx | src/main/webapp/javascript/index.jsx | import ReactDOM from 'react-dom';
import React from 'react';
import Table from './table';
require('../css/general.css');
ReactDOM.render(
<div>
<Table number={1} openSeats={[1,2]}/>
<Table number={2} openSeats={[1,2,3]}/>
<Table number={3} openSeats={[1]}/>
<Table number={4} openSeats={[1,2,3,4]}/>
</div>,
document.getElementById('content')
);
| import ReactDOM from 'react-dom';
import React from 'react';
import Table from './table';
import '../css/general.css';
ReactDOM.render(
<div>
<Table number={1} openSeats={[1,2]}/>
<Table number={2} openSeats={[1,2,3]}/>
<Table number={3} openSeats={[1]}/>
<Table number={4} openSeats={[1,2,3,4]}/>
</div>,
document.getElementById('content')
);
| Convert require css file into an import statement | Convert require css file into an import statement
| JSX | unlicense | Blastman/webpack-gradle,Blastman/webpack-gradle,Blastman/webpack-gradle,Blastman/webpack-gradle | ---
+++
@@ -1,8 +1,7 @@
import ReactDOM from 'react-dom';
import React from 'react';
import Table from './table';
-
-require('../css/general.css');
+import '../css/general.css';
ReactDOM.render(
<div> |
8ca2201ad77867df21052e3c44ff0f320002cb0e | app/assets/javascripts/components/ui/single_line_list.js.jsx | app/assets/javascripts/components/ui/single_line_list.js.jsx | var Label = require('./label.js.jsx')
var SingleLineList = React.createClass({
propTypes: {
height: React.PropTypes.string
},
getDefaultProps() {
return {
height: '2rem'
}
},
render: function() {
var height, items, shadowStyle
height = this.props.height
items = _.map(this.props.items, item => {
return <div className="inline-block px1">{item}</div>
})
shadowStyle = {
width: height,
background: 'linear-gradient(90deg, transparent, white)'
}
return <div className="relative mxn1 overflow-hidden" style={{height: height, whiteSpace: 'nowrap'}}>
{items}
<div className="absolute top-0 right-0 bottom-0" style={shadowStyle}></div>
</div>
}
})
module.exports = SingleLineList
| var Label = require('./label.js.jsx')
var SingleLineList = React.createClass({
propTypes: {
height: React.PropTypes.string
},
getDefaultProps() {
return {
height: '2rem'
}
},
render: function() {
var height, items, shadowStyle
height = this.props.height
items = _.map(this.props.items, item => {
return <div className="inline-block px1">{item}</div>
})
shadowStyle = {
width: height,
background: 'linear-gradient(90deg, rgba(255, 255, 255, 0), white)'
}
return <div className="relative mxn1 overflow-hidden" style={{height: height, whiteSpace: 'nowrap'}}>
{items}
<div className="absolute top-0 right-0 bottom-0" style={shadowStyle}></div>
</div>
}
})
module.exports = SingleLineList
| Fix line shadow being black in Safari. | Fix line shadow being black in Safari.
| JSX | agpl-3.0 | lachlanjc/meta,lachlanjc/meta,assemblymade/meta,assemblymade/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta | ---
+++
@@ -22,7 +22,7 @@
shadowStyle = {
width: height,
- background: 'linear-gradient(90deg, transparent, white)'
+ background: 'linear-gradient(90deg, rgba(255, 255, 255, 0), white)'
}
return <div className="relative mxn1 overflow-hidden" style={{height: height, whiteSpace: 'nowrap'}}> |
8e55505cc88c1e93f1b6462cc8719d6c3aedb60f | components/CommunityApp.jsx | components/CommunityApp.jsx | 'use strict';
var React = require('react'),
Jumbotron = require('react-bootstrap/lib/Jumbotron'),
FluxibleMixin = require('fluxible/addons/FluxibleMixin'),
connectToStores = require('fluxible/addons/connectToStores'),
provideContext = require('fluxible/addons/provideContext'),
RouteHandler = require('react-router').RouteHandler,
ApplicationStore = require('../stores/ApplicationStore');
var CommunityApp = React.createClass({
mixins: [ FluxibleMixin ],
render: function () {
return (
<main>
<RouteHandler />
</main>
);
}
});
CommunityApp = connectToStores(CommunityApp, [ ApplicationStore ], function (stores) {
return {
ApplicationStore: stores.ApplicationStore.getState()
};
});
CommunityApp = provideContext(CommunityApp);
module.exports = CommunityApp;
| 'use strict';
var React = require('react'),
Jumbotron = require('react-bootstrap/lib/Jumbotron'),
FluxibleMixin = require('fluxible/addons/FluxibleMixin'),
connectToStores = require('fluxible/addons/connectToStores'),
provideContext = require('fluxible/addons/provideContext'),
RouteHandler = require('react-router').RouteHandler,
ApplicationStore = require('../stores/ApplicationStore'),
Link = require('react-router').Link;
var CommunityApp = React.createClass({
mixins: [ FluxibleMixin ],
render: function () {
return (
<main>
<ul>
<li><Link to="home">Home-Link</Link></li>
<li><Link to="about">About-Link</Link></li>
</ul>
<RouteHandler />
</main>
);
}
});
CommunityApp = connectToStores(CommunityApp, [ ApplicationStore ], function (stores) {
return {
ApplicationStore: stores.ApplicationStore.getState()
};
});
CommunityApp = provideContext(CommunityApp);
module.exports = CommunityApp;
| Add content to showcase client side routing | Add content to showcase client side routing
| JSX | mit | lxanders/community | ---
+++
@@ -6,7 +6,8 @@
connectToStores = require('fluxible/addons/connectToStores'),
provideContext = require('fluxible/addons/provideContext'),
RouteHandler = require('react-router').RouteHandler,
- ApplicationStore = require('../stores/ApplicationStore');
+ ApplicationStore = require('../stores/ApplicationStore'),
+ Link = require('react-router').Link;
var CommunityApp = React.createClass({
mixins: [ FluxibleMixin ],
@@ -14,6 +15,10 @@
render: function () {
return (
<main>
+ <ul>
+ <li><Link to="home">Home-Link</Link></li>
+ <li><Link to="about">About-Link</Link></li>
+ </ul>
<RouteHandler />
</main>
); |
9004888794b0c935ba4523a65c75981d4aca80c4 | apps/common/js/components/lab-interactive.jsx | apps/common/js/components/lab-interactive.jsx | import React from 'react';
import iframePhone from 'iframe-phone';
export default class LabInteractive extends React.Component {
componentDidMount() {
this._phone = new iframePhone.ParentEndpoint(this.refs.iframe);
if (this.props.interactive) {
let interactive = this.props.interactive;
if (this.props.model) {
interactive = combineInteractiveAndModel(interactive, this.props.model)
}
this._phone.post('loadInteractive', interactive);
}
}
get phone() {
return this._phone;
}
componentWillUnmount() {
this.phone.disconnect();
}
render() {
return (
<iframe ref='iframe' width={this.props.width} height={this.props.height}
frameBorder='0' allowFullScreen
src={this.props.src}></iframe>
)
}
}
LabInteractive.defaultProps = {
width: '610px',
height: '350px',
// lab-1.10.0 is stored in /public dir.
src: '/lab-1.10.0/embeddable.html'
};
function combineInteractiveAndModel(interactive, model) {
delete interactive.models[0].url;
interactive.models[0].model = model;
return interactive;
} | import React from 'react';
import iframePhone from 'iframe-phone';
export default class LabInteractive extends React.Component {
componentDidMount() {
this._phone = new iframePhone.ParentEndpoint(this.refs.iframe);
if (this.props.interactive) {
let interactive = this.props.interactive;
if (this.props.model) {
interactive = combineInteractiveAndModel(interactive, this.props.model)
}
this._phone.post('loadInteractive', interactive);
}
}
get phone() {
return this._phone;
}
componentWillUnmount() {
this.phone.disconnect();
}
render() {
return (
<iframe ref='iframe' width={this.props.width} height={this.props.height}
frameBorder='0' allowFullScreen
src={this.props.src}></iframe>
)
}
}
LabInteractive.defaultProps = {
width: '610px',
height: '350px',
// lab-1.10.0 is stored in `/public` directory.
// Note that application pages must be stored in the same dir, so this path works
// correctly. If an app is placed somewhere else, it has to provide custom `src` property
// (e.g. '../lab-1.10.0/embeddable.html' if its page is in a `/public` subdirectory).
src: 'lab-1.10.0/embeddable.html'
};
function combineInteractiveAndModel(interactive, model) {
delete interactive.models[0].url;
interactive.models[0].model = model;
return interactive;
} | Fix Lab embeddable page path | Fix Lab embeddable page path
[#112434041]
| JSX | mit | concord-consortium/leap-motion,concord-consortium/leap-motion,concord-consortium/leap-motion | ---
+++
@@ -34,8 +34,11 @@
LabInteractive.defaultProps = {
width: '610px',
height: '350px',
- // lab-1.10.0 is stored in /public dir.
- src: '/lab-1.10.0/embeddable.html'
+ // lab-1.10.0 is stored in `/public` directory.
+ // Note that application pages must be stored in the same dir, so this path works
+ // correctly. If an app is placed somewhere else, it has to provide custom `src` property
+ // (e.g. '../lab-1.10.0/embeddable.html' if its page is in a `/public` subdirectory).
+ src: 'lab-1.10.0/embeddable.html'
};
function combineInteractiveAndModel(interactive, model) { |
4c949d8e0c593d7d2ca5f403ad499297453ceb73 | app/react/components/github-avatar/github-avatar.jsx | app/react/components/github-avatar/github-avatar.jsx | import React from "react";
export default React.createClass({
propTypes: {
user: React.PropTypes.object.isRequired,
size: React.PropTypes.number
},
getDefaultProps() {
return {
size: 40
};
},
render() {
return (
<a className="github-avatar" href={`https://github.com/${this.props.user.github_username}`}>
<img className="circle" srcSet={`${this.props.user.avatar_url}&s=${this.props.size}, ${this.props.user.avatar_url}&s=${this.props.size*2} 2x`} width={this.props.size} height={this.props.size} alt={this.props.user.name} />
</a>
);
}
});
| import React from "react";
export default class GithubAvatar extends React.Component {
render() {
return (
<a className="github-avatar" href={`https://github.com/${this.props.user.github_username}`}>
<img className="circle" srcSet={`${this.props.user.avatar_url}&s=${this.props.size}, ${this.props.user.avatar_url}&s=${this.props.size*2} 2x`} width={this.props.size} height={this.props.size} alt={this.props.user.name} />
</a>
);
}
}
GithubAvatar.propTypes = {
user: React.PropTypes.object.isRequired,
size: React.PropTypes.number
};
GithubAvatar.defaultProps = {
size: 40
};
| Make changes for es6 migrations | GithubAvatar: Make changes for es6 migrations
See #613
| JSX | mpl-2.0 | mozilla/science.mozilla.org,mozilla/science.mozilla.org | ---
+++
@@ -1,20 +1,22 @@
import React from "react";
-export default React.createClass({
- propTypes: {
- user: React.PropTypes.object.isRequired,
- size: React.PropTypes.number
- },
- getDefaultProps() {
- return {
- size: 40
- };
- },
+export default class GithubAvatar extends React.Component {
+
render() {
+
return (
<a className="github-avatar" href={`https://github.com/${this.props.user.github_username}`}>
<img className="circle" srcSet={`${this.props.user.avatar_url}&s=${this.props.size}, ${this.props.user.avatar_url}&s=${this.props.size*2} 2x`} width={this.props.size} height={this.props.size} alt={this.props.user.name} />
</a>
);
}
-});
+}
+
+GithubAvatar.propTypes = {
+ user: React.PropTypes.object.isRequired,
+ size: React.PropTypes.number
+};
+
+GithubAvatar.defaultProps = {
+ size: 40
+}; |
d7925d2e057375722984268c654621663e57c280 | src/components/AccountView.jsx | src/components/AccountView.jsx | import styles from '../styles/accountView'
import React from 'react'
import PassphraseForm from './PassphraseForm'
import InputText from './InputText'
import InputEmail from './InputEmail'
import SelectBox from './SelectBox'
const AccountView = (props) => {
const { t } = props
// specific to passphrase form
const { onPassphraseSubmit, passphraseErrors, passphraseSubmitting, updateInfos, infosSubmitting, isFetching, instance } = props
if (isFetching) {
return <p>Loading...</p>
}
const attributes = instance.data.attributes
return (
<div className={styles['account-view']}>
<h2>{t('AccountView.title')}</h2>
<InputEmail
inputData='email'
setValue={attributes.email || ''}
updateInfos={updateInfos}
infosSubmitting={infosSubmitting}
t={t}
/>
<InputText
inputData='public_name'
setValue={attributes.public_name || ''}
updateInfos={updateInfos}
infosSubmitting={infosSubmitting}
t={t}
/>
<PassphraseForm
onPassphraseSubmit={onPassphraseSubmit}
currentPassErrors={passphraseErrors || []}
passphraseSubmitting={passphraseSubmitting}
t={t}
/>
<SelectBox
inputData='locale'
setValue={attributes.locale || ''}
updateInfos={updateInfos}
infosSubmitting={infosSubmitting}
t={t}
/>
</div>
)
}
export default AccountView
| import styles from '../styles/accountView'
import React from 'react'
import PassphraseForm from './PassphraseForm'
import InputText from './InputText'
import InputEmail from './InputEmail'
import SelectBox from './SelectBox'
const AccountView = (props) => {
const { t } = props
// specific to passphrase form
const { onPassphraseSubmit, passphraseErrors, passphraseSubmitting, updateInfos, infosSubmitting, isFetching, instance } = props
if (isFetching) {
return <p>Loading...</p>
}
const attributes = instance.data && instance.data.attributes || {}
return (
<div className={styles['account-view']}>
<h2>{t('AccountView.title')}</h2>
<InputEmail
inputData='email'
setValue={attributes.email || ''}
updateInfos={updateInfos}
infosSubmitting={infosSubmitting}
t={t}
/>
<InputText
inputData='public_name'
setValue={attributes.public_name || ''}
updateInfos={updateInfos}
infosSubmitting={infosSubmitting}
t={t}
/>
<PassphraseForm
onPassphraseSubmit={onPassphraseSubmit}
currentPassErrors={passphraseErrors || []}
passphraseSubmitting={passphraseSubmitting}
t={t}
/>
<SelectBox
inputData='locale'
setValue={attributes.locale || ''}
updateInfos={updateInfos}
infosSubmitting={infosSubmitting}
t={t}
/>
</div>
)
}
export default AccountView
| Handle instance const if fetchInfos gives you nothing | [Fix] Handle instance const if fetchInfos gives you nothing
| JSX | agpl-3.0 | y-lohse/cozy-settings,y-lohse/cozy-settings | ---
+++
@@ -15,7 +15,7 @@
return <p>Loading...</p>
}
- const attributes = instance.data.attributes
+ const attributes = instance.data && instance.data.attributes || {}
return (
<div className={styles['account-view']}> |
63a78aeeaa5a8a6f63b823869afa70dfbbca04d5 | src/components/HistoryItem.jsx | src/components/HistoryItem.jsx | let React = require("react");
let moment = require("moment");
let HistoryItem = React.createClass({
statics: {
truncate: function (s) {
let newString = s.substr(0, 100);
if (s.length > 100) {
newString += "..."
}
return newString
},
getTime: function (t) {
return moment(t).format("HH:mm:ss");
}
},
render: function () {
return (
<tr>
<td className="mdl-data-table__cell--non-numeric">{this.constructor.getTime(this.props.visited)}</td>
<td className="mdl-data-table__cell--non-numeric"><img src={"chrome://favicon/" + this.props.url} /></td>
<td className="mdl-data-table__cell--non-numeric">
<a href={this.props.url} target="_blank">{this.constructor.truncate(this.props.title || this.props.url)}</a>
</td>
</tr>
);
}
});
module.exports = HistoryItem; | let React = require("react");
let moment = require("moment");
let HistoryItem = React.createClass({
statics: {
truncate: function (s) {
let newString = s.substr(0, 100);
if (s.length > 100) {
newString += "..."
}
return newString
},
getTime: function (t) {
return moment(t).format("hh:mm:ss A");
}
},
render: function () {
return (
<tr>
<td className="mdl-data-table__cell--non-numeric">{this.constructor.getTime(this.props.visited)}</td>
<td className="mdl-data-table__cell--non-numeric"><img src={"chrome://favicon/" + this.props.url} /></td>
<td className="mdl-data-table__cell--non-numeric">
<a
href={this.props.url}
target="_blank"
className="mdl-badge"
data-badge={this.props.count}>
{this.constructor.truncate(this.props.title || this.props.url)}
</a>
</td>
</tr>
);
}
});
module.exports = HistoryItem; | Update 24-hour time to 12-hour; and added visit count badge | Update 24-hour time to 12-hour; and added visit count badge
- 12-hour time is easier to read (AM / PM)
- Playing around with MDL badge to show total number of times a page has been visited (room for improvement)
| JSX | mit | MrSaints/historyx,MrSaints/historyx | ---
+++
@@ -11,7 +11,7 @@
return newString
},
getTime: function (t) {
- return moment(t).format("HH:mm:ss");
+ return moment(t).format("hh:mm:ss A");
}
},
render: function () {
@@ -20,7 +20,13 @@
<td className="mdl-data-table__cell--non-numeric">{this.constructor.getTime(this.props.visited)}</td>
<td className="mdl-data-table__cell--non-numeric"><img src={"chrome://favicon/" + this.props.url} /></td>
<td className="mdl-data-table__cell--non-numeric">
- <a href={this.props.url} target="_blank">{this.constructor.truncate(this.props.title || this.props.url)}</a>
+ <a
+ href={this.props.url}
+ target="_blank"
+ className="mdl-badge"
+ data-badge={this.props.count}>
+ {this.constructor.truncate(this.props.title || this.props.url)}
+ </a>
</td>
</tr>
); |
b0fe442edfc9fa0ae7b018280db2017cb900849c | app/javascript/lca/components/pages/resourcesPage.jsx | app/javascript/lca/components/pages/resourcesPage.jsx | import React from 'react'
import Typography from 'material-ui/Typography'
import BlockPaper from '../generic/blockPaper.jsx'
export default function ResourcesPage() {
return <BlockPaper>
<Typography variant="headline" gutterBottom>
Resources
</Typography>
<Typography paragraph>
<a href="https://www.reddit.com/r/exalted/comments/4yby39/madletters_charm_cascades_version_3_including/">
Charm Cascades and other resources
</a>
by MadLetter
</Typography>
<Typography paragraph>
<a href="http://forum.theonyxpath.com/forum/main-category/exalted/766048-ex3-i-made-a-1-page-combat-flowchart">
Combat flowchart
</a>
by GivenFlesh
</Typography>
<Typography paragraph>
<a href="http://forum.theonyxpath.com/forum/main-category/exalted/1180122-ex3-social-system-cheat-sheet-and-flowchart">
Social system cheat sheet
</a>
by Redthorn
</Typography>
<Typography paragraph>
<a href="http://forum.theonyxpath.com/forum/main-category/exalted/65025-exalted-3rd-edition-useful-links-and-topics">
'Useful Links' thread on the official Exalted forums
</a>
</Typography>
</BlockPaper>
}
| import React from 'react'
import Typography from 'material-ui/Typography'
import BlockPaper from '../generic/blockPaper.jsx'
export default function ResourcesPage() {
return <BlockPaper>
<Typography variant="headline" gutterBottom>
Resources
</Typography>
<Typography paragraph
component="a" href="https://www.reddit.com/r/exalted/comments/4yby39/madletters_charm_cascades_version_3_including/"
>
Charm Cascades and other resources by MadLetter (On Reddit)
</Typography>
<Typography paragraph
component="a" href="http://forum.theonyxpath.com/forum/main-category/exalted/766048-ex3-i-made-a-1-page-combat-flowchart"
>
Combat flowchart by GivenFlesh (OPP Forums)
</Typography>
<Typography paragraph
component="a" href="http://forum.theonyxpath.com/forum/main-category/exalted/1180122-ex3-social-system-cheat-sheet-and-flowchart"
>
Social system cheat sheet by Redthorn (Opp Forums)
</Typography>
<Typography paragraph
component="a" href="http://forum.theonyxpath.com/forum/main-category/exalted/65025-exalted-3rd-edition-useful-links-and-topics"
>
"Useful Links" thread on the official Exalted forums
</Typography>
</BlockPaper>
}
| Make resources page more readable on dark theme | Make resources page more readable on dark theme
| JSX | agpl-3.0 | makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi | ---
+++
@@ -10,34 +10,28 @@
Resources
</Typography>
- <Typography paragraph>
- <a href="https://www.reddit.com/r/exalted/comments/4yby39/madletters_charm_cascades_version_3_including/">
- Charm Cascades and other resources
- </a>
-
- by MadLetter
+ <Typography paragraph
+ component="a" href="https://www.reddit.com/r/exalted/comments/4yby39/madletters_charm_cascades_version_3_including/"
+ >
+ Charm Cascades and other resources by MadLetter (On Reddit)
</Typography>
- <Typography paragraph>
- <a href="http://forum.theonyxpath.com/forum/main-category/exalted/766048-ex3-i-made-a-1-page-combat-flowchart">
- Combat flowchart
- </a>
-
- by GivenFlesh
+ <Typography paragraph
+ component="a" href="http://forum.theonyxpath.com/forum/main-category/exalted/766048-ex3-i-made-a-1-page-combat-flowchart"
+ >
+ Combat flowchart by GivenFlesh (OPP Forums)
</Typography>
- <Typography paragraph>
- <a href="http://forum.theonyxpath.com/forum/main-category/exalted/1180122-ex3-social-system-cheat-sheet-and-flowchart">
- Social system cheat sheet
- </a>
-
- by Redthorn
+ <Typography paragraph
+ component="a" href="http://forum.theonyxpath.com/forum/main-category/exalted/1180122-ex3-social-system-cheat-sheet-and-flowchart"
+ >
+ Social system cheat sheet by Redthorn (Opp Forums)
</Typography>
- <Typography paragraph>
- <a href="http://forum.theonyxpath.com/forum/main-category/exalted/65025-exalted-3rd-edition-useful-links-and-topics">
- 'Useful Links' thread on the official Exalted forums
- </a>
+ <Typography paragraph
+ component="a" href="http://forum.theonyxpath.com/forum/main-category/exalted/65025-exalted-3rd-edition-useful-links-and-topics"
+ >
+ "Useful Links" thread on the official Exalted forums
</Typography>
</BlockPaper>
} |
77ef01f2bc57af7a83c97c319788a48d97ca97d8 | frontend/src/components/documentation/GetInvolved/GetInvolved.jsx | frontend/src/components/documentation/GetInvolved/GetInvolved.jsx | import React from 'react';
import Topic from './../Topic.jsx';
export default class Welcome extends React.Component {
render () {
return (
<Topic
noExamples={true}>
<h1 id="getInvolved">Get Involved</h1>
<p>
This documentation is all open sourced at <a href="https://github.com/uclapi/apiDocs">https://github.com/uclapi/apiDocs.</a>
</p>
<p>
The full API is open sourced at <a href="https://github.com/uclapi/uclapi">https://github.com/uclapi/uclapi</a>.
</p>
<p>
Any and all contributions are welcome! If you spot a typo or error, feel free to fix it and submit a pull request :)
</p>
</Topic>
)
}
}
| import React from 'react';
import Topic from './../Topic.jsx';
export default class Welcome extends React.Component {
render () {
return (
<Topic
noExamples={true}>
<h1 id="getInvolved">Get Involved</h1>
<p>
The full API including front-end, documentation and the back-end is all open sourced at <a href="https://github.com/uclapi/uclapi">https://github.com/uclapi/uclapi</a>.
</p>
<p>
Any and all contributions are welcome! If you spot a typo or error, feel free to fix it and submit a pull request :)
</p>
</Topic>
)
}
}
| Remove link to now archived github repo | Remove link to now archived github repo
| JSX | mit | uclapi/uclapi,uclapi/uclapi,uclapi/uclapi,uclapi/uclapi | ---
+++
@@ -11,10 +11,7 @@
noExamples={true}>
<h1 id="getInvolved">Get Involved</h1>
<p>
- This documentation is all open sourced at <a href="https://github.com/uclapi/apiDocs">https://github.com/uclapi/apiDocs.</a>
- </p>
- <p>
- The full API is open sourced at <a href="https://github.com/uclapi/uclapi">https://github.com/uclapi/uclapi</a>.
+ The full API including front-end, documentation and the back-end is all open sourced at <a href="https://github.com/uclapi/uclapi">https://github.com/uclapi/uclapi</a>.
</p>
<p>
Any and all contributions are welcome! If you spot a typo or error, feel free to fix it and submit a pull request :) |
0d3132a4e2dc564eea44cfc0851221c02ec4257a | src/options/components/navigation/Nav.jsx | src/options/components/navigation/Nav.jsx | import React from 'react'
import PropTypes from 'prop-types'
import { Link } from 'react-router'
import styles from './styles.css'
const Nav = ({ children }) => {
return (
<nav className={styles.root}>
<ul className={styles.nav}>{children}</ul>
<div className={styles.icon_div}>
<Link to="/overview">
<img
src="/img/memex-logo.png"
className={styles.icon}
/>
</Link>
</div>
</nav>
)
}
Nav.propTypes = {
children: PropTypes.arrayOf(PropTypes.node).isRequired,
}
export default Nav
| import React from 'react'
import PropTypes from 'prop-types'
import styles from './styles.css'
const Nav = ({ children }) => {
return (
<nav className={styles.root}>
<ul className={styles.nav}>{children}</ul>
</nav>
)
}
Nav.propTypes = {
children: PropTypes.arrayOf(PropTypes.node).isRequired,
}
export default Nav
| Remove dupe memex logo in options page side-nav | Remove dupe memex logo in options page side-nav
| JSX | mit | WorldBrain/WebMemex,WorldBrain/WebMemex | ---
+++
@@ -1,6 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
-import { Link } from 'react-router'
import styles from './styles.css'
@@ -8,14 +7,6 @@
return (
<nav className={styles.root}>
<ul className={styles.nav}>{children}</ul>
- <div className={styles.icon_div}>
- <Link to="/overview">
- <img
- src="/img/memex-logo.png"
- className={styles.icon}
- />
- </Link>
- </div>
</nav>
)
} |
d2a98b4a22d8ad7d1e28821909192e03ab14c539 | src/jsx/components/navigation/PrimaryNav.jsx | src/jsx/components/navigation/PrimaryNav.jsx | /**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
<NavGroup className="FlatNav-group">
<a href="https://twitter.com/voxeldavid">Twitter</a>
<a href="https://github.com/vocksel">GitHub</a>
</NavGroup>
</nav>
);
}
}
| /**
* This is the navigation we use at the top of the page.
*
* It's the user's primary source of navigating between pages.
*/
import React, { Component } from 'react';
import NavLink from './NavLink';
import NavGroup from './NavGroup';
export default class PrimaryNav extends Component {
render() {
return (
<nav className="FlatNav FlatNav--main">
<NavGroup className="FlatNav-group">
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
</nav>
);
}
}
| Remove off-site links from the navigation | Remove off-site links from the navigation
These have been worked into the introduction and no longer need to be linked in the nav.
| JSX | mit | vocksel/my-website,VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website | ---
+++
@@ -17,11 +17,6 @@
<NavLink onlyActiveOnIndex={true} to="/">Portfolio</NavLink>
<NavLink to="/about">About</NavLink>
</NavGroup>
-
- <NavGroup className="FlatNav-group">
- <a href="https://twitter.com/voxeldavid">Twitter</a>
- <a href="https://github.com/vocksel">GitHub</a>
- </NavGroup>
</nav>
);
} |
194fede5c006e1bde538e350b8c11643f9621d39 | frontend/src/components/print/picasso/ScheduleEntry.jsx | frontend/src/components/print/picasso/ScheduleEntry.jsx | // eslint-disable-next-line no-unused-vars
import React from 'react'
import pdf from '@react-pdf/renderer'
const { View, Text } = pdf
function scheduleEntryTitle (scheduleEntry) {
return scheduleEntry.activity().category().short + ' ' + scheduleEntry.number + ' ' + scheduleEntry.activity().title
}
const scheduleEntryStyles = {
position: 'absolute',
borderRadius: '2px'
}
function DayColumn ({ scheduleEntry, styles }) {
return <View key={scheduleEntry.id} style={{
left: scheduleEntry.left * 100 + '%',
right: (1.0 - scheduleEntry.left - scheduleEntry.width) * 100 + '%',
backgroundColor: scheduleEntry.activity().category().color,
...scheduleEntryStyles,
...styles
}}>
<Text>{scheduleEntryTitle(scheduleEntry)}</Text>
</View>
}
export default DayColumn
| // eslint-disable-next-line no-unused-vars
import React from 'react'
import pdf from '@react-pdf/renderer'
const { View, Text } = pdf
function scheduleEntryTitle (scheduleEntry) {
return scheduleEntry.activity().category().short + ' ' + scheduleEntry.number + ' ' + scheduleEntry.activity().title
}
const scheduleEntryStyles = {
position: 'absolute',
borderRadius: '2px'
}
function DayColumn ({ scheduleEntry, styles }) {
return <View key={scheduleEntry.id} style={{
left: scheduleEntry.left * 100 + '%',
right: (1.0 - scheduleEntry.left - scheduleEntry.width) * 100 + '%',
backgroundColor: scheduleEntry.activity().category().color,
...scheduleEntryStyles,
...styles
}}>
<View style={{ margin: '5px' }}>
<Text>{scheduleEntryTitle(scheduleEntry)}</Text>
</View>
</View>
}
export default DayColumn
| Add some simulated padding around schedule entry contents | Add some simulated padding around schedule entry contents
But since padding or borders break the height calculation in react-pdf,
we do it using another nested View with a margin.
https://github.com/diegomura/react-pdf/issues/1562
| JSX | agpl-3.0 | ecamp/ecamp3,ecamp/ecamp3,pmattmann/ecamp3,usu/ecamp3,usu/ecamp3,ecamp/ecamp3,pmattmann/ecamp3,usu/ecamp3,ecamp/ecamp3,pmattmann/ecamp3,pmattmann/ecamp3,usu/ecamp3 | ---
+++
@@ -21,7 +21,9 @@
...scheduleEntryStyles,
...styles
}}>
- <Text>{scheduleEntryTitle(scheduleEntry)}</Text>
+ <View style={{ margin: '5px' }}>
+ <Text>{scheduleEntryTitle(scheduleEntry)}</Text>
+ </View>
</View>
}
|
4da4ad8564426df28efc6eef379abac326e6a31c | app/js/components/CircuitCanvas.jsx | app/js/components/CircuitCanvas.jsx | /* @flow */
'use strict';
import React from 'react';
import ReactArt from 'react-art';
var Surface = ReactArt.Surface;
export default class CircuitCanvas extends React.Component {
constructor(props) {
super(props);
}
render() {
const elements = this.props.elements.map(function(element) {
const props = Object.assign({key: element.id}, element.props);
return React.createElement(element.component, props);
});
return (
<div
style={{padding: 0, margin: 0, border: 0}}
onClick={this.props.clickHandler}>
<Surface
width={this.props.width}
height={this.props.height}
>
{elements}
</Surface>
</div>
);
}
}
CircuitCanvas.defaultProps = {
width: 700,
height: 700,
elements: []
};
CircuitCanvas.propTypes = {
width: React.PropTypes.number,
height: React.PropTypes.number,
elements: React.PropTypes.arrayOf(
React.PropTypes.shape({
id: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
]).isRequired,
component: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.func // ReactClass is a function (could do better checking here)
]).isRequired,
props: React.PropTypes.object
}))
};
| /* @flow */
'use strict';
import React from 'react';
import ReactArt from 'react-art';
var Surface = ReactArt.Surface;
export default class CircuitCanvas extends React.Component {
constructor(props) {
super(props);
}
render() {
const elements = this.props.elements.map(function(element) {
const props = Object.assign({key: element.id}, element.props);
return React.createElement(element.component, props);
});
return (
<div
style={{padding: 0, margin: 0, border: 0}}
onClick={this.props.clickHandler}>
<Surface
width={this.props.width}
height={this.props.height}
style={{display: 'block'}}
>
{elements}
</Surface>
</div>
);
}
}
CircuitCanvas.defaultProps = {
width: 700,
height: 700,
elements: []
};
CircuitCanvas.propTypes = {
width: React.PropTypes.number,
height: React.PropTypes.number,
elements: React.PropTypes.arrayOf(
React.PropTypes.shape({
id: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
]).isRequired,
component: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.func // ReactClass is a function (could do better checking here)
]).isRequired,
props: React.PropTypes.object
}))
};
| Stop relying on external CSS to display canvas as block | Stop relying on external CSS to display canvas as block
| JSX | epl-1.0 | circuitsim/circuit-simulator,circuitsim/circuit-simulator,circuitsim/circuit-simulator | ---
+++
@@ -25,6 +25,7 @@
<Surface
width={this.props.width}
height={this.props.height}
+ style={{display: 'block'}}
>
{elements}
</Surface> |
8488ebeb8be1a30bfcb5e8cbdc1887b90583fc32 | app/static/js/mixins/PhotoMixin.jsx | app/static/js/mixins/PhotoMixin.jsx | /** @jsx React.DOM */
define('photo-mixin', ['react'], function(React) {
var PhotoMixin = {
photoUrl: function(type, ext, folder, name) {
// If it's a .gif, just use the original
if (ext == 'gif' && type == 'display') {
ext = 'webm';
postfix = '_display';
} else {
ext = 'jpg';
if (type == 'original') {
postfix = '';
} else {
postfix = '_' + type;
}
}
return 'https://' + Config.s3_bucket + '.s3.amazonaws.com' + '/' + folder + '/' + name + postfix + '.' + ext;
}
};
return PhotoMixin;
});
| /** @jsx React.DOM */
define('photo-mixin', ['react'], function(React) {
var PhotoMixin = {
photoUrl: function(type, ext, folder, name) {
// If it's a .gif, just use the original
if (ext == 'gif' && type == 'display') {
ext = 'webm';
postfix = '_' + type;
} else if (type == 'original') {
postfix = '';
} else {
ext = 'jpg';
postfix = '_' + type;
}
return 'https://' + Config.s3_bucket + '.s3.amazonaws.com' + '/' + folder + '/' + name + postfix + '.' + ext;
}
};
return PhotoMixin;
});
| Fix original url path for lightbox download button | Fix original url path for lightbox download button
| JSX | mit | taeram/ineffable,taeram/ineffable,taeram/ineffable | ---
+++
@@ -7,14 +7,12 @@
// If it's a .gif, just use the original
if (ext == 'gif' && type == 'display') {
ext = 'webm';
- postfix = '_display';
+ postfix = '_' + type;
+ } else if (type == 'original') {
+ postfix = '';
} else {
ext = 'jpg';
- if (type == 'original') {
- postfix = '';
- } else {
- postfix = '_' + type;
- }
+ postfix = '_' + type;
}
return 'https://' + Config.s3_bucket + '.s3.amazonaws.com' + '/' + folder + '/' + name + postfix + '.' + ext; |
c7749438f1df10f7dce43e831c625c7cdb2ecf57 | app/jsx/files/FilesUsage.jsx | app/jsx/files/FilesUsage.jsx | define([
'react',
'i18n!react_files',
'compiled/react_files/components/FilesUsage',
'compiled/util/friendlyBytes',
'jsx/shared/ProgressBar'
], function (React, I18n, FilesUsage, friendlyBytes, ProgressBar) {
FilesUsage.render = function () {
if (this.state) {
var percentUsed = Math.round(this.state.quota_used / this.state.quota * 100);
var label = I18n.t('%{percentUsed}% of %{bytesAvailable} used', {
percentUsed: percentUsed,
bytesAvailable: friendlyBytes(this.state.quota)
});
return (
<div className='grid-row ef-quota-usage'>
<div className='col-xs-5'>
<ProgressBar progress={percentUsed} aria-label={label} />
</div>
<div className='col-xs-7' style={{paddingLeft: '0px'}} aria-hidden={true}>
{label}
</div>
</div>
);
} else {
return <div />;
}
};
return React.createClass(FilesUsage);
});
| define([
'react',
'i18n!react_files',
'compiled/react_files/components/FilesUsage',
'compiled/util/friendlyBytes',
], function (React, I18n, FilesUsage, friendlyBytes) {
FilesUsage.render = function () {
if (this.state) {
var percentUsed = Math.round(this.state.quota_used / this.state.quota * 100);
var label = I18n.t('%{percentUsed}% of %{bytesAvailable} used', {
percentUsed: percentUsed,
bytesAvailable: friendlyBytes(this.state.quota)
});
const srLabel = I18n.t('Files Quota: %{percentUsed}% of %{bytesAvailable} used', {
percentUsed: percentUsed,
bytesAvailable: friendlyBytes(this.state.quota)
});
return (
<div className='grid-row ef-quota-usage'>
<div className='col-xs-5'>
<div ref='container' className='progress-bar__bar-container' aria-hidden={true}>
<div
ref='bar'
className='progress-bar__bar'
style={{
width: Math.min(percentUsed, 100) + '%'
}}
/>
</div>
</div>
<div className='col-xs-7' style={{paddingLeft: '0px'}} aria-hidden={true}>
{label}
</div>
<div className='screenreader-only'>{srLabel}</div>
</div>
);
} else {
return <div />;
}
};
return React.createClass(FilesUsage);
});
| Remove aria progress bar information from files usage | [a11y] Remove aria progress bar information from files usage
This takes out the progress bar a11y stuff because the bar itself
is not an actual progress bar, but is rather a usage indicator.
It hides everything from screenreaders and provides them with an
explanatory bit of text instead.
closes CNVS-25695
Test Plan:
- Go to Files
- Using a screenreader go through the page to the files usage
indicator.
- The bar should not appear at all for the screenreader.
- The screenreader should read "Files Quoata: XX% of XXX MB used"
Change-Id: Ibb84ffc3c154b4a81ca8d85bf446d546175909b3
Reviewed-on: https://gerrit.instructure.com/68618
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <[email protected]>
QA-Review: Clare Strong <[email protected]>
Product-Review: Clay Diffrient <[email protected]>
| JSX | agpl-3.0 | venturehive/canvas-lms,grahamb/canvas-lms,SwinburneOnline/canvas-lms,grahamb/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms,fronteerio/canvas-lms,HotChalk/canvas-lms,sfu/canvas-lms,djbender/canvas-lms,dgynn/canvas-lms,sfu/canvas-lms,SwinburneOnline/canvas-lms,venturehive/canvas-lms,redconfetti/canvas-lms,instructure/canvas-lms,djbender/canvas-lms,roxolan/canvas-lms,djbender/canvas-lms,fronteerio/canvas-lms,SwinburneOnline/canvas-lms,dgynn/canvas-lms,matematikk-mooc/canvas-lms,fronteerio/canvas-lms,sfu/canvas-lms,fronteerio/canvas-lms,redconfetti/canvas-lms,dgynn/canvas-lms,venturehive/canvas-lms,instructure/canvas-lms,instructure/canvas-lms,djbender/canvas-lms,matematikk-mooc/canvas-lms,instructure/canvas-lms,sfu/canvas-lms,instructure/canvas-lms,instructure/canvas-lms,dgynn/canvas-lms,grahamb/canvas-lms,instructure/canvas-lms,SwinburneOnline/canvas-lms,sfu/canvas-lms,grahamb/canvas-lms,HotChalk/canvas-lms,sfu/canvas-lms,matematikk-mooc/canvas-lms,roxolan/canvas-lms,matematikk-mooc/canvas-lms,redconfetti/canvas-lms,roxolan/canvas-lms,grahamb/canvas-lms,HotChalk/canvas-lms,redconfetti/canvas-lms,venturehive/canvas-lms,HotChalk/canvas-lms | ---
+++
@@ -3,8 +3,7 @@
'i18n!react_files',
'compiled/react_files/components/FilesUsage',
'compiled/util/friendlyBytes',
- 'jsx/shared/ProgressBar'
-], function (React, I18n, FilesUsage, friendlyBytes, ProgressBar) {
+], function (React, I18n, FilesUsage, friendlyBytes) {
FilesUsage.render = function () {
if (this.state) {
@@ -13,14 +12,27 @@
percentUsed: percentUsed,
bytesAvailable: friendlyBytes(this.state.quota)
});
+ const srLabel = I18n.t('Files Quota: %{percentUsed}% of %{bytesAvailable} used', {
+ percentUsed: percentUsed,
+ bytesAvailable: friendlyBytes(this.state.quota)
+ });
return (
<div className='grid-row ef-quota-usage'>
<div className='col-xs-5'>
- <ProgressBar progress={percentUsed} aria-label={label} />
+ <div ref='container' className='progress-bar__bar-container' aria-hidden={true}>
+ <div
+ ref='bar'
+ className='progress-bar__bar'
+ style={{
+ width: Math.min(percentUsed, 100) + '%'
+ }}
+ />
+ </div>
</div>
<div className='col-xs-7' style={{paddingLeft: '0px'}} aria-hidden={true}>
{label}
</div>
+ <div className='screenreader-only'>{srLabel}</div>
</div>
);
} else { |
37f2fe1a7174adf2df3832522f207e32833ee620 | app/assets/javascripts/components/SharedComponents/CommentBox.js.jsx | app/assets/javascripts/components/SharedComponents/CommentBox.js.jsx | var CommentBox = React.createClass({
handleSubmit: function(e){
e.preventDefault();
var path = this.props.path
var data = React.findDOMNode(this.refs.comment).value
new_comment = App.jacobs_request('POST', path, data)
$('.comments').append(
"<div class='comment'>"+
"<a class='avatar' href='/users/"+ this.props.current_user.id+"'><img src="+this.props.current_user.avatar_url+" /></a>"+
"<div class='content'>"+
"<a class='author' href='/users/"+ this.props.current_user.id+"'> "+this.props.current_user.first_name+" "+this.props.current_user.last_name+" </a>"+
"<div class='text'>"+
data+
"</div>"+
"</div>"+
"</div>"
)
React.findDOMNode(this.refs.comment).value = ''
},
render: function(){
return (
<div id="comment_box" className="comment_box" ref="wrapper">
<div id="added_comments">
</div>
<form onSubmit={this.handleSubmit}>
<textarea rows="5" cols="40" ref="comment"></textarea><br/>
<button className="ui primary button" type="submit">Post a reply</button>
</form>
</div>
)
}
})
| var CommentBox = React.createClass({
handleSubmit: function(e){
e.preventDefault();
var path = this.props.path
var data = React.findDOMNode(this.refs.comment).value
if (data != ''){
new_comment = App.jacobs_request('POST', path, data)
$('.comments').append(
"<div class='comment'>"+
"<a class='avatar' href='/users/"+ this.props.current_user.id+"'><img src="+this.props.current_user.avatar_url+" /></a>"+
"<div class='content'>"+
"<a class='author' href='/users/"+ this.props.current_user.id+"'> "+this.props.current_user.first_name+" "+this.props.current_user.last_name+" </a>"+
"<div class='text'>"+
data+
"</div>"+
"</div>"+
"</div>"
)
}
React.findDOMNode(this.refs.comment).value = ''
},
render: function(){
return (
<div id="comment_box" className="comment_box" ref="wrapper">
<div id="added_comments">
</div>
<form onSubmit={this.handleSubmit}>
<textarea rows="5" cols="40" ref="comment"></textarea><br/>
<button className="ui primary button" type="submit">Post a reply</button>
</form>
</div>
)
}
})
| Fix bug where blank comments would stack strangely | Fix bug where blank comments would stack strangely
| JSX | mit | ShadyLogic/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter,TimCannady/fixstarter,TimCannady/fixstarter,ShadyLogic/fixstarter | ---
+++
@@ -4,19 +4,22 @@
e.preventDefault();
var path = this.props.path
var data = React.findDOMNode(this.refs.comment).value
- new_comment = App.jacobs_request('POST', path, data)
- $('.comments').append(
- "<div class='comment'>"+
- "<a class='avatar' href='/users/"+ this.props.current_user.id+"'><img src="+this.props.current_user.avatar_url+" /></a>"+
- "<div class='content'>"+
- "<a class='author' href='/users/"+ this.props.current_user.id+"'> "+this.props.current_user.first_name+" "+this.props.current_user.last_name+" </a>"+
- "<div class='text'>"+
- data+
+
+ if (data != ''){
+ new_comment = App.jacobs_request('POST', path, data)
+ $('.comments').append(
+ "<div class='comment'>"+
+ "<a class='avatar' href='/users/"+ this.props.current_user.id+"'><img src="+this.props.current_user.avatar_url+" /></a>"+
+ "<div class='content'>"+
+ "<a class='author' href='/users/"+ this.props.current_user.id+"'> "+this.props.current_user.first_name+" "+this.props.current_user.last_name+" </a>"+
+ "<div class='text'>"+
+ data+
+ "</div>"+
"</div>"+
- "</div>"+
- "</div>"
- )
+ "</div>"
+ )
+ }
React.findDOMNode(this.refs.comment).value = ''
}, |
2dcfe5ec092102256d43a496b3b01fafa7a98358 | packages/lesswrong/components/questions/PostsPageQuestionContent.jsx | packages/lesswrong/components/questions/PostsPageQuestionContent.jsx | import { Components, registerComponent } from 'meteor/vulcan:core';
import React from 'react';
import PropTypes from 'prop-types';
import withUser from '../common/withUser'
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';
const PostsPageQuestionContent = ({post, currentUser, refetch}) => {
const { AnswersList, NewAnswerCommentQuestionForm, CantCommentExplanation, RelatedQuestionsList } = Components
return (
<div>
{(!currentUser || Users.isAllowedToComment(currentUser, post)) && <NewAnswerCommentQuestionForm post={post} refetch={refetch} />}
{currentUser && !Users.isAllowedToComment(currentUser, post) &&
<CantCommentExplanation post={post}/>
}
<AnswersList terms={{view: "questionAnswers", postId: post._id}} post={post}/>
<RelatedQuestionsList post={post} />
</div>
)
};
PostsPageQuestionContent.propTypes = {
post: PropTypes.object.isRequired,
};
registerComponent('PostsPageQuestionContent', PostsPageQuestionContent, withUser, withErrorBoundary);
| import { Components, registerComponent } from 'meteor/vulcan:core';
import React from 'react';
import PropTypes from 'prop-types';
import withUser from '../common/withUser'
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';
const MAX_ANSWERS_QUERIED = 100
const PostsPageQuestionContent = ({post, currentUser, refetch}) => {
const { AnswersList, NewAnswerCommentQuestionForm, CantCommentExplanation, RelatedQuestionsList } = Components
return (
<div>
{(!currentUser || Users.isAllowedToComment(currentUser, post)) && <NewAnswerCommentQuestionForm post={post} refetch={refetch} />}
{currentUser && !Users.isAllowedToComment(currentUser, post) &&
<CantCommentExplanation post={post}/>
}
<AnswersList terms={{view: "questionAnswers", postId: post._id, limit: MAX_ANSWERS_QUERIED}} post={post}/>
<RelatedQuestionsList post={post} />
</div>
)
};
PostsPageQuestionContent.propTypes = {
post: PropTypes.object.isRequired,
};
registerComponent('PostsPageQuestionContent', PostsPageQuestionContent, withUser, withErrorBoundary);
| Increase number of answers rendered by default | Increase number of answers rendered by default
| JSX | mit | Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2 | ---
+++
@@ -4,6 +4,8 @@
import withUser from '../common/withUser'
import Users from 'meteor/vulcan:users';
import withErrorBoundary from '../common/withErrorBoundary';
+
+const MAX_ANSWERS_QUERIED = 100
const PostsPageQuestionContent = ({post, currentUser, refetch}) => {
const { AnswersList, NewAnswerCommentQuestionForm, CantCommentExplanation, RelatedQuestionsList } = Components
@@ -13,7 +15,7 @@
{currentUser && !Users.isAllowedToComment(currentUser, post) &&
<CantCommentExplanation post={post}/>
}
- <AnswersList terms={{view: "questionAnswers", postId: post._id}} post={post}/>
+ <AnswersList terms={{view: "questionAnswers", postId: post._id, limit: MAX_ANSWERS_QUERIED}} post={post}/>
<RelatedQuestionsList post={post} />
</div>
) |
cfff8dee23786c48b0f7c5e45d279aa3176d22dc | coin-selfservice-standalone/src/javascripts/components/main.jsx | coin-selfservice-standalone/src/javascripts/components/main.jsx | /** @jsx React.DOM */
App.Components.Main = React.createClass({
render: function () {
return (
<div>
<div className="l-header">
<App.Components.Header />
<App.Components.Navigation active={this.props.page.props.key} />
</div>
{this.props.page}
<App.Components.Footer />
</div>
);
}
});
| /** @jsx React.DOM */
App.Components.Main = React.createClass({
render: function () {
return (
<div>
<div className="l-header">
<App.Components.Header />
{this.renderNavigation()}
</div>
{this.props.page}
<App.Components.Footer />
</div>
);
},
renderNavigation: function() {
if (!App.currentUser.superUser) {
return <App.Components.Navigation active={this.props.page.props.key} />;
}
}
});
| Make the navigation bar conditional | Make the navigation bar conditional
Only render the navigation bar when the current user is a super user. | JSX | apache-2.0 | OpenConext/OpenConext-dashboard,cybera/OpenConext-dashboard,cybera/OpenConext-dashboard,OpenConext/OpenConext-dashboard,OpenConext/OpenConext-dashboard,cybera/OpenConext-dashboard,cybera/OpenConext-dashboard,OpenConext/OpenConext-dashboard | ---
+++
@@ -6,7 +6,7 @@
<div>
<div className="l-header">
<App.Components.Header />
- <App.Components.Navigation active={this.props.page.props.key} />
+ {this.renderNavigation()}
</div>
{this.props.page}
@@ -14,5 +14,11 @@
<App.Components.Footer />
</div>
);
+ },
+
+ renderNavigation: function() {
+ if (!App.currentUser.superUser) {
+ return <App.Components.Navigation active={this.props.page.props.key} />;
+ }
}
}); |
287844003fc2b55e7bc207788c7bad6a0ce25fba | 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 className="row">
<div className="col-md-9">
<a href={website}><h3>{organization}</h3></a>
<p>{description}</p>
<span>Contact: </span>
<p>Phone: {phone}</p>
<p>Address: {address}</p>
</div>
</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 className="row">
<div className="col-md-9">
<a href={website}><h3>{organization}</h3></a>
<p>{description}</p>
<p>Contact: </p>
<p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
<p><span className="glyphicon glyphicon-home"></span> Address: {address}</p>
</div>
</div>
)
}
}
| Add home icon; need to adjust size still | Add home icon; need to adjust size still
| JSX | mit | codeforsanjose/renters-rights,codeforsanjose/renters-rights,codeforsanjose/renters-rights | ---
+++
@@ -21,9 +21,9 @@
<div className="col-md-9">
<a href={website}><h3>{organization}</h3></a>
<p>{description}</p>
- <span>Contact: </span>
- <p>Phone: {phone}</p>
- <p>Address: {address}</p>
+ <p>Contact: </p>
+ <p><span className="glyphicon glyphicon-earphone"></span> Phone: {phone}</p>
+ <p><span className="glyphicon glyphicon-home"></span> Address: {address}</p>
</div>
</div>
) |
edca716c7a948281304936c04bcd76e85515c0e5 | app/javascript/app/components/tools-nav/tools-nav-component.jsx | app/javascript/app/components/tools-nav/tools-nav-component.jsx | import React from 'react';
import { NavLink } from 'react-router-dom';
import DownloadMenu from 'components/download-menu';
import ShareMenu from 'components/share-menu';
import cx from 'classnames';
import PropTypes from 'prop-types';
import styles from './tools-nav-styles.scss';
const ToolsNav = ({ className, reverse }) => (
<div className={cx(styles.toolsNav, className)}>
<NavLink
className={cx(styles.link, styles.myCwButton)}
activeClassName={styles.linkActive}
to="/my-climate-watch"
title="My climate watch"
>
MY CW
</NavLink>
<DownloadMenu className={styles.downloadButton} reverse={reverse} />
<ShareMenu className={styles.shareButton} reverse={reverse} />
</div>
);
ToolsNav.propTypes = {
className: PropTypes.string,
reverse: PropTypes.bool
};
ToolsNav.defaultProps = {
reverse: false
};
export default ToolsNav;
| import React from 'react';
import { NavLink } from 'react-router-dom';
import DownloadMenu from 'components/download-menu';
import ShareMenu from 'components/share-menu';
import cx from 'classnames';
import PropTypes from 'prop-types';
import styles from './tools-nav-styles.scss';
const FEATURE_MY_CLIMATEWATCH = process.env.FEATURE_MY_CLIMATEWATCH === 'true';
const mycwLinkConfig = FEATURE_MY_CLIMATEWATCH
? { to: '/my-climate-watch', title: 'My climate watch' }
: { to: '', disabled: true, title: 'Coming soon' };
const ToolsNav = ({ className, reverse }) => (
<div className={cx(styles.toolsNav, className)}>
<NavLink
className={cx(styles.link, styles.myCwButton, {
[styles.disabled]: mycwLinkConfig.disabled
})}
activeClassName={styles.linkActive}
{...mycwLinkConfig}
>
MY CW
</NavLink>
<DownloadMenu className={styles.downloadButton} reverse={reverse} />
<ShareMenu className={styles.shareButton} reverse={reverse} />
</div>
);
ToolsNav.propTypes = {
className: PropTypes.string,
reverse: PropTypes.bool
};
ToolsNav.defaultProps = {
reverse: false
};
export default ToolsNav;
| Update toolsnav with flag logic | Update toolsnav with flag logic
| JSX | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -7,13 +7,19 @@
import styles from './tools-nav-styles.scss';
+const FEATURE_MY_CLIMATEWATCH = process.env.FEATURE_MY_CLIMATEWATCH === 'true';
+const mycwLinkConfig = FEATURE_MY_CLIMATEWATCH
+ ? { to: '/my-climate-watch', title: 'My climate watch' }
+ : { to: '', disabled: true, title: 'Coming soon' };
+
const ToolsNav = ({ className, reverse }) => (
<div className={cx(styles.toolsNav, className)}>
<NavLink
- className={cx(styles.link, styles.myCwButton)}
+ className={cx(styles.link, styles.myCwButton, {
+ [styles.disabled]: mycwLinkConfig.disabled
+ })}
activeClassName={styles.linkActive}
- to="/my-climate-watch"
- title="My climate watch"
+ {...mycwLinkConfig}
>
MY CW
</NavLink> |
4af84bdbe0e7a42025cb0f1bd275a688314a4ee2 | 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;
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);
| import React, {Component} from 'react';
// import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
class ColorPalette extends Component {
buildPalette() {
const roomSelectedName = this.props.roomSelected;
const room = this.props.rooms[roomSelectedName];
const color = room && room.color && room.color.hex;
let rectWidth = 100;
return <rect x="0" y="0" fill={color || 'white'} width={rectWidth} height="50" />
}
render() {
return (
<div>
<svg width={100}>
<g>
{this.buildPalette()}
</g>
</svg>
</div>
)
}
};
function mapStateToProps({ rooms, roomSelected }) {
return { rooms, roomSelected };
}
// function mapDispatchToProps(dispatch) {
// return bindActionCreators({selectRoom}, dispatch);
// }
export default connect(mapStateToProps)(ColorPalette);
| Fix error thrown when loading a room page directly | fix: Fix error thrown when loading a room page directly
When loading a specific page from its url (e.g., 'http://localhost:3000/furniture/den'), an error would be thrown by ColorPalette. Now that doesn't happen.
| JSX | mit | Nailed-it/Designify,Nailed-it/Designify | ---
+++
@@ -4,21 +4,19 @@
class ColorPalette extends Component {
buildPalette() {
- let roomSelected = this.props.roomSelected;
- const color = this.props.rooms[roomSelected].color && this.props.rooms[roomSelected].color.hex;
+ const roomSelectedName = this.props.roomSelected;
+ const room = this.props.rooms[roomSelectedName];
+ const color = room && room.color && room.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}>
+ <svg width={100}>
<g>
- {rects}
+ {this.buildPalette()}
</g>
</svg>
</div> |
bb9c2c54b6c790046663c48b5600a3dfe54e5b34 | client/app/bundles/Events/components/Event.jsx | client/app/bundles/Events/components/Event.jsx | import moment from 'moment';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
export default class Event extends Component {
organizerName() {
const attributes = this.props.event.attributes;
if (attributes.organizer)
return attributes.organizer.name;
}
locationName() {
const location = this.props.event.attributes.location;
if (location)
return `${location.venue}`;
}
render() {
const { attributes, id } = this.props.event;
return (
<div className='list-group-item'>
<div className='col-8'>
<Link to={`/events/${id}`}> {attributes.title} </Link>
<span> {` at ${this.locationName() || 'Event Location' }`} </span>
<span> {` hosted by ${this.organizerName() || 'Event Organizer'}`} </span>
</div>
<div className='col-2'>
{`${attributes['rsvp-count']} RSVPs`}
</div>
<div className='col-2'>
<Link className='event_list-toggle' to={`/events/${id}/attendances`}>
<button className='btn btn-primary'>
RSVPs
</button>
</Link>
</div>
</div>
);
}
}
| import moment from 'moment';
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
export default class Event extends Component {
organizerName() {
const attributes = this.props.event.attributes;
if (attributes.organizer)
return attributes.organizer.name;
}
locationName() {
const location = this.props.event.attributes.location;
if (location)
return `${location.venue}`;
}
render() {
const { attributes, id } = this.props.event;
return (
<div className='list-group-item'>
<div className='col-8'>
<Link to={`/events/${id}`}> {attributes.name || attributes.title} </Link>
<span> {` at ${this.locationName() || 'Event Location' }`} </span>
<span> {` hosted by ${this.organizerName() || 'Event Organizer'}`} </span>
</div>
<div className='col-2'>
{`${attributes['rsvp-count']} RSVPs`}
</div>
<div className='col-2'>
<Link className='event_list-toggle' to={`/events/${id}/attendances`}>
<button className='btn btn-primary'>
RSVPs
</button>
</Link>
</div>
</div>
);
}
}
| Use event name in admin page. | Use event name in admin page.
| JSX | agpl-3.0 | agustinrhcp/advocacycommons,advocacycommons/advocacycommons,agustinrhcp/advocacycommons,matinieves/advocacycommons,matinieves/advocacycommons,advocacycommons/advocacycommons,advocacycommons/advocacycommons,matinieves/advocacycommons,agustinrhcp/advocacycommons | ---
+++
@@ -24,7 +24,7 @@
return (
<div className='list-group-item'>
<div className='col-8'>
- <Link to={`/events/${id}`}> {attributes.title} </Link>
+ <Link to={`/events/${id}`}> {attributes.name || attributes.title} </Link>
<span> {` at ${this.locationName() || 'Event Location' }`} </span>
<span> {` hosted by ${this.organizerName() || 'Event Organizer'}`} </span>
</div> |
b9798ec5a329bf5fa735856e5e9f0cc250d151e1 | app/index.jsx | app/index.jsx | import App from 'components/app';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<App />,
document.getElementById('app')
);
| import App from 'components/App';
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<App />,
document.getElementById('app')
);
| Switch the pascalcase for component file names | Switch the pascalcase for component file names
| JSX | mit | ryansobol/with-react,ryansobol/with-react | ---
+++
@@ -1,4 +1,4 @@
-import App from 'components/app';
+import App from 'components/App';
import React from 'react';
import ReactDOM from 'react-dom';
|
de7eb2341a582a3354496eef7e76593e7320108f | app/assets/javascripts/components/actions/timelines.jsx | app/assets/javascripts/components/actions/timelines.jsx | export const TIMELINE_SET = 'TIMELINE_SET';
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
export function setTimeline(timeline, statuses) {
return {
type: TIMELINE_SET,
timeline: timeline,
statuses: statuses
};
}
export function updateTimeline(timeline, status) {
return {
type: TIMELINE_UPDATE,
timeline: timeline,
status: status
};
}
export function deleteFromTimeline(id) {
return {
type: TIMELINE_DELETE,
id: id
};
}
| export const TIMELINE_SET = 'TIMELINE_SET';
export const TIMELINE_UPDATE = 'TIMELINE_UPDATE';
export const TIMELINE_DELETE = 'TIMELINE_DELETE';
export function setTimeline(timeline, statuses) {
return {
type: TIMELINE_SET,
timeline: timeline,
statuses: statuses
};
}
export function updateTimeline(timeline, status) {
return {
type: TIMELINE_UPDATE,
timeline: timeline,
status: status
};
}
export function deleteFromTimelines(id) {
return {
type: TIMELINE_DELETE,
id: id
};
}
| Fix typo in deleteFromTimelines action creator | Fix typo in deleteFromTimelines action creator | JSX | agpl-3.0 | librize/mastodon,hyuki0000/mastodon,rekif/mastodon,Kirishima21/mastodon,Arukas/mastodon,salvadorpla/mastodon,unarist/mastodon,TootCat/mastodon,nonoz/mastodon,rainyday/mastodon,h-izumi/mastodon,kirakiratter/mastodon,res-ac/mstdn.res.ac,ykzts/mastodon,hyuki0000/mastodon,NS-Kazuki/mastodon,salvadorpla/mastodon,tcitworld/mastodon,foozmeat/mastodon,TheInventrix/mastodon,mhffdq/mastodon,dwango/mastodon,dwango/mastodon,esetomo/mastodon,ikuradon/mastodon,honpya/taketodon,Craftodon/Craftodon,amazedkoumei/mastodon,abcang/mastodon,dunn/mastodon,salvadorpla/mastodon,dissolve/mastodon,PlantsNetwork/mastodon,ikuradon/mastodon,mimumemo/mastodon,TheInventrix/mastodon,h3zjp/mastodon,salvadorpla/mastodon,rekif/mastodon,RobertRence/Mastodon,lindwurm/mastodon,summoners-riftodon/mastodon,5thfloor/ichiji-social,kibousoft/mastodon,bureaucracy/mastodon,RobertRence/Mastodon,ebihara99999/mastodon,TheInventrix/mastodon,tootsuite/mastodon,summoners-riftodon/mastodon,KnzkDev/mastodon,tootcafe/mastodon,pso2club/mastodon,RobertRence/Mastodon,masarakki/mastodon,tootcafe/mastodon,heropunch/mastodon-ce,masto-donte-com-br/mastodon,kirakiratter/mastodon,8796n/mastodon,Toootim/mastodon,Kyon0000/mastodon,alimony/mastodon,gol-cha/mastodon,SerCom-KC/mastodon,glitch-soc/mastodon,verniy6462/mastodon,pinfort/mastodon,summoners-riftodon/mastodon,MastodonCloud/mastodon,d6rkaiz/mastodon,developer-mstdn18/mstdn18,riku6460/chikuwagoddon,thor-the-norseman/mastodon,mosaxiv/mastodon,tri-star/mastodon,masarakki/mastodon,tateisu/mastodon,lynlynlynx/mastodon,sylph-sin-tyaku/mastodon,5thfloor/ichiji-social,robotstart/mastodon,mecab/mastodon,heropunch/mastodon-ce,cobodo/mastodon,blackle/mastodon,clworld/mastodon,pixiv/mastodon,narabo/mastodon,mimumemo/mastodon,foozmeat/mastodon,cybrespace/mastodon,Ryanaka/mastodon,Craftodon/Craftodon,tootsuite/mastodon,8796n/mastodon,narabo/mastodon,primenumber/mastodon,Kirishima21/mastodon,Kyon0000/mastodon,MitarashiDango/mastodon,abcang/mastodon,pinfort/mastodon,ykzts/mastodon,kibousoft/mastodon,unarist/mastodon,palon7/mastodon,rutan/mastodon,theoria24/mastodon,ebihara99999/mastodon,tateisu/mastodon,Chronister/mastodon,sinsoku/mastodon,yukimochi/mastodon,rainyday/mastodon,moeism/mastodon,mhffdq/mastodon,Nyoho/mastodon,hyuki0000/mastodon,hugogameiro/mastodon,PlantsNetwork/mastodon,vahnj/mastodon,pso2club/mastodon,increments/mastodon,koteitan/googoldon,koteitan/googoldon,ineffyble/mastodon,MitarashiDango/mastodon,tcitworld/mastodon,danhunsaker/mastodon,Gargron/mastodon,librize/mastodon,kirakiratter/mastodon,pointlessone/mastodon,koteitan/googoldon,lindwurm/mastodon,increments/mastodon,esetomo/mastodon,rekif/mastodon,increments/mastodon,res-ac/mstdn.res.ac,3846masa/mastodon,TootCat/mastodon,gol-cha/mastodon,glitch-soc/mastodon,Monappy/mastodon,hugogameiro/mastodon,verniy6462/mastodon,mimumemo/mastodon,honpya/taketodon,Arukas/mastodon,pfm-eyesightjp/mastodon,Gargron/mastodon,ambition-vietnam/mastodon,cybrespace/mastodon,vahnj/mastodon,haleyashleypraesent/ProjectPrionosuchus,ashfurrow/mastodon,havicon/mastodon,yi0713/mastodon,im-in-space/mastodon,Toootim/mastodon,Chronister/mastodon,ikuradon/mastodon,Nyoho/mastodon,thnkrs/mastodon,mimumemo/mastodon,haleyashleypraesent/ProjectPrionosuchus,ykzts/mastodon,musashino205/mastodon,hugogameiro/mastodon,YuyaYokosuka/mastodon_animeclub,tri-star/mastodon,dissolve/mastodon,lindwurm/mastodon,tootcafe/mastodon,hugogameiro/mastodon,imomix/mastodon,nclm/mastodon,anon5r/mastonon,esetomo/mastodon,palon7/mastodon,KnzkDev/mastodon,ambition-vietnam/mastodon,ineffyble/mastodon,corzntin/mastodon,pixiv/mastodon,cybrespace/mastodon,WitchesTown/mastodon,Toootim/mastodon,WitchesTown/mastodon,musashino205/mastodon,rutan/mastodon,sylph-sin-tyaku/mastodon,amazedkoumei/mastodon,amazedkoumei/mastodon,moeism/mastodon,TheInventrix/mastodon,mstdn-jp/mastodon,im-in-space/mastodon,tri-star/mastodon,cobodo/mastodon,d6rkaiz/mastodon,pixiv/mastodon,koteitan/googoldon,pixiv/mastodon,primenumber/mastodon,thnkrs/mastodon,infinimatix/infinimatix.net,jukper/mastodon,nclm/mastodon,tootcafe/mastodon,Monappy/mastodon,Kyon0000/mastodon,Toootim/mastodon,lynlynlynx/mastodon,heropunch/mastodon-ce,thor-the-norseman/mastodon,Ryanaka/mastodon,saggel/mastodon,mosaxiv/mastodon,summoners-riftodon/mastodon,librize/mastodon,imas/mastodon,rainyday/mastodon,infinimatix/infinimatix.net,gol-cha/mastodon,SerCom-KC/mastodon,palon7/mastodon,verniy6462/mastodon,vahnj/mastodon,h3zjp/mastodon,bureaucracy/mastodon,dwango/mastodon,Nyoho/mastodon,haleyashleypraesent/ProjectPrionosuchus,koba-lab/mastodon,blackle/mastodon,kazh98/social.arnip.org,koba-lab/mastodon,yi0713/mastodon,ebihara99999/mastodon,palon7/mastodon,robotstart/mastodon,jukper/mastodon,yukimochi/mastodon,SerCom-KC/mastodon,maa123/mastodon,alarky/mastodon,nonoz/mastodon,nonoz/mastodon,masarakki/mastodon,theoria24/mastodon,jukper/mastodon,masto-donte-com-br/mastodon,theoria24/mastodon,sylph-sin-tyaku/mastodon,saggel/mastodon,pfm-eyesightjp/mastodon,clworld/mastodon,primenumber/mastodon,hyuki0000/mastodon,dunn/mastodon,blackle/mastodon,cobodo/mastodon,kazh98/social.arnip.org,mecab/mastodon,kibousoft/mastodon,primenumber/mastodon,blackle/mastodon,NS-Kazuki/mastodon,alarky/mastodon,nclm/mastodon,HogeTatu/mastodon,koba-lab/mastodon,bureaucracy/mastodon,pfm-eyesightjp/mastodon,5thfloor/ichiji-social,Kirishima21/mastodon,alarky/mastodon,TheInventrix/mastodon,3846masa/mastodon,Craftodon/Craftodon,verniy6462/mastodon,MitarashiDango/mastodon,im-in-space/mastodon,danhunsaker/mastodon,mecab/mastodon,alimony/mastodon,3846masa/mastodon,Arukas/mastodon,res-ac/mstdn.res.ac,anon5r/mastonon,d6rkaiz/mastodon,havicon/mastodon,kazh98/social.arnip.org,haleyashleypraesent/ProjectPrionosuchus,pfm-eyesightjp/mastodon,TootCat/mastodon,foozmeat/mastodon,ineffyble/mastodon,KnzkDev/mastodon,kagucho/mastodon,corzntin/mastodon,HogeTatu/mastodon,codl/mastodon,Ryanaka/mastodon,tootsuite/mastodon,mhffdq/mastodon,havicon/mastodon,kazh98/social.arnip.org,saggel/mastodon,maa123/mastodon,WitchesTown/mastodon,d6rkaiz/mastodon,YuyaYokosuka/mastodon_animeclub,YuyaYokosuka/mastodon_animeclub,kagucho/mastodon,WitchesTown/mastodon,mosaxiv/mastodon,NS-Kazuki/mastodon,maa123/mastodon,esetomo/mastodon,increments/mastodon,unarist/mastodon,vahnj/mastodon,alarky/mastodon,Gargron/mastodon,ambition-vietnam/mastodon,honpya/taketodon,imomix/mastodon,corzntin/mastodon,SerCom-KC/mastodon,cobodo/mastodon,ashfurrow/mastodon,rutan/mastodon,mstdn-jp/mastodon,thor-the-norseman/mastodon,dunn/mastodon,Kirishima21/mastodon,vahnj/mastodon,TootCat/mastodon,abcang/mastodon,sinsoku/mastodon,Ryanaka/mastodon,dwango/mastodon,codl/mastodon,MastodonCloud/mastodon,Monappy/mastodon,KnzkDev/mastodon,pinfort/mastodon,foozmeat/mastodon,lindwurm/mastodon,kibousoft/mastodon,rutan/mastodon,h3zjp/mastodon,Arukas/mastodon,mstdn-jp/mastodon,masto-donte-com-br/mastodon,PlantsNetwork/mastodon,ashfurrow/mastodon,masarakki/mastodon,infinimatix/infinimatix.net,ms2sato/mastodon,h-izumi/mastodon,ebihara99999/mastodon,kagucho/mastodon,tri-star/mastodon,riku6460/chikuwagoddon,MastodonCloud/mastodon,Chronister/mastodon,pointlessone/mastodon,8796n/mastodon,dunn/mastodon,amazedkoumei/mastodon,pointlessone/mastodon,danhunsaker/mastodon,Nyoho/mastodon,sylph-sin-tyaku/mastodon,pso2club/mastodon,clworld/mastodon,clworld/mastodon,5thfloor/ichiji-social,nonoz/mastodon,RobertRence/Mastodon,pointlessone/mastodon,moeism/mastodon,anon5r/mastonon,corzntin/mastodon,Craftodon/Craftodon,glitch-soc/mastodon,alimony/mastodon,imas/mastodon,masto-donte-com-br/mastodon,musashino205/mastodon,h-izumi/mastodon,mhffdq/mastodon,MastodonCloud/mastodon,tateisu/mastodon,codl/mastodon,mecab/mastodon,tootsuite/mastodon,honpya/taketodon,pso2club/mastodon,MitarashiDango/mastodon,Monappy/mastodon,tateisu/mastodon,imas/mastodon,dissolve/mastodon,im-in-space/mastodon,thnkrs/mastodon,ashfurrow/mastodon,YuyaYokosuka/mastodon_animeclub,maa123/mastodon,ikuradon/mastodon,NS-Kazuki/mastodon,Chronister/mastodon,imomix/mastodon,lynlynlynx/mastodon,pinfort/mastodon,ms2sato/mastodon,3846masa/mastodon,rekif/mastodon,res-ac/mstdn.res.ac,theoria24/mastodon,codl/mastodon,h3zjp/mastodon,rainyday/mastodon,riku6460/chikuwagoddon,yukimochi/mastodon,ykzts/mastodon,mosaxiv/mastodon,musashino205/mastodon,kagucho/mastodon,gol-cha/mastodon,unarist/mastodon,narabo/mastodon,ambition-vietnam/mastodon,yukimochi/mastodon,narabo/mastodon,kirakiratter/mastodon,PlantsNetwork/mastodon,mstdn-jp/mastodon,lynlynlynx/mastodon,developer-mstdn18/mstdn18,anon5r/mastonon,developer-mstdn18/mstdn18,tcitworld/mastodon,imas/mastodon,koba-lab/mastodon,robotstart/mastodon,riku6460/chikuwagoddon,imomix/mastodon,cybrespace/mastodon,yi0713/mastodon,yi0713/mastodon,ms2sato/mastodon,h-izumi/mastodon,HogeTatu/mastodon,abcang/mastodon,glitch-soc/mastodon,sinsoku/mastodon,danhunsaker/mastodon | ---
+++
@@ -18,7 +18,7 @@
};
}
-export function deleteFromTimeline(id) {
+export function deleteFromTimelines(id) {
return {
type: TIMELINE_DELETE,
id: id |
94c7af6e4ebec4e8dc8cd7d5274bedc8ea8757fd | src/index.jsx | src/index.jsx | import React from 'react'
import ReactDOM from 'react-dom'
import Auth from './components/auth'
ReactDOM.render(Auth, document.getElementById('root'))
| import React from 'react'
import ReactDOM from 'react-dom'
import Auth from './components/auth.jsx'
ReactDOM.render(<Auth />, document.getElementById('root'))
| Fix how auth is required and used | Fix how auth is required and used
| JSX | mit | cheshire137/spotty-features,cheshire137/spotty-features | ---
+++
@@ -1,6 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
-import Auth from './components/auth'
+import Auth from './components/auth.jsx'
-ReactDOM.render(Auth, document.getElementById('root'))
+ReactDOM.render(<Auth />, document.getElementById('root')) |
01eb1044044c13fa5aef96054d44a8dccf7380e6 | src/index.jsx | src/index.jsx | require ('./stylesheets/style.css');
import React from 'react';
import ReactDom from 'react-dom';
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import {HeaderApp} from './components';
class App extends React.Component {
render () {
return (
<div>
<MuiThemeProvider>
<HeaderApp/>
</MuiThemeProvider>
</div>
);
}
}
injectTapEventPlugin();
ReactDom.render(<App/>, document.getElementById('app')); | require ('./stylesheets/style.css');
import React from 'react';
import ReactDom from 'react-dom';
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import {HeaderApp, Gallery} from './components';
class App extends React.Component {
render () {
return (
<div>
<MuiThemeProvider>
<HeaderApp/>
</MuiThemeProvider>
<MuiThemeProvider>
<Gallery
elements={[
{key:"1",src:"https://randomuser.me/api/portraits/women/48.jpg"},
{key:"2",src:"https://randomuser.me/api/portraits/men/53.jpg"},
{key:"3",src:"https://randomuser.me/api/portraits/women/31.jpg"},
{key:"4",src:"https://randomuser.me/api/portraits/men/27.jpg"}
]}
/>
</MuiThemeProvider>
</div>
);
}
}
injectTapEventPlugin();
ReactDom.render(<App/>, document.getElementById('app')); | ADD masonry component to the body of the page. | ADD masonry component to the body of the page.
| JSX | mit | andresin87/uz-teamwork,andresin87/uz-teamwork | ---
+++
@@ -6,7 +6,7 @@
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
-import {HeaderApp} from './components';
+import {HeaderApp, Gallery} from './components';
class App extends React.Component {
render () {
@@ -15,6 +15,16 @@
<MuiThemeProvider>
<HeaderApp/>
</MuiThemeProvider>
+ <MuiThemeProvider>
+ <Gallery
+ elements={[
+ {key:"1",src:"https://randomuser.me/api/portraits/women/48.jpg"},
+ {key:"2",src:"https://randomuser.me/api/portraits/men/53.jpg"},
+ {key:"3",src:"https://randomuser.me/api/portraits/women/31.jpg"},
+ {key:"4",src:"https://randomuser.me/api/portraits/men/27.jpg"}
+ ]}
+ />
+ </MuiThemeProvider>
</div>
);
} |
bef849a22075775e928f17458ccc2be7a197ac35 | src/client/modules/common/components/web/ui-antd/components/RenderField.jsx | src/client/modules/common/components/web/ui-antd/components/RenderField.jsx | import React from 'react';
import PropTypes from 'prop-types';
import Form from 'antd/lib/form';
import Input from 'antd/lib/input';
const FormItem = Form.Item;
const RenderField = ({ input, label, type, meta: { touched, error } }) => {
let validateStatus = '';
if (touched && error) {
validateStatus = 'error';
}
return (
<FormItem label={label} validateStatus={validateStatus} help={error}>
<div>
<Input {...input} placeholder={label} type={type} />
</div>
</FormItem>
);
};
RenderField.propTypes = {
input: PropTypes.object,
label: PropTypes.string,
type: PropTypes.string,
meta: PropTypes.object
};
export default RenderField;
| import React from 'react';
import PropTypes from 'prop-types';
import Form from 'antd/lib/form';
import Input from 'antd/lib/input';
const FormItem = Form.Item;
const RenderField = ({ input, label, type, meta: { touched, error } }) => {
let validateStatus = '';
if (touched && error) {
validateStatus = 'error';
}
return (
<FormItem label={label} validateStatus={validateStatus} help={touched && error}>
<div>
<Input {...input} placeholder={label} type={type} />
</div>
</FormItem>
);
};
RenderField.propTypes = {
input: PropTypes.object,
label: PropTypes.string,
type: PropTypes.string,
meta: PropTypes.object
};
export default RenderField;
| Fix AntD showing errors on not touched inputs | Fix AntD showing errors on not touched inputs
| JSX | mit | sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-fullstack-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit | ---
+++
@@ -12,7 +12,7 @@
}
return (
- <FormItem label={label} validateStatus={validateStatus} help={error}>
+ <FormItem label={label} validateStatus={validateStatus} help={touched && error}>
<div>
<Input {...input} placeholder={label} type={type} />
</div> |
a6578ebb3379a1a62828fc3a5a00d9cf6c710bb4 | src/framework/text/Text.jsx | src/framework/text/Text.jsx |
import React, {
PropTypes,
} from 'react';
import classNames from 'classnames';
import keyMirror from 'keyMirror';
export {
default as DescriptionText,
} from './DescriptionText.jsx';
const Text = props => {
const rhythmClassMap = {
[Text.RHYTHM.XSMALL]: 'text--xSmallRhythm',
[Text.RHYTHM.SMALL]: 'text--smallRhythm',
};
const classes = classNames('text', rhythmClassMap[props.rhythm]);
return (
<div className={classes}>
{props.children}
</div>
);
};
Text.RHYTHM = keyMirror({
XSMALL: null,
SMALL: null,
});
Text.propTypes = {
children: PropTypes.oneOfType([
PropTypes.array,
PropTypes.element,
PropTypes.string,
]).isRequired,
rhythm: PropTypes.string,
};
export default Text;
|
import React, {
PropTypes,
} from 'react';
import classNames from 'classnames';
import keyMirror from 'keymirror';
export {
default as DescriptionText,
} from './DescriptionText.jsx';
const Text = props => {
const rhythmClassMap = {
[Text.RHYTHM.XSMALL]: 'text--xSmallRhythm',
[Text.RHYTHM.SMALL]: 'text--smallRhythm',
};
const classes = classNames('text', rhythmClassMap[props.rhythm]);
return (
<div className={classes}>
{props.children}
</div>
);
};
Text.RHYTHM = keyMirror({
XSMALL: null,
SMALL: null,
});
Text.propTypes = {
children: PropTypes.oneOfType([
PropTypes.array,
PropTypes.element,
PropTypes.string,
]).isRequired,
rhythm: PropTypes.string,
};
export default Text;
| Fix broken build caused by typo in keymirror import. | Fix broken build caused by typo in keymirror import.
| JSX | mit | smaato/ui-framework | ---
+++
@@ -3,7 +3,7 @@
PropTypes,
} from 'react';
import classNames from 'classnames';
-import keyMirror from 'keyMirror';
+import keyMirror from 'keymirror';
export {
default as DescriptionText, |
ac0ef50c0ff9788491997e3c8bc50509c7a914bf | app/assets/javascripts/components/tags.js.jsx | app/assets/javascripts/components/tags.js.jsx | var Tags = React.createClass({
mixins: [FluxMixin],
emptyCopy: function() {
if(this.props.tags.length === 0) {
return "No tags yet, create some below :-)";
}
},
renderTags: function() {
return (
<ul className="Tags--list">
{ this.props.tags.map(function(tag) {
return (
<Tag
data={ tag }
removeClickHandler={ this.handleTagRemoveClicked }
key={ tag.id }
/>
);
}.bind(this))
}
</ul>
);
},
handleTagRemoveClicked: function(event, data) {
this.getFlux().actions.list.removeTag({
listId: this.props.listId,
tagToRemove: data.name
});
},
render: function() {
return (
<div className="container">
<div className="Tags u-border-beta u-p-1">
<h2>Tags</h2>
<p className='u-t-muted'>
{ this.emptyCopy() }
</p>
{ this.renderTags() }
<TagSearchController listId={ this.props.listId } />
</div>
</div>
);
}
});
| var Tags = React.createClass({
mixins: [FluxMixin],
emptyCopy: function() {
if(this.props.tags.length === 0) {
return "No tags yet, create some below :-)";
}
},
renderTags: function() {
return (
<ul className="Tags--list">
{ this.props.tags.map(function(tag) {
return (
<Tag
data={ tag }
tagClickHandler={ this.handleTagRemoveClicked }
key={ tag.id }
type='remove'
/>
);
}.bind(this))
}
</ul>
);
},
handleTagRemoveClicked: function(event, data) {
this.getFlux().actions.list.removeTag({
listId: this.props.listId,
tagToRemove: data.name
});
},
render: function() {
return (
<div className="container">
<div className="Tags u-bg-blue-xlight u-p-3">
<h2>Tags</h2>
<p className='u-t-muted'>
{ this.emptyCopy() }
</p>
{ this.renderTags() }
<TagSearchController listId={ this.props.listId } />
</div>
</div>
);
}
});
| Use unified click handler in tags. | Use unified click handler in tags.
| JSX | mit | kirillis/mytopten,krisimmig/mytopten,kirillis/mytopten,krisimmig/mytopten,kirillis/mytopten,krisimmig/mytopten | ---
+++
@@ -14,8 +14,9 @@
return (
<Tag
data={ tag }
- removeClickHandler={ this.handleTagRemoveClicked }
+ tagClickHandler={ this.handleTagRemoveClicked }
key={ tag.id }
+ type='remove'
/>
);
}.bind(this))
@@ -34,7 +35,7 @@
render: function() {
return (
<div className="container">
- <div className="Tags u-border-beta u-p-1">
+ <div className="Tags u-bg-blue-xlight u-p-3">
<h2>Tags</h2>
<p className='u-t-muted'>
{ this.emptyCopy() } |
f4444bfdf015944be6c95b5f5fc1062a0ac3d7c3 | web-server/app/assets/javascripts/components/package-component.jsx | web-server/app/assets/javascripts/components/package-component.jsx | define(['react', 'react-router', '../mixins/fluxbone', 'sota-dispatcher'], function(React, Router, Fluxbone, SotaDispatcher) {
var PackageComponent = React.createClass({
mixins: [
Fluxbone.Mixin('Package', 'sync')
],
handleUpdatePackage: function() {
SotaDispatcher.dispatch({
actionType: "package-updatePackage",
package: this.props.Package
});
},
render: function() {
return (
<Router.Link to='package' params={{name: this.props.Package.get('name'), version: this.props.Package.get('version')}}>
<li className="list-group-item">
<span className="badge" onClick={ this.handleUpdatePackage }>
Update Package
</span>
{ this.props.Package.get('name') }
</li>
</Router.Link>
);
}
});
return PackageComponent;
});
| define(['react', 'react-router', '../mixins/fluxbone', 'sota-dispatcher'], function(React, Router, Fluxbone, SotaDispatcher) {
var PackageComponent = React.createClass({
mixins: [
Fluxbone.Mixin('Package', 'sync')
],
handleUpdatePackage: function() {
SotaDispatcher.dispatch({
actionType: "package-updatePackage",
package: this.props.Package
});
},
render: function() {
return (
<Router.Link to='package' params={{name: this.props.Package.get('name'), version: this.props.Package.get('version')}}>
<li className="list-group-item">
<span className="badge" onClick={ this.handleUpdatePackage }>
Update Package
</span>
{ this.props.Package.get('name') } - { this.props.Package.get('version') }
</li>
</Router.Link>
);
}
});
return PackageComponent;
});
| Add version to packages list | Add version to packages list
| JSX | mpl-2.0 | PDXostc/rvi_sota_server,PDXostc/rvi_sota_server,PDXostc/rvi_sota_server | ---
+++
@@ -17,7 +17,7 @@
<span className="badge" onClick={ this.handleUpdatePackage }>
Update Package
</span>
- { this.props.Package.get('name') }
+ { this.props.Package.get('name') } - { this.props.Package.get('version') }
</li>
</Router.Link>
); |
7cb38f0dac4ae17549104bf67f1f3e928fd4eddf | client/app/bundles/RentersRights/components/ReportIssue.jsx | client/app/bundles/RentersRights/components/ReportIssue.jsx | import React from 'react';
import RentersLayout from './RentersLayout'
export default class ReportIssue extends React.Component {
/* render() {
const { locale } = this.props;
<Renters Layout locale={locale}>
*/
render() {
const {} = this.props;
return (
<RentersLayout>
<div className="content-container language-paragraph">
<div className="page-header">
<h1>Report San JosΓ© Rental Issue(s)</h1>
</div>
<p>Contact the City of San JosΓ© Rental Rights and Referrals Program via <a href="mailto:[email protected]">email</a> or call <a href="tel:+4089754480">(408)975-4480</a>.</p>
</div>
</RentersLayout>
)
}
}
| import React from 'react';
import RentersLayout from './RentersLayout'
export default class ReportIssue extends React.Component {
/* render() {
const { locale } = this.props;
<Renters Layout locale={locale}>
*/
render() {
const {} = this.props;
return (
<RentersLayout>
<div className="content-container language-paragraph">
<div className="page-header">
<h1>Report San JosΓ© Rental Issue(s)</h1>
</div>
<p>Contact the City of San JosΓ© Rental Rights and Referrals Program via <a href="mailto:[email protected]">email</a> or call <a href="tel:+4089754480">(408)975-4480</a>.</p>
</div>
</RentersLayout>
)
}
}
| Add function for parsing .tsv file | Add function for parsing .tsv file
| JSX | mit | codeforsanjose/renters-rights,codeforsanjose/renters-rights,codeforsanjose/renters-rights | ---
+++
@@ -7,11 +7,11 @@
const { locale } = this.props;
<Renters Layout locale={locale}>
- */
+ */
render() {
-
+
const {} = this.props;
-
+
return (
<RentersLayout>
<div className="content-container language-paragraph"> |
3eb82aff0f0baf7e264570badffb9d146d31c8f4 | bundles/main/entry.jsx | bundles/main/entry.jsx | import 'babel/polyfill'
import React from 'react'
import {DevTools, DebugPanel, LogMonitor} from 'redux-devtools/lib/react'
import {Provider} from 'react-redux'
import {navigate} from '../../actions/navigate'
import App from '../../components/containers/App'
import config from '../../config'
import app from '../../store'
import routes from './routes'
import Router from '../../lib/Router'
import compileRoutes from '../../lib/compileRoutes'
const router = Router(compileRoutes(routes), match => {
app.dispatch(navigate(match))
})
router.start()
const selector = '[data-imdikator=site]'
const containers = document.querySelectorAll(selector)
if (containers.length !== 1) {
throw new Error(`Expected exactly 1 element container for imdikator (matching ${selector}`)
}
React.render(
// The child must be wrapped in a function
// to work around an issue in React 0.13.
<div>
<Provider store={app}>
{() => <App router={router}/>}
</Provider>
{config.reduxDevTools && (
<DebugPanel top right bottom>
<DevTools store={app} monitor={LogMonitor} />
</DebugPanel>
)}
</div>,
containers[0]
)
window.R = router
| import 'babel/polyfill'
import React from 'react'
import {DevTools, DebugPanel, LogMonitor} from 'redux-devtools/lib/react'
import {Provider} from 'react-redux'
import {navigate} from '../../actions/navigate'
import App from '../../components/containers/App'
import config from '../../config'
import app from '../../store'
import routes from './routes'
import Router from '../../lib/Router'
import compileRoutes from '../../lib/compileRoutes'
const router = Router(compileRoutes(routes), match => {
app.dispatch(navigate(match))
})
router.start()
const selector = '[data-imdikator=site]'
const containers = document.querySelectorAll(selector)
if (containers.length !== 1) {
throw new Error(`Expected exactly 1 element container for imdikator (matching ${selector}`)
}
React.render(
// The child must be wrapped in a function
// to work around an issue in React 0.13.
<div>
<Provider store={app}>
{() => <App router={router}/>}
</Provider>
{config.reduxDevTools && (
<DebugPanel style={{backgroundColor: '#444'}} top right bottom>
<div style={{padding: 4}}>
Pro tip: Turn off redux devtools with:
<input type="text" readOnly
onFocus={e => (target => setTimeout(() => target.select(), 0))(e.target)}
style={{margin: 0, lineHeight: 1, color: 'inherit', backgroundColor: 'inherit', padding: 2, border: '1px solid #aaa'}}
value="REDUX_DEVTOOLS=0 npm start"/>
</div>
<DevTools store={app} monitor={LogMonitor} />
</DebugPanel>
)}
</div>,
containers[0]
)
window.R = router
| Add a note about how to turn off redux devtools | Add a note about how to turn off redux devtools
| JSX | mit | bengler/imdikator,bengler/imdikator | ---
+++
@@ -31,7 +31,14 @@
</Provider>
{config.reduxDevTools && (
- <DebugPanel top right bottom>
+ <DebugPanel style={{backgroundColor: '#444'}} top right bottom>
+ <div style={{padding: 4}}>
+ Pro tip: Turn off redux devtools with:
+ <input type="text" readOnly
+ onFocus={e => (target => setTimeout(() => target.select(), 0))(e.target)}
+ style={{margin: 0, lineHeight: 1, color: 'inherit', backgroundColor: 'inherit', padding: 2, border: '1px solid #aaa'}}
+ value="REDUX_DEVTOOLS=0 npm start"/>
+ </div>
<DevTools store={app} monitor={LogMonitor} />
</DebugPanel>
)} |
09db0626e00b247ea97eb0cf1a8100e3b56038f3 | src/NextMonth.jsx | src/NextMonth.jsx | import React, { Component, PropTypes } from 'react';
class NextMonth extends Component {
static propTypes = {
inner: PropTypes.node,
disable: PropTypes.bool
}
static defaultProps = {
inner: 'Next',
disable: false
}
handleClick() {
let {onClick} = this.props;
if(this.props.disable) return;
onClick && onClick.call(this);
}
render() {
let classes = 'cal__nav cal__nav--next';
if(this.props.disable) {
classes += ' cal__nav--disabled';
}
return(
<button
className={classes}
role="button"
title="Next month"
onClick={::this.handleClick}
>
{this.props.inner}
</button>
)
}
}
export default NextMonth; | import React, { Component, PropTypes } from 'react';
class NextMonth extends Component {
static propTypes = {
inner: PropTypes.node,
disable: PropTypes.bool
}
static defaultProps = {
inner: 'Next',
disable: false
}
handleClick() {
let {onClick} = this.props;
if(this.props.disable) return;
onClick && onClick.call(this);
}
render() {
let classes = 'cal__nav cal__nav--next';
if(this.props.disable) {
classes += ' cal__nav--disabled';
}
return(
<button
className={classes}
role="button"
title="Next month"
type="button"
onClick={::this.handleClick}
>
{this.props.inner}
</button>
)
}
}
export default NextMonth;
| Set button type to "button" | Set button type to "button" | JSX | isc | souporserious/react-midnight,jremmen/react-dately,frederickfogerty/react-dately,souporserious/react-simple-calendar,souporserious/react-dately,souporserious/react-simple-calendar,souporserious/react-midnight,souporserious/react-dately,frederickfogerty/react-dately,jremmen/react-dately | ---
+++
@@ -31,6 +31,7 @@
className={classes}
role="button"
title="Next month"
+ type="button"
onClick={::this.handleClick}
>
{this.props.inner} |
99f18c1bbe1f7677842f06e397289eca6fb08e97 | src/js/routes.jsx | src/js/routes.jsx | import React from 'react/addons';
import Router from 'react-router';
import App from './app.jsx';
import TodoApp from '../components/templates/todo-app/todo-app.jsx';
import About from '../components/templates/about/about.jsx';
var Route = Router.Route;
var DefaultRoute = Router.DefaultRoute;
var NotFoundRoute = Router.NotFoundRoute;
var Redirect = Router.Redirect;
var routes = (
<Route name='app' path='/' handler={App}>
<Route name='about' handler={About} />
<DefaultRoute name='todo-app' handler={TodoApp} />
</Route>
);
export default routes;
| import React from 'react/addons';
import Router from 'react-router';
import App from './app.jsx';
import TodoApp from '../components/templates/todo-app/todo-app.jsx';
import About from '../components/templates/about/about.jsx';
var Route = Router.Route;
var DefaultRoute = Router.DefaultRoute;
var NotFoundRoute = Router.NotFoundRoute;
var Redirect = Router.Redirect;
var routes = (
<Route name='app' path='/' handler={App}>
<DefaultRoute name='todo-app' handler={TodoApp} />
<Route name='about' path='/about' handler={About} />
<NotFoundRoute handler={TodoApp} />
</Route>
);
export default routes;
| Add NotFoundRoute to redirect back to app | Add NotFoundRoute to redirect back to app
| JSX | mit | mattpetrie/React-Node-Project-Seed,mattpetrie/React-Node-Project-Seed,haner199401/React-Node-Project-Seed,haner199401/React-Node-Project-Seed | ---
+++
@@ -11,8 +11,9 @@
var routes = (
<Route name='app' path='/' handler={App}>
- <Route name='about' handler={About} />
<DefaultRoute name='todo-app' handler={TodoApp} />
+ <Route name='about' path='/about' handler={About} />
+ <NotFoundRoute handler={TodoApp} />
</Route>
);
|
e005247a2fb460278c03f75013d53c69b8923e9b | client/whispers/nav-entry.jsx | client/whispers/nav-entry.jsx | import React, { PropTypes } from 'react'
import Entry from '../material/left-nav/entry.jsx'
import IconButton from '../material/icon-button.jsx'
import styles from './whisper.css'
export default class WhisperNavEntry extends React.Component {
static propTypes = {
user: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
};
_handleClose = ::this.onClose;
render() {
const { user } = this.props
const button = <IconButton className={styles.navCloseButton} icon='close' title='Close'
onClick={this._handleButtonClicked} />
return <Entry link={`/whispers/${encodeURIComponent(user)}`} button={button}>{user}</Entry>
}
onClose() {
this.props.onClose(this.props.user)
}
}
| import React, { PropTypes } from 'react'
import Entry from '../material/left-nav/entry.jsx'
import IconButton from '../material/icon-button.jsx'
import styles from './whisper.css'
export default class WhisperNavEntry extends React.Component {
static propTypes = {
user: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
};
_handleClose = ::this.onClose;
render() {
const { user } = this.props
const button = <IconButton className={styles.navCloseButton} icon='close' title='Close'
onClick={this._handleClose} />
return <Entry link={`/whispers/${encodeURIComponent(user)}`} button={button}>{user}</Entry>
}
onClose() {
this.props.onClose(this.props.user)
}
}
| Fix the name of the onClick handler for the whisper close button. | Fix the name of the onClick handler for the whisper close button.
| JSX | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery | ---
+++
@@ -14,7 +14,7 @@
render() {
const { user } = this.props
const button = <IconButton className={styles.navCloseButton} icon='close' title='Close'
- onClick={this._handleButtonClicked} />
+ onClick={this._handleClose} />
return <Entry link={`/whispers/${encodeURIComponent(user)}`} button={button}>{user}</Entry>
} |
6d2b64b4e0e0ba0968fb11eeccb53dcdedb98daf | src/projects/aquaman/index.jsx | src/projects/aquaman/index.jsx | import React from 'react';
import { ProjectType } from 'types';
import thumbnail from './thumbnail.jpg';
export default {
title: 'Aquaman Sponsorship',
slug: 'aquaman',
startDate: new Date(2018, 6),
releaseDate: new Date(2018, 10),
type: ProjectType.Game,
thumbnail: thumbnail,
url: 'https://github.com/vocksel/class.lua',
shortDescription: 'A hectic 4 month sprint to release a game for the Warner Brother\'s sponsorship',
description: (
<React.Fragment>
<p>Hello, World!</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Atque quam soluta <a href="#">tempora harum</a> ut aut vero fuga similique necessitatibus nostrum quas doloremque, minus error ipsam ullam, blanditiis itaque ratione eaque. Lorem ipsum dolor sit amet consectetur adipisicing elit. <a href="#">Voluptatem maiores</a> fugiat nam quibusdam accusamus officia aliquid tempore, ea suscipit illum.</p>
</React.Fragment>
)
};
| import React from 'react';
import { ProjectType } from 'types';
import thumbnail from './thumbnail.jpg';
export default {
title: 'Aquaman: City of Rolantis',
slug: 'aquaman',
startDate: new Date(2018, 6),
releaseDate: new Date(2018, 10),
type: ProjectType.Game,
thumbnail: thumbnail,
url: 'https://www.roblox.com/games/2056459358/City-of-Rolantis',
shortDescription: 'A hectic 4 month sprint to release a game for the Warner Brother\'s sponsorship',
description: (
<React.Fragment>
<p>Hello, World!</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Atque quam soluta <a href="#">tempora harum</a> ut aut vero fuga similique necessitatibus nostrum quas doloremque, minus error ipsam ullam, blanditiis itaque ratione eaque. Lorem ipsum dolor sit amet consectetur adipisicing elit. <a href="#">Voluptatem maiores</a> fugiat nam quibusdam accusamus officia aliquid tempore, ea suscipit illum.</p>
</React.Fragment>
)
};
| Update title and link for Aquaman | Update title and link for Aquaman
| JSX | mit | VoxelDavid/voxeldavid-website,VoxelDavid/voxeldavid-website,vocksel/my-website,vocksel/my-website | ---
+++
@@ -3,13 +3,13 @@
import thumbnail from './thumbnail.jpg';
export default {
- title: 'Aquaman Sponsorship',
+ title: 'Aquaman: City of Rolantis',
slug: 'aquaman',
startDate: new Date(2018, 6),
releaseDate: new Date(2018, 10),
type: ProjectType.Game,
thumbnail: thumbnail,
- url: 'https://github.com/vocksel/class.lua',
+ url: 'https://www.roblox.com/games/2056459358/City-of-Rolantis',
shortDescription: 'A hectic 4 month sprint to release a game for the Warner Brother\'s sponsorship',
description: (
<React.Fragment> |
a2b03c9543806602cadb5c964bea279e32197b79 | src/scripts/DateTimePicker.jsx | src/scripts/DateTimePicker.jsx | "use strict"
import React from 'react'
import update from 'react-addons-update'
import InputMoment from 'input-moment'
import _moment from 'moment'
const DateTimePicker = React.createClass({
onChangeDate: function(moment) {
this.props.onChange(update(this.props.value, {
moment: {$set: moment}
}))
},
onSaveDate: function() {
const newTimestamp = this.props.value.moment.valueOf();
this.props.onChange(update(this.props.value, {
timestamp: {$set: newTimestamp}
}))
},
render: function () {
const {timestamp, moment} = this.props.value
return (
<div>
<input value={_moment(timestamp).format("MM.DD HH:mm:ss")} readOnly={true} />
<InputMoment
moment={moment}
onChange={this.onChangeDate}
onSave={this.onSaveDate} />
</div>
)
}
})
DateTimePicker.contextTypes = {
store: React.PropTypes.object
}
DateTimePicker.wrapState = function(timestamp) {
return {
timestamp,
moment: _moment(timestamp)
}
}
DateTimePicker.unwrapState = function(value) {
return value.timestamp
}
export default DateTimePicker
| "use strict"
import React from 'react'
import update from 'react-addons-update'
import InputMoment from 'input-moment'
import _moment from 'moment'
const DateTimePicker = React.createClass({
getInitialState: function() {
return {
visible: false
}
},
onClick: function() {
this.setState(update(this.state, {
visible: {$set: !this.state.visible}
}))
var resetMoment = _moment(this.props.value.timestamp)
this.props.onChange(update(this.props.value, {
moment: {$set: resetMoment}
}))
},
onChangeDate: function(moment) {
this.props.onChange(update(this.props.value, {
moment: {$set: moment}
}))
},
onSaveDate: function() {
const newTimestamp = this.props.value.moment.valueOf();
this.props.onChange(update(this.props.value, {
timestamp: {$set: newTimestamp}
}))
this.setState(update(this.state, {
visible: {$set: false}
}))
},
render: function () {
const {timestamp, moment} = this.props.value
return (
<div>
<input onClick={this.onClick} value={_moment(timestamp).format("MM.DD HH:mm:ss")} readOnly={true} />
{ this.state.visible
? <InputMoment
moment={moment}
onChange={this.onChangeDate}
onSave={this.onSaveDate} />
: <span/>
}
</div>
)
}
})
DateTimePicker.contextTypes = {
store: React.PropTypes.object
}
DateTimePicker.wrapState = function(timestamp) {
return {
timestamp,
moment: _moment(timestamp)
}
}
DateTimePicker.unwrapState = function(value) {
return value.timestamp
}
export default DateTimePicker
| Add date field to expense (improvement) | Add date field to expense (improvement)
| JSX | mit | moneytrack/moneytrack.github.io,moneytrack/frontend,moneytrack/moneytrack.github.io,moneytrack/frontend,moneytrack/frontend | ---
+++
@@ -5,6 +5,22 @@
import _moment from 'moment'
const DateTimePicker = React.createClass({
+
+ getInitialState: function() {
+ return {
+ visible: false
+ }
+ },
+
+ onClick: function() {
+ this.setState(update(this.state, {
+ visible: {$set: !this.state.visible}
+ }))
+ var resetMoment = _moment(this.props.value.timestamp)
+ this.props.onChange(update(this.props.value, {
+ moment: {$set: resetMoment}
+ }))
+ },
onChangeDate: function(moment) {
this.props.onChange(update(this.props.value, {
@@ -17,17 +33,23 @@
this.props.onChange(update(this.props.value, {
timestamp: {$set: newTimestamp}
}))
+ this.setState(update(this.state, {
+ visible: {$set: false}
+ }))
},
render: function () {
const {timestamp, moment} = this.props.value
return (
<div>
- <input value={_moment(timestamp).format("MM.DD HH:mm:ss")} readOnly={true} />
- <InputMoment
+ <input onClick={this.onClick} value={_moment(timestamp).format("MM.DD HH:mm:ss")} readOnly={true} />
+ { this.state.visible
+ ? <InputMoment
moment={moment}
onChange={this.onChangeDate}
- onSave={this.onSaveDate} />
+ onSave={this.onSaveDate} />
+ : <span/>
+ }
</div>
)
} |
689fbf17fc3336b0e28349b2093f9ff626976678 | 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';
import log from 'domain/log';
class SingleSignOnRedirectCallback extends Component {
componentDidMount() {
userManager.signinRedirectCallback()
.then(() => {
this.props.dispatch(replace(sessionStorage.lastUrlPath || ''));
})
.catch((error) => {
log.error('SingleSignOnRedirectCallback - Could not sign in', error);
return userManager.signoutRedirect();
});
}
render() {
return null;
}
}
SingleSignOnRedirectCallback.propTypes = {
dispatch: React.PropTypes.func.isRequired,
};
export default connect()(SingleSignOnRedirectCallback);
| 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);
| Revert "Added a catch() in case the redirect callback fails" | Revert "Added a catch() in case the redirect callback fails"
This reverts commit fea916641be1c19b398d79bdbf4c4dc7e1af21e3.
| JSX | mit | e1-bsd/omni-common-ui,e1-bsd/omni-common-ui | ---
+++
@@ -2,17 +2,12 @@
import { connect } from 'react-redux';
import { replace } from 'react-router-redux';
import userManager from './userManager';
-import log from 'domain/log';
class SingleSignOnRedirectCallback extends Component {
componentDidMount() {
- userManager.signinRedirectCallback()
+ userManager.signinRedirectCallback() // TODO What if it fails?
.then(() => {
this.props.dispatch(replace(sessionStorage.lastUrlPath || ''));
- })
- .catch((error) => {
- log.error('SingleSignOnRedirectCallback - Could not sign in', error);
- return userManager.signoutRedirect();
});
}
|
87d0d762f63a7bc16ca2e5be117ed940513c52a8 | wrappers/head/component.jsx | wrappers/head/component.jsx | import React from 'react';
import PropTypes from 'prop-types';
import NextHead from 'next/head';
import ReactHtmlParser from 'react-html-parser';
// if the metaTags prop is returned from getStaticProps or getServerSide props
// we parse it and use in favour of page props
const Head = ({ title, description, noIndex, metaTags }) =>
metaTags ? (
ReactHtmlParser(metaTags)
) : (
<NextHead>
<title>{title}</title>
<meta name="description" content={description} />
<meta name="author" content="Vizzuality" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="@globalforests" />
<meta name="twitter:description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:type" content="website" />
<meta property="og:image" content="/preview.jpg" />
{noIndex && <meta name="robots" content="noindex,follow" />}
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=5"
/>
</NextHead>
);
Head.propTypes = {
title: PropTypes.string,
description: PropTypes.string,
noIndex: PropTypes.bool,
metaTags: PropTypes.string,
};
export default Head;
| import React from 'react';
import PropTypes from 'prop-types';
import NextHead from 'next/head';
import ReactHtmlParser from 'react-html-parser';
// if the metaTags prop is returned from getStaticProps or getServerSide props
// we parse it and use in favour of page props
const Head = ({ title, description, noIndex, metaTags }) => {
const isServer = typeof window === 'undefined';
let isProd = false;
if (!isServer) isProd =
window.location.host === 'globalforestwatch.org' ||
window.location.host === 'www.globalforestwatch.org'
return metaTags ? (
ReactHtmlParser(metaTags)
) : (
<NextHead>
<title>{title}</title>
<meta name="description" content={description} />
<meta name="author" content="Vizzuality" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="@globalforests" />
<meta name="twitter:description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:type" content="website" />
<meta property="og:image" content="/preview.jpg" />
{(noIndex || !isProd) && <meta name="robots" content="noindex,follow" />}
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=5"
/>
</NextHead>
)};
Head.propTypes = {
title: PropTypes.string,
description: PropTypes.string,
noIndex: PropTypes.bool,
metaTags: PropTypes.string,
};
export default Head;
| Add noindex to staging and preprod environments | Add noindex to staging and preprod environments
| JSX | mit | Vizzuality/gfw,Vizzuality/gfw | ---
+++
@@ -5,8 +5,15 @@
// if the metaTags prop is returned from getStaticProps or getServerSide props
// we parse it and use in favour of page props
-const Head = ({ title, description, noIndex, metaTags }) =>
- metaTags ? (
+const Head = ({ title, description, noIndex, metaTags }) => {
+ const isServer = typeof window === 'undefined';
+ let isProd = false;
+
+ if (!isServer) isProd =
+ window.location.host === 'globalforestwatch.org' ||
+ window.location.host === 'www.globalforestwatch.org'
+
+ return metaTags ? (
ReactHtmlParser(metaTags)
) : (
<NextHead>
@@ -20,13 +27,13 @@
<meta property="og:description" content={description} />
<meta property="og:type" content="website" />
<meta property="og:image" content="/preview.jpg" />
- {noIndex && <meta name="robots" content="noindex,follow" />}
+ {(noIndex || !isProd) && <meta name="robots" content="noindex,follow" />}
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=5"
/>
</NextHead>
- );
+ )};
Head.propTypes = {
title: PropTypes.string, |
a5423268e488a54584ed186d1f60d635cd765042 | kanban_app/app/components/Notes.jsx | kanban_app/app/components/Notes.jsx | import React from 'react';
import {Decorator as Cerebral} from 'cerebral-react';
import Editable from './Editable.jsx';
import Note from './Note.jsx';
@Cerebral()
export default class Notes extends React.Component {
constructor(props) {
super(props);
this.renderNote = this.renderNote.bind(this);
this.moveNote = this.moveNote.bind(this);
this.attachNote = this.attachNote.bind(this);
}
render() {
const notes = this.props.items;
return <ul className="notes">{notes.map(this.renderNote)}</ul>;
}
renderNote(note) {
return (
<Note className="note"
onMove={this.moveNote} onAttach={this.attachNote}
note={note} 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>
);
}
moveNote({sourceNote, targetNote}) {
this.props.signals.noteMoved.sync({sourceNote, targetNote});
}
attachNote({laneId, noteId}) {
this.props.signals.noteAttachedToLane.sync({laneId, noteId});
}
}
| import React from 'react';
import {Decorator as Cerebral} from 'cerebral-react';
import Editable from './Editable.jsx';
import Note from './Note.jsx';
@Cerebral()
export default class Notes extends React.Component {
constructor(props) {
super(props);
this.renderNote = this.renderNote.bind(this);
this.moveNote = this.moveNote.bind(this);
this.attachNote = this.attachNote.bind(this);
}
render() {
const notes = this.props.items;
console.log('rendering notes', notes);
return <ul className="notes">{notes.map(this.renderNote)}</ul>;
}
renderNote(note) {
return (
<Note className="note"
onMove={this.moveNote} onAttach={this.attachNote}
note={note} 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>
);
}
moveNote({sourceNote, targetNote}) {
this.props.signals.noteMoved.sync({sourceNote, targetNote});
}
attachNote({laneId, noteId}) {
this.props.signals.noteAttachedToLane.sync({laneId, noteId});
}
}
| Add note rendering debug print | Add note rendering debug print
| JSX | mit | survivejs/cerebral-demo | ---
+++
@@ -14,6 +14,9 @@
}
render() {
const notes = this.props.items;
+
+ console.log('rendering notes', notes);
+
return <ul className="notes">{notes.map(this.renderNote)}</ul>;
}
renderNote(note) { |
f4436049605043c9c73701e527f5ab2085838a18 | src/client/containers/HeaderPanels/HeaderPanels.jsx | src/client/containers/HeaderPanels/HeaderPanels.jsx | import React, {Component} from 'react'
import SortPanel from './SortPanel'
import FilterPanel from './FilterPanel'
import ArchivePanel from './ArchivePanel'
import WatchPanel from './WatchPanel'
class HeaderPanels extends Component {
constructor(props) {
super(props);
}
componentDidUpdate(prevProps, prevState) {
console.error("Component did update! ", this.props.activePanel)
}
render() {
const {activePanel} = this.props
return (
<div className="header-panels">
<WatchPanel isActive={activePanel === "watch"} {...this.props} />
<ArchivePanel isActive={activePanel === "archive"} {...this.props} />
<FilterPanel isActive={activePanel === "filter"} {...this.props} />
<SortPanel isActive={activePanel === "sort"} {...this.props} />
</div>
)
}
}
export default HeaderPanels
| import React, {Component} from 'react'
import SortPanel from './SortPanel'
import FilterPanel from './FilterPanel'
import ArchivePanel from './ArchivePanel'
import WatchPanel from './WatchPanel'
export default function HeaderPanels(props) {
const {activePanel: panel} = props
return (
<div className="header-panels">
<WatchPanel isActive={panel === "watch"} {...props} />
<ArchivePanel isActive={panel === "archive"} {...props} />
<FilterPanel isActive={panel === "filter"} {...props} />
<SortPanel isActive={panel === "sort"} {...props} />
</div>
)
}
| Make HeaderPanel into a function | feat(Container): Make HeaderPanel into a function
| JSX | mit | AdamSalma/Lurka,AdamSalma/Lurka | ---
+++
@@ -6,28 +6,15 @@
import WatchPanel from './WatchPanel'
-class HeaderPanels extends Component {
- constructor(props) {
- super(props);
-
- }
+export default function HeaderPanels(props) {
+ const {activePanel: panel} = props
- componentDidUpdate(prevProps, prevState) {
- console.error("Component did update! ", this.props.activePanel)
- }
-
- render() {
- const {activePanel} = this.props
-
- return (
- <div className="header-panels">
- <WatchPanel isActive={activePanel === "watch"} {...this.props} />
- <ArchivePanel isActive={activePanel === "archive"} {...this.props} />
- <FilterPanel isActive={activePanel === "filter"} {...this.props} />
- <SortPanel isActive={activePanel === "sort"} {...this.props} />
- </div>
- )
- }
+ return (
+ <div className="header-panels">
+ <WatchPanel isActive={panel === "watch"} {...props} />
+ <ArchivePanel isActive={panel === "archive"} {...props} />
+ <FilterPanel isActive={panel === "filter"} {...props} />
+ <SortPanel isActive={panel === "sort"} {...props} />
+ </div>
+ )
}
-
-export default HeaderPanels |
01e5c0b31b6c4d318411fd89cb0699e321447dac | app/views/panel-item.jsx | app/views/panel-item.jsx | import React from 'react';
import PropTypes from 'prop-types';
import Stats from './stats.jsx';
import { summaryStatBlock as data } from '../scripts/validators';
const divStyle = {
float: 'left',
margin: '0 20px 0 0'
};
const PanelItem = ({data, label}) => {
return (
<div style={divStyle}>
<h2>{label}</h2>
<Stats data={data} />
</div>);
};
PanelItem.propTypes = {
data: data,
label: PropTypes.string
};
export default PanelItem;
| import React from 'react';
import PropTypes from 'prop-types';
import Stats from './stats.jsx';
import { summaryStatBlock as data } from '../scripts/validators';
const divStyle = {
float: 'left',
margin: '0 20px 0 0'
};
const PanelItem = ({data, label}) => {
return (
<div style={divStyle}>
<h2>{label}</h2>
<Stats data={data} />
</div>);
};
PanelItem.propTypes = {
data: data,
label: PropTypes.string
};
export default PanelItem;
| Fix linting errors after bumping version number | Fix linting errors after bumping version number
| JSX | mit | gregstewart/hearthstone-tracker,gregstewart/hearthstone-tracker | ---
+++
@@ -11,9 +11,9 @@
const PanelItem = ({data, label}) => {
return (
<div style={divStyle}>
- <h2>{label}</h2>
- <Stats data={data} />
- </div>);
+ <h2>{label}</h2>
+ <Stats data={data} />
+ </div>);
};
PanelItem.propTypes = { |
518f8ff382705257caf63732d738cc12aa9b41a0 | client/components/listingEntry.jsx | client/components/listingEntry.jsx | let ListingEntry = props => (
<div>
<p>
<span> {props.listing.date} / </span>
<span> {props.listing.location} / </span>
<span> {props.listing.price}</span>
</p>
<p>{props.listing.title}</p>
<p>{props.listing.description}</p>
</div>
);
export default ListingEntry;
| let ListingEntry = props => (
<div>
<span class="listingDate"> {props.listing.date} | </span>
<span class="listingPrice"> {props.listing.price} | </span>
<span class="listingLocation"> {props.listing.location} | </span>
<span class="listingTitle"> {props.listing.title} </span>
</div>
);
export default ListingEntry;
| Refactor ListingEntry to display entry on 1 line | Refactor ListingEntry to display entry on 1 line
- Currently a ListingEntry takes up three lines. Refactor to make the
ListingEntry take up one line, and arrange the listing entry fields as
follows: date, price, location, title (do NOT show the desription
anymore).
| JSX | mit | glistening-gibus/hackifieds,aphavichitr/hackifieds,glistening-gibus/hackifieds,aphavichitr/hackifieds,glistening-gibus/hackifieds,Hackifieds/hackifieds,Hackifieds/hackifieds | ---
+++
@@ -1,12 +1,9 @@
let ListingEntry = props => (
<div>
- <p>
- <span> {props.listing.date} / </span>
- <span> {props.listing.location} / </span>
- <span> {props.listing.price}</span>
- </p>
- <p>{props.listing.title}</p>
- <p>{props.listing.description}</p>
+ <span class="listingDate"> {props.listing.date} | </span>
+ <span class="listingPrice"> {props.listing.price} | </span>
+ <span class="listingLocation"> {props.listing.location} | </span>
+ <span class="listingTitle"> {props.listing.title} </span>
</div>
);
|
cd6f0d5a3130bb9f19eab63b2a66c401a2635eff | src/components/ChartBench.jsx | src/components/ChartBench.jsx | import {HotKeys} from "react-hotkeys"
import ClipboardButton from "react-clipboard.js"
import Chart from "../containers/Chart"
import EditToolbar from "../containers/EditToolbar"
const ChartBench = ({
chartJson,
hotKeysHandlers,
slug,
title,
width,
}) => {
return (
<article style={{marginBottom: 60}}>
<h1 id={slug}>
<a href={"#" + slug} style={{textDecoration: "none"}} title="Anchor">ο</a>
{" "}
{title}
<small>
{" "}
</small>
</h1>
<HotKeys handlers={hotKeysHandlers}>
<EditToolbar chartSlug={slug} />
<Chart slug={slug} width={width} />
</HotKeys>
<p>
<ClipboardButton data-clipboard-text={chartJson}>
Copy JSON
</ClipboardButton>
</p>
</article>
)
}
export default ChartBench
| import {HotKeys} from "react-hotkeys"
import ClipboardButton from "react-clipboard.js"
import Chart from "../containers/Chart"
import EditToolbar from "../containers/EditToolbar"
const ChartBench = ({
chartJson,
hotKeysHandlers,
slug,
title,
width,
}) => {
return (
<article style={{marginBottom: 60}}>
<h1 id={slug}>
<a href={"#" + slug} style={{textDecoration: "none"}} title="Anchor">ο</a>
{" "}
{title}
<small>
{" "}
</small>
</h1>
<EditToolbar chartSlug={slug} />
<HotKeys handlers={hotKeysHandlers}>
<Chart slug={slug} width={width} />
</HotKeys>
<p>
<ClipboardButton data-clipboard-text={chartJson}>
Copy JSON
</ClipboardButton>
</p>
</article>
)
}
export default ChartBench
| Enable key shortcuts only when chart is focused to avoid double triggered actions with <select> | Enable key shortcuts only when chart is focused to avoid double triggered actions with <select>
| JSX | agpl-3.0 | openchordcharts/openchordcharts-sample-data,openchordcharts/sample-data,openchordcharts/sample-data,openchordcharts/openchordcharts-sample-data | ---
+++
@@ -22,8 +22,8 @@
{" "}
</small>
</h1>
+ <EditToolbar chartSlug={slug} />
<HotKeys handlers={hotKeysHandlers}>
- <EditToolbar chartSlug={slug} />
<Chart slug={slug} width={width} />
</HotKeys>
<p> |
fd8d8797dd73d4a7a69c74debf98ed3f768de77b | app/renderer-jsx/html-frame/html-frame.jsx | app/renderer-jsx/html-frame/html-frame.jsx | 'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
class HTMLFrame extends React.Component {
componentDidMount() {
this.renderHtml();
}
componentDidUpdate() {
this.renderHtml();
}
renderHtml() {
const html = this.props.html || '<!doctype html><html></html>';
const doc = ReactDOM.findDOMNode(this).contentDocument;
if (doc && doc.readyState === 'complete') {
doc.clear();
doc.open();
doc.write(html);
doc.close();
} else {
setTimeout(this.renderHtml, 5);
}
}
render() {
return (
<iframe {...this.props} />
);
}
}
module.exports = HTMLFrame;
| 'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
class HTMLFrame extends React.Component {
constructor() {
super();
this.counter = 0;
}
componentDidMount() {
this.renderHtml();
}
componentDidUpdate() {
this.renderHtml();
}
renderHtml() {
const html = this.props.html || '<!doctype html><html></html>';
const doc = ReactDOM.findDOMNode(this).contentDocument;
if (doc && doc.readyState === 'complete') {
doc.clear();
doc.open();
doc.write(html);
doc.close();
} else {
setTimeout(this.renderHtml, 5);
}
}
render() {
this.counter += 1;
if (this.counter > 10000)
this.counter = 0;
return (
<iframe key={this.counter} {...this.props} />
);
}
}
module.exports = HTMLFrame;
| Fix iframe conflicts on scripting | Fix iframe conflicts on scripting
| JSX | mit | hainproject/hain,hainproject/hain,appetizermonster/hain,hainproject/hain,hainproject/hain,appetizermonster/hain,appetizermonster/hain,appetizermonster/hain | ---
+++
@@ -4,6 +4,11 @@
import ReactDOM from 'react-dom';
class HTMLFrame extends React.Component {
+ constructor() {
+ super();
+ this.counter = 0;
+ }
+
componentDidMount() {
this.renderHtml();
}
@@ -26,8 +31,11 @@
}
render() {
+ this.counter += 1;
+ if (this.counter > 10000)
+ this.counter = 0;
return (
- <iframe {...this.props} />
+ <iframe key={this.counter} {...this.props} />
);
}
} |
e2908fd705ea26204e60b276f064690b69ef020e | app/components/Send/SendAmountsPanel/SendAmountsInfoBox/index.jsx | app/components/Send/SendAmountsPanel/SendAmountsInfoBox/index.jsx | // @flow
import React from 'react'
import styles from './SendAmountsInfoBox.scss'
import { multiplyNumber } from '../../../../core/math'
type Props = {
assetName: string,
assetPrice: number,
totalAmount: number,
remainingAmount: number,
totalBalanceWorth: number,
remainingBalanceWorth: number,
fiatCurrencySymbol: string
}
const SendAmountsInfoBox = ({
assetName,
assetPrice,
totalAmount,
totalBalanceWorth,
remainingBalanceWorth,
remainingAmount,
fiatCurrencySymbol
}: Props) => (
<div className={styles.sendAmountsInfoBox}>
<div className={styles.assetTitle}>
<h3>{assetName}</h3>
</div>
<div className={styles.assetAmounts}>
<p className={styles.assetAmountsPrimary}>{totalAmount.toFixed(2)}</p>
<p className={styles.assetAmountsSecondary}>
{remainingAmount.toFixed(2)}
</p>
</div>
<div className={styles.assetValue}>
<p className={styles.totalAssetValue}>
{fiatCurrencySymbol}
{totalBalanceWorth}
</p>
<p className={styles.remainingAssetValue}>
{fiatCurrencySymbol}
{remainingBalanceWorth}
</p>
</div>
</div>
)
export default SendAmountsInfoBox
| // @flow
import React from 'react'
import styles from './SendAmountsInfoBox.scss'
import { multiplyNumber } from '../../../../core/math'
type Props = {
assetName: string,
totalAmount: string,
remainingAmount: number,
totalBalanceWorth: number,
remainingBalanceWorth: number,
fiatCurrencySymbol: string
}
const SendAmountsInfoBox = ({
assetName,
totalAmount,
totalBalanceWorth,
remainingBalanceWorth,
remainingAmount,
fiatCurrencySymbol
}: Props) => (
<div className={styles.sendAmountsInfoBox}>
<div className={styles.assetTitle}>
<h3>{assetName}</h3>
</div>
<div className={styles.assetAmounts}>
<p className={styles.assetAmountsPrimary}>{totalAmount}</p>
<p className={styles.assetAmountsSecondary}>{remainingAmount}</p>
</div>
<div className={styles.assetValue}>
<p className={styles.totalAssetValue}>
{fiatCurrencySymbol}
{totalBalanceWorth.toFixed(2)}
</p>
<p className={styles.remainingAssetValue}>
{fiatCurrencySymbol}
{remainingBalanceWorth.toFixed(2)}
</p>
</div>
</div>
)
export default SendAmountsInfoBox
| Add toFixed to correct variables | Add toFixed to correct variables
| JSX | mit | hbibkrim/neon-wallet,CityOfZion/neon-wallet,hbibkrim/neon-wallet,CityOfZion/neon-wallet,CityOfZion/neon-wallet | ---
+++
@@ -7,8 +7,7 @@
type Props = {
assetName: string,
- assetPrice: number,
- totalAmount: number,
+ totalAmount: string,
remainingAmount: number,
totalBalanceWorth: number,
remainingBalanceWorth: number,
@@ -17,7 +16,6 @@
const SendAmountsInfoBox = ({
assetName,
- assetPrice,
totalAmount,
totalBalanceWorth,
remainingBalanceWorth,
@@ -29,19 +27,17 @@
<h3>{assetName}</h3>
</div>
<div className={styles.assetAmounts}>
- <p className={styles.assetAmountsPrimary}>{totalAmount.toFixed(2)}</p>
- <p className={styles.assetAmountsSecondary}>
- {remainingAmount.toFixed(2)}
- </p>
+ <p className={styles.assetAmountsPrimary}>{totalAmount}</p>
+ <p className={styles.assetAmountsSecondary}>{remainingAmount}</p>
</div>
<div className={styles.assetValue}>
<p className={styles.totalAssetValue}>
{fiatCurrencySymbol}
- {totalBalanceWorth}
+ {totalBalanceWorth.toFixed(2)}
</p>
<p className={styles.remainingAssetValue}>
{fiatCurrencySymbol}
- {remainingBalanceWorth}
+ {remainingBalanceWorth.toFixed(2)}
</p>
</div>
</div> |
4167482bfbbe81cbacca44f31700fab90c5aba8e | components/time-picker/__examples__/default.jsx | components/time-picker/__examples__/default.jsx | import React from 'react';
import IconSettings from '~/components/icon-settings';
import Timepicker from '~/components/time-picker'; // `~` is replaced with design-system-react at runtime
class Example extends React.Component {
static displayName = 'TimepickerExample';
render() {
return (
<IconSettings iconPath="/assets/icons">
<Timepicker
placeholder="Select a time"
stepInMinutes={30}
onDateChange={(date, inputStr) => {
console.log('onDateChange ', date, ' inputStr: ', inputStr);
}}
/>
</IconSettings>
);
}
}
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
| import React from 'react';
import IconSettings from '~/components/icon-settings';
import Timepicker from '~/components/time-picker'; // `~` is replaced with design-system-react at runtime
class Example extends React.Component {
static displayName = 'TimepickerExample';
render() {
return (
<IconSettings iconPath="/assets/icons">
<Timepicker
label="Time"
placeholder="Select a time"
stepInMinutes={30}
onDateChange={(date, inputStr) => {
console.log('onDateChange ', date, ' inputStr: ', inputStr);
}}
/>
</IconSettings>
);
}
}
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
| Add label for TimePicker example | Add label for TimePicker example
| JSX | bsd-3-clause | salesforce/design-system-react,salesforce/design-system-react,salesforce/design-system-react | ---
+++
@@ -10,6 +10,7 @@
return (
<IconSettings iconPath="/assets/icons">
<Timepicker
+ label="Time"
placeholder="Select a time"
stepInMinutes={30}
onDateChange={(date, inputStr) => { |
43e0354510c0fa2ff8c960488a90d8613fd8681b | app/assets/javascripts/components/overview/my_exercises/components/UpcomingExercise.jsx | app/assets/javascripts/components/overview/my_exercises/components/UpcomingExercise.jsx | import React from 'react';
import PropTypes from 'prop-types';
// Components
import ModuleRow from '@components/timeline/TrainingModules/ModuleRow/ModuleRow.jsx';
export const UpcomingExercise = ({ exercise, trainingLibrarySlug }) => (
<table className="table">
<tbody>
<ModuleRow
key={exercise.id}
module={exercise}
trainingLibrarySlug={trainingLibrarySlug}
/>
</tbody>
</table>
);
UpcomingExercise.propTypes = {
exercise: PropTypes.object.isRequired
};
export default UpcomingExercise;
| import React from 'react';
import PropTypes from 'prop-types';
// Components
import ModuleRow from '@components/timeline/TrainingModules/ModuleRow/ModuleRow.jsx';
export const UpcomingExercise = ({ exercise, trainingLibrarySlug }) => (
<table className="table">
<tbody>
<ModuleRow
key={exercise.id}
isStudent
module={exercise}
trainingLibrarySlug={trainingLibrarySlug}
/>
</tbody>
</table>
);
UpcomingExercise.propTypes = {
exercise: PropTypes.object.isRequired
};
export default UpcomingExercise;
| Use isStudent flag for MyExercises | Use isStudent flag for MyExercises
| JSX | mit | WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard | ---
+++
@@ -9,6 +9,7 @@
<tbody>
<ModuleRow
key={exercise.id}
+ isStudent
module={exercise}
trainingLibrarySlug={trainingLibrarySlug}
/> |
58e131fbe5860a600b13b8064f3bfe69cf3e7461 | gxa/src/main/javascript/atlas_bundles/baseline-expression/src/BaselineHeatmapWidget.jsx | gxa/src/main/javascript/atlas_bundles/baseline-expression/src/BaselineHeatmapWidget.jsx | import React from 'react'
import PropTypes from 'prop-types'
import ExpressionAtlasHeatmap from 'expression-atlas-heatmap-highcharts'
const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
const BaselineHeatmapWidget = (props) =>
<div className="row column margin-top-large">
<h5>{(props.showHeatmapLabel ? `${capitalizeFirstLetter(props.species)} β ` : '') + props.factor.value}</h5>
<ExpressionAtlasHeatmap atlasUrl={props.atlasUrl}
query={{
gene: props.geneQuery,
condition: props.conditionQuery,
species: props.species,
source: props.factor.name
}}
isWidget={false}
showAnatomogram={props.showAnatomogram}
/>
</div>
BaselineHeatmapWidget.propTypes = {
atlasUrl: PropTypes.string.isRequired,
geneQuery: PropTypes.string.isRequired,
conditionQuery: PropTypes.string.isRequired,
species: PropTypes.string.isRequired,
factor: PropTypes.shape({
name: PropTypes.string.isRequired,
value: PropTypes.string.isRequired
}).isRequired,
showAnatomogram: PropTypes.bool.isRequired,
showHeatmapLabel: PropTypes.bool.isRequired
}
export default BaselineHeatmapWidget
| import React from 'react'
import PropTypes from 'prop-types'
import ExpressionAtlasHeatmap from 'expression-atlas-heatmap-highcharts'
const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
const BaselineHeatmapWidget = (props) =>
<div className="row column margin-top-large margin-bottom-xlarge">
<h5>{(props.showHeatmapLabel ? `${capitalizeFirstLetter(props.species)} β ` : '') + props.factor.value}</h5>
<ExpressionAtlasHeatmap atlasUrl={props.atlasUrl}
query={{
gene: props.geneQuery,
condition: props.conditionQuery,
species: props.species,
source: props.factor.name
}}
isWidget={false}
showAnatomogram={props.showAnatomogram}
/>
</div>
BaselineHeatmapWidget.propTypes = {
atlasUrl: PropTypes.string.isRequired,
geneQuery: PropTypes.string.isRequired,
conditionQuery: PropTypes.string.isRequired,
species: PropTypes.string.isRequired,
factor: PropTypes.shape({
name: PropTypes.string.isRequired,
value: PropTypes.string.isRequired
}).isRequired,
showAnatomogram: PropTypes.bool.isRequired,
showHeatmapLabel: PropTypes.bool.isRequired
}
export default BaselineHeatmapWidget
| Add some more space between heatmaps | Add some more space between heatmaps
| JSX | apache-2.0 | gxa/atlas,gxa/atlas,gxa/atlas,gxa/atlas,gxa/atlas | ---
+++
@@ -6,7 +6,7 @@
const capitalizeFirstLetter = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
const BaselineHeatmapWidget = (props) =>
- <div className="row column margin-top-large">
+ <div className="row column margin-top-large margin-bottom-xlarge">
<h5>{(props.showHeatmapLabel ? `${capitalizeFirstLetter(props.species)} β ` : '') + props.factor.value}</h5>
<ExpressionAtlasHeatmap atlasUrl={props.atlasUrl}
query={{ |
285013c6e27bf14a2ab98ad2252eca73b146044e | src/components/SideMenuItem.jsx | src/components/SideMenuItem.jsx | import React, { PropTypes } from 'react';
const propTypes = {
fileName: PropTypes.string.isRequired,
fileType: PropTypes.string.isRequired,
};
export default class SideMenuItem extends React.Component {
constructor() {
super();
this.fileTypeToClassName = this.fileTypeToClassName.bind(this);
}
fileTypeToClassName(fileType) {
if (fileType === 'dir') {
return 'icon-folder';
} else if (fileType === 'file') {
return 'icon-doc-text';
} else if (fileType === 'dotfile') {
return 'aaa';
}
return '';
}
render() {
const classes = ['icon', this.fileTypeToClassName(this.props.fileType)];
return (
<span className="nav-group-item">
<span className={classes.join(' ')} />
{this.props.fileName}
</span>
);
}
}
SideMenuItem.propTypes = propTypes;
| import React, { PropTypes } from 'react';
const propTypes = {
fileName: PropTypes.string.isRequired,
fileType: PropTypes.string.isRequired,
};
export default class SideMenuItem extends React.Component {
constructor() {
super();
this.fileTypeToClassName = this.fileTypeToClassName.bind(this);
}
fileTypeToClassName(fileType) {
if (fileType === 'dir') {
return 'icon-folder';
} else if (fileType === 'file') {
return 'icon-doc-text';
} else if (fileType === 'dotfile') {
return 'aaa';
}
return '';
}
render() {
const fileIconClx = ['icon', this.fileTypeToClassName(this.props.fileType)];
const expandIconClass = (this.props.fileType === 'dir') ? 'icon icon-right-dir' : 'icon';
return (
<span className="nav-group-item">
<span className={expandIconClass} />
<span className={fileIconClx.join(' ')} />
{this.props.fileName}
</span>
);
}
}
SideMenuItem.propTypes = propTypes;
| Add right-arrow-icon to sidemenu if filetype is folder | Add right-arrow-icon to sidemenu if filetype is folder
| JSX | mit | tanaka0325/dropnote,tanaka0325/dropnote | ---
+++
@@ -24,10 +24,13 @@
}
render() {
- const classes = ['icon', this.fileTypeToClassName(this.props.fileType)];
+ const fileIconClx = ['icon', this.fileTypeToClassName(this.props.fileType)];
+ const expandIconClass = (this.props.fileType === 'dir') ? 'icon icon-right-dir' : 'icon';
+
return (
<span className="nav-group-item">
- <span className={classes.join(' ')} />
+ <span className={expandIconClass} />
+ <span className={fileIconClx.join(' ')} />
{this.props.fileName}
</span>
); |
5b0dc7a26d53f594a2a0b561158d90170214b5ef | src/ExpandIcon.jsx | src/ExpandIcon.jsx | import React from 'react';
export default ({ expandable, prefixCls, onExpand, needIndentSpaced, expanded, record }) => {
if (expandable) {
const expandClassName = expanded ? 'expanded' : 'collapsed';
return (
<span
className={`${prefixCls}-expand-icon ${prefixCls}-${expandClassName}`}
onClick={() => onExpand(!expanded, record)}
/>
);
} else if (needIndentSpaced) {
return <span className={`${prefixCls}-expand-icon ${prefixCls}-spaced`} />;
}
return null;
};
| import React, { PropTypes } from 'react';
import shallowequal from 'shallowequal';
const ExpandIcon = React.createClass({
propTypes: {
record: PropTypes.object,
prefixCls: PropTypes.string,
expandable: PropTypes.any,
expanded: PropTypes.bool,
needIndentSpaced: PropTypes.bool,
onExpand: PropTypes.func,
},
shouldComponentUpdate(nextProps) {
return !shallowequal(nextProps, this.props);
},
render() {
const { expandable, prefixCls, onExpand, needIndentSpaced, expanded, record } = this.props;
if (expandable) {
const expandClassName = expanded ? 'expanded' : 'collapsed';
return (
<span
className={`${prefixCls}-expand-icon ${prefixCls}-${expandClassName}`}
onClick={() => onExpand(!expanded, record)}
/>
);
} else if (needIndentSpaced) {
return <span className={`${prefixCls}-expand-icon ${prefixCls}-spaced`} />;
}
return null;
},
});
export default ExpandIcon;
| Fix returned null in stateless function in [email protected] | Fix returned null in stateless function in [email protected]
https://github.com/facebook/react/pull/5884
| JSX | mit | react-component/table,react-component/table | ---
+++
@@ -1,16 +1,33 @@
-import React from 'react';
+import React, { PropTypes } from 'react';
+import shallowequal from 'shallowequal';
-export default ({ expandable, prefixCls, onExpand, needIndentSpaced, expanded, record }) => {
- if (expandable) {
- const expandClassName = expanded ? 'expanded' : 'collapsed';
- return (
- <span
- className={`${prefixCls}-expand-icon ${prefixCls}-${expandClassName}`}
- onClick={() => onExpand(!expanded, record)}
- />
- );
- } else if (needIndentSpaced) {
- return <span className={`${prefixCls}-expand-icon ${prefixCls}-spaced`} />;
- }
- return null;
-};
+const ExpandIcon = React.createClass({
+ propTypes: {
+ record: PropTypes.object,
+ prefixCls: PropTypes.string,
+ expandable: PropTypes.any,
+ expanded: PropTypes.bool,
+ needIndentSpaced: PropTypes.bool,
+ onExpand: PropTypes.func,
+ },
+ shouldComponentUpdate(nextProps) {
+ return !shallowequal(nextProps, this.props);
+ },
+ render() {
+ const { expandable, prefixCls, onExpand, needIndentSpaced, expanded, record } = this.props;
+ if (expandable) {
+ const expandClassName = expanded ? 'expanded' : 'collapsed';
+ return (
+ <span
+ className={`${prefixCls}-expand-icon ${prefixCls}-${expandClassName}`}
+ onClick={() => onExpand(!expanded, record)}
+ />
+ );
+ } else if (needIndentSpaced) {
+ return <span className={`${prefixCls}-expand-icon ${prefixCls}-spaced`} />;
+ }
+ return null;
+ },
+});
+
+export default ExpandIcon; |
23848dd37a2e6fd216d2a82c11011be188b673f4 | ui/component/i18nMessage/view.jsx | ui/component/i18nMessage/view.jsx | // @flow
import React from 'react';
type Props = {
tokens: Object,
children: string, // e.g. "Read %faq_link% for more detail"
};
export default function I18nMessage(props: Props) {
const message = __(props.children),
regexp = /%\w+%/g,
matchingGroups = message.match(regexp);
if (!matchingGroups) {
return message;
}
const messageSubstrings = props.children.split(regexp),
tokens = props.tokens;
return (
<React.Fragment>
{messageSubstrings.map((substring, index) => {
const token =
index < matchingGroups.length ? matchingGroups[index].substring(1, matchingGroups[index].length - 1) : null; // get token without % on each side
return (
<React.Fragment key={index}>
{substring}
{token && tokens[token]}
</React.Fragment>
);
})}
</React.Fragment>
);
}
| // @flow
import React from 'react';
type Props = {
tokens: Object,
children: string, // e.g. "Read %faq_link% for more detail"
};
export default function I18nMessage(props: Props) {
const message = __(props.children),
regexp = /%\w+%/g,
matchingGroups = message.match(regexp);
if (!matchingGroups) {
return message;
}
const messageSubstrings = message.split(regexp),
tokens = props.tokens;
return (
<React.Fragment>
{messageSubstrings.map((substring, index) => {
const token =
index < matchingGroups.length ? matchingGroups[index].substring(1, matchingGroups[index].length - 1) : null; // get token without % on each side
return (
<React.Fragment key={index}>
{substring}
{token && tokens[token]}
</React.Fragment>
);
})}
</React.Fragment>
);
}
| Fix <i18nMessage> not localizing the message. | Fix <i18nMessage> not localizing the message.
--- Problem (#4173) ---
Messages under <i18nMessage> weren't localized although the translation is available. However, the tokens for these messages are localized, causing a mixed-language final string.
--- Fix ---
It appears that the original message (instead of the localized) was used in the token-substitution process.
| JSX | mit | lbryio/lbry-electron,lbryio/lbry-app,lbryio/lbry-app,lbryio/lbry-electron,lbryio/lbry-electron | ---
+++
@@ -15,7 +15,7 @@
return message;
}
- const messageSubstrings = props.children.split(regexp),
+ const messageSubstrings = message.split(regexp),
tokens = props.tokens;
return ( |
09735163d064069ffd1d3f1138d3e7a93db93319 | client/src/components/sub/Note.jsx | client/src/components/sub/Note.jsx | import React from 'react';
import Connection from '../../Connection.js'
class Note extends React.Component {
constructor(props){
super(props);
}
saveNote(note){
// this can be invoked when in the compiled view
// send it to the redis cache
}
playNote(note){
// this can be invoked when in the review view
}
render(){
var view;
//props.page will be obtained from redux store.
if (this.props.view === 'Compiled') {
view = (
<div className="note">
'this is a note in compiled'{/*this.props.note*/}
</div>
)
} else if (this.props.view === 'Lecture'){
view = (
<div className="note">
{this.props.note.content + this.props.note.audioTimestamp}
</div>)
} else if (this.props.view === 'Review') {
view = (
<div className="note">
'this is a note in review'{/*this.props.note*/}
</div>
)
}
return view
}
}
export default Connection(Note) | import React from 'react';
import Connection from '../../Connection.js'
class Note extends React.Component {
constructor(props){
super(props);
}
saveNote(note){
// this can be invoked when in the compiled view
// send it to the redis cache
}
playNote(note){
// this can be invoked when in the review view
}
render(){
var view;
//props.page will be obtained from redux store.
if (this.props.view === 'Compiled') {
view = (
<div className="note">
'this is a note in compiled'{/*this.props.note*/}
</div>
)
} else if (this.props.view === 'Lecture'){
view = (
<div className="note">
{this.props.note.content + ' ' + this.props.note.audioTimestamp}
</div>)
} else if (this.props.view === 'Review') {
view = (
<div className="note">
'this is a note in review'{/*this.props.note*/}
</div>
)
}
return view
}
}
export default Connection(Note) | Put space between note message and timestamp | Put space between note message and timestamp
| JSX | mit | derektliu/Picky-Notes,inspiredtolive/Picky-Notes,inspiredtolive/Picky-Notes,inspiredtolive/Picky-Notes,folksy-squid/Picky-Notes,derektliu/Picky-Notes,derektliu/Picky-Notes,folksy-squid/Picky-Notes,folksy-squid/Picky-Notes | ---
+++
@@ -28,7 +28,7 @@
} else if (this.props.view === 'Lecture'){
view = (
<div className="note">
- {this.props.note.content + this.props.note.audioTimestamp}
+ {this.props.note.content + ' ' + this.props.note.audioTimestamp}
</div>)
} else if (this.props.view === 'Review') {
view = ( |
8fe6ae8b22998166c5e216929613f3475c0665d1 | lib/views/Index.jsx | lib/views/Index.jsx | import React from "react";
export default function Index() {
return (
<div>
<div className="heading">
<div className="row">
<div className="col-xs-12 col-md-7 col-lg-6 offset-lg-1 logo" />
<div className="col-xs-12 col-md-5 col-lg-4 col-xl-3 blurb">
<p className="lead">
Are <strong>they</strong> calling back <strong>from beyond the cloud</strong>?
</p>
<a className="btn btn-primary btn-lg" href="/new">Let's find out!</a>
</div>
</div>
</div>
<div className="comics">
<div className="row">
<div className="col-sm-6 col-md-6 col-lg-4 comic comic-1" title="Create a pair of URLs: a trap and a monitor" />
<div className="col-sm-6 col-md-6 col-lg-4 comic comic-2" title="Copy-paste the trap to your favorite chat app, URL shortener, ..." />
<div className="col-sm-12 col-md-12 col-lg-4 comic comic-3" title="The monitor page shows you who visited the trap" />
</div>
</div>
</div>
);
}
| import React from "react";
export default function Index() {
return (
<div>
<div className="heading">
<div className="row">
<div className="col-xs-12 col-md-7 col-lg-6 offset-lg-1 logo" />
<div className="col-xs-12 col-md-5 col-lg-4 col-xl-3 blurb">
<p className="lead">
Are <strong>they</strong> calling back <strong>from beyond the cloud</strong>?
</p>
<a className="btn btn-primary btn-lg" href="/new" title="Create new URI:teller monitor and trap">Let's find out!</a>
</div>
</div>
</div>
<div className="comics">
<div className="row">
<div className="col-sm-6 col-md-6 col-lg-4 comic comic-1" title="Create a pair of URLs: a trap and a monitor" />
<div className="col-sm-6 col-md-6 col-lg-4 comic comic-2" title="Copy-paste the trap to your favorite chat app, URL shortener, ..." />
<div className="col-sm-12 col-md-12 col-lg-4 comic comic-3" title="The monitor page shows you who visited the trap" />
</div>
</div>
</div>
);
}
| Add title attribute for button to create new monitor and trap | Add title attribute for button to create new monitor and trap
| JSX | mit | HowNetWorks/uriteller | ---
+++
@@ -12,7 +12,7 @@
Are <strong>they</strong> calling back <strong>from beyond the cloud</strong>?
</p>
- <a className="btn btn-primary btn-lg" href="/new">Let's find out!</a>
+ <a className="btn btn-primary btn-lg" href="/new" title="Create new URI:teller monitor and trap">Let's find out!</a>
</div>
</div>
</div> |
b3497bf89653af74893c9cb687a3ce3340338d87 | client/components/LandingButton.jsx | client/components/LandingButton.jsx | import React from 'react';
import { Link } from 'react-router';
export default class LandingButton extends React.Component {
constructor(props) {
super(props);
this.state = {
showText: false,
};
}
render() {
return (
<div id="landingButton">
<Link onClick={this.props.handleLandingBtnClick} to="/text">LandingButton</Link>
</div>
);
}
}
| import React from 'react';
import { Link } from 'react-router';
export default class LandingButton extends React.Component {
constructor(props) {
super(props);
this.state = {
showText: false,
};
}
render() {
return (
<div id="landingButton">
<Link
onClick={this.props.handleLandingBtnClick}
to={this.props.directTo}>
{this.props.buttonName}
</Link>
</div>
);
}
}
| Handle props to route to corresponding page | Handle props to route to corresponding page
| JSX | mit | nonchalantkettle/SpeechDoctor,alexxisroxxanne/SpeechDoctor,alexxisroxxanne/SpeechDoctor,nonchalantkettle/SpeechDoctor | ---
+++
@@ -12,7 +12,11 @@
render() {
return (
<div id="landingButton">
- <Link onClick={this.props.handleLandingBtnClick} to="/text">LandingButton</Link>
+ <Link
+ onClick={this.props.handleLandingBtnClick}
+ to={this.props.directTo}>
+ {this.props.buttonName}
+ </Link>
</div>
);
} |
Subsets and Splits