Skip to content

Commit f8c68d1

Browse files
authored
Merge pull request #501 from mapbox/feature/review-user-link
Add link to review user on changeset list
2 parents ded772e + bfb5214 commit f8c68d1

File tree

2 files changed

+60
-24
lines changed

2 files changed

+60
-24
lines changed

src/components/list/row.js

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Map } from 'immutable';
66
import { SecondaryLine } from './secondary_line';
77
import { PrimaryLine } from './primary_line';
88
import { Title } from './title';
9+
import { history } from '../../store/history';
910

1011
export class Row extends React.PureComponent {
1112
props: {
@@ -42,13 +43,17 @@ export class Row extends React.PureComponent {
4243

4344
backgroundClass += active
4445
? 'light-blue'
45-
: this.wasOpen ? ' bg-darken5 ' : '';
46+
: this.wasOpen
47+
? ' bg-darken5 '
48+
: '';
4649
return (
47-
<Link
48-
to={{
49-
search: window.location.search,
50-
pathname: `/changesets/${changesetId}`
51-
}}
50+
<div
51+
onClick={() =>
52+
history.push({
53+
search: window.location.search,
54+
pathname: `/changesets/${changesetId}`
55+
})
56+
}
5257
>
5358
<div className={`${backgroundClass} ${borderClass}`} ref={inputRef}>
5459
<div
@@ -58,20 +63,27 @@ export class Row extends React.PureComponent {
5863
}
5964
>
6065
<div className="flex-parent flex-parent--column">
61-
<div>
62-
<Title
63-
properties={properties}
64-
wasOpen={this.wasOpen}
65-
date={properties.get('date')}
66-
/>
67-
</div>
68-
<div>
69-
<PrimaryLine
70-
reasons={properties.get('reasons')}
71-
tags={properties.get('tags')}
72-
comment={properties.get('comment')}
73-
/>
74-
</div>
66+
<Link
67+
to={{
68+
search: window.location.search,
69+
pathname: `/changesets/${changesetId}`
70+
}}
71+
>
72+
<div>
73+
<Title
74+
properties={properties}
75+
wasOpen={this.wasOpen}
76+
date={properties.get('date')}
77+
/>
78+
</div>
79+
<div>
80+
<PrimaryLine
81+
reasons={properties.get('reasons')}
82+
tags={properties.get('tags')}
83+
comment={properties.get('comment')}
84+
/>
85+
</div>
86+
</Link>
7587
<div>
7688
<SecondaryLine
7789
changesetId={changesetId}
@@ -82,7 +94,7 @@ export class Row extends React.PureComponent {
8294
</div>
8395
</div>
8496
</div>
85-
</Link>
97+
</div>
8698
);
8799
}
88100
}

src/components/list/secondary_line.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// @flow
22
import React from 'react';
3+
import { Link } from 'react-router-dom';
4+
35
import { CreateDeleteModify } from '../create_delete_modify';
46
import { NumberOfComments } from './comments';
7+
import { getObjAsQueryParam } from '../../utils/query_params';
58

69
import thumbsUp from '../../assets/thumbs-up.svg';
710
import thumbsDown from '../../assets/thumbs-down.svg';
@@ -10,9 +13,30 @@ export function SecondaryLine({ changesetId, date, properties }: Object) {
1013
return (
1114
<span className="flex-parent flex-parent--row justify--space-between txt-light txt-s color-gray">
1215
<span>
13-
<span className="mr6">{changesetId}</span>
16+
<Link
17+
to={{
18+
search: window.location.search,
19+
pathname: `/changesets/${changesetId}`
20+
}}
21+
>
22+
<span className="mr6">{changesetId}</span>
23+
</Link>
1424
{properties.get('checked') ? (
15-
<span>
25+
<Link
26+
to={{
27+
search: getObjAsQueryParam('filters', {
28+
users: [
29+
{
30+
label: properties.get('check_user'),
31+
value: properties.get('check_user')
32+
}
33+
],
34+
date__gte: [{ label: '', value: '' }]
35+
}),
36+
pathname: '/'
37+
}}
38+
title={`See ${properties.get('check_user')}'s changesets`}
39+
>
1640
{properties.get('harmful') ? (
1741
<img
1842
src={thumbsDown}
@@ -31,7 +55,7 @@ export function SecondaryLine({ changesetId, date, properties }: Object) {
3155
'check_user'
3256
)}`}</span>
3357
)}
34-
</span>
58+
</Link>
3559
) : null}
3660
</span>
3761
<span className="flex-parent flex-parent--row">

0 commit comments

Comments
 (0)