|
6 | 6 | import React, { useContext, useRef, useState } from 'react'; |
7 | 7 | import { CommentView } from './comment'; |
8 | 8 | import Diff from './diff'; |
9 | | -import { addIcon, errorIcon, gitCommitIcon, gitMergeIcon, loadingIcon, tasklistIcon, threeBars } from './icon'; |
| 9 | +import { addIcon, checkIcon, circleFilledIcon, closeIcon, errorIcon, gitCommitIcon, gitMergeIcon, loadingIcon, tasklistIcon, threeBars } from './icon'; |
10 | 10 | import { nbsp } from './space'; |
11 | 11 | import { Timestamp } from './timestamp'; |
12 | 12 | import { AuthorLink, Avatar } from './user'; |
@@ -105,6 +105,20 @@ export const Timeline = ({ events, isIssue }: { events: TimelineEvent[], isIssue |
105 | 105 |
|
106 | 106 | export default Timeline; |
107 | 107 |
|
| 108 | + |
| 109 | +function CommitStateIcon({ status }: { status: 'EXPECTED' | 'ERROR' | 'FAILURE' | 'PENDING' | 'SUCCESS' | undefined; }) { |
| 110 | + switch (status) { |
| 111 | + case 'PENDING': |
| 112 | + return circleFilledIcon; |
| 113 | + case 'SUCCESS': |
| 114 | + return checkIcon; |
| 115 | + case 'FAILURE': |
| 116 | + case 'ERROR': |
| 117 | + return closeIcon; |
| 118 | + } |
| 119 | + return null; |
| 120 | +} |
| 121 | + |
108 | 122 | const CommitEventView = (event: CommitEvent) => { |
109 | 123 | const context = useContext(PullRequestContext); |
110 | 124 | const [clickedElement, setClickedElement] = useState<'title' | 'sha' | undefined>(undefined); |
@@ -139,6 +153,9 @@ const CommitEventView = (event: CommitEvent) => { |
139 | 153 | </div> |
140 | 154 | </div> |
141 | 155 | <div className="timeline-detail"> |
| 156 | + <div className='status-section'> |
| 157 | + <CommitStateIcon status={event.status} /> |
| 158 | + </div> |
142 | 159 | <a |
143 | 160 | className="sha" |
144 | 161 | onClick={(e) => handleCommitClick(e, 'sha')} |
|
0 commit comments