handleClick()} role={'button'} className='pointer mb-2 mt-2 w-100 d-flex flex-row commit-navigation'>
+
handleClick()} role={'button'} className={`pointer mb-2 mt-2 w-100 d-flex flex-row commit-navigation ${isAheadOfRepo? 'text-success':''}`}>
{
activePanel === eventKey ?
:
}
diff --git a/libs/remix-ui/git/src/components/navigation/commits.tsx b/libs/remix-ui/git/src/components/navigation/commits.tsx
index bbb090ee2f..536c99a0c4 100644
--- a/libs/remix-ui/git/src/components/navigation/commits.tsx
+++ b/libs/remix-ui/git/src/components/navigation/commits.tsx
@@ -1,4 +1,4 @@
-import { faCaretDown, faArrowUp, faArrowDown, faArrowRotateRight, faCaretRight, faArrowsUpDown } from "@fortawesome/free-solid-svg-icons";
+import { faCaretDown, faArrowUp, faArrowDown, faArrowRotateRight, faCaretRight, faArrowsUpDown, faCloudArrowUp, faCloudArrowDown } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { CustomTooltip } from "@remix-ui/helper";
import React, { useEffect } from "react";
@@ -11,15 +11,18 @@ import { gitPluginContext } from "../gitui";
import LoaderIndicator from "./loaderindicator";
export interface CommitsNavigationProps {
- title: string,
- eventKey: string,
- activePanel: string,
- callback: (eventKey: string) => void
- branch?: branch,
- remote?: remote
+ title: string,
+ eventKey: string,
+ activePanel: string,
+ callback: (eventKey: string) => void
+ branch?: branch,
+ remote?: remote
+ showButtons?: boolean
+ ahead?: boolean,
+ behind?: boolean,
}
-export const CommitsNavigation = ({ eventKey, activePanel, callback, title, branch, remote }: CommitsNavigationProps) => {
+export const CommitsNavigation = ({ eventKey, activePanel, callback, title, branch, remote, showButtons, ahead, behind }: CommitsNavigationProps) => {
const pluginactions = React.useContext(pluginActionsContext)
const [pullEnabled, setPullEnabled] = React.useState(true)
const [pushEnabled, setPushEnabled] = React.useState(true)
@@ -38,19 +41,21 @@ export const CommitsNavigation = ({ eventKey, activePanel, callback, title, bran
return (
<>
-
-
handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'>
+
+ handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-100'>
{
activePanel === eventKey ? :
}
-
+ {ahead? : null}
+ {behind? : null}
+
-
-
-
-
+ {showButtons ?
+
+
+ : null}
>
diff --git a/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx b/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx
index ef5c03e1b0..3aa506071b 100644
--- a/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx
+++ b/libs/remix-ui/git/src/components/navigation/remotesdetails.tsx
@@ -1,5 +1,6 @@
import { faCaretDown, faCaretRight, faArrowRightArrowLeft, faGlobe, faToggleOff, faToggleOn, faTrash, faCheck, faSync } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { CustomTooltip } from "@remix-ui/helper";
import React, { useContext, useEffect } from "react";
import { gitActionsContext } from "../../state/context";
import { branch, remote } from "../../types";
@@ -42,13 +43,15 @@ export const RemotesDetailsNavigation = (props: RemotesDetailsNavigationProps) =
{
activePanel === eventKey ? :
}
-
- {remote.remote} {remote.url}
-
+
+
+ {remote.remote} {remote.url}
+
+
{context.defaultRemote && context.defaultRemote?.url === remote.url ?
-
{}} disabledCondition={true}>
+
{ }} disabledCondition={true}>
:
}
diff --git a/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx b/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx
index 2436ef08bc..0a3ecb200d 100644
--- a/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx
+++ b/libs/remix-ui/git/src/components/panels/branches/branchdifferencedetails.tsx
@@ -11,10 +11,12 @@ export interface BrancheDifferenceProps {
title: string,
remote?: remote,
branch?: branch
+ ahead?: boolean,
+ behind?: boolean
}
export const BranchDifferenceDetails = (props: BrancheDifferenceProps) => {
- const { commits, title, branch, remote } = props;
+ const { commits, title, branch, remote, ahead, behind } = props;
const [activePanel, setActivePanel] = useState
("");
const actions = React.useContext(gitActionsContext)
@@ -26,12 +28,12 @@ export const BranchDifferenceDetails = (props: BrancheDifferenceProps) => {
return (
-
+
{commits && commits.map((commit, index) => {
return (
- {}} commit={commit}>
+ {}} commit={commit}>
);
})}
diff --git a/libs/remix-ui/git/src/components/panels/branches/branchdifferences.tsx b/libs/remix-ui/git/src/components/panels/branches/branchdifferences.tsx
index 6923cb70c8..ab3a1c95ab 100644
--- a/libs/remix-ui/git/src/components/panels/branches/branchdifferences.tsx
+++ b/libs/remix-ui/git/src/components/panels/branches/branchdifferences.tsx
@@ -7,42 +7,41 @@ import { BranchDifferenceDetails } from "./branchdifferencedetails";
export interface BrancheDetailsProps {
branch: branch;
showSummary?: boolean;
- remote?: remote;
}
export const BranchDifferences = (props: BrancheDetailsProps) => {
- const { branch, showSummary, remote } = props;
+ const { branch, showSummary } = props;
const context = React.useContext(gitPluginContext)
useEffect(() => {
console.log('GET BRANCH DIFF', branch)
}, [])
+ const getRemote = (): remote | null => {
+ return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
+ }
+
useEffect(() => {
console.log('BRANCH DIFF', context.branchDifferences)
}, [context.branchDifferences])
const commitsAhead = (remote: remote) => {
+ if(!remote) return [];
return context.branchDifferences[`${remote.remote}/${branch.name}`]?.uniqueHeadCommits || [];
}
const commitsBehind = (remote: remote) => {
+ if(!remote) return [];
return context.branchDifferences[`${remote.remote}/${branch.name}`]?.uniqueRemoteCommits || [];
}
+ if(!getRemote()) return null;
+
return (
- <>
- {!showSummary && context.remotes.map((remote, index) => {
- return (
-
-
-
- {commitsAhead(remote).length === 0 && commitsBehind(remote).length === 0? null:
}
-
- );
- })}
- {showSummary && summary
}
-
- >
- );
+
+
+
+
+ {commitsAhead(getRemote()).length === 0 && commitsBehind(getRemote()).length === 0 ? null :
}
+ )
}
\ No newline at end of file
diff --git a/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx b/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
index e957e512b8..c7a27a645e 100644
--- a/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
+++ b/libs/remix-ui/git/src/components/panels/branches/localbranchdetails.tsx
@@ -67,7 +67,7 @@ export const LocalBranchDetails = (props: BrancheDetailsProps) => {
{context.localBranchCommits && Object.entries(context.localBranchCommits).map(([key, value]) => {
if (key == branch.name) {
return value.map((commit, index) => {
- return ()
+ return ()
})
}
})}
diff --git a/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx b/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
index 814a50c279..f14f19ad51 100644
--- a/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
+++ b/libs/remix-ui/git/src/components/panels/branches/remotebranchedetails.tsx
@@ -87,7 +87,7 @@ export const RemoteBranchDetails = (props: BrancheDetailsProps) => {
if (key == branch.name) {
return value.map((page, index) => {
return page.commits.map((commit, index) => {
- return ()
+ return ()
})
})
}
diff --git a/libs/remix-ui/git/src/components/panels/commits.tsx b/libs/remix-ui/git/src/components/panels/commits.tsx
index 30a8c615e4..e0d82e4e3f 100644
--- a/libs/remix-ui/git/src/components/panels/commits.tsx
+++ b/libs/remix-ui/git/src/components/panels/commits.tsx
@@ -44,7 +44,7 @@ export const Commits = () => {
{context.commits && context.commits.map((commit, index) => {
return (
-
+
);
})}
diff --git a/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx b/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx
index f7b03bcea6..bc037d6c40 100644
--- a/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx
+++ b/libs/remix-ui/git/src/components/panels/commits/commitdetails.tsx
@@ -5,15 +5,17 @@ import { CommitDetailsNavigation } from "../../navigation/commitdetails";
import { gitActionsContext } from "../../../state/context";
import { gitPluginContext } from "../../gitui";
import { CommitDetailsItems } from "./commitdetailsitem";
+import { branch, remote } from "@remix-ui/git";
export interface CommitDetailsProps {
commit: ReadCommitResult;
checkout: (oid: string) => void;
getCommitChanges: (commit: ReadCommitResult) => void;
+ branch: branch
}
export const CommitDetails = (props: CommitDetailsProps) => {
- const { commit, checkout, getCommitChanges } = props;
+ const { commit, checkout, getCommitChanges, branch } = props;
const actions = React.useContext(gitActionsContext)
const context = React.useContext(gitPluginContext)
const [activePanel, setActivePanel] = useState("");
@@ -25,14 +27,27 @@ export const CommitDetails = (props: CommitDetailsProps) => {
}
}, [activePanel])
+ const getRemote = (): remote | null => {
+ return context.upstream ? context.upstream : context.defaultRemote ? context.defaultRemote : null
+ }
+
+ const commitsAhead = (remote: remote) => {
+ if(!remote) return [];
+ return context.branchDifferences[`${remote.remote}/${branch.name}`]?.uniqueHeadCommits || [];
+ }
+
+ const isAheadOfRepo = () => {
+ return commitsAhead(getRemote()).findIndex((c) => c.oid === commit.oid) > -1
+ }
+
return (
-
+
<>
{context.commitChanges && context.commitChanges.filter(
(change) => change.hashModified === commit.oid && change.hashOriginal === commit.commit.parent[0]
).map((change, index) => {
- return ()
+ return ()
})}
>
diff --git a/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx b/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx
index d031a0d89d..8d5d0e904a 100644
--- a/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx
+++ b/libs/remix-ui/git/src/components/panels/commits/commitdetailsitem.tsx
@@ -7,10 +7,11 @@ import { faGlobe } from "@fortawesome/free-solid-svg-icons";
export interface CCommitDetailsItemsProps {
commitChange: commitChange;
+ isAheadOfRepo: boolean;
}
export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => {
- const { commitChange } = props;
+ const { commitChange, isAheadOfRepo } = props;
const actions = React.useContext(gitActionsContext)
const pluginActions = React.useContext(pluginActionsContext)
@@ -32,7 +33,7 @@ export const CommitDetailsItems = (props: CCommitDetailsItemsProps) => {
>)
}
return (<>
-
+
await openChanges(commitChange)}>
{path.basename(commitChange.path)}
{commitChange.path}