Files
medreport_mrb2b/app/home/(user)/_components/home-menu-navigation.tsx
Helena 195af1db3d MED-137: add doctor other jobs view (#55)
* add doctor jobs view

* change translation

* another translation change

* clean up

* add analaysis detail view to paths config

* translation

* merge fix

* fix path

* move components to shared

* refactor

* imports

* clean up
2025-08-25 11:12:57 +03:00

66 lines
2.4 KiB
TypeScript

import Link from 'next/link';
import { ShoppingCart } from 'lucide-react';
import { Trans } from '@kit/ui/trans';
import { AppLogo } from '@kit/shared/components/app-logo';
import { ProfileAccountDropdownContainer } from '@kit/shared/components/personal-account-dropdown-container';
import { Search } from '@kit/shared/components/ui/search';
import { SIDEBAR_WIDTH_PROPERTY } from '@/packages/ui/src/shadcn/constants';
import { Button } from '@kit/ui/button';
import { UserNotifications } from '../_components/user-notifications';
import { type UserWorkspace } from '../_lib/server/load-user-workspace';
import { StoreCart } from '@medusajs/types';
import { formatCurrency } from '@/packages/shared/src/utils';
import { createI18nServerInstance } from '@/lib/i18n/i18n.server';
export async function HomeMenuNavigation(props: { workspace: UserWorkspace, cart: StoreCart | null }) {
const { language } = await createI18nServerInstance();
const { workspace, user, accounts } = props.workspace;
const totalValue = props.cart?.total ? formatCurrency({
currencyCode: props.cart.currency_code,
locale: language,
value: props.cart.total,
}) : 0;
const cartItemsCount = props.cart?.items?.length ?? 0;
const hasCartItems = cartItemsCount > 0;
return (
<div className={'flex w-full flex-1 items-center justify-between gap-3'}>
<div className={`flex items-center ${SIDEBAR_WIDTH_PROPERTY}`}>
<AppLogo />
</div>
<Search
className="flex grow"
startElement={<Trans i18nKey="common:search" values={{ end: '...' }} />}
/>
<div className="flex items-center justify-end gap-3">
{hasCartItems && (
<Button className='relative px-4 py-2 h-10 border-1 mr-0 cursor-pointer' variant='ghost'>
<span className='flex items-center text-nowrap'>{totalValue}</span>
</Button>
)}
<Link href='/home/cart'>
<Button variant="ghost" className='relative px-4 py-2 h-10 border-1 mr-0 cursor-pointer' >
<ShoppingCart className="stroke-[1.5px]" />
<Trans i18nKey="common:shoppingCartCount" values={{ count: cartItemsCount }} />
</Button>
</Link>
<UserNotifications userId={user.id} />
<div>
<ProfileAccountDropdownContainer
user={user}
account={workspace}
showProfileName
accounts={accounts}
/>
</div>
</div>
</div>
);
}