11import React , { useEffect , useState } from 'react' ;
22import axiosInstance from '../../../../utils/axiosInstance' ;
33
4+ // Font Awesome
5+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
6+ import { faClock , faUser } from '@fortawesome/free-solid-svg-icons' ;
7+
8+ // CoreUI
9+ import { CIcon } from '@coreui/icons-react' ;
10+ import { cilCheckCircle , cilXCircle } from '@coreui/icons' ;
11+
412const AgreementList = ( ) => {
513 const [ agreements , setAgreements ] = useState ( [ ] ) ;
614 const [ loading , setLoading ] = useState ( true ) ;
@@ -22,21 +30,39 @@ const AgreementList = () => {
2230 fetchAgreements ( ) ;
2331 } , [ ] ) ;
2432
25- if ( loading ) return < p > Loading agreements...</ p > ;
26- if ( error ) return < p > { error } </ p > ;
33+ if ( loading ) return < p > < FontAwesomeIcon icon = { faClock } /> Loading agreements...</ p > ;
34+ if ( error ) return < p style = { { color : 'red' } } > { error } </ p > ;
2735
2836 return (
29- < div >
30- < h2 > Agreements </ h2 >
37+ < div style = { { padding : '20px' } } >
38+ < h2 > < FontAwesomeIcon icon = { faUser } /> Agreement List </ h2 >
3139 { agreements . length === 0 ? (
3240 < p > No agreements found.</ p >
3341 ) : (
3442 < ul >
3543 { agreements . map ( ( agreement ) => (
36- < li key = { agreement . _id } >
37- < strong > Status:</ strong > { agreement . status } < br />
38- < strong > User ID:</ strong > { agreement . userId } < br />
39- < strong > Timestamp:</ strong > { new Date ( agreement . timestamp ) . toLocaleString ( ) }
44+ < li key = { agreement . _id } style = { { marginBottom : '15px' } } >
45+ < p >
46+ < strong > Status:</ strong > { ' ' }
47+ { agreement . status === 'accepted' ? (
48+ < span style = { { color : 'green' } } >
49+ < CIcon icon = { cilCheckCircle } /> Accepted
50+ </ span >
51+ ) : (
52+ < span style = { { color : 'red' } } >
53+ < CIcon icon = { cilXCircle } /> Rejected
54+ </ span >
55+ ) }
56+ </ p >
57+ < p >
58+ < FontAwesomeIcon icon = { faUser } /> < strong > User ID:</ strong > { agreement . userId }
59+ </ p >
60+ < p >
61+ < FontAwesomeIcon icon = { faClock } /> { ' ' }
62+ < strong > Timestamp:</ strong > { ' ' }
63+ { new Date ( agreement . timestamp ) . toLocaleString ( ) }
64+ </ p >
65+ < hr />
4066 </ li >
4167 ) ) }
4268 </ ul >
0 commit comments