|
|
@ -18,7 +18,6 @@ export function Workspace () { |
|
|
|
const [showIconsMenu, hideIconsMenu] = useState<boolean>(false) |
|
|
|
const [showIconsMenu, hideIconsMenu] = useState<boolean>(false) |
|
|
|
const [showBranches, setShowBranches] = useState<boolean>(false) |
|
|
|
const [showBranches, setShowBranches] = useState<boolean>(false) |
|
|
|
const [branchFilter, setBranchFilter] = useState<string>('') |
|
|
|
const [branchFilter, setBranchFilter] = useState<string>('') |
|
|
|
const [selectedBranch, setSelectedBranch] = useState<string>('') |
|
|
|
|
|
|
|
const displayOzCustomRef = useRef<HTMLDivElement>() |
|
|
|
const displayOzCustomRef = useRef<HTMLDivElement>() |
|
|
|
const mintableCheckboxRef = useRef() |
|
|
|
const mintableCheckboxRef = useRef() |
|
|
|
const burnableCheckboxRef = useRef() |
|
|
|
const burnableCheckboxRef = useRef() |
|
|
@ -32,6 +31,7 @@ export function Workspace () { |
|
|
|
const cloneUrlRef = useRef<HTMLInputElement>() |
|
|
|
const cloneUrlRef = useRef<HTMLInputElement>() |
|
|
|
const initGitRepoRef = useRef<HTMLInputElement>() |
|
|
|
const initGitRepoRef = useRef<HTMLInputElement>() |
|
|
|
const filteredBranches = selectedWorkspace ? (selectedWorkspace.branches || []).filter(branch => branch.name.includes(branchFilter) && branch.remote).slice(0, 20) : [] |
|
|
|
const filteredBranches = selectedWorkspace ? (selectedWorkspace.branches || []).filter(branch => branch.name.includes(branchFilter) && branch.remote).slice(0, 20) : [] |
|
|
|
|
|
|
|
const currentBranch = selectedWorkspace ? selectedWorkspace.currentBranch : null |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
let workspaceName = localStorage.getItem('currentWorkspace') |
|
|
|
let workspaceName = localStorage.getItem('currentWorkspace') |
|
|
@ -67,7 +67,7 @@ export function Workspace () { |
|
|
|
const workspace = global.fs.browser.workspaces.find(workspace => workspace.name === currentWorkspace) |
|
|
|
const workspace = global.fs.browser.workspaces.find(workspace => workspace.name === currentWorkspace) |
|
|
|
|
|
|
|
|
|
|
|
setSelectedWorkspace(workspace) |
|
|
|
setSelectedWorkspace(workspace) |
|
|
|
workspace && setSelectedBranch(workspace.currentBranch) |
|
|
|
// workspace && setSelectedBranch(workspace.currentBranch)
|
|
|
|
}, [currentWorkspace]) |
|
|
|
}, [currentWorkspace]) |
|
|
|
|
|
|
|
|
|
|
|
const renameCurrentWorkspace = () => { |
|
|
|
const renameCurrentWorkspace = () => { |
|
|
@ -221,7 +221,6 @@ export function Workspace () { |
|
|
|
const switchToBranch = async (branch: string) => { |
|
|
|
const switchToBranch = async (branch: string) => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await global.dispatchSwitchToBranch(branch) |
|
|
|
await global.dispatchSwitchToBranch(branch) |
|
|
|
setSelectedBranch(branch) |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
global.modal('Checkout Git Branch', e.message, 'OK', () => {}) |
|
|
|
global.modal('Checkout Git Branch', e.message, 'OK', () => {}) |
|
|
|
} |
|
|
|
} |
|
|
@ -230,7 +229,6 @@ export function Workspace () { |
|
|
|
const switchToNewBranch = async () => { |
|
|
|
const switchToNewBranch = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|
await global.dispatchSwitchToNewBranch(branchFilter) |
|
|
|
await global.dispatchSwitchToNewBranch(branchFilter) |
|
|
|
setSelectedBranch(branchFilter) |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
global.modal('Checkout Git Branch', e.message, 'OK', () => {}) |
|
|
|
global.modal('Checkout Git Branch', e.message, 'OK', () => {}) |
|
|
|
} |
|
|
|
} |
|
|
@ -725,7 +723,7 @@ export function Workspace () { |
|
|
|
<div className="pt-1 mr-1"> |
|
|
|
<div className="pt-1 mr-1"> |
|
|
|
<Dropdown style={{ height: 30, minWidth: 80 }} onToggle={toggleBranches} show={showBranches} drop={'up'}> |
|
|
|
<Dropdown style={{ height: 30, minWidth: 80 }} onToggle={toggleBranches} show={showBranches} drop={'up'}> |
|
|
|
<Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control h-100 p-0 pl-2 pr-2 text-dark" icon={null}> |
|
|
|
<Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control h-100 p-0 pl-2 pr-2 text-dark" icon={null}> |
|
|
|
{ global.fs.browser.isRequestingCloning ? <i className="fad fa-spinner fa-spin"></i> : selectedBranch || '-none-' } |
|
|
|
{ global.fs.browser.isRequestingCloning ? <i className="fad fa-spinner fa-spin"></i> : currentBranch || '-none-' } |
|
|
|
</Dropdown.Toggle> |
|
|
|
</Dropdown.Toggle> |
|
|
|
|
|
|
|
|
|
|
|
<Dropdown.Menu as={CustomMenu} className='custom-dropdown-items branches-dropdown' data-id="custom-dropdown-items"> |
|
|
|
<Dropdown.Menu as={CustomMenu} className='custom-dropdown-items branches-dropdown' data-id="custom-dropdown-items"> |
|
|
@ -748,7 +746,7 @@ export function Workspace () { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Dropdown.Item key={index} onClick={() => { switchToBranch(branch.name) }}> |
|
|
|
<Dropdown.Item key={index} onClick={() => { switchToBranch(branch.name) }}> |
|
|
|
{
|
|
|
|
{
|
|
|
|
selectedBranch === branch.name ? |
|
|
|
currentBranch === branch.name ? |
|
|
|
<span>✓ { branch.name } </span> : |
|
|
|
<span>✓ { branch.name } </span> : |
|
|
|
<span className="pl-3">{ branch.name }</span> |
|
|
|
<span className="pl-3">{ branch.name }</span> |
|
|
|
} |
|
|
|
} |
|
|
@ -757,7 +755,7 @@ export function Workspace () { |
|
|
|
}) :
|
|
|
|
}) :
|
|
|
|
<Dropdown.Item onClick={switchToNewBranch}> |
|
|
|
<Dropdown.Item onClick={switchToNewBranch}> |
|
|
|
<div className="pl-1 pr-1"> |
|
|
|
<div className="pl-1 pr-1"> |
|
|
|
<i className="fas fa-code-branch pr-2"></i><span>Create branch: { branchFilter } from '{selectedBranch}'</span> |
|
|
|
<i className="fas fa-code-branch pr-2"></i><span>Create branch: { branchFilter } from '{currentBranch}'</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Dropdown.Item> |
|
|
|
</Dropdown.Item> |
|
|
|
} |
|
|
|
} |
|
|
|