import React, { useState } from 'react'; import { Redirect, Route } from 'react-router-dom'; import { PageContent } from '../Layout/PageContent'; import { DeviceDetailView } from './DetailView'; import { RoleChangedModal } from '../Modal/RoleChangedModal'; import { ConnectBlockchainAccountModal } from '../Modal/ConnectBlockchainAccountModal'; import { useDeviceMenu } from './deviceMenu'; import { useLinks } from '../../hooks'; export const Device = () => { const { baseURL, devicesPageUrl } = useLinks(); const [showRoleModal, setShowRoleModal] = useState(false); const [showBlockchainModal, setShowBlockchainModal] = useState(false); function ProductionDetailView(id: number): JSX.Element { return ; } const deviceMenuList = useDeviceMenu(); return (
{ const key = props.match.params.key; const id = props.match.params.id; const matches = deviceMenuList.filter((item) => { return item.key === key; }); if (matches.length > 0 && key === 'producing_detail_view') { matches[0].component = () => ProductionDetailView(parseInt(id, 10)); } return ( 0 ? matches[0] : null} redirectPath={devicesPageUrl} /> ); }} /> ( )} /> ( )} />
); };