Skip to content

Commit

Permalink
fix connecting text
Browse files Browse the repository at this point in the history
  • Loading branch information
joeizang committed Aug 28, 2024
1 parent a0a511d commit 6ad693b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libs/remix-ui/workspace/src/lib/contexts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
31 changes: 30 additions & 1 deletion libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,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
Expand Down Expand Up @@ -1068,7 +1097,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">
{
Expand Down

0 comments on commit 6ad693b

Please sign in to comment.