path stringlengths 5 195 | repo_name stringlengths 5 79 | content stringlengths 25 1.01M |
|---|---|---|
src/Main.js | ghostsnstuff/byte | import React from 'react';
import assign from 'object-assign';
import GameLayout from './components/GameLayout/GameLayout';
const { Component, StyleSheet } = React;
const backgroundColors = [
'#8BD47D', // green
'#B43CB0', // purple
'#3F51B5', // indigo
'#FFC107', // yellow
'#F44336', // orange-red
'#00BCD4' // cyan
];
export default class Main extends Component {
onMobileUI () {
if (window.innerWidth <= 475) {
styles.container.paddingTop = null;
}
if (window.innerWidth <= 330) {
styles.widget.fontSize = 14;
}
}
render () {
this.onMobileUI();
return (
<div style={styles.container} className="container">
{/* Game UI */}
<GameLayout />
{/* Content */}
<section className="row" style={{ fontFamily: 'courier', padding: 20, maxWidth: 400, margin: '0 auto', border: '0x solid'}}>
<div style={{ fontSize: 28 }}>
<span><a name="howToPlay" style={{ color: '#000', textDecoration: 'none' }}>How to Play</a></span>
</div>
<div>
<ul style={{ listStyleType: 'decimal' }}>
<li style={styles.li}>
<span style={{ fontWeight: 'bold', letterSpacing: 3 }}>Example</span>
<table className="table-bordered" style={{ marginTop: 15, marginLeft: -25 }}>
<tr>
<section style={{ paddingTop: 10, marginLeft: -25 }}>
<div style={{ fontSize: 16, paddingBottom: 15 }}>Translating binary ... </div>
<div style={{ fontSize: 16, paddingBottom: 15 }}>Using the table below add together the values where 1 is, and voila.</div>
<div style={{ fontSize: 16 }}>10000001 => 128 + 1 = 129</div>
</section>
</tr>
<tr>
<td style={ assign({}, styles.td, { color: '#c7ff4a', backgroundColor: '#5d5d5d' }) }>128</td>
<td style={styles.td}>64</td>
<td style={styles.td}>32</td>
<td style={styles.td}>16</td>
<td style={styles.td}>8</td>
<td style={styles.td}>4</td>
<td style={styles.td}>2</td>
<td style={ assign({}, styles.td, { color: '#c7ff4a', backgroundColor: '#5d5d5d' }) }>1</td>
</tr>
<tr>
<td style={styles.td}>1</td>
<td style={styles.td}>0</td>
<td style={styles.td}>0</td>
<td style={styles.td}>0</td>
<td style={styles.td}>0</td>
<td style={styles.td}>0</td>
<td style={styles.td}>0</td>
<td style={styles.td}>1</td>
</tr>
</table>
</li>
<li style={styles.li}>
<span style={{ fontWeight: 'bold', letterSpacing: 3 }}>Gameplay</span>
<div style={styles.content}>Translate 8-bit binary numbers into their decimal equivalent as many times as possible in 30 seconds.</div>
<div style={styles.content}>For each correct answer your points increase by 2^n (0 to 1 to 2 to 4 to 8 etc).</div>
<div style={styles.content}>When you get to 2048 points, you win! (original)</div>
</li>
<li style={styles.li}>
<span style={{ fontWeight: 'bold', letterSpacing: 3 }}>Binary</span>
<div style={styles.content}>According to Wikipedia, a binary number is a number expressed in the binary numeral system, or base-2 numeral system, which represents numeric values using two different symbols: typically 0 and 1.</div>
</li>
<li style={styles.li}>
<span style={{ fontWeight: 'bold', letterSpacing: 3 }}>WTF</span>
<div style={styles.content}>
How do I convert binary?
<a target="_new" href="https://en.m.wikipedia.org/wiki/Binary_number#Counting_in_binary" style={assign({}, styles.hyperlink, { paddingRight: 5 })}>Explanation, animations, etc.</a>
via Wikipedia.
</div>
</li>
</ul>
</div>
<div style={{ fontSize: 28 }}>
<span>About</span>
<section style={{ paddingTop: 10 }}>
<div style={{ fontSize: 16, paddingBottom: 15 }}>
<span style={styles.byte}>Byte</span> was designed and built at <a target="_new" style={styles.hyperlink} href="https://facebook.com/hubsycafe">hubsy</a> in Paris, France where coffee makes everything possible.
</div>
<div style={{ fontSize: 16, paddingBottom: 15 }}>The game was made for fun by <a target="_new" style={styles.hyperlink} href="http://whoami.pizza">me</a> (isb).</div>
<div style={{ fontSize: 16, paddingBottom: 15 }}>
<a target="_new" href="https://github.com/ghostsnstuff/byte">
<img src="http://cdn.flaticon.com/png/256/25231.png" height="40" width="40" />
</a>
</div>
<div style={{ fontSize: 16, paddingBottom: 15, border: '0px solid' }}>
<img style={{ border: '0px solid', verticalAlign: 'middle', margin: 'auto', display: 'table-cell' }} src="http://ferd.ca/static/img/printf/trashcan.png"/>
</div>
</section>
</div>
</section>
</div>
);
}
}
const styles = {
flexcontainerRow: {
display: '-webkit-flex',
display: 'flex',
WebkitFlexDirection: 'row',
flexDirection: 'row',
WebkitAlignItems: 'center',
alignItems: 'center',
WebkitJustifyContent: 'center',
justifyContent: 'center',
},
container: {
padding: 10,
paddingTop: 45,
maxWidth: 500,
border: '0px solid',
height: '100%'
},
main: {
border: '2px dotted #c7ff4a',
padding: 25,
paddingBottom: 35,
maxWidth: 400,
margin: '0 auto',
backgroundColor: '#5d5d5d',
},
header: {
border: '0px solid',
padding: 10,
textAlign: 'center'
},
navigation: {
border: '0px solid',
paddingTop: 10,
paddingBottom: 10
},
content: {
fontSize: 16,
border: '0px solid',
paddingTop: 15,
marginLeft: -25,
fontWeight: '200'
},
byte: {
letterSpacing: 1,
color: '#c7ff4a',
backgroundColor: '#5d5d5d',
padding: 2,
paddingLeft: 5,
paddingRight: 5
},
GameLaoutContainer: {
border: '0px solid',
height: 90
},
hyperlink: {
color: 'blue',
textDecoration: 'underline'
},
footer: {
borderWidth: 0,
marginTop: 25
},
logo: {
fontSize: 30,
color: '#c7ff4a',
fontFamily: 'courier',
letterSpacing: 6,
border: '0px solid',
},
widget: {
color: '#c7ff4a',
fontFamily: 'courier',
fontSize: 18,
border: '1px solid #c7ff4a',
borderWidth: 2,
padding: 5,
margin: 5,
paddingLeft: 9,
paddingRight: 9,
},
binaryString: {
border: '0px solid',
fontSize: 36,
letterSpacing: 8,
color: '#c7ff4a',
fontFamily: 'courier',
fontWeight: '400'
},
binaryStringContainer: {
border: '0px solid',
height: 70,
},
equals: {
border: '0px solid',
margin: 5,
marginRight: 10,
height: 100,
width: 40,
fontSize: 60,
textAlign: 'center',
color: '#c7ff4a'
},
textField: {
color: '#c7ff4a',
borderWidth: 4,
fontSize: 36,
fontFamily: 'courier',
margin: 5,
height: 60,
width: 100,
borderColor: '#c7ff4a',
backgroundColor: '#5d5d5d',
textAlign: 'center'
},
a: {
color: '#c7ff4a',
textDecoration: 'none'
},
li: {
fontSize: 20,
marginTop: 15
},
td: {
padding: 5,
paddingLeft: 8,
paddingRight: 8,
width: 50,
textAlign: 'center'
},
statsOuterContainer: {
border: '0px solid',
height: 50
},
statsInnerContainer: {
border: '0px solid',
},
stat: {
border: '0px solid',
margin: 10,
fontSize: 22,
fontFamily: 'courier',
fontWeight: '500',
color: '#c7ff4a'
}
};
|
src/app/components/collapsible_demo/collaps_container.js | ROZ32/react-example | import React from 'react';
import image from '../../images/expand-vertical-4.svg';
import Collapsible from './collapsible';
import '../../styles/basic_demos.scss';
import '../../styles/collapsible_demo.scss';
export class CollapsibleContainer extends React.Component {
render() {
return (
<div>
<header>
<img src={image} />
<h1>Collapsible Content</h1>
</header>
<div className="content">
<div id="accordion" role="tablist" aria-multiselectable="true">
<Collapsible title="Title 1" collapsibleShow={true}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Impedit minima hic dolore, ut odit unde voluptatum, officia aperiam dignissimos ex neque facere quidem labore saepe quisquam repellat, deleniti modi tempore culpa. Accusantium numquam exercitationem maxime neque, provident ratione, ut eius ducimus labore odio aliquid! Voluptas atque, ab magni tempore sed repellat accusamus molestias! Nostrum dignissimos officia reiciendis rem nihil dolor ipsa, iste minus minima atque magni quisquam quos, ullam quidem adipisci aperiam! Tempora est beatae nostrum voluptates debitis numquam molestiae dolores aspernatur, veritatis eos, reiciendis quos architecto in aliquid dolorum provident odio earum. Velit, eligendi exercitationem, quo in veritatis nihil.
</Collapsible>
<Collapsible title="Title 2" collapsibleShow={true}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Libero odio iste, sunt dignissimos dolorum similique alias unde veritatis aliquam dolor aliquid, eligendi dolorem impedit, modi neque eaque. Amet rem, temporibus.
</Collapsible>
<Collapsible title="Title 2" collapsibleShow={true}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Beatae voluptas, et quas fuga consequatur enim qui, adipisci quos odit ipsum nam placeat. Vero, ab tenetur porro neque molestias soluta delectus.
</Collapsible>
</div>
</div>
</div>
);
}
}
|
src/layout/hero.js | bokuweb/re-bulma | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from '../../build/styles';
import { getCallbacks } from '../helper/helper';
export default class Hero extends Component {
static propTypes = {
style: PropTypes.object,
children: PropTypes.any,
className: PropTypes.string,
isBold: PropTypes.bool,
size: PropTypes.oneOf([
'isSmall',
'isMedium',
'isLarge',
'isFullheight',
]),
color: PropTypes.oneOf([
'isPrimary',
'isInfo',
'isSuccess',
'isWarning',
'isDanger',
'isLink',
'isWhite',
'isLight',
'isDark',
'isBlack',
'isLink',
]),
};
static defaultProps = {
style: {},
className: '',
};
createClassName() {
return [
styles.hero,
this.props.isBold ? styles.isBold : '',
styles[this.props.size],
styles[this.props.color],
this.props.className,
].join(' ').trim();
}
render() {
return (
<section
{...getCallbacks(this.props)}
style={this.props.style}
className={this.createClassName()}
>
{this.props.children}
</section>
);
}
}
|
src/docs/reference/Accessibility.js | karatechops/grommet-docs | // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import DocsArticle from '../../components/DocsArticle';
import Table from 'grommet/components/Table';
import Status from 'grommet/components/icons/Status';
export default class Accessibility extends Component {
_onClick () {
// no-op
}
render () {
return (
<DocsArticle title='Accessibility'>
<section>
<p>Products that are accessible to all users are good for people,
products, and business. All users should be empowered with access
and the ability to have a pleasant experience with your
application.</p>
<p>We follow the <a href='http://www.w3.org/TR/WCAG20/'>Web Content
Accessibility Guidelines (WCAG)</a>. By following this style guide
and utilizing the accompanying implementation platform, you will be
well on your way to satisfying the WCAG recommendations.</p>
</section>
<section>
<p>This section describes the Grommet guidelines for developing
accessible applications.</p>
<h3>Icons</h3>
<p>The icon components can be read by screen readers. The default
textual description for icons can be overridden by setting
the a11yTitle. The default title or a11yTitle attribute use
localization if it exist.</p>
<h4>Example:</h4>
<Table>
<caption>Example of Icons with different values</caption>
<thead>
<tr>
<th>Icon</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><Status value='critical'/></td>
<td><pre><code className='html hljs xml'>
{"<Status value='critical'>"}</code></pre></td>
</tr>
<tr>
<td><Status value='critical' a11yTitle='Server Down'/></td>
<td><pre><code className='html hljs xml'>
{"<Status value='critical' a11yTitle='Server Down'>"}
</code></pre></td>
</tr>
</tbody>
</Table>
<h3>Menu</h3>
<p>
The Grommet Menu component also supports screen readers. By default,
the Menu component assumes the "menu" role and the focusable
children passed to this component receive the "menuitem" role. The
user can navigate the Menu by using either the tab or arrow keys.
</p>
<h3>Lang attribute</h3>
<p>
If the lang attribute is not explicitly set in the html
element, Grommet will specify the lang attribute according to
the user browser’s locale. In addition to the html element,
lang attribute can be set on other elements like App.
</p>
<h4>Example</h4>
<pre><code className='html hljs xml'>
{"<App lang='en-US'>\n ...\n</App>"}
</code></pre>
<h3>Skip Links</h3>
<p>Grommet has skip links that make it easy to skip repetitive
content. Grommet skip links have two locations: Skip to Main
Content and Skip to Footer. To set the "Skip to Main Content"
link in Grommet, an attribute primary="true" needs to be added
to the main content element. The "Skip to Footer" link is
added by default with the Footer component. </p>
<h4>Example:</h4>
<pre><code className='html hljs xml'>
{"<App>\n" +
" <Article>\n" +
" <Header>\n" +
" <h1>Title</h1>\n" +
" </Header>\n" +
" <Section primary={true}>\n" +
" <h2>Heading</h2>\n" +
" <p>Lorem ipsum ...</p>\n" +
" </Section>\n" +
" </Article>\n" +
"</App>"}
</code></pre>
</section>
</DocsArticle>
);
}
};
|
react/src/index.js | museumary/Museumary | import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
import { BrowserRouter } from 'react-router-dom';
import './index.css';
ReactDOM.render((
<BrowserRouter>
<App />
</BrowserRouter>
), document.getElementById('root'));
|
app/jsx/gradebook/default_gradebook/components/LatePoliciesTabPanel.js | djbender/canvas-lms | /*
* Copyright (C) 2017 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React from 'react'
import {bool, func, number, shape, string} from 'prop-types'
import {Alert} from '@instructure/ui-alerts'
import {View, Grid} from '@instructure/ui-layout'
import {FormFieldGroup} from '@instructure/ui-form-field'
import {NumberInput} from '@instructure/ui-number-input'
import {PresentationContent, ScreenReaderContent} from '@instructure/ui-a11y'
import {Spinner, Text} from '@instructure/ui-elements'
import {Checkbox} from '@instructure/ui-forms'
import CanvasSelect from '../../../shared/components/CanvasSelect'
import NumberHelper from '../../../shared/helpers/numberHelper'
import Round from 'compiled/util/round'
import I18n from 'i18n!gradebook'
const MIN_PERCENTAGE_INPUT = 0
const MAX_PERCENTAGE_INPUT = 100
function isNumeric(input) {
return NumberHelper.validate(input)
}
function validationError(input) {
if (!isNumeric(input)) {
return 'notNumeric'
}
return null
}
function bound(decimal) {
if (decimal < MIN_PERCENTAGE_INPUT) return MIN_PERCENTAGE_INPUT
if (decimal > MAX_PERCENTAGE_INPUT) return MAX_PERCENTAGE_INPUT
return decimal
}
const errorMessages = {
missingSubmissionDeduction: {
notNumeric: I18n.t('Missing submission grade must be numeric')
},
lateSubmissionDeduction: {
notNumeric: I18n.t('Late submission deduction must be numeric')
},
lateSubmissionMinimumPercent: {
notNumeric: I18n.t('Lowest possible grade must be numeric')
}
}
function validationErrorMessage(input, validationType) {
const error = validationError(input)
return errorMessages[validationType][error]
}
function messages(names, validationErrors) {
const errors = names.map(name => validationErrors[name])
return errors.reduce(
(acc, error) => (error ? acc.concat([{text: error, type: 'error'}]) : acc),
[]
)
}
function subtractFromMax(decimal) {
return MAX_PERCENTAGE_INPUT - decimal
}
const numberInputWillUpdateMap = {
missingSubmissionDeduction(decimal) {
// the missingSubmissionDeductionDisplayValue is the difference of `100% - missingSubmissionDeduction`
return subtractFromMax(decimal)
},
lateSubmissionDeduction(decimal) {
return decimal
},
lateSubmissionMinimumPercent(decimal) {
return decimal
}
}
class LatePoliciesTabPanel extends React.Component {
static propTypes = {
latePolicy: shape({
changes: shape({
missingSubmissionDeductionEnabled: bool,
missingSubmissionDeduction: number,
lateSubmissionDeductionEnabled: bool,
lateSubmissionDeduction: number,
lateSubmissionInterval: string,
lateSubmissionMinimumPercent: number
}).isRequired,
validationErrors: shape({
missingSubmissionDeduction: string,
lateSubmissionDeduction: string,
lateSubmissionMinimumPercent: string
}).isRequired,
data: shape({
missingSubmissionDeductionEnabled: bool,
missingSubmissionDeduction: number,
lateSubmissionDeductionEnabled: bool,
lateSubmissionDeduction: number,
lateSubmissionInterval: string,
lateSubmissionMinimumPercentEnabled: bool,
lateSubmissionMinimumPercent: number
})
}).isRequired,
changeLatePolicy: func.isRequired,
locale: string.isRequired,
showAlert: bool.isRequired
}
state = {
showAlert: this.props.showAlert
}
missingPolicyMessages = messages.bind(this, ['missingSubmissionDeduction'])
latePolicyMessages = messages.bind(this, [
'lateSubmissionDeduction',
'lateSubmissionMinimumPercent'
])
componentDidUpdate(_prevProps, prevState) {
if (!prevState.showAlert || this.state.showAlert) {
return
}
const inputEnabled = this.getLatePolicyAttribute('missingSubmissionDeductionEnabled')
if (inputEnabled) {
this.missingSubmissionDeductionInput.focus()
} else {
this.missingSubmissionCheckbox.focus()
}
}
getLatePolicyAttribute = key => {
const {changes, data} = this.props.latePolicy
if (key in changes) {
return changes[key]
}
return data && data[key]
}
changeMissingSubmissionDeductionEnabled = ({target: {checked}}) => {
const changes = this.calculateChanges({missingSubmissionDeductionEnabled: checked})
this.props.changeLatePolicy({...this.props.latePolicy, changes})
}
changeLateSubmissionDeductionEnabled = ({target: {checked}}) => {
const updates = {lateSubmissionDeductionEnabled: checked}
if (!checked) {
updates.lateSubmissionMinimumPercentEnabled = false
} else if (this.getLatePolicyAttribute('lateSubmissionMinimumPercent') > MIN_PERCENTAGE_INPUT) {
updates.lateSubmissionMinimumPercentEnabled = true
}
this.props.changeLatePolicy({
...this.props.latePolicy,
changes: this.calculateChanges(updates)
})
}
handleBlur = name => {
if (this.props.latePolicy.changes[name] == null) {
return
}
const decimal = bound(NumberHelper.parse(this.props.latePolicy.changes[name]))
const errorMessage = validationErrorMessage(decimal, name)
if (errorMessage) {
const validationErrors = {...this.props.latePolicy.validationErrors, [name]: errorMessage}
return this.props.changeLatePolicy({...this.props.latePolicy, validationErrors})
}
const decimalDisplayValue = numberInputWillUpdateMap[name](decimal)
this.setState({[`${name}DisplayValue`]: Round(decimalDisplayValue, 2)}, () => {
const changesData = {[name]: Round(decimal, 2)}
if (name === 'lateSubmissionMinimumPercent') {
changesData[`${name}Enabled`] = changesData[name] !== MIN_PERCENTAGE_INPUT
}
const updates = {
changes: this.calculateChanges(changesData),
validationErrors: {...this.props.latePolicy.validationErrors}
}
delete updates.validationErrors[name]
this.props.changeLatePolicy({...this.props.latePolicy, ...updates})
})
}
handleChange = (name, inputDisplayValue) => {
const nameDisplayValue = `${name}DisplayValue`
this.setState({[nameDisplayValue]: inputDisplayValue}, () => {
let decimal = Round(NumberHelper.parse(inputDisplayValue), 2)
decimal = numberInputWillUpdateMap[name](decimal)
const changes = this.calculateChanges(
{[name]: decimal},
{[nameDisplayValue]: inputDisplayValue}
)
this.props.changeLatePolicy({...this.props.latePolicy, changes})
})
}
changeLateSubmissionInterval = (_event, selectedOption) => {
const changes = this.calculateChanges({lateSubmissionInterval: selectedOption})
this.props.changeLatePolicy({...this.props.latePolicy, changes})
}
calculateChanges(changedData, changedDisplayValues = {}) {
const changes = {...this.props.latePolicy.changes}
Object.keys(changedData).forEach(key => {
const keyDisplayValue = `${key}DisplayValue`
const original = this.props.latePolicy.data[key]
const changed = changedData[key]
const originalAndChangedDiffer = original !== changed
let hasChanges = originalAndChangedDiffer
if (changedDisplayValues.hasOwnProperty(keyDisplayValue)) {
hasChanges = originalAndChangedDiffer !== changedDisplayValues[keyDisplayValue]
}
if (hasChanges) {
changes[key] = changed
} else if (key in changes) {
delete changes[key] // don't track matching values
}
})
return changes
}
closeAlert = () => {
this.setState({showAlert: false})
}
currentInputDisplayValue = (key, defaultValue) => {
const stateDisplayKey = `${key}DisplayValue`
// If the user is in the process of entering something, display it.
if (this.state[stateDisplayKey] != null) {
return this.state[stateDisplayKey]
}
// If the user updated this value, switched to a different tab, then came
// back to this tab, the updated value will be in the changes hash.
if (this.props.latePolicy.changes?.[key] != null) {
const value = this.props.latePolicy.changes[key]
return numberInputWillUpdateMap[key](value)
}
// If there have been no changes, use the value we were passed in.
if (this.props.latePolicy.data?.[key] != null) {
const value = this.props.latePolicy.data[key]
return numberInputWillUpdateMap[key](value)
}
// If we haven't been given a value yet, punt and show a default.
return defaultValue
}
render() {
if (!this.props.latePolicy.data) {
return (
<div id="LatePoliciesTabPanel__Container-noContent">
<Spinner renderTitle={I18n.t('Loading')} size="large" margin="small" />
</div>
)
}
const {validationErrors} = this.props.latePolicy
const data = {...this.props.latePolicy.data, ...this.props.latePolicy.changes}
return (
<div id="LatePoliciesTabPanel__Container">
<View as="div" margin="small">
<Checkbox
label={I18n.t('Automatically apply grade for missing submissions')}
checked={data.missingSubmissionDeductionEnabled}
onChange={this.changeMissingSubmissionDeductionEnabled}
ref={c => {
this.missingSubmissionCheckbox = c
}}
/>
</View>
<FormFieldGroup
description={<ScreenReaderContent>{I18n.t('Missing policies')}</ScreenReaderContent>}
messages={this.missingPolicyMessages(validationErrors)}
>
<View as="div" margin="small small small large">
<div className="NumberInput__Container">
<Grid vAlign="bottom" colSpacing="small">
<Grid.Row>
<Grid.Col width="auto">
<NumberInput
id="missing-submission-grade"
locale={this.props.locale}
inputRef={m => {
this.missingSubmissionDeductionInput = m
}}
renderLabel={I18n.t('Grade percentage for missing submissions')}
disabled={!this.getLatePolicyAttribute('missingSubmissionDeductionEnabled')}
value={this.currentInputDisplayValue(
'missingSubmissionDeduction',
MAX_PERCENTAGE_INPUT
)}
onBlur={_event => this.handleBlur('missingSubmissionDeduction')}
onChange={(_event, val) =>
this.handleChange('missingSubmissionDeduction', val)
}
placeholder="100"
showArrows={false}
/>
</Grid.Col>
<Grid.Col width="auto">
<View margin="0 0 x-small" display="block">
<Text weight="bold">{I18n.t('%')}</Text>
</View>
</Grid.Col>
</Grid.Row>
</Grid>
</div>
</View>
</FormFieldGroup>
<PresentationContent>
<hr />
</PresentationContent>
{this.state.showAlert && (
<Alert
variant="warning"
closeButtonLabel={I18n.t('Close')}
onDismiss={this.closeAlert}
margin="small"
>
{I18n.t('Changing the late policy will affect previously graded submissions.')}
</Alert>
)}
<View as="div" margin="small">
<Checkbox
label={I18n.t('Automatically apply deduction to late submissions')}
defaultChecked={data.lateSubmissionDeductionEnabled}
onChange={this.changeLateSubmissionDeductionEnabled}
/>
</View>
<FormFieldGroup
description={<ScreenReaderContent>{I18n.t('Late policies')}</ScreenReaderContent>}
messages={this.latePolicyMessages(validationErrors)}
>
<View as="div" margin="small small small large">
<div style={{display: 'flex', alignItems: 'center'}}>
<Grid vAlign="bottom" colSpacing="small">
<Grid.Row>
<Grid.Col width="auto">
<NumberInput
id="late-submission-deduction"
locale={this.props.locale}
inputRef={l => {
this.lateSubmissionDeductionInput = l
}}
renderLabel={I18n.t('Late submission deduction percent')}
disabled={!this.getLatePolicyAttribute('lateSubmissionDeductionEnabled')}
value={this.currentInputDisplayValue(
'lateSubmissionDeduction',
MIN_PERCENTAGE_INPUT
)}
onBlur={_event => this.handleBlur('lateSubmissionDeduction')}
onChange={(_event, val) => this.handleChange('lateSubmissionDeduction', val)}
placeholder="0"
showArrows={false}
/>
</Grid.Col>
<Grid.Col width="auto">
<View margin="0 0 x-small" display="block">
<Text weight="bold">{I18n.t('%')}</Text>
</View>
</Grid.Col>
<Grid.Col width="auto">
<CanvasSelect
disabled={!this.getLatePolicyAttribute('lateSubmissionDeductionEnabled')}
id="late-submission-interval"
label={I18n.t('Late submission deduction interval')}
onChange={this.changeLateSubmissionInterval}
value={data.lateSubmissionInterval}
>
<CanvasSelect.Option key="day" id="day" value="day">
{I18n.t('Day')}
</CanvasSelect.Option>
<CanvasSelect.Option key="hour" id="hour" value="hour">
{I18n.t('Hour')}
</CanvasSelect.Option>
</CanvasSelect>
</Grid.Col>
</Grid.Row>
<Grid.Row>
<Grid.Col width="auto">
<NumberInput
id="late-submission-minimum-percent"
locale={this.props.locale}
inputRef={l => {
this.lateSubmissionMinimumPercentInput = l
}}
renderLabel={I18n.t('Lowest possible grade percent')}
value={this.currentInputDisplayValue(
'lateSubmissionMinimumPercent',
MIN_PERCENTAGE_INPUT
)}
disabled={!this.getLatePolicyAttribute('lateSubmissionDeductionEnabled')}
onBlur={_event => this.handleBlur('lateSubmissionMinimumPercent')}
onChange={(_event, val) =>
this.handleChange('lateSubmissionMinimumPercent', val)
}
placeholder="0"
inline
showArrows={false}
/>
</Grid.Col>
<Grid.Col width="auto">
<View margin="0 0 x-small" display="block">
<Text weight="bold">{I18n.t('%')}</Text>
</View>
</Grid.Col>
</Grid.Row>
</Grid>
</div>
</View>
</FormFieldGroup>
</div>
)
}
}
export default LatePoliciesTabPanel
|
src/routes/index.js | abkfenris/inferno-react | import React from 'react'
import { Route, IndexRoute } from 'react-router'
// NOTE: here we're making use of the `resolve.root` configuration
// option in webpack, which allows us to specify import paths as if
// they were from the root of the ~/src directory. This makes it
// very easy to navigate to files regardless of how deeply nested
// your current file is.
import CoreLayout from 'layouts/CoreLayout/CoreLayout'
import HomeView from 'views/HomeView/HomeView'
export default (store) => (
<Route path='/' component={CoreLayout}>
<IndexRoute component={HomeView} />
</Route>
)
|
techCurriculum/ui/solutions/2.4/src/App.js | jennybkim/engineeringessentials | /**
* Copyright 2017 Goldman Sachs.
* 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.
**/
import React from 'react';
import Title from './components/Title';
function App() {
return (
<div>
<Title />
</div>
);
}
export default App;
|
src/views/HomeView/HomeView.js | pawelniewie/presento | import React from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router'
import { actions as counterActions } from '../../redux/modules/presentation'
import DuckImage from './Duck.jpg'
import classes from './HomeView.scss'
// We define mapStateToProps where we'd normally use
// the @connect decorator so the data requirements are clear upfront, but then
// export the decorated component after the main class definition so
// the component can be tested w/ and w/o being connected.
// See: http://rackt.github.io/redux/docs/recipes/WritingTests.html
const mapStateToProps = (state) => ({
})
export class HomeView extends React.Component {
render () {
return (
<div className='container text-center'>
<div className='row'>
<div className='col-xs-2 col-xs-offset-5'>
<img className={classes.duck}
src={DuckImage}
alt='This is a duck, because Redux.' />
</div>
</div>
<h1>Available presentations</h1>
<p>
<Link to='/gun-preso'>Jak zdobyć pozwolenie na broń?</Link>
</p>
</div>
)
}
}
export default connect(mapStateToProps, counterActions)(HomeView)
|
source/component/button/single.js | togayther/react-native-cnblogs | import React, { Component } from 'react';
import Icon from 'react-native-vector-icons/Ionicons';
import ActionButton from 'react-native-action-button';
import { ComponentStyles, StyleConfig } from '../../style';
class SingleButton extends Component {
constructor(props) {
super(props);
}
renderButtonIcon(){
const { icon = 'ios-arrow-round-back' } = this.props;
return (
<Icon
name={ icon }
size = { StyleConfig.icon_size }
style={ ComponentStyles.button_icon } />
)
}
render() {
const {
onPress = ()=>null,
color = StyleConfig.action_color_primary,
position ='left',
offsetX = StyleConfig.action_offset_x,
offsetY = StyleConfig.action_offset_y
} = this.props;
return (
<ActionButton
offsetY = { offsetY }
offsetX = { offsetX }
size = { StyleConfig.action_size }
position={ position }
buttonColor = { color }
onPress = { ()=>onPress() }
hideShadow = { true }
icon = { this.renderButtonIcon() }>
</ActionButton>
)
}
}
export default SingleButton;
|
tests/react_modules/es6class-types-module.js | gabro/flow | /* @flow */
import React from 'react';
type Props = {name: string};
class Hello extends React.Component<{}, Props, void>{
props: Props;
static defaultProps: {};
render(): React.Element<*> {
return <div>{this.props.name}</div>;
}
}
module.exports = Hello;
|
js/App.js | CineCor/CinecorReactNative |
import React, { Component } from 'react';
import AppNavigator from './AppNavigator';
import I18n from 'react-native-i18n';
I18n.fallbacks = true;
console.log(I18n.currentLocale())
class App extends Component {
render() {
return <AppNavigator />;
}
}
export default App;
|
src/icons/Clock.js | fbfeix/react-icons | import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class Clock extends React.Component {
render() {
if(this.props.bare) {
return <g>
<g>
<path d="M255.988,32C132.285,32,32,132.298,32,256c0,123.715,100.285,224,223.988,224C379.703,480,480,379.715,480,256
C480,132.298,379.703,32,255.988,32z M391.761,391.765c-10.099,10.098-21.126,18.928-32.886,26.42l-15.946-27.62l-13.856,8
l15.955,27.636c-24.838,13.03-52.372,20.455-81.027,21.624V416h-16v31.825c-28.656-1.166-56.191-8.59-81.03-21.62l15.958-27.641
l-13.856-8l-15.949,27.625c-11.761-7.492-22.79-16.324-32.889-26.424c-10.099-10.099-18.93-21.127-26.422-32.889l27.624-15.949
l-8-13.855L85.796,345.03c-13.03-24.839-20.454-52.374-21.621-81.03H96v-16H64.175c1.167-28.655,8.592-56.19,21.623-81.029
l27.638,15.958l8-13.856l-27.623-15.948c7.492-11.76,16.322-22.787,26.419-32.885c10.1-10.101,21.129-18.933,32.89-26.426
l15.949,27.624l13.856-8l-15.958-27.64C191.81,72.765,219.345,65.34,248,64.175V96h16V64.176
c28.654,1.169,56.188,8.595,81.026,21.626l-15.954,27.634l13.856,8l15.945-27.618c11.76,7.492,22.787,16.323,32.886,26.421
c10.1,10.099,18.931,21.126,26.424,32.887l-27.619,15.946l8,13.856l27.636-15.956c13.031,24.839,20.457,52.373,21.624,81.027H416
v16h31.824c-1.167,28.655-8.592,56.189-21.622,81.028l-27.637-15.957l-8,13.856l27.621,15.947
C410.693,370.637,401.861,381.665,391.761,391.765z"></path>
<path d="M400,241H284.268c-2.818-5.299-7.083-9.708-12.268-12.708V160h-32v68.292c-9.562,5.534-16,15.866-16,27.708
c0,17.673,14.327,32,32,32c11.425,0,21.444-5.992,27.106-15H400V241z"></path>
</g>
</g>;
} return <IconBase>
<g>
<path d="M255.988,32C132.285,32,32,132.298,32,256c0,123.715,100.285,224,223.988,224C379.703,480,480,379.715,480,256
C480,132.298,379.703,32,255.988,32z M391.761,391.765c-10.099,10.098-21.126,18.928-32.886,26.42l-15.946-27.62l-13.856,8
l15.955,27.636c-24.838,13.03-52.372,20.455-81.027,21.624V416h-16v31.825c-28.656-1.166-56.191-8.59-81.03-21.62l15.958-27.641
l-13.856-8l-15.949,27.625c-11.761-7.492-22.79-16.324-32.889-26.424c-10.099-10.099-18.93-21.127-26.422-32.889l27.624-15.949
l-8-13.855L85.796,345.03c-13.03-24.839-20.454-52.374-21.621-81.03H96v-16H64.175c1.167-28.655,8.592-56.19,21.623-81.029
l27.638,15.958l8-13.856l-27.623-15.948c7.492-11.76,16.322-22.787,26.419-32.885c10.1-10.101,21.129-18.933,32.89-26.426
l15.949,27.624l13.856-8l-15.958-27.64C191.81,72.765,219.345,65.34,248,64.175V96h16V64.176
c28.654,1.169,56.188,8.595,81.026,21.626l-15.954,27.634l13.856,8l15.945-27.618c11.76,7.492,22.787,16.323,32.886,26.421
c10.1,10.099,18.931,21.126,26.424,32.887l-27.619,15.946l8,13.856l27.636-15.956c13.031,24.839,20.457,52.373,21.624,81.027H416
v16h31.824c-1.167,28.655-8.592,56.189-21.622,81.028l-27.637-15.957l-8,13.856l27.621,15.947
C410.693,370.637,401.861,381.665,391.761,391.765z"></path>
<path d="M400,241H284.268c-2.818-5.299-7.083-9.708-12.268-12.708V160h-32v68.292c-9.562,5.534-16,15.866-16,27.708
c0,17.673,14.327,32,32,32c11.425,0,21.444-5.992,27.106-15H400V241z"></path>
</g>
</IconBase>;
}
};Clock.defaultProps = {bare: false} |
app/javascript/mastodon/features/notifications/components/notifications_permission_banner.js | yukimochi/mastodon | import React from 'react';
import Icon from 'mastodon/components/icon';
import Button from 'mastodon/components/button';
import IconButton from 'mastodon/components/icon_button';
import { requestBrowserPermission } from 'mastodon/actions/notifications';
import { changeSetting } from 'mastodon/actions/settings';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' },
});
export default @connect()
@injectIntl
class NotificationsPermissionBanner extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
handleClick = () => {
this.props.dispatch(requestBrowserPermission());
}
handleClose = () => {
this.props.dispatch(changeSetting(['notifications', 'dismissPermissionBanner'], true));
}
render () {
const { intl } = this.props;
return (
<div className='notifications-permission-banner'>
<div className='notifications-permission-banner__close'>
<IconButton icon='times' onClick={this.handleClose} title={intl.formatMessage(messages.close)} />
</div>
<h2><FormattedMessage id='notifications_permission_banner.title' defaultMessage='Never miss a thing' /></h2>
<p><FormattedMessage id='notifications_permission_banner.how_to_control' defaultMessage="To receive notifications when Mastodon isn't open, enable desktop notifications. You can control precisely which types of interactions generate desktop notifications through the {icon} button above once they're enabled." values={{ icon: <Icon id='sliders' /> }} /></p>
<Button onClick={this.handleClick}><FormattedMessage id='notifications_permission_banner.enable' defaultMessage='Enable desktop notifications' /></Button>
</div>
);
}
}
|
src/svg-icons/device/battery-charging-50.js | spiermar/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let DeviceBatteryCharging50 = (props) => (
<SvgIcon {...props}>
<path d="M14.47 13.5L11 20v-5.5H9l.53-1H7v7.17C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13.5h-2.53z"/><path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v8.17h2.53L13 7v5.5h2l-.53 1H17V5.33C17 4.6 16.4 4 15.67 4z"/>
</SvgIcon>
);
DeviceBatteryCharging50 = pure(DeviceBatteryCharging50);
DeviceBatteryCharging50.displayName = 'DeviceBatteryCharging50';
DeviceBatteryCharging50.muiName = 'SvgIcon';
export default DeviceBatteryCharging50;
|
src/mui/detail/ShowActions.js | marmelab/admin-on-rest | import React from 'react';
import { CardActions } from 'material-ui/Card';
import { ListButton, EditButton, DeleteButton, RefreshButton } from '../button';
const cardActionStyle = {
zIndex: 2,
display: 'inline-block',
float: 'right',
};
const ShowActions = ({ basePath, data, hasDelete, hasEdit, hasList }) => (
<CardActions style={cardActionStyle}>
{hasEdit && <EditButton basePath={basePath} record={data} />}
{hasList && <ListButton basePath={basePath} />}
{hasDelete && <DeleteButton basePath={basePath} record={data} />}
<RefreshButton />
</CardActions>
);
export default ShowActions;
|
src/components/Root/index.js | johnnyghost/react-redux-boilerplate | import React from 'react';
import { Provider } from 'react-redux';
import routes from 'routes';
import { Router, browserHistory } from 'react-router';
import configureStore from 'store/configureStore';
const store = configureStore();
/**
* <Root />
* The entry point component.
*
* @return {JSXElement}
*/
const Root = ():Object => {
return (
<Provider store={store}>
<Router history={browserHistory}>
{routes}
</Router>
</Provider>
)
}
export default Root;
|
src/js/components/Header.js | schabou/cheap-booze | import React from 'react';
import { Jumbotron } from 'react-bootstrap';
export default class Header extends React.Component {
constructor(props) {
super(props);
}
render() {
return(
<Jumbotron style={{'textAlign': 'center'}}>
<h1>Booze is expensive</h1>
<p>Save a bit of money and find the cheapest and most convenient booze by using this app! Click the button and we will find you
the cheapest booze possible at the closest available LCBO, and even give you directions on how to get there.</p>
</Jumbotron>
);
}
} |
client/me/security/controller.js | tinkertinker/wp-calypso | /**
* External dependencies
*/
import React from 'react';
import page from 'page';
import i18n from 'i18n-calypso';
/**
* Internal dependencies
*/
import analytics from 'lib/analytics';
import notices from 'notices';
import userSettings from 'lib/user-settings';
import { setDocumentHeadTitle as setTitle } from 'state/document-head/actions';
import { renderWithReduxStore } from 'lib/react-helpers';
const ANALYTICS_PAGE_TITLE = 'Me';
export default {
password( context ) {
const PasswordComponent = require( 'me/security/main' );
const basePath = context.path;
const accountPasswordData = require( 'lib/account-password-data' );
context.store.dispatch( setTitle( i18n.translate( 'Password', { textOnly: true } ) ) ); // FIXME: Auto-converted from the Flux setTitle action. Please use <DocumentHead> instead.
if ( context.query && context.query.updated === 'password' ) {
notices.success( i18n.translate( 'Your password was saved successfully.' ), { displayOnNextPage: true } );
page.replace( window.location.pathname );
}
analytics.pageView.record( basePath, ANALYTICS_PAGE_TITLE + ' > Password' );
renderWithReduxStore(
React.createElement( PasswordComponent,
{
userSettings: userSettings,
path: context.path,
accountPasswordData: accountPasswordData
}
),
document.getElementById( 'primary' ),
context.store
);
},
twoStep( context ) {
const TwoStepComponent = require( 'me/two-step' ),
basePath = context.path,
appPasswordsData = require( 'lib/application-passwords-data' );
context.store.dispatch( setTitle( i18n.translate( 'Two-Step Authentication', { textOnly: true } ) ) ); // FIXME: Auto-converted from the Flux setTitle action. Please use <DocumentHead> instead.
analytics.pageView.record( basePath, ANALYTICS_PAGE_TITLE + ' > Two-Step Authentication' );
renderWithReduxStore(
React.createElement( TwoStepComponent,
{
userSettings: userSettings,
path: context.path,
appPasswordsData: appPasswordsData
}
),
document.getElementById( 'primary' ),
context.store
);
},
connectedApplications( context ) {
const ConnectedAppsComponent = require( 'me/connected-applications' ),
basePath = context.path,
connectedAppsData = require( 'lib/connected-applications-data' );
context.store.dispatch( setTitle( i18n.translate( 'Connected Applications', { textOnly: true } ) ) ); // FIXME: Auto-converted from the Flux setTitle action. Please use <DocumentHead> instead.
analytics.pageView.record( basePath, ANALYTICS_PAGE_TITLE + ' > Connected Applications' );
renderWithReduxStore(
React.createElement( ConnectedAppsComponent,
{
userSettings: userSettings,
path: context.path,
connectedAppsData: connectedAppsData
}
),
document.getElementById( 'primary' ),
context.store
);
},
securityCheckup( context ) {
const CheckupComponent = require( 'me/security-checkup' ),
basePath = context.path;
context.store.dispatch( setTitle( i18n.translate( 'Security Checkup', { textOnly: true } ) ) ); // FIXME: Auto-converted from the Flux setTitle action. Please use <DocumentHead> instead.
analytics.pageView.record( basePath, ANALYTICS_PAGE_TITLE + ' > Security Checkup' );
renderWithReduxStore(
React.createElement( CheckupComponent,
{
userSettings: userSettings,
path: context.path
}
),
document.getElementById( 'primary' ),
context.store
);
}
};
|
src/app/components/layout/LanguagePickerDialog.js | meedan/check-web | import React from 'react';
import { PropTypes } from 'prop-types';
import { FormattedMessage, defineMessages, injectIntl, intlShape } from 'react-intl';
import Button from '@material-ui/core/Button';
import CircularProgress from '@material-ui/core/CircularProgress';
import TextField from '@material-ui/core/TextField';
import Autocomplete from '@material-ui/lab/Autocomplete';
import { makeStyles } from '@material-ui/core/styles';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import { FormattedGlobalMessage } from '../MappedMessage';
import { safelyParseJSON } from '../../helpers';
import LanguageRegistry, { languageLabel } from '../../LanguageRegistry';
const messages = defineMessages({
optionLabel: {
id: 'languagePickerDialog.optionLabel',
defaultMessage: '{languageName} ({languageCode})',
},
unknownLanguage: {
id: 'languagePickerDialog.unknownLanguage',
defaultMessage: 'Unknown language',
},
});
const useStyles = makeStyles(() => ({
dialog: {
position: 'absolute',
top: 60,
},
}));
const LanguagePickerDialog = ({
intl,
isSaving,
onDismiss,
onSubmit,
open,
team,
}) => {
const classes = useStyles();
const [value, setValue] = React.useState(null);
const languages = safelyParseJSON(team.get_languages) || [];
languages.unshift('und');
const options = (languages ? languages.concat('disabled') : [])
.concat(Object.keys(LanguageRegistry)
.filter(code => !languages.includes(code)));
// intl.formatMessage needed here because Autocomplete
// performs toLowerCase on strings for comparison
const getOptionLabel = (code) => {
if (code === 'disabled') return '──────────';
if (code === 'und') return intl.formatMessage(messages.unknownLanguage);
return intl.formatMessage(messages.optionLabel, {
languageName: (
LanguageRegistry[code] ?
`${LanguageRegistry[code].name} / ${languageLabel(code)}` :
`${languageLabel(code)}`
),
languageCode: code,
});
};
const handleChange = (e, val) => {
setValue(val);
};
const handleSubmit = () => {
onSubmit({ languageCode: value, languageName: languageLabel(value) });
};
return (
<Dialog
open={open}
maxWidth="xs"
PaperProps={{
className: window.parent === window ? '' : classes.dialog, // Fixed position in browser extension
}}
fullWidth
>
<DialogTitle>
<FormattedMessage id="languagePickerDialog.title" defaultMessage="Choose a language" />
</DialogTitle>
<DialogContent>
<Autocomplete
id="autocomplete-add-language"
name="autocomplete-add-language"
options={options}
openOnFocus
getOptionLabel={getOptionLabel}
getOptionDisabled={option => option === 'disabled'}
value={value}
renderInput={
params => (<TextField
label={
<FormattedMessage
id="languagePickerDialog.selectLanguage"
defaultMessage="Select a language"
/>
}
{...params}
/>)
}
onChange={handleChange}
fullWidth
/>
</DialogContent>
<DialogActions>
<Button className="add-language-action__cancel" onClick={onDismiss}>
<FormattedGlobalMessage messageKey="cancel" />
</Button>
<Button
className="add-language-action__submit"
color="primary"
endIcon={isSaving ? <CircularProgress color="inherit" size="1em" /> : null}
disabled={!value || isSaving}
onClick={handleSubmit}
variant="contained"
>
<FormattedGlobalMessage messageKey="submit" />
</Button>
</DialogActions>
</Dialog>
);
};
LanguagePickerDialog.propTypes = {
isSaving: PropTypes.bool.isRequired,
intl: intlShape.isRequired,
onDismiss: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,
team: PropTypes.shape({
id: PropTypes.string.isRequired,
get_languages: PropTypes.string.isRequired,
}).isRequired,
};
export default injectIntl(LanguagePickerDialog);
|
src/js/components/home/homefooter.js | axuebin/react-blog | import React from 'react';
import '../../../css/home/homefooter.css';
export default class HomeFooter extends React.Component {
render() {
return (
<div className="home-footer">
<p>®axuebin</p>
</div>
);
}
}
|
packages/xo-web/src/common/xo/migrate-vms-modal/index.js | vatesfr/xo-web | import BaseComponent from 'base-component'
import every from 'lodash/every'
import flatten from 'lodash/flatten'
import forEach from 'lodash/forEach'
import filter from 'lodash/filter'
import find from 'lodash/find'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import React from 'react'
import some from 'lodash/some'
import store from 'store'
import _ from '../../intl'
import Icon from 'icon'
import invoke from '../../invoke'
import SingleLineRow from '../../single-line-row'
import Tooltip from '../../tooltip'
import { Col } from '../../grid'
import { getDefaultNetworkForVif, getDefaultMigrationNetwork } from '../utils'
import { SelectHost, SelectNetwork, SelectSr } from '../../select-objects'
import { connectStore, createCompare } from '../../utils'
import { createGetObjectsOfType, createPicker, createSelector, getObject } from '../../selectors'
import { isSrShared } from 'xo'
import { isSrWritable } from '../'
const LINE_STYLE = { paddingBottom: '1em' }
@connectStore(
() => {
const getNetworks = createGetObjectsOfType('network')
const getPifs = createGetObjectsOfType('PIF')
const getPools = createGetObjectsOfType('pool')
const getVms = createGetObjectsOfType('VM').pick((_, props) => props.vms)
const getVbdsByVm = createGetObjectsOfType('VBD')
.pick(createSelector(getVms, vms => flatten(map(vms, vm => vm.$VBDs))))
.groupBy('VM')
const getVifsByVM = createGetObjectsOfType('VIF')
.pick(createSelector(getVms, vms => flatten(map(vms, vm => vm.VIFs))))
.groupBy('$VM')
return {
networks: getNetworks,
pifs: getPifs,
pools: getPools,
vbdsByVm: getVbdsByVm,
vifsByVm: getVifsByVM,
vms: getVms,
}
},
{ withRef: true }
)
export default class MigrateVmsModalBody extends BaseComponent {
constructor(props) {
super(props)
this._getHostPredicate = createSelector(
() => this.props.vms,
vms => host => some(vms, vm => host.id !== vm.$container)
)
this._getSrPredicate = createSelector(
() => this.state.host,
host => (host ? sr => isSrWritable(sr) && (sr.$container === host.id || sr.$container === host.$pool) : false)
)
this._getTargetNetworkPredicate = createSelector(
createPicker(
() => this.props.pifs,
() => this.state.host.$PIFs
),
pifs => {
if (!pifs) {
return false
}
const networks = {}
forEach(pifs, pif => {
networks[pif.$network] = true
})
return network => networks[network.id]
}
)
this._getMigrationNetworkPredicate = createSelector(
createPicker(
() => this.props.pifs,
() => this.state.host.$PIFs
),
pifs => {
if (!pifs) {
return false
}
const networks = {}
forEach(pifs, pif => {
pif.ip && (networks[pif.$network] = true)
})
return network => networks[network.id]
}
)
}
componentDidMount() {
this._selectHost(this.props.host)
}
get value() {
const { host } = this.state
const vms = filter(this.props.vms, vm => vm.$container !== host.id)
if (!host || isEmpty(vms)) {
return { vms }
}
const { networks, pifs, vbdsByVm, vifsByVm } = this.props
const { doNotMigrateVdi, doNotMigrateVmVdis, migrationNetworkId, networkId, smartVifMapping, srId } = this.state
// Map VM --> ( Map VDI --> SR )
// 2021-02-16: Fill the map (VDI -> SR) with *all* the VDIs to avoid unexpectedly migrating them to the wrong SRs:
// - Intra-pool: a VDI will only be migrated to the selected SR if the VDI was on a local SR.
// - Inter-pool: all VDIs will be migrated to the selected SR.
const mapVmsMapVdisSrs = {}
forEach(vbdsByVm, (vbds, vm) => {
const mapVdisSrs = {}
forEach(vbds, vbd => {
const vdi = vbd.VDI
if (!vbd.is_cd_drive && vdi) {
mapVdisSrs[vdi] = doNotMigrateVmVdis[vm] || doNotMigrateVdi[vdi] ? this._getObject(vdi).$SR : srId
}
})
mapVmsMapVdisSrs[vm] = mapVdisSrs
})
const defaultNetwork =
smartVifMapping &&
invoke(() => {
// First PIF with an IP.
const pifId = find(host.$PIFs, pif => pifs[pif].ip)
const pif = pifId && pifs[pifId]
return pif && pif.$network
})
// Map VM --> ( Map VIF --> network )
const mapVmsMapVifsNetworks = {}
forEach(vms, vm => {
if (vm.$pool === host.$pool) {
return
}
const mapVifsNetworks = {}
forEach(vifsByVm[vm.id], vif => {
mapVifsNetworks[vif.id] = smartVifMapping
? getDefaultNetworkForVif(vif, host, pifs, networks) || defaultNetwork
: networkId
})
mapVmsMapVifsNetworks[vm.id] = mapVifsNetworks
})
return {
mapVmsMapVdisSrs,
mapVmsMapVifsNetworks,
migrationNetwork: migrationNetworkId,
sr: srId,
targetHost: host.id,
vms,
}
}
_getObject(id) {
return getObject(store.getState(), id)
}
_selectHost = host => {
if (!host) {
this.setState({ targetHost: undefined })
return
}
const { pools, pifs } = this.props
const intraPool = every(this.props.vms, vm => vm.$pool === host.$pool)
const defaultMigrationNetworkId = getDefaultMigrationNetwork(intraPool, host, pools, pifs)
const defaultSrId = pools[host.$pool].default_SR
const defaultSrConnectedToHost = some(host.$PBDs, pbd => this._getObject(pbd).SR === defaultSrId)
const doNotMigrateVmVdis = {}
const doNotMigrateVdi = {}
let noVdisMigration = false
if (intraPool) {
forEach(this.props.vbdsByVm, (vbds, vm) => {
if (this._getObject(vm).$container === host.id) {
doNotMigrateVmVdis[vm] = true
return
}
const _doNotMigrateVdi = {}
forEach(vbds, vbd => {
if (vbd.VDI != null) {
doNotMigrateVdi[vbd.VDI] = _doNotMigrateVdi[vbd.VDI] = isSrShared(
this._getObject(this._getObject(vbd.VDI).$SR)
)
}
})
doNotMigrateVmVdis[vm] = every(_doNotMigrateVdi)
})
noVdisMigration = every(doNotMigrateVmVdis)
}
this.setState({
defaultSrConnectedToHost,
defaultSrId,
host,
intraPool,
doNotMigrateVdi,
doNotMigrateVmVdis,
migrationNetworkId: defaultMigrationNetworkId,
networkId: defaultMigrationNetworkId,
noVdisMigration,
smartVifMapping: true,
srId: defaultSrConnectedToHost ? defaultSrId : undefined,
})
}
getCompareContainers = createSelector(
() => this.props.vms,
vms => createCompare([pool => some(vms, vm => vm.$pool === pool.id)])
)
_selectMigrationNetwork = migrationNetwork =>
this.setState({ migrationNetworkId: migrationNetwork == null ? undefined : migrationNetwork.id })
_selectNetwork = network => this.setState({ networkId: network.id })
_selectSr = sr => this.setState({ srId: sr.id })
_toggleSmartVifMapping = () => this.setState({ smartVifMapping: !this.state.smartVifMapping })
render() {
const {
defaultSrConnectedToHost,
defaultSrId,
host,
intraPool,
migrationNetworkId,
networkId,
noVdisMigration,
smartVifMapping,
srId,
} = this.state
return (
<div>
<div style={LINE_STYLE}>
<SingleLineRow>
<Col size={6}>{_('migrateVmSelectHost')}</Col>
<Col size={6}>
<SelectHost
compareContainers={this.getCompareContainers()}
onChange={this._selectHost}
predicate={this._getHostPredicate()}
value={host}
/>
</Col>
</SingleLineRow>
</div>
{host !== undefined && (
<div style={LINE_STYLE}>
<SingleLineRow>
<Col size={6}>{_('migrateVmSelectMigrationNetwork')}</Col>
<Col size={6}>
<SelectNetwork
onChange={this._selectMigrationNetwork}
predicate={this._getMigrationNetworkPredicate()}
required={!intraPool}
value={migrationNetworkId}
/>
</Col>
</SingleLineRow>
{intraPool && <i>{_('optionalEntry')}</i>}
</div>
)}
{host && (!noVdisMigration || migrationNetworkId != null) && (
<div key='sr' style={LINE_STYLE}>
<SingleLineRow>
<Col size={6}>
{!intraPool ? _('migrateVmsSelectSr') : _('migrateVmsSelectSrIntraPool')}{' '}
{(defaultSrId === undefined || !defaultSrConnectedToHost) && (
<Tooltip
content={
defaultSrId !== undefined
? _('migrateVmNotConnectedDefaultSrError')
: _('migrateVmNoDefaultSrError')
}
>
<Icon
icon={defaultSrId !== undefined ? 'alarm' : 'info'}
className={defaultSrId !== undefined ? 'text-warning' : 'text-info'}
size='lg'
/>
</Tooltip>
)}
</Col>
<Col size={6}>
<SelectSr onChange={this._selectSr} predicate={this._getSrPredicate()} required value={srId} />
</Col>
</SingleLineRow>
</div>
)}
{host && !intraPool && (
<div key='network' style={LINE_STYLE}>
<SingleLineRow>
<Col size={6}>{_('migrateVmsSelectNetwork')}</Col>
<Col size={6}>
<SelectNetwork
disabled={smartVifMapping}
onChange={this._selectNetwork}
predicate={this._getTargetNetworkPredicate()}
value={networkId}
/>
</Col>
</SingleLineRow>
<SingleLineRow>
<Col size={6} offset={6}>
<input type='checkbox' onChange={this._toggleSmartVifMapping} checked={smartVifMapping} />{' '}
{_('migrateVmsSmartMapping')}
</Col>
</SingleLineRow>
</div>
)}
</div>
)
}
}
|
packages/ringcentral-widgets/components/ActiveCallItemV2/index.js | ringcentral/ringcentral-js-widget | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import sessionStatus from 'ringcentral-integration/modules/Webphone/sessionStatus';
import {
isInbound,
isRinging,
} from 'ringcentral-integration/lib/callLogHelpers';
import { isOnHold } from 'ringcentral-integration/modules/Webphone/webphoneHelper';
import CallIcon from '../CallIcon';
import ContactDisplay from '../ContactDisplay';
import CircleButton from '../CircleButton';
import EndIcon from '../../assets/images/End.svg';
import HoldIcon from '../../assets/images/Hold.svg';
import SwitchIcon from '../../assets/images/Flip.svg';
import VoicemailIcon from '../../assets/images/Voicemail.svg';
import AnswerIcon from '../../assets/images/Answer.svg';
import MergeIntoConferenceIcon from '../../assets/images/MergeIntoConferenceIcon.svg';
import TransferIcon from '../../assets/images/Transfer.svg';
import MediaObject from '../MediaObject';
import DurationCounter from '../DurationCounter';
import styles from './styles.scss';
import i18n from '../ActiveCallItem/i18n'; // Reuse the exsisting translations
function WebphoneButtons({
currentLocale,
session,
webphoneReject,
webphoneHangup,
webphoneResume,
webphoneAnswer,
webphoneHold,
showMergeCall,
showHold,
disableMerge,
onMergeCall,
disableLinks,
}) {
if (!session) {
return null;
}
let hangupFunc = webphoneHangup;
let endIcon = EndIcon;
let answerBtn = null;
let rejectTitle = i18n.getString('hangup', currentLocale);
const holdTitle = i18n.getString('hold', currentLocale);
const unholdTitle = i18n.getString('unhold', currentLocale);
if (isInbound(session) && session.callStatus === sessionStatus.connecting) {
hangupFunc = webphoneReject;
endIcon = VoicemailIcon;
rejectTitle = i18n.getString('toVoicemail', currentLocale);
showHold = false;
answerBtn = (
<span
title={i18n.getString('accept', currentLocale)}
className={styles.webphoneButton}
>
<CircleButton
className={styles.answerButton}
onClick={(e) => {
e.stopPropagation();
webphoneAnswer(session.id);
}}
icon={AnswerIcon}
showBorder={false}
disabled={disableLinks}
/>
</span>
);
}
let holdBtn;
let mergeBtn;
if (showHold) {
if (isOnHold(session)) {
holdBtn = (
<span title={unholdTitle} className={styles.webphoneButton}>
<CircleButton
className={classnames(styles.holdButton, styles.active)}
onClick={(e) => {
e.stopPropagation();
webphoneResume(session.id);
}}
iconWidth={260}
iconX={120}
icon={HoldIcon}
disabled={disableLinks}
showBorder
/>
</span>
);
} else {
holdBtn = (
<span title={holdTitle} className={styles.webphoneButton}>
<CircleButton
className={styles.holdButton}
onClick={(e) => {
e.stopPropagation();
webphoneHold(session.id);
}}
iconWidth={260}
iconX={120}
icon={HoldIcon}
disabled={disableLinks}
showBorder
/>
</span>
);
}
}
if (showMergeCall) {
const mergeTitle = i18n.getString('mergeToConference', currentLocale);
mergeBtn = (
<span title={mergeTitle} className={styles.webphoneButton}>
<CircleButton
className={classnames({
[styles.mergeButton]: true,
[styles.disabled]: disableMerge,
})}
onClick={(e) => {
e.stopPropagation();
onMergeCall(session.id);
}}
iconWidth={260}
iconX={120}
icon={MergeIntoConferenceIcon}
showBorder
disabled={disableMerge || disableLinks}
dataSign={mergeTitle}
/>
</span>
);
}
return (
<div className={styles.webphoneButtons}>
{mergeBtn}
{holdBtn}
<span
title={rejectTitle}
data-sign="toVoiceMail"
className={styles.webphoneButton}
>
<CircleButton
className={styles.rejectButton}
onClick={(e) => {
e.stopPropagation();
hangupFunc(session.id);
}}
iconWidth={260}
iconX={120}
icon={endIcon}
showBorder={false}
disabled={disableLinks}
/>
</span>
{answerBtn}
</div>
);
}
WebphoneButtons.propTypes = {
currentLocale: PropTypes.string.isRequired,
session: PropTypes.object,
webphoneReject: PropTypes.func,
webphoneHangup: PropTypes.func,
webphoneResume: PropTypes.func,
webphoneHold: PropTypes.func,
showMergeCall: PropTypes.bool,
showHold: PropTypes.bool,
disableMerge: PropTypes.bool,
onMergeCall: PropTypes.func,
webphoneAnswer: PropTypes.func,
disableLinks: PropTypes.bool,
};
WebphoneButtons.defaultProps = {
session: undefined,
webphoneReject: undefined,
webphoneHangup: undefined,
webphoneResume: undefined,
webphoneHold: undefined,
showMergeCall: false,
showHold: true,
disableMerge: true,
onMergeCall: (i) => i,
webphoneAnswer: (i) => i,
disableLinks: false,
};
function ActiveCallControlButtons({
showRingoutCallControl,
showSwitchCall,
currentLocale,
disableLinks,
telephonySessionId,
ringoutHangup,
ringoutReject,
ringoutTransfer,
ringing,
inbound,
webphoneSwitchCall,
}) {
if (!showRingoutCallControl && !showSwitchCall) return null;
let swithCallButton;
if (showSwitchCall) {
swithCallButton = (
<span
title={i18n.getString('switchCall', currentLocale)}
className={styles.ringoutButton}
data-sign="switchCall"
>
<CircleButton
disabled={disableLinks}
className={classnames({
[styles.switchButton]: true,
[styles.disabled]: disableLinks,
})}
onClick={(e) => {
e.stopPropagation();
webphoneSwitchCall();
}}
icon={SwitchIcon}
showBorder
/>
</span>
);
}
if (!showRingoutCallControl) {
return <div className={styles.ringoutButtons}>{swithCallButton}</div>;
}
let endButton;
const inComingCall = inbound && ringing;
if (inComingCall) {
const rejectTitle = i18n.getString('reject', currentLocale);
endButton = (
<span
title={rejectTitle}
className={styles.ringoutButton}
data-sign="hangup"
>
<CircleButton
disabled={disableLinks}
className={classnames({
[styles.endButton]: true,
[styles.disabled]: disableLinks,
})}
onClick={(e) => {
e.stopPropagation();
ringoutReject(telephonySessionId);
}}
icon={EndIcon}
showBorder={false}
/>
</span>
);
} else {
const hangupTitle = i18n.getString('hangup', currentLocale);
endButton = (
<span
title={hangupTitle}
className={styles.ringoutButton}
data-sign="hangup"
>
<CircleButton
disabled={disableLinks}
className={classnames({
[styles.endButton]: true,
[styles.disabled]: disableLinks,
})}
onClick={(e) => {
e.stopPropagation();
ringoutHangup(telephonySessionId);
}}
icon={EndIcon}
showBorder={false}
/>
</span>
);
}
let transferBtn;
if (ringoutTransfer && !inComingCall) {
const transferTitle = i18n.getString('transfer', currentLocale);
transferBtn = (
<span
title={transferTitle}
className={styles.ringoutButton}
data-sign="transfer"
>
<CircleButton
disabled={disableLinks}
className={classnames({
[styles.transferButton]: true,
[styles.disabled]: disableLinks,
})}
onClick={(e) => {
e.stopPropagation();
ringoutTransfer(telephonySessionId);
}}
icon={TransferIcon}
/>
</span>
);
}
return (
<div className={styles.ringoutButtons}>
{endButton}
{transferBtn}
{swithCallButton}
</div>
);
}
ActiveCallControlButtons.propTypes = {
currentLocale: PropTypes.string.isRequired,
disableLinks: PropTypes.bool,
ringoutHangup: PropTypes.func,
ringoutTransfer: PropTypes.func,
ringing: PropTypes.bool.isRequired,
inbound: PropTypes.bool.isRequired,
telephonySessionId: PropTypes.string.isRequired,
ringoutReject: PropTypes.func,
showRingoutCallControl: PropTypes.bool.isRequired,
showSwitchCall: PropTypes.bool.isRequired,
webphoneSwitchCall: PropTypes.func,
};
ActiveCallControlButtons.defaultProps = {
disableLinks: false,
ringoutHangup: undefined,
ringoutTransfer: undefined,
ringoutReject: undefined,
webphoneSwitchCall: undefined,
};
/**
* TODO: Gradually replace <ActiveCallItem/> with this component
*/
export default class ActiveCallItem extends Component {
constructor(props) {
super(props);
this.state = {
selected: 0,
isLogging: false,
avatarUrl: null,
extraNum: 0,
};
this._userSelection = false;
this.contactDisplay = null;
this.webphoneToVoicemail = (sessionId) => {
if (typeof this.props.webphoneToVoicemail !== 'function') {
return;
}
this.props.webphoneToVoicemail(sessionId);
this.toVoicemailTimeout = setTimeout(() => {
this.props.webphoneReject(sessionId);
}, 3000);
};
}
setContact(nextProps = this.props) {
const { isOnConferenceCall, conferenceCallParties } = nextProps;
if (isOnConferenceCall) {
this.setState({
avatarUrl: conferenceCallParties.map((profile) => profile.avatarUrl)[0],
extraNum:
conferenceCallParties.length > 0
? conferenceCallParties.length - 1
: 0,
});
return;
}
const selected = this.getSelectedContactIdx(nextProps);
this.onSelectContact(
this.getSelectedContact(selected, nextProps),
selected,
);
}
componentDidMount() {
this._mounted = true;
this.setContact();
}
componentWillReceiveProps(nextProps) {
if (this.getContactMatches(nextProps) !== this.getContactMatches()) {
this.setContact(nextProps);
}
}
componentWillUnmount() {
this._mounted = false;
if (this.toVoicemailTimeout) {
clearTimeout(this.toVoicemailTimeout);
this.toVoicemailTimeout = null;
}
}
getCallInfo() {
const {
call: { telephonyStatus, startTime, offset },
disableLinks,
currentLocale,
showCallDetail,
} = this.props;
if (!showCallDetail) {
return null;
}
const telephonyStatusInfo = i18n.getString(telephonyStatus, currentLocale);
return (
<div className={styles.callDetail}>
{disableLinks ? (
i18n.getString('unavailable', currentLocale)
) : (
<DurationCounter startTime={startTime} offset={offset} />
)}
<span className={styles.split}>|</span>
<span title={telephonyStatusInfo}>{telephonyStatusInfo}</span>
</div>
);
}
getFallbackContactName() {
return isInbound(this.props.call)
? this.props.call.from.name
: this.props.call.to.name;
}
onSelectContact = (value, idx) => {
if (!value || typeof this.props.getAvatarUrl !== 'function') {
return;
}
this._userSelection = true;
this.setState({
selected: idx,
});
if (value) {
this.props.getAvatarUrl(value).then((avatarUrl) => {
if (this._mounted) {
this.setState({ avatarUrl });
}
});
if (this.props.call.webphoneSession) {
this.props.updateSessionMatchedContact(
this.props.call.webphoneSession.id,
value,
);
}
}
};
getSelectedContactIdx = (nextProps = this.props) => {
const contactMatches = this.getContactMatches(nextProps);
let selected = null;
if (!nextProps.call.webphoneSession) {
selected = 0;
} else if (contactMatches && contactMatches.length) {
const contact = nextProps.call.webphoneSession.contactMatch;
if (contact) {
selected = contactMatches.findIndex((match) => match.id === contact.id);
}
if (selected === -1 || !contact) {
selected = 0;
}
}
return selected;
};
getSelectedContact = (
selected = this.getSelectedContactIdx(),
nextProps = this.props,
) => {
const contactMatches = this.getContactMatches(nextProps);
return (contactMatches && contactMatches[selected]) || null;
};
getContactMatches(nextProps = this.props) {
return isInbound(nextProps.call)
? nextProps.call.fromMatches
: nextProps.call.toMatches;
}
getPhoneNumber() {
return isInbound(this.props.call)
? this.props.call.from.phoneNumber || this.props.call.from.extensionNumber
: this.props.call.to.phoneNumber || this.props.call.to.extensionNumber;
}
webphoneSwitchCall = () => this.props.webphoneSwitchCall(this.props.call);
render() {
const {
call: { direction, webphoneSession, telephonySessionId },
disableLinks,
currentLocale,
areaCode,
countryCode,
enableContactFallback,
isLogging,
brand,
showContactDisplayPlaceholder,
webphoneHangup,
webphoneResume,
sourceIcons,
phoneTypeRenderer,
phoneSourceNameRenderer,
renderContactName,
renderExtraButton,
contactDisplayStyle,
isOnConferenceCall,
webphoneHold,
onClick,
showMergeCall,
showHold,
showAvatar,
disableMerge,
onMergeCall,
showCallDetail,
webphoneAnswer,
ringoutHangup,
ringoutTransfer,
ringoutReject,
showRingoutCallControl,
showSwitchCall,
showMultipleMatch,
} = this.props;
const { avatarUrl, extraNum } = this.state;
const phoneNumber = this.getPhoneNumber();
const contactMatches = this.getContactMatches();
const fallbackContactName = this.getFallbackContactName();
const ringing = isRinging(this.props.call);
const inbound = isInbound(this.props.call);
const contactName =
typeof renderContactName === 'function'
? renderContactName(this.props.call)
: undefined;
const extraButton =
typeof renderExtraButton === 'function' ? (
<div className={styles.extraButton}>
{renderExtraButton(this.props.call)}
</div>
) : (
undefined
);
const hasCallControl = !!(
webphoneSession ||
showRingoutCallControl ||
showSwitchCall
);
const cursorPointer = hasCallControl && !!onClick;
return (
<div data-sign="callItem" className={styles.callItemContainer}>
<MediaObject
containerCls={styles.wrapper}
bodyCls={classnames({
[styles.content]: true,
[styles.cursorPointer]: cursorPointer,
[styles.cursorUnset]: !cursorPointer,
[styles.disabled]: hasCallControl && disableLinks,
})}
leftCls={classnames({
[styles.cursorPointer]: cursorPointer,
[styles.cursorUnset]: !cursorPointer,
[styles.disabled]: hasCallControl && disableLinks,
})}
mediaLeft={
<div onClick={hasCallControl && onClick ? onClick : null}>
<CallIcon
direction={direction}
ringing={ringing}
active
missed={false}
inboundTitle={i18n.getString('inboundCall', currentLocale)}
outboundTitle={i18n.getString('outboundCall', currentLocale)}
missedTitle={i18n.getString('missedCall', currentLocale)}
isOnConferenceCall={isOnConferenceCall}
showAvatar={showAvatar}
avatarUrl={avatarUrl}
extraNum={extraNum}
/>
</div>
}
mediaBody={
<div
onClick={hasCallControl && onClick ? onClick : null}
className={styles.strechVertical}
>
<ContactDisplay
isOnConferenceCall={isOnConferenceCall}
contactName={showMultipleMatch ? undefined : contactName}
className={classnames(
styles.contactDisplay,
contactDisplayStyle,
)}
contactMatches={contactMatches}
selected={this.state.selected}
onSelectContact={this.onSelectContact}
disabled={!showMultipleMatch}
iconClassName={
showMultipleMatch ? undefined : styles.selectIcon
}
isLogging={isLogging || this.state.isLogging}
fallBackName={fallbackContactName}
enableContactFallback={enableContactFallback}
areaCode={areaCode}
countryCode={countryCode}
phoneNumber={phoneNumber}
currentLocale={currentLocale}
brand={brand}
showPlaceholder={showContactDisplayPlaceholder}
showType={false}
sourceIcons={sourceIcons}
phoneTypeRenderer={phoneTypeRenderer}
phoneSourceNameRenderer={phoneSourceNameRenderer}
/>
{showCallDetail ? this.getCallInfo() : null}
</div>
}
mediaRight={
<div className={styles.actionIconsBox}>
{webphoneSession ? (
<WebphoneButtons
session={webphoneSession}
webphoneReject={this.webphoneToVoicemail}
webphoneHangup={webphoneHangup}
webphoneResume={webphoneResume}
webphoneHold={webphoneHold}
currentLocale={currentLocale}
showMergeCall={showMergeCall}
showHold={showHold}
disableMerge={disableMerge}
onMergeCall={onMergeCall}
webphoneAnswer={webphoneAnswer}
/>
) : (
<ActiveCallControlButtons
showSwitchCall={!webphoneSession && showSwitchCall}
webphoneSwitchCall={this.webphoneSwitchCall}
showRingoutCallControl={showRingoutCallControl}
telephonySessionId={telephonySessionId}
disableLinks={disableLinks}
currentLocale={currentLocale}
ringing={ringing}
inbound={inbound}
ringoutReject={ringoutReject}
ringoutHangup={ringoutHangup}
ringoutTransfer={ringoutTransfer}
/>
)}
{extraButton}
</div>
}
/>
</div>
);
}
}
ActiveCallItem.propTypes = {
call: PropTypes.shape({
direction: PropTypes.string.isRequired,
telephonyStatus: PropTypes.string,
startTime: PropTypes.number.isRequired,
activityMatches: PropTypes.array.isRequired,
fromMatches: PropTypes.array.isRequired,
toMatches: PropTypes.array.isRequired,
from: PropTypes.shape({
phoneNumber: PropTypes.string,
extensionNumber: PropTypes.string,
name: PropTypes.string,
}).isRequired,
to: PropTypes.shape({
phoneNumber: PropTypes.string,
extensionNumber: PropTypes.string,
name: PropTypes.string,
}),
webphoneSession: PropTypes.object,
telephonySessionId: PropTypes.string,
}).isRequired,
areaCode: PropTypes.string.isRequired,
countryCode: PropTypes.string.isRequired,
currentLocale: PropTypes.string.isRequired,
disableLinks: PropTypes.bool,
isLogging: PropTypes.bool,
webphoneReject: PropTypes.func,
webphoneHangup: PropTypes.func,
webphoneResume: PropTypes.func,
webphoneToVoicemail: PropTypes.func,
webphoneSwitchCall: PropTypes.func,
webphoneHold: PropTypes.func,
enableContactFallback: PropTypes.bool,
brand: PropTypes.string,
showContactDisplayPlaceholder: PropTypes.bool,
sourceIcons: PropTypes.object,
phoneTypeRenderer: PropTypes.func,
phoneSourceNameRenderer: PropTypes.func,
renderContactName: PropTypes.func,
renderExtraButton: PropTypes.func,
contactDisplayStyle: PropTypes.string,
isOnConferenceCall: PropTypes.bool,
onClick: PropTypes.func,
showAvatar: PropTypes.bool,
getAvatarUrl: PropTypes.func,
showMergeCall: PropTypes.bool,
showHold: PropTypes.bool,
disableMerge: PropTypes.bool,
onMergeCall: PropTypes.func,
showCallDetail: PropTypes.bool,
updateSessionMatchedContact: PropTypes.func,
webphoneAnswer: PropTypes.func,
ringoutHangup: PropTypes.func,
ringoutTransfer: PropTypes.func,
showRingoutCallControl: PropTypes.bool,
ringoutReject: PropTypes.func,
showMultipleMatch: PropTypes.bool,
showSwitchCall: PropTypes.bool,
};
ActiveCallItem.defaultProps = {
isLogging: false,
disableLinks: false,
webphoneReject: undefined,
webphoneHangup: undefined,
webphoneResume: undefined,
webphoneToVoicemail: undefined,
webphoneHold: undefined,
webphoneSwitchCall: undefined,
enableContactFallback: undefined,
brand: 'RingCentral',
showContactDisplayPlaceholder: true,
sourceIcons: undefined,
phoneTypeRenderer: undefined,
phoneSourceNameRenderer: undefined,
renderContactName: undefined,
renderExtraButton: undefined,
contactDisplayStyle: undefined,
isOnConferenceCall: false,
onClick: undefined,
showAvatar: true,
getAvatarUrl: undefined,
showMergeCall: false,
showHold: true,
disableMerge: false,
onMergeCall: (i) => i,
showCallDetail: false,
updateSessionMatchedContact: (i) => i,
webphoneAnswer: (i) => i,
ringoutHangup: undefined,
ringoutTransfer: undefined,
ringoutReject: undefined,
showRingoutCallControl: false,
showMultipleMatch: false,
showSwitchCall: false,
};
|
src/svg-icons/social/plus-one.js | pancho111203/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialPlusOne = (props) => (
<SvgIcon {...props}>
<path d="M10 8H8v4H4v2h4v4h2v-4h4v-2h-4zm4.5-1.92V7.9l2.5-.5V18h2V5z"/>
</SvgIcon>
);
SocialPlusOne = pure(SocialPlusOne);
SocialPlusOne.displayName = 'SocialPlusOne';
SocialPlusOne.muiName = 'SvgIcon';
export default SocialPlusOne;
|
src/index.js | Andumino/SimpleWeatherApp | if (module.hot) {
module.hot.accept();
}
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from './store';
import { fetchLocation, fetchWeather } from './actions';
import App from './components/App/App';
//import './index.scss';
const store = configureStore();
// store.subscribe(() => {
// console.log('store.subscribe, ', store.getState());
// });
store.dispatch(fetchLocation());
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('app')
);
|
src/components/app.js | regMeet/ReactSelector | import React, { Component } from 'react';
import ReduxFormReactSelect from './reduxFormReactSelect';
export default class App extends Component {
render() {
return (
<div>
React simple starter
<ReduxFormReactSelect />
</div>
);
}
}
|
docs/app/Examples/collections/Breadcrumb/Content/BreadcrumbExampleSection.js | Rohanhacker/Semantic-UI-React | import React from 'react'
import { Breadcrumb } from 'semantic-ui-react'
const BreadcrumbExampleSection = () => (
<Breadcrumb>
<Breadcrumb.Section link>Home</Breadcrumb.Section>
<Breadcrumb.Divider />
<Breadcrumb.Section active>Search</Breadcrumb.Section>
</Breadcrumb>
)
export default BreadcrumbExampleSection
|
ReactNativeExampleApp/node_modules/react-native/Libraries/Utilities/throwOnWrongReactAPI.js | weien/Auth0Exercise | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule throwOnWrongReactAPI
* @flow
*/
'use strict';
function throwOnWrongReactAPI(key: string) {
throw new Error(
`Seems you're trying to access 'ReactNative.${key}' from the 'react-native' package. Perhaps you meant to access 'React.${key}' from the 'react' package instead?
For example, instead of:
import React, { Component, View } from 'react-native';
You should now do:
import React, { Component } from 'react';
import { View } from 'react-native';
Check the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1
`);
}
module.exports = throwOnWrongReactAPI;
|
src/client/routes.js | fk1blow/react-presentception | import React from 'react';
import {DefaultRoute, NotFoundRoute, Route} from 'react-router';
// usual routes found on a web app...
import App from './components/app';
import Home from './components/home';
import NotFound from './components/notfound';
import About from './components/about-page';
import Configuration from './components/configure-page';
// presentation page - dashboard and presentation show/details
import Presentation from './components/presentation';
import PresentationDashboard from './components/presentation/dashboard';
import PresentationDetails from './components/presentation/details';
// slide presentator wrapper - proxy of a `RouteHandler` component
import SlidePresentator from './components/presentator/slide-wrapper';
// remote peers/control endpoints
import Remote from './components/remote';
import RemoteConnect from './components/remote/connect';
import RemoteDashboard from './components/remote/dashboard';
import RemoteControl from './components/remote/control';
export default (
<Route handler={App}>
<DefaultRoute handler={Home} name="home" />
<Route name="presentations" handler={Presentation}>
<DefaultRoute name="presentations-dashboard" handler={PresentationDashboard} />
<Route name="presentation-details" handler={PresentationDetails} path=":id">
<Route name="slide-presentation" handler={SlidePresentator} path="slides/:index" />
</Route>
</Route>
<Route name="remote" handler={Remote}>
<DefaultRoute name="remote-dashboard" handler={RemoteDashboard} />
<Route name="remote-connect" handler={RemoteConnect} path="connect" />
<Route name="remote-control" handler={RemoteControl} path="control" />
</Route>
<Route handler={About} name="about" />
<Route handler={Configuration} name="configuration" />
<NotFoundRoute handler={NotFound} name="not-found" />
</Route>
);
|
src/svg-icons/action/trending-flat.js | ichiohta/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionTrendingFlat = (props) => (
<SvgIcon {...props}>
<path d="M22 12l-4-4v3H3v2h15v3z"/>
</SvgIcon>
);
ActionTrendingFlat = pure(ActionTrendingFlat);
ActionTrendingFlat.displayName = 'ActionTrendingFlat';
ActionTrendingFlat.muiName = 'SvgIcon';
export default ActionTrendingFlat;
|
src/components/GithubButton/GithubButton.js | twomoonsfactory/custom-poll | import React from 'react';
const GithubButton = (props) => {
const {user, repo, type, width, height, count, large} = props;
let src = `https://ghbtns.com/github-btn.html?user=${user}&repo=${repo}&type=${type}`;
if (count) src += '&count=true';
if (large) src += '&size=large';
return (
<iframe
src={src}
frameBorder="0"
allowTransparency="true"
scrolling="0"
width={width}
height={height}
style={{border: 'none', width: width, height: height}}></iframe>
);
};
GithubButton.propTypes = {
user: React.PropTypes.string.isRequired,
repo: React.PropTypes.string.isRequired,
type: React.PropTypes.oneOf(['star', 'watch', 'fork', 'follow']).isRequired,
width: React.PropTypes.number.isRequired,
height: React.PropTypes.number.isRequired,
count: React.PropTypes.bool,
large: React.PropTypes.bool
};
export default GithubButton;
|
src/helpers/UdTokenTagger.js | OCMC-Translation-Projects/ioc-liturgical-react | import React from 'react';
import PropTypes from 'prop-types';
import {
Button
, FormControl
, FormGroup
, Tab
, Tabs
, Well
} from 'react-bootstrap';
import FontAwesome from 'react-fontawesome';
import { get } from 'lodash';
import TreeNode from '../classes/TreeNode';
import LabelSelector from '../helpers/LabelSelector';
import MessageIcons from '../helpers/MessageIcons';
import Server from '../helpers/Server';
import Spinner from '../helpers/Spinner';
import UiSchemas from "../classes/UiSchemas";
/**
* Provides a means for the user to set the tags for a token.
* A token can be a word or a punctuation mark.
* The tags initialize using information from the database via the rest api.
* The user then has the option of manually setting tag values,
* or if the user selects an analysis from an external source,
* e.g. Perseus (displayed via the Grammar component),
* the selected values are copied and become parms to the TokenTagger.
* The new values are saved back to the database.
*
* Note: the grammar tags are set by TreeNode.getGrammar()
*/
class TokenTagger extends React.Component {
constructor(props) {
super(props);
this.state = this.setTheState(props, "");
this.getAspectComponent = this.getAspectComponent.bind(this);
this.getCaseComponent = this.getCaseComponent.bind(this);
this.getDefiniteComponent = this.getDefiniteComponent.bind(this);
this.getDegreeComponent = this.getDegreeComponent.bind(this);
this.getDependencyComponent = this.getDependencyComponent.bind(this);
this.getGenderComponent = this.getGenderComponent.bind(this);
this.getLabelComponent = this.getLabelComponent.bind(this);
this.getMoodComponent = this.getMoodComponent.bind(this);
this.getNumberComponent = this.getNumberComponent.bind(this);
this.getNumTypeComponent = this.getNumTypeComponent.bind(this);
this.getPartOfSpeechComponent = this.getPartOfSpeechComponent.bind(this);
this.getPossComponent = this.getPossComponent.bind(this);
this.getPersonComponent = this.getPersonComponent.bind(this);
this.getPronTypeComponent = this.getPronTypeComponent.bind(this);
this.getReferentComponent = this.getReferentComponent.bind(this);
this.getTabs = this.getTabs.bind(this);
this.getTenseComponent = this.getTenseComponent.bind(this);
this.getVerbNumberComponent = this.getVerbNumberComponent.bind(this);
this.getVerbFormComponent = this.getVerbFormComponent.bind(this);
this.getVoiceComponent = this.getVoiceComponent.bind(this);
this.handleAspectChange = this.handleAspectChange.bind(this);
this.handleCaseChange = this.handleCaseChange.bind(this);
this.handleDefiniteChange = this.handleDefiniteChange.bind(this);
this.handleDegreeChange = this.handleDegreeChange.bind(this);
this.handleDependencyChange = this.handleDependencyChange.bind(this);
this.handleGenderChange = this.handleGenderChange.bind(this);
this.handleGlossChange = this.handleGlossChange.bind(this);
this.handleLabelChange = this.handleLabelChange.bind(this);
this.handleLemmaChange = this.handleLemmaChange.bind(this);
this.handleMoodChange = this.handleMoodChange.bind(this);
this.handleNumberChange = this.handleNumberChange.bind(this);
this.handleNumTypeChange = this.handleNumTypeChange.bind(this);
this.handlePartOfSpeechChange = this.handlePartOfSpeechChange.bind(this);
this.handlePersonChange = this.handlePersonChange.bind(this);
this.handlePossChange = this.handlePossChange.bind(this);
this.handlePronTypeChange = this.handlePronTypeChange.bind(this);
this.handleReferentChange = this.handleReferentChange.bind(this);
this.handleTenseChange = this.handleTenseChange.bind(this);
this.handleVerbFormChange = this.handleVerbFormChange.bind(this);
this.handleVoiceChange = this.handleVoiceChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.submitUpdate = this.submitUpdate.bind(this);
this.toggleSubmit = this.toggleSubmit.bind(this);
this.handleValueUpdateCallback = this.handleValueUpdateCallback.bind(this);
this.getSubmitMessage = this.getSubmitMessage.bind(this);
this.normalizeIndex = this.normalizeIndex.bind(this);
};
componentWillMount = () => {
};
componentWillReceiveProps = (nextProps) => {
this.state = this.setTheState(nextProps, this.state);
};
setTheState = (props, currentState) => {
let index = props.index;
let tokenAnalysis = props.tokenAnalysis;
let labels = props.session.labels;
let labelTopics = props.session.labelTopics;
let labelGrammarTermsTitles = labels[labelTopics.grammarTermsTitles];
let labelAspect = labels[labelTopics.UDtagsAspect];
let labelCase = labels[labelTopics.UDtagsCase];
let labelCategories = labels[labelTopics.UDtagsDepRel];
let labelDefinite = labels[labelTopics.UDtagsDefinite];
let labelDegree = labels[labelTopics.UDtagsDegree];
let labelGender = labels[labelTopics.UDtagsGender];
let labelNumber = labels[labelTopics.UDtagsNumber];
let labelNumType = labels[labelTopics.UDtagsNumType];
let labelPerson = labels[labelTopics.UDtagsPerson];
let labelPos = labels[labelTopics.UDtagsPos];
let labelPoss = labels[labelTopics.UDtagsPoss];
let labelPronType = labels[labelTopics.UDtagsPronType];
let labelMood = labels[labelTopics.UDtagsMood];
let labelTense = labels[labelTopics.UDtagsTense];
let labelVerbForm = labels[labelTopics.UDtagsVerbForm];
let labelVoice = labels[labelTopics.UDtagsVoice];
let grammar = {
case: {title: labelGrammarTermsTitles.case, values: labelCase}
, categories: {title: labelGrammarTermsTitles.categories, values: labelCategories}
, aspect: {title: labelGrammarTermsTitles.aspect, values: labelAspect}
, definite: {title: labelGrammarTermsTitles.definite, values: labelDefinite}
, degree: {title: labelGrammarTermsTitles.degree, values: labelDegree}
, gender: {title: labelGrammarTermsTitles.gender, values: labelGender}
, mood: {title: labelGrammarTermsTitles.mood, values: labelMood}
, number: {title: labelGrammarTermsTitles.number, values: labelNumber}
, numType: {title: labelGrammarTermsTitles.numType, values: labelNumType}
, person: {title: labelGrammarTermsTitles.person, values: labelPerson}
, pos: {title: labelGrammarTermsTitles.pos, values: labelPos}
, poss: {title: labelGrammarTermsTitles.poss, values: labelPoss}
, pronType: {title: labelGrammarTermsTitles.pronType, values: labelPronType}
, tense: {title: labelGrammarTermsTitles.tense, values: labelTense}
, verbForm: {title: labelGrammarTermsTitles.verbForm, values: labelVerbForm}
, voice: {title: labelGrammarTermsTitles.voice, values: labelVoice}
};
// if the index did not change, preserve the previous state
if (currentState.index && (currentState.index === index)) {
tokenAnalysis = currentState.tokenAnalysis;
let propLemma = props.copiedLemma;
let propGloss = props.copiedGloss;
let propPos = props.copiedPos;
let propGrammar = props.copiedGrammar;
let lemma = currentState.lemma;
let gloss = currentState.gloss;
let dependsOn = get(currentState, "dependsOn", props.tokenAnalysis.dependsOn);
let refersTo = get(currentState, "refersTo", props.tokenAnalysis.refersTo);
let selectedAspect = currentState.selectedAspect;
let selectedCase = currentState.selectedCase;
let selectedDefinite = currentState.selectedDefinite;
let selectedDegree = currentState.selectedDegree;
let selectedGender = currentState.selectedGender;
let selectedMood = currentState.selectedMood;
let selectedNumber = currentState.selectedNumber;
let selectedNumType = currentState.selectedNumType;
let selectedPerson = currentState.selectedPerson;
let selectedPos = currentState.selectedPos;
let selectedPoss = currentState.selectedPoss;
let selectedPronType = currentState.selectedPronType;
let selectedTense = currentState.selectedTense;
let selectedVerbForm = currentState.selectedVerbForm;
let selectedVoice = currentState.selectedVoice;
let theTaggedNode = new TreeNode();
if (currentState.theTaggedNode) {
theTaggedNode = currentState.theTaggedNode;
}
if (selectedPos) {
if (props.copiedPos) {
if(props.copiedPos === currentState.propPos) {
// ignore
} else {
selectedPos = props.copiedPos;
}
}
} else {
selectedPos = props.copiedPos;
}
if (lemma) {
if (props.copiedLemma) {
if(props.copiedLemma === currentState.lemma) {
// ignore
} else {
lemma = props.copiedLemma;
}
}
} else {
lemma = props.copiedLemma;
}
if (gloss) {
if (props.copiedGloss) {
if(props.copiedGloss === currentState.propGloss) {
// ignore
} else {
gloss = props.copiedGloss;
}
}
} else {
gloss = props.copiedGloss;
}
if (props.copiedGrammar) {
let tags = props.copiedGrammar.split(".");
for (let i=1; i < tags.length; i++) {
let tag = tags[i];
if (tag === "PRES") {
tag = "PRS";
} else if (tag === "PART") {
tag = "PTCP";
} else if (tag === "PERF") {
tag = "PRF";
} else if (tag === "INF") { // treat infinitive as a part of speech
selectedPos = tag;
propPos = tag;
}
if (labelCase.values[tag]) {
selectedCase = tag;
} else if (grammar.gender.values[tag]) {
selectedGender = tag;
} else if (grammar.number.values[tag]) {
selectedNumber = tag;
} else if (grammar.mood.values[tag]) {
selectedMood = tag;
} else if (grammar.person.values[tag]) {
selectedPerson = tag;
} else if (grammar.tense.values[tag]) {
selectedTense = tag;
} else if (grammar.voice.values[tag]) {
selectedVoice = tag;
}
}
}
let submitDisabled = true;
if (currentState.theTaggedNode) {
submitDisabled = currentState.theTaggedNode.notComplete();
}
let uiSchemas = {};
if (props.session && props.session.uiSchemas) {
uiSchemas = new UiSchemas(
props.session.uiSchemas.formsDropdown
, props.session.uiSchemas.formsSchemas
, props.session.uiSchemas.forms
);
}
return (
{
labels: {
thisClass: labels[labelTopics.TokenTagger]
, messages: labels[labelTopics.messages]
, grammar: grammar
}
, session: {
uiSchemas: uiSchemas
}
, messageIcons: MessageIcons.getMessageIcons()
, messageIcon: MessageIcons.getMessageIcons().info
, message: labels[labelTopics.messages].initial
, index: index
, selectedAspect: selectedAspect
, selectedCase: selectedCase
, selectedDefinite: selectedDefinite
, selectedDegree: selectedDegree
, selectedGender: selectedGender
, selectedMood: selectedMood
, selectedNumber: selectedNumber
, selectedNumType: selectedNumType
, selectedPerson: selectedPerson
, selectedPos: selectedPos
, selectedPoss: selectedPoss
, selectedPronType: selectedPronType
, selectedTense: selectedTense
, selectedVerbForm: selectedVerbForm
, selectedVoice: selectedVoice
, selectedLabel: get(currentState, "selectedLabel", "")
, dependsOn: dependsOn
, refersTo: refersTo
, lemma: lemma
, gloss: gloss
, propLemma: propLemma
, propGloss: propGloss
, propPos: propPos
, propGrammar: propGrammar
, tokenAnalysis: tokenAnalysis
, theTaggedNode: theTaggedNode
, submitDisabled: submitDisabled
, updatingData: currentState.updatingData
, dataUpdated: currentState.dataUpdated
}
)
} else {
return (
{
labels: {
thisClass: labels[labelTopics.TokenTagger]
, messages: labels[labelTopics.messages]
, grammar: grammar
}
, messageIcons: MessageIcons.getMessageIcons()
, messageIcon: MessageIcons.getMessageIcons().info
, message: labels[labelTopics.messages].initial
, updatingData: false
, dataUpdated: false
, index: index
, selectedAspect: tokenAnalysis.aspect ? tokenAnalysis.aspect : "_"
, selectedCase: tokenAnalysis.gCase ? tokenAnalysis.gCase : "_"
, selectedDefinite: tokenAnalysis.definite ? tokenAnalysis.definite : "_"
, selectedDegree: tokenAnalysis.degree ? tokenAnalysis.degree : "_"
, selectedGender: tokenAnalysis.gender ? tokenAnalysis.gender : "_"
, selectedMood: tokenAnalysis.mood ? tokenAnalysis.mood : "_"
, selectedNumber: tokenAnalysis.number ? tokenAnalysis.number : "_"
, selectedNumType: tokenAnalysis.numType ? tokenAnalysis.numType : "_"
, selectedPerson: tokenAnalysis.person ? tokenAnalysis.person : "_"
, selectedPos: tokenAnalysis.pos ? tokenAnalysis.pos : "_"
, selectedPoss: tokenAnalysis.poss ? tokenAnalysis.poss : "_"
, selectedPronType: tokenAnalysis.pronType ? tokenAnalysis.pronType : "_"
, selectedTense: tokenAnalysis.tense ? tokenAnalysis.tense : "_"
, selectedVerbForm: tokenAnalysis.verbForm ? tokenAnalysis.verbForm : "_"
, selectedVoice: tokenAnalysis.voice ? tokenAnalysis.voice : "_"
, selectedLabel: tokenAnalysis.label ? tokenAnalysis.label : "_"
, lemma: tokenAnalysis.lemma ? tokenAnalysis.lemma : "_"
, gloss: tokenAnalysis.gloss ? tokenAnalysis.gloss : "_"
, dependsOn: tokenAnalysis.dependsOn ? tokenAnalysis.dependsOn : "_"
, refersTo: tokenAnalysis.refersTo ? tokenAnalysis.refersTo : "_"
, grammar: tokenAnalysis.grammar ? tokenAnalysis.grammar : "_"
, tokenAnalysis: tokenAnalysis
}
)
}
};
handleGlossChange = (event) => {
this.setState({
gloss: event.target.value
}, this.toggleSubmit);
};
handleLemmaChange = (event) => {
this.setState({
lemma: event.target.value
}, this.toggleSubmit);
};
normalizeIndex(value) {
let result = value;
if (value) {
if (value === "0") {
result = "Root";
} else {
result = (parseInt(value)-1).toString();
}
}
return result;
}
handleDependencyChange = (selection) => {
this.setState({
dependsOn: this.normalizeIndex(selection["value"])
}, this.toggleSubmit);
};
handleReferentChange = (selection) => {
this.setState({
refersTo: selection["value"]
}, this.toggleSubmit);
};
handleLabelChange = (selection) => {
this.setState({
selectedLabel: selection["value"]
}, this.toggleSubmit);
};
handlePartOfSpeechChange = (selection) => {
this.setState({
selectedPos: selection["value"]
}, this.toggleSubmit);
};
handlePersonChange = (selection) => {
this.setState({
selectedPerson: selection["value"]
}, this.toggleSubmit);
};
handleNumberChange = (selection) => {
this.setState({
selectedNumber: selection["value"]
}, this.toggleSubmit);
};
handleCaseChange = (selection) => {
this.setState({
selectedCase: selection["value"]
}, this.toggleSubmit);
};
handleGenderChange = (selection) => {
this.setState({
selectedGender: selection["value"]
}, this.toggleSubmit);
};
handleTenseChange = (selection) => {
this.setState({
selectedTense: selection["value"]
}, this.toggleSubmit);
};
handleAspectChange = (selection) => {
this.setState({
selectedAspect: selection["value"]
}, this.toggleSubmit);
};
handleDefiniteChange = (selection) => {
this.setState({
selectedDefinite: selection["value"]
}, this.toggleSubmit);
};
handleDegreeChange = (selection) => {
this.setState({
selectedDegree: selection["value"]
}, this.toggleSubmit);
};
handleNumTypeChange = (selection) => {
this.setState({
selectedNumType: selection["value"]
}, this.toggleSubmit);
};
handlePossChange = (selection) => {
this.setState({
selectedPoss: selection["value"]
}, this.toggleSubmit);
};
handlePronTypeChange = (selection) => {
this.setState({
selectedPronType: selection["value"]
}, this.toggleSubmit);
};
handleVerbFormChange = (selection) => {
this.setState({
selectedVerbForm: selection["value"]
}, this.toggleSubmit);
};
handleMoodChange = (selection) => {
this.setState({
selectedMood: selection["value"]
}, this.toggleSubmit);
};
handleVoiceChange = (selection) => {
this.setState({
selectedVoice: selection["value"]
}, this.toggleSubmit);
};
getDependencyComponent = () => {
let theIndex = parseInt(this.props.index)+1;
let result = {};
let values = {
"0": "Root"
};
for (let i=1; i <= this.props.tokens.length; i++ ) {
if (i !== theIndex) {
values[i] = (i) + ": " + this.props.tokens[i-1];
}
}
result.title = "Depends On";
result.values = values;
// make adjustments for displaying dependency dropdown
let initialValue = this.state.dependsOn;
if (initialValue === "Root") {
initialValue = "0";
} else {
initialValue = (parseInt(initialValue)+1).toString();
}
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Dependency">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={result}
initialValue={initialValue}
changeHandler={this.handleDependencyChange}
/>
</div>
);
};
getReferentComponent = () => {
if (TreeNode.requiresReferent(this.state.selectedPos)
) {
let theIndex = parseInt(this.props.index);
let result = {};
let values = {};
for (let i=0; i < this.props.tokens.length; i++ ) {
if (i !== theIndex) {
values[i] = (i+1) + ": " + this.props.tokens[i];
}
}
result.title = "Refers to";
result.values = values;
// make adjustments for displaying dropdown index shift
let initialValue = this.state.refersTo;
// if (initialValue === "Root") {
// initialValue = "0";
// } else {
// initialValue = (parseInt(initialValue)+1).toString();
// }
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Referent">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={result}
initialValue={initialValue}
changeHandler={this.handleReferentChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getLabelComponent = () => {
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-POS">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.categories}
initialValue={this.state.selectedLabel}
changeHandler={this.handleLabelChange}
/>
</div>
);
};
getPartOfSpeechComponent = () => {
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-POS">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.pos}
initialValue={this.state.selectedPos}
changeHandler={this.handlePartOfSpeechChange}
/>
</div>
);
};
getPersonComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
&& (! this.state.selectedVerbForm.startsWith("Part"))
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Person">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.person}
initialValue={this.state.selectedPerson}
changeHandler={this.handlePersonChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getNumberComponent = () => {
if (this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("ART")
|| this.state.selectedPos.startsWith("PRON")
|| this.state.selectedPos.startsWith("NOUN")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Number">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.number}
initialValue={this.state.selectedNumber}
changeHandler={this.handleNumberChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getVerbNumberComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Number">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.number}
initialValue={this.state.selectedNumber}
changeHandler={this.handleNumberChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getCaseComponent = () => {
if (this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("ART")
|| this.state.selectedPos.startsWith("PRON")
|| this.state.selectedPos.startsWith("NOUN")
|| (this.state.selectedPos.startsWith("VERB") && this.state.selectedVerbForm.startsWith("Part"))
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Case">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.case}
initialValue={this.state.selectedCase}
changeHandler={this.handleCaseChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getGenderComponent = () => {
if (this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("ART")
|| this.state.selectedPos.startsWith("PRON")
|| this.state.selectedPos.startsWith("NOUN")
|| (this.state.selectedPos.startsWith("VERB")
&& this.state.selectedVerbForm.startsWith("Part"))
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Gender">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.gender}
initialValue={this.state.selectedGender}
changeHandler={this.handleGenderChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getTenseComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.tense}
initialValue={this.state.selectedTense}
changeHandler={this.handleTenseChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getAspectComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.aspect}
initialValue={this.state.selectedAspect}
changeHandler={this.handleAspectChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getDefiniteComponent = () => {
if (this.state.selectedPos.startsWith("ART")
|| this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("NOUN")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.definite}
initialValue={this.state.selectedDefinite}
changeHandler={this.handleDefiniteChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getDegreeComponent = () => {
if (this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("ADV")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.degree}
initialValue={this.state.selectedDegree}
changeHandler={this.handleDegreeChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getNumTypeComponent = () => {
if (this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("ADV")
|| this.state.selectedPos.startsWith("DET")
|| this.state.selectedPos.startsWith("NUM")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.numType}
initialValue={this.state.selectedNumType}
changeHandler={this.handleNumTypeChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getPossComponent = () => {
if (this.state.selectedPos.startsWith("PRON")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.poss}
initialValue={this.state.selectedPoss}
changeHandler={this.handlePossChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getPronTypeComponent = () => {
if (this.state.selectedPos.startsWith("PRON")
|| this.state.selectedPos.startsWith("ADJ")
|| this.state.selectedPos.startsWith("ADV")
|| this.state.selectedPos.startsWith("DET")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.pronType}
initialValue={this.state.selectedPronType}
changeHandler={this.handlePronTypeChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getVerbFormComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Tense">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.verbForm}
initialValue={this.state.selectedVerbForm}
changeHandler={this.handleVerbFormChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getVoiceComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Voice">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.voice}
initialValue={this.state.selectedVoice}
changeHandler={this.handleVoiceChange}
/>
</div>
);
} else {
return (<span/>);
}
};
getMoodComponent = () => {
if (this.state.selectedPos.startsWith("VERB")
&& (! this.state.selectedVerbForm.startsWith("Part"))
){
return (
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Mood">
<LabelSelector
languageCode={this.props.session.languageCode}
labels={this.state.labels.grammar.mood}
initialValue={this.state.selectedMood}
changeHandler={this.handleMoodChange}
/>
</div>
);
} else {
return (<span/>);
}
};
/**
* Update the database and return the value to the caller
*/
submitUpdate = () => {
let path = this.state.session.uiSchemas.getHttpPutPathForSchema(
this.state.tokenAnalysis._valueSchemaId
);
// submit update to the database via the rest api
Server.restPutSchemaBasedForm(
this.props.session.restServer
, this.props.session.userInfo.username
, this.props.session.userInfo.password
, path
, this.state.tokenAnalysis
, undefined
, this.handleValueUpdateCallback
);
// submit update to the caller
this.props.callBack(
this.state.theTaggedNode
);
};
handleSubmit = (event) => {
event.preventDefault();
let tokenAnalysis = this.state.tokenAnalysis;
let theTaggedNode = this.state.theTaggedNode;
tokenAnalysis.annotationSchema = "UD";
tokenAnalysis.dependsOn = theTaggedNode.dependsOn;
tokenAnalysis.refersTo = theTaggedNode.refersTo;
tokenAnalysis.lemma = theTaggedNode.lemma;
tokenAnalysis.gloss = theTaggedNode.gloss;
tokenAnalysis.label = theTaggedNode.label;
tokenAnalysis.gCase = theTaggedNode.case;
tokenAnalysis.gender = theTaggedNode.gender;
tokenAnalysis.mood = theTaggedNode.mood;
tokenAnalysis.number = theTaggedNode.number;
tokenAnalysis.person = theTaggedNode.person;
tokenAnalysis.pos = theTaggedNode.pos;
tokenAnalysis.tense = theTaggedNode.tense;
tokenAnalysis.voice = theTaggedNode.voice;
tokenAnalysis.grammar = theTaggedNode.grammar;
tokenAnalysis.definite = theTaggedNode.definite;
tokenAnalysis.degree = theTaggedNode.degree;
tokenAnalysis.numType = theTaggedNode.numType;
tokenAnalysis.poss = theTaggedNode.poss;
tokenAnalysis.pronType = theTaggedNode.pronType;
this.setState({
updatingData: true
, tokenAnalysis: tokenAnalysis
}, this.submitUpdate);
};
handleValueUpdateCallback = (restCallResult) => {
if (restCallResult) {
this.setState({
message: restCallResult.message
, messageIcon: restCallResult.messageIcon
, messageStatus: restCallResult.status
, updatingData: false
, dataUpdated: true
});
}
};
toggleSubmit = () => {
let theNode = new TreeNode(
this.props.index
, this.props.token
, this.state.lemma
, this.state.gloss
, this.state.dependsOn
, this.state.refersTo
, this.state.selectedLabel
, this.state.selectedCase
, this.state.selectedGender
, this.state.selectedMood
, this.state.selectedNumber
, this.state.selectedPerson
, this.state.selectedPos
, this.state.selectedTense
, this.state.selectedVoice
);
if (theNode.isComplete()) {
this.setState({
theTaggedNode: theNode
, submitDisabled: false
});
} else {
this.setState({submitDisabled: true})
}
};
getSubmitMessage = () => {
if (this.state.updatingData) {
return (
<Spinner message={this.state.labels.messages.updating}/>
);
} else if (this.state.dataUpdated) {
let message = this.state.labels.messages.updated;
if (this.state.messageStatus !== "200") {
message = this.state.message;
}
return (
<span>
<FontAwesome
name={this.state.messageIcon}
/>
{message}
</span>
)
} else {
return (<span/>);
}
};
getTabs = () => {
return (
<div className="row">
<Tabs id="App-Text-Node-Editor-Tabs" animation={false}>
<Tab eventKey={"morphology"} title={
this.state.labels.thisClass.morphology}>
<Well>
<FormGroup
>
<div className="container">
<div>
<div className="row">
{this.getPartOfSpeechComponent()}
{this.getPronTypeComponent()}
{this.getNumTypeComponent()}
{this.getDefiniteComponent()}
{this.getDegreeComponent()}
{this.getVerbFormComponent()}
{this.getAspectComponent()}
{this.getPersonComponent()}
{this.getVerbNumberComponent()}
{this.getTenseComponent()}
{this.getVoiceComponent()}
{this.getMoodComponent()}
{this.getGenderComponent()}
{this.getNumberComponent()}
{this.getCaseComponent()}
</div>
</div>
</div>
</FormGroup>
</Well>
</Tab>
<Tab eventKey={"syntax"} title={
this.state.labels.thisClass.syntax}>
<Well>
<FormGroup
>
<div className="container">
<div>
<div className="row">
{this.getDependencyComponent()}
{this.getLabelComponent()}
</div>
</div>
</div>
</FormGroup>
</Well>
</Tab>
<Tab eventKey={"semantics"} title={
this.state.labels.thisClass.semantics}>
<Well>
<FormGroup
>
<div className="container">
<div>
<div className="row">
{this.getReferentComponent()}
</div>
</div>
</div>
</FormGroup>
</Well>
</Tab>
</Tabs>
</div>
);
};
render() {
return (
<form onSubmit={this.handleSubmit}>
<div className="container">
<div>
<div className="row">
<div className="col-sm-12 col-md-12 col-lg-12 resourceSelectorPrompt">{this.state.labels.thisClass.instructions}</div>
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-POS">
{parseInt(this.props.index)+1} {this.props.token}
</div>
</div>
</div>
</div>
{this.getTabs()}
<FormGroup
>
<div className="container">
<div>
<div className="row">
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Case">
<div className="resourceSelectorPrompt">{this.state.labels.thisClass.lemma}</div>
<FormControl
id="AppTreeNodeBuilder-Lemma"
className="App App-TokenTagger-Lemma"
type="text"
value={this.state.lemma}
placeholder="Enter lemma"
onChange={this.handleLemmaChange}
/>
</div>
<div className="col-sm-12 col-md-12 col-lg-12 App-Label-Selector-Case">
<div className="resourceSelectorPrompt">{this.state.labels.thisClass.gloss}</div>
<FormControl
id="AppTreeNodeBuilder-Gloss"
className="App App-TokenTagger-Gloss"
type="text"
value={this.state.gloss}
placeholder="Enter gloss"
onChange={this.handleGlossChange}
/>
</div>
</div>
</div>
</div>
</FormGroup>
<div className="row">
<div className="col-sm-2 col-md-2 col-lg-2 App-Label-Selector-Button">
<Button
bsStyle="primary"
type="submit"
onClick={this.handleSubmit}
disabled={this.state.submitDisabled}
>
{this.state.labels.messages.submit}
</Button>
</div>
<div className="col-sm-6 col-md-6 col-lg-6 App-Label-Selector-Retrieving">
{this.getSubmitMessage()}
</div>
<div className="col-sm-4 col-md-4 col-lg-4 App-Label-Selector-Empty">
</div>
</div>
<div className="row">
<div className="col-sm-2 col-md-2 col-lg-2 App-Label-Selector-Help">
<a
href="https://github.com/PerseusDL/treebank_data/blob/master/AGDT2/guidelines/Greek_guidelines.md"
target="_blank"
>{this.state.labels.thisClass.help}</a>
</div>
<div className="col-sm-2 col-md-2 col-lg-2 App-Label-Selector-Help">
<a
href={"https://www.eva.mpg.de/lingua/resources/glossing-rules.php"
+ this.state.gloss
+ "_1?isEntryInOtherDict=false"}
target="_blank"
>{this.state.labels.thisClass.leipzig}</a>
</div>
<div className="col-sm-3 col-md-3 col-lg-3 App-Label-Selector-Help">
<a
href={"https://www.oxfordlearnersdictionaries.com/definition/english/"
+ this.state.gloss
+ "_1?isEntryInOtherDict=false"}
target="_blank"
>{this.state.labels.thisClass.oxford}</a>
</div>
</div>
</form>
)
}
}
TokenTagger.propTypes = {
session: PropTypes.object.isRequired
, index: PropTypes.string.isRequired
, tokens: PropTypes.array.isRequired
, token: PropTypes.string.isRequired
, tokenAnalysis: PropTypes.object.isRequired
, callBack: PropTypes.func.isRequired
, copiedLemma: PropTypes.string
, copiedGloss: PropTypes.string
, copiedPos: PropTypes.string
, copiedGrammar: PropTypes.string
};
TokenTagger.defaultProps = {
copiedLemma: ""
, copiedGloss: ""
, copiedPos: ""
, copiedGrammar: ""
};
export default TokenTagger;
|
src/browser/todos/TodosPage.js | robinpokorny/este | // @flow
import Buttons from './Buttons';
import NewTodo from './NewTodo';
import React from 'react';
import Todos from './Todos';
import linksMessages from '../../common/app/linksMessages';
import { Box, PageHeader, Title } from '../app/components';
import { FormattedMessage } from 'react-intl';
const TodosPage = () => (
<Box>
<Title message={linksMessages.todos} />
{/* This ugly wrapping syntax will be unneccessary with React fiber soon */}
<FormattedMessage {...linksMessages.todos}>
{message => <PageHeader heading={message} />}
</FormattedMessage>
<NewTodo />
<Todos />
<Buttons />
</Box>
);
export default TodosPage;
|
app/containers/constants/ToastContainer.js | Caraxiong/react-demo | import React from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { hideToastFun } from '../../actions/toastActions'
import Toast from '../../constants/Toast'
const ToastContainer = ({ bool , toastText , hideToastFun }) => (
<Toast bool = { bool } toastText = {toastText} onClick = {() => hideToastFun()} />
)
ToastContainer.propTypes = {
bool: PropTypes.bool,
toastText: PropTypes.string,
hideToastFun: PropTypes.func
}
const mapStateToProps = (state) => {
return {
bool: state.toast.bool,
toastText: state.toast.toastText
}
}
export default connect(
mapStateToProps,
{ hideToastFun }
)(ToastContainer)
|
src/index.js | OscarYuen/apollo-error-catcher | import React from 'react';
import PropTypes from "prop-types";
const catchApolloError = function(WrappedComponent, ErrorComponent) {
return class ApolloErrorHandler extends React.Component {
static propTypes = {
data: PropTypes.shape({
error: PropTypes.object
})
}
render () {
if (this.props.data) {
const error = this.props.data.error;
if (error) {
return <ErrorComponent {...this.props}/>;
} else {
return <WrappedComponent {...this.props}/>
}
}
}
}
}
export default catchApolloError; |
src/CHANGELOG.js | ronaldpereira/WoWAnalyzer | import React from 'react';
import { Yajinni, Mamtooth, Zerotorescue, Putro, joshinator, Gebuz, ackwell, emallson, blazyb, Dambroda, Nalhan, Satyric, niseko, Khadaj, Fyruna, Matardarix, jos3p, Aelexe, Chizu, Hartra344, Hordehobbs, Dorixius, Sharrq, Scotsoo, HolySchmidt, Zeboot, Abelito75, Anatta336, HawkCorrigan, Amrux, Qbz, Viridis, Juko8, fluffels, Draenal, JeremyDwayne, axelkic, Khazak, layday, Vetyst } from 'CONTRIBUTORS';
import ItemLink from 'common/ItemLink';
import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import { change, date } from 'common/changelog';
import Contributor from 'interface/ContributorButton';
export default [
change(date(2020, 5, 27), <>Fixed a bug where <ItemLink id={ITEMS.VOID_TWISTED_TITANSHARD.id} /> showed as having done 0 healing </>, Putro),
change(date(2020, 5, 25), 'Replaced hard-coded statistic categories with STATISTIC_CATEGORY.', Vetyst),
change(date(2020, 5, 18), 'Replaced duplicate FIGHT_DIFFICULTIES with DIFFICULTIES', Vetyst),
change(date(2020, 5, 18), 'Updated patchlist', Vetyst),
change(date(2020, 5, 14), 'Replaced hardcoded event type strings with EventType equivalent', Vetyst),
change(date(2020, 5, 13), 'Disallow use of ++ and -- to adhere to the style guide', Putro),
change(date(2020, 5, 12), 'Tweak JetBrains codeStyles file to better adhere to code style, while allowing for auto-formatting all files in the repository.', Vetyst),
change(date(2020, 5, 12), 'Reduced avatar and article image file sizes.', Vetyst),
change(date(2020, 4, 26), <>Added <SpellLink id={SPELLS.BLOOD_FURY_PHYSICAL.id} /> to the core parser. </>, Putro),
change(date(2020, 4, 16), <>Fixed a bug where the haste value gained <SpellLink id={SPELLS.ESSENCE_OF_THE_FOCUSING_IRIS_RANK_THREE_FOUR.id} /> minor was extremely low if the buff never fell off.</>, Putro),
change(date(2020, 4, 14), <>Using <ItemLink id={ITEMS.AZSHARAS_FONT_OF_POWER.id} /> no longer shows as downtime during the channel.</>, Sharrq),
change(date(2020, 3, 30), <>Added <SpellLink id={SPELLS.FLASH_OF_INSIGHT.id} />.</>, niseko),
change(date(2020, 3, 30), <>Added <SpellLink id={SPELLS.SEVERE_T3.id} /> <SpellLink id={SPELLS.EXPEDIENT_T3.id} /> <SpellLink id={SPELLS.MASTERFUL_T3.id} /> <SpellLink id={SPELLS.VERSATILE_T3.id} />.</>, niseko),
change(date(2020, 3, 30), <>Added <SpellLink id={SPELLS.ESSENCE_OF_THE_FOCUSING_IRIS_RANK_THREE_FOUR.id} /> and <SpellLink id={SPELLS.FOCUSED_ENERGY_BUFF.id} />.</>, Putro),
change(date(2020, 3, 29), 'Add the possibility to modify stat multipliers to be able to support some of the new corruption effects.', niseko),
change(date(2020, 3, 16), <>Adjusted <ItemLink id={ITEMS.ASHJRAKAMAS_SHROUD_OF_RESOLVE.id} /> for hotfixes.</>, niseko),
change(date(2020, 3, 6), 'Fixed an issue where Vantus Runes weren\'t working as intended.', niseko),
change(date(2020, 3, 4), 'Fix a bug where having multiple of the same corruption didn\'t count towards corruption total', Putro),
change(date(2020, 2, 28), <>Added the primary stat proc of <ItemLink id={ITEMS.ASHJRAKAMAS_SHROUD_OF_RESOLVE.id} />.</>, niseko),
change(date(2020, 2, 21), <>Added the possibility of adding item warnings, and added a warning for people using <ItemLink id={ITEMS.WHISPERING_ELDRITH_BOW.id} />.</>, Putro),
change(date(2020, 2, 21), <>Added <SpellLink id={SPELLS.SYMBIOTIC_PRESENCE.id} />.</>, niseko),
change(date(2020, 2, 17), <>Added <ItemLink id={ITEMS.FORBIDDEN_OBSIDIAN_CLAW.id} /> and <ItemLink id={ITEMS.HUMMING_BLACK_DRAGONSCALE.id} />.</>, niseko),
change(date(2020, 2, 14), <>Updated <SpellLink id={SPELLS.VOID_RITUAL_BUFF.id} /> and <SpellLink id={SPELLS.SURGING_VITALITY_BUFF.id} /> with the hotfixed stat values.</>, niseko),
change(date(2020, 2, 13), 'Add a warning to the Skitra encounter page as the logs for the fight are only accurate if the analyzed player is the one logging.', Putro),
change(date(2020, 2, 12), 'Implemented a corruption overview on the character page.', Putro),
change(date(2020, 2, 12), 'Fixed a bug that breaks the player selection when there is incomplete information from warcraftlogs.', niseko),
change(date(2020, 2, 9), 'Added statistics for the 8.3 Alchemist Stones.', niseko),
change(date(2020, 2, 5), <> Implemented <ItemLink id={ITEMS.VOID_TWISTED_TITANSHARD.id} />, <ItemLink id={ITEMS.VITA_CHARGED_TITANSHARD.id} /> as well as an individual statistic for the set bonus <SpellLink id={SPELLS.TITANIC_EMPOWERMENT.id} />. </>, Putro),
change(date(2020, 2, 5), <>Added <SpellLink id={SPELLS.HONED_MIND_BUFF.id} />, <SpellLink id={SPELLS.SURGING_VITALITY_BUFF.id} />, <SpellLink id={SPELLS.RACING_PULSE_BUFF.id} /> and <SpellLink id={SPELLS.DEADLY_MOMENTUM_BUFF.id} />.</>, niseko),
change(date(2020, 2, 5), <>Added <SpellLink id={SPELLS.VOID_RITUAL_BUFF.id} />.</>, niseko),
change(date(2020, 2, 5), <>Added <SpellLink id={SPELLS.SIPHONER_T3.id} /> and fixed leech stat values in parses using this corruption.</>, niseko),
change(date(2020, 1, 30), <>Fixed bug in calcuating bonus crit damage from <SpellLink id={SPELLS.BLOOD_OF_THE_ENEMY.id} />.</>, Khazak),
change(date(2020, 1, 27), <>Added <SpellLink id={SPELLS.INEFFABLE_TRUTH_BUFF.id} />.</>, niseko),
change(date(2020, 1, 27), 'Added basic corruption effect support.', niseko),
change(date(2020, 1, 24), 'Updated Zone list to include Ny\'alotha bosses.', Putro),
change(date(2020, 1, 20), 'Updated Azerite Trait info for Patch 8.3.', emallson),
change(date(2020, 1, 16), 'Added Ny\'alotha boss information and phases.', Sharrq),
change(date(2020, 1, 15), 'Changed the stat values statistic layout.', Zerotorescue),
change(date(2020, 1, 12), <>Added <SpellLink id={SPELLS.BLOOD_OF_THE_ENEMY.id} />.</>, Khazak),
change(date(2020, 1, 4), 'Converted Event Filtering to TypeScript.', Zeboot),
change(date(2020, 1, 4), 'Fixed bug causing timefilter input to stop responding.', Zeboot),
change(date(2020, 1, 1), 'Updated code integration tests to be more maintainable.', Zerotorescue),
change(date(2020, 1, 1), 'Added statistic for Strife.', Abelito75),
change(date(2019, 12, 31), 'Replaced TravisCI build pipelines with GitHub actions workflows.', Zerotorescue),
change(date(2019, 12, 29), 'Updated Combatant to typescript', [HawkCorrigan]),
change(date(2019, 12, 27), 'Indicate elemental shaman has been updated for 8.2.5 and update the example log', Draenal),
change(date(2019, 12, 23), 'Fixed early DoT refresh extension check.', layday),
change(date(2019, 12, 17), 'Fixed integration testing code with new build support.', [emallson]),
change(date(2019, 12, 16), 'Updated internal test tools to use new API URL.', [emallson]),
change(date(2019, 12, 15), 'Fix spell icons in cooldowns tab.', [Zerotorescue]),
change(date(2019, 12, 15), 'Added an available raid buffs panel to the player selection page.', [axelkic, Zerotorescue]),
change(date(2019, 12, 14), 'Converted CastEfficiency to TypeScript and refactor it a bit.', Zerotorescue),
change(date(2019, 12, 13), 'Added a confirm dialog to the keybinding (l) to open the current page in your development environment.', Zerotorescue),
change(date(2019, 12, 13), 'Added TypeScript support to the codebase. See Discord for more info.', Zerotorescue),
change(date(2019, 12, 8), <>Reduced likely hood to accidnetly go to unintended page.</>, Abelito75),
change(date(2019, 11, 14), 'Added the ability to define different rotations for analysis (like no icelance for frost mages)', Zeboot),
change(date(2019, 10, 25), <>Fixed a bug in the dispels module.</>, Khadaj),
change(date(2019, 10, 25), <>Added missing spell information for resource refunds and gains from <SpellLink id={SPELLS.LUCID_DREAMS_MINOR.id} /> and <SpellLink id={SPELLS.VISION_OF_PERFECTION.id} />.</>, Juko8),
change(date(2019, 10, 24), <>Replaced the activity time statistic icons that had outgrown their space with smaller ones. <small>I only fixed it for <a href="https://hacktoberfest.digitalocean.com/">the shirt</a>.</small></>, Zerotorescue),
change(date(2019, 10, 24), 'Updated nodejs for docker.', JeremyDwayne),
change(date(2019, 10, 19), <>Fixed an issue in the character tab caused it to break for logs without essences.</>, Draenal),
change(date(2019, 10, 13), <>Added extra information and cleaned up Vantus Rune infographic.</>, Abelito75),
change(date(2019, 10, 13), <>Added <ItemLink id={ITEMS.RAZOR_CORAL.id} />.</>, Zeboot),
change(date(2019, 10, 13), 'Added event filter to cooldown to view only events during a selected cooldown.', Zeboot),
change(date(2019, 10, 13), <>Added <ItemLink id={ITEMS.BLOODTHIRSTY_URCHIN.id} />.</>, Zeboot),
change(date(2019, 10, 13), <>Added <ItemLink id={ITEMS.DRIBBLING_INKPOD.id} />.</>, Zeboot),
change(date(2019, 10, 2), <>Added Potion of Empowered Proximity for the potion checker.</>, Abelito75),
change(date(2019, 10, 2), <>Fixed an issue in Cast Efficiency that caused spells to have a time on CD higher than 100%.</>, Sharrq),
change(date(2019, 9, 30), <>Adjusted phase transitions for Orgozoa, Za'qul, and Queen Azshara to be more accurate.</>, Sharrq),
change(date(2019, 9, 24), <>Updated channeling code to take into account downtime from items like <ItemLink id={ITEMS.AZSHARAS_FONT_OF_POWER.id} /> and to display them on the timeline.</>, Yajinni),
change(date(2019, 9, 24), <>Added <ItemLink id={ITEMS.AZSHARAS_FONT_OF_POWER.id} />.</>, Yajinni),
change(date(2019, 9, 20), <>Added <ItemLink id={ITEMS.CYCLOTRONIC_BLAST.id} />.</>, Juko8),
change(date(2019, 9, 20), 'Added 8.2 gems', Juko8),
change(date(2019, 9, 16), <>Changed how cast efficiency is tracked for spells with charges <em>and</em> charge refunds (mostly <SpellLink id={SPELLS.JUDGMENT_CAST_PROTECTION.id} />).</>, emallson),
change(date(2019, 9, 11), 'Fight statistics in the character panel now include the most used essences.', niseko),
change(date(2019, 9, 10), 'Added a cast time column to the mana efficiency module.', niseko),
change(date(2019, 9, 9), <>Added <ItemLink id={ITEMS.POTION_OF_FOCUSED_RESOLVE.id} />.</>, Sharrq),
change(date(2019, 9, 8), <>Fixed issue with <ItemLink id={ITEMS.ENCHANT_WEAPON_FORCE_MULTIPLIER.id} /> and Critical Strike.</>, emallson),
change(date(2019, 9, 7), <>Added <ItemLink id={ITEMS.ENCHANT_WEAPON_FORCE_MULTIPLIER.id} /></>, emallson),
change(date(2019, 9, 6), 'Remove references to deprecated React lifecycle methods.', fluffels),
change(date(2019, 9, 5), 'Fixed a calculation error affecting time spent casting in some cases.', niseko),
change(date(2019, 8, 27), <>Added check to remove <SpellLink id={SPELLS.WINDWALKING.id} /> from dispel infographic. </>, Abelito75),
change(date(2019, 8, 27), <>Updated <SpellLink id={SPELLS.CONCENTRATED_FLAME.id} /> to take into account 2 charges at rank 3 and up.</>, Yajinni),
change(date(2019, 8, 26), 'Normalized the location of visions of perfections reduced cd calculator.', Abelito75),
change(date(2019, 8, 22), 'Updated cooldown tab so it includes absorbed damage for dps.', Abelito75),
change(date(2019, 8, 22), 'Added Spell IDs and the stacking haste buff from Condensed Life Force.', Sharrq),
change(date(2019, 8, 22), <><SpellLink id={SPELLS.LUCID_DREAMS.id} /> minor for rage refund added. Shouldn't show up as missing id in rage-useage now.</>, Abelito75),
change(date(2019, 8, 20), 'Fixed potential crash of phase fabrication during mixed filter usage.', Zeboot),
change(date(2019, 8, 16), 'Added event filter to death recap to view only pre-death events.', Zeboot),
change(date(2019, 8, 16), 'Added Heart of Azeroth Essences to Character Info panel.', [Viridis]),
change(date(2019, 8, 14), 'Fixed potential crash of phase fabrication during mixed filter usage.', Zeboot),
change(date(2019, 8, 12), 'Added more phase trigger types to improve our phase detection.', Zeboot),
change(date(2019, 8, 12), <>Added <SpellLink id={SPELLS.LOYAL_TO_THE_END.id} /> azerite trait.</>, Khadaj),
change(date(2019, 8, 7), <>Updated <SpellLink id={SPELLS.CONCENTRATED_FLAME.id} /> healing calculation.</>, Yajinni),
change(date(2019, 8, 6), <>Added <ItemLink id={ITEMS.POTION_OF_WILD_MENDING.id} />.</>, niseko),
change(date(2019, 8, 6), <>Added <SpellLink id={SPELLS.WELL_OF_EXISTENCE_MAJOR.id} /></>, Qbz),
change(date(2019, 8, 6), 'Made it easier to rollback to older versions of the app in case of issues.', Zerotorescue),
change(date(2019, 8, 6), 'General responsive improvements for better mobile experience.', Amrux),
change(date(2019, 8, 6), <>Shows <SpellLink id={SPELLS.ABYSSAL_HEALING_POTION.id} /> in death recap now!</>, Abelito75),
change(date(2019, 8, 3), 'Keep track of disabled modules names during production.', Zeboot),
change(date(2019, 8, 3), 'Made the error handler more resilient to errors in browser extensions.', Zerotorescue),
change(date(2019, 8, 3), 'Changed polyfilling so we might accidentally support more old and/or shitty browsers.', Zerotorescue),
change(date(2019, 8, 3), 'Updated to create-react-app 3 and made the development environment easier to update.', Zerotorescue),
change(date(2019, 8, 2), 'Added \'degraded experience\' toaster in case of disabled modules.', Zeboot),
change(date(2019, 8, 2), <>Fixed the Haste value of <SpellLink id={SPELLS.EVER_RISING_TIDE_MAJOR.id} /></>, niseko),
change(date(2019, 7, 27), 'Added Unbridled Fury to the list of strong pre-potions.', emallson),
change(date(2019, 7, 27), <>Added <SpellLink id={SPELLS.NULL_DYNAMO.id} /> essence.</>, emallson),
change(date(2019, 7, 25), 'Fixed a crash in the Ever-Rising Tide Module', HawkCorrigan),
change(date(2019, 7, 23), 'Added 8.2 weapon enchants.', Zeboot),
change(date(2019, 7, 21), 'Update error logging to reduce overhead.', Zerotorescue),
change(date(2019, 7, 20), 'Added news article about time filtering.', Zeboot),
change(date(2019, 7, 20), 'Allow for repeated phases in bossfights (e.g. Lady Ashvane / Radiance of Azshara).', Zeboot),
change(date(2019, 7, 20), 'Made time filtering potion whitelist import from the potions module to avoid having to update separately each patch.', Zeboot),
change(date(2019, 7, 20), <>Fixed <SpellLink id={SPELLS.CONCENTRATED_FLAME.id} /> not accounting for absorbs.</>, [Zeboot]),
change(date(2019, 7, 20), 'Show changelog entries along with news on the frontpage.', [Zerotorescue]),
change(date(2019, 7, 20), <>Removed ads by Google and most ad spots as they were not worth the degraded experience for you guys. Instead, please consider a monthly donation on <a href="https://www.patreon.com/wowanalyzer">Patreon</a> to support the project and unlock Premium, or bounty tickets on <a href="https://www.bountysource.com/teams/wowanalyzer">BountySource</a> for contributors to solve (currently active bounties: $1,550).</>, [Zerotorescue]),
change(date(2019, 7, 20), <>Added <SpellLink id={SPELLS.WORLDVEIN_RESONANCE.id} /> essence.</>, [Anatta336]),
change(date(2019, 7, 20), 'Updated the build process to ensure every new pull request has a changelog entry.', Zerotorescue),
change(date(2019, 7, 19), 'Added boss configs and phase info for Eternal Palace.', [Sharrq]),
change(date(2019, 7, 16), 'Added the ability to filter the results by time period.', [Zeboot]),
change(date(2019, 7, 16), 'Added the ability to filter the results by phases.', [Zeboot]),
change(date(2019, 7, 12), <>Added Major <SpellLink id={SPELLS.CONCENTRATED_FLAME.id} /> and Minor <SpellLink id={SPELLS.ANCIENT_FLAME.id} /> essences.</>, [Yajinni]),
change(date(2019, 6, 25), 'Changed the search character default to the Eternal Palace raid.', [Yajinni]),
change(date(2019, 6, 25), <>Added <SpellLink id={SPELLS.EVER_RISING_TIDE_MAJOR.id} /> and <SpellLink id={SPELLS.EVER_RISING_TIDE.id} /> essences.</>, [niseko]),
change(date(2019, 6, 19), 'Added Eternal Palace raid information to zones.', [Yajinni]),
change(date(2019, 6, 16), <>Fixed issue where Cooldown's Even more button would cause the website to crash. </>, [Abelito75, Zeboot]),
change(date(2019, 6, 16), 'Fixed issues with shared CDs (like potions) in the timeline.', [Zeboot]),
change(date(2019, 6, 10), 'Added URL bar search support for report links.', [Zeboot]),
change(date(2019, 6, 10), 'Fixed an issue with some items not providing relevant cast events.', [Zeboot]),
change(date(2019, 6, 10), 'Added most items from the Crucible of Storms raid.', [Zeboot]),
change(date(2019, 6, 2), <>Added a <SpellLink id={SPELLS.IGNITION_MAGES_FUSE_BUFF.id} /> module to track usage and average haste gained.</>, [HolySchmidt]),
change(date(2019, 5, 12), 'Added average heart of azeroth level to the player selection page', [Scotsoo]),
change(date(2019, 5, 10), <>Fixed an issue where the timeline and the Cancelled Casts statistic would incorrectly mark a spell as cancelled in high latency situations.</>, [Sharrq]),
change(date(2019, 4, 20), <>Fixed issue for mages where the timeline would show a cast as cancelled if they cast an ability that could be cast while casting (e.g. <SpellLink id={SPELLS.SHIMMER_TALENT.id} /> or <SpellLink id={SPELLS.FIRE_BLAST.id} />).</>, [Sharrq]),
change(date(2019, 4, 17), 'Added the Crucible of Storms raid to the character search and made it the default raid.', [Yajinni]),
change(date(2019, 3, 30), 'Fixed issue where the character parses page didn\'t return any results when region wasn\'t capitalized.', [Zerotorescue]),
change(date(2019, 3, 21), 'Added Battle of Dazar\'alor Vantus Runes so they should now be shown in the statistics.', [Zerotorescue]),
change(date(2019, 3, 21), <>Added food buffs that were added since 8.1 so they'll correctly trigger the <i>food used</i> checklist item (<a href="https://twitter.com/BMHunterWow/status/1108717252243791873">the bug report</a>).</>, [Zerotorescue]),
change(date(2019, 3, 19), 'Improved the display of the checklist rules on mobile devices.', [Zerotorescue]),
change(date(2019, 3, 16), <>Restructured the server setup to eliminate API downtime. The source code for the server can now be found <a href="https://github.com/WoWAnalyzer/server">here</a>.</>, [Zerotorescue]),
change(date(2019, 3, 16), 'Show "TOP 100" in the throughput bar performance when eligible.', [Zerotorescue]),
change(date(2019, 3, 15), 'Fixed an issue where the azerite levels didn\'t show up in the player selection.', [Zerotorescue]),
change(date(2019, 3, 14), 'Fixed an issue that lead to not all azerite power icons showing up properly on the character tab.', [Zerotorescue]),
change(date(2019, 3, 14), 'Fixed a crash in player selection when WCL sent corrupt player info.', [Zerotorescue]),
change(date(2019, 3, 14), 'Fixed a crash when adblock is enabled.', [Zerotorescue]),
change(date(2019, 3, 14), 'Fixed the layout of the "outdated patch" warning screen.', [Zerotorescue]),
change(date(2019, 3, 14), 'Fixed a crash on initial load in Microsoft Edge.', [Zerotorescue]),
change(date(2019, 3, 13), 'Updated Discord link description text.', [Zerotorescue]),
change(date(2019, 3, 13), 'Fallback to ads for our Premium when adblock is enabled.', [Zerotorescue]),
change(date(2019, 3, 13), 'Replaced the statistics ad with an in-feed ad that better fits the layout.', [Zerotorescue]),
change(date(2019, 3, 13), 'Replaced the Patreon page links with direct join links to make it easier to sign up.', [Zerotorescue]),
change(date(2019, 3, 12), 'Fixed a crash on the results page when the player info received from Warcraft Logs is corrupt (now it shows an alert instead).', [Zerotorescue]),
change(date(2019, 3, 12), 'Fixed a crash on the statistics tab when WCL has no rankings data (e.g. due to the 8.1.5 partitioning).', [Zerotorescue]),
change(date(2019, 3, 10), 'WoWAnalyzer 3.0! This is the biggest update since the release, featuring a completely new interface, with a new logo, color scheme, and various new pages and improvements to the results page including a complete rework of the timeline. Many people worked on this, thanks so much to everyone who contributed!', [Zerotorescue]),
change(date(2019, 3, 2), <>Hide checklist rules if all of the requirements beneath them are hidden/disabled.</>, [Sharrq]),
change(date(2019, 2, 24), <>Added composition details to raid composition screen showing role counts and avarage ilvl.</>, [Dorixius]),
change(date(2019, 2, 15), <>If Warcraft Logs sends a corrupt JSON message, try to automatically decorrupt it.</>, [Zerotorescue]),
change(date(2019, 1, 31), <>Fixed an issue where the "A connection error occured." message might be shown when an error occured during module initialization.</>, [Zerotorescue]),
change(date(2019, 1, 31), <>Added <SpellLink id={SPELLS.TREACHEROUS_COVENANT.id} /> module.</>, [Khadaj]),
change(date(2019, 1, 30), <>Added <ItemLink id={ITEMS.CREST_OF_PAKU_ALLIANCE.id} /> analyzer and accounted for its Haste gain.</>, [Zerotorescue]),
change(date(2019, 1, 30), <>Added <SpellLink id={SPELLS.BONDED_SOULS_TRAIT.id} /> azerite trait and accounted for its Haste gain.</>, [Zerotorescue]),
change(date(2019, 1, 26), <>Account for Haste gained from <SpellLink id={SPELLS.OPULENCE_AMETHYST_OF_THE_SHADOW_KING.id} />.</>, [Zerotorescue]),
change(date(2019, 1, 25), 'Add Battle of Dazar\'alor to the selectable raids in the character page filters.', [joshinator]),
change(date(2018, 12, 29), 'Split mitigation check into Physical and Magical.', [emallson, Hordehobbs]),
change(date(2018, 12, 20), 'Added better caching for character profiles from the blizzard API', [Hartra344]),
change(date(2018, 12, 10), 'Migraged Battle.Net API calls to to use the new blizzard.com Api endpoint', [Hartra344]),
change(date(2018, 12, 9), 'Fixed crashes when switching players that can get the same buff.', [Chizu]),
change(date(2018, 12, 9), 'Split the food check in the Be Well Prepared section of the checklist to check if food buff was present and if that food buff was high quality. Updated the suggestions to reflect this.', [Yajinni]),
change(date(2018, 12, 9), 'Added a link to reports that have similiar kill-times under the Statistics tab for easier comparison.', [Putro]),
change(date(2018, 11, 15), <>Added <ItemLink id={ITEMS.DREAD_GLADIATORS_INSIGNIA.id} /> module.</>, [Aelexe]),
change(date(2018, 11, 14), <>Added <SpellLink id={SPELLS.GIFT_OF_THE_NAARU_MAGE.id} /> to ability list.</>, [Dambroda]),
change(date(2018, 11, 13), 'Added an AverageTargetsHit module for general usage.', [Putro]),
change(date(2018, 11, 12), <>Added <ItemLink id={ITEMS.AZEROKKS_RESONATING_HEART.id} /> module.</>, [Aelexe]),
change(date(2018, 11, 11), <>Added <ItemLink id={ITEMS.DISC_OF_SYSTEMATIC_REGRESSION.id} /> module.</>, [Matardarix]),
change(date(2018, 11, 11), <>Added <ItemLink id={ITEMS.MYDAS_TALISMAN.id} /> module.</>, [Aelexe]),
change(date(2018, 11, 10), <>Added <ItemLink id={ITEMS.ROTCRUSTED_VOODOO_DOLL.id} /> module.</>, [jos3p]),
change(date(2018, 11, 9), <>Added <ItemLink id={ITEMS.REZANS_GLEAMING_EYE.id} /> module.</>, [Matardarix]),
change(date(2018, 11, 6), <>Added <ItemLink id={ITEMS.SYRINGE_OF_BLOODBORNE_INFIRMITY.id} /> module.</>, [Matardarix]),
change(date(2018, 11, 2), <>Added <SpellLink id={SPELLS.TRADEWINDS.id} /> module.</>, [Fyruna]),
change(date(2018, 11, 2), <>Added <SpellLink id={SPELLS.UNSTABLE_CATALYST.id} /> module.</>, [niseko]),
change(date(2018, 11, 1), <>Added <SpellLink id={SPELLS.SWIRLING_SANDS.id} /> module.</>, [niseko]),
change(date(2018, 10, 26), <>Added <SpellLink id={SPELLS.WOUNDBINDER.id} />, <SpellLink id={SPELLS.BRACING_CHILL.id} />, <SpellLink id={SPELLS.SYNERGISTIC_GROWTH.id} />, and <SpellLink id={SPELLS.EPHEMERAL_RECOVERY_BUFF.id} /> azerite modules. </>, [Khadaj]),
change(date(2018, 10, 26), <>Added <ItemLink id={ITEMS.LUSTROUS_GOLDEN_PLUMAGE.id} /> module. </>, [Putro]),
change(date(2018, 10, 24), <>Added <ItemLink id={ITEMS.DREAD_GLADIATORS_BADGE.id} /> module. </>, [Putro]),
change(date(2018, 10, 23), <>Added <SpellLink id={SPELLS.ARCHIVE_OF_THE_TITANS.id} /> module.</>, [niseko]),
change(date(2018, 10, 23), <>Added <ItemLink id={ITEMS.DREAD_GLADIATORS_MEDALLION.id} /> module.</>, [niseko]),
change(date(2018, 10, 22), <>Added <SpellLink id={SPELLS.COASTAL_SURGE.id} /> module.</>, [niseko]),
change(date(2018, 10, 21), <>Added <SpellLink id={SPELLS.BLIGHTBORNE_INFUSION.id} /> module.</>, [niseko]),
change(date(2018, 10, 17), <>Fixed mana usage for innervate in cooldown tabs for healers.</>, [blazyb]),
change(date(2018, 10, 6), <>Corrected Azerite Scaling for traits with split stat scaling (e.g. <SpellLink id={SPELLS.GEMHIDE.id} />).</>, [emallson]),
change(date(2018, 10, 6), <React.Fragment> Added a damage reduction module for dwarf racial <SpellLink id={SPELLS.STONEFORM.id} /> </React.Fragment>, [Satyric]),
change(date(2018, 10, 2), 'Added a BFA-ready food and flasker checker to the well prepared checklist, with a lot of help from ArthurEnglebert', [Putro]),
change(date(2018, 9, 30), 'Removed the suggestions for Healing Potions and Healthstones, and added their status to the death recap panel. The "you died" suggestions will now refer to this for more information.', [Zerotorescue]),
change(date(2018, 9, 30), 'The "you had mana left" suggestion will no longer show up on wipes.', [Zerotorescue]),
change(date(2018, 9, 30), 'The "you died" suggestion will no longer show up when you died within 15 seconds of a wipe.', [Zerotorescue]),
change(date(2018, 9, 29), 'Added a "spec currently not supported" page, since the about panel appeared to be insufficient.', [Zerotorescue]),
change(date(2018, 9, 29), 'Completely reworked the way reports are loaded to be much more maintainable. There were also some minor performance imprpvements.', [Zerotorescue]),
change(date(2018, 9, 25), <> Added <SpellLink id={SPELLS.BLESSED_PORTENTS.id} /> module.</>, [Nalhan]),
change(date(2018, 9, 24), <> Added <SpellLink id={SPELLS.CONCENTRATED_MENDING.id} /> module. </>, [Nalhan]),
change(date(2018, 9, 24), <>Added <SpellLink id={SPELLS.HEED_MY_CALL.id} /> module.</>, [Dambroda]),
change(date(2018, 9, 22), <>Added <SpellLink id={SPELLS.GUTRIPPER.id} /> module.</>, [Dambroda]),
change(date(2018, 9, 19), <>Added <SpellLink id={SPELLS.OVERWHELMING_POWER.id} /> and <SpellLink id={SPELLS.BLOOD_RITE.id} /> modules.</>, [joshinator]),
change(date(2018, 9, 16), 'Added the players azerite traits to the character pane.', [joshinator]),
change(date(2018, 9, 17), 'Added Azerite trait Laser Matrix.', [blazyb]),
change(date(2018, 9, 17), <>Adds <ItemLink id={ITEMS.GALECALLERS_BOON.id} /> and <ItemLink id={ITEMS.HARLANS_LOADED_DICE.id} /> modules.</>, [Putro]),
change(date(2018, 9, 17), <>Added a <SpellLink id={SPELLS.ELEMENTAL_WHIRL.id} /> module.</>, [Putro]),
change(date(2018, 9, 17), <>Added a <ItemLink id={ITEMS.DARKMOON_DECK_FATHOMS.id} /> module.</>, [Putro]),
change(date(2018, 9, 16), <>Added a <SpellLink id={SPELLS.METICULOUS_SCHEMING.id} />-module.</>, [joshinator]),
change(date(2018, 9, 12), 'Added support for item Seabreeze', [blazyb]),
change(date(2018, 9, 10), 'Added the engineering weapon enchants to the EnchantChecker and mark them as valid weapon enchants.', [Putro]),
change(date(2018, 8, 8), 'Moved the detail tab selection to the left side.', [Zerotorescue]),
change(date(2018, 8, 6), 'If a module has a bug that causes an error it will now automatically be disabled instead of crashing.', [Zerotorescue]),
change(date(2018, 8, 5), 'Linking a hunter pet doesn\'t crash the analyzer url builder anymore.', [Mamtooth]),
change(date(2018, 8, 5), <>Added a <SpellLink id={SPELLS.MIGHT_OF_THE_MOUNTAIN.id} /> racial contribution module. Thanks to @Iyob for the suggestion.</>, [Zerotorescue]),
change(date(2018, 8, 4), 'Account for the 1% Critical Strike racial from Blood Elfs.', [Zerotorescue]),
change(date(2018, 8, 3), <>Added an <SpellLink id={SPELLS.ARCANE_TORRENT_MANA1.id} /> module that works for all Blood Elfs.</>, [Zerotorescue]),
change(date(2018, 6, 24), 'Added tracking of potion cooldowns and split Healthstone into Healthstone and health pots.', [Gebuz]),
change(date(2018, 7, 26), <>Updated our GlobalCooldown module to automatically ignore certain casts if we've marked them as not being actual casts. BM Hunter casting two spells (one for buff, one for damage) per <SpellLink id={SPELLS.BARBED_SHOT.id} /> is an example.</>, [Putro]),
change(date(2018, 7, 24), 'Added character information fetching from Battle.net (when possible) to gain race information and character thumbnails. The character thumbnail will now be used in the versus-header as per the original design.', [Zerotorescue]),
change(date(2018, 7, 21), 'Added a raid health tab to healer roles.', [Zerotorescue]),
change(date(2018, 7, 19), <>Fixed Darkmoon Deck: Promises squished mana values.</>, [Zerotorescue]),
change(date(2018, 7, 19), <>Fixed a crash when wearing Drape of Shame.</>, [Zerotorescue]),
change(date(2018, 7, 15), 'Added a link to the Legion analyzer in the links under the report bar.', [Zerotorescue]),
change(date(2018, 7, 11), <>Added support for the <SpellLink id={SPELLS.GEMHIDE.id} /> trait.</>, [emallson]),
change(date(2018, 7, 11), <>Parsing time is about 35% quicker! Thanks to <Contributor {...ackwell} /> for showing <a href="https://github.com/WoWAnalyzer/WoWAnalyzer/issues/1799">the idea</a> worked out in <a href="https://github.com/xivanalysis/xivanalysis">xivanalysis</a>.</>, [Zerotorescue]),
change(date(2018, 7, 7), 'Implemented a system for localization. We\'ll need to manually add support for localization everywhere before things can be translated, this will take some time.', [Zerotorescue]),
change(date(2018, 7, 6), 'Changed tooltips to be static except for large bars in the timeline.', [Zerotorescue]),
change(date(2018, 7, 6), 'When switching fights in the results page, the selected tab will now be remembered.', [Zerotorescue]),
change(date(2018, 7, 5), 'Added a toggle to the results page to adjust statistics for fight downtime. This is an experimental feature.', [Zerotorescue]),
change(date(2018, 6, 28), 'Allow Warcaftlogs- & BattleNet-character-links in the report selecter.', [joshinator]),
change(date(2018, 6, 24), <>Changed the <SpellLink id={SPELLS.HEALTHSTONE.id} /> suggestion to always be of minor importance.</>, [Zerotorescue]),
change(date(2018, 6, 24), 'Added an "About WoWAnalyzer" panel to the home page and updated the announcement.', [Zerotorescue]),
change(date(2018, 6, 24), 'The report history panel will be hidden where there are no entries.', [Zerotorescue]),
change(date(2018, 6, 23), 'Revamped all spells with static GCDs or base GCDs different from the class default.', [Zerotorescue]),
change(date(2018, 6, 22), 'Added WoWAnalyzer Premium. See the announcement for more information.', [Zerotorescue]),
change(date(2018, 6, 22), 'Added "ads" to help fund further development. The "ads" will at some point in the future turn into real ads from an ad platform.', [Zerotorescue]),
change(date(2018, 6, 12), 'Updated character selection to default to HPS or DPS as metric, depending on characters last active spec.', [joshinator]),
change(date(2018, 6, 8), 'Added Healthstone/Health pots to abilities and the death recap.', [Gebuz]),
change(date(2018, 6, 6), 'Fixed the character selection realm dropdown in Mozilla Firefox.', [Zerotorescue]),
change(date(2018, 6, 2), 'Improved error handling so the app will no longer permanently stay stuck in a loading state when something unexpected happens.', [Zerotorescue]),
change(date(2018, 6, 2), 'Fixed an issue where the character search realm matching was case-sensitive.', [Zerotorescue]),
change(date(2018, 6, 1), <>Removed all changelog entries before June 2018, and updated spec contributors to match. If you're interested in older changelogs, visit <a href="https://legion.wowanalyzer.com/">https://legion.wowanalyzer.com/</a>.</>, [Zerotorescue]),
];
|
src/components/helpers/input.js | VictorQD/react-pdf-viewer | import React from 'react';
const Input = props => (
<input
{...props}
data-name={props.name}
/>
);
Input.propTypes = {
name: React.PropTypes.string.isRequired
};
export default Input;
|
app/components/user-list.js | svtizg/svtizg.github.io | import React from 'react';
import { Link } from 'react-router';
const UserList = React.createClass({
render: function() {
return (
<ul className="user-list">
<li><Link to="users/2">Михаил Яндимиров</Link></li>
<li><Link to="users/1">Михаил Фалалеев</Link></li>
<li><Link to="users/3">Света Изгарева</Link></li>
<li><Link to="users/4">Дмитрий Ничик</Link></li>
<li><Link to="users/5">Павел Губин</Link></li>
</ul>
);
}
});
export default UserList;
|
src/components/Link/Link.js | tonimoeckel/lap-counter-react | /**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import PropTypes from 'prop-types';
import history from '../../history';
function isLeftClickEvent(event) {
return event.button === 0;
}
function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
class Link extends React.Component {
static propTypes = {
to: PropTypes.string,
children: PropTypes.node.isRequired,
onClick: PropTypes.func,
};
static defaultProps = {
onClick: null,
};
handleClick = event => {
if (this.props.onClick) {
this.props.onClick(event);
}
if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
return;
}
if (event.defaultPrevented === true) {
return;
}
event.preventDefault();
history.push(this.props.to);
};
render() {
const { to, children, ...props } = this.props;
return (
<a href={to} {...props} onClick={this.handleClick}>
{children}
</a>
);
}
}
export default Link;
|
src/components/app.js | neetuktoor/tossUP | import React from 'react';
import { BrowserRouter, Route, Switch, Redirect} from 'react-router-dom';
import { connect } from 'react-redux';
import Header from './Header';
import Footer from './Footer';
import Signup from './Signup';
import Login from './Login';
import Home from './Home';
import Profile from './Profile';
import EditProfile from './EditProfile';
import createBetForm from './createBetForm';
import NotifList from './NotifList';
import betList from './betList';
//two functions that return Route components, checking if authenticated, then redirecting to login or homepage location
const PrivateRoute = ({component: Component, authenticated, ...props}) => {
console.log("private section. Authenticated? ", Component);
return (
<Route
{...props}
render= {(props) => authenticated === true
? <Component {...props} />
: <Redirect to={{pathname: '/login', state: {from: props.location}}} />}
/>
);
};
const PublicRoute = ({component: Component, authenticated, ...props}) => {
return (
<Route
{...props}
render={(props) => authenticated === false
? <Component {...props} />
: <Redirect to='/' />}
/>
);
};
class App extends React.Component {
render() {
return (
<BrowserRouter>
<div className="container">
<Header />
<Switch>
<PrivateRoute authenticated={this.props.authenticated } path="/createbet" component= { createBetForm } />
<PublicRoute authenticated={this.props.authenticated } path="/signup" component={ Signup } />
<PublicRoute authenticated={this.props.authenticated } path="/login" component={ Login } />
<PrivateRoute authenticated = { this.props.authenticated } path = "/notifications" component= { NotifList } />
<PrivateRoute authenticated = { this.props.authenticated } path = "/bets" component= { betList } />
<PrivateRoute authenticated = {this.props.authenticated } path = "/profile" component = { Profile } />
<PrivateRoute authenticated = { this.props.authenticated } path = "/editprofile" component = { EditProfile } />
<PrivateRoute authenticated={this.props.authenticated } path="/" component= { betList } />
</Switch>
<Footer />
</div>
</BrowserRouter>
);
}
}
const mapStateToProps = (state) => {
return { authenticated: state.auth.authenticated };
};
export default connect(mapStateToProps)(App);
|
src/components/LinkFrom.js | marksauter/reactd3 | // @flow
import React from 'react';
import { pure, compose } from 'recompose';
import { Link, withRouter } from 'react-router-dom';
import type { Location } from 'lib/reactRouterUtils';
import { from, cleanProps } from 'lib/reactRouterUtils';
type Props = {
to: string,
location: Location,
}
export const LinkFrom = (props: Props) => {
const { to, location, ...rest } = props;
const fromTo = from(location);
return (
<Link to={fromTo(to)} {...cleanProps(rest)} />
);
}
export default compose(
withRouter,
pure,
)(LinkFrom);
|
ache-dashboard/src/AlertMessage.js | ViDA-NYU/ache | import React from 'react';
class Messages {
data = [];
error(text) {
this.data.push({type:'error', message: text});
}
success(text) {
this.data.push({type:'success', message: text});
}
display() {
this.clearOldMessages();
for(let m of this.data) {
if(!m.firstShownAt)
m.firstShownAt = Date.now();
}
return this.data;
}
clearOldMessages() {
const timeLimitMs = 5000; // 5 secs
let now = Date.now();
this.data = this.data.filter(m =>
!m.firstShownAt ||
((now - m.firstShownAt) < timeLimitMs)
);
}
}
class AlertMessage extends React.Component {
render() {
if(!this.props.message) return null;
const text = this.props.message.message;
let glyphName;
let msgClass;
if (this.props.message.type === 'error') {
glyphName = 'glyphicon-exclamation-sign';
msgClass = 'alert-danger';
} else if (this.props.message.type === 'warn') {
glyphName = 'glyphicon-exclamation-sign';
msgClass = 'alert-warning';
} else if (this.props.message.type === 'success') {
glyphName = 'glyphicon-ok-circle';
msgClass = 'alert-success';
} else {
glyphName = 'glyphicon-ok-circle';
msgClass = 'alert-info';
}
return (
<div className={'alert message ' + msgClass} >
<span className={'glyphicon ' + glyphName } aria-hidden="true"></span> {text}
</div>
);
}
}
class AlertMessages extends React.Component {
render() {
if(!this.props.messages || this.props.messages.length === 0)
return null;
else return (
<div>
{ this.props.messages.map((msg, index) =>
<AlertMessage key={index} message={msg} />
)}
</div>
);
}
}
export {Messages, AlertMessage, AlertMessages};
|
ui/js/pages/event/EventDetails.js | ericsoderberg/pbc-web |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import moment from 'moment-timezone';
import { loadCategory, unloadCategory } from '../../actions';
import FormField from '../../components/FormField';
import FormFieldAdd from '../../components/FormFieldAdd';
import Button from '../../components/Button';
import DateTimeInput from '../../components/DateTimeInput';
import SelectSearch from '../../components/SelectSearch';
import ImageField from '../../components/ImageField';
import DomainIdField from '../../components/DomainIdField';
import TrashIcon from '../../icons/Trash';
import { getLocationParams } from '../../utils/Params';
const Suggestion = props => (
<div className="box--between">
<span>{props.item.name}</span>
<span className="secondary">
{moment(props.item.start).format('MMM Do YYYY')}
</span>
</div>
);
Suggestion.propTypes = {
item: PropTypes.shape({
start: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
name: PropTypes.string,
}).isRequired,
};
class EventDetails extends Component {
constructor() {
super();
this._onToggle = this._onToggle.bind(this);
this._otherTimeChange = this._otherTimeChange.bind(this);
this._onChangePrimaryEvent = this._onChangePrimaryEvent.bind(this);
this.state = { active: false };
}
componentDidMount() {
const { formState } = this.props;
const params = getLocationParams();
if (params.calendarId) {
formState.change('calendarId')(params.calendarId);
}
}
componentWillReceiveProps(nextProps) {
const { calendars, formState, session } = nextProps;
const event = formState.object;
if (!session.userId.administrator && !event.calendarId && calendars.length > 0) {
formState.change('calendarId')(calendars[0]._id);
}
}
componentWillUnmount() {
const { dispatch } = this.props;
dispatch(unloadCategory('calendars'));
}
_get() {
const { dispatch } = this.props;
dispatch(loadCategory('calendars', { sort: 'name' }));
}
_onToggle() {
const { calendars } = this.props;
const active = !this.state.active;
if (active && calendars.length === 0) {
this._get();
}
this.setState({ active: !this.state.active });
}
_otherTimeChange(field, index) {
return (value) => {
const { formState } = this.props;
const event = formState.object;
const times = event.times.splice(0);
times[index][field] = value;
formState.set('times', times);
};
}
_onChangePrimaryEvent(suggestion) {
const { formState } = this.props;
let value;
if (suggestion) {
value = { _id: suggestion._id, name: suggestion.name };
} else {
value = undefined;
}
formState.set('primaryEventId', value);
}
render() {
const { calendars, errors, formState, session } = this.props;
const { active } = this.state;
const event = formState.object;
let contents;
if (active) {
let primaryEvent;
if (!event.dates || event.dates.length === 0) {
primaryEvent = (
<FormField label="Primary event"
help="For recurring event one-offs"
error={errors.primaryEventId}>
<SelectSearch category="events"
options={{ select: 'name start', sort: '-start' }}
Suggestion={Suggestion}
clearable={true}
value={(event.primaryEventId || {}).name || ''}
onChange={this._onChangePrimaryEvent} />
</FormField>
);
}
let otherTimes;
if (event.times && event.times.length > 0) {
otherTimes = event.times.map((time, index) => [
<FormField key={`start-${time._id}`}
label="Also starts"
closeControl={
<button type="button"
className="button-icon"
onClick={formState.removeAt('times', index)}>
<TrashIcon secondary={true} />
</button>
}>
<DateTimeInput value={time.start || ''}
onChange={this._otherTimeChange('start', index)} />
</FormField>,
<FormField key={`end-${time._id}`} label="Also ends">
<DateTimeInput value={time.end || ''}
onChange={this._otherTimeChange('end', index)} />
</FormField>,
]);
}
let addOtherTime;
if (!event.allDay) {
addOtherTime = (
<FormFieldAdd>
<Button label="Add another time"
secondary={true}
onClick={formState.addTo('times',
{ start: event.start, end: event.end })} />
</FormFieldAdd>
);
}
const calendarOptions = calendars.map(calendar => (
<option key={calendar._id} label={calendar.name} value={calendar._id} />
));
if (session.userId.administrator) {
calendarOptions.unshift(<option key={0} />);
}
contents = (
<fieldset className="form__fields">
<FormField label="Calendar" error={errors.calendarId}>
<select name="calendarId"
value={(event.calendarId || {})._id || event.calendarId || ''}
onChange={formState.change('calendarId')}>
{calendarOptions}
</select>
</FormField>
<FormField label="Url ID" help="unique url name" error={errors.path}>
<input name="path"
value={event.path || ''}
onChange={formState.change('path')} />
</FormField>
<FormField>
<input id="public"
name="public"
type="checkbox"
checked={event.public || false}
onChange={formState.toggle('public')} />
<label htmlFor="public">public</label>
</FormField>
<FormField key="align">
<input id="align"
name="align"
type="checkbox"
checked={event.align !== 'start'}
onChange={() => formState.set('align',
event.align === 'start' ? 'center' : 'start')} />
<label htmlFor="align">center</label>
</FormField>
<ImageField label="Image"
name="image"
formState={formState}
property="image" />
<FormField label="Background color">
<input name="color"
value={event.color || ''}
onChange={formState.change('color')} />
</FormField>
<DomainIdField formState={formState} session={session} />
{primaryEvent}
{otherTimes}
{addOtherTime}
</fieldset>
);
}
return (
<div>
<div type="button" className="form-item">
<Button secondary={true}
label="Details"
onClick={this._onToggle} />
</div>
{contents}
</div>
);
}
}
EventDetails.propTypes = {
calendars: PropTypes.array,
dispatch: PropTypes.func.isRequired,
errors: PropTypes.object,
formState: PropTypes.object.isRequired,
session: PropTypes.object.isRequired,
};
EventDetails.defaultProps = {
calendars: [],
errors: {},
};
const select = state => ({
calendars: (state.calendars || {}).items || [],
});
export default connect(select)(EventDetails);
|
src/index.js | spartanhooah/BlogApp | import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import {BrowserRouter, Route, Switch} from 'react-router-dom';
import promise from 'redux-promise';
import reducers from './reducers';
import PostsIndex from './components/posts_index';
import NewPost from './components/new_post';
import ShowPost from './components/show_post';
const createStoreWithMiddleware = applyMiddleware(promise)(createStore);
ReactDOM.render(
<Provider store={createStoreWithMiddleware(reducers)}>
<BrowserRouter>
<div>
<Switch>
<Route path="/posts/new" component={NewPost} />
<Route path="/posts/:id" component={ShowPost} />
<Route path="/" component={PostsIndex} />
</Switch>
</div>
</BrowserRouter>
</Provider>
, document.querySelector('.container'));
|
src/js/components/Layer/stories/Form.js | HewlettPackard/grommet | import React from 'react';
import { Add, Close } from 'grommet-icons';
import {
Box,
Button,
FormField,
Grommet,
Heading,
Layer,
Select,
TextArea,
TextInput,
} from 'grommet';
import { grommet } from 'grommet/themes';
const suggestions = ['alpha', 'beta'];
export const FormLayer = () => {
const [open, setOpen] = React.useState(false);
const [select, setSelect] = React.useState('');
const onOpen = () => setOpen(true);
const onClose = () => setOpen(undefined);
return (
<Grommet theme={grommet} full>
<Box fill align="center" justify="center">
<Button icon={<Add />} label="Add" onClick={onOpen} />
{open && (
<Layer
position="right"
full="vertical"
modal
onClickOutside={onClose}
onEsc={onClose}
>
<Box
as="form"
fill="vertical"
overflow="auto"
width="medium"
pad="medium"
onSubmit={onClose}
>
<Box flex={false} direction="row" justify="between">
<Heading level={2} margin="none">
Add
</Heading>
<Button icon={<Close />} onClick={onClose} />
</Box>
<Box flex="grow" overflow="auto" pad={{ vertical: 'medium' }}>
<FormField label="First">
<TextInput suggestions={suggestions} />
</FormField>
<FormField label="Second">
<Select
options={[
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
]}
value={select}
onSearch={() => {}}
onChange={({ option }) => setSelect(option)}
/>
</FormField>
<FormField label="Third">
<TextArea />
</FormField>
</Box>
<Box flex={false} as="footer" align="start">
<Button
type="submit"
label="Submit"
onClick={onClose}
primary
/>
</Box>
</Box>
</Layer>
)}
</Box>
</Grommet>
);
};
FormLayer.storyName = 'Form';
FormLayer.parameters = {
chromatic: { disable: true },
};
export default {
title: 'Layout/Layer/Form',
};
|
app/renderer/settings.js | pastak/electonic-ninetan | import React from 'react'
import ReactDOM from 'react-dom'
import SettingsApp from './components/SettingsApp'
(() => {
document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(<SettingsApp />, document.querySelector('#settingsApp'))
})
})()
|
src/components/HOC/ToggleSwitch.js | dkadrios/zendrum-stompblock-client | import React from 'react'
import PropTypes from 'prop-types'
import { Switch, FormControlLabel, FormGroup } from '@material-ui/core'
const ToggleSwitch = ({ checked, feature, handler }) => (
<FormGroup>
<FormControlLabel
control={<Switch
color="primary"
checked={checked}
onChange={(event, value) => handler(value)}
/>}
label={`Enable ${feature}`}
/>
</FormGroup>
)
ToggleSwitch.propTypes = {
checked: PropTypes.bool.isRequired,
feature: PropTypes.string.isRequired,
handler: PropTypes.func.isRequired,
}
export default ToggleSwitch
|
server/sonar-web/src/main/js/apps/component-measures/details/drilldown/Breadcrumb.js | lbndev/sonarqube | /*
* SonarQube
* Copyright (C) 2009-2017 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
import QualifierIcon from '../../../../components/shared/qualifier-icon';
import { isDiffMetric, formatLeak } from '../../utils';
import { formatMeasure } from '../../../../helpers/measures';
const Breadcrumb = ({ component, metric, onBrowse }) => {
const handleClick = e => {
e.preventDefault();
e.target.blur();
onBrowse(component);
};
let inner;
if (onBrowse) {
inner = (
<a id={'component-measures-breadcrumb-' + component.key} href="#" onClick={handleClick}>
{component.name}
</a>
);
} else {
inner = <span>{component.name}</span>;
}
const value = isDiffMetric(metric)
? formatLeak(component.leak, metric)
: formatMeasure(component.value, metric.type);
return (
<span>
<QualifierIcon qualifier={component.qualifier} />
{inner}
{value != null && <span>{' (' + value + ')'}</span>}
</span>
);
};
export default Breadcrumb;
|
app/components/AppFooter/index.js | ahsan-virani/react-gcd-portal | import React from 'react';
import { FormattedMessage } from 'react-intl';
import Img from './Img';
import Footer from './Footer';
import { FooterBtn } from './FooterClass';
import { Link } from 'react-router';
import FootLogoImg from './foot-logo.png';
import NavBar from './NavBar';
import Ul from './Ul';
import './styles.css';
//
class AppFooter extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<Footer>
<div className="wrapper">
<div className="footer">
<div className="foot1">
<div className="foot-logo">
<Link to="/">
<Img src={FootLogoImg} alt="GlobalCoinDex" />
</Link>
</div>
<div className="foot-social">
<ul>
<li>
<Link to="/"><i className="fa fa-facebook" aria-hidden="true"></i></Link>
</li>
<li>
<Link to="/"><i className="fa fa-twitter" aria-hidden="true"></i></Link>
</li>
<li>
<Link to="/"><i className="fa fa-youtube" aria-hidden="true"></i></Link>
</li>
<li>
<Link to="/"><i className="fa fa-linkedin" aria-hidden="true"></i></Link>
</li>
</ul>
</div>
</div>
<div className="foot2">
<h1>NAVIGATIONS</h1>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/about">About</Link></li>
<li><Link to="/features">Features</Link></li>
<li><Link to="/security">Security</Link></li>
</ul>
<ul>
<li><Link to="/howitworks">How It Works</Link></li>
<li><Link to="/marketstats">Market Statistics</Link></li>
<li><Link to="/changelog">Change Log</Link></li>
<li><Link to="/contact">Contact Us</Link></li>
</ul>
</div>
<div className="foot3">
<h1>Join Our Mailing List</h1>
<p>Join us and stay up to date</p>
<input type="text" placeholder="Your Email here" />
<FooterBtn type="submit" />
</div>
<div className="clear"></div>
</div>
</div>
<div className="copyright">
<p>Copyrights © 2017 Global Coindex (GCD.)</p>
</div>
</Footer>
);
}
}
export default AppFooter;
|
src/index.js | jbkly/passphrase | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import setWordArray from './wordlist';
setWordArray();
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
|
src/parser/shared/modules/items/bfa/FirstMatesSpyglass.js | FaideWW/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS/index';
import ITEMS from 'common/ITEMS/index';
import Analyzer from 'parser/core/Analyzer';
import HIT_TYPES from 'game/HIT_TYPES';
import Abilities from 'parser/core/modules/Abilities';
import { formatPercentage } from 'common/format';
/**
* First Mate's Spyglass -
* Use: Increase your Critical Strike by 768 for 15 sec. (2 Min Cooldown)
*/
class FirstMatesSpyglass extends Analyzer {
static dependencies = {
abilities: Abilities,
};
casts = 0;
timesHit = 0;
timesCrit = 0;
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTrinket(
ITEMS.FIRST_MATES_SPYGLASS.id
);
if (this.active) {
this.abilities.add({
spell: SPELLS.SPYGLASS_SIGHT,
name: ITEMS.FIRST_MATES_SPYGLASS.name,
category: Abilities.SPELL_CATEGORIES.ITEMS,
cooldown: 120,
castEfficiency: {
suggestion: true,
},
});
}
}
on_byPlayer_cast(event) {
if (event.ability.guid !== SPELLS.SPYGLASS_SIGHT.id) {
return;
}
this.casts += 1;
}
on_byPlayer_damage(event) {
if (!this.selectedCombatant.hasBuff(SPELLS.SPYGLASS_SIGHT.id)) {
return;
}
if (event.hitType !== HIT_TYPES.CRIT) {
this.timesHit += 1;
} else {
this.timesHit += 1;
this.timesCrit += 1;
}
}
on_byPlayer_heal(event) {
if (!this.selectedCombatant.hasBuff(SPELLS.SPYGLASS_SIGHT.id)) {
return;
}
if (event.hitType !== HIT_TYPES.CRIT) {
this.timesHit += 1;
} else {
this.timesHit += 1;
this.timesCrit += 1;
}
}
get totalBuffUptime() {
return this.selectedCombatant.getBuffUptime(SPELLS.SPYGLASS_SIGHT.id) / this.owner.fightDuration;
}
item() {
return {
item: ITEMS.FIRST_MATES_SPYGLASS,
result: (
<dfn data-tip={`You critically hit ${formatPercentage(this.timesCrit / this.timesHit)}% of the time with this buff up`}>
Used {this.casts} times / {formatPercentage(this.totalBuffUptime)}% uptime
</dfn>
),
};
}
}
export default FirstMatesSpyglass;
|
public/src/puns/puns.container.js | MaciejSzaflik/CharadesAndStuff | import React from 'react';
export class Puns extends React.Component {
render() {
return (
<div>Kalambury</div>
)
}
} |
ui/src/index.js | AhmedAli7O1/docker-portal | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
ReactDOM.render(
<App />,
document.getElementById('root')
);
|
app/javascript/mastodon/features/ui/components/video_modal.js | SerCom-KC/mastodon | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import Video from '../../video';
import ImmutablePureComponent from 'react-immutable-pure-component';
export default class VideoModal extends ImmutablePureComponent {
static propTypes = {
media: ImmutablePropTypes.map.isRequired,
time: PropTypes.number,
onClose: PropTypes.func.isRequired,
};
render () {
const { media, time, onClose } = this.props;
return (
<div className='modal-root__modal video-modal'>
<div>
<Video
preview={media.get('preview_url')}
src={media.get('url')}
startTime={time}
onCloseVideo={onClose}
detailed
alt={media.get('description')}
/>
</div>
</div>
);
}
}
|
elcri.men/src/pages/404.js | diegovalle/new.crimenmexico | import React from 'react';
import {useStaticQuery, graphql} from 'gatsby';
import Layout from '../components/layout';
import {useIntl, injectIntl, FormattedMessage, FormattedHTMLMessage} from 'react-intl';
import Img from 'gatsby-image';
import useBestImages from '../components/BestImages';
import LLink from '../components/LLink';
import Helmet from 'react-helmet';
const useError = () => {
const data = useStaticQuery (graphql`
query errorQuery {
fatbubu:file(relativePath: {eq: "fatbubu.jpg"}) {
childImageSharp {
fixed(width: 300, height: 400, quality: 80) {
...GatsbyImageSharpFixed_withWebp
originalName
width
}
}
}
}
`);
return data;
};
const NotFoundPage = props => {
const intl = useIntl ();
const image = useError ();
const bestImages = useBestImages ();
return (
<Layout locale={props.pageContext.locale} path={props.location.pathname}>
<Helmet>
<title>{intl.formatMessage ({id: 'NOT FOUND'})}</title>
<meta name="description" content={intl.formatMessage ({
id: "You just hit a route that doesn't exist... the sadness.",
})} />
<html lang={props.pageContext.locale} />
</Helmet>
<section class="hero">
<div class="hero-body">
<div class="container has-text-centered">
<h1 className="title has-text-centered has-text-danger">
{intl.formatMessage ({id: 'NOT FOUND'})}
</h1>
<h2 className="subtitle has-text-centered has-text-danger">
{intl.formatMessage ({
id: "You just hit a route that doesn't exist... the sadness.",
})}
</h2>
</div>
</div>
</section>
<div class="columns is-mobile is-centered">
<div class="column is-half has-text-centered">
<figure class="image is-3x4 is-inline-block">
<Img
key={image.fatbubu.childImageSharp.fixed}
fixed={image.fatbubu.childImageSharp.fixed}
title={intl.formatMessage ({
id: 'NOT FOUND',
})}
alt={intl.formatMessage ({
id: 'NOT FOUND',
})}
/>
</figure>
</div>
</div>
<section class="more is-widescreen" style={{paddingTop: '2rem'}}>
<div class="container has-text-centered">
<h2 class="title">
<FormattedMessage id="best_site" />
</h2>
<div class="columns">
<div class="column">
<h5 class="title is-5"><FormattedMessage id="crime_map" /></h5>
<br />
<div class="level">
<div class="level-item">
<figure class="image is-128x128">
<Img
className="is-rounded"
key={bestImages.mapa.childImageSharp.fixed}
fixed={bestImages.mapa.childImageSharp.fixed}
title={intl.formatMessage ({id: 'Crime map of Mexico'})}
alt={intl.formatMessage ({id: 'Crime map of Mexico'})}
/>
</figure>
</div>
</div>
<p className="block">
<FormattedHTMLMessage id="map_description" />
</p>
<br />
<button class="button is-link">
<LLink
to="/mapa-de-delincuencia/"
locale={props.pageContext.locale}
>
<FormattedMessage id="crime_map" />
</LLink>
</button>
</div>
<div class="column">
<h5 class="title is-5"><FormattedMessage id="anomalies" /></h5>
<div class="level">
<div class="level-item">
<figure class="image is-128x128">
<Img
className="is-rounded"
key={bestImages.anomalies.childImageSharp.fixed}
fixed={bestImages.anomalies.childImageSharp.fixed}
title={intl.formatMessage ({id: 'Crime anomalies'})}
alt={intl.formatMessage ({id: 'Crime anomalies'})}
/>
</figure>
</div>
</div>
<p className="block">
<FormattedHTMLMessage id="anomalies_description" />
</p>
<br />
<button class="button is-link">
<LLink to="/anomalias/" locale={props.pageContext.locale}>
<FormattedMessage id="anomalies" />
</LLink>
</button>
</div>
<div class="column">
<h5 class="title is-5"><FormattedMessage id="trends" /></h5><br />
<div class="level">
<div class="level-item">
<figure class="image is-128x128">
<Img
className="is-rounded"
key={bestImages.trend.childImageSharp.fixed}
fixed={bestImages.trend.childImageSharp.fixed}
title={intl.formatMessage ({
id: 'Homicide trends in Mexico',
})}
alt={intl.formatMessage ({
id: 'Homicide trends in Mexico',
})}
/>
</figure>
</div>
</div>
<p class="block">
<FormattedHTMLMessage id="trend_description" />
</p>
<br />
<button class="button is-link">
<LLink to="/tendencias/" locale={props.pageContext.locale}>
<FormattedMessage id="trends" />
</LLink>
</button>
</div>
</div>
</div>
</section>
</Layout>
);
};
export default NotFoundPage;
|
frontend/src/components/overview/nowplay.js | Kilte/scrobbler | import React from 'react';
function NowplayBar() {
return <div className="overview-nowplay-bar">
<span className="overview-nowplay-bar-item"></span>
<span className="overview-nowplay-bar-item"></span>
<span className="overview-nowplay-bar-item"></span>
<span className="overview-nowplay-bar-item"></span>
<span className="overview-nowplay-bar-item"></span>
</div>;
}
class Nowplay extends React.Component {
componentWillMount() {
this.props.loadData();
}
render() {
let content,
description;
if (!this.props.data.get('loaded')) {
content = <NowplayBar />;
description = 'Requesting data...';
} else if (this.props.data.get('error')) {
content = <NowplayBar />;
description = 'Unable to get current track';
} else {
let data = this.props.data.get('data');
if (data) {
content = <div className="overview-nowplay-track">
<div className="overview-nowplay-track-item">
<NowplayBar />
</div>
<div className="overview-nowplay-track-item">
{data.get('title')}
</div>
</div>;
description = `From "${data.get('album')}" of "${data.get('artist')}"`;
} else {
content = <NowplayBar />;
description = 'Nothing to display';
}
}
return <div className="overview-nowplay">
<div className="overview-nowplay-content">
{content}
</div>
<div className="overview-nowplay-description" title={description}>
{description}
</div>
</div>;
}
}
Nowplay.propTypes = {
data: React.PropTypes.object.isRequired,
loadData: React.PropTypes.func.isRequired
};
export default Nowplay;
|
app/javascript/packs/components/shared/Form/index.js | NahlStudio/teamly-rails | import React from 'react';
function Form(props) {
return (
<form {...props}>
{props.children}
</form>
);
}
export default Form;
|
frontend/src/Components/FileBrowser/FileBrowserRow.js | Radarr/Radarr | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Icon from 'Components/Icon';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRowButton from 'Components/Table/TableRowButton';
import { icons } from 'Helpers/Props';
import styles from './FileBrowserRow.css';
function getIconName(type) {
switch (type) {
case 'computer':
return icons.COMPUTER;
case 'drive':
return icons.DRIVE;
case 'file':
return icons.FILE;
case 'parent':
return icons.PARENT;
default:
return icons.FOLDER;
}
}
class FileBrowserRow extends Component {
//
// Listeners
onPress = () => {
this.props.onPress(this.props.path);
};
//
// Render
render() {
const {
type,
name
} = this.props;
return (
<TableRowButton onPress={this.onPress}>
<TableRowCell className={styles.type}>
<Icon name={getIconName(type)} />
</TableRowCell>
<TableRowCell>{name}</TableRowCell>
</TableRowButton>
);
}
}
FileBrowserRow.propTypes = {
type: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
path: PropTypes.string.isRequired,
onPress: PropTypes.func.isRequired
};
export default FileBrowserRow;
|
src/Navigation.js | BrendonSled/react-native-navigation | /*eslint-disable*/
import React from 'react';
import {AppRegistry} from 'react-native';
import platformSpecific from './deprecated/platformSpecificDeprecated';
import {Screen} from './Screen';
import PropRegistry from './PropRegistry';
const registeredScreens = {};
const _allNavigatorEventHandlers = {};
function registerScreen(screenID, generator) {
registeredScreens[screenID] = generator;
AppRegistry.registerComponent(screenID, generator);
}
function registerComponent(screenID, generator, store = undefined, Provider = undefined, options = {}) {
if (store && Provider) {
return _registerComponentRedux(screenID, generator, store, Provider, options);
} else {
return _registerComponentNoRedux(screenID, generator);
}
}
function _registerComponentNoRedux(screenID, generator) {
const generatorWrapper = function() {
const InternalComponent = generator();
if (!InternalComponent) {
console.error(`Navigation: ${screenID} registration result is 'undefined'`);
}
return class extends Screen {
static navigatorStyle = InternalComponent.navigatorStyle || {};
static navigatorButtons = InternalComponent.navigatorButtons || {};
constructor(props) {
super(props);
this.state = {
internalProps: {...props, ...PropRegistry.load(props.screenInstanceID)}
}
}
componentWillReceiveProps(nextProps) {
this.setState({
internalProps: {...PropRegistry.load(this.props.screenInstanceID), ...nextProps}
})
}
render() {
return (
<InternalComponent testID={screenID} navigator={this.navigator} {...this.state.internalProps} />
);
}
};
};
registerScreen(screenID, generatorWrapper);
return generatorWrapper;
}
function _registerComponentRedux(screenID, generator, store, Provider, options) {
const generatorWrapper = function() {
const InternalComponent = generator();
return class extends Screen {
static navigatorStyle = InternalComponent.navigatorStyle || {};
static navigatorButtons = InternalComponent.navigatorButtons || {};
constructor(props) {
super(props);
this.state = {
internalProps: {...props, ...PropRegistry.load(props.screenInstanceID)}
}
}
componentWillReceiveProps(nextProps) {
this.setState({
internalProps: {...PropRegistry.load(this.props.screenInstanceID), ...nextProps}
})
}
render() {
return (
<Provider store={store} {...options}>
<InternalComponent testID={screenID} navigator={this.navigator} {...this.state.internalProps} />
</Provider>
);
}
};
};
registerScreen(screenID, generatorWrapper);
return generatorWrapper;
}
function getRegisteredScreen(screenID) {
const generator = registeredScreens[screenID];
if (!generator) {
console.error(`Navigation.getRegisteredScreen: ${screenID} used but not yet registered`);
return undefined;
}
return generator();
}
function showModal(params = {}) {
return platformSpecific.showModal(params);
}
function dismissModal(params = {}) {
return platformSpecific.dismissModal(params);
}
function dismissAllModals(params = {}) {
return platformSpecific.dismissAllModals(params);
}
function showSnackbar(params = {}) {
return platformSpecific.showSnackbar(params);
}
function showLightBox(params = {}) {
return platformSpecific.showLightBox(params);
}
function dismissLightBox(params = {}) {
return platformSpecific.dismissLightBox(params);
}
function showInAppNotification(params = {}) {
return platformSpecific.showInAppNotification(params);
}
function dismissInAppNotification(params = {}) {
return platformSpecific.dismissInAppNotification(params);
}
function startTabBasedApp(params) {
return platformSpecific.startTabBasedApp(params);
}
function startSingleScreenApp(params) {
return platformSpecific.startSingleScreenApp(params);
}
function setEventHandler(navigatorEventID, eventHandler) {
_allNavigatorEventHandlers[navigatorEventID] = eventHandler;
}
function clearEventHandler(navigatorEventID) {
delete _allNavigatorEventHandlers[navigatorEventID];
}
function handleDeepLink(params = {}) {
const { link, payload } = params;
if (!link) return;
const event = {
type: 'DeepLink',
link,
...(payload ? { payload } : {})
};
for (let i in _allNavigatorEventHandlers) {
_allNavigatorEventHandlers[i](event);
}
}
async function isAppLaunched() {
return await platformSpecific.isAppLaunched();
}
async function isRootLaunched() {
return await platformSpecific.isRootLaunched();
}
function getCurrentlyVisibleScreenId() {
return platformSpecific.getCurrentlyVisibleScreenId();
}
export default {
getRegisteredScreen,
getCurrentlyVisibleScreenId,
registerComponent,
showModal: showModal,
dismissModal: dismissModal,
dismissAllModals: dismissAllModals,
showSnackbar: showSnackbar,
showLightBox: showLightBox,
dismissLightBox: dismissLightBox,
showInAppNotification: showInAppNotification,
dismissInAppNotification: dismissInAppNotification,
startTabBasedApp: startTabBasedApp,
startSingleScreenApp: startSingleScreenApp,
setEventHandler: setEventHandler,
clearEventHandler: clearEventHandler,
handleDeepLink: handleDeepLink,
isAppLaunched: isAppLaunched,
isRootLaunched: isRootLaunched
};
|
docs/src/components/Home/Home.js | seekinternational/seek-asia-style-guide | import React from 'react';
import { ScreenReaderOnly } from 'seek-asia-style-guide/react';
import Hero from './Hero/Hero';
import Preface from './Preface/Preface';
export default function Home() {
return (
<div>
<ScreenReaderOnly><h1>SEEK Style Guide</h1></ScreenReaderOnly>
<Hero />
<Preface />
</div>
);
}
|
containers/TodoList.js | FlorianEdelmaier/SimpleReduxDemo | import React from 'react';
import Todo from './Todo';
class TodoList extends React.Component {
render() {
return (
<ul>
{this.props.todos.map(todo =>
<Todo
key={todo.id}
text={todo.text}
completed={todo.completed}
onClick={() => this.props.onTodoClick(todo.id)}/>
)}
</ul>
);
}
}
TodoList.propTypes = {
onTodoClick: React.PropTypes.func.isRequired,
todos: React.PropTypes.arrayOf(React.PropTypes.shape({
text: React.PropTypes.string.isRequired,
completed: React.PropTypes.bool.isRequired
}).isRequired).isRequired
};
export default TodoList;
|
src/app/components/home/OneColumnTable.js | maullerz/eve-react | import React from 'react'
import SimpleList from "../blocks/_simple_list"
const OneColumnTable = ({data}) => {
return <table>
<thead>
<tr>
<th>{data.title}</th>
</tr>
</thead>
<tbody>
<tr>
<td className="t-a_l">
<SimpleList list={data.list} />
</td>
</tr>
</tbody>
</table>
}
export default OneColumnTable
|
test/helpers/shallowRenderHelper.js | abbr/ShowPreper | /**
* Function to get the shallow output for a given component
* As we are using phantom.js, we also need to include the fn.proto.bind shim!
*
* @see http://simonsmith.io/unit-testing-react-components-without-a-dom/
* @author somonsmith
*/
import React from 'react'
import ShallowRenderer from 'react-test-renderer/shallow'
/**
* Get the shallow rendered component
*
* @param {Object} component The component to return the output for
* @param {Object} props [optional] The components properties
* @param {Mixed} ...children [optional] List of children
* @return {Object} Shallow rendered output
*/
export default function createComponent(component, props = {}, ...children) {
const shallowRenderer = new ShallowRenderer()
shallowRenderer.render(
React.createElement(
component,
props,
children.length > 1 ? children : children[0]
)
)
return shallowRenderer.getRenderOutput()
}
|
frontend/src/containers/VictimIP.js | dimkarakostas/rupture | import React from 'react';
export default class VictimIP extends React.Component {
constructor() {
super();
this.state = { sourceip: '' };
}
handleIP = () => {
this.setState({ sourceip: this.refs.victimip.value });
this.props.onUpdate(this.refs.victimip.value);
}
render() {
return(
<div>
<label htmlFor='ip' className='col-md-4 col-sm-6 attackpagefields'>IP: </label>
<div className='col-md-6 progressmargin'>
<input type='text' className='form-control' placeholder='192.168.1.2' ref='victimip'
value={ this.props.sourceip }
onChange={ this.handleIP }/>
</div>
</div>
);
}
}
|
newclient/scripts/components/admin/disclosure-filter-by-reviewer/reviewer/index.js | kuali/research-coi | /*
The Conflict of Interest (COI) module of Kuali Research
Copyright © 2005-2016 Kuali, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
import styles from './style';
import classNames from 'classnames';
import React from 'react';
import {AdminActions} from '../../../../actions/admin-actions';
export default class Reviewer extends React.Component {
constructor() {
super();
this.onClick = this.onClick.bind(this);
}
onClick() {
AdminActions.removeReviewerFilter(this.props.userId);
}
render() {
return (
<div className={styles.container}>
{this.props.value}
<button onClick={this.onClick} className={styles.button}>
<i className={classNames('fa', 'fa-times')} />
</button>
</div>
);
}
}
|
client/components/users/reset-password.js | ShannChiang/meteor-react-redux-base | import React from 'react';
export default class extends React.Component {
constructor(props) {
super(props);
this.state = {uiState: 'INIT'};
this.onSubmit = this.onSubmit.bind(this);
}
onSubmit(e) {
e.preventDefault();
this.setState({uiState: 'SENDING'});console.log(this._input.value);
this.props.resetPassword(this._input.value, (err) => {
if (err) {
console.log(err);
this.setState({uiState: 'FAIL'});
} else {
this.setState({uiState: 'SUCCESS'});
}
});
}
render() {
if (this.state.uiState === 'SENDING') return <div style={{marginTop: 60, marginLeft: 10}}>正在设置密码...</div>;
if (this.state.uiState === 'SUCCESS') return <div style={{marginTop: 60, marginLeft: 10}}>密码设置成功</div>;
return (
<form style={{marginTop: 60, marginLeft: 10}} onSubmit={this.onSubmit}>
{this.state.uiState === 'FAIL' && <p>密码设置失败,请重试</p>}
密码:<input type="password" ref={(c) => this._input = c}/>
<input type="submit" value="设置" />
</form>);
}
}
|
packages/wix-style-react/src/Input/Affix/Affix.js | wix/wix-style-react | import React from 'react';
import PropTypes from 'prop-types';
import { st, classes } from './Affix.st.css';
import InputConsumer from '../InputConsumer';
import { FontUpgradeContext } from '../../FontUpgrade/context';
const Affix = ({ children, value }) => (
<InputConsumer consumerCompName={Affix.displayName}>
{({
size,
inPrefix,
inSuffix,
border,
roundInput,
disabled,
onInputClicked,
}) => (
<FontUpgradeContext.Consumer>
{({ active: isMadefor }) => (
<div
className={st(classes.root, {
isMadefor,
size,
inPrefix,
inSuffix,
border: roundInput ? 'round' : border,
disabled,
})}
onClick={onInputClicked}
data-hook="custom-affix"
>
{value || children}
</div>
)}
</FontUpgradeContext.Consumer>
)}
</InputConsumer>
);
Affix.displayName = 'Input.Affix';
Affix.propTypes = {
children: PropTypes.node,
value: PropTypes.string,
};
export default Affix;
|
examples/immutable/app.js | maludwig/react-redux-form | import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import store from './store.js';
import UserForm from './components/user-form.js';
class App extends React.Component {
render() {
return (
<Provider store={store}>
<UserForm />
</Provider>
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
src/server.js | NathanBWaters/website | import Express from 'express';
import React from 'react';
import ReactDOM from 'react-dom/server';
import config from './config';
import favicon from 'serve-favicon';
import compression from 'compression';
import httpProxy from 'http-proxy';
import path from 'path';
import createStore from './redux/create';
import ApiClient from './helpers/ApiClient';
import Html from './helpers/Html';
import PrettyError from 'pretty-error';
import http from 'http';
import { match } from 'react-router';
import { ReduxAsyncConnect, loadOnServer } from 'redux-async-connect';
import createHistory from 'react-router/lib/createMemoryHistory';
import {Provider} from 'react-redux';
import getRoutes from './routes';
const targetUrl = 'http://' + config.apiHost + ':' + config.apiPort;
const pretty = new PrettyError();
const app = new Express();
const server = new http.Server(app);
const proxy = httpProxy.createProxyServer({
target: targetUrl,
ws: true
});
app.use(compression());
app.use(favicon(path.join(__dirname, '..', 'static', 'favicon.ico')));
app.use(Express.static(path.join(__dirname, '..', 'static')));
// Proxy to API server
app.use('/api', (req, res) => {
proxy.web(req, res, {target: targetUrl});
});
app.use('/ws', (req, res) => {
proxy.web(req, res, {target: targetUrl + '/ws'});
});
server.on('upgrade', (req, socket, head) => {
proxy.ws(req, socket, head);
});
// added the error handling to avoid https://github.com/nodejitsu/node-http-proxy/issues/527
proxy.on('error', (error, req, res) => {
let json;
if (error.code !== 'ECONNRESET') {
console.error('proxy error', error);
}
if (!res.headersSent) {
res.writeHead(500, {'content-type': 'application/json'});
}
json = {error: 'proxy_error', reason: error.message};
res.end(JSON.stringify(json));
});
app.use((req, res) => {
if (__DEVELOPMENT__) {
// Do not cache webpack stats: the script file would change since
// hot module replacement is enabled in the development env
webpackIsomorphicTools.refresh();
}
const client = new ApiClient(req);
const history = createHistory(req.originalUrl);
const store = createStore(history, client);
function hydrateOnClient() {
res.send('<!doctype html>\n' +
ReactDOM.renderToString(<Html assets={webpackIsomorphicTools.assets()} store={store}/>));
}
if (__DISABLE_SSR__) {
hydrateOnClient();
return;
}
match({ history, routes: getRoutes(store), location: req.originalUrl }, (error, redirectLocation, renderProps) => {
if (redirectLocation) {
res.redirect(redirectLocation.pathname + redirectLocation.search);
} else if (error) {
console.error('ROUTER ERROR:', pretty.render(error));
res.status(500);
hydrateOnClient();
} else if (renderProps) {
loadOnServer({...renderProps, store, helpers: {client}}).then(() => {
const component = (
<Provider store={store} key="provider">
<ReduxAsyncConnect {...renderProps} />
</Provider>
);
res.status(200);
global.navigator = {userAgent: req.headers['user-agent']};
res.send('<!doctype html>\n' +
ReactDOM.renderToString(<Html assets={webpackIsomorphicTools.assets()} component={component} store={store}/>));
});
} else {
res.status(404).send('Not found');
}
});
});
if (config.port) {
server.listen(config.port, (err) => {
if (err) {
console.error(err);
}
console.info('----\n==> ✅ %s is running, talking to API server on %s.', config.app.title, config.apiPort);
console.info('==> 💻 Open http://%s:%s in a browser to view the app.', config.host, config.port);
});
} else {
console.error('==> ERROR: No PORT environment variable has been specified');
}
|
src/js/components/icons/base/Cafeteria.js | kylebyerly-hp/grommet | // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import CSSClassnames from '../../../utils/CSSClassnames';
import Intl from '../../../utils/Intl';
import Props from '../../../utils/Props';
const CLASS_ROOT = CSSClassnames.CONTROL_ICON;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class Icon extends Component {
render () {
const { className, colorIndex } = this.props;
let { a11yTitle, size, responsive } = this.props;
let { intl } = this.context;
const classes = classnames(
CLASS_ROOT,
`${CLASS_ROOT}-cafeteria`,
className,
{
[`${CLASS_ROOT}--${size}`]: size,
[`${CLASS_ROOT}--responsive`]: responsive,
[`${COLOR_INDEX}-${colorIndex}`]: colorIndex
}
);
a11yTitle = a11yTitle || Intl.getMessage(intl, 'cafeteria');
const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));
return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M12,1 L12,7.99967027 C12,9.65670662 10.6526091,11 9.00313032,11 L5.99686968,11 C4.34174426,11 3,9.6513555 3,7.99967027 L3,1 M6,7 C6,7 6,6.54902482 6,6.00922203 L6,1 M9,7 C9,7 9,6.54902482 9,6.00922203 L9,1 M6,11 L6,21.5044548 C6,22.3304216 6.66579723,23 7.5,23 L7.5,23 C8.32842712,23 9,22.3204455 9,21.5044548 L9,11 M15,18 L15,21.4998351 C15,22.3283533 15.6657972,23 16.5,23 L16.5,23 C17.3284271,23 18,22.3316845 18,21.4952612 L18,15 C18,15 21,15 21,12 C21,9 21,10 21,7 C21,4 19,2 15,2 C15,2 15,9.99456145 15,18 L15,18 Z"/></svg>;
}
};
Icon.contextTypes = {
intl: PropTypes.object
};
Icon.defaultProps = {
responsive: true
};
Icon.displayName = 'Cafeteria';
Icon.icon = true;
Icon.propTypes = {
a11yTitle: PropTypes.string,
colorIndex: PropTypes.string,
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),
responsive: PropTypes.bool
};
|
src/components/identicon/Identicon.js | ipfs/webui | import React from 'react'
import ReactIdenticon from 'react-identicons'
import { colors } from 'ipfs-css/theme.json'
const identiconPalette = [colors.navy, colors.aqua, colors.gray, colors.charcoal, colors.red, colors.yellow, colors.teal, colors.green]
const Identicon = ({ size = 14, cid, className = 'v-btm' }) => <ReactIdenticon string={cid} size={size} palette={identiconPalette} className={className} />
export default Identicon
|
Magistrate/client/components/roles/createRoleDialog.js | Pondidum/Magistrate | import React from 'react'
import RoleDialog from './roleDialog'
var CreateRoleDialog = React.createClass({
open() {
var dialog = this.refs.dialog;
dialog.resetValues();
dialog.open();
},
onSubmit() {
var dialog = this.refs.dialog;
var values = dialog.getValue();
var json = JSON.stringify({
key: values.key,
name: values.name,
description: values.description
});
dialog.asyncStart();
$.ajax({
url: this.props.url,
method: "PUT",
dataType: 'json',
data: json,
cache: false,
success: function(data) {
dialog.asyncStop();
if (data) {
this.props.onCreate(data);
dialog.close();
} else {
this.setState({ keyTaken: true });
}
}.bind(this),
error: function(xhr, status, err) {
dialog.asyncStop();
}
});
},
render() {
return (
<a className="btn btn-primary" onClick={this.open}>
Create Role
<RoleDialog onSubmit={this.onSubmit} acceptText="Create" ref="dialog" />
</a>
);
}
});
export default CreateRoleDialog
|
modules/About.js | Sinyupl/jieshao | import React from 'react'
export default React.createClass({
render(){
return <div>About</div>
}
})
|
src/svg-icons/image/add-a-photo.js | xmityaz/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageAddAPhoto = (props) => (
<SvgIcon {...props}>
<path d="M3 4V1h2v3h3v2H5v3H3V6H0V4h3zm3 6V7h3V4h7l1.83 2H21c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V10h3zm7 9c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-3.2-5c0 1.77 1.43 3.2 3.2 3.2s3.2-1.43 3.2-3.2-1.43-3.2-3.2-3.2-3.2 1.43-3.2 3.2z"/>
</SvgIcon>
);
ImageAddAPhoto = pure(ImageAddAPhoto);
ImageAddAPhoto.displayName = 'ImageAddAPhoto';
ImageAddAPhoto.muiName = 'SvgIcon';
export default ImageAddAPhoto;
|
src/js/components/icons/base/Restaurant.js | odedre/grommet-final | /**
* @description Restaurant SVG Icon.
* @property {string} a11yTitle - Accessibility Title. If not set uses the default title of the status icon.
* @property {string} colorIndex - The color identifier to use for the stroke color.
* If not specified, this component will default to muiTheme.palette.textColor.
* @property {xsmall|small|medium|large|xlarge|huge} size - The icon size. Defaults to small.
* @property {boolean} responsive - Allows you to redefine what the coordinates.
* @example
* <svg width="24" height="24" ><path d="M19,18 L5,18 L19,18 Z M12,18 L12,12 L12,18 Z M15,18 L15,14 L15,18 Z M9,18 L9,14 L9,18 Z M19,22 L19,11.3292943 C20.1651924,10.9174579 21,9.80621883 21,8.5 C21,6.84314575 19.6568542,5.5 18,5.5 C17.6192862,5.5 17.2551359,5.57091725 16.9200387,5.7002623 C16.5495238,3.87433936 14.4600194,2 12,2 C9.53998063,2 7.45047616,3.87433936 7.07996126,5.7002623 C6.74486408,5.57091725 6.38071384,5.5 6,5.5 C4.34314575,5.5 3,6.84314575 3,8.5 C3,9.80621883 3.83480763,10.9174579 5,11.3292943 L5,22 L19,22 Z"/></svg>
*/
// (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import CSSClassnames from '../../../utils/CSSClassnames';
import Intl from '../../../utils/Intl';
import Props from '../../../utils/Props';
const CLASS_ROOT = CSSClassnames.CONTROL_ICON;
const COLOR_INDEX = CSSClassnames.COLOR_INDEX;
export default class Icon extends Component {
render () {
const { className, colorIndex } = this.props;
let { a11yTitle, size, responsive } = this.props;
let { intl } = this.context;
const classes = classnames(
CLASS_ROOT,
`${CLASS_ROOT}-restaurant`,
className,
{
[`${CLASS_ROOT}--${size}`]: size,
[`${CLASS_ROOT}--responsive`]: responsive,
[`${COLOR_INDEX}-${colorIndex}`]: colorIndex
}
);
a11yTitle = a11yTitle || Intl.getMessage(intl, 'restaurant');
const restProps = Props.omit(this.props, Object.keys(Icon.propTypes));
return <svg {...restProps} version="1.1" viewBox="0 0 24 24" width="24px" height="24px" role="img" className={classes} aria-label={a11yTitle}><path fill="none" stroke="#000" strokeWidth="2" d="M19,18 L5,18 L19,18 Z M12,18 L12,12 L12,18 Z M15,18 L15,14 L15,18 Z M9,18 L9,14 L9,18 Z M19,22 L19,11.3292943 C20.1651924,10.9174579 21,9.80621883 21,8.5 C21,6.84314575 19.6568542,5.5 18,5.5 C17.6192862,5.5 17.2551359,5.57091725 16.9200387,5.7002623 C16.5495238,3.87433936 14.4600194,2 12,2 C9.53998063,2 7.45047616,3.87433936 7.07996126,5.7002623 C6.74486408,5.57091725 6.38071384,5.5 6,5.5 C4.34314575,5.5 3,6.84314575 3,8.5 C3,9.80621883 3.83480763,10.9174579 5,11.3292943 L5,22 L19,22 Z"/></svg>;
}
};
Icon.contextTypes = {
intl: PropTypes.object
};
Icon.defaultProps = {
responsive: true
};
Icon.displayName = 'Restaurant';
Icon.icon = true;
Icon.propTypes = {
a11yTitle: PropTypes.string,
colorIndex: PropTypes.string,
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'huge']),
responsive: PropTypes.bool
};
|
src/Parser/Core/Modules/CastEfficiency.js | enragednuke/WoWAnalyzer | import React from 'react';
import SpellLink from 'common/SpellLink';
import Wrapper from 'common/Wrapper';
import { formatPercentage } from 'common/format';
import Analyzer from 'Parser/Core/Analyzer';
import SpellHistory from 'Parser/Core/Modules/SpellHistory';
import Tab from 'Main/Tab';
import CastEfficiencyComponent from 'Main/CastEfficiency';
import SpellTimeline from 'Main/Timeline/SpellTimeline';
import Abilities from './Abilities';
import AbilityTracker from './AbilityTracker';
import Combatants from './Combatants';
import Haste from './Haste';
const DEFAULT_RECOMMENDED = 0.80;
const DEFAULT_AVERAGE_DOWNSTEP = 0.05;
const DEFAULT_MAJOR_DOWNSTEP = 0.15;
class CastEfficiency extends Analyzer {
static dependencies = {
abilityTracker: AbilityTracker,
combatants: Combatants,
haste: Haste,
spellHistory: SpellHistory,
abilities: Abilities,
};
/*
* Gets info about spell's cooldown behavior. All values are as of the current timestamp.
* completedRechargeTime is the total ms of completed cooldowns
* endingRechargeTime is the total ms into current cooldown
* recharges is the total number of times the spell has recharged (either come off cooldown or gained a charge)
* Only works on spells entered into CastEfficiency list.
*/
_getCooldownInfo(ability) {
const mainSpellId = (ability.spell instanceof Array) ? ability.spell[0].id : ability.spell.id;
const history = this.spellHistory.historyBySpellId[mainSpellId];
if (!history) { // spell either never been cast, or not in abilities list
return {
completedRechargeTime: 0,
endingRechargeTime: 0,
recharges: 0,
casts: 0,
};
}
let lastRechargeTimestamp = null;
let recharges = 0;
const completedRechargeTime = history
.filter(event => event.type === 'updatespellusable')
.reduce((acc, event) => {
if (event.trigger === 'begincooldown') {
lastRechargeTimestamp = event.timestamp;
return acc;
} else if (event.trigger === 'endcooldown') {
const rechargingTime = (event.timestamp - lastRechargeTimestamp) || 0;
recharges += 1;
lastRechargeTimestamp = null;
return acc + rechargingTime;
// This might cause oddness if we add anything that externally refreshes charges, but so far nothing does
} else if (event.trigger === 'restorecharge') {
const rechargingTime = (event.timestamp - lastRechargeTimestamp) || 0;
recharges += 1;
lastRechargeTimestamp = event.timestamp;
return acc + rechargingTime;
} else {
return acc;
}
}, 0);
const endingRechargeTime = (!lastRechargeTimestamp) ? 0 : this.owner.currentTimestamp - lastRechargeTimestamp;
const casts = history.filter(event => event.type === 'cast').length;
return {
completedRechargeTime,
endingRechargeTime,
recharges,
casts,
};
}
/*
* Packs cast efficiency results for use by suggestions / tab
*/
getCastEfficiency() {
return this.abilities.activeAbilities
.map(ability => this.getCastEfficiencyForAbility(ability))
.filter(item => item !== null); // getCastEfficiencyForAbility can return null, remove those from the result
}
getCastEfficiencyForSpellId(spellId) {
const ability = this.abilities.getAbility(spellId);
return ability ? this.getCastEfficiencyForAbility(ability) : null;
}
getCastEfficiencyForAbility(ability) {
const spellId = ability.spell.id;
const fightDurationMs = this.owner.fightDuration;
const fightDurationMinutes = fightDurationMs / 1000 / 60;
const cooldown = ability.cooldown;
const cooldownMs = !cooldown ? null : cooldown * 1000;
const cdInfo = this._getCooldownInfo(ability);
// ability.casts is used for special cases that show the wrong number of cast events, like Penance
// and also for splitting up differently buffed versions of the same spell (this use has nothing to do with CastEfficiency)
let casts;
if (ability.castEfficiency.casts) {
casts = ability.castEfficiency.casts(this.abilityTracker.getAbility(spellId), this.owner);
} else {
casts = cdInfo.casts;
}
const cpm = casts / fightDurationMinutes;
if (ability.isUndetectable && casts === 0) {
// Some spells (most notably Racials) can not be detected if a player has them. This hides those spells if they have 0 casts.
return null;
}
// ability.maxCasts is used for special cases for spells that have a variable availability or CD based on state, like Void Bolt.
// This same behavior should be managable using SpellUsable's interface, so maxCasts is deprecated.
// Legacy support: if maxCasts is defined, cast efficiency will be calculated using casts/rawMaxCasts
let rawMaxCasts;
const averageCooldown = (cdInfo.recharges === 0) ? null : (cdInfo.completedRechargeTime / cdInfo.recharges);
if (ability.castEfficiency.maxCasts) {
// maxCasts expects cooldown in seconds
rawMaxCasts = ability.castEfficiency.maxCasts(cooldown, this.owner.fightDuration, this.abilityTracker.getAbility, this.owner);
} else if (averageCooldown) { // no average CD if spell hasn't been cast
rawMaxCasts = (this.owner.fightDuration / averageCooldown) + (ability.charges || 1) - 1;
} else {
rawMaxCasts = (this.owner.fightDuration / cooldownMs) + (ability.charges || 1) - 1;
}
const maxCasts = Math.ceil(rawMaxCasts) || 0;
const maxCpm = (cooldown === null) ? null : maxCasts / fightDurationMinutes;
let efficiency;
if (ability.castEfficiency.maxCasts) { // legacy support for custom maxCasts
efficiency = Math.min(1, casts / rawMaxCasts);
} else {
// Cast efficiency calculated as the percent of fight time spell was on cooldown
if (cooldown && this.owner.fightDuration) {
const timeOnCd = cdInfo.completedRechargeTime + cdInfo.endingRechargeTime;
efficiency = timeOnCd / this.owner.fightDuration;
} else {
efficiency = null;
}
}
const recommendedEfficiency = ability.castEfficiency.recommendedEfficiency || DEFAULT_RECOMMENDED;
const averageIssueEfficiency = ability.castEfficiency.averageIssueEfficiency || (recommendedEfficiency - DEFAULT_AVERAGE_DOWNSTEP);
const majorIssueEfficiency = ability.castEfficiency.majorIssueEfficiency || (recommendedEfficiency - DEFAULT_MAJOR_DOWNSTEP);
const gotMaxCasts = (casts === maxCasts);
const canBeImproved = efficiency !== null && efficiency < recommendedEfficiency && !gotMaxCasts;
return {
ability,
cpm,
maxCpm,
casts,
maxCasts,
efficiency,
recommendedEfficiency,
averageIssueEfficiency,
majorIssueEfficiency,
gotMaxCasts,
canBeImproved,
};
}
suggestions(when) {
const castEfficiencyInfo = this.getCastEfficiency();
castEfficiencyInfo.forEach(abilityInfo => {
if (!abilityInfo.ability.castEfficiency.suggestion || abilityInfo.efficiency === null || abilityInfo.gotMaxCasts) {
return;
}
const ability = abilityInfo.ability;
const mainSpell = (ability.spell instanceof Array) ? ability.spell[0] : ability.spell;
const suggestionThresholds = {
actual: abilityInfo.efficiency,
isLessThan: {
minor: abilityInfo.recommendedEfficiency,
average: abilityInfo.averageIssueEfficiency,
major: abilityInfo.majorIssueEfficiency,
},
};
when(suggestionThresholds).addSuggestion((suggest, actual, recommended) => {
return suggest(
<Wrapper>
Try to cast <SpellLink id={mainSpell.id} /> more often. {ability.castEfficiency.extraSuggestion || ''} <a href="#spell-timeline">View timeline</a>.
</Wrapper>
)
.icon(mainSpell.icon)
.actual(`${abilityInfo.casts} out of ${abilityInfo.maxCasts} possible casts. You kept it on cooldown ${formatPercentage(actual, 1)}% of the time.`)
.recommended(`>${formatPercentage(recommended, 1)}% is recommended`)
.details(() => (
<div style={{ margin: '0 -22px' }}>
<SpellTimeline
historyBySpellId={this.spellHistory.historyBySpellId}
abilities={this.abilities}
spellId={mainSpell.id}
start={this.owner.fight.start_time}
end={this.owner.currentTimestamp}
/>
</div>
))
.staticImportance(ability.castEfficiency.importance);
});
});
}
tab() {
return {
title: 'Cast efficiency',
url: 'cast-efficiency',
render: () => (
<Tab title="Cast efficiency">
<CastEfficiencyComponent
categories={this.abilities.constructor.SPELL_CATEGORIES}
abilities={this.getCastEfficiency()}
/>
</Tab>
),
};
}
}
export default CastEfficiency;
|
src/components/ProjectList.js | shunito/daisyconv | // jshint esversion:6
import React, { Component } from 'react';
import ReactDOM, { render } from 'react-dom';
export default class ProjectList extends Component {
_onClickOpenButton() {
var options = {
title: 'Open DAISY File',
filters: [
{name: 'DAISY', extensions: ['zip', 'daisy' ]}
],
properties: ['openFile']
};
dialog.showOpenDialog(options,function(files){
if( files ){
ipcRenderer.send("file-open", {
files: files
});
}
});
}
_onSelectProject( e ){
const id = e.currentTarget.getAttribute('data-projId');
ipcRenderer.send("dispatch-store", {
type: 'VIEW_DAISY_STATUS',
value: id
});
}
render() {
var projects = this.props.projects;
var i,l, project;
var list = projects.map((project, index) =>
<tr key={index} onClick={ this._onSelectProject } data-projId={project.id}>
<td>{project.name}</td>
<td>{project.id}</td>
<td>{project.include}</td>
</tr>
);
return (<div>
<h2 className={"title-main"}>Projects</h2>
<div className={"page-btn-group"}>
<button className={"btn btn-default"} onClick={this._onClickOpenButton}>
<span className={"icon icon-folder icon-text"}></span> Open New DAISY
</button>
</div>
<div className={"section"}>
<table className={"table-striped table selectable"}>
<thead>
<tr><th>Title</th><th>ID</th><th>Include Date</th></tr>
</thead>
<tbody>{list}</tbody>
</table>
</div>
</div>);
}
}
|
src/routes.js | sivael/simpleBlogThingie | import React from 'react'
import { render } from 'react-dom'
import { Router, Route, browserHistory, IndexRoute } from 'react-router'
import App from 'components/App'
import Blog from 'containers/blog/Blog'
import About from 'components/About'
import Contact from 'components/Contact'
import PostView from 'components/blog/routes/PostView'
import PostAdd from 'containers/blog/PostNew'
import PostEdit from 'components/blog/routes/PostEdit'
import PostRemove from 'components/blog/routes/PostRemove'
export default (
<Route path="/" component={App}>
<IndexRoute component={Blog} />
<Route path="post">
<Route path="view/:id" component={PostView} />
<Route path="add" component={PostAdd} />
<Route path="edit/:id" component={PostEdit} />
<Route path="remove/:id" component={PostRemove} />
</Route>
<Route path="about" component={About} />
<Route path="contact" component={Contact} />
</Route>
)
|
docs/Footer.js | jxnblk/cxs | import React from 'react'
import Flex from './Flex'
import Box from './Box'
import Logo from './Logo'
import Link from './Link'
import Stats from './Stats'
const Footer = () => (
<footer>
<Flex
align='center'
wrap
mt={4}
pt={4}
pb={4}>
<Link
href='https://github.com/jxnblk/cxs'
children='GitHub'
/>
<Link
href='http://jxnblk.com'
children='Made by Jxnblk'
/>
<Box ml='auto' />
<Stats />
</Flex>
<Flex p={4} mt={5} mb={5} align='center' justify='center'>
<Logo
size={32}
strokeWidth={1}
/>
</Flex>
</footer>
)
export default Footer
|
src/app/components/feedItem.js | benigeri/soapee-ui | import moment from 'moment';
import React from 'react';
import { Link } from 'react-router';
import MarkedDisplay from 'components/markedDisplay';
import ImageableThumbnails from 'components/imageableThumbnails';
import UserAvatar from 'components/userAvatar';
export default React.createClass( {
render() {
let { feedItem } = this.props;
let { user } = feedItem.feedable_meta;
return (
<div className="feed-item media">
<div className="media-left">
<UserAvatar
user={ user }
/>
</div>
<div className="media-body">
<div className="about">
<span className="user">
<Link to="userProfile" params={ { id: user.id } }>{ user.name }</Link>
</span>
{ this.renderActionDescription() }
<span className="time"
title={ moment( feedItem.created_at ).format( 'LLLL' ) }
>
{ moment( feedItem.created_at ).fromNow() }
</span>
</div>
{ this.renderFeedableType() }
</div>
</div>
);
},
renderActionDescription() {
let { feedable_meta } = this.props.feedItem;
let action = {
status_updates: statusUpdate,
comments: comment,
recipes: recipes,
recipe_journals: recipeJournals,
users: () => <span> joined</span>
}[ this.props.feedItem.feedable_type ];
return action();
function statusUpdate() {
return (
<span> posted a <Link to="status-update" params={ { id: feedable_meta.target.id } }><strong>status update</strong></Link></span>
);
}
function comment() {
return (
<span> commented on
<Link to={feedable_meta.target.targetType} params={ { id: feedable_meta.target.id } }>
<strong>{feedable_meta.target.name}</strong>
</Link>
</span>
);
}
function recipes() {
return (
<span> {feedable_meta.target.actionType}
<Link to="recipe" params={ { id: feedable_meta.target.id } }>
<strong>{feedable_meta.target.name}</strong>
</Link>
</span>
);
}
function recipeJournals() {
return (
<span> added a <strong>Recipe Journal</strong> to
<Link to="recipe" params={ { id: feedable_meta.target.id } }>
<strong>{feedable_meta.target.name}</strong>
</Link>
</span>
);
}
},
renderFeedableType() {
let { feedable_meta } = this.props.feedItem;
let renderer = {
status_updates: renderStatusUpdate.bind( this ),
comments: renderCommentUpdate.bind( this ),
recipes: renderRecipe.bind( this ),
recipe_journals: renderRecipeJournals.bind( this ),
users: () => {}
}[ this.props.feedItem.feedable_type ];
return renderer();
function renderStatusUpdate() {
return (
<div className="status-update">
<MarkedDisplay
content={ feedable_meta.target.update }
/>
<ImageableThumbnails
images={ this.props.feedItem.feedable.images }
/>
</div>
);
}
function renderCommentUpdate() {
return (
<div className="status-comment">
<MarkedDisplay
content={ feedable_meta.target.comment || '' }
/>
</div>
);
}
function renderRecipe() {
return (
<div className="status-recipe">
<ImageableThumbnails
images={ this.props.feedItem.feedable.images }
/>
</div>
);
}
function renderRecipeJournals() {
return (
<div className="status-recipe-journals">
<MarkedDisplay
content={ feedable_meta.target.journal }
/>
<ImageableThumbnails
images={ this.props.feedItem.feedable.images }
/>
</div>
);
}
}
} ); |
lib/Components/App.js | Kalikoze/weatherly | import React from 'react';
import { Welcome } from './Welcome';
import Search from './Search';
import { CurrentWeather } from './CurrentWeather';
import { SevenHours } from './SevenHours';
import { TenDays } from './TenDays';
import Key from '../utils/Key.js';
import '../../styles.css';
export default class App extends React.Component {
constructor() {
super();
this.state = {
weatherData: null,
place: null,
message: 'Enter a city or ZIP code to check the forecast',
};
}
getCityWeatherData(newPlace) {
fetch(
`http://api.wunderground.com/api/${Key}/conditions/forecast/forecast10day/geolookup/hourly/q/${newPlace}.json`
)
.then(response => {
response
.json()
.then(data => {
if (data.response.error) {
localStorage.clear();
return this.setState({ message: 'Please enter a valid city and state' });
}
this.storeCity(newPlace);
return this.setState({
weatherData: data,
place: newPlace,
message: '',
});
})
.catch(error => {
this.setState({ message: 'The server is down, please try again later' });
});
})
.catch(error => {
this.setState({ message: 'The server is down, please try again later' });
});
}
componentWillMount() {
const city = localStorage.getItem('city');
if (city) {
this.getCityWeatherData(city);
}
}
storeCity(place) {
localStorage.setItem('city', place);
}
render() {
const { weatherData, place, message } = this.state;
if (!weatherData) {
return (
<div className="welcome-page">
<Welcome
header="Welcome!"
searchDiv="welcome-search-div"
class="welcome-search"
onClick={this.getCityWeatherData.bind(this)}
message={message}
div="welcome-div"
/>
</div>
);
} else {
// const weatherImage = weatherData.current_observation.icon;
// const background = document.getElementById('app')
// background.style.backgroundImage = `url(./lib/Assets/weather-condition-backgrounds/${weatherImage}.jpg)`;
return (
<div>
<Welcome
header=""
searchDiv="main-page-search"
class="search-general"
onClick={this.getCityWeatherData.bind(this)}
message={message}
/>
<CurrentWeather weatherData={weatherData} />
<SevenHours weatherData={weatherData} />
<TenDays weatherData={weatherData} />
</div>
);
}
}
}
|
src/native/todos/Header.js | VigneshRavichandran02/3io | /* @flow */
import type { State } from '../../common/types';
import R from 'ramda';
import React from 'react';
import theme from '../app/themes/initial';
import { FormattedMessage } from '../app/components';
import { StyleSheet, View } from 'react-native';
import { connect } from 'react-redux';
import { defineMessages } from 'react-intl';
const messages = defineMessages({
leftTodos: {
defaultMessage: `{leftTodos, plural,
=0 {Nothing, enjoy :-)}
one {You have {leftTodos} task}
other {You have {leftTodos} tasks}
}`,
id: 'todos.leftTodos',
},
});
const styles = StyleSheet.create({
header: {
alignItems: 'center',
backgroundColor: theme.brandPrimary,
justifyContent: 'center',
paddingTop: theme.fontSize,
paddingBottom: theme.fontSize * 0.5,
},
text: {
color: theme.inverseTextColor,
fontSize: theme.fontSizeH5,
},
});
const Header = ({ todos }) => {
const leftTodos = R.values(todos).filter(todo => !todo.completed).length;
return (
<View style={styles.header}>
<FormattedMessage
{...messages.leftTodos}
style={styles.text}
values={{ leftTodos }}
/>
</View>
);
};
Header.propTypes = {
todos: React.PropTypes.object.isRequired,
};
export default connect(
(state: State) => ({
todos: state.todos.all,
}),
)(Header);
|
public/client/routes/publicClientConf/containers/publicClientConf.js | Concorda/concorda-dashboard | 'use strict'
import React from 'react'
import {connect} from 'react-redux'
import {reduxForm} from 'redux-form'
import RadioGroup from 'react-radio-group'
import CheckboxGroup from 'react-checkbox-group'
import {validateInitConfig, saveInitConfig} from '../../../modules/client/actions/index'
import {validateEditClient} from '../../../lib/validations'
export let PublicClientConf = React.createClass({
propTypes: {
handleSubmit: React.PropTypes.func.isRequired
},
getInitialState () {
return {
registerType: 'closed',
authType: []
}
},
componentDidMount () {
this.props.dispatch(validateInitConfig())
},
componentWillReceiveProps: function (nextProps) {
if (nextProps.configuration) {
this.setState({
registerType: nextProps.configuration.registerType || 'closed',
authType: nextProps.configuration.authType || []
})
}
},
updateClient (data) {
const dispatch = this.props.dispatch
data.registerType = this.state.registerType
data.authType = this.state.authType
data.configured = true
const redirectTo = '/login'
dispatch(saveInitConfig(data, redirectTo))
},
handleRegisterTypeChange (value) {
this.setState({registerType: value})
},
handleAuthTypeChange () {
let selectedValues = this.refs.authType.getCheckedValues()
this.setState({authType: selectedValues})
},
render () {
const { fields: {emailTemplateFolder, registerType, authType}, handleSubmit } = this.props
return (
<div className="page container-fluid">
<div className="row middle-xs page-heading">
<h2 className="col-xs-12 col-sm-6">Initialize Client Configuration</h2>
</div>
<form className="login-form col-xs-12 txt-left form-full-width form-panel"
onSubmit={handleSubmit(this.updateClient)}>
<div className="row">
<div className="col-xs-12 col-sm-6">
<label>Email templates folder</label>
<input {...emailTemplateFolder} placeholder="Email template folder" className="input-large"/>
</div>
</div>
<div className="row">
<div className="col-xs-12 col-sm-8">
<div className="row">
<div className="col-xs-2 col-sm-2">
Register Type:
</div>
<div className="col-xs-10 col-sm-6">
<RadioGroup name="registerType" selectedValue={this.state.registerType}
onChange={this.handleRegisterTypeChange}>
{Radio => (
<div className="row generic-inputs-list">
<Radio value="public"/>Public
<Radio value="closed"/>Closed
</div>
)}
</RadioGroup>
</div>
</div>
{registerType.error && registerType.touched && <div className="form-err">{registerType.error}</div>}
</div>
</div>
<div className="row">
<div className="col-xs-12 col-sm-8">
<div className="row">
<div className="col-xs-2 col-sm-2">
Authentication Type:
</div>
<div className="col-xs-10 col-sm-6">
<CheckboxGroup name="authType" value={this.state.authType} ref="authType"
onChange={this.handleAuthTypeChange}>
<div className="row generic-inputs-list">
<label>
<input type="checkbox" value="github"/>GitHub
</label>
<label>
<input type="checkbox" value="twitter"/>Twitter
</label>
<label>
<input type="checkbox" value="google"/>Google
</label>
</div>
</CheckboxGroup>
</div>
{authType.error && authType.touched && <div className="form-err">{authType.error}</div>}
</div>
</div>
</div>
<div className="row">
<div className="col-lg-2 col-md-4 col-sm-6 col-xs-12">
<button type="submit" className="btn btn-large submit">Submit</button>
</div>
</div>
</form>
</div>
)
}
})
PublicClientConf = reduxForm(
{
form: 'initClientConf',
fields: ['emailTemplateFolder', 'registerType', 'authType'],
validate: validateEditClient
},
state => ({
initialValues: state.client.configuration ? state.client.configuration : null
}))(PublicClientConf)
export default connect((state) => {
return {
configuration: state.client.configuration ? state.client.configuration : null
}
})(PublicClientConf)
|
demos/forms-demo/src/index.js | FWeinb/cerebral | import React from 'react'
import {render} from 'react-dom'
import {Controller} from 'cerebral'
import {Container} from 'cerebral/react'
import Devtools from 'cerebral/devtools'
import Router from 'cerebral-router'
import app from './modules/app'
import simple from './modules/simple'
import checkout from './modules/checkout'
import App from './components/App'
const controller = Controller({
options: {
strictRender: true
},
router: Router({
routes: {
'/': 'app.routed',
'/simple': 'simple.routed',
'/checkout': 'checkout.routed'
},
onlyHash: true
}),
devtools: Devtools(),
modules: {
app,
simple,
checkout
}
})
render((
<Container controller={controller} >
<App />
</Container>
), document.querySelector('#root'))
|
src/list/components/ListHeader.js | nheyn/react-stack-skeleton | /* @flow */
import React from 'react';
type Props = {
newItemValue: string,
onChangeNewItem: (e: SyntheticInputEvent) => void,
onCreateNewItem: (e: SyntheticInputEvent) => void,
};
const ENTER_KEY = 13;
/**
* The footer for the todo list.
*/
export default function ListHeader(props: Props): React.Element<*> {
const { newItemValue, onChangeNewItem, onCreateNewItem, ...otherProps } = props;
return (
<header className="header" {...otherProps}>
<h1>todos</h1>
<input
className="new-todo"
placeholder="What needs to be done?"
value={newItemValue}
onChange={onChangeNewItem}
onKeyDown={(e) => e.keyCode === ENTER_KEY? onCreateNewItem(e): undefined}
autoFocus
/>
</header>
);
}
|
blueocean-material-icons/src/js/components/svg-icons/action/home.js | kzantow/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const ActionHome = (props) => (
<SvgIcon {...props}>
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
</SvgIcon>
);
ActionHome.displayName = 'ActionHome';
ActionHome.muiName = 'SvgIcon';
export default ActionHome;
|
app/components/DetailActionDropdown.js | Fresh-maker/razor-client | // @flow
import React, { Component } from 'react';
class DetailActionDropdown extends Component {
handleDropdownChange = (actionType)=> {
switch(actionType) {
case 'print':
console.log('window.print',window.print);
return window.print();
}
alert(''+actionType);
}
render() {
const { currentSearch, updateSearch } = this.props;
const paperId = this.props.params.id;
return (
<div className="row">
<select onChange={(e)=>this.handleDropdownChange(e.target.value)}>
<option value="">Actions</option>
<option value="copy">Copy to Clipboard</option>
<option value="export">Export</option>
<option value="email">E-mail</option>
<option value="print">Print</option>
</select>
</div>
);
}
}
export default DetailActionDropdown;
|
src/svg-icons/image/camera-rear.js | igorbt/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageCameraRear = (props) => (
<SvgIcon {...props}>
<path d="M10 20H5v2h5v2l3-3-3-3v2zm4 0v2h5v-2h-5zm3-20H7C5.9 0 5 .9 5 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm-5 6c-1.11 0-2-.9-2-2s.89-2 1.99-2 2 .9 2 2C14 5.1 13.1 6 12 6z"/>
</SvgIcon>
);
ImageCameraRear = pure(ImageCameraRear);
ImageCameraRear.displayName = 'ImageCameraRear';
ImageCameraRear.muiName = 'SvgIcon';
export default ImageCameraRear;
|
src/components/Profiles/UpdateProfile.js | RahulDesai92/PHR | import React, { Component } from 'react';
import { Text,
View,
StyleSheet,
ActivityIndicator,
Image,
KeyboardAvoidingView ,
TouchableOpacity,
ScrollView
} from 'react-native';
import { NavigationActions } from 'react-navigation';
import customstyles from '../../../assets/styles/customstyles';
import customtext from '../../utils/customtext';
import colors from '../../utils/colors';
import { TextField } from 'react-native-material-textfield';
import Toast from 'react-native-simple-toast';
//import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import { RaisedTextButton } from 'react-native-material-buttons';
import { Dropdown } from 'react-native-material-dropdown';
import environment from '../../utils/environment';
const {
loginscreenLogoContainer,
loginscreenLogo,
loginTitle ,
container1
} = customstyles;
const { loginscreenregisterInput,
loginscreenregisterContainer,
loginscreenCreateAccountWrapper,
loginscreenCreateAccountText,
loginscreenCreateAccountLinkText,
loginscreenLoginContainer
} = customstyles;
const { white,
turquoise,
black,
electricBlue
} = colors;
const { base_url } = environment;
export default class UpdateProfile extends Component {
constructor() {
super();
this.onFocus = this.onFocus.bind(this);
this.onChangeText = this.onChangeText.bind(this);
this.onSubmitBlood = this.onSubmitBlood.bind(this);
this.onSubmitHeight = this.onSubmitHeight.bind(this);
this.onSubmitWeight = this.onSubmitWeight.bind(this);
this.onSubmitBloodPressure = this.onSubmitBloodPressure.bind(this);
this.onSubmitPulseRate = this.onSubmitPulseRate.bind(this);
this.onSubmitTempture = this.onSubmitTempture.bind(this);
this.onSubmitRemarks = this.onSubmitRemarks.bind(this);
this.onBlur = this.onBlur.bind(this);
this.onAccessoryPress = this.onAccessoryPress.bind(this);
this.onSubmitUpdate = this.onSubmitUpdate.bind(this);
this.diseasetypeRef = this.updateRef.bind(this, 'diseasetype');
this.bloodRef = this.updateRef.bind(this, 'blood');
this.heightRef = this.updateRef.bind(this,'height');
this.weightRef = this.updateRef.bind(this, 'weight');
this.bloodpressureRef = this.updateRef.bind(this, 'bloodpressure');
this.pulserateRef = this.updateRef.bind(this, 'pulserate');
this.temptureRef = this.updateRef.bind(this, 'tempture');
this.remarksRef = this.updateRef.bind(this, 'remarks');
// this.registerObj = this.updateRef.bond(this,'registerObj');
this.renderPasswordAccessory = this.renderPasswordAccessory.bind(this);
this.state = {
blood: '',
height: '',
weight: '',
bloodpressure: '',
pulserate:'',
tempture:'',
diseasetype:'',
remarks:'',
code: 'A700',
secureTextEntry: true,
};
}
onAccessoryPress() {
this.setState(({ secureTextEntry }) => ({ secureTextEntry: !secureTextEntry }));
}
onSubmitBlood(){
this.blood.focus();
}
onSubmitHeight(){
this.height.focus();
}
onSubmitWeight(){
this.weight.focus();
}
onSubmitBloodPressure() {
this.bloodpressure.focus();
}
onSubmitPulseRate() {
this.pulserate.focus();
}
onSubmitTempture(){
this.tempture.focus();
}
onSubmitRemarks(){
this.remarks.focus();
}
onBlur() {
let errors = {};
['blood', 'height','weight', 'bloodpressure','pulserate','tempture','remarks']
.forEach((name) => {
console.log("Name: " + name);
let value = this[name].value();
console.log("Value: " + value);
if (!value) {
errors[name] = 'Should not be empty';
}
else{
if (name === 'blood' && value.length > 2) {
errors[name] = 'Invalid blood group';
}
if (name === 'height' && value.length < 2.0) {
errors[name] = 'please enter a valid height';
}
if (name === 'weight' && value.length < 2) {
errors[name] = 'please enter validnumber';
}
if (name === 'bloodpressure' && value.length < 2) {
errors[name] = 'please enter a valid bloodpressure';
}
if (name === 'pulserate' && value.length < 2) {
errors[name] = 'please enter a valid pulserate';
}
if (name === 'tempture' && value.length < 2) {
errors[name] = 'please enter a valid tempture';
}
if (name === 'diseasetype') {
errors[name] = 'diseasetype must be selected';
}
}
});
this.setState({ errors });
}
isEmptyObject(object) {
return (Object.getOwnPropertyNames(object).length === 0);
}
onFocus() {
let { errors = {} } = this.state;
for (let name in errors) {
let ref = this[name];
if (ref && ref.isFocused()) {
delete errors[name];
}
}
this.setState({ errors });
}
onChangeText(text) {
['blood', 'height','weight', 'bloodpressure','pulserate','tempture','diseasetype','remarks']
.map((name) => ({ name, ref: this[name] }))
.forEach(({ name, ref }) => {
if (ref.isFocused()) {
this.setState({ [name]: text });
}
});
}
onSubmitUpdate(token) {
let errors = {};
this.setState({ errors });
return fetch(base_url + '/updateProfile', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'x-access-token': token
},
body: JSON.stringify({
growableObj : {
Blood: this.state.blood,
Height: this.state.height,
Weight: this.state.weight,
BloodPressure: this.state.bloodpressure,
PulseRate: this.state.pulserate,
BodyTempture: this.state.bodytempture,
DiseaseType: this.state.diseasetype,
Remarks: this.state.remarks
}
})
})
.then((response) => response.json())
.then((responseJson) => {
var message = responseJson.message;
console.log("message"+responseJson.message);
console.log('token'+token);
if (message === 'Internal Server Error !' || message === 'invalid token' || message === 'invalid request') {
Toast.show(message);
} else {
Toast.show(message);
console.log("HomePage");
this.props.navigation.navigate('HomePage',{token,token});
}
})
.catch((error) => {
console.error(error);
});
}
updateRef(name, ref) {
this[name] = ref;
}
renderPasswordAccessory() {
let { secureTextEntry } = this.state;
let name = secureTextEntry?
'visibility':
'visibility-off';
/* return (
<MaterialIcon
size={24}
name={name}
color={TextField.defaultProps.baseColor}
onPress={this.onAccessoryPress}
suppressHighlighting
/>
);*/
}
static navigationOptions = {
header: null,
}
render() {
var {params} = this.props.navigation.state;
var token = params.token
console.log('token' + token);
let { errors = {}, secureTextEntry, ...data } = this.state;
let { blood = 'blood' } = data;
let { height = 'height' } = data;
let { weight = 'weight' } = data;
let { bloodpressure = 'bloodpressure' } = data;
let { pulserate = 'pulserate' } = data;
let { bodytempture = 'bodytempture' } = data;
let { diseasetype = 'diseasetype' } = data;
let { remarks = 'remarks' } = data;
return (
<KeyboardAvoidingView behavior="padding" style={loginscreenregisterContainer}>
<ScrollView>
<View style={loginscreenregisterInput}>
<TextField
ref={this.bloodRef}
value={data.blood}
keyboardType='default'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitBlood}
returnKeyType='next'
label="Enter Blood Group"
error={errors.blood}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<TextField
ref={this.heightRef}
value={data.height}
keyboardType='phone-pad'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitHeight}
returnKeyType='next'
label="Enter Height(in inches)"
error={errors.height}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<TextField
ref={this.weightRef}
value={data.weight}
keyboardType='phone-pad'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitWeight}
returnKeyType='next'
label="Enter Weight(in Kgs)"
error={errors.weight}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<TextField
ref={this.bloodpressureRef}
value={data.bloodpressure}
keyboardType='phone-pad'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitBloodPressure}
returnKeyType='next'
label="Blood Pressuer (millimeters of mercury)"
error={errors.bloodpressure}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<TextField
ref={this.pulserateRef}
value={data.pulserate}
keyboardType='phone-pad'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitPulseRate}
returnKeyType='next'
label="Enter Pulse Rate(in BPM)"
error={errors.pulserate}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<TextField
ref={this.temptureRef}
value={data.tempture}
keyboardType='phone-pad'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitTempture}
returnKeyType='next'
label="Body Tempture (in Fahrenheit)"
error={errors.tempture}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<Dropdown
ref={this.diseasetypeRef}
value={data.diseasetype}
data={diseaseType}
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
returnKeyType='next'
label="Are you Suffering from any Disease?"
tintColor={white}
textColor={black}
style={container1}
onBlur={this.onBlur}
/>
<TextField
ref={this.remarksRef}
value={data.remarks}
keyboardType='default'
autoCapitalize='none'
autoCorrect={false}
enablesReturnKeyAutomatically={true}
onFocus={this.onFocus}
onChangeText={this.onChangeText}
onSubmitEditing={this.onSubmitRemarks}
returnKeyType='next'
label="Remarks"
error={errors.remarks}
tintColor={black}
textColor={black}
onBlur={this.onBlur}
/>
<View style={loginscreenLoginContainer}>
<RaisedTextButton
onPress={()=>this.onSubmitUpdate(token)}
title="Update"
color={electricBlue}
titleColor={white}
/>
</View>
</View>
</ScrollView>
</KeyboardAvoidingView>
);
}
}
const diseaseType = [
{ value: 'Yes' },
{ value: 'No' },
]; |
src/entry.js | thojan02/my-first-jsp-app | /**
* src/entry.js
*/
console.log('We are live!');
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app';
import App2 from './components/app2';
ReactDOM.render(React.createElement(App2), document.getElementById('root')); |
web/src/pages/index.js | ajmalafif/ajmalafif.com | import React from 'react'
import { Link, graphql } from 'gatsby'
import {
mapEdgesToNodes,
filterOutDocsWithoutSlugs,
filterOutDocsPublishedInTheFuture,
} from '../lib/helpers'
import GraphQLErrorList from '../components/graphql-error-list'
import SEO from '../components/seo'
import Layout from '../containers/layout'
import Img from 'gatsby-image'
import tw, { theme, css } from 'twin.macro'
import Tilt from 'react-parallax-tilt'
export const query = graphql`
query IndexPageQuery {
site: sanitySiteSettings(_id: { regex: "/(drafts.|)siteSettings/" }) {
title
description
keywords
}
file(relativePath: { eq: "ajmal.jpg" }) {
childImageSharp {
fluid(maxWidth: 1024, quality: 100) {
...GatsbyImageSharpFluid
}
}
}
posts: allSanityPost(
limit: 6
sort: { fields: [publishedAt], order: DESC }
filter: { slug: { current: { ne: null } }, publishedAt: { ne: null } }
) {
edges {
node {
id
publishedAt
mainImage {
...ImageWithPreview
caption
alt
}
title
_rawExcerpt
slug {
current
}
}
}
}
}
`
const IndexPage = (props) => {
const { data, errors } = props
if (errors) {
return (
<Layout>
<GraphQLErrorList errors={errors} />
</Layout>
)
}
const site = (data || {}).site
const postNodes = (data || {}).posts
? mapEdgesToNodes(data.posts)
.filter(filterOutDocsWithoutSlugs)
.filter(filterOutDocsPublishedInTheFuture)
: []
if (!site) {
throw new Error(
'Missing "Site settings". Open the studio at http://localhost:3333 and add some content to "Site settings" and restart the development server.'
)
}
return (
<Layout>
<SEO title={site.title} description={site.description} />
<div
tw="grid h-screen"
css={{
gridTemplateColumns: '1fr min(80ch, calc(100% - 48px)) 1fr',
gridRowGap: 8,
'& > *': {
gridColumn: 2,
},
}}
>
<div tw="mt-10 md:mt-0 align-middle md:place-self-center justify-between w-full">
<div tw="flex flex-col-reverse md:flex-row md:items-center">
<div tw="md:w-2/3 font-serif mt-8 md:mt-0 md:pr-8">
<h1 tw="text-3xl lg:text-4xl xl:text-5xl font-semibold lg:font-semibold">
Hi, I’m Ajmal 👋🏼
</h1>
<p tw="mt-2 prose lg:prose-lg xl:prose-xl">
Always gearing myself to be in the flow state & play mode. Currently exploring
living with meaningful productivity.
</p>
<div tw="mt-4 flex flex-col sm:flex-row text-center space-y-4 sm:space-y-0 sm:space-x-4">
<Link to="/projects/">
<div
tw="rounded py-2 px-6 font-medium font-sans"
css={{
backgroundColor: `${theme`colors.accent`}`,
color: `var(--text-cta)`,
boxShadow:
'0 0 0 1px var(--color-primary), 0 1px 1px 1px var(--color-accent)',
'&:hover, &:focus': {
backgroundColor: `${theme`colors.primary`}`,
},
}}
>
View Projects
</div>
</Link>
<Link to="/notes/">
<div
tw="rounded py-2 px-6 font-medium font-sans"
css={{
backgroundColor: 'transparent',
color: `var(--text-stronger)`,
boxShadow: '0 0 0 1px var(--color-border), 0 1px 1px 1px var(--color-border)',
'&:hover, &:focus': {
backgroundColor: 'var(--bg-secondary)',
},
'&:focus': {
backgroundColor: 'var(--bg-secondary)',
borderRadius: 4,
},
}}
>
Read Notes
</div>
</Link>
</div>
</div>
<div tw="md:w-1/3 md:self-stretch">
<Tilt
tiltReverse={true}
tiltMaxAngleX="5.0"
tiltMaxAngleY="5.0"
gyroscope={true}
glareMaxOpacity="0.2"
glareReverse={true}
glareEnable={true}
>
<Img
tw="rounded-md max-w-xs mx-auto md:ml-auto"
fluid={data.file.childImageSharp.fluid}
alt="Ajmal Afif"
/>
</Tilt>
</div>
</div>
</div>
</div>
</Layout>
)
}
export default IndexPage
|
code/web/node_modules/react-router/es6/IndexRoute.js | zyxcambridge/RecordExistence | import React from 'react';
import warning from './routerWarning';
import invariant from 'invariant';
import { createRouteFromReactElement as _createRouteFromReactElement } from './RouteUtils';
import { component, components, falsy } from './InternalPropTypes';
var func = React.PropTypes.func;
/**
* An <IndexRoute> is used to specify its parent's <Route indexRoute> in
* a JSX route config.
*/
var IndexRoute = React.createClass({
displayName: 'IndexRoute',
statics: {
createRouteFromReactElement: function createRouteFromReactElement(element, parentRoute) {
/* istanbul ignore else: sanity check */
if (parentRoute) {
parentRoute.indexRoute = _createRouteFromReactElement(element);
} else {
process.env.NODE_ENV !== 'production' ? warning(false, 'An <IndexRoute> does not make sense at the root of your route config') : void 0;
}
}
},
propTypes: {
path: falsy,
component: component,
components: components,
getComponent: func,
getComponents: func
},
/* istanbul ignore next: sanity check */
render: function render() {
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<IndexRoute> elements are for router configuration only and should not be rendered') : invariant(false) : void 0;
}
});
export default IndexRoute; |
src/svg-icons/maps/local-pharmacy.js | nathanmarks/material-ui | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let MapsLocalPharmacy = (props) => (
<SvgIcon {...props}>
<path d="M21 5h-2.64l1.14-3.14L17.15 1l-1.46 4H3v2l2 6-2 6v2h18v-2l-2-6 2-6V5zm-5 9h-3v3h-2v-3H8v-2h3V9h2v3h3v2z"/>
</SvgIcon>
);
MapsLocalPharmacy = pure(MapsLocalPharmacy);
MapsLocalPharmacy.displayName = 'MapsLocalPharmacy';
MapsLocalPharmacy.muiName = 'SvgIcon';
export default MapsLocalPharmacy;
|
openex-front/src/private/components/integrations/Index.js | Luatix/OpenEx | import React from 'react';
import * as PropTypes from 'prop-types';
import { Route, Switch } from 'react-router-dom';
import Integrations from './Integrations';
import { errorWrapper } from '../../../components/Error';
const Index = () => (
<Switch>
<Route exact path="/integrations" render={errorWrapper(Integrations)} />
</Switch>
);
Index.propTypes = {
classes: PropTypes.object,
};
export default Index;
|
js/components/card/card-showcase.js | ChiragHindocha/stay_fit |
import React, { Component } from 'react';
import { Image, Dimensions } from 'react-native';
import { connect } from 'react-redux';
import { actions } from 'react-native-navigation-redux-helpers';
import { Container, Header, Title, Content, Button, Icon, Card, CardItem, Text, Thumbnail, Left, Right, Body, IconNB } from 'native-base';
import styles from './styles';
import { Actions } from 'react-native-router-flux';
const deviceWidth = Dimensions.get('window').width;
const logo = require('../../../img/logo.png');
const cardImage = require('../../../img/drawer-cover.png');
const {
popRoute,
} = actions;
class NHCardShowcase extends Component {
static propTypes = {
popRoute: React.PropTypes.func,
navigation: React.PropTypes.shape({
key: React.PropTypes.string,
}),
}
popRoute() {
this.props.popRoute(this.props.navigation.key);
}
render() {
return (
<Container style={styles.container}>
<Header>
<Left>
<Button transparent onPress={() => Actions.pop()}>
<Icon name="arrow-back" />
</Button>
</Left>
<Body>
<Title>Card Showcase</Title>
</Body>
<Right />
</Header>
<Content padder>
<Card style={styles.mb}>
<CardItem bordered>
<Left>
<Thumbnail source={logo} />
<Body>
<Text>NativeBase</Text>
<Text note>April 15, 2016</Text>
</Body>
</Left>
</CardItem>
<CardItem>
<Body>
<Image style={{ alignSelf: 'center', height: 150, resizeMode: 'cover', width: deviceWidth / 1.18, marginVertical: 5 }} source={cardImage} />
<Text>
NativeBase is a free and, source framework that enables developers
to build high-quality mobile apps using React Native iOS and Android apps
with a fusion of ES6.
NativeBase builds a layer on top of React Native that provides you with
basic set of components for mobile application development.
</Text>
</Body>
</CardItem>
<CardItem style={{paddingVertical: 0}}>
<Left>
<Button transparent>
<Icon name="logo-github" />
<Text>1,926 stars</Text>
</Button>
</Left>
</CardItem>
</Card>
</Content>
</Container>
);
}
}
function bindAction(dispatch) {
return {
popRoute: key => dispatch(popRoute(key)),
};
}
const mapStateToProps = state => ({
navigation: state.cardNavigation,
themeState: state.drawer.themeState,
});
export default connect(mapStateToProps, bindAction)(NHCardShowcase);
|
src/Parser/Mage/Frost/Modules/Items/IceTime.js | enragednuke/WoWAnalyzer | import React from 'react';
import ITEMS from 'common/ITEMS';
import SPELLS from 'common/SPELLS';
import { formatNumber } from 'common/format';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import ItemDamageDone from 'Main/ItemDamageDone';
/**
* Ice Time:
* Your Frozen Orb explodes into a Frost Nova that deals (600% of Spell power) damage.
*/
class IceTime extends Analyzer {
static dependencies = {
combatants: Combatants,
};
casts = 0;
hits = 0;
damage = 0;
on_initialized() {
this.active = this.combatants.selected.hasShoulder(ITEMS.ICE_TIME.id);
}
on_byPlayer_cast(event) {
if (event.ability.guid === SPELLS.FROZEN_ORB.id) {
this.casts += 1;
}
}
on_byPlayer_damage(event) {
if (event.ability.guid === SPELLS.ICE_TIME_FROST_NOVA.id) {
this.hits += 1;
this.damage += event.amount + (event.absorbed || 0);
}
}
item() {
const averageDamage = (this.damage / this.hits) || 0;
return {
item: ITEMS.ICE_TIME,
result: (
<dfn data-tip={`Over <b>${this.casts}</b> Frozen Orb casts, your Ice Time's proc hit <b>${this.hits}</b> targets for an average of <b>${formatNumber(averageDamage)}</b> each.`}>
<ItemDamageDone amount={this.damage} />
</dfn>
),
};
}
}
export default IceTime;
|
app/scripts/components/ui/checkbox/checkbox.js | bluedaniel/Kakapo-app | import React from 'react';
export default ({ checked, handleChange, label, name, dispatch }) => (
<label className="switch" htmlFor={name}>
<span className="switch-label">{label}</span>
<input
checked={checked}
id={name}
name={name}
onChange={() => dispatch(handleChange(!checked))}
type="checkbox"
value={checked}
/>
</label>
);
|
src/ui/components/Header.js | notifapi/notifapi-web | import React from 'react';
import { Component } from 'react';
export default class Header extends Component {
render() {
return(
<header role="banner" className="navbar navbar-custom navbar-static-top">
<div className="container">
<div className="navbar-header"><a className="navbar-brand" href="/">NotifAPI</a>
</div>
<div className="navbar-collapse bs-navbar-collapse collapse">
<ul id="top" role="navigation" className="nav navbar-nav">
<li><a href="/features">Features</a></li>
<li><a href="/docs">Docs</a></li>
<li><a href="/about">About</a></li>
<li><a href="/blog">Blog</a></li>
</ul>
<ul id="sign-in" role="navigation" className="nav navbar-nav navbar-right">
<li><a href="/sign-in">SIGN IN</a></li>
</ul>
</div>
</div>
</header>
)
}
} |
src/svg-icons/social/group-add.js | IsenrichO/mui-with-arrows | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let SocialGroupAdd = (props) => (
<SvgIcon {...props}>
<path d="M8 10H5V7H3v3H0v2h3v3h2v-3h3v-2zm10 1c1.66 0 2.99-1.34 2.99-3S19.66 5 18 5c-.32 0-.63.05-.91.14.57.81.9 1.79.9 2.86s-.34 2.04-.9 2.86c.28.09.59.14.91.14zm-5 0c1.66 0 2.99-1.34 2.99-3S14.66 5 13 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm6.62 2.16c.83.73 1.38 1.66 1.38 2.84v2h3v-2c0-1.54-2.37-2.49-4.38-2.84zM13 13c-2 0-6 1-6 3v2h12v-2c0-2-4-3-6-3z"/>
</SvgIcon>
);
SocialGroupAdd = pure(SocialGroupAdd);
SocialGroupAdd.displayName = 'SocialGroupAdd';
SocialGroupAdd.muiName = 'SvgIcon';
export default SocialGroupAdd;
|
components/Moment/Moment.js | rdjpalmer/bloom | import PropTypes from 'prop-types';
import React from 'react';
import cx from 'classnames';
import Wrapper from '../Wrapper/Wrapper';
import css from './Moment.css';
import Icon from '../Icon/Icon';
const Moment = ({ icon, title, children, className }) => (
<Wrapper className={ cx(css.root, className) }>
<div className={ css.inner }>
<div className={ css.header }>
<Icon name={ icon } className={ css.icon } />
<div className={ css.title }>{ title }</div>
</div>
<div className={ css.body }>
{ children }
</div>
</div>
</Wrapper>
);
Moment.propTypes = {
icon: PropTypes.string,
title: PropTypes.node.isRequired,
children: PropTypes.node.isRequired,
className: PropTypes.string,
};
Moment.defaultProps = {
icon: 'tick-c',
};
export default Moment;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.