Skip to content

Commit

Permalink
Drop deprecated react-tap-event-plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
bchrobot committed Jul 6, 2018
1 parent 27eea76 commit 6821116
Show file tree
Hide file tree
Showing 27 changed files with 64 additions and 74 deletions.
7 changes: 1 addition & 6 deletions __test__/AssignmentSummary.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import React from 'react'
import { mount } from 'enzyme'
import { StyleSheetTestUtils } from 'aphrodite'
import injectTapEventPlugin from 'react-tap-event-plugin'
import each from 'jest-each'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import { CardActions, CardTitle } from 'material-ui/Card'
Expand Down Expand Up @@ -62,7 +61,6 @@ describe('AssignmentSummary text', function t() {
})

describe('AssignmentSummary actions inUSA and NOT AllowSendAll', () => {
injectTapEventPlugin() // prevents warning
function create(unmessaged, unreplied, badTimezone, isDynamic) {
window.NOT_IN_USA = 0
window.ALLOW_SEND_ALL = false
Expand Down Expand Up @@ -159,10 +157,7 @@ it('renders "Send later" when there is a badTimezoneCount', () => {
})

describe('contacts filters', () => {
// These are an attempt to confirm that the buttons will work.
// It would be better to simulate clicking them, but I can't
// get it to work right now because of 'react-tap-event-plugin'
// some hints are here https://github.com/mui-org/material-ui/issues/4200#issuecomment-217738345
// TODO: material-ui switch test to clicks

it('filters correctly in USA', () => {
window.NOT_IN_USA = 0
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
"react-formal": "^0.28.4",
"react-router": "^2.5.2",
"react-router-redux": "^4.0.5",
"react-tap-event-plugin": "^2.0.0",
"redis": "^2.8.0",
"redux": "^3.7.2",
"redux-thunk": "^2.1.0",
Expand Down
4 changes: 0 additions & 4 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import muiTheme from '../styles/mui-theme'
import theme from '../styles/theme'
import { StyleSheet, css } from 'aphrodite'
import injectTapEventPlugin from 'react-tap-event-plugin'
import Form from 'react-formal'
import GSTextField from './forms/GSTextField'
import GSDateField from './forms/GSDateField'
import GSScriptField from './forms/GSScriptField'
import GSSelectField from './forms/GSSelectField'

// Needed for MaterialUI
injectTapEventPlugin()

Form.addInputTypes({
string: GSTextField,
number: GSTextField,
Expand Down
4 changes: 2 additions & 2 deletions src/components/AssignmentSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class AssignmentSummary extends Component {
disabled={disabled}
label={title}
primary={primary && !disabled}
onTouchTap={() => this.goToTodos(contactsFilter, assignment.id)}
onClick={() => this.goToTodos(contactsFilter, assignment.id)}
/>)
} else {
return (<Badge
Expand All @@ -80,7 +80,7 @@ export class AssignmentSummary extends Component {
<RaisedButton
disabled={disabled}
label={title}
onTouchTap={() => this.goToTodos(contactsFilter, assignment.id)}
onClick={() => this.goToTodos(contactsFilter, assignment.id)}
/>
</Badge>)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/AssignmentTexter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ class AssignmentTexter extends React.Component {
text={title}
/>,
<IconButton
onTouchTap={this.handleNavigatePrevious}
onClick={this.handleNavigatePrevious}
disabled={!this.hasPrevious()}
>
<NavigateBeforeIcon />
</IconButton>,
<IconButton
onTouchTap={this.handleNavigateNextforSkip}
onClick={this.handleNavigateNextforSkip}
disabled={!this.hasNext()}
>
<NavigateNextIcon />
Expand Down
2 changes: 1 addition & 1 deletion src/components/BulkSendButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class BulkSendButton extends Component {
return (
<div className={css(styles.container)}>
<RaisedButton
onTouchTap={this.sendMessages}
onClick={this.sendMessages}
label={this.state.isSending ? 'Sending...' : `Send Bulk (${window.BULK_SEND_CHUNK_SIZE})`}
disabled={this.state.isSending}
primary
Expand Down
2 changes: 1 addition & 1 deletion src/components/CampaignCannedResponseForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CannedResponseForm extends React.Component {
/>
<FlatButton
label='Cancel'
onTouchTap={() => this.setState({ showForm: false })}
onClick={() => this.setState({ showForm: false })}
style={{
marginLeft: 5,
display: 'inline-block'
Expand Down
4 changes: 2 additions & 2 deletions src/components/CampaignCannedResponsesForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class CampaignCannedResponsesForm extends React.Component {
secondary
label='Add new canned response'
icon={<CreateIcon />}
onTouchTap={() => this.setState({ showForm: true })}
onClick={() => this.setState({ showForm: true })}
/>
)
}
Expand All @@ -90,7 +90,7 @@ export default class CampaignCannedResponsesForm extends React.Component {
secondaryText={response.text}
rightIconButton={(
<IconButton
onTouchTap={() => {
onClick={() => {
const newVals = this.props.formValues.cannedResponses.map((responseToDelete) => {
if (responseToDelete.id === response.id) {
return null
Expand Down
6 changes: 3 additions & 3 deletions src/components/CampaignInteractionStepsForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default class CampaignInteractionStepsForm extends React.Component {
fullWidth
hintText='Answer to the previous question'
/> : ''}
{interactionStep.parentInteractionId ? <DeleteIcon style={styles.pullRight} onTouchTap={this.deleteStep(interactionStep.id).bind(this)} /> : ''}
{interactionStep.parentInteractionId ? <DeleteIcon style={styles.pullRight} onClick={this.deleteStep(interactionStep.id).bind(this)} /> : ''}
{interactionStep.parentInteractionId && this.props.availableActions && this.props.availableActions.length ?
(<div key={`answeractions-${interactionStep.id}`}>
<Form.Field
Expand Down Expand Up @@ -184,7 +184,7 @@ export default class CampaignInteractionStepsForm extends React.Component {
{interactionStep.questionText && interactionStep.script && (!interactionStep.parentInteractionId || interactionStep.answerOption) ? <div>
<RaisedButton
label='+ Add a response'
onTouchTap={this.addStep(interactionStep.id).bind(this)}
onClick={this.addStep(interactionStep.id).bind(this)}
style={{ marginBottom: '10px' }}
/>
</div> : ''}
Expand Down Expand Up @@ -213,7 +213,7 @@ export default class CampaignInteractionStepsForm extends React.Component {
<RaisedButton
primary
label={this.props.saveLabel}
onTouchTap={this.onSave.bind(this)}
onClick={this.onSave.bind(this)}
/>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/CampaignTextersForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ export default class CampaignTextersForm extends React.Component {
: ''}
<div className={css(styles.removeButton)}>
<IconButton
onTouchTap={async () => {
onClick={async () => {
const currentFormValues = this.formValues()
const newFormValues = {
...currentFormValues
Expand Down Expand Up @@ -454,7 +454,7 @@ export default class CampaignTextersForm extends React.Component {
<div>
<RaisedButton
label='Add All'
onTouchTap={(() => this.addAllTexters())}
onClick={(() => this.addAllTexters())}
/>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/Chip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const styles = {
}
}

function Chip({ text, iconRightClass, onIconRightTouchTap, onTouchTap, style = {} }) {
function Chip({ text, iconRightClass, onIconRightTouchTap, onClick, style = {} }) {
return (
<div style={_.extend({}, styles.chip, style)} onTouchTap={onTouchTap}>
<div style={_.extend({}, styles.chip, style)} onClick={onClick}>
{text}
{iconRightClass ? React.createElement(iconRightClass, { style: styles.icon, onTouchTap: onIconRightTouchTap }) : ''}
{iconRightClass ? React.createElement(iconRightClass, { style: styles.icon, onClick: onIconRightTouchTap }) : ''}
</div>
)
}
Expand All @@ -42,7 +42,7 @@ Chip.propTypes = {
text: PropTypes.element,
iconRightClass: PropTypes.string,
onIconRightTouchTap: PropTypes.func,
onTouchTap: PropTypes.func,
onClick: PropTypes.func,
style: PropTypes.object
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfirmButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class ConfirmButton extends Component {
return (
<div className={css(styles.container)}>
<RaisedButton
onTouchTap={this.toggleConfirmationDialog}
onClick={this.toggleConfirmationDialog}
label={this.props.label}
/>
<Dialog
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Navigation = function Navigation(props) {
<ListItem
key={section.name}
primaryText={section.name}
onTouchTap={() => props.router.push(section.url)}
onClick={() => props.router.push(section.url)}
/>
))}
<Divider />
Expand Down
2 changes: 1 addition & 1 deletion src/components/ScriptEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class ScriptEditor extends React.Component {
<Chip
style={styles.scriptFieldButton}
text={delimit(field)}
onTouchTap={() => this.addCustomField(field)}
onClick={() => this.addCustomField(field)}
/>
))}
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/components/ScriptList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ class ScriptList extends React.Component {
// targetOrigin={{horizontal: 'left', vertical: 'bottom'}}
// >
// <MenuItem primaryText={duplicateCampaignResponses && !script.isUserCreated ? "Duplicate and edit" : "Edit"}
// onTouchTap={() => this.handleEditScript(script)}
// onClick={() => this.handleEditScript(script)}
// />
// {
// script.isUserCreated ? (
// <MenuItem primaryText="Delete"
// onTouchTap={() => this.handleDeleteScript(script.id)}
// onClick={() => this.handleDeleteScript(script.id)}
// />
// ) : ''
// }
Expand All @@ -98,7 +98,7 @@ class ScriptList extends React.Component {
const listItems = scripts.map((script) => (
<ListItem
value={script.text}
onTouchTap={() => onSelectCannedResponse(script)}
onClick={() => onSelectCannedResponse(script)}
key={script.id}
primaryText={script.title}
secondaryText={script.text}
Expand All @@ -123,7 +123,7 @@ class ScriptList extends React.Component {
<FlatButton
label='Add new canned response'
icon={<CreateIcon />}
onTouchTap={this.handleOpenDialog}
onClick={this.handleOpenDialog}
/>
) : ''}
<Form.Context>
Expand All @@ -133,7 +133,7 @@ class ScriptList extends React.Component {
actions={[
<FlatButton
label='Cancel'
onTouchTap={this.handleCloseDialog}
onClick={this.handleCloseDialog}
/>,
<Form.Button
type='submit'
Expand Down
2 changes: 1 addition & 1 deletion src/components/SendButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SendButton extends Component {
return (
<div className={css(styles.container)}>
<RaisedButton
onTouchTap={this.handleTouchTap}
onClick={this.handleTouchTap}
disabled={this.props.disabled}
label={this.clickStepLabels()[this.state.clickStepIndex]}
primary
Expand Down
6 changes: 3 additions & 3 deletions src/components/forms/GSScriptField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export default class GSScriptField extends GSFormField {
actions={[
<FlatButton
label='Cancel'
onTouchTap={this.handleCloseDialog}
onClick={this.handleCloseDialog}
/>,
<RaisedButton
label='Done'
onTouchTap={this.handleSaveScript}
onClick={this.handleSaveScript}
primary
/>
]}
Expand All @@ -84,7 +84,7 @@ export default class GSScriptField extends GSFormField {
<TextField
multiLine
onFocus={this.handleOpenDialog}
onTouchTap={(event) => {
onClick={(event) => {
event.stopPropagation()
}}
floatingLabelText={this.floatingLabelText()}
Expand Down
6 changes: 3 additions & 3 deletions src/containers/AdminCampaignEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,19 @@ class AdminCampaignEdit extends React.Component {
{this.props.campaignData.campaign.isArchived ? (
<RaisedButton
label='Unarchive'
onTouchTap={async() => await this.props.mutations.unarchiveCampaign(this.props.campaignData.campaign.id)}
onClick={async() => await this.props.mutations.unarchiveCampaign(this.props.campaignData.campaign.id)}
/>
) : (
<RaisedButton
label='Archive'
onTouchTap={async() => await this.props.mutations.archiveCampaign(this.props.campaignData.campaign.id)}
onClick={async() => await this.props.mutations.archiveCampaign(this.props.campaignData.campaign.id)}
/>
)}
<RaisedButton
primary
label='Start This Campaign!'
disabled={!isCompleted}
onTouchTap={async () => {
onClick={async () => {
this.setState({
startingCampaign: true
})
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminCampaignList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AdminCampaignList extends React.Component {
{adminPerms ?
(<FloatingActionButton
style={theme.components.floatingButton}
onTouchTap={this.handleClickNewButton}
onClick={this.handleClickNewButton}
>
<ContentAdd />
</FloatingActionButton>
Expand Down
12 changes: 6 additions & 6 deletions src/containers/AdminCampaignStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class AdminCampaignStats extends React.Component {
return (
<RaisedButton
label='Copy Campaign'
onTouchTap={async() => await this.props.mutations.copyCampaign(this.props.params.campaignId)}
onClick={async() => await this.props.mutations.copyCampaign(this.props.params.campaignId)}
/>
)
}
Expand Down Expand Up @@ -175,15 +175,15 @@ class AdminCampaignStats extends React.Component {
{!campaign.isArchived ?
( // edit
<RaisedButton
onTouchTap={() => this.props.router.push(`/admin/${organizationId}/campaigns/${campaignId}/edit`)}
onClick={() => this.props.router.push(`/admin/${organizationId}/campaigns/${campaignId}/edit`)}
label='Edit'
/>
) : null}
{adminPerms ?
[ // Buttons for Admins (and not Supervolunteers)
( // export
<RaisedButton
onTouchTap={async () => {
onClick={async () => {
this.setState({
exportMessageOpen: true,
disableExportButton: true
Expand All @@ -201,19 +201,19 @@ class AdminCampaignStats extends React.Component {
( // unarchive
campaign.isArchived ?
<RaisedButton
onTouchTap={async () => await this.props.mutations.unarchiveCampaign(campaignId)}
onClick={async () => await this.props.mutations.unarchiveCampaign(campaignId)}
label='Unarchive'
/> : null),
( // archive
!campaign.isArchived ?
<RaisedButton
onTouchTap={async () => await this.props.mutations.archiveCampaign(campaignId)}
onClick={async () => await this.props.mutations.archiveCampaign(campaignId)}
label='Archive'
/> : null),
( // copy
<RaisedButton
label='Copy Campaign'
onTouchTap={async() => await this.props.mutations.copyCampaign(this.props.params.campaignId)}
onClick={async() => await this.props.mutations.copyCampaign(this.props.params.campaignId)}
/>)
] : null}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AdminNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AdminNavigation extends React.Component {
switchListItem={
<ListItem
primaryText='Switch to texter'
onTouchTap={() => this.props.router.push(`/app/${organizationId}/todos`)}
onClick={() => this.props.router.push(`/app/${organizationId}/todos`)}
/>
}
/>
Expand Down
Loading

0 comments on commit 6821116

Please sign in to comment.