1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2025-07-09 23:47:41 +02:00

Create renderConnection(), update template

This commit is contained in:
billz 2025-03-17 07:33:37 -07:00
parent 64faf296a6
commit 17fbbca046
2 changed files with 23 additions and 2 deletions

View File

@ -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
*

View File

@ -46,7 +46,7 @@
<span><?php echo _("Wireless"); ?></span>
<i class="fas fa-wifi fa-2xl"></i>
</div>
<div class="connection-item" <?php echo $tetheringActive; ?>>
<div class="connection-item <?php echo $tetheringActive; ?>">
<span><?php echo _("Tethering"); ?></span>
<i class="fas fa-mobile-alt fa-2xl"></i>
</div>
@ -55,7 +55,7 @@
<i class="fas fa-broadcast-tower fa-2xl"></i>
</div>
<img src="app/img/dashed.svg" class="dashed-lines" alt="">
<img src="app/img/solid.php?joint&device-1&out" class="solid-lines" alt="">
<img src="<?php echo htmlspecialchars(renderConnection($connectionType)); ?>" class="solid-lines" alt="Network connection">
</div>
<div class="center-device col-12 col-lg-4">
<div class="center-device-top">