|
|
@ -6,8 +6,6 @@ import ScamAlertStatus from './components/scamAlertStatus' |
|
|
|
import ScamDetails from './components/scamDetails' |
|
|
|
import ScamDetails from './components/scamDetails' |
|
|
|
import { FloatingFocusManager, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole } from '@floating-ui/react' |
|
|
|
import { FloatingFocusManager, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole } from '@floating-ui/react' |
|
|
|
import axios from 'axios' |
|
|
|
import axios from 'axios' |
|
|
|
import { get } from 'lodash' |
|
|
|
|
|
|
|
import { current } from '@reduxjs/toolkit' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface RemixUIStatusBarProps { |
|
|
|
export interface RemixUIStatusBarProps { |
|
|
|
statusBarPlugin: StatusBarInterface |
|
|
|
statusBarPlugin: StatusBarInterface |
|
|
@ -18,12 +16,11 @@ export type ScamAlert = { |
|
|
|
url: string |
|
|
|
url: string |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type GetCurrentWorkspace = |
|
|
|
type GetCurrentWorkspace = { |
|
|
|
{ |
|
|
|
name: string |
|
|
|
name: string |
|
|
|
isLocalhost: boolean |
|
|
|
isLocalhost: boolean |
|
|
|
absolutePath: string |
|
|
|
absolutePath: string |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) { |
|
|
|
export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) { |
|
|
|
const [showScamDetails, setShowScamDetails] = useState(false) |
|
|
|
const [showScamDetails, setShowScamDetails] = useState(false) |
|
|
@ -54,31 +51,13 @@ export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) { |
|
|
|
} |
|
|
|
} |
|
|
|
}, []) |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
const t = async () => { |
|
|
|
async function getGitBranchName() { |
|
|
|
const isGit = await statusBarPlugin.call('fileManager', 'isGitRepo') |
|
|
|
const gitRepo = await statusBarPlugin.call('fileManager', 'isGitRepo') |
|
|
|
if (!isGit) return |
|
|
|
console.log('gitRepo', gitRepo) |
|
|
|
const repoName = await statusBarPlugin.call('filePanel', 'getCurrentWorkspace') |
|
|
|
return gitRepo |
|
|
|
repoName && repoName?.name.length > 0 ? statusBarPlugin.currentWorkspaceName = repoName.name : statusBarPlugin.currentWorkspaceName = '' |
|
|
|
} |
|
|
|
return { repoWorkspaceName: repoName } |
|
|
|
async function getWorkspaceName() { |
|
|
|
} |
|
|
|
const thing = await statusBarPlugin.call('filePanel', 'getCurrentWorkspace') |
|
|
|
|
|
|
|
console.log('thing', thing) |
|
|
|
|
|
|
|
return thing |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
async function getWorkspaceGitBranchName() { |
|
|
|
|
|
|
|
if (!getGitBranchName()) return |
|
|
|
|
|
|
|
let currentWorkspace: GetCurrentWorkspace = {} as GetCurrentWorkspace |
|
|
|
|
|
|
|
currentWorkspace = await getWorkspaceName() |
|
|
|
|
|
|
|
console.log('currentWorkspace', currentWorkspace) |
|
|
|
|
|
|
|
setWorkspaceName(currentWorkspace?.name) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getWorkspaceGitBranchName() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return () => { |
|
|
|
|
|
|
|
getWorkspaceGitBranchName() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, [statusBarPlugin]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
@ -89,7 +68,7 @@ export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) { |
|
|
|
)} |
|
|
|
)} |
|
|
|
<div className="d-flex flex-row bg-primary justify-content-between align-items-center"> |
|
|
|
<div className="d-flex flex-row bg-primary justify-content-between align-items-center"> |
|
|
|
<div className="remixui_statusbar"> |
|
|
|
<div className="remixui_statusbar"> |
|
|
|
<GitStatus workspaceName={workspaceName ?? 'none'} /> |
|
|
|
<GitStatus plugin={statusBarPlugin} /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="remixui_statusbar"></div> |
|
|
|
<div className="remixui_statusbar"></div> |
|
|
|
<div className="remixui_statusbar d-flex flex-row"> |
|
|
|
<div className="remixui_statusbar d-flex flex-row"> |
|
|
|