Skip to content

Commit

Permalink
fix: cleaner logic for tab title
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya committed Jul 30, 2024
1 parent cd6a9fc commit 4ad7f19
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core/app/[locale]/(default)/account/[tab]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ export default async function AccountTabLayout({

const messages = await getMessages();

const tabsTitles = {
orders: t('orders'),
messages: t('messages'),
addresses: t('addresses'),
wishlists: t('wishlists'),
'recently-viewed': t('recentlyViewed'),
settings: t('settings'),
};

return (
<NextIntlClientProvider locale={locale} messages={{ Account: messages.Account ?? {} }}>
<AccountStatusProvider>
<h1 className="my-8 text-4xl font-black lg:my-8 lg:text-5xl">{t('heading')}</h1>
<nav aria-label={t('accountTabsLabel')}>
<ul className="mb-8 flex list-none items-start overflow-x-auto text-base">
<ul className="mb-8 flex items-start overflow-x-auto">
{tabList.map((tab) => (
<li key={tab}>
<Link
Expand All @@ -50,7 +59,7 @@ export default async function AccountTabLayout({
prefetch="viewport"
prefetchKind="full"
>
{tab === 'recently-viewed' ? t('recentlyViewed') : t(tab)}
{tabsTitles[tab]}
</Link>
</li>
))}
Expand Down

0 comments on commit 4ad7f19

Please sign in to comment.