Change 'copy' to 'duplicate' and switch to more appropriate icon (#149)

master
ramzan 4 years ago committed by GitHub
parent 2b43463fb0
commit 384e12e1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,7 +55,7 @@ export const routeResolver = new RouteResolver({
_id: { _id: {
_base: ':itemUid', _base: ':itemUid',
edit: 'edit', edit: 'edit',
copy: 'copy', duplicate: 'duplicate',
log: 'log', log: 'log',
}, },
new: 'new', new: 'new',
@ -284,7 +284,7 @@ class App extends React.PureComponent {
private autoRefresh() { private autoRefresh() {
if (navigator.onLine && this.props.credentials && if (navigator.onLine && this.props.credentials &&
!(window.location.pathname.match(/.*\/(new|edit|copy)$/))) { !(window.location.pathname.match(/.*\/(new|edit|duplicate)$/))) {
this.refresh(); this.refresh();
} }

@ -5,7 +5,7 @@ import * as React from 'react';
import { Route, Switch } from 'react-router'; import { Route, Switch } from 'react-router';
import Button from '@material-ui/core/Button'; import Button from '@material-ui/core/Button';
import IconEdit from '@material-ui/icons/Edit'; import IconEdit from '@material-ui/icons/Edit';
import IconCopy from '@material-ui/icons/FileCopy'; import IconDuplicate from '@material-ui/icons/FileCopy';
import IconChangeHistory from '@material-ui/icons/ChangeHistory'; import IconChangeHistory from '@material-ui/icons/ChangeHistory';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
@ -192,7 +192,7 @@ const CollectionRoutes = withStyles(styles)(withRouter(
/> />
{props.routePrefix === 'pim.events' && {props.routePrefix === 'pim.events' &&
<Route <Route
path={routeResolver.getRoute(props.routePrefix + '._id.copy')} path={routeResolver.getRoute(props.routePrefix + '._id.duplicate')}
exact exact
render={({ match }) => { render={({ match }) => {
const itemUid = decodeURIComponent(match.params.itemUid); const itemUid = decodeURIComponent(match.params.itemUid);
@ -210,7 +210,7 @@ const CollectionRoutes = withStyles(styles)(withRouter(
onDelete={props.onItemDelete} onDelete={props.onItemDelete}
onCancel={props.onItemCancel} onCancel={props.onItemCancel}
history={props.history} history={props.history}
copy duplicate
/> />
} }
</Container> </Container>
@ -285,12 +285,12 @@ const CollectionRoutes = withStyles(styles)(withRouter(
style={{ marginLeft: 15 }} style={{ marginLeft: 15 }}
onClick={() => onClick={() =>
history.push(routeResolver.getRoute( history.push(routeResolver.getRoute(
props.routePrefix + '._id.copy', props.routePrefix + '._id.duplicate',
{ itemUid: match.params.itemUid })) { itemUid: match.params.itemUid }))
} }
> >
<IconCopy className={classes.leftIcon} /> <IconDuplicate className={classes.leftIcon} />
Copy Duplicate
</Button> </Button>
} }
</div> </div>

@ -50,7 +50,7 @@ interface PropsType {
onCancel: () => void; onCancel: () => void;
location: Location; location: Location;
history: History; history: History;
copy: boolean; duplicate: boolean;
} }
class EventEdit extends React.PureComponent<PropsType> { class EventEdit extends React.PureComponent<PropsType> {
@ -106,7 +106,7 @@ class EventEdit extends React.PureComponent<PropsType> {
endDate.adjust(-1, 0, 0, 0); endDate.adjust(-1, 0, 0, 0);
} }
if (this.props.copy) { if (this.props.duplicate) {
this.state.title = event.title ? `Copy of ${event.title}` : ''; this.state.title = event.title ? `Copy of ${event.title}` : '';
} else { } else {
this.state.uid = event.uid; this.state.uid = event.uid;
@ -126,7 +126,7 @@ class EventEdit extends React.PureComponent<PropsType> {
} }
} }
} }
if (this.props.copy || this.props.item === undefined) { if (this.props.duplicate || this.props.item === undefined) {
this.state.uid = uuid.v4(); this.state.uid = uuid.v4();
} }
@ -228,7 +228,7 @@ class EventEdit extends React.PureComponent<PropsType> {
return; return;
} }
const event = (this.props.item && !this.props.copy) ? const event = (this.props.item && !this.props.duplicate) ?
this.props.item.clone() this.props.item.clone()
: :
new EventType() new EventType()
@ -287,7 +287,7 @@ class EventEdit extends React.PureComponent<PropsType> {
return ( return (
<> <>
<h2> <h2>
{(this.props.item && !this.props.copy) ? 'Edit Event' : 'New Event'} {(this.props.item && !this.props.duplicate) ? 'Edit Event' : 'New Event'}
</h2> </h2>
{recurring && ( {recurring && (
<div> <div>

Loading…
Cancel
Save