Skip to content

Commit

Permalink
test mobile menu on the bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ribeiro committed Sep 29, 2024
1 parent 40593fd commit f4e40cf
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 124 deletions.
50 changes: 25 additions & 25 deletions includes/footer.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
</main>
</main>

<div class="toast" id="errorToast">
<div class="toast-content">
<i class="fas fa-solid fa-x toast-icon error"></i>
<div class="message">
<span class="text text-1"><?= translate("error", $i18n) ?></span>
<span class="text text-2 errorMessage"></span>
</div>
<div class="toast" id="errorToast">
<div class="toast-content">
<i class="fas fa-solid fa-x toast-icon error"></i>
<div class="message">
<span class="text text-1"><?= translate("error", $i18n) ?></span>
<span class="text text-2 errorMessage"></span>
</div>
<i class="fa-solid fa-xmark close close-error"></i>
<div class="progress error"></div>
</div>
<i class="fa-solid fa-xmark close close-error"></i>
<div class="progress error"></div>
</div>

<div class="toast" id="successToast">
<div class="toast-content">
<i class="fas fa-solid fa-check toast-icon success"></i>
<div class="message">
<span class="text text-1"><?= translate("success", $i18n) ?></span>
<span class="text text-2 successMessage"></span>
</div>
<div class="toast" id="successToast">
<div class="toast-content">
<i class="fas fa-solid fa-check toast-icon success"></i>
<div class="message">
<span class="text text-1"><?= translate("success", $i18n) ?></span>
<span class="text text-2 successMessage"></span>
</div>
<i class="fa-solid fa-xmark close close-success"></i>
<div class="progress success"></div>
</div>
<i class="fa-solid fa-xmark close close-success"></i>
<div class="progress success"></div>
</div>

<?php
if (isset($db)) {
$db->close();
}
?>
<?php
if (isset($db)) {
$db->close();
}
?>

</body>
</body>

</html>
239 changes: 149 additions & 90 deletions includes/header.php
Original file line number Diff line number Diff line change
@@ -1,78 +1,80 @@
<?php
require_once 'connect.php';
require_once 'checkuser.php';
require_once 'checksession.php';
require_once 'currency_formatter.php';
require_once 'connect.php';
require_once 'checkuser.php';
require_once 'checksession.php';
require_once 'currency_formatter.php';

require_once 'i18n/languages.php';
require_once 'i18n/getlang.php';
require_once 'i18n/' . $lang . '.php';
require_once 'i18n/languages.php';
require_once 'i18n/getlang.php';
require_once 'i18n/' . $lang . '.php';

require_once 'getsettings.php';
require_once 'getsettings.php';

require_once 'version.php';
require_once 'version.php';

if ($userCount == 0) {
$db->close();
header("Location: registration.php");
exit();
}
if ($userCount == 0) {
$db->close();
header("Location: registration.php");
exit();
}

$demoMode = getenv('DEMO_MODE');
$demoMode = getenv('DEMO_MODE');

$theme = "automatic";
if (isset($settings['theme'])) {
$theme = $settings['theme'];
}
$theme = "automatic";
if (isset($settings['theme'])) {
$theme = $settings['theme'];
}

$updateThemeSettings = false;
if (isset($settings['update_theme_setttings'])) {
$updateThemeSettings = $settings['update_theme_setttings'];
}
$updateThemeSettings = false;
if (isset($settings['update_theme_setttings'])) {
$updateThemeSettings = $settings['update_theme_setttings'];
}

$colorTheme = "blue";
if (isset($settings['color_theme'])) {
$colorTheme = $settings['color_theme'];
}
$colorTheme = "blue";
if (isset($settings['color_theme'])) {
$colorTheme = $settings['color_theme'];
}

$customCss = "";
if (isset($settings['customCss'])) {
$customCss = $settings['customCss'];
}
$customCss = "";
if (isset($settings['customCss'])) {
$customCss = $settings['customCss'];
}

if (isset($themeValue)) {
$cookieExpire = time() + (30 * 24 * 60 * 60);
setcookie('theme', $themeValue, [
'expires' => $cookieExpire,
'samesite' => 'Strict'
]);
}
if (isset($themeValue)) {
$cookieExpire = time() + (30 * 24 * 60 * 60);
setcookie('theme', $themeValue, [
'expires' => $cookieExpire,
'samesite' => 'Strict'
]);
}

