Files
bee-dashboard/src/components/StatusIcon.tsx
T
Bálint Ujvári 519c411db0 feat: sync and update with all changes from fork (#720)
* feat: sync and update with all changes from fork
* refactor: extract clipboard copy logic into custom hook
* fix: correct spelling of DEFAULT_REFRESH_FREQUENCY_MS in Stamps and WalletBalance providers
* refactor(ui-tests): replace fixed sleeps with condition-based waits
* fix: handle null values for size and granteeCount in infoGroups
* fix(lint): add newline at end of file in useClipboardCopy hook
* fix(ui-tests): page.goto URL
* refactor: update import paths for useClipboardCopy

---------

Co-authored-by: Ferenc Sárai <sarai.ferenc@gmail.com>
2026-03-02 11:34:39 +01:00

53 lines
1.1 KiB
TypeScript

import { CircularProgress } from '@mui/material'
import type { ReactElement } from 'react'
import { CheckState } from '../providers/Bee'
interface Props {
checkState: CheckState
isLoading?: boolean
size?: number | string
className?: string
}
export default function StatusIcon({ checkState, size, className, isLoading }: Props): ReactElement {
const s = size || '1rem'
if (isLoading) return <CircularProgress size={s} className={className} />
let backgroundColor: string
switch (checkState) {
case CheckState.OK:
backgroundColor = '#1de600'
break
case CheckState.WARNING:
backgroundColor = 'orange'
break
case CheckState.ERROR:
backgroundColor = '#ff3a52'
break
case CheckState.STARTING:
backgroundColor = 'orange'
break
case CheckState.CONNECTING:
backgroundColor = '#0074D9'
break
default:
// Default is error
backgroundColor = '#ff3a52'
}
return (
<span
className={className}
style={{
backgroundColor,
height: s,
width: s,
borderRadius: '50%',
display: 'inline-block',
}}
/>
)
}