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" import { ReadCommitResult } from "isomorphic-git"
interface CommitDetailsNavigationProps { interface CommitDetailsNavigationProps {
commit: ReadCommitResult, commit: ReadCommitResult,
checkout: (oid: string) => void checkout: (oid: string) => void
eventKey: string eventKey: string
activePanel: string activePanel: string
callback: (eventKey: string) => void callback: (eventKey: string) => void
isAheadOfRepo: boolean isAheadOfRepo: boolean
} }
export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) => { export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) => {
@ -25,12 +25,12 @@ export const CommitDetailsNavigation = (props: CommitDetailsNavigationProps) =>
} }
return ( 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> 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> </div>
</> </>
); );

@ -10,10 +10,11 @@ import { gitPluginContext } from "../../gitui";
export interface CommitSummaryProps { export interface CommitSummaryProps {
commit: ReadCommitResult; commit: ReadCommitResult;
checkout: (oid: string) => void; checkout: (oid: string) => void;
isAheadOfRepo: boolean
} }
export const CommitSummary = (props: CommitSummaryProps) => { export const CommitSummary = (props: CommitSummaryProps) => {
const { commit, checkout } = props; const { commit, checkout, isAheadOfRepo } = props;
const context = React.useContext(gitPluginContext) const context = React.useContext(gitPluginContext)
const getDate = (commit: ReadCommitResult) => { const getDate = (commit: ReadCommitResult) => {
@ -60,7 +61,7 @@ export const CommitSummary = (props: CommitSummaryProps) => {
</div> </div>
{commit.commit.author.name || ""} {commit.commit.author.name || ""}
<span className="ml-1">{getDate(commit)}</span> <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