@@ -12,7 +12,9 @@ import CardFooter from '../../components/Card/CardFooter';
1212import Button from '../../components/CustomButtons/Button' ;
1313import Diff from './components/Diff' ;
1414import Attestation from './components/Attestation' ;
15- import AttestationView from './components/AttestationView' ;
15+ import AttestationInfo from './components/AttestationInfo' ;
16+ import RejectionInfo from './components/RejectionInfo' ;
17+ import Reject from './components/Reject' ;
1618import Table from '@material-ui/core/Table' ;
1719import TableBody from '@material-ui/core/TableBody' ;
1820import TableHead from '@material-ui/core/TableHead' ;
@@ -21,11 +23,9 @@ import TableCell from '@material-ui/core/TableCell';
2123import { getPush , authorisePush , rejectPush , cancelPush } from '../../services/git-push' ;
2224import { CheckCircle , Visibility , Cancel , Block } from '@material-ui/icons' ;
2325import Snackbar from '@material-ui/core/Snackbar' ;
24- import Tooltip from '@material-ui/core/Tooltip' ;
25- import { AttestationFormData , PushActionView } from '../../types' ;
26+ import { PushActionView } from '../../types' ;
2627import { trimPrefixRefsHeads , trimTrailingDotGit } from '../../../db/helper' ;
2728import { generateEmailLink , getGitProvider } from '../../utils' ;
28- import UserLink from '../../components/UserLink/UserLink' ;
2929
3030const Dashboard : React . FC = ( ) => {
3131 const { id } = useParams < { id : string } > ( ) ;
@@ -62,9 +62,9 @@ const Dashboard: React.FC = () => {
6262 }
6363 } ;
6464
65- const reject = async ( ) => {
65+ const reject = async ( reason : string ) => {
6666 if ( ! id ) return ;
67- await rejectPush ( id , setMessage , setUserAllowedToReject ) ;
67+ await rejectPush ( id , setMessage , setUserAllowedToReject , reason ) ;
6868 if ( isUserAllowedToReject ) {
6969 navigate ( '/dashboard/push/' ) ;
7070 }
@@ -153,91 +153,17 @@ const Dashboard: React.FC = () => {
153153 < Button color = 'warning' onClick = { cancel } >
154154 Cancel
155155 </ Button >
156- < Button color = 'danger' onClick = { reject } >
157- Reject
158- </ Button >
156+ < Reject rejectFn = { reject } />
159157 < Attestation approveFn = { authorise } />
160158 </ div >
161159 ) }
162- { push . attestation && push . authorised && (
163- < div
164- style = { {
165- background : '#eee' ,
166- padding : '10px 20px 10px 20px' ,
167- borderRadius : '10px' ,
168- color : 'black' ,
169- marginTop : '15px' ,
170- float : 'right' ,
171- position : 'relative' ,
172- textAlign : 'left' ,
173- } }
174- >
175- < span style = { { position : 'absolute' , top : 0 , right : 0 } } >
176- < CheckCircle
177- style = { {
178- cursor : push . autoApproved ? 'default' : 'pointer' ,
179- transform : 'scale(0.65)' ,
180- opacity : push . autoApproved ? 0.5 : 1 ,
181- } }
182- onClick = { ( ) => {
183- if ( ! push . autoApproved ) {
184- setAttestation ( true ) ;
185- }
186- } }
187- htmlColor = 'green'
188- />
189- </ span >
190-
191- { push . autoApproved ? (
192- < div style = { { paddingTop : '15px' } } >
193- < p >
194- < strong > Auto-approved by system</ strong >
195- </ p >
196- </ div >
197- ) : (
198- < >
199- { isGitHub && (
200- < UserLink username = { push . attestation . reviewer . username } >
201- < img
202- style = { { width : '45px' , borderRadius : '20px' } }
203- src = { `https://github.com/${ push . attestation . reviewer . gitAccount } .png` }
204- />
205- </ UserLink >
206- ) }
207- < div >
208- < p >
209- { isGitHub && (
210- < UserLink username = { push . attestation . reviewer . username } >
211- { push . attestation . reviewer . gitAccount }
212- </ UserLink >
213- ) }
214- { ! isGitHub && < UserLink username = { push . attestation . reviewer . username } /> } { ' ' }
215- approved this contribution
216- </ p >
217- </ div >
218- </ >
219- ) }
220-
221- < Tooltip
222- title = { moment ( push . attestation . timestamp ) . format (
223- 'dddd, MMMM Do YYYY, h:mm:ss a' ,
224- ) }
225- arrow
226- >
227- < kbd style = { { color : 'black' , float : 'right' } } >
228- { moment ( push . attestation . timestamp ) . fromNow ( ) }
229- </ kbd >
230- </ Tooltip >
231-
232- { ! push . autoApproved && (
233- < AttestationView
234- data = { push . attestation as AttestationFormData }
235- attestation = { attestation }
236- setAttestation = { setAttestation }
237- />
238- ) }
239- </ div >
240- ) }
160+ < AttestationInfo
161+ push = { push }
162+ isGitHub = { isGitHub }
163+ attestation = { attestation }
164+ setAttestation = { setAttestation }
165+ />
166+ < RejectionInfo push = { push } />
241167 </ CardHeader >
242168 < CardBody >
243169 < GridContainer >
0 commit comments