parent
32d9abf089
commit
c3db5384c9
@ -1,32 +1,32 @@ |
|||||||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
||||||
import React, { } from "react"; |
import React, { } from "react"; |
||||||
import { gitActionsContext, pluginActionsContext } from "../../state/context"; |
import { gitActionsContext, pluginActionsContext } from "../../state/context"; |
||||||
import LoaderIndicator from "./loaderindicator"; |
import LoaderIndicator from "./loaderindicator"; |
||||||
|
|
||||||
export const BranchesNavigation = ({ eventKey, activePanel, callback }) => { |
export const BranchesNavigation = ({ eventKey, activePanel, callback }) => { |
||||||
const pluginactions = React.useContext(pluginActionsContext) |
const pluginactions = React.useContext(pluginActionsContext) |
||||||
const context = React.useContext(gitActionsContext) |
const context = React.useContext(gitActionsContext) |
||||||
|
|
||||||
const handleClick = () => { |
const handleClick = () => { |
||||||
if (!callback) return |
if (!callback) return |
||||||
if (activePanel === eventKey) { |
if (activePanel === eventKey) { |
||||||
callback('') |
callback('') |
||||||
} else { |
} else { |
||||||
callback(eventKey) |
callback(eventKey) |
||||||
} |
|
||||||
} |
} |
||||||
return ( |
} |
||||||
<> |
return ( |
||||||
<div className={'d-flex justify-content-between pt-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
<> |
||||||
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'> |
<div className={'d-flex justify-content-between pt-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||||
{ |
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'> |
||||||
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
{ |
||||||
} |
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
||||||
<label className="pl-1 nav form-check-label">BRANCHES</label> |
} |
||||||
<LoaderIndicator></LoaderIndicator> |
<label className="pl-1 nav form-check-label">BRANCHES</label> |
||||||
</span> |
<LoaderIndicator></LoaderIndicator> |
||||||
</div> |
</span> |
||||||
</> |
</div> |
||||||
); |
</> |
||||||
|
); |
||||||
} |
} |
@ -1,29 +1,29 @@ |
|||||||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
||||||
import React, { } from "react"; |
import React, { } from "react"; |
||||||
import { pluginActionsContext } from "../../state/context"; |
import { pluginActionsContext } from "../../state/context"; |
||||||
|
|
||||||
export const GitHubNavigation = ({ eventKey, activePanel, callback }) => { |
export const GitHubNavigation = ({ eventKey, activePanel, callback }) => { |
||||||
const pluginactions = React.useContext(pluginActionsContext) |
const pluginactions = React.useContext(pluginActionsContext) |
||||||
|
|
||||||
const handleClick = () => { |
const handleClick = () => { |
||||||
if (!callback) return |
if (!callback) return |
||||||
if (activePanel === eventKey) { |
if (activePanel === eventKey) { |
||||||
callback('') |
callback('') |
||||||
} else { |
} else { |
||||||
callback(eventKey) |
callback(eventKey) |
||||||
} |
|
||||||
} |
} |
||||||
return ( |
} |
||||||
<> |
return ( |
||||||
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
<> |
||||||
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'> |
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||||
{ |
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'> |
||||||
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
{ |
||||||
} |
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
||||||
<label className="pl-1 nav form-check-label">GITHUB</label> |
} |
||||||
</span> |
<label className="pl-1 nav form-check-label">GITHUB</label> |
||||||
</div> |
</span> |
||||||
</> |
</div> |
||||||
); |
</> |
||||||
|
); |
||||||
} |
} |
@ -1,32 +1,32 @@ |
|||||||
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
import { faCaretDown, faCaretRight } from "@fortawesome/free-solid-svg-icons"; |
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; |
||||||
import React, { } from "react"; |
import React, { } from "react"; |
||||||
import { gitActionsContext, pluginActionsContext } from "../../state/context"; |
import { gitActionsContext, pluginActionsContext } from "../../state/context"; |
||||||
import LoaderIndicator from "./loaderindicator"; |
import LoaderIndicator from "./loaderindicator"; |
||||||
|
|
||||||
export const RemotesNavigation = ({ eventKey, activePanel, callback }) => { |
export const RemotesNavigation = ({ eventKey, activePanel, callback }) => { |
||||||
const pluginactions = React.useContext(pluginActionsContext) |
const pluginactions = React.useContext(pluginActionsContext) |
||||||
const context = React.useContext(gitActionsContext) |
const context = React.useContext(gitActionsContext) |
||||||
|
|
||||||
const handleClick = () => { |
const handleClick = () => { |
||||||
if (!callback) return |
if (!callback) return |
||||||
if (activePanel === eventKey) { |
if (activePanel === eventKey) { |
||||||
callback('') |
callback('') |
||||||
} else { |
} else { |
||||||
callback(eventKey) |
callback(eventKey) |
||||||
} |
|
||||||
} |
} |
||||||
return ( |
} |
||||||
<> |
return ( |
||||||
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
<> |
||||||
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'> |
<div className={'d-flex justify-content-between pt-1 pb-1 ' + (activePanel === eventKey? 'bg-light': '')}> |
||||||
{ |
<span onClick={()=>handleClick()} role={'button'} className='nav d-flex justify-content-start align-items-center w-75'> |
||||||
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
{ |
||||||
} |
activePanel === eventKey ? <FontAwesomeIcon className='' icon={faCaretDown}></FontAwesomeIcon> : <FontAwesomeIcon className='' icon={faCaretRight}></FontAwesomeIcon> |
||||||
<label className="pl-1 nav form-check-label">REMOTES</label> |
} |
||||||
<LoaderIndicator></LoaderIndicator> |
<label className="pl-1 nav form-check-label">REMOTES</label> |
||||||
</span> |
<LoaderIndicator></LoaderIndicator> |
||||||
</div> |
</span> |
||||||
</> |
</div> |
||||||
); |
</> |
||||||
|
); |
||||||
} |
} |
@ -1,59 +1,56 @@ |
|||||||
import { fileStatusResult, gitState } from "../types"; |
import { fileStatusResult, gitState } from "../types"; |
||||||
|
|
||||||
export const getFilesCountByStatus = (status: string, files: fileStatusResult[]) => { |
export const getFilesCountByStatus = (status: string, files: fileStatusResult[]) => { |
||||||
let count = 0; |
let count = 0; |
||||||
|
|
||||||
files.map((m) => { |
files.map((m) => { |
||||||
if (m.statusNames !== undefined) { |
if (m.statusNames !== undefined) { |
||||||
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
||||||
count++; |
count++; |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
return count; |
return count; |
||||||
} |
} |
||||||
|
|
||||||
export const getFilesByStatus = (status: string, files: fileStatusResult[]): fileStatusResult[] => { |
export const getFilesByStatus = (status: string, files: fileStatusResult[]): fileStatusResult[] => { |
||||||
const result: fileStatusResult[] = [] |
const result: fileStatusResult[] = [] |
||||||
files.map((m) => { |
files.map((m) => { |
||||||
if (m.statusNames !== undefined) { |
if (m.statusNames !== undefined) { |
||||||
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
if (m.statusNames && m.statusNames.indexOf(status) > -1) { |
||||||
result.push(m) |
result.push(m) |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
return result; |
return result; |
||||||
} |
} |
||||||
|
|
||||||
export const getFilesWithNotModifiedStatus = (files: fileStatusResult[]): fileStatusResult[] => { |
export const getFilesWithNotModifiedStatus = (files: fileStatusResult[]): fileStatusResult[] => { |
||||||
const result: fileStatusResult[] = [] |
const result: fileStatusResult[] = [] |
||||||
|
|
||||||
|
|
||||||
files.map((m) => { |
files.map((m) => { |
||||||
|
|
||||||
|
if (m.statusNames !== undefined) { |
||||||
if (m.statusNames !== undefined) { |
if (m.statusNames && m.statusNames.indexOf("unmodified") === -1) { |
||||||
if (m.statusNames && m.statusNames.indexOf("unmodified") === -1) { |
result.push(m) |
||||||
result.push(m) |
} |
||||||
} |
} |
||||||
} |
}); |
||||||
}); |
return result; |
||||||
return result; |
|
||||||
} |
} |
||||||
|
|
||||||
export const allChangedButNotStagedFiles = (files: fileStatusResult[]): fileStatusResult[] => { |
export const allChangedButNotStagedFiles = (files: fileStatusResult[]): fileStatusResult[] => { |
||||||
let allfiles = getFilesWithNotModifiedStatus(files) |
let allfiles = getFilesWithNotModifiedStatus(files) |
||||||
const staged = getFilesByStatus("staged", files) |
const staged = getFilesByStatus("staged", files) |
||||||
allfiles = allfiles.filter((trackedFile) => { |
allfiles = allfiles.filter((trackedFile) => { |
||||||
return staged.findIndex((stagedFile) => stagedFile.filename === trackedFile.filename) === -1 |
return staged.findIndex((stagedFile) => stagedFile.filename === trackedFile.filename) === -1 |
||||||
}) |
}) |
||||||
return allfiles; |
return allfiles; |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
export const getFileStatusForFile = (filename: string, files: fileStatusResult[]) => { |
export const getFileStatusForFile = (filename: string, files: fileStatusResult[]) => { |
||||||
for (let i: number = 0; i < files.length; i++) { |
for (let i: number = 0; i < files.length; i++) { |
||||||
if (files[i].filename === filename) |
if (files[i].filename === filename) |
||||||
return files[i].statusNames; |
return files[i].statusNames; |
||||||
} |
} |
||||||
} |
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue