Files
goodgo-platform/apps/web/app/[locale]/(public)/layout.tsx
Ho Ngoc Hai 58209b2434
Some checks failed
CodeQL Analysis / CodeQL (javascript-typescript) (push) Failing after 37s
E2E Tests / Playwright E2E (push) Failing after 7s
CI / AI Services (Python) — Smoke (push) Failing after 5s
Deploy / Build API Image (push) Failing after 5s
Deploy / Build Web Image (push) Failing after 7s
Deploy / Build AI Services Image (push) Failing after 4s
Security Scanning / Dependency Audit (pnpm) (push) Failing after 5s
Security Scanning / Trivy Scan — API Image (push) Failing after 40s
Security Scanning / Trivy Scan — Web Image (push) Failing after 40s
Security Scanning / Trivy Scan — AI Services Image (push) Failing after 31s
Security Scanning / Trivy Filesystem Scan (push) Failing after 30s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 5s
CI / E2E Tests (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Security Scanning / Security Gate (push) Failing after 0s
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped
fix(web): remove hardcoded mock ticker from public layout
The public layout rendered its own TickerStrip with 8 hardcoded mock
values ('Quận 1 +2.40%', 'Thủ Đức -0.80%', …) above the navbar. The
homepage already has a live DashboardTicker driven by /price-movers,
so this static one was visual noise that disagreed with the real data
just below it. Drop the bar + its helper variables, and update the
layout test to assert the static ticker is gone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 18:01:14 +07:00

162 lines
4.7 KiB
TypeScript

'use client';
import { usePathname } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { CompareFloatingBar } from '@/components/comparison/compare-floating-bar';
import { Footer } from '@/components/design-system/footer';
import { Navbar } from '@/components/design-system/navbar';
import { NotificationBell } from '@/components/notifications/notification-bell';
import { useTheme } from '@/components/providers/theme-provider';
import { LanguageSwitcher } from '@/components/ui/language-switcher';
import { Link, useRouter } from '@/i18n/navigation';
import { useAuthStore } from '@/lib/auth-store';
/** Render adapter — bridges design-system <Navbar/> and <Footer/> to next-intl's <Link>. */
function renderLink({
href,
children,
className,
onClick,
}: {
href: string;
children: React.ReactNode;
className?: string;
onClick?: () => void;
}) {
return (
<Link href={href as '/'} className={className} onClick={onClick}>
{children}
</Link>
);
}
export default function PublicLayout({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
const router = useRouter();
const { user, logout } = useAuthStore();
const { theme, toggleTheme } = useTheme();
const t = useTranslations();
const dashboardHref = user?.role === 'ADMIN' ? '/admin' : '/dashboard';
const handleLogout = async () => {
await logout();
router.push('/');
};
const navLinks = [
{
href: '/',
label: t('nav.home'),
isActive: pathname === '/' || !!pathname.match(/^\/(vi|en)\/?$/),
},
{
href: '/search',
label: t('nav.search'),
isActive: pathname.includes('/search'),
},
{
href: '/du-an',
label: t('nav.projects'),
isActive: pathname.includes('/du-an'),
},
{
href: '/khu-cong-nghiep',
label: t('nav.industrialParks'),
isActive: pathname.includes('/khu-cong-nghiep'),
},
{
href: '/chuyen-nhuong',
label: t('nav.transfer'),
isActive: pathname.includes('/chuyen-nhuong'),
},
{
href: '/pricing',
label: t('nav.pricing'),
isActive: pathname.includes('/pricing'),
},
];
const footerLinkGroups = [
{
title: t('footer.propertyTypes'),
links: [
{ label: t('propertyTypes.APARTMENT'), href: '/search?propertyType=APARTMENT' },
{ label: t('propertyTypes.HOUSE'), href: '/search?propertyType=HOUSE' },
{ label: t('propertyTypes.VILLA'), href: '/search?propertyType=VILLA' },
{ label: t('propertyTypes.LAND'), href: '/search?propertyType=LAND' },
],
},
{
title: t('footer.areas'),
links: [
{ label: 'TP. Hồ Chí Minh', href: '/search?city=Hồ Chí Minh' },
{ label: 'Hà Nội', href: '/search?city=Hà Nội' },
{ label: 'Đà Nẵng', href: '/search?city=Đà Nẵng' },
{ label: 'Nha Trang', href: '/search?city=Nha Trang' },
],
},
{
title: t('footer.support'),
links: [
{ label: t('nav.pricing'), href: '/pricing' },
{ label: t('common.login'), href: '/login' },
{ label: t('common.register'), href: '/register' },
],
},
];
return (
<div className="min-h-screen w-full overflow-x-clip bg-background">
<Navbar
brand={t('common.goodgo')}
links={navLinks}
user={user}
dashboardHref={dashboardHref}
notifications={<NotificationBell />}
languageSwitcher={<LanguageSwitcher />}
theme={theme}
onToggleTheme={toggleTheme}
onLogout={handleLogout}
renderLink={renderLink}
labels={{
login: t('common.login'),
register: t('common.register'),
dashboard: t('common.dashboard'),
admin: t('common.admin'),
profile: t('common.profile'),
logout: t('common.logout'),
openMenu: t('nav.openMenu'),
closeMenu: t('nav.closeMenu'),
darkMode: t('dashboard.darkMode'),
lightMode: t('dashboard.lightMode'),
mainNav: t('nav.mainNav'),
}}
/>
<main id="main-content" role="main">
{children}
</main>
<CompareFloatingBar />
<Footer
brand={t('common.goodgo')}
description={t('footer.description')}
linkGroups={footerLinkGroups}
copyright={t('common.allRightsReserved')}
contact={{
address: 'TP. Hồ Chí Minh, Việt Nam',
phone: '1900 xxxx',
email: 'support@goodgo.vn',
}}
socials={[
{ platform: 'facebook', href: '#' },
{ platform: 'youtube', href: '#' },
]}
renderLink={renderLink}
/>
</div>
);
}