Skip to content

Commit

Permalink
using context to detect app state
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlal321 authored and Aniket-Engg committed Sep 2, 2024
1 parent d9376e1 commit 874b405
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libs/remix-ui/statusbar/src/lib/remixui-statusbar-panel.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand All @@ -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('')
Expand Down Expand Up @@ -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>
Expand All @@ -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>
Expand Down

0 comments on commit 874b405

Please sign in to comment.