$isAdmin = $_SESSION['userId'] == 1;
$isAdmin = $_SESSION['userId'] == 1;

function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
return "$r, $g, $b";
function hex2rgb($hex)
{
$hex = str_replace("#", "", $hex);
if (strlen($hex) == 3) {
$r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
$g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
$b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
} else {
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, 4, 2));
}
return "$r, $g, $b";
}

?>
<!DOCTYPE html>
<html dir="<?= $languages[$lang]['dir'] ?>">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Wallos - Subscription Tracker</title>
<meta name="apple-mobile-web-app-title" content="Wallos">
<meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color"/>
<meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>" id="theme-color" />
<link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">
<link rel="apple-touch-icon" href="images/icon/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="152x152" href="images/icon/apple-touch-icon-152.png">
Expand All @@ -93,73 +95,130 @@ function hex2rgb($hex) {
<script type="text/javascript">
window.theme = "<?= $theme ?>";
window.update_theme_settings = "<?= $updateThemeSettings ?>";
window.lang = "<?=$lang ?>";
window.lang = "<?= $lang ?>";
window.colorTheme = "<?= $colorTheme ?>";
</script>
<style>
<?= htmlspecialchars($customCss, ENT_QUOTES, 'UTF-8') ?>
</style>
<?php
if (isset($settings['customColors'])) {
?>
<style id="custom_theme_colors">
:root {
<?php if (isset($settings['customColors']['main_color']) && !empty($settings['customColors']['main_color'])): ?>
--main-color: <?= $settings['customColors']['main_color'] ?>;
--main-color-rgb: <?= hex2rgb($settings['customColors']['main_color']) ?>;
<?php endif; ?>
<?php if (isset($settings['customColors']['accent_color']) && !empty($settings['customColors']['accent_color'])): ?>
--accent-color: <?= $settings['customColors']['accent_color'] ?>;
--accent-color-rgb: <?= hex2rgb($settings['customColors']['accent_color']) ?>;
<?php endif; ?>
<?php if (isset($settings['customColors']['hover_color']) && !empty($settings['customColors']['hover_color'])): ?>
--hover-color: <?= $settings['customColors']['hover_color'] ?>;
--hover-color-rgb: <?= hex2rgb($settings['customColors']['hover_color']) ?>;
<?php endif; ?>
}
</style>
<?php
}
if (isset($settings['customColors'])) {
?>
<style id="custom_theme_colors">
:root {
<?php if (isset($settings['customColors']['main_color']) && !empty($settings['customColors']['main_color'])): ?>
--main-color:
<?= $settings['customColors']['main_color'] ?>
;
--main-color-rgb:
<?= hex2rgb($settings['customColors']['main_color']) ?>
;
<?php endif; ?>
<?php if (isset($settings['customColors']['accent_color']) && !empty($settings['customColors']['accent_color'])): ?>
--accent-color:
<?= $settings['customColors']['accent_color'] ?>
;
--accent-color-rgb:
<?= hex2rgb($settings['customColors']['accent_color']) ?>
;
<?php endif; ?>
<?php if (isset($settings['customColors']['hover_color']) && !empty($settings['customColors']['hover_color'])): ?>
--hover-color:
<?= $settings['customColors']['hover_color'] ?>
;
--hover-color-rgb:
<?= hex2rgb($settings['customColors']['hover_color']) ?>
;
<?php endif; ?>
}
</style>
<?php
}
?>
<script type="text/javascript" src="scripts/i18n/<?= $lang ?>.js?<?= $version ?>"></script>
<script type="text/javascript" src="scripts/i18n/getlang.js?<?= $version ?>"></script>
</head>

<body class="<?= $theme ?> <?= $languages[$lang]['dir'] ?>">
<header>
<div class="contain">
<div class="logo">
<a href=".">
<div class="logo-image" title="Wallos - Subscription Tracker">
<?php include "images/siteicons/svg/logo.php"; ?>
</div>
</a>
<a href=".">
<div class="logo-image" title="Wallos - Subscription Tracker">
<?php include "images/siteicons/svg/logo.php"; ?>
</div>
</a>
</div>
<nav>
<div class="dropdown">
<button class="dropbtn" onClick="toggleDropdown()">
<img src="<?= $userData['avatar'] ?>" alt="me" id="avatar">
<span id="user"><?= $username ?></span>
<span id="user" class="hideOnMobile"><?= $username ?></span>
</button>
<div class="dropdown-content">
<a href="."><i class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
<a href="calendar.php"><i class="fa-solid fa-calendar"></i><?= translate('calendar', $i18n) ?></a>
<a href="stats.php"><i class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
<a href="settings.php"><i class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
<a href="." class="hideOnMobile"><i
class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
<a href="calendar.php" class="hideOnMobile"><i
class="fa-solid fa-calendar"></i><?= translate('calendar', $i18n) ?></a>
<a href="stats.php" class="hideOnMobile"><i
class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
<a href="settings.php" class="hideOnMobile"><i
class="fa-solid fa-gear"></i><?= translate('settings', $i18n) ?></a>
<?php if ($isAdmin): ?>
<a href="admin.php"><i class="fa-solid fa-user-tie"></i><?= translate('admin', $i18n) ?></a>
<?php endif; ?>
<a href="about.php"><i class="fa-solid fa-info-circle"></i><?= translate('about', $i18n) ?></a>
<?php
if ($settings['disableLogin'] == 0) {
?>
<a href="logout.php"><i class="fa-solid fa-arrow-right-from-bracket"></i><?= translate('logout', $i18n) ?></a>
<?php
}
if ($settings['disableLogin'] == 0) {
?>
<a href="logout.php"><i
class="fa-solid fa-arrow-right-from-bracket"></i><?= translate('logout', $i18n) ?></a>
<?php
}
?>
</div>
</div>
</nav>
</div>
</header>
<main>


<?php
// find out which page is being viewed
$page = basename($_SERVER['PHP_SELF']);
$subscriptionsClass = $page === 'index.php' ? 'active' : '';
$calendarClass = $page === 'calendar.php' ? 'active' : '';
$statsClass = $page === 'stats.php' ? 'active' : '';
$settingsClass = $page === 'settings.php' ? 'active' : '';
?>

<nav class="mobile-nav">
<a href="." class="nav-link <?= $subscriptionsClass ?>" title="<?= translate('subscriptions', $i18n) ?>">
<i class="fas fa-solid fa-list"></i>
</a>
<a href="calendar.php" class="nav-link <?= $calendarClass ?>" title="<?= translate('calendar', $i18n) ?>">
<i class="fas fa-solid fa-calendar"></i>
</a>
<?php
if ($page === 'index.php') {
?>
<button class="nav-link" title="<?= translate('add_subscription', $i18n) ?>" onClick="addSubscription()">
<i class="fas fa-solid fa-plus"></i>
</button>
<?php
} else {
?>
<a href=".?add" class="nav-link secondary" title="<?= translate('add_subscription', $i18n) ?>">
<i class="fas fa-solid fa-plus"></i>
</a>
<?php
}
?>
<a href="stats.php" class="nav-link <?= $statsClass ?>" title="<?= translate('stats', $i18n) ?>">
<i class="fas fa-solid fa-chart-simple"></i>
</a>
<a href="settings.php" class="nav-link <?= $settingsClass ?>" title="<?= translate('settings', $i18n) ?>">
<i class="fas fa-solid fa-cog"></i>
</a>
</nav>

<main>
11 changes: 9 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
?>

<header class="<?= $headerClass ?>" id="main-actions">
<button class="button" onClick="addSubscription()">
<button class="button hideOnMobile" onClick="addSubscription()">
<i class="fa-solid fa-circle-plus"></i>
<?= translate('new_subscription', $i18n) ?>
</button>
Expand Down Expand Up @@ -568,7 +568,14 @@
</form>
</section>
<script src="scripts/dashboard.js?<?= $version ?>"></script>

<?php
if (isset($_GET['add'])) {
?>
<script>
addSubscription();
</script>
<?php
}

require_once 'includes/footer.php';
?>
Loading

0 comments on commit f4e40cf

Please sign in to comment.