diff --git a/src/Index.tsx b/src/Index.tsx
index f167db3..03a8b5d 100644
--- a/src/Index.tsx
+++ b/src/Index.tsx
@@ -1,5 +1,9 @@
import { useState, useEffect } from "react";
import { Routes, Route, useNavigate } from "react-router-dom";
+import VeryLowSignal from "./assets/very_low_signal.png";
+import LowSignal from "./assets/low_signal.png";
+import MediumSignal from "./assets/medium_signal.png";
+import HighSignal from "./assets/high_signal.png";
import Dashboard from "./pages/Dashboard";
import Devices from "./pages/DeviceList";
import Extend from "./pages/ExtendWirelessNetwork";
@@ -31,8 +35,17 @@ function Index() {
"10.0.0.6",
"10.0.0.7",
]);
+ const wifiNames = [
+ "Home Wifi",
+ "Neighbors Wifi",
+ "Grandmas Wifi",
+ "McDonalds Wifi",
+ "Starbucks Wifi",
+ "Hotel Wifi",
+ ];
+ const wifiSignals = [4, 3, 1, 2, 1, 2];
+ const wifiSignalImages = [VeryLowSignal, LowSignal, MediumSignal, HighSignal];
- const [routerName, setRouterName] = useState("Example Router");
const [twoGExtendedName, setTwoGExtendedName] = useState(
"Example 2.4GHz Network",
);
@@ -46,6 +59,8 @@ function Index() {
const [selectedModeButton, setSelectedModeButton] = useState(0);
+ const [routerName, setRouterName] = useState("");
+
const navigate = useNavigate();
useEffect(() => {
@@ -57,6 +72,12 @@ function Index() {
setDevicesOnline(deviceNames.length);
}, [loginState, navigate, setLoggedUser, deviceNames]);
+ useEffect(() => {
+ if (!wifiNames[connected]) return setRouterName("Not Connnected");
+
+ setRouterName(wifiNames[connected]);
+ }, [connected]);
+
return (
<>
@@ -65,10 +86,13 @@ function Index() {
path="/"
element={
}
/>
@@ -93,6 +117,9 @@ function Index() {
setExtendedMode={setExtenderMode}
connected={connected}
setConnected={setConnected}
+ wifiNames={wifiNames}
+ wifiSignals={wifiSignals}
+ wifiSignalImages={wifiSignalImages}
/>
}
/>
diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx
index f97eac1..98ad866 100644
--- a/src/pages/Dashboard.tsx
+++ b/src/pages/Dashboard.tsx
@@ -1,55 +1,70 @@
-import { Link } from 'react-router-dom'
-import '../styles/Dashboard.css'
-import Globe from '../assets/globe.png'
-import Arrow from '../assets/arrow.png'
-import Router from '../assets/router.png'
-import Signal from '../assets/signal.png'
-import VeryLowSignal from '../assets/very_low_signal.png'
-import LowSignal from '../assets/low_signal.png'
-import MediumSignal from '../assets/medium_signal.png'
-import HighSignal from '../assets/high_signal.png'
-import Extender from '../assets/extender.png'
-import Device from '../assets/device.png'
-import Gear from '../assets/gear.png'
+import { Link } from "react-router-dom";
+import "../styles/Dashboard.css";
+import Globe from "../assets/globe.png";
+import Arrow from "../assets/arrow.png";
+import Router from "../assets/router.png";
+import Signal from "../assets/signal.png";
+import HighSignal from "../assets/high_signal.png";
+import Extender from "../assets/extender.png";
+import Device from "../assets/device.png";
+import Gear from "../assets/gear.png";
interface Props {
- RouterName: string;
- TwoGExtendedName: string;
- FiveGExtendedName: string;
- DevicesOnline: number;
+ routerName: string;
+ twoGExtendedName: string;
+ fiveGExtendedName: string;
+ devicesOnline: number;
+ connected: number;
+ wifiSignals: number[];
+ wifiSignalImages: string[];
}
-function Dashboard({ RouterName, TwoGExtendedName, FiveGExtendedName, DevicesOnline }: Props) {
+function Dashboard({
+ routerName,
+ twoGExtendedName,
+ fiveGExtendedName,
+ devicesOnline,
+ connected,
+ wifiSignals,
+ wifiSignalImages,
+}: Props) {
return (
<>