From 0ee0bc428c6f91c6095534701920a9db48696116 Mon Sep 17 00:00:00 2001 From: padreug Date: Fri, 5 Sep 2025 00:31:53 +0200 Subject: [PATCH] Refactor chat module and navigation components for improved user experience - Update app configuration to load chat module on startup for route registration. - Introduce useModularNavigation composable for dynamic navigation based on enabled modules. - Simplify Navbar.vue by utilizing userMenuItems for dropdown and button rendering, enhancing maintainability. - Enhance ChatPage.vue with detailed debug information and user authentication checks for better feedback. --- src/app.config.ts | 2 +- src/components/layout/Navbar.vue | 50 ++++------- src/composables/useModularNavigation.ts | 106 ++++++++++++++++++++++++ src/modules/chat/views/ChatPage.vue | 52 +++++++++++- 4 files changed, 175 insertions(+), 35 deletions(-) create mode 100644 src/composables/useModularNavigation.ts diff --git a/src/app.config.ts b/src/app.config.ts index 0a23d0e..09c9625 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -42,7 +42,7 @@ export const appConfig: AppConfig = { chat: { name: 'chat', enabled: true, - lazy: true, // Load on demand + lazy: false, // Load on startup to register routes config: { maxMessages: 500, autoScroll: true, diff --git a/src/components/layout/Navbar.vue b/src/components/layout/Navbar.vue index 2cde6dc..592305b 100644 --- a/src/components/layout/Navbar.vue +++ b/src/components/layout/Navbar.vue @@ -16,6 +16,7 @@ import { auth } from '@/composables/useAuth' import { useMarketPreloader } from '@/composables/useMarketPreloader' import { useMarketStore } from '@/stores/market' import { nostrChat } from '@/composables/useNostrChat' +import { useModularNavigation } from '@/composables/useModularNavigation' interface NavigationItem { name: string @@ -31,13 +32,9 @@ const showProfileDialog = ref(false) const showLogoutConfirm = ref(false) const marketPreloader = useMarketPreloader() const marketStore = useMarketStore() +const { navigation: modularNavigation, userMenuItems } = useModularNavigation() -const navigation = computed(() => [ - { name: t('nav.home'), href: '/' }, - { name: t('nav.events'), href: '/events' }, - { name: t('nav.market'), href: '/market' }, - { name: t('nav.chat'), href: '/chat' }, -]) +const navigation = modularNavigation // Compute total wallet balance const totalBalance = computed(() => { @@ -167,18 +164,13 @@ const handleLogout = async () => { Profile - - - My Tickets - - - - - Market Dashboard - - - - Relay Hub Status + + + {{ item.name }} @@ -256,21 +248,15 @@ const handleLogout = async () => { Profile - - - -