ui phase 11
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
'use client';
|
||||
import { FunctionComponent, PropsWithChildren, useMemo } from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { ProfileSummary } from '@/components';
|
||||
import { Stack } from '@mui/material';
|
||||
import { ProfileSummary, StatusChip } from '@/components';
|
||||
import { ROUTES } from '@/constants';
|
||||
import { LinkToPage } from '@/utils';
|
||||
import { useMyPartnerCenter } from '@/services/partnerCenter';
|
||||
@@ -11,11 +12,14 @@ import TopBarAndSideBarLayout from './TopBarAndSideBarLayout';
|
||||
* Partner-center portal shell (f15) — a **separate authz scope** from the Balinyaar admin console. A
|
||||
* center admin is not a Balinyaar admin; they see only their own center's data (server-enforced
|
||||
* tenancy). Same engine as the admin shell; the TopBar identity slot shows the center's own name
|
||||
* (skeleton while resolving) — the page-level access-denied state (403/404) stays where it is.
|
||||
* (skeleton while resolving) **plus a compact merchant-of-record indicator** (ui-phase-11 — previously
|
||||
* only the home page's own header showed this, so it disappeared once a center admin navigated away) —
|
||||
* the page-level access-denied state (403/404) stays where it is.
|
||||
* @layout PartnerLayout
|
||||
*/
|
||||
const PartnerLayout: FunctionComponent<PropsWithChildren> = ({ children }) => {
|
||||
const t = useTranslations('nav');
|
||||
const tPartner = useTranslations('partner');
|
||||
const { data: center, isLoading } = useMyPartnerCenter();
|
||||
|
||||
const sidebarItems: Array<LinkToPage> = useMemo(
|
||||
@@ -31,7 +35,18 @@ const PartnerLayout: FunctionComponent<PropsWithChildren> = ({ children }) => {
|
||||
return (
|
||||
<TopBarAndSideBarLayout
|
||||
sidebarItems={sidebarItems}
|
||||
identity={<ProfileSummary compact displayName={center?.name ?? ''} loading={isLoading} />}
|
||||
identity={
|
||||
<Stack direction="row" sx={{ gap: 1, alignItems: 'center', minWidth: 0 }}>
|
||||
<ProfileSummary compact displayName={center?.name ?? ''} loading={isLoading} />
|
||||
{!isLoading && center ? (
|
||||
<StatusChip
|
||||
status={center.isMerchantOfRecord ? 'active' : 'neutral'}
|
||||
label={center.isMerchantOfRecord ? tPartner('is_mor_yes') : tPartner('is_mor_no')}
|
||||
sx={{ height: 20, fontSize: '0.6875rem', display: { xs: 'none', sm: 'inline-flex' } }}
|
||||
/>
|
||||
) : null}
|
||||
</Stack>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</TopBarAndSideBarLayout>
|
||||
|
||||
Reference in New Issue
Block a user