fix connecting text

pull/5248/head
Joseph Izang 3 months ago committed by Aniket
parent 31a62585d0
commit 11ec9fa9ca
  1. 2
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  2. 31
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx

@ -2,6 +2,8 @@ import { branch } from '@remix-ui/git'
import { customAction } from '@remixproject/plugin-api'
import { createContext, SyntheticEvent } from 'react'
import { BrowserState } from '../reducers/workspace'
import { Plugin } from '@remixproject/engine'
import { CustomRemixApi } from '@remix-api'
export const FileSystemContext = createContext<{
fs: any,

@ -984,6 +984,35 @@ export function Workspace() {
</>
)
}
const [togglerText, setTogglerText] = useState<'Connecting' | 'Connected to Local FileSystem'>('Connecting')
useEffect(() => {
setTimeout(() => {
setTogglerText('Connected to Local FileSystem')
}, 1000)
}, [selectedWorkspace])
const WorkspaceDropdownToggle = () => {
const [togglerText, setTogglerText] = useState<'Connecting' | 'Connected to Local FileSystem'>('Connecting')
useEffect(() => {
setTimeout(() => {
setTogglerText('Connected to Local FileSystem')
}, 1000)
}, [selectedWorkspace])
return (
<Dropdown.Toggle
as={CustomToggle}
id="dropdown-custom-components"
className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control mt-1"
icon={selectedWorkspace && selectedWorkspace.isGitRepo && !(currentWorkspace === LOCALHOST) ? 'far fa-code-branch' : null}
>
{selectedWorkspace ? selectedWorkspace.name === LOCALHOST ? togglerText : selectedWorkspace.name : currentWorkspace === LOCALHOST ? formatNameForReadonly('localhost') : NO_WORKSPACE}
</Dropdown.Toggle>
)
}
return (
<div className="d-flex flex-column justify-content-between h-100">
<div
@ -1091,7 +1120,7 @@ export function Workspace() {
className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control mt-1"
icon={selectedWorkspace && selectedWorkspace.isGitRepo && !(currentWorkspace === LOCALHOST) ? 'far fa-code-branch' : null}
>
{selectedWorkspace ? selectedWorkspace.name === LOCALHOST ? 'Connected to Local FileSystem' : selectedWorkspace.name : currentWorkspace === LOCALHOST ? formatNameForReadonly('localhost') : NO_WORKSPACE}
{selectedWorkspace ? selectedWorkspace.name === LOCALHOST ? togglerText : selectedWorkspace.name : currentWorkspace === LOCALHOST ? formatNameForReadonly('localhost') : NO_WORKSPACE}
</Dropdown.Toggle>
<Dropdown.Menu as={CustomMenu} className="w-100 custom-dropdown-items" data-id="custom-dropdown-items">
{

Loading…
Cancel
Save