Share customer session cookies with the storefront and polish business settings.
Keep JWT login mirrored on the tenant cookie domain, improve e-payment settings UX, and add a storefront link from the customer sidebar. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
c289de5d2e
commit
dc570c1e7f
@@ -1,13 +1,13 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { NavLink, useNavigate } from 'react-router-dom'
|
||||
import { Home, User, MapPin, ShoppingBag, Heart, Package, HelpCircle, LogOut } from 'lucide-react'
|
||||
import { Home, User, MapPin, ShoppingBag, Heart, Package, HelpCircle, LogOut, Globe } from 'lucide-react'
|
||||
import { useLocale } from '@meshkee/dashboard-ui'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { useTenantBranding } from '../context/TenantBrandingContext'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { getActiveBusinessDomain } from '../lib/businessContext'
|
||||
import { isAbortError } from '../lib/api'
|
||||
import { getWebsiteBusinessInfo } from '../services/websiteService'
|
||||
import { getWebsiteBusinessInfo, getWebsiteUrl } from '../services/websiteService'
|
||||
import { hasBusinessModule } from '../utils/businessModules'
|
||||
import meshkeeLogo from '../assets/meshkee-logo.png'
|
||||
import styles from './Sidebar.module.css'
|
||||
@@ -26,6 +26,7 @@ export function Sidebar({ open = false }: SidebarProps) {
|
||||
const [logoUrl, setLogoUrl] = useState<string | null>(null)
|
||||
|
||||
const businessDomain = getActiveBusinessDomain()
|
||||
const websiteUrl = getWebsiteUrl(businessDomain)
|
||||
const fallbackBusinessName = user?.customerBusinesses[0]?.name ?? t('app.storeFallback')
|
||||
const displayName = brandName || fallbackBusinessName
|
||||
const showMyProducts = hasBusinessModule(enabledModules, 'customer_products')
|
||||
@@ -73,17 +74,23 @@ export function Sidebar({ open = false }: SidebarProps) {
|
||||
id="dashboard-sidebar"
|
||||
className={`${styles.sidebar} ${open ? styles.open : ''}`}
|
||||
>
|
||||
<div className={styles.brand}>
|
||||
<a
|
||||
href={websiteUrl}
|
||||
className={styles.brand}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={t('nav.goToWebsite')}
|
||||
>
|
||||
<img
|
||||
src={logoUrl || meshkeeLogo}
|
||||
alt={displayName}
|
||||
className={styles.brandLogo}
|
||||
alt=""
|
||||
className={logoUrl ? `${styles.brandLogo} ${styles.brandLogoUploaded}` : styles.brandLogo}
|
||||
/>
|
||||
<div className={styles.brandText}>
|
||||
<span className={styles.brandName}>{displayName}</span>
|
||||
<span className={styles.brandDomain}>{businessDomain}</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<nav className={styles.nav}>
|
||||
{navItems.map((item) => (
|
||||
@@ -102,6 +109,15 @@ export function Sidebar({ open = false }: SidebarProps) {
|
||||
</nav>
|
||||
|
||||
<div className={styles.footer}>
|
||||
<a
|
||||
href={websiteUrl}
|
||||
className={styles.navItem}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Globe size={20} />
|
||||
<span>{t('nav.goToWebsite')}</span>
|
||||
</a>
|
||||
<button type="button" className={styles.navItem}>
|
||||
<HelpCircle size={20} />
|
||||
<span>{t('nav.help')}</span>
|
||||
|
||||
Reference in New Issue
Block a user