@@ -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' ;
@@ -22,11 +24,9 @@ import { getPush, authorisePush, rejectPush, cancelPush } from '../../services/g
2224import type { ServiceResult } from '../../services/errors' ;
2325import { CheckCircle , Visibility , Cancel , Block } from '@material-ui/icons' ;
2426import Snackbar from '@material-ui/core/Snackbar' ;
25- import Tooltip from '@material-ui/core/Tooltip' ;
26- import { AttestationFormData , PushActionView } from '../../types' ;
27+ import { PushActionView } from '../../types' ;
2728import { trimPrefixRefsHeads , trimTrailingDotGit } from '../../../db/helper' ;
2829import { generateEmailLink , getGitProvider } from '../../utils' ;
29- import UserLink from '../../components/UserLink/UserLink' ;
3030
3131const Dashboard : React . FC = ( ) => {
3232 const { id } = useParams < { id : string } > ( ) ;
@@ -75,9 +75,9 @@ const Dashboard: React.FC = () => {
7575 handleActionFailure ( result ) ;
7676 } ;
7777
78- const reject = async ( ) => {
78+ const reject = async ( reason : string ) => {
7979 if ( ! id ) return ;
80- const result = await rejectPush ( id ) ;
80+ const result = await rejectPush ( id , reason ) ;
8181 if ( result . success ) {
8282 navigate ( '/dashboard/push/' ) ;
8383 return ;
@@ -172,91 +172,17 @@ const Dashboard: React.FC = () => {
172172 < Button color = 'warning' onClick = { cancel } >
173173 Cancel
174174 </ Button >
175- < Button color = 'danger' onClick = { reject } >
176- Reject
177- </ Button >
175+ < Reject rejectFn = { reject } />
178176 < Attestation approveFn = { authorise } />
179177 </ div >
180178 ) }
181- { push . attestation && push . authorised && (
182- < div
183- style = { {
184- background : '#eee' ,
185- padding : '10px 20px 10px 20px' ,
186- borderRadius : '10px' ,
187- color : 'black' ,
188- marginTop : '15px' ,
189- float : 'right' ,
190- position : 'relative' ,
191- textAlign : 'left' ,
192- } }
193- >
194- < span style = { { position : 'absolute' , top : 0 , right : 0 } } >
195- < CheckCircle
196- style = { {
197- cursor : push . autoApproved ? 'default' : 'pointer' ,
198- transform : 'scale(0.65)' ,
199- opacity : push . autoApproved ? 0.5 : 1 ,
200- } }
201- onClick = { ( ) => {
202- if ( ! push . autoApproved ) {
203- setAttestation ( true ) ;
204- }
205- } }
206- htmlColor = 'green'
207- />
208- </ span >
209-
210- { push . autoApproved ? (
211- < div style = { { paddingTop : '15px' } } >
212- < p >
213- < strong > Auto-approved by system</ strong >
214- </ p >
215- </ div >
216- ) : (
217- < >
218- { isGitHub && (
219- < UserLink username = { push . attestation . reviewer . username } >
220- < img
221- style = { { width : '45px' , borderRadius : '20px' } }
222- src = { `https://github.com/${ push . attestation . reviewer . gitAccount } .png` }
223- />
224- </ UserLink >
225- ) }
226- < div >
227- < p >
228- { isGitHub && (
229- < UserLink username = { push . attestation . reviewer . username } >
230- { push . attestation . reviewer . gitAccount }
231- </ UserLink >
232- ) }
233- { ! isGitHub && < UserLink username = { push . attestation . reviewer . username } /> } { ' ' }
234- approved this contribution
235- </ p >
236- </ div >
237- </ >
238- ) }
239-
240- < Tooltip
241- title = { moment ( push . attestation . timestamp ) . format (
242- 'dddd, MMMM Do YYYY, h:mm:ss a' ,
243- ) }
244- arrow
245- >
246- < kbd style = { { color : 'black' , float : 'right' } } >
247- { moment ( push . attestation . timestamp ) . fromNow ( ) }
248- </ kbd >
249- </ Tooltip >
250-
251- { ! push . autoApproved && (
252- < AttestationView
253- data = { push . attestation as AttestationFormData }
254- attestation = { attestation }
255- setAttestation = { setAttestation }
256- />
257- ) }
258- </ div >
259- ) }
179+ < AttestationInfo
180+ push = { push }
181+ isGitHub = { isGitHub }
182+ attestation = { attestation }
183+ setAttestation = { setAttestation }
184+ />
185+ < RejectionInfo push = { push } />
260186 </ CardHeader >
261187 < CardBody >
262188 < GridContainer >
0 commit comments