|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import { commitChange } from "../../../types"; |
|
|
|
|
import { branch, commitChange } from "../../../types"; |
|
|
|
|
import React from "react"; |
|
|
|
|
import path from "path"; |
|
|
|
|
import { gitActionsContext, pluginActionsContext } from "../../../state/context"; |
|
|
|
@ -8,10 +8,11 @@ import { faGlobe } from "@fortawesome/free-solid-svg-icons"; |
|
|
|
|
export interface CCommitDetailsItemsProps { |
|
|
|
|
commitChange: commitChange; |
|
|
|
|
isAheadOfRepo: boolean; |
|
|
|
|
openFileOnRemote: (file: string, hash: string) => void; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
|
const { commitChange, isAheadOfRepo } = props; |
|
|
|
|
const { commitChange, isAheadOfRepo, openFileOnRemote } = props; |
|
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
|
const pluginActions = React.useContext(pluginActionsContext) |
|
|
|
|
|
|
|
|
@ -22,6 +23,10 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
|
await pluginActions.openDiff(change) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const openRemote = () => { |
|
|
|
|
openFileOnRemote(commitChange.path, commitChange.hashModified) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function FunctionStatusIcons() { |
|
|
|
|
const status = commitChange.type |
|
|
|
|
return (<> |
|
|
|
@ -33,13 +38,14 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
|
</>) |
|
|
|
|
} |
|
|
|
|
return (<> |
|
|
|
|
<div className={`d-flex w-100 d-flex flex-row commitdetailsitem ${isAheadOfRepo? 'text-success':''}`}> |
|
|
|
|
<div className={`d-flex w-100 d-flex flex-row commitdetailsitem ${isAheadOfRepo ? 'text-success' : ''}`}> |
|
|
|
|
<div className='pointer gitfile long-and-truncated' onClick={async () => await openChanges(commitChange)}> |
|
|
|
|
<span className='font-weight-bold long-and-truncated'>{path.basename(commitChange.path)}</span> |
|
|
|
|
<div className='text-secondary long-and-truncated'> {commitChange.path}</div> |
|
|
|
|
</div> |
|
|
|
|
<div className="d-flex align-items-end"> |
|
|
|
|
<FontAwesomeIcon icon={faGlobe} className="mr-1 align-self-center" /> |
|
|
|
|
{!isAheadOfRepo ? |
|
|
|
|
<FontAwesomeIcon role={'button'} icon={faGlobe} onClick={() => openRemote()} className="pointer mr-1 align-self-center" /> : <></>} |
|
|
|
|
<FunctionStatusIcons></FunctionStatusIcons> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|