From c3c0d6d2c179c83a1700d773c496ff7a44cce99c Mon Sep 17 00:00:00 2001 From: Nikita Kiselev Date: Sat, 25 Oct 2025 18:48:47 +0300 Subject: [PATCH] feat(spa): show navbar with app logo and app name --- .../controller/extension/module/tgshop.php | 10 +-- .../template/extension/module/tgshop.twig | 19 ++-- .../src/Handlers/SettingsHandler.php | 3 +- spa/src/App.vue | 49 ++++++++--- spa/src/components/Dock.vue | 2 +- spa/src/components/Navbar.vue | 56 ++++++++++++ spa/src/style.css | 15 +++- spa/src/views/Cart.vue | 10 ++- spa/src/views/Checkout.vue | 86 +++++++++---------- 9 files changed, 174 insertions(+), 76 deletions(-) create mode 100644 spa/src/components/Navbar.vue diff --git a/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php b/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php index 686f99d..e5bab9c 100755 --- a/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php +++ b/module/oc_telegram_shop/upload/admin/controller/extension/module/tgshop.php @@ -378,24 +378,22 @@ TEXT, ], 'module_tgshop_app_name' => [ - 'hidden' => true, - 'required' => true, 'type' => 'text', - 'placeholder' => 'Введите название Телеграм магазина', + 'placeholder' => 'Без названия', 'help' => << [ - 'hidden' => true, 'type' => 'image', 'help' => << + - - {# Image #} + {# Textarea #} {% elseif item['type'] == 'textarea' %} - {# Products #} {% elseif item['type'] == 'products' %} @@ -450,4 +448,13 @@ -{{ footer }} \ No newline at end of file +{{ footer }} + + \ No newline at end of file diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/SettingsHandler.php b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/SettingsHandler.php index ff413b0..8d726ff 100755 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/SettingsHandler.php +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Handlers/SettingsHandler.php @@ -37,11 +37,12 @@ class SettingsHandler $icons['icon180'] = $this->imageTool->resize($appIcon, 180, 180, 'no_image.png', 'png'). '?_v=' . $hash; $icons['icon152'] = $this->imageTool->resize($appIcon, 152, 152, 'no_image.png', 'png'). '?_v=' . $hash; $icons['icon120'] = $this->imageTool->resize($appIcon, 120, 120, 'no_image.png', 'png'). '?_v=' . $hash; + $appIcon = $this->imageTool->resize($appIcon, 32, 32, 'no_image.png', 'png'). '?_v=' . $hash; } return new JsonResponse([ 'app_name' => $this->settings->get('app_name'), - 'app_icon' => $appIcon ? $appIcon . '?_v=' . $hash : '', + 'app_icon' => $appIcon ?? '', 'app_icon192' => $icons['icon192'] ?? '', 'app_icon180' => $icons['icon180'] ?? '', 'app_icon152' => $icons['icon152'] ?? '', diff --git a/spa/src/App.vue b/spa/src/App.vue index 9f66333..154a097 100644 --- a/spa/src/App.vue +++ b/spa/src/App.vue @@ -1,18 +1,35 @@ @@ -25,6 +42,7 @@ import {useSettingsStore} from "@/stores/SettingsStore.js"; import {useProductFiltersStore} from "@/stores/ProductFiltersStore.js"; import CartButton from "@/components/CartButton.vue"; import Dock from "@/components/Dock.vue"; +import Navbar from "@/components/Navbar.vue"; const tg = useMiniApp(); const platform = ref(); @@ -39,6 +57,7 @@ const settings = useSettingsStore(); const filtersStore = useProductFiltersStore(); const backButton = window.Telegram.WebApp.BackButton; const haptic = window.Telegram.WebApp.HapticFeedback; +const drawerOpen = ref(false); const routesToHideAppDock = [ 'product.show', @@ -56,6 +75,10 @@ function navigateBack() { router.back(); } +function toggleDrawer() { + drawerOpen.value = !drawerOpen.value +} + watch( () => route.name, () => { @@ -71,7 +94,7 @@ watch( ); function handleClickOutside(e) { - if (!e.target.closest('input')) { + if (!e.target.closest('input,select,textarea')) { document.activeElement?.blur(); } } diff --git a/spa/src/components/Dock.vue b/spa/src/components/Dock.vue index a54398e..8a6fddb 100644 --- a/spa/src/components/Dock.vue +++ b/spa/src/components/Dock.vue @@ -1,7 +1,7 @@ + + + + \ No newline at end of file diff --git a/spa/src/style.css b/spa/src/style.css index 74587b0..82a1791 100644 --- a/spa/src/style.css +++ b/spa/src/style.css @@ -14,6 +14,7 @@ html { --swiper-pagination-bullet-inactive-color: var(--color-base-content); --swiper-pagination-fraction-color: var(--color-neutral-content); --product_list_title_max_lines: 1; + --tc-navbar-min-height: 3rem; } .swiper-pagination-bullets { @@ -41,14 +42,22 @@ html { } .app-header { - z-index: 100; + z-index: 60; position: fixed; background: var(--color-primary); - padding-top: calc(var(--tg-content-safe-area-inset-top) + var(--tg-safe-area-inset-top)); + height: calc(var(--tg-content-safe-area-inset-top) + var(--tg-safe-area-inset-top)); + min-height: calc(var(--tg-content-safe-area-inset-top) + var(--tg-safe-area-inset-top)); + max-height: calc(var(--tg-content-safe-area-inset-top) + var(--tg-safe-area-inset-top)); display: flex; - justify-content: center; + flex-direction: column; + justify-content: end; align-items: center; color: white; + padding-bottom: 8px; +} + +.telecart-main-section { + padding-top: calc(var(--tg-content-safe-area-inset-top) + var(--tg-safe-area-inset-top) + var(--tc-navbar-min-height)); } .swiper-pagination-bullets > .swiper-pagination-bullet { diff --git a/spa/src/views/Cart.vue b/spa/src/views/Cart.vue index 6aa325a..6496011 100644 --- a/spa/src/views/Cart.vue +++ b/spa/src/views/Cart.vue @@ -109,7 +109,7 @@ -
+