/* eslint-disable-rule prefer-destructuring */ import React from 'react'; import { CButton, CModal, CModalHeader, CModalBody, CModalTitle, CModalFooter } from '@coreui/react'; import WifiChannelTable from '../components/WifiChannels/WifiChannelTable'; import { prettyDate } from '../utils/helper'; const WifiScanResultModalWidget = ({show, toggle, scanResults, date}) => { const parseThroughList = (scanList) => { const dbmNumber = 4294967295; const listOfChannels = []; scanList.forEach((scan) => { if(!listOfChannels.includes(scan.channel)){ listOfChannels.push(scan.channel); } }); const finalList = []; listOfChannels.forEach((channelNumber) => { const channel = { channel: channelNumber, devices: [] }; scanList.forEach((device) => { if(device.channel === channelNumber){ const deviceToAdd = {}; deviceToAdd.SSID = device.ssid ?? 'N/A'; deviceToAdd.Signal = (dbmNumber - device.signal) * -1; channel.devices.push(deviceToAdd); } }); finalList.push(channel); }); return finalList; } return ( {date !== '' ? prettyDate(date) : ''} Wifi Scan Results {scanResults === null ? null : } Close ); } export default WifiScanResultModalWidget;