|
|
@ -1,4 +1,4 @@ |
|
|
|
import { commitChange } from "../../../types"; |
|
|
|
import { branch, commitChange } from "../../../types"; |
|
|
|
import React from "react"; |
|
|
|
import React from "react"; |
|
|
|
import path from "path"; |
|
|
|
import path from "path"; |
|
|
|
import { gitActionsContext, pluginActionsContext } from "../../../state/context"; |
|
|
|
import { gitActionsContext, pluginActionsContext } from "../../../state/context"; |
|
|
@ -8,10 +8,11 @@ import { faGlobe } from "@fortawesome/free-solid-svg-icons"; |
|
|
|
export interface CCommitDetailsItemsProps { |
|
|
|
export interface CCommitDetailsItemsProps { |
|
|
|
commitChange: commitChange; |
|
|
|
commitChange: commitChange; |
|
|
|
isAheadOfRepo: boolean; |
|
|
|
isAheadOfRepo: boolean; |
|
|
|
|
|
|
|
openFileOnRemote: (file: string, hash: string) => void; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
const { commitChange, isAheadOfRepo } = props; |
|
|
|
const { commitChange, isAheadOfRepo, openFileOnRemote } = props; |
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
const pluginActions = React.useContext(pluginActionsContext) |
|
|
|
const pluginActions = React.useContext(pluginActionsContext) |
|
|
|
|
|
|
|
|
|
|
@ -22,6 +23,10 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
await pluginActions.openDiff(change) |
|
|
|
await pluginActions.openDiff(change) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const openRemote = () => { |
|
|
|
|
|
|
|
openFileOnRemote(commitChange.path, commitChange.hashModified) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function FunctionStatusIcons() { |
|
|
|
function FunctionStatusIcons() { |
|
|
|
const status = commitChange.type |
|
|
|
const status = commitChange.type |
|
|
|
return (<> |
|
|
|
return (<> |
|
|
@ -33,13 +38,14 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => { |
|
|
|
</>) |
|
|
|
</>) |
|
|
|
} |
|
|
|
} |
|
|
|
return (<> |
|
|
|
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)}> |
|
|
|
<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> |
|
|
|
<span className='font-weight-bold long-and-truncated'>{path.basename(commitChange.path)}</span> |
|
|
|
<div className='text-secondary long-and-truncated'> {commitChange.path}</div> |
|
|
|
<div className='text-secondary long-and-truncated'> {commitChange.path}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="d-flex align-items-end"> |
|
|
|
<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> |
|
|
|
<FunctionStatusIcons></FunctionStatusIcons> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|