From 17fbbca04606b390d506529a56e9ed6e3d2e9236 Mon Sep 17 00:00:00 2001 From: billz Date: Mon, 17 Mar 2025 07:33:37 -0700 Subject: [PATCH] Create renderConnection(), update template --- includes/dashboard.php | 21 +++++++++++++++++++++ templates/dashboard.php | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/includes/dashboard.php b/includes/dashboard.php index 09e21dc9..285fc60c 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -325,6 +325,27 @@ function getConnectionType() { return "other ($interface)"; } +/** + * Renders a URL for an svg solid line representing the associated + * connection type + * + * @param string $connectionType + * @return string + */ +function renderConnection(string $connectionType): string +{ + $deviceMap = [ + 'ethernet' => 'device-1', + 'wireless' => 'device-2', + 'tethering' => 'device-3', + 'cellular' => 'device-4' + ]; + $device = $deviceMap[$connectionType] ?? 'device-unknown'; + + // return generated URL for solid.php + return sprintf('app/img/solid.php?joint&%s&out', $device); +} + /** * Handles dashboard page actions * diff --git a/templates/dashboard.php b/templates/dashboard.php index 8d2a2312..df0a3409 100755 --- a/templates/dashboard.php +++ b/templates/dashboard.php @@ -46,7 +46,7 @@ -
> +
@@ -55,7 +55,7 @@
- + Network connection