|
|
@ -1,6 +1,7 @@ |
|
|
|
import { faCaretDown, faCaretRight, faArrowRightArrowLeft, faGlobe } from "@fortawesome/free-solid-svg-icons"; |
|
|
|
import { faCaretDown, faCaretRight, faArrowRightArrowLeft, faGlobe, faToggleOff, faToggleOn } from "@fortawesome/free-solid-svg-icons"; |
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
|
|
|
import React, { useContext, useEffect } from "react"; |
|
|
|
import React, { useContext, useEffect } from "react"; |
|
|
|
|
|
|
|
import { gitActionsContext } from "../../state/context"; |
|
|
|
import { branch, remote } from "../../types"; |
|
|
|
import { branch, remote } from "../../types"; |
|
|
|
import { gitPluginContext } from "../gitui"; |
|
|
|
import { gitPluginContext } from "../gitui"; |
|
|
|
|
|
|
|
|
|
|
@ -14,6 +15,8 @@ interface RemotesDetailsNavigationProps { |
|
|
|
export const RemotesDetailsNavigation = (props: RemotesDetailsNavigationProps) => { |
|
|
|
export const RemotesDetailsNavigation = (props: RemotesDetailsNavigationProps) => { |
|
|
|
const { eventKey, activePanel, callback, remote } = props; |
|
|
|
const { eventKey, activePanel, callback, remote } = props; |
|
|
|
const context = React.useContext(gitPluginContext) |
|
|
|
const context = React.useContext(gitPluginContext) |
|
|
|
|
|
|
|
const actions = React.useContext(gitActionsContext) |
|
|
|
|
|
|
|
|
|
|
|
const handleClick = () => { |
|
|
|
const handleClick = () => { |
|
|
|
if (!callback) return |
|
|
|
if (!callback) return |
|
|
|
if (activePanel === eventKey) { |
|
|
|
if (activePanel === eventKey) { |
|
|
@ -27,6 +30,10 @@ export const RemotesDetailsNavigation = (props: RemotesDetailsNavigationProps) = |
|
|
|
window.open(`${remote.url}`, '_blank'); |
|
|
|
window.open(`${remote.url}`, '_blank'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const setAsDefault = () => { |
|
|
|
|
|
|
|
actions.setDefaultRemote(remote) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<div className="d-flex flex-row w-100 mb-2 mt-2"> |
|
|
|
<div className="d-flex flex-row w-100 mb-2 mt-2"> |
|
|
@ -39,6 +46,11 @@ export const RemotesDetailsNavigation = (props: RemotesDetailsNavigationProps) = |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
{context.defaultRemote && context.defaultRemote?.url === remote.url ? |
|
|
|
|
|
|
|
<FontAwesomeIcon className='ml-auto mr-1 pointer text-success' icon={faToggleOff} ></FontAwesomeIcon> |
|
|
|
|
|
|
|
: |
|
|
|
|
|
|
|
<FontAwesomeIcon className='ml-auto mr-1 pointer' icon={faToggleOn} onClick={setAsDefault} ></FontAwesomeIcon> |
|
|
|
|
|
|
|
} |
|
|
|
{remote?.url && <FontAwesomeIcon className='ml-2 pointer' icon={faGlobe} onClick={() => openRemote()}></FontAwesomeIcon>} |
|
|
|
{remote?.url && <FontAwesomeIcon className='ml-2 pointer' icon={faGlobe} onClick={() => openRemote()}></FontAwesomeIcon>} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</> |
|
|
|
</> |
|
|
|