don't show popovers, remove delete, add tsc to admin pre-commit

This commit is contained in:
Daniel Ternyak 2019-02-27 16:50:53 -06:00
parent 063dbdde7c
commit 625a6cab99
No known key found for this signature in database
GPG Key ID: DF212D2DC5D0E245
3 changed files with 42 additions and 50 deletions

View File

@ -13,7 +13,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-commit": "lint-staged && yarn run tsc",
"pre-push": "yarn run lint && yarn run tsc"
}
},

View File

@ -75,36 +75,42 @@ class ProposalDetailNaked extends React.Component<Props, State> {
</Popconfirm>
);
const renderCancelControl = () => (
<Popconfirm
title={
<p>
Are you sure you want to cancel proposal and begin
<br />
the refund process? This cannot be undone.
</p>
}
placement="left"
cancelText="cancel"
okText="confirm"
okButtonProps={{ loading: store.proposalDetailCanceling }}
onConfirm={this.handleCancel}
>
<Button
icon="close-circle"
className="ProposalDetail-controls-control"
loading={store.proposalDetailCanceling}
disabled={
p.status !== PROPOSAL_STATUS.LIVE ||
p.stage === PROPOSAL_STAGE.FAILED ||
p.stage === PROPOSAL_STAGE.CANCELED
const renderCancelControl = () => {
const disabled =
p.status !== PROPOSAL_STATUS.LIVE ||
p.stage === PROPOSAL_STAGE.FAILED ||
p.stage === PROPOSAL_STAGE.CANCELED;
return (
<Popconfirm
title={
<p>
Are you sure you want to cancel proposal and begin
<br />
the refund process? This cannot be undone.
</p>
}
block
placement="left"
cancelText="cancel"
okText="confirm"
visible={!disabled}
okButtonProps={{
loading: store.proposalDetailCanceling,
}}
onConfirm={this.handleCancel}
>
Cancel & refund
</Button>
</Popconfirm>
);
<Button
icon="close-circle"
className="ProposalDetail-controls-control"
loading={store.proposalDetailCanceling}
disabled={disabled}
block
>
Cancel & refund
</Button>
</Popconfirm>
);
};
const renderArbiterControl = () => (
<ArbiterControl

View File

@ -1,8 +1,7 @@
import React from 'react';
import { view } from 'react-easy-state';
import { Popconfirm, Tag, Tooltip, List } from 'antd';
import { Tag, Tooltip, List } from 'antd';
import { Link } from 'react-router-dom';
import store from 'src/store';
import { Proposal, PROPOSAL_STATUS } from 'src/types';
import { PROPOSAL_STATUSES, PROPOSAL_STAGES, getStatusById } from 'util/statuses';
import { formatDateSeconds } from 'util/time';
@ -16,45 +15,32 @@ class ProposalItemNaked extends React.Component<Proposal> {
const p = this.props;
const status = getStatusById(PROPOSAL_STATUSES, p.status);
const stage = getStatusById(PROPOSAL_STAGES, p.stage);
const actions = [
<Popconfirm
key="delete"
onConfirm={this.handleDelete}
title="Are you sure?"
okText="Delete"
okType="danger"
placement="left"
>
<a>delete</a>
</Popconfirm>,
];
return (
<List.Item key={p.proposalId} className="ProposalItem" actions={actions}>
<List.Item key={p.proposalId} className="ProposalItem">
<Link to={`/proposals/${p.proposalId}`}>
<h2>
{p.title || '(no title)'}
<Tooltip title={status.hint}>
<Tag color={status.tagColor}>{status.tagDisplay}</Tag>
</Tooltip>
{p.status === PROPOSAL_STATUS.LIVE &&
{p.status === PROPOSAL_STATUS.LIVE && (
<Tooltip title={stage.hint}>
<Tag color={stage.tagColor}>{stage.tagDisplay}</Tag>
</Tooltip>
}
)}
</h2>
<p>Created: {formatDateSeconds(p.dateCreated)}</p>
<p>{p.brief}</p>
{p.rfp && (
<p>Submitted for RFP: <strong>{p.rfp.title}</strong></p>
<p>
Submitted for RFP: <strong>{p.rfp.title}</strong>
</p>
)}
</Link>
</List.Item>
);
}
private handleDelete = () => {
store.deleteProposal(this.props.proposalId);
};
}
const ProposalItem = view(ProposalItemNaked);