Skip to content

Commit

Permalink
put mobile menu behind experimental settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ribeiro committed Sep 29, 2024
1 parent 87103f8 commit 067e0f3
Show file tree
Hide file tree
Showing 25 changed files with 147 additions and 56 deletions.
36 changes: 36 additions & 0 deletions endpoints/settings/mobile_navigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

require_once '../../includes/connect_endpoint.php';

if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
die(json_encode([
"success" => false,
"message" => translate('session_expired', $i18n)
]));
}

if ($_SERVER["REQUEST_METHOD"] === "POST") {
$postData = file_get_contents("php://input");
$data = json_decode($postData, true);

$mobile_nav = $data['value'];

$stmt = $db->prepare('UPDATE settings SET mobile_nav = :mobile_nav WHERE user_id = :userId');
$stmt->bindParam(':mobile_nav', $mobile_nav, SQLITE3_INTEGER);
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER);

if ($stmt->execute()) {
die(json_encode([
"success" => true,
"message" => translate("success", $i18n)
]));
} else {
die(json_encode([
"success" => false,
"message" => translate("error", $i18n)
]));
}
}
«

?>
72 changes: 40 additions & 32 deletions includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ function hex2rgb($hex)
return "$r, $g, $b";
}

$mobileNavigation = $settings['mobile_nav'] ? "mobile-navivagtion" : "";

?>
<!DOCTYPE html>
<html dir="<?= $languages[$lang]['dir'] ?>">
Expand Down Expand Up @@ -139,7 +141,7 @@ function hex2rgb($hex)
<script type="text/javascript" src="scripts/i18n/getlang.js?<?= $version ?>"></script>
</head>

<body class="<?= $theme ?> <?= $languages[$lang]['dir'] ?>">
<body class="<?= $theme ?> <?= $languages[$lang]['dir'] ?> <?= $mobileNavigation ?>">
<header>
<div class="contain">
<div class="logo">
Expand All @@ -153,16 +155,16 @@ function hex2rgb($hex)
<div class="dropdown">
<button class="dropbtn" onClick="toggleDropdown()">
<img src="<?= $userData['avatar'] ?>" alt="me" id="avatar">
<span id="user" class="hideOnMobile"><?= $username ?></span>
<span id="user" class="mobileNavigationHideOnMobile"><?= $username ?></span>
</button>
<div class="dropdown-content">
<a href="." class="hideOnMobile"><i
<a href="." class="mobileNavigationHideOnMobile"><i
class="fa-solid fa-list"></i><?= translate('subscriptions', $i18n) ?></a>
<a href="calendar.php" class="hideOnMobile"><i
<a href="calendar.php" class="mobileNavigationHideOnMobile"><i
class="fa-solid fa-calendar"></i><?= translate('calendar', $i18n) ?></a>
<a href="stats.php" class="hideOnMobile"><i
<a href="stats.php" class="mobileNavigationHideOnMobile"><i
class="fa-solid fa-chart-simple"></i><?= translate('stats', $i18n) ?></a>
<a href="settings.php" class="hideOnMobile"><i
<a href="settings.php" class="mobileNavigationHideOnMobile"><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>
Expand Down Expand Up @@ -191,34 +193,40 @@ class="fa-solid fa-arrow-right-from-bracket"></i><?= translate('logout', $i18n)
$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
if ($settings['mobile_nav'] == 1) {
?>
<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
} else {
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=".?add" class="nav-link secondary" title="<?= translate('add_subscription', $i18n) ?>">
<i class="fas fa-solid fa-plus"></i>
<a href="stats.php" class="nav-link <?= $statsClass ?>" title="<?= translate('stats', $i18n) ?>">
<i class="fas fa-solid fa-chart-simple"></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>
<a href="settings.php" class="nav-link <?= $settingsClass ?>" title="<?= translate('settings', $i18n) ?>">
<i class="fas fa-solid fa-cog"></i>
</a>
</nav>
<?php
}
?>

