git4refactor
filip mertens 7 months ago
parent 74a872f0ac
commit 0a6c952726
  1. 16
      libs/remix-ui/git/src/components/navigation/commitdetails.tsx
  2. 5
      libs/remix-ui/git/src/components/panels/commits/commitsummary.tsx

@ -5,12 +5,12 @@ import { CommitSummary } from "../panels/commits/commitsummary";
import { ReadCommitResult } from "isomorphic-git"
interface CommitDetailsNavigationProps {
commit: ReadCommitResult,
checkout: (oid: string) => void
eventKey: string
activePanel: string
callback: (eventKey: string) => void
isAheadOfRepo: boolean
commit: ReadCommitResult,
checkout: (oid: string) => void
eventKey: string
activePanel: string
callback: (eventKey: string) => void
isAheadOfRepo: boolean
}
export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) => {
@ -25,12 +25,12 @@ export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) =>
}
return (
<>
<div onClick={() => handleClick()} role={'button'} className={`pointer mb-2 mt-2 w-100 d-flex flex-row commit-navigation ${isAheadOfRepo? 'text-success':''}`}>
<div onClick={() => handleClick()} role={'button'} className={`pointer mb-2 mt-2 w-100 d-flex flex-row commit-navigation ${isAheadOfRepo ? 'text-success' : ''}`}>
{
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon>
}
<CommitSummary commit={commit} checkout={checkout}></CommitSummary>
<CommitSummary isAheadOfRepo={isAheadOfRepo} commit={commit} checkout={checkout}></CommitSummary>
</div>
</>
);

@ -10,10 +10,11 @@ import { gitPluginContext } from "../../gitui";
export interface CommitSummaryProps {
commit: ReadCommitResult;
checkout: (oid: string) => void;
isAheadOfRepo: boolean
}
export const CommitSummary = (props: CommitSummaryProps) => {
const { commit, checkout } = props;
const { commit, checkout, isAheadOfRepo } = props;
const context = React.useContext(gitPluginContext)
const getDate = (commit: ReadCommitResult) => {
@ -60,7 +61,7 @@ export const CommitSummary = (props: CommitSummaryProps) => {
</div>
{commit.commit.author.name || ""}
<span className="ml-1">{getDate(commit)}</span>
{getRemote() && getRemote()?.url && <GitUIButton className="btn btn-sm p-0 mx-1 text-muted" onClick={() => openRemote()}><FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon></GitUIButton>}
{getRemote() && getRemote()?.url && !isAheadOfRepo && <GitUIButton className="btn btn-sm p-0 text-muted ml-1" onClick={() => openRemote()}><FontAwesomeIcon icon={faGlobe} ></FontAwesomeIcon></GitUIButton>}
</>
)
}
Loading…
Cancel
Save