|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import React, { useState, useRef, useEffect } from 'react'; | 
|---|
|  |  |  | import { useTranslate } from "react-admin"; | 
|---|
|  |  |  | import { Box, Typography, Tabs, Tab, Stack, useTheme, Divider } from '@mui/material'; | 
|---|
|  |  |  | import ShelfMain from './ShelfMain'; | 
|---|
|  |  |  | import JsonShow from '../../JsonShow'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const ShelfInsight = (props) => { | 
|---|
|  |  |  | const { sprite, setTitle } = props; | 
|---|
|  |  |  | const theme = useTheme(); | 
|---|
|  |  |  | const themeMode = theme.palette.mode; | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [activeTab, setActiveTab] = useState(0); | 
|---|
|  |  |  | const [curLocNo, setCurLocNo] = useState(null); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleTabChange = (event, newValue) => { | 
|---|
|  |  |  | setActiveTab(newValue); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <> | 
|---|
|  |  |  | <h1>SHleft</h1> | 
|---|
|  |  |  | </> | 
|---|
|  |  |  | <Box sx={{ height: '100%', display: 'flex', flexDirection: 'column' }}> | 
|---|
|  |  |  | <Tabs | 
|---|
|  |  |  | value={activeTab} | 
|---|
|  |  |  | onChange={handleTabChange} | 
|---|
|  |  |  | centered | 
|---|
|  |  |  | sx={{ mb: 0 }} | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <Tab label={translate('page.map.insight.title')} /> | 
|---|
|  |  |  | <Tab label={'JSON'} /> | 
|---|
|  |  |  | </Tabs> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Divider /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <Box flex={1} pt={2}> | 
|---|
|  |  |  | {activeTab === 0 && ( | 
|---|
|  |  |  | <ShelfMain | 
|---|
|  |  |  | data={sprite?.data} | 
|---|
|  |  |  | curLocNo={curLocNo} | 
|---|
|  |  |  | setCurLocNo={setCurLocNo} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | {activeTab === 1 && ( | 
|---|
|  |  |  | <JsonShow | 
|---|
|  |  |  | data={sprite?.data} | 
|---|
|  |  |  | height={550} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | )} | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | </Box> | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|