using context to detect app state

pull/5155/head
ijlal321 3 months ago committed by Aniket
parent d9376e15e4
commit 874b405738
  1. 9
      libs/remix-ui/statusbar/src/lib/remixui-statusbar-panel.tsx

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useContext } from 'react'
import GitStatus from './components/gitStatus'
import AIStatus from './components/aiStatus'
import ScamAlertStatus from './components/scamAlertStatus'
@ -9,7 +9,7 @@ import axios from 'axios'
import { StatusBar } from 'apps/remix-ide/src/app/components/status-bar'
import { StatusBarContextProvider } from '../contexts/statusbarcontext'
import DidYouKnow from './components/didYouKnow'
import isElectron from 'is-electron'
import { appPlatformTypes, platformContext } from '@remix-ui/app'
export interface RemixUIStatusBarProps {
statusBarPlugin: StatusBar
@ -21,6 +21,7 @@ export type ScamAlert = {
}
export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) {
const platform = useContext(platformContext)
const [showScamDetails, setShowScamDetails] = useState(true)
const [scamAlerts, setScamAlerts] = useState<ScamAlert[]>([])
const [gitBranchName, setGitBranchName] = useState('')
@ -69,7 +70,7 @@ export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) {
return (
<>
<StatusBarContextProvider>
{!isElectron() && showScamDetails && (
{(platform !== appPlatformTypes.desktop) && showScamDetails && (
<FloatingFocusManager context={context} modal={false}>
<ScamDetails refs={refs} floatStyle={{ ...floatingStyles, minHeight: 'auto', alignContent: 'center', paddingRight: '0.5rem' }} getFloatingProps={getFloatingProps} scamAlerts={scamAlerts} />
</FloatingFocusManager>
@ -87,7 +88,7 @@ export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) {
<div className="remixui_statusbar">
<AIStatus plugin={statusBarPlugin} aiActive={lightAiUp} isAiActive={isAiActive} setIsAiActive={setIsAiActive} />
</div>
{ !isElectron() && <div className="remixui_statusbar bg-warning px-2 remixui_statusbar_custom_padding d-flex justify-center align-items-center">
{ (platform !== appPlatformTypes.desktop) && <div className="remixui_statusbar bg-warning px-2 remixui_statusbar_custom_padding d-flex justify-center align-items-center">
<ScamAlertStatus refs={refs} getReferenceProps={getReferenceProps} />
</div> }
</div>

Loading…
Cancel
Save