1- import React from 'react' ;
1+ import React , { useCallback } from 'react' ;
22import styled from 'styled-components' ;
33import { view } from '@risingstack/react-easy-state' ;
44
55import appStore from 'webviews/store/appStore' ;
66import { Avatar , AuthorLink } from 'webviews/components/User' ;
7- import PlusIcon from 'webviews/assets/plus.svg' ;
8- import CheckIcon from 'webviews/assets/check.svg' ;
9- import DeleteIcon from 'webviews/assets/delete.svg' ;
7+ import EditIcon from 'webviews/assets/edit.svg' ;
108
119const Title = styled . div `
1210 margin-top: 15px;
@@ -21,10 +19,6 @@ const Item = styled(FlexCenter)`
2119 padding: 5px 0;
2220 justify-content: space-between;
2321
24- :hover {
25- cursor: pointer;
26- }
27-
2822 a:first-child {
2923 margin-right: 5px;
3024 }
@@ -51,24 +45,24 @@ const IconButton = styled.button`
5145 fill: var(--vscode-foreground);
5246 }
5347` ;
54- const Check = styled ( CheckIcon ) `
55- svg path {
56- fill: var(--vscode-button-background);
57- }
58- ` ;
5948
6049function Reviewers ( ) {
61- const { reviewers } = appStore ;
50+ const { reviewers, currentMR } = appStore ;
6251 const { reviewers : rReviewers = [ ] , volunteer_reviewers : volunteerReviewers = [ ] } = reviewers ;
6352 const allReviewers = [ ...rReviewers , ...volunteerReviewers ] ;
64- const { addReviewers } = appStore ;
53+ const { updateReviewers } = appStore ;
54+
55+ const onUpdateReviewer = useCallback ( ( ) => {
56+ const list = allReviewers . map ( ( i ) => i . reviewer . id ) ;
57+ updateReviewers ( currentMR . iid , list ) ;
58+ } , [ allReviewers ] ) ;
6559
6660 return (
6761 < div >
6862 < Title >
6963 Reviewers
70- < IconButton onClick = { addReviewers } >
71- < PlusIcon />
64+ < IconButton onClick = { onUpdateReviewer } >
65+ < EditIcon />
7266 </ IconButton >
7367 </ Title >
7468 { allReviewers . map ( ( r ) => {
@@ -78,10 +72,7 @@ function Reviewers() {
7872 < Avatar for = { r . reviewer } />
7973 < AuthorLink for = { r . reviewer } />
8074 </ FlexCenter >
81- { r . value === 100 && < Check /> }
82- < IconButton >
83- < DeleteIcon />
84- </ IconButton >
75+ { r . value === 100 && `👍` }
8576 </ Item >
8677 ) ;
8778 } ) }
0 commit comments