Compare commits
No commits in common. "dc221f50bf9aecd4981066ea38aa0cc63c4fa8d2" and "46958936dcb7fbb12bf224350e6d2c62270eccc7" have entirely different histories.
dc221f50bf
...
46958936dc
|
|
@ -29,7 +29,6 @@ next-env.d.ts
|
||||||
# Fonts and icon sprite, written by island's font-copy and icon-sprite plugins on next dev and next build (0012)
|
# Fonts and icon sprite, written by island's font-copy and icon-sprite plugins on next dev and next build (0012)
|
||||||
apps/*/public/icons/
|
apps/*/public/icons/
|
||||||
apps/*/public/fonts/
|
apps/*/public/fonts/
|
||||||
server-proxy.js
|
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
coverage
|
coverage
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,7 @@
|
||||||
"categories": {
|
"categories": {
|
||||||
"correctness": "error"
|
"correctness": "error"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {},
|
||||||
"jsx-a11y/aria-role": ["error", { "ignoreNonDOM": true }]
|
|
||||||
},
|
|
||||||
"env": {
|
"env": {
|
||||||
"builtin": true,
|
"builtin": true,
|
||||||
"browser": true,
|
"browser": true,
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"options": {
|
"options": {
|
||||||
"command": "next dev --port 7001"
|
"command": "next dev --port 3002"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"start": {
|
"start": {
|
||||||
"options": {
|
"options": {
|
||||||
"command": "next start --port 7001"
|
"command": "next start --port 3002"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { LoginStep } from '@lumina/market/app/screens/(auth)/auth/login/organism
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return { title: i18n.t('auth:login.meta-title'), robots: { index: false } };
|
return { title: i18n.t('auth:login.meta-title'), robots: { index: false } };
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { LoginVerifyStep } from '@lumina/market/app/screens/(auth)/auth/login/ve
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/regi
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { RegisterTypeStep } from '@lumina/market/app/screens/(auth)/auth/registe
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { RegisterPhoneStep } from '@lumina/market/app/screens/(auth)/auth/regist
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { RegisterVerifyStep } from '@lumina/market/app/screens/(auth)/auth/regis
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
|
||||||
import { i18n } from '../../i18n';
|
import { i18n } from '../../i18n';
|
||||||
import { AuthTemplate } from '../templates/auth-template';
|
import { AuthTemplate } from './templates/auth-template';
|
||||||
|
|
||||||
/** Login and registration, before their frame arrives: the header, the card and a form step's shape. */
|
/** Login and registration, before their frame arrives: the header, the card and a form step's shape. */
|
||||||
export default function AuthLoading() {
|
export default function AuthLoading() {
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,19 @@ import { Typography } from '@lumina/island/atoms/typography';
|
||||||
import { Card } from '@lumina/island/molecules/card';
|
import { Card } from '@lumina/island/molecules/card';
|
||||||
import { cn } from '@lumina/island/tools/cn';
|
import { cn } from '@lumina/island/tools/cn';
|
||||||
import { ROUTES } from '@lumina/market/app/navigation';
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry';
|
import { SupportEntry } from '@lumina/market/app/screens/(auth)/organisms/support-entry';
|
||||||
import NextLink from 'next/link';
|
import NextLink from 'next/link';
|
||||||
|
|
||||||
import { i18n } from '../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import type { AuthTemplateProps } from './types';
|
import type { AuthTemplateProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Login and registration on desktop: the logged-out header (the brand and support) and each
|
* Login and registration on desktop: the logged-out header (the brand and support) and each
|
||||||
* step in one centred card, its buttons inside the card under the fields. Registration step 5
|
* step in one centred card, its buttons inside the card under the fields. Browser back is the
|
||||||
* keeps the header, signed in: there is no nav until registration is complete. Browser back is the
|
|
||||||
* way back; there is no back button.
|
* way back; there is no back button.
|
||||||
*/
|
*/
|
||||||
export function AuthTemplate({
|
export function AuthTemplate({
|
||||||
width = 'narrow',
|
width = 'narrow',
|
||||||
framed = true,
|
|
||||||
children,
|
children,
|
||||||
}: AuthTemplateProps) {
|
}: AuthTemplateProps) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -45,19 +43,15 @@ export function AuthTemplate({
|
||||||
justifyContent="justify-center"
|
justifyContent="justify-center"
|
||||||
className="px-4 pt-28 pb-16"
|
className="px-4 pt-28 pb-16"
|
||||||
>
|
>
|
||||||
{framed ? (
|
<Card
|
||||||
<Card
|
padding="none"
|
||||||
padding="none"
|
className={cn(
|
||||||
className={cn(
|
'w-full p-10',
|
||||||
'w-full p-10',
|
width === 'wide' ? 'max-w-form' : 'max-w-checkout',
|
||||||
width === 'wide' ? 'max-w-form' : 'max-w-checkout',
|
)}
|
||||||
)}
|
>
|
||||||
>
|
{children}
|
||||||
{children}
|
</Card>
|
||||||
</Card>
|
|
||||||
) : (
|
|
||||||
children
|
|
||||||
)}
|
|
||||||
</FlexBox>
|
</FlexBox>
|
||||||
</FlexBox>
|
</FlexBox>
|
||||||
);
|
);
|
||||||
|
|
@ -3,10 +3,5 @@ import type { ReactNode } from 'react';
|
||||||
export type AuthTemplateProps = {
|
export type AuthTemplateProps = {
|
||||||
/** narrow (480): the number and the code. wide (560): the account type and step 4. */
|
/** narrow (480): the number and the code. wide (560): the account type and step 4. */
|
||||||
width?: 'narrow' | 'wide';
|
width?: 'narrow' | 'wide';
|
||||||
/**
|
|
||||||
* false: no card; the step draws its own, such as registration step 5's form card beside its
|
|
||||||
* live preview.
|
|
||||||
*/
|
|
||||||
framed?: boolean;
|
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
};
|
};
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
|
||||||
|
|
||||||
import { i18n } from '../../i18n';
|
|
||||||
import { AuthTemplate } from '../templates/auth-template';
|
|
||||||
|
|
||||||
/** Registration's last steps, before their frame arrives: the header, the card and a form step's shape. */
|
|
||||||
export default function OnboardingLoading() {
|
|
||||||
return (
|
|
||||||
<AuthTemplate width="wide">
|
|
||||||
<SkeletonPreset preset="form" delayed label={i18n.t('auth:loading')} />
|
|
||||||
</AuthTemplate>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
|
||||||
import {
|
|
||||||
CreatorProfileStep,
|
|
||||||
CreatorProfileStepSkeleton,
|
|
||||||
} from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step';
|
|
||||||
import type { Metadata } from 'next';
|
|
||||||
import { Suspense } from 'react';
|
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
|
||||||
return {
|
|
||||||
title: i18n.t('auth:register.profile.meta-title'),
|
|
||||||
robots: { index: false },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registration step 5 for a creator, on the session: the form card beside its live preview. The
|
|
||||||
* frame renders on the server; the step only in the browser, behind the same-size skeleton.
|
|
||||||
*/
|
|
||||||
export default function CreatorProfilePage() {
|
|
||||||
const skeleton = (
|
|
||||||
<CreatorProfileStepSkeleton
|
|
||||||
layout="desktop"
|
|
||||||
label={i18n.t('auth:loading')}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<AuthTemplate framed={false}>
|
|
||||||
<AuthGuard role="creator" fallback={skeleton}>
|
|
||||||
<Suspense fallback={skeleton}>
|
|
||||||
<CreatorProfileStep
|
|
||||||
size="md"
|
|
||||||
layout="desktop"
|
|
||||||
supportPlacement="popover"
|
|
||||||
/>
|
|
||||||
</Suspense>
|
|
||||||
</AuthGuard>
|
|
||||||
</AuthTemplate>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
|
||||||
import { InvestorProfileStep } from '@lumina/market/app/screens/(onboarding)/onboarding/investor-profile/organisms/investor-profile-step';
|
|
||||||
import type { Metadata } from 'next';
|
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
|
||||||
return {
|
|
||||||
title: i18n.t('auth:register.profile.meta-title'),
|
|
||||||
robots: { index: false },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registration step 5 for an investor, optional, on the session, in the 560 card. The frame
|
|
||||||
* renders on the server; the step only in the browser, for the signed-in investor.
|
|
||||||
*/
|
|
||||||
export default function InvestorProfilePage() {
|
|
||||||
return (
|
|
||||||
<AuthTemplate width="wide">
|
|
||||||
<AuthGuard
|
|
||||||
role="investor"
|
|
||||||
fallback={
|
|
||||||
<SkeletonPreset
|
|
||||||
preset="form"
|
|
||||||
count={2}
|
|
||||||
label={i18n.t('auth:loading')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<InvestorProfileStep size="md" supportPlacement="popover" />
|
|
||||||
</AuthGuard>
|
|
||||||
</AuthTemplate>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
},
|
},
|
||||||
"dev": {
|
"dev": {
|
||||||
"options": {
|
"options": {
|
||||||
"command": "next dev --port 7000"
|
"command": "next dev --port 3001"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"start": {
|
"start": {
|
||||||
"options": {
|
"options": {
|
||||||
"command": "next start --port 7000"
|
"command": "next start --port 3001"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import { LoginStep } from '@lumina/market/app/screens/(auth)/auth/login/organism
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return { title: i18n.t('auth:login.meta-title'), robots: { index: false } };
|
return { title: i18n.t('auth:login.meta-title'), robots: { index: false } };
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import { LoginVerifyStep } from '@lumina/market/app/screens/(auth)/auth/login/ve
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import { RegisterDetailsStep } from '@lumina/market/app/screens/(auth)/auth/regi
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import { RegisterTypeStep } from '@lumina/market/app/screens/(auth)/auth/registe
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
import { AuthTemplate } from '../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import { RegisterPhoneStep } from '@lumina/market/app/screens/(auth)/auth/regist
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ import { RegisterVerifyStep } from '@lumina/market/app/screens/(auth)/auth/regis
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
|
||||||
import { i18n } from '../../../../../i18n';
|
import { i18n } from '../../../../../i18n';
|
||||||
import { AuthTopBar } from '../../../../organisms/auth-top-bar';
|
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../../../../templates/auth-template';
|
import { AuthTemplate } from '../../../templates/auth-template';
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
export function generateMetadata(): Metadata {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
||||||
|
|
||||||
import { i18n } from '../../i18n';
|
import { i18n } from '../../i18n';
|
||||||
import { AuthTopBar } from '../organisms/auth-top-bar';
|
import { AuthTopBar } from './organisms/auth-top-bar';
|
||||||
import { AuthTemplate } from '../templates/auth-template';
|
import { AuthTemplate } from './templates/auth-template';
|
||||||
|
|
||||||
/** Login and registration, before their frame arrives: the top bar and a form step's shape. */
|
/** Login and registration, before their frame arrives: the top bar and a form step's shape. */
|
||||||
export default function AuthLoading() {
|
export default function AuthLoading() {
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ import { Button } from '@lumina/island/atoms/button';
|
||||||
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
import { FlexBox } from '@lumina/island/atoms/flex-box';
|
||||||
import { Typography } from '@lumina/island/atoms/typography';
|
import { Typography } from '@lumina/island/atoms/typography';
|
||||||
import { ROUTES } from '@lumina/market/app/navigation';
|
import { ROUTES } from '@lumina/market/app/navigation';
|
||||||
import { SupportEntry } from '@lumina/market/app/screens/organisms/support-entry';
|
import { SupportEntry } from '@lumina/market/app/screens/(auth)/organisms/support-entry';
|
||||||
import NextLink from 'next/link';
|
import NextLink from 'next/link';
|
||||||
|
|
||||||
import { i18n } from '../../../i18n';
|
import { i18n } from '../../../../i18n';
|
||||||
import type { AuthTopBarProps } from './types';
|
import type { AuthTopBarProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
|
||||||
|
|
||||||
import { i18n } from '../../i18n';
|
|
||||||
import { AuthTopBar } from '../organisms/auth-top-bar';
|
|
||||||
import { AuthTemplate } from '../templates/auth-template';
|
|
||||||
|
|
||||||
/** Registration's last steps, before their frame arrives: the top bar and a form step's shape. */
|
|
||||||
export default function OnboardingLoading() {
|
|
||||||
return (
|
|
||||||
<AuthTemplate
|
|
||||||
header={<AuthTopBar title={i18n.t('auth:register.header')} />}
|
|
||||||
>
|
|
||||||
<SkeletonPreset preset="form" delayed label={i18n.t('auth:loading')} />
|
|
||||||
</AuthTemplate>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
|
||||||
import {
|
|
||||||
CreatorProfileStep,
|
|
||||||
CreatorProfileStepSkeleton,
|
|
||||||
} from '@lumina/market/app/screens/(onboarding)/onboarding/creator-profile/organisms/creator-profile-step';
|
|
||||||
import type { Metadata } from 'next';
|
|
||||||
import { Suspense } from 'react';
|
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
|
||||||
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
|
||||||
return {
|
|
||||||
title: i18n.t('auth:register.profile.meta-title'),
|
|
||||||
robots: { index: false },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registration step 5 for a creator, on the session. The frame renders on the server; the step
|
|
||||||
* only in the browser, for the signed-in creator, behind the same-size skeleton.
|
|
||||||
*/
|
|
||||||
export default function CreatorProfilePage() {
|
|
||||||
const skeleton = (
|
|
||||||
<CreatorProfileStepSkeleton
|
|
||||||
layout="mobile"
|
|
||||||
label={i18n.t('auth:loading')}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
<AuthTemplate
|
|
||||||
header={<AuthTopBar title={i18n.t('auth:register.header')} />}
|
|
||||||
>
|
|
||||||
<AuthGuard role="creator" fallback={skeleton}>
|
|
||||||
<Suspense fallback={skeleton}>
|
|
||||||
<CreatorProfileStep
|
|
||||||
size="lg"
|
|
||||||
layout="mobile"
|
|
||||||
supportPlacement="bottom"
|
|
||||||
/>
|
|
||||||
</Suspense>
|
|
||||||
</AuthGuard>
|
|
||||||
</AuthTemplate>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
|
||||||
import { AuthGuard } from '@lumina/market/app/guards/auth-guard';
|
|
||||||
import { InvestorProfileStep } from '@lumina/market/app/screens/(onboarding)/onboarding/investor-profile/organisms/investor-profile-step';
|
|
||||||
import type { Metadata } from 'next';
|
|
||||||
|
|
||||||
import { i18n } from '../../../../i18n';
|
|
||||||
import { AuthTopBar } from '../../../organisms/auth-top-bar';
|
|
||||||
import { AuthTemplate } from '../../../templates/auth-template';
|
|
||||||
|
|
||||||
export function generateMetadata(): Metadata {
|
|
||||||
return {
|
|
||||||
title: i18n.t('auth:register.profile.meta-title'),
|
|
||||||
robots: { index: false },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registration step 5 for an investor, optional, on the session. The frame renders on the
|
|
||||||
* server; the step only in the browser, for the signed-in investor.
|
|
||||||
*/
|
|
||||||
export default function InvestorProfilePage() {
|
|
||||||
return (
|
|
||||||
<AuthTemplate
|
|
||||||
header={<AuthTopBar title={i18n.t('auth:register.header')} />}
|
|
||||||
>
|
|
||||||
<AuthGuard
|
|
||||||
role="investor"
|
|
||||||
fallback={
|
|
||||||
<SkeletonPreset
|
|
||||||
preset="form"
|
|
||||||
count={2}
|
|
||||||
label={i18n.t('auth:loading')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<InvestorProfileStep size="lg" supportPlacement="bottom" />
|
|
||||||
</AuthGuard>
|
|
||||||
</AuthTemplate>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# 0014 Registration step 5 on the session, with a server draft
|
|
||||||
|
|
||||||
Status: Proposed · Area: architecture · Date: 2026-10-05 · Decided by: agent
|
|
||||||
|
|
||||||
## Context
|
|
||||||
Step 5 (profile completion) runs after the account exists, so it can't sit behind `GuestGuard` like the other `(auth)` steps (0013). The design autosaves a creator's profile and lets them resume after a login, but the API had no draft: any save completed the profile. The user chose to fix the back end first.
|
|
||||||
|
|
||||||
## Decision
|
|
||||||
- Serve step 5 at `/onboarding/creator-profile` and `/onboarding/investor-profile` under `(onboarding)`, rendered only in the browser behind `AuthGuard` with the role, behind a same-size skeleton, with `noindex`.
|
|
||||||
- A creator's step 5 autosaves through `PATCH /traders/me/profile` (a draft, markets may be empty) and ends only with `POST /traders/me/profile/complete`; `profileComplete` needs that call.
|
|
||||||
- An investor's step 5 saves nothing until «ذخیره و ورود» (`PUT /users/profile/avatar`, then `PATCH /users/profile` with `interests`).
|
|
||||||
|
|
||||||
## Alternatives
|
|
||||||
- Autosave with `PUT`: rejected; it completes the profile at the first market, so resume after login breaks.
|
|
||||||
- Keep the draft in local storage: rejected; it would hold profile data in the browser and not follow the creator to another device.
|
|
||||||
|
|
||||||
## Consequences
|
|
||||||
- Login lands an unfinished creator on step 5 until they complete it (`profileComplete` is false).
|
|
||||||
- Posting and tiers stay locked by the back end until completion.
|
|
||||||
|
|
@ -16,4 +16,3 @@
|
||||||
- 0003 design: Only semantic tokens, named as in the Lumina Design System, produce Tailwind utilities (`@theme inline`); primitives stay plain `:root` variables and Tailwind's defaults are removed.
|
- 0003 design: Only semantic tokens, named as in the Lumina Design System, produce Tailwind utilities (`@theme inline`); primitives stay plain `:root` variables and Tailwind's defaults are removed.
|
||||||
- 0005 design: Island holds Lumina's product components and status-to-tone map; they take every text as props (`children` or `labels`) and never import i18next or platform code.
|
- 0005 design: Island holds Lumina's product components and status-to-tone map; they take every text as props (`children` or `labels`) and never import i18next or platform code.
|
||||||
- 0006 architecture: Make every non-app project a pnpm workspace package `@lumina/<name>` with subpath `exports`; third-party dependencies stay in the root package.json.
|
- 0006 architecture: Make every non-app project a pnpm workspace package `@lumina/<name>` with subpath `exports`; third-party dependencies stay in the root package.json.
|
||||||
- 0014 architecture: Serve registration step 5 under `(onboarding)` behind `AuthGuard`; a creator's profile autosaves as a server draft (`PATCH`) and completes only through `POST …/profile/complete`.
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ export const AVATAR_PX: Record<AvatarSize, number> = {
|
||||||
md: 40,
|
md: 40,
|
||||||
lg: 56,
|
lg: 56,
|
||||||
xl: 80,
|
xl: 80,
|
||||||
'2xl': 96,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AVATAR_INITIAL_VARIANT: Record<AvatarSize, TypographyVariant> = {
|
export const AVATAR_INITIAL_VARIANT: Record<AvatarSize, TypographyVariant> = {
|
||||||
|
|
@ -15,7 +14,6 @@ export const AVATAR_INITIAL_VARIANT: Record<AvatarSize, TypographyVariant> = {
|
||||||
md: 'body-md',
|
md: 'body-md',
|
||||||
lg: 'heading-sm',
|
lg: 'heading-sm',
|
||||||
xl: 'heading-lg',
|
xl: 'heading-lg',
|
||||||
'2xl': 'display',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AVATAR_MARK_PX: Record<AvatarSize, number> = {
|
export const AVATAR_MARK_PX: Record<AvatarSize, number> = {
|
||||||
|
|
@ -23,5 +21,4 @@ export const AVATAR_MARK_PX: Record<AvatarSize, number> = {
|
||||||
md: 14,
|
md: 14,
|
||||||
lg: 18,
|
lg: 18,
|
||||||
xl: 22,
|
xl: 22,
|
||||||
'2xl': 24,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ export const avatarVariants = cva(
|
||||||
lg: 'size-14',
|
lg: 'size-14',
|
||||||
/** The channel profile header. */
|
/** The channel profile header. */
|
||||||
xl: 'size-20',
|
xl: 'size-20',
|
||||||
/** The profile photo field. */
|
|
||||||
'2xl': 'size-24',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: { size: 'md' },
|
defaultVariants: { size: 'md' },
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
import { Element } from '../../primitives/element';
|
|
||||||
import { cn } from '../../tools/cn';
|
|
||||||
import { FlexBox } from '../flex-box';
|
|
||||||
import { GridBox } from '../grid-box';
|
|
||||||
import { Icon } from '../icon';
|
|
||||||
import { Typography } from '../typography';
|
|
||||||
import type { CheckboxProps } from './types';
|
|
||||||
import { checkboxVariants } from './variants';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A labelled checkbox for a consent or an option. The whole row is the hit area (at least 44px
|
|
||||||
* high). Works with react-hook-form's `register` or as a controlled input; the ref reaches the
|
|
||||||
* input.
|
|
||||||
*/
|
|
||||||
export function Checkbox({
|
|
||||||
invalid = false,
|
|
||||||
className,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: CheckboxProps) {
|
|
||||||
return (
|
|
||||||
<FlexBox
|
|
||||||
tag="label"
|
|
||||||
alignItems="items-start"
|
|
||||||
gap="gap-3"
|
|
||||||
className={cn('min-h-touch-target cursor-pointer', className)}
|
|
||||||
>
|
|
||||||
<GridBox
|
|
||||||
tag="span"
|
|
||||||
justifyItems="justify-items-center"
|
|
||||||
alignItems="items-center"
|
|
||||||
className="mt-px flex-none"
|
|
||||||
>
|
|
||||||
<Element
|
|
||||||
tag="input"
|
|
||||||
type="checkbox"
|
|
||||||
aria-invalid={invalid || undefined}
|
|
||||||
className={checkboxVariants({ invalid })}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
<Icon
|
|
||||||
name="check"
|
|
||||||
size={14}
|
|
||||||
strokeWidth={3}
|
|
||||||
className="pointer-events-none invisible text-text-on-action [grid-area:1/1] peer-checked:visible"
|
|
||||||
/>
|
|
||||||
</GridBox>
|
|
||||||
<Typography tag="span" variant="body-sm" className="leading-6">
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export { Checkbox } from './Checkbox';
|
|
||||||
export type { CheckboxProps } from './types';
|
|
||||||
export { checkboxVariants } from './variants';
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
||||||
|
|
||||||
export type CheckboxProps = Omit<
|
|
||||||
ComponentPropsWithRef<'input'>,
|
|
||||||
'type' | 'children'
|
|
||||||
> & {
|
|
||||||
/** Required and unchecked on submit: a red box; the message goes under it. */
|
|
||||||
invalid?: boolean;
|
|
||||||
/** The label, a full sentence the person agrees to. */
|
|
||||||
children: ReactNode;
|
|
||||||
};
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
import { cva } from 'class-variance-authority';
|
|
||||||
|
|
||||||
/** The 22px box; the real input draws it, so focus and checked state need no script. */
|
|
||||||
export const checkboxVariants = cva(
|
|
||||||
'peer m-0 size-5.5 appearance-none rounded-sm border-[1.5px] bg-surface transition-colors duration-120 ease-standard [grid-area:1/1] checked:border-action-primary checked:bg-action-primary focus-visible:focus-ring actionable:cursor-pointer disabled:frozen',
|
|
||||||
{
|
|
||||||
variants: {
|
|
||||||
invalid: {
|
|
||||||
true: 'border-danger',
|
|
||||||
false: 'border-border-default',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
defaultVariants: { invalid: false },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import { cn } from '../../tools/cn';
|
|
||||||
import { FlexBox } from '../flex-box';
|
|
||||||
import { Icon } from '../icon';
|
|
||||||
import { Typography } from '../typography';
|
|
||||||
import type { ChipProps } from './types';
|
|
||||||
import { chipVariants } from './variants';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A toggle pill for a multiple choice, such as markets. A real button with `aria-pressed`, so
|
|
||||||
* Tab, Space and screen readers work. Wrap a set in `role="group"` with an accessible name.
|
|
||||||
*/
|
|
||||||
export function Chip({
|
|
||||||
selected,
|
|
||||||
size = 'md',
|
|
||||||
className,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: ChipProps) {
|
|
||||||
return (
|
|
||||||
<FlexBox
|
|
||||||
tag="button"
|
|
||||||
type="button"
|
|
||||||
aria-pressed={selected}
|
|
||||||
display="inline-flex"
|
|
||||||
alignItems="items-center"
|
|
||||||
className={cn(chipVariants({ selected, size }), 'gap-1.5', className)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{selected && <Icon name="check" size={16} strokeWidth={2.5} />}
|
|
||||||
<Typography tag="span" variant="label" color="inherit">
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export { Chip } from './Chip';
|
|
||||||
export type { ChipProps, ChipSize } from './types';
|
|
||||||
export { chipVariants } from './variants';
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import type { VariantProps } from 'class-variance-authority';
|
|
||||||
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
||||||
|
|
||||||
import type { chipVariants } from './variants';
|
|
||||||
|
|
||||||
export type ChipSize = NonNullable<VariantProps<typeof chipVariants>['size']>;
|
|
||||||
|
|
||||||
export type ChipProps = Omit<
|
|
||||||
ComponentPropsWithRef<'button'>,
|
|
||||||
'children' | 'type' | 'aria-pressed'
|
|
||||||
> & {
|
|
||||||
/** On: filled with a check. Read out as a pressed toggle. */
|
|
||||||
selected: boolean;
|
|
||||||
/** `md` (44px) in forms, `sm` (36px) in compact filter rows. */
|
|
||||||
size?: ChipSize;
|
|
||||||
children: ReactNode;
|
|
||||||
};
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
import { cva } from 'class-variance-authority';
|
|
||||||
|
|
||||||
/** A pill you press to pick one of many, such as a market; a set sits in a wrapping row. */
|
|
||||||
export const chipVariants = cva(
|
|
||||||
'rounded-full border px-4 whitespace-nowrap transition-colors duration-120 ease-standard focus-visible:focus-ring actionable:cursor-pointer disabled:frozen',
|
|
||||||
{
|
|
||||||
variants: {
|
|
||||||
selected: {
|
|
||||||
true: 'border-action-primary bg-action-primary text-text-on-action actionable:hover:bg-action-primary-hover',
|
|
||||||
false:
|
|
||||||
'border-transparent bg-action-primary-muted text-action-primary-text actionable:hover:border-action-primary',
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
sm: 'min-h-control-sm px-3.5',
|
|
||||||
md: 'min-h-control-md',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
defaultVariants: { selected: false, size: 'md' },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
@ -61,7 +61,6 @@ function exitsFinished(dialog: HTMLDialogElement): Promise<unknown> {
|
||||||
export function Dialog({
|
export function Dialog({
|
||||||
open,
|
open,
|
||||||
onClose,
|
onClose,
|
||||||
onExited,
|
|
||||||
dismissible = true,
|
dismissible = true,
|
||||||
alert = false,
|
alert = false,
|
||||||
labelledBy,
|
labelledBy,
|
||||||
|
|
@ -82,7 +81,6 @@ export function Dialog({
|
||||||
);
|
);
|
||||||
const left = useEffectEvent((dialog: HTMLDialogElement) => {
|
const left = useEffectEvent((dialog: HTMLDialogElement) => {
|
||||||
if (raiseToasts) announce(DIALOG_CLOSE_EVENT, dialog);
|
if (raiseToasts) announce(DIALOG_CLOSE_EVENT, dialog);
|
||||||
onExited?.();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,6 @@ export type DialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
/** Escape and a tap on the scrim call it, unless `dismissible` is false. */
|
/** Escape and a tap on the scrim call it, unless `dismissible` is false. */
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
/**
|
|
||||||
* The dialog has left the top layer after its exit transitions and focus went back to the
|
|
||||||
* trigger. The page is inert until then, so move focus elsewhere here, such as to a field the
|
|
||||||
* dialog added.
|
|
||||||
*/
|
|
||||||
onExited?: () => void;
|
|
||||||
/** false: Escape and the scrim do nothing, for a halt the user must wait out. */
|
/** false: Escape and the scrim do nothing, for a halt the user must wait out. */
|
||||||
dismissible?: boolean;
|
dismissible?: boolean;
|
||||||
/** An urgent message that interrupts, such as «در حال تأیید پرداخت...»: `role="alertdialog"`. */
|
/** An urgent message that interrupts, such as «در حال تأیید پرداخت...»: `role="alertdialog"`. */
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
import { cn } from '../../tools/cn';
|
|
||||||
import { FlexBox } from '../flex-box';
|
|
||||||
import { Icon } from '../icon';
|
|
||||||
import { Typography } from '../typography';
|
|
||||||
import type { FieldErrorProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error line under a group that has no field of its own, such as a set of chips, a consent
|
|
||||||
* box or a photo: an alert icon and the message, announced when it appears.
|
|
||||||
*/
|
|
||||||
export function FieldError({ id, className, children }: FieldErrorProps) {
|
|
||||||
return (
|
|
||||||
<FlexBox
|
|
||||||
id={id}
|
|
||||||
role="alert"
|
|
||||||
alignItems="items-start"
|
|
||||||
gap="gap-1"
|
|
||||||
className={cn('text-danger-text', className)}
|
|
||||||
>
|
|
||||||
<Icon name="alert" size={16} className="mt-[3px] flex-none" />
|
|
||||||
<Typography tag="span" variant="caption" color="inherit">
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export { FieldError } from './FieldError';
|
|
||||||
export type { FieldErrorProps } from './types';
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
import type { ReactNode } from 'react';
|
|
||||||
|
|
||||||
export type FieldErrorProps = {
|
|
||||||
/** Lets the control point at it with `aria-describedby`. */
|
|
||||||
id?: string;
|
|
||||||
className?: string;
|
|
||||||
children: ReactNode;
|
|
||||||
};
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
import { cn } from '../../tools/cn';
|
|
||||||
import { FlexBox } from '../flex-box';
|
|
||||||
import { Icon } from '../icon';
|
|
||||||
import { linkVariants } from '../link';
|
|
||||||
import { Typography } from '../typography';
|
|
||||||
import type { LinkButtonProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Looks like a Link but is a button, because it acts on the page (opens a sheet, removes a photo,
|
|
||||||
* retries an upload) rather than navigating.
|
|
||||||
*/
|
|
||||||
export function LinkButton({
|
|
||||||
standalone,
|
|
||||||
icon,
|
|
||||||
iconStart,
|
|
||||||
className,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: LinkButtonProps) {
|
|
||||||
return (
|
|
||||||
<FlexBox
|
|
||||||
tag="button"
|
|
||||||
type="button"
|
|
||||||
display="inline-flex"
|
|
||||||
alignItems="items-center"
|
|
||||||
gap="gap-1"
|
|
||||||
className={cn(
|
|
||||||
linkVariants({ standalone }),
|
|
||||||
'border-0 bg-transparent p-0 text-start disabled:frozen',
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{iconStart && <Icon name={iconStart} size={18} />}
|
|
||||||
<Typography tag="span" variant="inherit" color="inherit">
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
{icon && <Icon name={icon} size={18} />}
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export { LinkButton } from './LinkButton';
|
|
||||||
export type { LinkButtonProps } from './types';
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
||||||
|
|
||||||
import type { IconName } from '../icon';
|
|
||||||
|
|
||||||
export type LinkButtonProps = Omit<
|
|
||||||
ComponentPropsWithRef<'button'>,
|
|
||||||
'children' | 'type'
|
|
||||||
> & {
|
|
||||||
/** A 44px hit area for a button on its own line. */
|
|
||||||
standalone?: boolean;
|
|
||||||
/** Trailing icon. */
|
|
||||||
icon?: IconName;
|
|
||||||
/** Leading icon, for an action named by its verb, such as `refresh` before «تلاش مجدد». */
|
|
||||||
iconStart?: IconName;
|
|
||||||
children: ReactNode;
|
|
||||||
};
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
import { cn } from '../../tools/cn';
|
|
||||||
import { FlexBox } from '../flex-box';
|
|
||||||
import { GridBox } from '../grid-box';
|
|
||||||
import { Icon } from '../icon';
|
|
||||||
import { Typography } from '../typography';
|
|
||||||
import type { RowButtonProps } from './types';
|
|
||||||
|
|
||||||
/** A 56px choice row in a sheet or a menu: an icon disc, the name, and an optional note at the end. */
|
|
||||||
export function RowButton({
|
|
||||||
icon,
|
|
||||||
meta,
|
|
||||||
metaDir,
|
|
||||||
className,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: RowButtonProps) {
|
|
||||||
return (
|
|
||||||
<FlexBox
|
|
||||||
tag="button"
|
|
||||||
type="button"
|
|
||||||
alignItems="items-center"
|
|
||||||
gap="gap-3"
|
|
||||||
className={cn(
|
|
||||||
'min-h-14 w-full rounded-lg border border-border-subtle bg-surface px-3 py-2 text-start text-text-primary transition-colors duration-120 ease-standard focus-visible:focus-ring actionable:cursor-pointer actionable:hover:border-border-strong actionable:hover:bg-surface-hover disabled:frozen',
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<GridBox
|
|
||||||
tag="span"
|
|
||||||
justifyItems="justify-items-center"
|
|
||||||
alignItems="items-center"
|
|
||||||
className="size-10 flex-none rounded-full bg-action-primary-subtle text-action-primary"
|
|
||||||
>
|
|
||||||
<Icon name={icon} size={20} />
|
|
||||||
</GridBox>
|
|
||||||
<Typography
|
|
||||||
tag="span"
|
|
||||||
variant="body-md"
|
|
||||||
color="inherit"
|
|
||||||
className="min-w-0 flex-1 font-semibold"
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</Typography>
|
|
||||||
{meta != null && (
|
|
||||||
<Typography
|
|
||||||
tag="bdi"
|
|
||||||
variant="caption"
|
|
||||||
color="secondary"
|
|
||||||
dir={metaDir}
|
|
||||||
className="flex-none"
|
|
||||||
>
|
|
||||||
{meta}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export { RowButton } from './RowButton';
|
|
||||||
export type { RowButtonProps } from './types';
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
||||||
|
|
||||||
import type { IconName } from '../icon';
|
|
||||||
|
|
||||||
export type RowButtonProps = Omit<
|
|
||||||
ComponentPropsWithRef<'button'>,
|
|
||||||
'children' | 'type'
|
|
||||||
> & {
|
|
||||||
icon: IconName;
|
|
||||||
/** The row's name, such as «تلگرام». */
|
|
||||||
children: ReactNode;
|
|
||||||
/** A short note at the end, such as the address prefix `t.me/`. */
|
|
||||||
meta?: ReactNode;
|
|
||||||
/** `ltr` for an address or a code in `meta`. */
|
|
||||||
metaDir?: 'ltr' | 'rtl';
|
|
||||||
};
|
|
||||||
|
|
@ -1,10 +1,39 @@
|
||||||
import { LinkButton } from '../link-button';
|
import { cn } from '../../tools/cn';
|
||||||
|
import { FlexBox } from '../flex-box';
|
||||||
|
import { Icon } from '../icon';
|
||||||
|
import { linkVariants } from '../link';
|
||||||
|
import { Typography } from '../typography';
|
||||||
import type { SupportLinkProps } from './types';
|
import type { SupportLinkProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* «تماس با پشتیبانی»: looks like a Link but is a button, because it opens SupportSheet rather
|
* «تماس با پشتیبانی»: looks like a Link but is a button, because it opens SupportSheet rather
|
||||||
* than navigating. Inside a dimmed card, put it in the card's `action` so it stays live.
|
* than navigating. Inside a dimmed card, put it in the card's `action` so it stays live.
|
||||||
*/
|
*/
|
||||||
export function SupportLink({ icon = true, ...props }: SupportLinkProps) {
|
export function SupportLink({
|
||||||
return <LinkButton iconStart={icon ? 'headset' : undefined} {...props} />;
|
icon = true,
|
||||||
|
standalone,
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: SupportLinkProps) {
|
||||||
|
return (
|
||||||
|
<FlexBox
|
||||||
|
tag="button"
|
||||||
|
type="button"
|
||||||
|
display="inline-flex"
|
||||||
|
alignItems="items-center"
|
||||||
|
gap="gap-1"
|
||||||
|
className={cn(
|
||||||
|
linkVariants({ standalone }),
|
||||||
|
'border-0 bg-transparent p-0 text-start',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{icon && <Icon name="headset" size={18} />}
|
||||||
|
<Typography tag="span" variant="inherit" color="inherit">
|
||||||
|
{children}
|
||||||
|
</Typography>
|
||||||
|
</FlexBox>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,6 @@ export type {
|
||||||
ButtonAsLinkProps,
|
ButtonAsLinkProps,
|
||||||
ButtonProps,
|
ButtonProps,
|
||||||
} from './atoms/button';
|
} from './atoms/button';
|
||||||
export { Checkbox, checkboxVariants } from './atoms/checkbox';
|
|
||||||
export type { CheckboxProps } from './atoms/checkbox';
|
|
||||||
export { Chip, chipVariants } from './atoms/chip';
|
|
||||||
export type { ChipProps, ChipSize } from './atoms/chip';
|
|
||||||
export { Countdown, countdownTone } from './atoms/countdown';
|
export { Countdown, countdownTone } from './atoms/countdown';
|
||||||
export type {
|
export type {
|
||||||
CountdownKind,
|
CountdownKind,
|
||||||
|
|
@ -27,8 +23,6 @@ export {
|
||||||
DIALOG_PANEL_SELECTOR,
|
DIALOG_PANEL_SELECTOR,
|
||||||
} from './atoms/dialog';
|
} from './atoms/dialog';
|
||||||
export type { DialogProps } from './atoms/dialog';
|
export type { DialogProps } from './atoms/dialog';
|
||||||
export { FieldError } from './atoms/field-error';
|
|
||||||
export type { FieldErrorProps } from './atoms/field-error';
|
|
||||||
export { FlexBox } from './atoms/flex-box';
|
export { FlexBox } from './atoms/flex-box';
|
||||||
export type {
|
export type {
|
||||||
AlignContent,
|
AlignContent,
|
||||||
|
|
@ -56,10 +50,6 @@ export { ICON_NAMES, Icon } from './atoms/icon';
|
||||||
export type { IconName, IconProps } from './atoms/icon';
|
export type { IconName, IconProps } from './atoms/icon';
|
||||||
export { Link, linkVariants } from './atoms/link';
|
export { Link, linkVariants } from './atoms/link';
|
||||||
export type { LinkProps } from './atoms/link';
|
export type { LinkProps } from './atoms/link';
|
||||||
export { LinkButton } from './atoms/link-button';
|
|
||||||
export type { LinkButtonProps } from './atoms/link-button';
|
|
||||||
export { RowButton } from './atoms/row-button';
|
|
||||||
export type { RowButtonProps } from './atoms/row-button';
|
|
||||||
export {
|
export {
|
||||||
Skeleton,
|
Skeleton,
|
||||||
SkeletonRegion,
|
SkeletonRegion,
|
||||||
|
|
@ -97,26 +87,16 @@ export type {
|
||||||
TypographyProps,
|
TypographyProps,
|
||||||
TypographyVariant,
|
TypographyVariant,
|
||||||
} from './atoms/typography';
|
} from './atoms/typography';
|
||||||
export { AvatarField } from './molecules/avatar-field';
|
|
||||||
export type {
|
|
||||||
AvatarFieldLabels,
|
|
||||||
AvatarFieldProps,
|
|
||||||
AvatarFieldStatus,
|
|
||||||
} from './molecules/avatar-field';
|
|
||||||
export { Banner, bannerVariants } from './molecules/banner';
|
export { Banner, bannerVariants } from './molecules/banner';
|
||||||
export type { BannerProps, BannerTone } from './molecules/banner';
|
export type { BannerProps, BannerTone } from './molecules/banner';
|
||||||
export { Card, cardVariants } from './molecules/card';
|
export { Card, cardVariants } from './molecules/card';
|
||||||
export type { CardOwnProps, CardProps } from './molecules/card';
|
export type { CardOwnProps, CardProps } from './molecules/card';
|
||||||
export { ChipGroup } from './molecules/chip-group';
|
|
||||||
export type { ChipGroupOption, ChipGroupProps } from './molecules/chip-group';
|
|
||||||
export { ChoiceCard, choiceCardVariants } from './molecules/choice-card';
|
export { ChoiceCard, choiceCardVariants } from './molecules/choice-card';
|
||||||
export type { ChoiceCardProps } from './molecules/choice-card';
|
export type { ChoiceCardProps } from './molecules/choice-card';
|
||||||
export { EmptyState } from './molecules/empty-state';
|
export { EmptyState } from './molecules/empty-state';
|
||||||
export type { EmptyStateProps, EmptyStateTone } from './molecules/empty-state';
|
export type { EmptyStateProps, EmptyStateTone } from './molecules/empty-state';
|
||||||
export { ERROR_KIND_STYLES, ErrorState } from './molecules/error-state';
|
export { ERROR_KIND_STYLES, ErrorState } from './molecules/error-state';
|
||||||
export type { ErrorKind, ErrorStateProps } from './molecules/error-state';
|
export type { ErrorKind, ErrorStateProps } from './molecules/error-state';
|
||||||
export { FormSection } from './molecules/form-section';
|
|
||||||
export type { FormSectionProps } from './molecules/form-section';
|
|
||||||
export { LockedTeaser } from './molecules/locked-teaser';
|
export { LockedTeaser } from './molecules/locked-teaser';
|
||||||
export type { LockedTeaserProps } from './molecules/locked-teaser';
|
export type { LockedTeaserProps } from './molecules/locked-teaser';
|
||||||
export { MediaCarousel } from './molecules/media-carousel';
|
export { MediaCarousel } from './molecules/media-carousel';
|
||||||
|
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import { useId, useRef } from 'react';
|
|
||||||
import type { ChangeEvent } from 'react';
|
|
||||||
|
|
||||||
import { Avatar } from '../../atoms/avatar';
|
|
||||||
import { Button } from '../../atoms/button';
|
|
||||||
import { FieldError } from '../../atoms/field-error';
|
|
||||||
import { FlexBox } from '../../atoms/flex-box';
|
|
||||||
import { LinkButton } from '../../atoms/link-button';
|
|
||||||
import { Typography } from '../../atoms/typography';
|
|
||||||
import { Element } from '../../primitives/element';
|
|
||||||
import { cn } from '../../tools/cn';
|
|
||||||
import type { AvatarFieldProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A profile photo: the round picture (or the username's initial), a button that opens the picker,
|
|
||||||
* and remove. A failed upload keeps the picked photo dimmed in a red ring with the message and
|
|
||||||
* «تلاش مجدد»; the rest of the form is unaffected.
|
|
||||||
*/
|
|
||||||
export function AvatarField({
|
|
||||||
name,
|
|
||||||
src,
|
|
||||||
status = 'idle',
|
|
||||||
progress,
|
|
||||||
error,
|
|
||||||
accept,
|
|
||||||
onPick,
|
|
||||||
onRemove,
|
|
||||||
onRetry,
|
|
||||||
disabled = false,
|
|
||||||
labels,
|
|
||||||
className,
|
|
||||||
}: AvatarFieldProps) {
|
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
|
||||||
const messageId = useId();
|
|
||||||
const isUploading = status === 'uploading';
|
|
||||||
const isFailed = status === 'failed';
|
|
||||||
const hasError = error != null && error !== false;
|
|
||||||
|
|
||||||
const pick = (event: ChangeEvent<HTMLInputElement>) => {
|
|
||||||
const file = event.target.files?.[0];
|
|
||||||
// The same file can be picked again after it was rejected.
|
|
||||||
event.target.value = '';
|
|
||||||
if (file) onPick(file);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FlexBox direction="flex-col" gap="gap-3" className={className}>
|
|
||||||
<FlexBox alignItems="items-center" gap="gap-4">
|
|
||||||
<Avatar
|
|
||||||
name={name}
|
|
||||||
src={src}
|
|
||||||
size="2xl"
|
|
||||||
label={src ? labels.preview : undefined}
|
|
||||||
className={cn(
|
|
||||||
'rounded-full transition-opacity duration-120 ease-standard',
|
|
||||||
isUploading && 'opacity-70',
|
|
||||||
isFailed && 'opacity-50 ring-2 ring-danger',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<FlexBox direction="flex-col" alignItems="items-start" gap="gap-1">
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
icon="image"
|
|
||||||
isLoading={isUploading}
|
|
||||||
disabled={disabled}
|
|
||||||
aria-describedby={hasError ? messageId : undefined}
|
|
||||||
onClick={() => inputRef.current?.click()}
|
|
||||||
>
|
|
||||||
{src ? labels.change : labels.pick}
|
|
||||||
</Button>
|
|
||||||
{isUploading && progress !== undefined && labels.uploading && (
|
|
||||||
<Typography
|
|
||||||
tag="span"
|
|
||||||
variant="caption"
|
|
||||||
color="secondary"
|
|
||||||
aria-live="polite"
|
|
||||||
>
|
|
||||||
{labels.uploading(progress)}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
{src && onRemove && status === 'idle' && (
|
|
||||||
<LinkButton standalone disabled={disabled} onClick={onRemove}>
|
|
||||||
{labels.remove}
|
|
||||||
</LinkButton>
|
|
||||||
)}
|
|
||||||
</FlexBox>
|
|
||||||
</FlexBox>
|
|
||||||
{hasError && (
|
|
||||||
<FlexBox alignItems="items-center" wrap="flex-wrap" gap="gap-2">
|
|
||||||
<FieldError id={messageId}>{error}</FieldError>
|
|
||||||
{isFailed && onRetry && (
|
|
||||||
<LinkButton
|
|
||||||
standalone
|
|
||||||
iconStart="refresh"
|
|
||||||
disabled={disabled}
|
|
||||||
onClick={onRetry}
|
|
||||||
>
|
|
||||||
{labels.retry}
|
|
||||||
</LinkButton>
|
|
||||||
)}
|
|
||||||
</FlexBox>
|
|
||||||
)}
|
|
||||||
<Element
|
|
||||||
tag="input"
|
|
||||||
ref={inputRef}
|
|
||||||
type="file"
|
|
||||||
accept={accept}
|
|
||||||
tabIndex={-1}
|
|
||||||
aria-hidden
|
|
||||||
className="sr-only"
|
|
||||||
onChange={pick}
|
|
||||||
/>
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
export { AvatarField } from './AvatarField';
|
|
||||||
export type {
|
|
||||||
AvatarFieldLabels,
|
|
||||||
AvatarFieldProps,
|
|
||||||
AvatarFieldStatus,
|
|
||||||
} from './types';
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import type { ReactNode } from 'react';
|
|
||||||
|
|
||||||
/** idle: nothing in flight. uploading: the picked photo is on its way. failed: it didn't arrive. */
|
|
||||||
export type AvatarFieldStatus = 'idle' | 'uploading' | 'failed';
|
|
||||||
|
|
||||||
/** Every text the field shows, from the translations. */
|
|
||||||
export type AvatarFieldLabels = {
|
|
||||||
/** «انتخاب تصویر», with no photo yet. */
|
|
||||||
pick: string;
|
|
||||||
/** «تغییر تصویر», with a photo. */
|
|
||||||
change: string;
|
|
||||||
/** «حذف تصویر». */
|
|
||||||
remove: string;
|
|
||||||
/** «تلاش مجدد», after a failed upload. */
|
|
||||||
retry: string;
|
|
||||||
/** The photo's accessible name: «پیشنمایش برش دایرهای تصویر پروفایل». */
|
|
||||||
preview: string;
|
|
||||||
/** While uploading, given the percent: «در حال بارگذاری… ۶۴٪». */
|
|
||||||
uploading?: (percent: number) => ReactNode;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AvatarFieldProps = {
|
|
||||||
/** The username: its first letter stands in while there is no photo. */
|
|
||||||
name: string;
|
|
||||||
/** The photo to show: the uploaded one, or the picked file's preview while it uploads. */
|
|
||||||
src: string | null;
|
|
||||||
status?: AvatarFieldStatus;
|
|
||||||
/** 0–100 while uploading. */
|
|
||||||
progress?: number;
|
|
||||||
/** A rejected pick or a failed upload. A rejected pick keeps the current photo. */
|
|
||||||
error?: ReactNode;
|
|
||||||
/** MIME types for the picker, such as `image/jpeg,image/png`. */
|
|
||||||
accept?: string;
|
|
||||||
/** A picked file. Check its type and size here, when it is picked. */
|
|
||||||
onPick: (file: File) => void;
|
|
||||||
/** Omit it when the photo can't be removed. */
|
|
||||||
onRemove?: () => void;
|
|
||||||
/** Sends the same file again after a failed upload. */
|
|
||||||
onRetry?: () => void;
|
|
||||||
disabled?: boolean;
|
|
||||||
labels: AvatarFieldLabels;
|
|
||||||
className?: string;
|
|
||||||
};
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
import { useId } from 'react';
|
|
||||||
|
|
||||||
import { Chip } from '../../atoms/chip';
|
|
||||||
import { FieldError } from '../../atoms/field-error';
|
|
||||||
import { FlexBox } from '../../atoms/flex-box';
|
|
||||||
import type { ChipGroupProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A multiple choice as a wrapping row of toggle chips, such as markets, with its error under it.
|
|
||||||
* The fieldset is named and can take focus, so a form error can send the person to it.
|
|
||||||
*/
|
|
||||||
export function ChipGroup<T extends string>({
|
|
||||||
options,
|
|
||||||
value,
|
|
||||||
onToggle,
|
|
||||||
label,
|
|
||||||
error,
|
|
||||||
size = 'md',
|
|
||||||
disabled = false,
|
|
||||||
ref,
|
|
||||||
className,
|
|
||||||
}: ChipGroupProps<T>) {
|
|
||||||
const errorId = useId();
|
|
||||||
const hasError = error != null && error !== false;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FlexBox direction="flex-col" gap="gap-2" className={className}>
|
|
||||||
<FlexBox
|
|
||||||
ref={ref}
|
|
||||||
tag="fieldset"
|
|
||||||
tabIndex={-1}
|
|
||||||
aria-label={label}
|
|
||||||
aria-describedby={hasError ? errorId : undefined}
|
|
||||||
wrap="flex-wrap"
|
|
||||||
gap="gap-2"
|
|
||||||
className="rounded-md outline-none"
|
|
||||||
>
|
|
||||||
{options.map((option) => (
|
|
||||||
<Chip
|
|
||||||
key={option.value}
|
|
||||||
size={size}
|
|
||||||
selected={value.includes(option.value)}
|
|
||||||
disabled={disabled}
|
|
||||||
onClick={() => onToggle(option.value)}
|
|
||||||
>
|
|
||||||
{option.label}
|
|
||||||
</Chip>
|
|
||||||
))}
|
|
||||||
</FlexBox>
|
|
||||||
{hasError && <FieldError id={errorId}>{error}</FieldError>}
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export { ChipGroup } from './ChipGroup';
|
|
||||||
export type { ChipGroupOption, ChipGroupProps } from './types';
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
import type { ReactNode, Ref } from 'react';
|
|
||||||
|
|
||||||
import type { ChipSize } from '../../atoms/chip';
|
|
||||||
|
|
||||||
export type ChipGroupOption<T extends string> = { value: T; label: ReactNode };
|
|
||||||
|
|
||||||
export type ChipGroupProps<T extends string> = {
|
|
||||||
options: readonly ChipGroupOption<T>[];
|
|
||||||
/** The picked values. */
|
|
||||||
value: readonly T[];
|
|
||||||
/** A chip was pressed: add or remove its value. */
|
|
||||||
onToggle: (value: T) => void;
|
|
||||||
/** The group's accessible name, usually its section title. */
|
|
||||||
label: string;
|
|
||||||
/** Under the chips, such as «انتخاب حداقل یک تخصص الزامی است.». */
|
|
||||||
error?: ReactNode;
|
|
||||||
size?: ChipSize;
|
|
||||||
disabled?: boolean;
|
|
||||||
/** Reaches the fieldset, which takes focus (and scrolls into view) for a form error. */
|
|
||||||
ref?: Ref<HTMLFieldSetElement>;
|
|
||||||
className?: string;
|
|
||||||
};
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
import { useId } from 'react';
|
|
||||||
|
|
||||||
import { FlexBox } from '../../atoms/flex-box';
|
|
||||||
import { Typography } from '../../atoms/typography';
|
|
||||||
import type { FormSectionProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One titled part of a long form, such as a photo, a set of chips or a list of links: the heading
|
|
||||||
* with its optional marker, a hint, then the controls. The section is named by its heading.
|
|
||||||
*/
|
|
||||||
export function FormSection({
|
|
||||||
title,
|
|
||||||
note,
|
|
||||||
hint,
|
|
||||||
className,
|
|
||||||
children,
|
|
||||||
}: FormSectionProps) {
|
|
||||||
const titleId = useId();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FlexBox
|
|
||||||
tag="section"
|
|
||||||
aria-labelledby={titleId}
|
|
||||||
direction="flex-col"
|
|
||||||
gap="gap-3"
|
|
||||||
className={className}
|
|
||||||
>
|
|
||||||
<FlexBox direction="flex-col" className="gap-0.5">
|
|
||||||
<Typography tag="h2" variant="heading-sm" id={titleId}>
|
|
||||||
{title}
|
|
||||||
{note != null && (
|
|
||||||
<Typography
|
|
||||||
tag="span"
|
|
||||||
variant="caption"
|
|
||||||
color="secondary"
|
|
||||||
className="ms-1"
|
|
||||||
>
|
|
||||||
{note}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</Typography>
|
|
||||||
{hint != null && (
|
|
||||||
<Typography tag="p" variant="caption" color="secondary">
|
|
||||||
{hint}
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</FlexBox>
|
|
||||||
{children}
|
|
||||||
</FlexBox>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
export { FormSection } from './FormSection';
|
|
||||||
export type { FormSectionProps } from './types';
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import type { ReactNode } from 'react';
|
|
||||||
|
|
||||||
export type FormSectionProps = {
|
|
||||||
/** The section's name, a level-2 heading. */
|
|
||||||
title: ReactNode;
|
|
||||||
/** A quiet marker after the title, such as «(اختیاری)». */
|
|
||||||
note?: ReactNode;
|
|
||||||
/** One sentence under the title: what to put here. */
|
|
||||||
hint?: ReactNode;
|
|
||||||
className?: string;
|
|
||||||
children: ReactNode;
|
|
||||||
};
|
|
||||||
|
|
@ -20,7 +20,6 @@ export function Modal({
|
||||||
actions,
|
actions,
|
||||||
icon,
|
icon,
|
||||||
onClose,
|
onClose,
|
||||||
onExited,
|
|
||||||
closeLabel,
|
closeLabel,
|
||||||
dismissible = true,
|
dismissible = true,
|
||||||
alert,
|
alert,
|
||||||
|
|
@ -32,7 +31,6 @@ export function Modal({
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
onExited={onExited}
|
|
||||||
dismissible={dismissible}
|
dismissible={dismissible}
|
||||||
alert={alert}
|
alert={alert}
|
||||||
labelledBy={titleId}
|
labelledBy={titleId}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ export type ModalProps = {
|
||||||
icon?: ReactNode;
|
icon?: ReactNode;
|
||||||
/** Escape and the scrim call it, unless `dismissible` is false. */
|
/** Escape and the scrim call it, unless `dismissible` is false. */
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
/** The modal has closed and focus is back on the page. */
|
|
||||||
onExited?: () => void;
|
|
||||||
/** The ✕'s accessible name, such as «بستن». Shows the ✕; omit it when there is a cancel button. */
|
/** The ✕'s accessible name, such as «بستن». Shows the ✕; omit it when there is a cancel button. */
|
||||||
closeLabel?: string;
|
closeLabel?: string;
|
||||||
/** false: no ✕, and Escape and the scrim do nothing, such as «در حال تأیید پرداخت...». */
|
/** false: no ✕, and Escape and the scrim do nothing, such as «در حال تأیید پرداخت...». */
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ export function Sheet({
|
||||||
children,
|
children,
|
||||||
footer,
|
footer,
|
||||||
onClose,
|
onClose,
|
||||||
onExited,
|
|
||||||
closeLabel,
|
closeLabel,
|
||||||
dismissible = true,
|
dismissible = true,
|
||||||
alert,
|
alert,
|
||||||
|
|
@ -52,7 +51,6 @@ export function Sheet({
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
onExited={onExited}
|
|
||||||
dismissible={dismissible}
|
dismissible={dismissible}
|
||||||
alert={alert}
|
alert={alert}
|
||||||
labelledBy={titleId}
|
labelledBy={titleId}
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@ export type SheetProps = {
|
||||||
footer?: ReactNode;
|
footer?: ReactNode;
|
||||||
/** Escape, the scrim and (popover) a tap outside call it. */
|
/** Escape, the scrim and (popover) a tap outside call it. */
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
/** Bottom and side only: the sheet has closed and focus is back on the page. */
|
|
||||||
onExited?: () => void;
|
|
||||||
/** The ✕'s accessible name, such as «بستن». Shows the ✕; omit it when there is a cancel button. */
|
/** The ✕'s accessible name, such as «بستن». Shows the ✕; omit it when there is a cancel button. */
|
||||||
closeLabel?: string;
|
closeLabel?: string;
|
||||||
/** false: Escape and the scrim do nothing, for a blocking halt. */
|
/** false: Escape and the scrim do nothing, for a blocking halt. */
|
||||||
|
|
@ -39,5 +37,5 @@ export type SheetHeadProps = {
|
||||||
|
|
||||||
export type SheetPopoverProps = Omit<
|
export type SheetPopoverProps = Omit<
|
||||||
SheetProps,
|
SheetProps,
|
||||||
'placement' | 'dismissible' | 'alert' | 'onExited'
|
'placement' | 'dismissible' | 'alert'
|
||||||
>;
|
>;
|
||||||
|
|
|
||||||
|
|
@ -157,11 +157,6 @@ export function date(
|
||||||
return time ? `${day}${DATE_TIME_JOINER}${timeFormatter.format(at)}` : day;
|
return time ? `${day}${DATE_TIME_JOINER}${timeFormatter.format(at)}` : day;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Time of day in Tehran: `14:05`, such as when a draft was last saved. */
|
|
||||||
export function time(value: DateInput): string {
|
|
||||||
return timeFormatter.format(toDate(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** `همین الان`, `5 دقیقه پیش`, `2 ساعت پیش`, `دیروز`; older than that → `date()`. */
|
/** `همین الان`, `5 دقیقه پیش`, `2 ساعت پیش`, `دیروز`; older than that → `date()`. */
|
||||||
export function relative(
|
export function relative(
|
||||||
value: DateInput,
|
value: DateInput,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ export {
|
||||||
sheba,
|
sheba,
|
||||||
signed,
|
signed,
|
||||||
signedPercent,
|
signedPercent,
|
||||||
time,
|
|
||||||
} from './format';
|
} from './format';
|
||||||
export { LOCALE, TIME_ZONE } from './constants';
|
export { LOCALE, TIME_ZONE } from './constants';
|
||||||
export type { DateFormatOptions, DateInput, ShebaFormatOptions } from './types';
|
export type { DateFormatOptions, DateInput, ShebaFormatOptions } from './types';
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { useLoginPage } from '../../../../../../../features/auth';
|
import { useLoginPage } from '../../../../../../../features/auth';
|
||||||
import { translateMessage } from '../../../../../../../shared/utils';
|
import { translateMessage } from '../../../../../../../shared/utils';
|
||||||
import { useAuthRoutes } from '../../../../../../navigation';
|
import { useAuthRoutes } from '../../../../../../navigation';
|
||||||
import { SupportEntry } from '../../../../../organisms/support-entry';
|
import { SupportEntry } from '../../../../organisms/support-entry';
|
||||||
import type { LoginStepProps } from './types';
|
import type { LoginStepProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { SupportEntryProps } from '../../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../../organisms/support-entry';
|
||||||
|
|
||||||
export type LoginStepProps = {
|
export type LoginStepProps = {
|
||||||
/** `lg` on mobile, `md` on desktop. */
|
/** `lg` on mobile, `md` on desktop. */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { Typography } from '@lumina/island/atoms/typography';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { SupportEntry } from '../../../../../../../organisms/support-entry';
|
import { SupportEntry } from '../../../../../../organisms/support-entry';
|
||||||
import type { SuspendedNoticeProps } from '../types';
|
import type { SuspendedNoticeProps } from '../types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { SupportEntryProps } from '../../../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../../../organisms/support-entry';
|
||||||
|
|
||||||
export type LoginVerifyStepProps = {
|
export type LoginVerifyStepProps = {
|
||||||
/** `lg` on mobile, `md` on desktop. */
|
/** `lg` on mobile, `md` on desktop. */
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import { Controller } from 'react-hook-form';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { formatMobile, translateMessage } from '../../../../../../shared/utils';
|
import { formatMobile, translateMessage } from '../../../../../../shared/utils';
|
||||||
import { SupportEntry } from '../../../../organisms/support-entry';
|
import { SupportEntry } from '../../../organisms/support-entry';
|
||||||
import type { CodeStepProps } from './types';
|
import type { CodeStepProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
import type { CodeStepModel } from '../../../../../../features/auth';
|
import type { CodeStepModel } from '../../../../../../features/auth';
|
||||||
import type { SupportEntryProps } from '../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../organisms/support-entry';
|
||||||
|
|
||||||
export type CodeStepProps = {
|
export type CodeStepProps = {
|
||||||
/** The page model's code step (`useCodeStep`). */
|
/** The page model's code step (`useCodeStep`). */
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import { Banner } from '@lumina/island/molecules/banner';
|
||||||
import type { FormEvent } from 'react';
|
import type { FormEvent } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { SupportEntry } from '../../../../../../../organisms/support-entry';
|
import { SupportEntry } from '../../../../../../organisms/support-entry';
|
||||||
import { RegisterProgress } from '../../../../../../../organisms/register-progress';
|
import { RegisterProgress } from '../../../../organisms/register-progress';
|
||||||
import type { DetailsFrameProps } from '../types';
|
import type { DetailsFrameProps } from '../types';
|
||||||
import { ExpiryHalt } from './ExpiryHalt';
|
import { ExpiryHalt } from './ExpiryHalt';
|
||||||
import { ExpiryWarning } from './ExpiryWarning';
|
import { ExpiryWarning } from './ExpiryWarning';
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type {
|
||||||
RegisterDetailsPageModel,
|
RegisterDetailsPageModel,
|
||||||
UseDetailsPartOptions,
|
UseDetailsPartOptions,
|
||||||
} from '../../../../../../../../features/auth';
|
} from '../../../../../../../../features/auth';
|
||||||
import type { SupportEntryProps } from '../../../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../../../organisms/support-entry';
|
||||||
|
|
||||||
export type RegisterDetailsStepProps = {
|
export type RegisterDetailsStepProps = {
|
||||||
/** `lg` on mobile, `md` on desktop. */
|
/** `lg` on mobile, `md` on desktop. */
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { UserRole } from '../../../../features/auth';
|
import type { UserRole } from '../../../../../../../features/auth';
|
||||||
|
|
||||||
export type RegisterProgressProps = {
|
export type RegisterProgressProps = {
|
||||||
/** 0-based: account type, number, code, details or identity, profile. */
|
/** 0-based: account type, number, code, details or identity, profile. */
|
||||||
|
|
@ -14,8 +14,8 @@ import { useRegisterTypePage } from '../../../../../../../features/auth';
|
||||||
import type { UserRole } from '../../../../../../../features/auth';
|
import type { UserRole } from '../../../../../../../features/auth';
|
||||||
import { translateMessage } from '../../../../../../../shared/utils';
|
import { translateMessage } from '../../../../../../../shared/utils';
|
||||||
import { useAuthRoutes } from '../../../../../../navigation';
|
import { useAuthRoutes } from '../../../../../../navigation';
|
||||||
import { SupportEntry } from '../../../../../organisms/support-entry';
|
import { SupportEntry } from '../../../../organisms/support-entry';
|
||||||
import { RegisterProgress } from '../../../../../organisms/register-progress';
|
import { RegisterProgress } from '../register-progress';
|
||||||
import type { RegisterTypeStepProps } from './types';
|
import type { RegisterTypeStepProps } from './types';
|
||||||
|
|
||||||
const ACCOUNT_TYPES = [
|
const ACCOUNT_TYPES = [
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { SupportEntryProps } from '../../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../../organisms/support-entry';
|
||||||
|
|
||||||
export type RegisterTypeStepProps = {
|
export type RegisterTypeStepProps = {
|
||||||
/** `lg` on mobile, `md` on desktop. */
|
/** `lg` on mobile, `md` on desktop. */
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { useRegisterPhonePage } from '../../../../../../../../features/auth';
|
import { useRegisterPhonePage } from '../../../../../../../../features/auth';
|
||||||
import { translateMessage } from '../../../../../../../../shared/utils';
|
import { translateMessage } from '../../../../../../../../shared/utils';
|
||||||
import { useAuthRoutes } from '../../../../../../../navigation';
|
import { useAuthRoutes } from '../../../../../../../navigation';
|
||||||
import { SupportEntry } from '../../../../../../organisms/support-entry';
|
import { SupportEntry } from '../../../../../organisms/support-entry';
|
||||||
import { RegisterProgress } from '../../../../../../organisms/register-progress';
|
import { RegisterProgress } from '../../../organisms/register-progress';
|
||||||
import type { RegisterPhoneStepProps } from './types';
|
import type { RegisterPhoneStepProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { SupportEntryProps } from '../../../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../../../organisms/support-entry';
|
||||||
|
|
||||||
export type RegisterPhoneStepProps = {
|
export type RegisterPhoneStepProps = {
|
||||||
/** `lg` on mobile, `md` on desktop. */
|
/** `lg` on mobile, `md` on desktop. */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { useRegisterVerifyPage } from '../../../../../../../../features/auth';
|
import { useRegisterVerifyPage } from '../../../../../../../../features/auth';
|
||||||
import { useAuthRoutes } from '../../../../../../../navigation';
|
import { useAuthRoutes } from '../../../../../../../navigation';
|
||||||
import { CodeStep } from '../../../../organisms/code-step';
|
import { CodeStep } from '../../../../organisms/code-step';
|
||||||
import { RegisterProgress } from '../../../../../../organisms/register-progress';
|
import { RegisterProgress } from '../../../organisms/register-progress';
|
||||||
import type { RegisterVerifyStepProps } from './types';
|
import type { RegisterVerifyStepProps } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { SupportEntryProps } from '../../../../../../organisms/support-entry';
|
import type { SupportEntryProps } from '../../../../../organisms/support-entry';
|
||||||
|
|
||||||
export type RegisterVerifyStepProps = {
|
export type RegisterVerifyStepProps = {
|
||||||
/** `lg` on mobile, `md` on desktop. */
|
/** `lg` on mobile, `md` on desktop. */
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ import { SupportSheet } from '@lumina/island/organisms/support-sheet';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { getEnv } from '../../../../env';
|
import { getEnv } from '../../../../../env';
|
||||||
import { ROUTES } from '../../../navigation';
|
import { ROUTES } from '../../../../navigation';
|
||||||
import { SUPPORT_CHAT_URLS } from './constants';
|
import { SUPPORT_CHAT_URLS } from './constants';
|
||||||
import type { SupportEntryProps } from './types';
|
import type { SupportEntryProps } from './types';
|
||||||
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
'use client';
|
|
||||||
|
|
||||||
import {
|
|
||||||
useCreatorPhotoPart,
|
|
||||||
useCreatorProfilePage,
|
|
||||||
} from '../../../../../../../features/profile';
|
|
||||||
import { CompletedView } from './components/CompletedView';
|
|
||||||
import { ProfileForm } from './components/ProfileForm';
|
|
||||||
import { StepLayout } from './components/StepLayout';
|
|
||||||
import type { CreatorProfileStepProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registration step 5 for a creator, on the normal session: the public profile, required but
|
|
||||||
* saved as it is typed, so it can be finished later. The page wraps it in Suspense while the
|
|
||||||
* saved draft loads; then the form, and after «تکمیل ثبتنام» the end of registration.
|
|
||||||
*/
|
|
||||||
export function CreatorProfileStep(props: CreatorProfileStepProps) {
|
|
||||||
const page = useCreatorProfilePage();
|
|
||||||
const photo = useCreatorPhotoPart(page.profile);
|
|
||||||
|
|
||||||
if (page.view === 'completed') {
|
|
||||||
return (
|
|
||||||
<StepLayout layout={props.layout}>
|
|
||||||
<CompletedView
|
|
||||||
username={page.profile.username}
|
|
||||||
size={props.size}
|
|
||||||
supportPlacement={props.supportPlacement}
|
|
||||||
/>
|
|
||||||
</StepLayout>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return <ProfileForm {...props} page={page} photo={photo} />;
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
import { SkeletonPreset } from '@lumina/island/organisms/skeleton-preset';
|
|
||||||
|
|
||||||
import { StepLayout } from './components/StepLayout';
|
|
||||||
import type { CreatorProfileStepSkeletonProps } from './types';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Step 5's shape before the viewer and the draft are known: the form and, on desktop, the
|
|
||||||
* preview card beside it, at the same size as the step. Server-safe, for the page's guard.
|
|
||||||
*/
|
|
||||||
export function CreatorProfileStepSkeleton({
|
|
||||||
layout,
|
|
||||||
label,
|
|
||||||
}: CreatorProfileStepSkeletonProps) {
|
|
||||||
return (
|
|
||||||
<StepLayout
|
|
||||||
layout={layout}
|
|
||||||
aside={
|
|
||||||
layout === 'desktop' && <SkeletonPreset preset="header" label={label} />
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<SkeletonPreset preset="form" count={4} label={label} />
|
|
||||||
</StepLayout>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue