mirror of
https://github.com/harness/drone.git
synced 2025-05-04 21:49:09 +08:00
fix: [code-659]: change commit on pr page to be a link (#255)
This commit is contained in:
parent
302ba2dd7e
commit
6bbf7bba5c
@ -187,9 +187,9 @@ export const SpaceSelector: React.FC<SpaceSelectorProps> = ({ onSelect }) => {
|
||||
className={css.table}
|
||||
columns={columns}
|
||||
data={spaces || []}
|
||||
onRowClick={data => {
|
||||
onRowClick={spaceData => {
|
||||
setOpened(false)
|
||||
selectSpace({ uid: data?.space?.uid, path: data?.space?.path }, true)
|
||||
selectSpace({ uid: spaceData?.space?.uid, path: spaceData?.space?.path }, true)
|
||||
}}
|
||||
getRowClassName={row => cx(css.row, !row.original.space.description && css.noDesc)}
|
||||
/>
|
||||
|
@ -182,3 +182,8 @@
|
||||
color: var(--orange-300);
|
||||
}
|
||||
}
|
||||
|
||||
.commitLink {
|
||||
text-decoration: underline;
|
||||
color: var(--primary-7) !important;
|
||||
}
|
||||
|
@ -24,5 +24,6 @@ declare const styles: {
|
||||
readonly bp3Icon: string
|
||||
readonly repeatBtn: string
|
||||
readonly bp3ButtonText: string
|
||||
readonly commitLink: string
|
||||
}
|
||||
export default styles
|
||||
|
@ -202,6 +202,7 @@ export const Conversation: React.FC<ConversationProps> = ({
|
||||
key={`system-${threadId}`}
|
||||
pullRequestMetadata={pullRequestMetadata}
|
||||
commentItems={commentItems}
|
||||
repoMetadataPath={repoMetadata.path}
|
||||
/>
|
||||
}></ThreadSection>
|
||||
)
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
} from '@harness/uicore'
|
||||
import ReactTimeago from 'react-timeago'
|
||||
import { Render } from 'react-jsx-match'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { CodeIcon, GitInfoProps } from 'utils/GitUtils'
|
||||
import { MarkdownViewer } from 'components/MarkdownViewer/MarkdownViewer'
|
||||
import { useStrings } from 'framework/strings'
|
||||
@ -19,16 +20,23 @@ import type { TypesPullReqActivity } from 'services/code'
|
||||
import type { CommentItem } from 'components/CommentBox/CommentBox'
|
||||
import { formatDate, formatTime } from 'utils/Utils'
|
||||
import { CommentType } from 'components/DiffViewer/DiffViewerUtils'
|
||||
import { useAppContext } from 'AppContext'
|
||||
import css from './Conversation.module.scss'
|
||||
|
||||
interface SystemCommentProps extends Pick<GitInfoProps, 'pullRequestMetadata'> {
|
||||
commentItems: CommentItem<TypesPullReqActivity>[]
|
||||
repoMetadataPath?: string
|
||||
}
|
||||
|
||||
export const SystemComment: React.FC<SystemCommentProps> = ({ pullRequestMetadata, commentItems }) => {
|
||||
export const SystemComment: React.FC<SystemCommentProps> = ({
|
||||
pullRequestMetadata,
|
||||
commentItems,
|
||||
repoMetadataPath
|
||||
}) => {
|
||||
const { getString } = useStrings()
|
||||
const payload = commentItems[0].payload
|
||||
const type = payload?.type
|
||||
const { routes } = useAppContext()
|
||||
|
||||
switch (type) {
|
||||
case CommentType.MERGE: {
|
||||
@ -92,7 +100,16 @@ export const SystemComment: React.FC<SystemCommentProps> = ({ pullRequestMetadat
|
||||
str={getString('pr.prBranchPushInfo')}
|
||||
vars={{
|
||||
user: <strong>{payload?.author?.display_name}</strong>,
|
||||
commit: <strong>{(payload?.payload as Unknown)?.new}</strong>
|
||||
commit: (
|
||||
<Link
|
||||
className={css.commitLink}
|
||||
to={routes.toCODECommit({
|
||||
repoPath: repoMetadataPath as string,
|
||||
commitRef: (payload?.payload as Unknown)?.new
|
||||
})}>
|
||||
{(payload?.payload as Unknown)?.new.substring(0, 6)}
|
||||
</Link>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
|
@ -52,7 +52,7 @@ export const SignUp: React.FC = () => {
|
||||
showError(getErrorMessage(error))
|
||||
})
|
||||
},
|
||||
[mutate, setToken, showSuccess, showError, history, getString]
|
||||
[mutate, setToken, showSuccess, showError, getString]
|
||||
)
|
||||
|
||||
const handleSubmit = (data: RegisterForm): void => {
|
||||
|
Loading…
Reference in New Issue
Block a user