Skip to content

Commit 0988037

Browse files
committed
feat(web): ts mentions component
1 parent a87a1f7 commit 0988037

File tree

7 files changed

+29
-2
lines changed

7 files changed

+29
-2
lines changed

webapp/src/components/sidebar_buttons/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function mapStateToProps(state) {
1515
return {
1616
connected: state[`plugins-${pluginId}`].connected,
1717
clientId: state[`plugins-${pluginId}`].clientId,
18+
mentions: state[`plugins-${pluginId}`].sidebarContent.mentions,
1819
reviews: state[`plugins-${pluginId}`].sidebarContent.reviews,
1920
yourPrs: state[`plugins-${pluginId}`].sidebarContent.prs,
2021
yourAssignments: state[`plugins-${pluginId}`].sidebarContent.assignments,

webapp/src/components/sidebar_buttons/sidebar_buttons.jsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default class SidebarButtons extends React.PureComponent {
1414
connected: PropTypes.bool,
1515
clientId: PropTypes.string,
1616
enterpriseURL: PropTypes.string,
17+
mentions: PropTypes.arrayOf(PropTypes.object),
1718
reviews: PropTypes.arrayOf(PropTypes.object),
1819
unreads: PropTypes.arrayOf(PropTypes.object),
1920
yourPrs: PropTypes.arrayOf(PropTypes.object),
@@ -191,6 +192,18 @@ export default class SidebarButtons extends React.PureComponent {
191192
{' ' + unreads.length}
192193
</a>
193194
</OverlayTrigger>
195+
<OverlayTrigger
196+
key='githubMentionsLink'
197+
placement={placement}
198+
overlay={<Tooltip id='mentionTooltip'>{'Mentions on Pull Requests'}</Tooltip>}
199+
>
200+
<a
201+
onClick={() => this.openRHS(RHSStates.MENTIONS)}
202+
style={button}
203+
>
204+
<i className='fa fa-comment-o'/>
205+
</a>
206+
</OverlayTrigger>
194207
<OverlayTrigger
195208
key='githubRefreshButton'
196209
placement={placement}

webapp/src/components/sidebar_right/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import {getSidebarData} from 'src/selectors';
1111
import SidebarRight from './sidebar_right.jsx';
1212

1313
function mapStateToProps(state) {
14-
const {username, reviews, yourPrs, yourAssignments, unreads, enterpriseURL, orgs, rhsState} = getSidebarData(state);
14+
const {username, mentions, reviews, yourPrs, yourAssignments, unreads, enterpriseURL, orgs, rhsState} = getSidebarData(state);
1515
return {
1616
username,
1717
reviews,
1818
yourPrs,
19+
mentions,
1920
yourAssignments,
2021
unreads,
2122
enterpriseURL,

webapp/src/components/sidebar_right/sidebar_right.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default class SidebarRight extends React.PureComponent {
6868
username: PropTypes.string,
6969
orgs: PropTypes.array.isRequired,
7070
enterpriseURL: PropTypes.string,
71+
mentions: PropTypes.arrayOf(PropTypes.object),
7172
reviews: PropTypes.arrayOf(PropTypes.object),
7273
unreads: PropTypes.arrayOf(PropTypes.object),
7374
yourPrs: PropTypes.arrayOf(PropTypes.object),
@@ -107,7 +108,7 @@ export default class SidebarRight extends React.PureComponent {
107108
orgQuery += ('+org%3A' + org);
108109
return orgQuery;
109110
});
110-
const {yourPrs, reviews, unreads, yourAssignments, username, rhsState} = this.props;
111+
const {yourPrs, mentions, reviews, unreads, yourAssignments, username, rhsState} = this.props;
111112

112113
let title = '';
113114
let githubItems = [];
@@ -120,6 +121,13 @@ export default class SidebarRight extends React.PureComponent {
120121
title = 'Your Open Pull Requests';
121122
listUrl = baseURL + '/pulls?q=is%3Aopen+is%3Apr+author%3A' + username + '+archived%3Afalse' + orgQuery;
122123

124+
break;
125+
case RHSStates.MENTIONS:
126+
127+
githubItems = mentions;
128+
title = 'Your mentions';
129+
listUrl = baseURL + '/pulls?q=is%3Aopen+is%3Apr+mentions%3A' + username + '+archived%3Afalse' + orgQuery;
130+
123131
break;
124132
case RHSStates.REVIEWS:
125133

webapp/src/constants/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const RHSStates = {
1010
REVIEWS: 'reviews',
1111
UNREADS: 'unreads',
1212
ASSIGNMENTS: 'assignments',
13+
MENTIONS: 'mentions',
1314
};
1415

1516
export const ReviewState = {

webapp/src/selectors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const getSidebarData = createSelector(
5757
const {username, sidebarContent, reviewDetails, yourPrDetails, organizations, rhsState} = pluginState;
5858
return {
5959
username,
60+
mentions: sidebarContent.mentions || emptyArray,
6061
reviews: mapPrsToDetails(sidebarContent.reviews || emptyArray, reviewDetails),
6162
yourPrs: mapPrsToDetails(sidebarContent.prs || emptyArray, yourPrDetails),
6263
yourAssignments: sidebarContent.assignments || emptyArray,

webapp/src/types/github_types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export type UnreadsData = {
109109
}
110110

111111
export type SidebarContentData = {
112+
mentions: GithubIssueData[];
112113
prs: GithubIssueData[];
113114
reviews: GithubIssueData[];
114115
assignments: GithubIssueData[];
@@ -148,6 +149,7 @@ export type APIError = {
148149

149150
export type SidebarData = {
150151
username: string;
152+
mentions: GithubIssueData[];
151153
reviews: GithubIssueData[];
152154
yourPrs: GithubIssueData[];
153155
yourAssignments: GithubIssueData[],

0 commit comments

Comments
 (0)