1- import React , { useState , useEffect } from 'react' ;
1+ import React , { useState , useEffect , useMemo } from 'react' ;
22import { useMQTT } from '../providers/MQTTContext' ; // Import the useMQTT hook
33import dayjs from 'dayjs' ;
44import utc from 'dayjs/plugin/utc' ;
@@ -19,7 +19,6 @@ import { ERROR_COLOR, WARNING_COLOR, NOTICE_COLOR } from "../color";
1919import Chip from '@mui/material/Chip' ;
2020import PioreactorIcon from "./PioreactorIcon"
2121import { Link } from 'react-router' ;
22- import emptyStateIllustration from '../assets/undraw_clouds_bmtk.svg' ;
2322
2423// Activate the UTC plugin
2524dayjs . extend ( utc ) ;
@@ -68,11 +67,24 @@ const LEVELS = [
6867 "CRITICAL"
6968]
7069
70+ const EMPTY_STATE_ILLUSTRATIONS = [
71+ "/static/svgs/yeast-cells.svg" ,
72+ "/static/svgs/bacteria-cells.svg" ,
73+ "/static/svgs/coccus-cells.svg" ,
74+ "/static/svgs/spore-forming-bacilli.svg" ,
75+ "/static/svgs/bacteria-two-bacillus-touching.svg" ,
76+ "/static/svgs/bacteria-three-bacillus-touching.svg" ,
77+ ] ;
78+
7179function PaginatedLogTable ( { pioreactorUnit, experiment, relabelMap, logLevel } ) {
7280 const [ listOfLogs , setListOfLogs ] = useState ( [ ] ) ;
7381 const [ skip , setSkip ] = useState ( 0 ) ; // Tracks the number of logs already loaded
7482 const [ loading , setLoading ] = useState ( false ) ; // Tracks if the logs are currently loading
7583 const [ onlyAssignedLogs , setOnlyAssignedLogs ] = useState ( true ) ;
84+ const emptyStateIllustration = useMemo ( ( ) => {
85+ const randomIndex = Math . floor ( Math . random ( ) * EMPTY_STATE_ILLUSTRATIONS . length ) ;
86+ return EMPTY_STATE_ILLUSTRATIONS [ randomIndex ] ;
87+ } , [ ] ) ;
7688 const { client, subscribeToTopic, unsubscribeFromTopic } = useMQTT ( ) ;
7789
7890 const getAPIURL = ( unit , onlyAssignedLogs , experiment ) => {
@@ -236,7 +248,7 @@ function PaginatedLogTable({pioreactorUnit, experiment, relabelMap, logLevel })
236248 </ TableContainer >
237249 ) : showEmptyState ? (
238250 < Box display = "flex" flexDirection = "column" alignItems = "center" justifyContent = "center" sx = { { minHeight : "350px" , gap : 2 , textAlign : "center" } } >
239- < Box component = "img" src = { emptyStateIllustration } alt = "No logs illustration" sx = { { maxWidth : "320px " , width : "100%" , opacity : 0.9 } } />
251+ < Box component = "img" src = { emptyStateIllustration } alt = "No logs illustration" sx = { { maxWidth : "350px " , width : "100%" , opacity : 0.8 } } />
240252 < Box sx = { { color : "#5f6a7d" , fontSize : "14px" } } >
241253 No logs yet. They will appear here once your Pioreactor starts reporting activity.
242254 </ Box >
0 commit comments