import { Button, Grid, makeStyles } from '@material-ui/core' import { CheckBox, CheckBoxOutlineBlank } from '@material-ui/icons'; import React, { useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import DpAlert from '../../../../layouts/mui/DpAlert'; import H24Player from './H24Player'; import LegendCommon from './LegendCommon'; const useStyles = makeStyles({ root: { color: '#fff', padding: '0.8rem 0', }, tool: { marginBottom: '1.2rem', }, buttons: { backgroundColor: 'red', flexShrink: 0, }, legend: { backgroundColor: 'green', }, checklabel: { justifyContent: 'flex-start', } }) function WF() { const classes = useStyles(); const dispatch = useDispatch(); let contourSetting = useSelector(s => s.runtime.layerSetting.contour); const { type, outdated, strtm } = useMemo(() => { let type = contourSetting?.type; const ret = { type }; if (type === 'wf24h') { ret.strtm = contourSetting?.tm; ret.outdated = false; } else if (type === 'wf2h') { ret.strtm = contourSetting?.tm; ret.outdated = false; } return ret; }, [contourSetting]); const genWeatherContour24H = () => { dispatch.shyjview.showWeather24h(); } const genWeatherContourRadar = () => { dispatch.shyjview.showWeatherRadar(); } const setIndexH24 = (index) => { let newContourSetting = { ...contourSetting }; if (typeof index === 'number') { newContourSetting.index = index + 1; } else { newContourSetting.index = 0; } dispatch.runtime.setLayerSetting({ contour: newContourSetting }) } return (
{ strtm && contourSetting?.msg ? ( {contourSetting.msg} ) : null } { strtm ? ( {`天气预报时间: ${strtm.substr(0, '0000-00-00 00'.length)}`} ) : ( 点击上方按钮查看实时天气预报 ) } { type === 'wf24h' ? ( <> { contourSetting?.index > 0 ? ( <> ) : ( ) } ) : null } { type === 'wf2h' ? ( ) : null }
) } export default React.memo(WF);