diff --git a/src/market-app/App.vue b/src/market-app/App.vue index 8c7f8ba..9aed606 100644 --- a/src/market-app/App.vue +++ b/src/market-app/App.vue @@ -6,8 +6,9 @@ import LoginDialog from '@/components/auth/LoginDialog.vue' import { useTheme } from '@/components/theme-provider' import { toast } from 'vue-sonner' import { useAuth } from '@/composables/useAuthService' -import { Button } from '@/components/ui/button' -import { LogIn } from 'lucide-vue-next' +import { + Store, ShoppingCart, Package, LogIn, User as UserIcon, +} from 'lucide-vue-next' const route = useRoute() const router = useRouter() @@ -17,8 +18,47 @@ const { isAuthenticated } = useAuth() const showLoginDialog = ref(false) +interface Tab { + name: string + icon: any + path?: string + authRequired?: boolean + onClick?: () => void +} + +const bottomTabs = computed(() => [ + { name: 'Browse', icon: Store, path: '/market' }, + { name: 'Cart', icon: ShoppingCart, path: '/cart' }, + { name: 'My Store', icon: Package, path: '/market/dashboard', authRequired: true }, + isAuthenticated.value + ? { name: 'Profile', icon: UserIcon, path: '/profile' } + : { name: 'Log in', icon: LogIn, path: '/login' }, +]) + const isLoginPage = computed(() => route.path === '/login') +function isActiveTab(tab: Tab): boolean { + if (!tab.path) return false + if (tab.path === '/market') { + return route.path === '/market' || route.path.startsWith('/market/stall/') || route.path.startsWith('/market/product/') + } + if (tab.path === '/cart') return route.path === '/cart' || route.path.startsWith('/checkout/') + return route.path.startsWith(tab.path) +} + +function onTabClick(tab: Tab) { + if (tab.authRequired && !isAuthenticated.value) { + toast.info(`${tab.name} requires login`, { + action: { + label: 'Log in', + onClick: () => router.push('/login'), + }, + }) + return + } + if (tab.path) router.push(tab.path) +} + async function handleLoginSuccess() { showLoginDialog.value = false toast.success('Welcome!') @@ -30,15 +70,33 @@ async function handleLoginSuccess() {
-
- -
- -
+
+ +
diff --git a/src/modules/market/composables/useMarket.ts b/src/modules/market/composables/useMarket.ts index 98ea935..47ccaa0 100644 --- a/src/modules/market/composables/useMarket.ts +++ b/src/modules/market/composables/useMarket.ts @@ -168,7 +168,11 @@ export function useMarket() { relays: config.nostr.relays, selected: true, opts: { - name: `${import.meta.env.VITE_APP_NAME} Market`, + // Logged-in user has no published market event yet — show their + // namespace as "My Market". Avoids leaking VITE_APP_NAME (which + // is the brand of whichever standalone app is bundled, e.g. + // "Sortir" for activities) into the market label. + name: 'My Market', description: 'A communal market to sell your goods', merchants: [], ui: {}