Skip to content

Commit 6471eaa

Browse files
author
Vikas Agarwal
committed
feat: adding audit fields for quick info in list view
1 parent 378ede6 commit 6471eaa

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

src/components/ChallengesComponent/ChallengeCard/ChallengeCard.module.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
flex: 6;
8686
flex-wrap: nowrap;
8787
display: flex;
88+
text-decoration: none;
8889

8990
.name {
9091
flex:1;
@@ -102,6 +103,7 @@
102103
flex-direction: column;
103104
justify-content: center;
104105
align-items: center;
106+
text-decoration: none;
105107
}
106108

107109
.col3 {
@@ -180,6 +182,26 @@
180182
}
181183
}
182184
}
185+
186+
.createdAt {
187+
color: $gray;
188+
font-size: 10px;
189+
190+
&:hover {
191+
text-decoration: none;
192+
}
193+
}
194+
195+
.lastUpdated {
196+
text-decoration: none;
197+
.lastUpdatedAt {
198+
color: $tc-black;
199+
}
200+
.lastUpdatedBy {
201+
color: $gray;
202+
font-size: 10px;
203+
}
204+
}
183205
}
184206

185207
.activateButton {

src/components/ChallengesComponent/ChallengeCard/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { faFile, faUser } from '@fortawesome/free-solid-svg-icons'
1313
import ChallengeStatus from '../ChallengeStatus'
1414
import ChallengeTag from '../ChallengeTag'
1515
import styles from './ChallengeCard.module.scss'
16-
import { getFormattedDuration } from '../../../util/date'
16+
import { getFormattedDuration, formatDate } from '../../../util/date'
1717
import { CHALLENGE_STATUS, COMMUNITY_APP_URL, DIRECT_PROJECT_URL, ONLINE_REVIEW_URL } from '../../../config/constants'
1818
import { patchChallenge } from '../../../services/challenges'
1919
import ConfirmationModal from '../../Modal/ConfirmationModal'
@@ -172,6 +172,15 @@ const renderStatus = (status) => {
172172
}
173173
}
174174

175+
const renderLastUpdated = (challenge) => {
176+
return (
177+
<Link className={cn(styles.col2, styles.lastUpdated)} to={`/projects/${challenge.projectId}/challenges/${challenge.id}/view`}>
178+
<div className={styles.lastUpdatedAt}>{formatDate(challenge.updated)}</div>
179+
<div className={styles.lastUpdatedBy}>{challenge.updatedBy}</div>
180+
</Link>
181+
)
182+
}
183+
175184
class ChallengeCard extends React.Component {
176185
constructor (props) {
177186
super(props)
@@ -248,8 +257,10 @@ class ChallengeCard extends React.Component {
248257
<div className={styles.name}>
249258
<span className={styles.block}>{challenge.name}</span>
250259
<ChallengeTag track={challenge.trackId} challengeType={challenge.type} />
260+
<span className={styles.createdAt}>{`Created by ${challenge.createdBy} at ${formatDate(challenge.created)}`}</span>
251261
</div>
252262
</Link>
263+
{renderLastUpdated(challenge)}
253264
<Link className={styles.col2} to={`/projects/${challenge.projectId}/challenges/${challenge.id}/view`}>
254265
{renderStatus(challenge.status.toUpperCase())}
255266
</Link>

src/components/ChallengesComponent/ChallengeList/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ class ChallengeList extends Component {
192192
challenges.length > 0 && (
193193
<div className={styles.header}>
194194
<div className={styles.col1}>Challenges Name</div>
195+
<div className={styles.col2}>Last Updated</div>
195196
<div className={styles.col2}>Status</div>
196197
{(selectedTab === 0) && (<div className={styles.col3}>Current phase</div>)}
197198
<div className={styles.col4}>&nbsp;</div>

src/util/date.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ export const getLastDate = (dates) => {
1717
return Math.max(...dates)
1818
}
1919

20+
/**
21+
* Get formatted date
22+
* @param {Date} date date to be formatted
23+
* @returns formatted Date
24+
*/
25+
export const formatDate = (date) => {
26+
return moment(date).format('DD/MM/YYYY')
27+
}
28+
2029
/**
2130
* Formats duration
2231
* @param duration Duration

0 commit comments

Comments
 (0)