<main>
3 changes: 2 additions & 1 deletion includes/i18n/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Deaktivierte Abonnements verstecken",
"show_disabled_subscriptions_at_the_bottom" => "Deaktivierte Abonnements am Ende anzeigen",
"experimental_settings" => "Experimentelle Einstellungen",
"remove_background" => "Versuchen den Hintergrund von Logos aus der Bildersuche zu entfernen (experimentell)",
"remove_background" => "Versuchen den Hintergrund von Logos aus der Bildersuche zu entfernen",
"use_mobile_navigation_bar" => "Mobile Navigationsleiste verwenden",
"experimental_info" => "Experimentelle Einstellungen funktionieren möglicherweise nicht perfekt.",
"payment_methods" => "Zahlungsmethoden",
"payment_methods_info" => "Zahlungsmethode zum (de-)aktivieren anklicken.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/el.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Απόκρυψη απενεργοποιημένων συνδρομών",
"show_disabled_subscriptions_at_the_bottom" => "Εμφάνιση απενεργοποιημένων συνδρομών στο τέλος",
"experimental_settings" => "Πειραματικές ρυθμίσεις",
"remove_background" => "Προσπάθεια αφαίρεσης του φόντου των λογότυπων από την αναζήτηση εικόνας (πειραματικά)",
"remove_background" => "Προσπάθεια αφαίρεσης του φόντου των λογότυπων από την αναζήτηση εικόνας",
"use_mobile_navigation_bar" => "Χρήση μπάρας πλοήγησης για κινητά",
"experimental_info" => "Οι πειραματικές ρυθμίσεις πιθανότατα δεν θα λειτουργούν τέλεια.",
"payment_methods" => "Τρόποι πληρωμής",
"payment_methods_info" => "Κάνε κλικ σε μια μέθοδο πληρωμής για να την απενεργοποιήσεις/ενεργοποιήσεις.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@
"hide_disabled_subscriptions" => "Hide disabled subscriptions",
"show_disabled_subscriptions_at_the_bottom" => "Show disabled subscriptions at the bottom",
"experimental_settings" => "Experimental Settings",
"remove_background" => "Attempt to remove background of logos from image search (experimental)",
"remove_background" => "Attempt to remove background of logos from image search",
"use_mobile_navigation_bar" => "Use mobile navigation bar",
"experimental_info" => "Experimental settings will probably not work perfectly.",
"payment_methods" => "Payment Methods",
"payment_methods_info" => "Click a payment method to disable / enable it.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Ocultar suscripciones desactivadas",
"show_disabled_subscriptions_at_the_bottom" => "Mostrar suscripciones desactivadas al final",
"experimental_settings" => "Configuraciones Experimentales",
"remove_background" => "Intentar quitar el fondo de los logotipos de la búsqueda de imágenes (experimental)",
"remove_background" => "Intentar quitar el fondo de los logotipos de la búsqueda de imágenes",
"use_mobile_navigation_bar" => "Usar barra de navegación móvil",
"experimental_info" => "Las configuraciones experimentales probablemente no funcionarán perfectamente.",
"payment_methods" => "Métodos de Pago",
"payment_methods_info" => "Haz clic en un método de pago para deshabilitarlo/habilitarlo.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Masquer les abonnements désactivés",
"show_disabled_subscriptions_at_the_bottom" => "Afficher les abonnements désactivés en bas",
"experimental_settings" => "Paramètres expérimentaux",
"remove_background" => "Tenter de supprimer l'arrière-plan des logos de la recherche d'images (expérimental)",
"remove_background" => "Tenter de supprimer l'arrière-plan des logos de la recherche d'images",
"use_mobile_navigation_bar" => "Utiliser la barre de navigation mobile",
"experimental_info" => "Les paramètres expérimentaux ne fonctionneront probablement pas parfaitement.",
"payment_methods" => "Méthodes de paiement",
"payment_methods_info" => "Cliquez sur une méthode de paiement pour la désactiver / l'activer.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@
"hide_disabled_subscriptions" => 'Nascondi gli abbonamenti disattivati',
"show_disabled_subscriptions_at_the_bottom" => 'Mostra gli abbonamenti disattivati in fondo',
'experimental_settings' => 'Impostazioni sperimentali',
'remove_background' => 'Prova a rimuovere lo sfondo dei loghi dalla ricerca delle immagini (sperimentale)',
'remove_background' => 'Prova a rimuovere lo sfondo dei loghi dalla ricerca delle immagini',
"use_mobile_navigation_bar" => "Utilizza la barra di navigazione mobile",
'experimental_info' => 'Le impostazioni sperimentali potrebbero non funzioneranno perfettamente.',
'payment_methods' => 'Metodi di pagamento',
'payment_methods_info' => 'Fai clic su un metodo di pagamento per abilitarlo/disabilitarlo.',
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/jp.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "無効な定期購入を非表示にする",
"show_disabled_subscriptions_at_the_bottom" => "無効な定期購入を一番下に表示する",
"experimental_settings" => "実験的な設定",
"remove_background" => "画像検索からロゴの背景を削除する (実験)",
"remove_background" => "画像検索からロゴの背景を削除する",
"use_mobile_navigation_bar" => "モバイルナビゲーションバーを使用する",
"experimental_info" => "実験的な設定は、おそらく完全には機能しません。",
"payment_methods" => "支払い方法",
"payment_methods_info" => "支払い方法をクリックして無効/有効を切り替えます。",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/ko.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@
"hide_disabled_subscriptions" => "비활성화된 구독 숨기기",
"show_disabled_subscriptions_at_the_bottom" => "비활성화된 구독을 하단에 표시",
"experimental_settings" => "실험적 설정",
"remove_background" => "로고 이미지 검색에서 배경 삭제 (실험적)",
"remove_background" => "로고 이미지 검색에서 배경 삭제",
"use_mobile_navigation_bar" => "모바일 네비게이션 바 사용",
"experimental_info" => "실험적 설정은 제대로 작동하지 않을 수 있습니다.",
"payment_methods" => "결제 수단",
"payment_methods_info" => "결제 수단을 클릭하여 활성화/비활성화 할 수 있습니다.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/pl.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Ukryj wyłączone subskrypcje",
"show_disabled_subscriptions_at_the_bottom" => "Pokaż wyłączone subskrypcje na dole",
"experimental_settings" => "Ustawienia eksperymentalne",
"remove_background" => "Próba usunięcia tła logo z wyszukiwania obrazów (eksperymentalnie)",
"remove_background" => "Próba usunięcia tła logo z wyszukiwania obrazów",
"use_mobile_navigation_bar" => "Użyj paska nawigacyjnego na urządzeniach mobilnych",
"experimental_info" => "Ustawienia eksperymentalne prawdopodobnie nie będą działać idealnie.",
"payment_methods" => "Metody płatności",
"payment_methods_info" => "Kliknij metodę płatności, aby ją wyłączyć/włączyć..",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/pt.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Esconder subscrições desactivadas",
"show_disabled_subscriptions_at_the_bottom" => "Mostrar subscrições desactivadas no fundo da lista",
"experimental_settings" => "Definições Experimentais",
"remove_background" => "Tentar remover o fundo dos logos na pesquisa de imagem (experimental)",
"remove_background" => "Tentar remover o fundo dos logos na pesquisa de imagem",
"use_mobile_navigation_bar" => "Usar barra de navegação móvel",
"experimental_info" => "Definições experimentais provavelmente não funcionarão correctamente.",
"payment_methods" => "Métodos de Pagamento",
"payment_methods_info" => "Clique num método de pagamento para o activar / desactivar.",
Expand Down
1 change: 1 addition & 0 deletions includes/i18n/pt_br.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"show_disabled_subscriptions_at_the_bottom" => "Mostre as assinaturas desativadas no final da lista",
"experimental_settings" => "Configurações experimentais",
"remove_background" => "Tentar remover o fundo de logos na pesquisa de imagem",
"use_mobile_navigation_bar" => "Usar barra de navegação móvel",
"experimental_info" => "As configurações experimentais provavelmente não funcionarão corretamente",
"payment_methods" => "Métodos de pagamento",
"payment_methods_info" => "Clique em um método de pagamento para ativá-lo ou desativá-lo",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/ru.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Скрыть отключенные подписки",
"show_disabled_subscriptions_at_the_bottom" => "Показать отключенные подписки внизу списка",
"experimental_settings" => "Экспериментальные настройки",
"remove_background" => "Попытка удалить фон логотипов из поиска изображений (экспериментально).",
"remove_background" => "Попытка удалить фон логотипов из поиска изображений.",
"use_mobile_navigation_bar" => "Использовать мобильную панель навигации",
"experimental_info" => "Экспериментальные настройки, вероятно, не будут работать идеально.",
"payment_methods" => "Способы оплаты",
"payment_methods_info" => "Нажмите на способ оплаты, чтобы отключить/включить его.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/sl.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Skrij onemogočene naročnine",
"show_disabled_subscriptions_at_the_bottom" => "Prikaži onemogočene naročnine na dnu seznama",
"experimental_settings" => "Eksperimentalne nastavitve",
"remove_background" => "Poskusi odstraniti ozadje logotipov iz iskanja slik (eksperimentalno)",
"remove_background" => "Poskusi odstraniti ozadje logotipov iz iskanja slik",
"use_mobile_navigation_bar" => "Uporabi mobilno navigacijsko vrstico",
"experimental_info" => "Poskusne nastavitve verjetno ne bodo popolnoma delovale.",
"payment_methods" => "Načini plačila",
"payment_methods_info" => "Kliknite način plačila, da ga onemogočite/omogočite.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/sr.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Сакриј онемогућене претплате",
"show_disabled_subscriptions_at_the_bottom" => "Прикажи онемогућене претплате на дну",
"experimental_settings" => "Експериментална подешавања",
"remove_background" => "Покушајте уклонити позадину логотипа са слика претраге (експериментално)",
"remove_background" => "Покушајте уклонити позадину логотипа са слика претраге",
"use_mobile_navigation_bar" => "Користите мобилну навигациону траку",
"experimental_info" => "Експериментална подешавања вероватно неће радити савршено.",
"payment_methods" => "Начини плаћања",
"payment_methods_info" => "Кликните на начин плаћања да бисте га онемогућили / омогућили.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/sr_lat.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Sakrij onemogućene pretplate",
"show_disabled_subscriptions_at_the_bottom" => "Prikaži onemogućene pretplate na dnu",
"experimental_settings" => "Eksperimentalna podešavanja",
"remove_background" => "Pokušajte ukloniti pozadinu logotipa sa pretrage slika (eksperimentalno)",
"remove_background" => "Pokušajte ukloniti pozadinu logotipa sa pretrage slika",
"use_mobile_navigation_bar" => "Koristi navigacionu traku za mobilne uređaje",
"experimental_info" => "Eksperimentalna podešavanja verovatno neće savršeno funkcionisati.",
"payment_methods" => "Načini plaćanja",
"payment_methods_info" => "Kliknite na način plaćanja da biste ga onemogućili / omogućili.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
"hide_disabled_subscriptions" => "Devre dışı bırakılan abonelikleri gizle",
"show_disabled_subscriptions_at_the_bottom" => "Devre dışı bırakılan abonelikleri altta göster",
"experimental_settings" => "Deneysel Ayarlar",
"remove_background" => "Görsel aramadan logoların arka planını kaldırmayı deneyin (deneysel)",
"remove_background" => "Görsel aramadan logoların arka planını kaldırmayı deneyin",
"use_mobile_navigation_bar" => "Mobil cihazlarda gezinme çubuğunu kullan",
"experimental_info" => "Deneysel ayarlar muhtemelen mükemmel çalışmayacak.",
"payment_methods" => "Ödeme Yöntemleri",
"payment_methods_info" => "Bir ödeme yöntemini devre dışı bırakmak / etkinleştirmek için tıklayın.",
Expand Down
3 changes: 2 additions & 1 deletion includes/i18n/zh_cn.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@
"hide_disabled_subscriptions" => "隐藏已停用的订阅",
"show_disabled_subscriptions_at_the_bottom" => "在订阅列表底部显示已停用的订阅",
"experimental_settings" => "实验性设置",
"remove_background" => "尝试从图片搜索中移除标志的背景(实验性)",
"remove_background" => "尝试从图片搜索中移除标志的背景",
"use_mobile_navigation_bar" => "使用移动导航栏",
"experimental_info" => "实验性设置,可能存在问题。",
"payment_methods" => "支付方式",
"payment_methods_info" => "点击支付方式以禁用/启用。",
Expand Down
Loading

0 comments on commit 067e0f3

Please sign in to comment.