Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: more trans deleted warning #1

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/components/BountyDeletedWarning/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import styled from 'styled-components';
import Tooltip from '../Tooltip';
import { i18nTxt } from '../../utils';

const ItemWarning = styled.span`
margin-left: 10px;
i {
font-size: 18px;
color: rgb(240, 69, 58);
}
`;

export default function BountyDeletedWarning() {
return (
<ItemWarning>
<span className="item-warning">
<Tooltip direction="topRight" tipSpan={<i className="material-icons dp48">info</i>}>
{i18nTxt('The Bounty has been offline from its corresponding national station and no longer supports viewing')}
</Tooltip>
</span>
</ItemWarning>
);
}
4 changes: 2 additions & 2 deletions src/components/PageHead/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class PageHead extends Component {
};

render() {
const { head, location, updateCommon, lang, updateHead } = this.props;
const { head, location, updateCommon, lang, updateHead, history } = this.props;
const { homeSticky } = this.state;
let wrapClass;
if (isPath(location, '/')) {
Expand Down Expand Up @@ -336,7 +336,7 @@ class PageHead extends Component {
updateCommon({
lang: v.value,
});
window.location.reload();
history.push('/');
},
options: [
{
Expand Down
11 changes: 4 additions & 7 deletions src/pages/Bounty/commonStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ export const MyBounSolunDiv = styled(StyledWrapper)`
vertical-align: middle;
}
}
.item-link.disabled {
cursor: default;
pointer-events: none;
}
.item-head {
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -200,13 +204,6 @@ export const MyBounSolunDiv = styled(StyledWrapper)`
font-size: 14px;
margin-right: 12px;
}
.item-warning {
margin-left: 10px;
i {
font-size: 18px;
color: rgb(240, 69, 58);
}
}
.reject-tips {
margin-top: 8px;
width: 520px;
Expand Down
20 changes: 6 additions & 14 deletions src/pages/Bounty/mybounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import BackHeadDiv from '../../components/BackHeadDiv';
import { BOUNTY_STATUS_ENUM } from '../../constants';
import * as s2 from '../UserInfo/commonStyle';
import { fmtToDay, getStatus, auth, commonPropTypes, i18nTxt } from '../../utils';
import Tooltip from '../../components/Tooltip';
import BountyDeletedWarning from '../../components/BountyDeletedWarning';
// import * as s2 from './commonStyle';

class MyBounty extends Component {
constructor(...args) {
super(...args);
Expand All @@ -34,16 +35,6 @@ class MyBounty extends Component {
document.title = i18nTxt('My Bounties');
}

renderWarning = () => {
return (
<span className="item-warning">
<Tooltip direction="topRight" tipSpan={<i className="material-icons dp48">info</i>}>
{i18nTxt('The Bounty has been offline from its corresponding national station and no longer supports viewing')}
</Tooltip>
</span>
);
};

render() {
const { myBounty, getMyBounty, getMyJoinedBounty, history, updateMy } = this.props;
return (
Expand Down Expand Up @@ -114,7 +105,7 @@ class MyBounty extends Component {
<div className="my-bounty-item clearfix">
<div className="item-head">
<h5>{v.title}</h5>
<Link className="item-link" to={`/view-bounty?bountyId=${v.id}`}>
<Link className={`item-link ${v.transDeleted ? 'disabled' : ''}`} to={`/view-bounty?bountyId=${v.id}`}>
<span>{i18nTxt('VIEW MORE')}</span>
<i className="material-icons dp48">chevron_right</i>
</Link>
Expand All @@ -125,7 +116,7 @@ class MyBounty extends Component {
<span className="item-status" style={rejectColor}>
{getStatus(v.status)}
</span>
{v.transDeleted && this.renderWarning()}
{v.transDeleted && <BountyDeletedWarning />}
</div>
{rejectTips}
</div>
Expand Down Expand Up @@ -180,7 +171,7 @@ class MyBounty extends Component {
<div className="my-bounty-item clearfix">
<div className="item-head">
<h5>{v.title}</h5>
<Link className="item-link" to={`/view-bounty?bountyId=${v.id}`}>
<Link className={`item-link ${v.transDeleted ? 'disabled' : ''}`} to={`/view-bounty?bountyId=${v.id}`}>
<span>{i18nTxt('VIEW MORE')}</span>
<i className="material-icons dp48">chevron_right</i>
</Link>
Expand All @@ -191,6 +182,7 @@ class MyBounty extends Component {
<span className="item-status" style={rejectColor}>
{getStatus(v.status)}
</span>
{v.transDeleted && <BountyDeletedWarning />}
</div>
{rejectTips}
</div>
Expand Down
7 changes: 6 additions & 1 deletion src/pages/Solution/mysolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as s from '../Bounty/commonStyle';
import BackHeadDiv from '../../components/BackHeadDiv';
import { SOLUTION_STATUS_ENUM } from '../../constants';
import { fmtToDay, getStatus, auth, commonPropTypes, i18nTxt } from '../../utils';
import BountyDeletedWarning from '../../components/BountyDeletedWarning';

const MyBounSolunDiv = styled(s.MyBounSolunDiv)`
.update-progress {
Expand Down Expand Up @@ -103,7 +104,10 @@ class MySolution extends Component {
<div className="my-bounty-item clearfix">
<div className="item-head">
<h5>{v.title}</h5>
<Link className="item-link" to={`/view-submission?submissionId=${v.id}&from=mysubmission`}>
<Link
className={`item-link ${v.transDeleted ? 'disabled' : ''}`}
to={`/view-submission?submissionId=${v.id}&from=mysubmission`}
>
<span>{i18nTxt('VIEW MORE')}</span>
<i className="material-icons dp48">chevron_right</i>
</Link>
Expand All @@ -114,6 +118,7 @@ class MySolution extends Component {
<span className="item-status" style={rejectColor}>
{getStatus(v.status)}
</span>
{v.transDeleted && <BountyDeletedWarning />}
</div>
{updateDiv}
{rejectTips}
Expand Down
14 changes: 12 additions & 2 deletions src/pages/UserInfo/my-likes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import BackHeadDiv from '../../components/BackHeadDiv';
import * as s2 from './commonStyle';
import Modal from '../../components/Modal';
import { fmtToDay, auth, commonPropTypes, getStatus, i18nTxt } from '../../utils';
import BountyDeletedWarning from '../../components/BountyDeletedWarning';

const Wrapper = styled(StyledWrapper)`
padding: 40px;
Expand Down Expand Up @@ -72,6 +73,10 @@ const Wrapper = styled(StyledWrapper)`
vertical-align: middle;
}
}
.arrow-link.disabled {
cursor: default;
pointer-events: none;
}
}
.like-subm-from {
color: #999;
Expand Down Expand Up @@ -251,6 +256,7 @@ class MyLikes extends Component {
<div className="like-sub">
<span style={{ color: '#666' }}>{fmtToDay(bounty.updatedAt || bounty.createdAt)}</span>
<span className="like-state">{getStatus(bounty.status)}</span>
{bounty.transDeleted && <BountyDeletedWarning />}
</div>
</td>
<td className="align-right">
Expand All @@ -259,7 +265,7 @@ class MyLikes extends Component {
</button>
</td>
<td className="align-right">
<Link to={`/view-bounty?bountyId=${bounty.id}`} className="arrow-link">
<Link to={`/view-bounty?bountyId=${bounty.id}`} className={`arrow-link ${bounty.transDeleted ? 'disabled' : ''}`}>
<span>{i18nTxt('VIEW MORE')}</span>
<i className="material-icons dp48">chevron_right</i>
</Link>
Expand Down Expand Up @@ -324,6 +330,7 @@ class MyLikes extends Component {
<span className="like-subm-from">
{i18nTxt('Submission from')} {solution.user.nickname}
</span>
{solution.transDeleted && <BountyDeletedWarning />}
</div>
</td>
<td className="align-right">
Expand All @@ -332,7 +339,10 @@ class MyLikes extends Component {
</button>
</td>
<td className="align-right">
<Link to={`/view-submission?submissionId=${solution.id}`} className="arrow-link">
<Link
to={`/view-submission?submissionId=${solution.id}`}
className={`arrow-link ${solution.transDeleted ? 'disabled' : ''}`}
>
<span>{i18nTxt('VIEW MORE')}</span>
<i className="material-icons dp48">chevron_right</i>
</Link>
Expand Down