diff --git a/platforms/market/src/app/error-boundaries/app-crash/AppCrash.tsx b/platforms/market/src/app/error-boundaries/app-crash/AppCrash.tsx
index 928dbca..4a336b6 100644
--- a/platforms/market/src/app/error-boundaries/app-crash/AppCrash.tsx
+++ b/platforms/market/src/app/error-boundaries/app-crash/AppCrash.tsx
@@ -1,10 +1,11 @@
'use client';
-import { buttonVariants } from '@lumina/island/atoms/button';
+import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { Typography } from '@lumina/island/atoms/typography';
import { useTranslation } from 'react-i18next';
+import { ROUTES } from '../../navigation/navigation';
import { ErrorFallback } from '../error-fallback';
import type { AppCrashProps } from './types';
@@ -36,18 +37,9 @@ export function AppCrash({ error }: AppCrashProps) {
size="app"
onRetry={() => window.location.reload()}
>
-
-
- {tErrors('empty.home')}
-
-
+
);
diff --git a/platforms/market/src/app/navigation/components/account-menu/AccountMenu.tsx b/platforms/market/src/app/navigation/components/account-menu/AccountMenu.tsx
index 3774d3b..ac9c56d 100644
--- a/platforms/market/src/app/navigation/components/account-menu/AccountMenu.tsx
+++ b/platforms/market/src/app/navigation/components/account-menu/AccountMenu.tsx
@@ -92,7 +92,7 @@ export function AccountMenu({ account }: AccountMenuProps) {
{name}
diff --git a/platforms/market/src/app/navigation/components/desk-back/DeskBack.tsx b/platforms/market/src/app/navigation/components/desk-back/DeskBack.tsx
index cdb0fb8..06c7abb 100644
--- a/platforms/market/src/app/navigation/components/desk-back/DeskBack.tsx
+++ b/platforms/market/src/app/navigation/components/desk-back/DeskBack.tsx
@@ -30,7 +30,7 @@ export function DeskBack({ label, ...options }: DeskBackProps) {
tag="span"
variant="inherit"
color="inherit"
- className="text-[0.9375rem] leading-6 font-semibold"
+ className="text-body-compact leading-6 font-semibold"
>
{label ?? t('nav.back')}
diff --git a/platforms/market/src/app/navigation/components/desktop-header/components/HeaderNavLink.tsx b/platforms/market/src/app/navigation/components/desktop-header/components/HeaderNavLink.tsx
index c4d93ce..4e21fe1 100644
--- a/platforms/market/src/app/navigation/components/desktop-header/components/HeaderNavLink.tsx
+++ b/platforms/market/src/app/navigation/components/desktop-header/components/HeaderNavLink.tsx
@@ -14,7 +14,7 @@ export function HeaderNavLink({ href, label, isActive }: HeaderNavLinkProps) {
color={isActive ? 'brand' : 'secondary'}
aria-current={isActive ? 'page' : undefined}
className={cn(
- 'inline-block rounded-full px-4 py-2 text-[0.9375rem] leading-6 font-semibold whitespace-nowrap no-underline transition-colors duration-120 ease-standard hover:text-text-primary focus-visible:focus-ring',
+ 'inline-block rounded-full px-4 py-2 text-body-compact leading-6 font-semibold whitespace-nowrap no-underline transition-colors duration-120 ease-standard hover:text-text-primary focus-visible:focus-ring',
isActive && 'bg-action-primary-subtle',
)}
>
diff --git a/platforms/market/src/app/navigation/components/mobile-top-bar/MobileTopBar.tsx b/platforms/market/src/app/navigation/components/mobile-top-bar/MobileTopBar.tsx
index a8dcd5e..7798868 100644
--- a/platforms/market/src/app/navigation/components/mobile-top-bar/MobileTopBar.tsx
+++ b/platforms/market/src/app/navigation/components/mobile-top-bar/MobileTopBar.tsx
@@ -24,7 +24,7 @@ import type { MobileTopBarProps } from './types';
/** The guest's «ورود/ثبتنام»: an indigo text link, 15/600, 44px tall. */
const LOGIN_LINK_CLASS =
- 'rounded-full px-2 text-[0.9375rem] leading-11 font-semibold whitespace-nowrap no-underline focus-visible:focus-ring';
+ 'rounded-full px-2 text-body-compact leading-11 font-semibold whitespace-nowrap no-underline focus-visible:focus-ring';
/**
* The mobile top bar of a page pushed from a tab: back, the page's name (18/30) and support. A
diff --git a/platforms/market/src/app/navigation/components/publish-menu/PublishMenu.tsx b/platforms/market/src/app/navigation/components/publish-menu/PublishMenu.tsx
index ec28e8a..fa5aa8b 100644
--- a/platforms/market/src/app/navigation/components/publish-menu/PublishMenu.tsx
+++ b/platforms/market/src/app/navigation/components/publish-menu/PublishMenu.tsx
@@ -20,7 +20,7 @@ const isBlocked = (standing: string): standing is BlockedStanding =>
* «انتشار» (C4 ۱.۱, ۱.۲, ۷.۱): a verified creator gets the menu, «پست جدید» or «پیشبینی جدید». A
* creator who can't publish sees it frozen, and a press explains why instead of a tooltip. On
* mobile the open menu sits centred over the nav, on a light scrim that dims the page down to the
- * nav; a press on the scrim closes it.
+ * nav; a press on the scrim closes it, and the FAB turns into an icon-only ✕ «بستن» (J08-1b).
*/
export function PublishMenu({ placement }: PublishMenuProps) {
const { t } = useTranslation();
@@ -29,6 +29,8 @@ export function PublishMenu({ placement }: PublishMenuProps) {
const [isOpen, setIsOpen] = useState(false);
const [isExplaining, setIsExplaining] = useState(false);
const blocked = isBlocked(standing) ? standing : null;
+ // J08-1b-M: the open FAB is just the ✕, named «بستن»; desktop keeps «انتشار» beside it.
+ const isClosingFab = placement === 'nav' && isOpen;
return (
<>
@@ -43,6 +45,7 @@ export function PublishMenu({ placement }: PublishMenuProps) {
-
-
- );
const next =
standing === 'suspended' ? (
@@ -84,7 +70,6 @@ export function BlockedPublishDialog({
diff --git a/platforms/market/src/app/navigation/components/publish-menu/constants.ts b/platforms/market/src/app/navigation/components/publish-menu/constants.ts
deleted file mode 100644
index abb283c..0000000
--- a/platforms/market/src/app/navigation/components/publish-menu/constants.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import type { IconName } from '@lumina/island/atoms/icon';
-
-import type { BlockedStanding } from './types';
-
-/** Each blocked standing's art: its icon and its tile's tone. */
-export const BLOCKED_ART: Record<
- BlockedStanding,
- { icon: IconName; className: string }
-> = {
- pending: {
- icon: 'clock',
- className: 'bg-surface-sunken text-text-secondary',
- },
- rejected: { icon: 'alert', className: 'bg-danger-subtle text-danger-text' },
- suspended: { icon: 'lock', className: 'bg-surface-sunken text-text-primary' },
-};
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/hooks/use-dialog-route.ts b/platforms/market/src/app/navigation/hooks/use-dialog-route.ts
similarity index 71%
rename from platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/hooks/use-dialog-route.ts
rename to platforms/market/src/app/navigation/hooks/use-dialog-route.ts
index e7113fb..11e06d8 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/hooks/use-dialog-route.ts
+++ b/platforms/market/src/app/navigation/hooks/use-dialog-route.ts
@@ -1,14 +1,16 @@
+'use client';
+
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import type { DialogRoute } from '../types';
/**
- * The dialog that intercepts /compose/post plays its exit before its route changes. Closed, it goes
- * back to the page under it, or to `fallback` when there is no history to go back to. Finished, it
- * goes to `href` so back never reopens an empty composer, the `@modal` slot empties there, and
- * `href` is read again from the server: back when `href` is the page under it, else in place of
- * its own history entry.
+ * A dialog that intercepts a route (/compose/post, /compose/prediction) plays its exit before its
+ * route changes. Closed, it goes back to the page under it, or to `fallback` when there is no
+ * history to go back to. Finished, it goes to `href` so back never reopens an empty composer, the
+ * `@modal` slot empties there, and `href` is read again from the server: back when `href` is the
+ * page under it, else in place of its own history entry.
*/
export function useDialogRoute(fallback: string): DialogRoute {
const router = useRouter();
@@ -21,7 +23,7 @@ export function useDialogRoute(fallback: string): DialogRoute {
setExit('done');
if (isUnder) {
// Replacing would leave that page in history twice, and the next back would seem to do
- // nothing. The refresh waits for the back to land, or it would read /compose/post again.
+ // nothing. The refresh waits for the back to land, or it would read the composer again.
window.addEventListener('popstate', () => router.refresh(), {
once: true,
});
diff --git a/platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/hooks/use-leave-guard.ts b/platforms/market/src/app/navigation/hooks/use-leave-guard.ts
similarity index 75%
rename from platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/hooks/use-leave-guard.ts
rename to platforms/market/src/app/navigation/hooks/use-leave-guard.ts
index b6a5a27..24601d2 100644
--- a/platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/hooks/use-leave-guard.ts
+++ b/platforms/market/src/app/navigation/hooks/use-leave-guard.ts
@@ -1,3 +1,5 @@
+'use client';
+
import { useEffect } from 'react';
/** A plain click on a link to another page of this site, which the app would navigate to itself. */
@@ -24,16 +26,17 @@ function leavingHref(event: MouseEvent): string | null {
}
/**
- * While a block holds unsaved changes, leaving asks first: a link inside the app (the header, the
- * account menu) opens the page's own dialog with where it leads (J03-1g), and closing or reloading
- * the tab gets the browser's prompt. Back is asked about by the bar's `onBack`.
+ * While a form holds unsaved changes (`active`), leaving asks first. A link inside the app (the
+ * header, the account menu, the brand) is held and handed to `onLeaveRequest` with where it leads,
+ * which asks and navigates there itself; closing or reloading the tab gets the browser's prompt.
+ * Back is the caller's: the bar's `onBack` asks before it leaves. Keep `onLeaveRequest` stable.
*/
export function useLeaveGuard(
- isDirty: boolean,
+ active: boolean,
onLeaveRequest: (href: string) => void,
): void {
useEffect(() => {
- if (!isDirty) return undefined;
+ if (!active) return undefined;
const askOnUnload = (event: BeforeUnloadEvent) => event.preventDefault();
// Capture, so it runs before the app's own link handling and can stop it.
const askOnLink = (event: MouseEvent) => {
@@ -49,5 +52,5 @@ export function useLeaveGuard(
window.removeEventListener('beforeunload', askOnUnload);
document.removeEventListener('click', askOnLink, true);
};
- }, [isDirty, onLeaveRequest]);
+ }, [active, onLeaveRequest]);
}
diff --git a/platforms/market/src/app/navigation/index.ts b/platforms/market/src/app/navigation/index.ts
index 55b50e4..26e2452 100644
--- a/platforms/market/src/app/navigation/index.ts
+++ b/platforms/market/src/app/navigation/index.ts
@@ -16,8 +16,10 @@ export {
} from './constants';
export { useAuthRoutes } from './hooks/use-auth-routes';
export { useBackTarget } from './hooks/use-back-target';
+export { useDialogRoute } from './hooks/use-dialog-route';
export { useHomeHref } from './hooks/use-home-href';
export { useIsStandalone } from './hooks/use-is-standalone';
+export { useLeaveGuard } from './hooks/use-leave-guard';
export {
homeRoute,
loginRoute,
@@ -27,4 +29,4 @@ export {
withReturnPath,
} from './navigation';
export { safeReturnPath } from './return-path';
-export type { AuthRoutes, BackOptions } from './types';
+export type { AuthRoutes, BackOptions, DialogRoute } from './types';
diff --git a/platforms/market/src/app/navigation/types.ts b/platforms/market/src/app/navigation/types.ts
index 3ce5756..19b27eb 100644
--- a/platforms/market/src/app/navigation/types.ts
+++ b/platforms/market/src/app/navigation/types.ts
@@ -46,3 +46,18 @@ export type BackOptions = {
export type BackAction =
| { href: string; onClick?: never }
| { href?: never; onClick: () => void };
+
+/** How a dialog that intercepts a route (bear's `@modal`) leaves it (0023, C4 ۷.۳). */
+export type DialogRoute = {
+ /** Until it starts closing. */
+ open: boolean;
+ /** Closes it, then goes back to the page under it. */
+ close: () => void;
+ /**
+ * Closes it and goes to `href`, read again: back, when `href` is the page under it (`isUnder`),
+ * else in place of the dialog's history entry.
+ */
+ finish: (href: string, options?: { isUnder?: boolean }) => void;
+ /** The Modal's `onExited`. */
+ onExited: () => void;
+};
diff --git a/platforms/market/src/app/screens/(auth)/auth/register/details/organisms/register-details-step/components/CreatorIdentityForm.tsx b/platforms/market/src/app/screens/(auth)/auth/register/details/organisms/register-details-step/components/CreatorIdentityForm.tsx
index 1633e43..f6f5202 100644
--- a/platforms/market/src/app/screens/(auth)/auth/register/details/organisms/register-details-step/components/CreatorIdentityForm.tsx
+++ b/platforms/market/src/app/screens/(auth)/auth/register/details/organisms/register-details-step/components/CreatorIdentityForm.tsx
@@ -1,14 +1,10 @@
'use client';
import { Button } from '@lumina/island/atoms/button';
-import { FlexBox } from '@lumina/island/atoms/flex-box';
-import { Icon } from '@lumina/island/atoms/icon';
-import { Typography } from '@lumina/island/atoms/typography';
import { FileField } from '@lumina/island/molecules/file-field';
+import { FormSection } from '@lumina/island/molecules/form-section';
import { TextInput } from '@lumina/island/molecules/text-input';
import { number } from '@lumina/tools/format';
-import { useId } from 'react';
-import type { ReactNode } from 'react';
import { Controller } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
@@ -29,56 +25,6 @@ const ID_CARD_SIDES = [
const BYTES_PER_MB = 1024 * 1024;
-/**
- * A labelled group with its privacy line: what investors see, and what only the review sees (its
- * heading carries the lock).
- */
-function Group({
- title,
- note,
- titleIcon,
- children,
-}: {
- title: string;
- note: string;
- titleIcon?: 'lock';
- children: ReactNode;
-}) {
- const titleId = useId();
- return (
-
-
-
-
- {title}
-
- {titleIcon && (
-
- )}
-
-
- {note}
-
-
- {children}
-
- );
-}
-
/**
* Step 4 for a creator: the public username, then the private identity (names, national code,
* both sides of the ID card) for the admin review. The images upload with a bar; repeat taps are
@@ -120,9 +66,10 @@ export function CreatorIdentityForm(props: DetailsFormProps) {
>
}
>
-
-
-
+
@@ -191,7 +138,7 @@ export function CreatorIdentityForm(props: DetailsFormProps) {
)}
/>
))}
-
+
);
}
diff --git a/platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/CreatorProfileEdit.tsx b/platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/CreatorProfileEdit.tsx
index 7810064..4991d09 100644
--- a/platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/CreatorProfileEdit.tsx
+++ b/platforms/market/src/app/screens/(flow)/account/profile/organisms/creator-profile-edit/CreatorProfileEdit.tsx
@@ -11,10 +11,10 @@ import {
MobileTopBar,
ROUTES,
useHomeHref,
+ useLeaveGuard,
} from '../../../../../../navigation';
import { CreatorProfileEditSkeleton } from './CreatorProfileEditSkeleton';
import { EditContent } from './components/EditContent';
-import { useLeaveGuard } from './hooks/use-leave-guard';
import type { CreatorProfileEditProps, LeaveTarget } from './types';
/**
diff --git a/platforms/market/src/app/screens/(flow)/account/profile/organisms/investor-profile-form/components/ProfileFields.tsx b/platforms/market/src/app/screens/(flow)/account/profile/organisms/investor-profile-form/components/ProfileFields.tsx
index cb94715..742948b 100644
--- a/platforms/market/src/app/screens/(flow)/account/profile/organisms/investor-profile-form/components/ProfileFields.tsx
+++ b/platforms/market/src/app/screens/(flow)/account/profile/organisms/investor-profile-form/components/ProfileFields.tsx
@@ -80,6 +80,9 @@ export function ProfileFields({ page, photo, layout }: ProfileFieldsProps) {
error={translateMessage(t, photo.error)}
accept={AVATAR_IMAGE.types.join(',')}
disabled={photo.isRemoving}
+ // J12-2: the DS lg 52px photo and a small ghost «حذف تصویر».
+ size="lg"
+ removeStyle="ghost"
onPick={photo.pick}
onRemove={photo.remove}
labels={{
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerLocked.tsx b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/ComposerLocked.tsx
similarity index 67%
rename from platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerLocked.tsx
rename to platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/ComposerLocked.tsx
index 44e16e1..5a0eb87 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerLocked.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/ComposerLocked.tsx
@@ -3,15 +3,15 @@ import { Card } from '@lumina/island/molecules/card';
import { ResultPanel } from '@lumina/island/molecules/result-panel';
import { useTranslation } from 'react-i18next';
-import { MobileTopBar } from '../../../../../../../navigation/components/mobile-top-bar';
-import { LOCKED_PANEL } from '../constants';
-import type { ComposerLockedProps } from '../types';
-import { LockedActions } from './LockedActions';
+import { MobileTopBar } from '../../../../../navigation/components/mobile-top-bar';
+import { LockedActions } from './components/LockedActions';
+import { LOCKED_PANEL } from './constants';
+import type { ComposerLockedProps } from './types';
/**
- * The composer's address opened by a creator who may not publish (C4 ۲.۱–۲.۳, J08-1f…1j): what
- * «انتشار» would explain in its sheet, as the page, with the one way forward and «بستن». Mobile:
- * the pushed page's bar over the panel; desktop: the 640px card.
+ * A composer's address opened by a creator who may not publish (C4 ۲.۱–۲.۳, J08-1f…1j, J09-1e):
+ * what «انتشار» would explain in its sheet, as the page, with the one way forward and «بستن».
+ * Mobile: the pushed page's bar over the panel; desktop: the 640px card.
*/
export function ComposerLocked({
standing,
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerLockedDialog.tsx b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/ComposerLockedDialog.tsx
similarity index 72%
rename from platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerLockedDialog.tsx
rename to platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/ComposerLockedDialog.tsx
index 9c2a6a6..4b4b0b0 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerLockedDialog.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/ComposerLockedDialog.tsx
@@ -2,13 +2,13 @@ import { Typography } from '@lumina/island/atoms/typography';
import { Modal } from '@lumina/island/molecules/modal';
import { useTranslation } from 'react-i18next';
-import { ROUTES } from '../../../../../../../navigation/navigation';
-import { useDialogRoute } from '../hooks/use-dialog-route';
-import type { ComposerLockedDialogProps } from '../types';
-import { LockedActions } from './LockedActions';
+import { useDialogRoute } from '../../../../../navigation/hooks/use-dialog-route';
+import { ROUTES } from '../../../../../navigation/navigation';
+import { LockedActions } from './components/LockedActions';
+import type { ComposerLockedDialogProps } from './types';
/**
- * The composer dialog's route opened by a creator who may not publish (J08-1f-D): the 420px
+ * A composer dialog's route opened by a creator who may not publish (J08-1f-D, J09-1e): the 420px
* question «انتشار» would have asked, title, reason and actions only, over the page. «بستن»,
* Escape and the scrim go back to that page.
*/
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/LockedActions.tsx b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/components/LockedActions.tsx
similarity index 77%
rename from platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/LockedActions.tsx
rename to platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/components/LockedActions.tsx
index 5b0a5c1..afa265b 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/LockedActions.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/components/LockedActions.tsx
@@ -2,13 +2,14 @@ import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { useTranslation } from 'react-i18next';
-import { ROUTES } from '../../../../../../../navigation/navigation';
-import { SupportEntry } from '../../../../../../organisms/support-entry';
+import { ROUTES } from '../../../../../../navigation/navigation';
+import { SupportEntry } from '../../../../../organisms/support-entry';
import type { LockedActionsProps } from '../types';
/**
- * Why-not's actions (C4 ۲.۱–۲.۳): the identity review's status for a pending creator, its form to
- * correct and send again for a rejected one, support for a suspended one; «بستن» under it.
+ * Why-not's actions (C4 ۲.۱–۲.۳, J09-1e, as «انتشار» explains it): the identity review's status for
+ * a pending creator, its form to correct and send again for a rejected one, support for a
+ * suspended one; «بستن» under it.
*/
export function LockedActions({
standing,
diff --git a/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/constants.ts b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/constants.ts
new file mode 100644
index 0000000..a3df771
--- /dev/null
+++ b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/constants.ts
@@ -0,0 +1,14 @@
+import type { IconName } from '@lumina/island/atoms/icon';
+import type { ResultPanelTone } from '@lumina/island/molecules/result-panel';
+
+import type { BlockedStanding } from '../../../../../../features/post';
+
+/** The blocked composer page's panel for each standing: its tone and icon (J08-1f…1j, J09-1e). */
+export const LOCKED_PANEL: Record<
+ BlockedStanding,
+ { tone: ResultPanelTone; icon: IconName }
+> = {
+ pending: { tone: 'info', icon: 'clock' },
+ rejected: { tone: 'danger', icon: 'alert' },
+ suspended: { tone: 'danger', icon: 'lock' },
+};
diff --git a/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/index.ts b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/index.ts
new file mode 100644
index 0000000..8d3c805
--- /dev/null
+++ b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/index.ts
@@ -0,0 +1,7 @@
+export { ComposerLocked } from './ComposerLocked';
+export { ComposerLockedDialog } from './ComposerLockedDialog';
+export type {
+ ComposerLockedDialogProps,
+ ComposerLockedLayout,
+ ComposerLockedProps,
+} from './types';
diff --git a/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/types.ts b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/types.ts
new file mode 100644
index 0000000..80d10e6
--- /dev/null
+++ b/platforms/market/src/app/screens/(flow)/compose/organisms/composer-locked/types.ts
@@ -0,0 +1,25 @@
+import type { BlockedStanding } from '../../../../../../features/post';
+
+export type ComposerLockedLayout = 'mobile' | 'desktop';
+
+export type ComposerLockedProps = {
+ standing: BlockedStanding;
+ layout: ComposerLockedLayout;
+ /** The composer's own title for the mobile bar: «پست جدید», «ویرایش پست», «پیشبینی جدید». */
+ title: string;
+ /** «بستن»: back to where the composer was opened, or the creator's channel. */
+ onClose: () => void;
+};
+
+export type ComposerLockedDialogProps = {
+ standing: BlockedStanding;
+ /** The creator's own: their channel is where «بستن» goes with no history. */
+ username: string;
+};
+
+/** The blocked composer's way forward over «بستن», in a page or a dialog. */
+export type LockedActionsProps = {
+ standing: BlockedStanding;
+ layout: ComposerLockedLayout;
+ onClose: () => void;
+};
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposer.tsx b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposer.tsx
index 764552a..8ed1610 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposer.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposer.tsx
@@ -8,7 +8,7 @@ import { usePublishAccess } from '../../../../../../../features/post';
import { useCurrentAccount } from '../../../../../../../stores/auth';
import { ROUTES } from '../../../../../../navigation/navigation';
import { ComposerForm } from './components/ComposerForm';
-import { ComposerLocked } from './components/ComposerLocked';
+import { ComposerLocked } from '../../../organisms/composer-locked';
import { EditComposer } from './components/EditComposer';
import type { PostComposerProps } from './types';
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposerDialog.tsx b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposerDialog.tsx
index e1ff789..3723504 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposerDialog.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/PostComposerDialog.tsx
@@ -8,7 +8,7 @@ import { StatusEmptyState } from '../../../../../../error-boundaries';
import { ROUTES } from '../../../../../../navigation/navigation';
import { ComposerDialog } from './components/ComposerDialog';
import { ComposerDialogPlaceholder } from './components/ComposerDialogPlaceholder';
-import { ComposerLockedDialog } from './components/ComposerLockedDialog';
+import { ComposerLockedDialog } from '../../../organisms/composer-locked';
import { EditComposerDialog } from './components/EditComposerDialog';
import { PostComposerDialogSkeleton } from './PostComposerDialogSkeleton';
import type { PostComposerDialogProps } from './types';
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialog.tsx b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialog.tsx
index 69fea19..de0355c 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialog.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialog.tsx
@@ -7,7 +7,7 @@ import {
usePostComposerPage,
} from '../../../../../../../../features/post';
import { ROUTES } from '../../../../../../../navigation/navigation';
-import { useDialogRoute } from '../hooks/use-dialog-route';
+import { useDialogRoute } from '../../../../../../../navigation/hooks/use-dialog-route';
import type { ComposerDialogProps } from '../types';
import { ComposerDialogFrame } from './ComposerDialogFrame';
import { ComposerPanel } from './ComposerPanel';
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialogPlaceholder.tsx b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialogPlaceholder.tsx
index 5771576..db5f19e 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialogPlaceholder.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/components/ComposerDialogPlaceholder.tsx
@@ -2,7 +2,7 @@ import { Button } from '@lumina/island/atoms/button';
import { FlexBox } from '@lumina/island/atoms/flex-box';
import { useTranslation } from 'react-i18next';
-import { useDialogRoute } from '../hooks/use-dialog-route';
+import { useDialogRoute } from '../../../../../../../navigation/hooks/use-dialog-route';
import type { ComposerDialogPlaceholderProps } from '../types';
import { ComposerDialogFrame } from './ComposerDialogFrame';
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/constants.ts b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/constants.ts
index 1748d95..1a033b2 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/constants.ts
+++ b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/constants.ts
@@ -1,17 +1,2 @@
-import type { IconName } from '@lumina/island/atoms/icon';
-import type { ResultPanelTone } from '@lumina/island/molecules/result-panel';
-
-import type { BlockedStanding } from '../../../../../../../features/post';
-
/** What the file picker offers: the image types the API takes. */
export const IMAGE_ACCEPT = 'image/jpeg,image/png,image/webp';
-
-/** The blocked composer page's panel for each standing: its tone and icon. */
-export const LOCKED_PANEL: Record<
- BlockedStanding,
- { tone: ResultPanelTone; icon: IconName }
-> = {
- pending: { tone: 'info', icon: 'clock' },
- rejected: { tone: 'danger', icon: 'alert' },
- suspended: { tone: 'danger', icon: 'lock' },
-};
diff --git a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/types.ts b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/types.ts
index 073dd45..c513196 100644
--- a/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/types.ts
+++ b/platforms/market/src/app/screens/(flow)/compose/post/organisms/post-composer/types.ts
@@ -2,7 +2,6 @@ import type { ReactNode, RefObject } from 'react';
import type { Control } from 'react-hook-form';
import type {
- BlockedStanding,
ComposerImagesModel,
PostComposerPageModel,
UnlockedPostPayload,
@@ -121,39 +120,3 @@ export type LeaveConfirmProps = {
model: PostComposerPageModel;
layout: ComposerLayout;
};
-
-export type ComposerLockedProps = {
- standing: BlockedStanding;
- layout: ComposerLayout;
- /** The composer's own title, «پست جدید» or «ویرایش پست», for the mobile bar. */
- title: string;
- /** «بستن»: back to where the composer was opened, or the creator's channel. */
- onClose: () => void;
-};
-
-/** The blocked composer's way forward over «بستن», in a page or a dialog. */
-export type LockedActionsProps = {
- standing: BlockedStanding;
- layout: ComposerLayout;
- onClose: () => void;
-};
-
-export type ComposerLockedDialogProps = {
- standing: BlockedStanding;
- username: string;
-};
-
-/** How the intercepted dialog leaves its route (C4 ۷.۳). */
-export type DialogRoute = {
- /** Until it starts closing. */
- open: boolean;
- /** Closes it, then goes back to the page under it. */
- close: () => void;
- /**
- * Closes it and goes to `href`, read again: back, when `href` is the page under it (`isUnder`),
- * else in place of the dialog's history entry.
- */
- finish: (href: string, options?: { isUnder?: boolean }) => void;
- /** The Modal's `onExited`. */
- onExited: () => void;
-};
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposer.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposer.tsx
index d25a4fa..a139c09 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposer.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposer.tsx
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
import { usePublishAccess } from '../../../../../../../features/post';
import { useCurrentAccount } from '../../../../../../../stores/auth';
import { ROUTES } from '../../../../../../navigation/navigation';
-import { ComposerLocked } from './components/ComposerLocked';
+import { ComposerLocked } from '../../../organisms/composer-locked';
import { ComposerPage } from './components/ComposerPage';
import type { PredictionComposerProps } from './types';
@@ -39,6 +39,7 @@ export function PredictionComposer({ layout }: PredictionComposerProps) {
{
if (window.history.length > 1) router.back();
else router.push(ROUTES.channel(account.username));
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposerDialog.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposerDialog.tsx
index 6cfc7a4..475563a 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposerDialog.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/PredictionComposerDialog.tsx
@@ -6,7 +6,7 @@ import { StatusEmptyState } from '../../../../../../error-boundaries';
import { ROUTES } from '../../../../../../navigation/navigation';
import { ComposerDialog } from './components/ComposerDialog';
import { ComposerDialogPlaceholder } from './components/ComposerDialogPlaceholder';
-import { LockedDialog } from './components/LockedDialog';
+import { ComposerLockedDialog } from '../../../organisms/composer-locked';
import { PredictionComposerDialogSkeleton } from './PredictionComposerDialogSkeleton';
/**
@@ -32,7 +32,10 @@ export function PredictionComposerDialog() {
if (access.status === 'pending') return ;
if (access.status === 'blocked') {
return (
-
+
);
}
return ;
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialog.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialog.tsx
index fdf75e0..fde9520 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialog.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialog.tsx
@@ -3,7 +3,7 @@ import { useQueryClient } from '@tanstack/react-query';
import { isChannelOnScreen } from '../../../../../../../../features/post';
import { usePredictionComposerPage } from '../../../../../../../../features/prediction';
import { ROUTES } from '../../../../../../../navigation/navigation';
-import { useDialogRoute } from '../hooks/use-dialog-route';
+import { useDialogRoute } from '../../../../../../../navigation/hooks/use-dialog-route';
import type { ComposerDialogProps } from '../types';
import { ComposerFrame } from './ComposerFrame';
import { ComposerWorkspace } from './ComposerWorkspace';
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialogPlaceholder.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialogPlaceholder.tsx
index ff37338..b3d9b53 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialogPlaceholder.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerDialogPlaceholder.tsx
@@ -1,6 +1,6 @@
import { FlexBox } from '@lumina/island/atoms/flex-box';
-import { useDialogRoute } from '../hooks/use-dialog-route';
+import { useDialogRoute } from '../../../../../../../navigation/hooks/use-dialog-route';
import type { ComposerDialogPlaceholderProps } from '../types';
import { ComposerFrame } from './ComposerFrame';
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerLocked.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerLocked.tsx
deleted file mode 100644
index 5f98aa5..0000000
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ComposerLocked.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import { FlexBox } from '@lumina/island/atoms/flex-box';
-import { Card } from '@lumina/island/molecules/card';
-import { ResultPanel } from '@lumina/island/molecules/result-panel';
-import { useTranslation } from 'react-i18next';
-
-import { MobileTopBar } from '../../../../../../../navigation/components/mobile-top-bar';
-import { LOCKED_PANEL } from '../constants';
-import type { ComposerLockedProps } from '../types';
-import { LockedActions } from './LockedActions';
-
-/**
- * /compose/prediction opened by a creator who may not publish (J09-1e): pending, rejected or
- * suspended, what «انتشار» would explain, as the page, with the one way forward and «بستن».
- * Mobile: the pushed page's bar over the panel; desktop: a card.
- */
-export function ComposerLocked({
- standing,
- layout,
- onClose,
-}: ComposerLockedProps) {
- const { t } = useTranslation(['common', 'predictions']);
- const { tone, icon } = LOCKED_PANEL[standing];
- const panel = (
-
- }
- />
- );
-
- if (layout === 'mobile') {
- return (
-
-
-
- {panel}
-
-
- );
- }
- return (
-
- {panel}
-
- );
-}
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ConfirmPublish.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ConfirmPublish.tsx
index 80ed816..c465026 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ConfirmPublish.tsx
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/ConfirmPublish.tsx
@@ -7,7 +7,6 @@ import { DetailRow } from '@lumina/island/molecules/detail-row';
import { KeyValue } from '@lumina/island/molecules/key-value';
import { Modal } from '@lumina/island/molecules/modal';
import { Sheet } from '@lumina/island/molecules/sheet';
-import { Element } from '@lumina/island/primitives/element';
import { date, number, price } from '@lumina/tools/format';
import { useTranslation } from 'react-i18next';
@@ -30,9 +29,9 @@ export function ConfirmPublish({ model, layout }: ComposerPartProps) {
-
+
{summary.symbol}
-
+
-
+
{t('composer.confirm.entry-value', {
price: price(summary.entryPrice),
})}
-
+
{t('composer.confirm.entry-note')}
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/LockedActions.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/LockedActions.tsx
deleted file mode 100644
index a0fe078..0000000
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/LockedActions.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import { Button } from '@lumina/island/atoms/button';
-import { FlexBox } from '@lumina/island/atoms/flex-box';
-import { useTranslation } from 'react-i18next';
-
-import { ROUTES } from '../../../../../../../navigation/navigation';
-import { SupportEntry } from '../../../../../../organisms/support-entry';
-import type { LockedActionsProps } from '../types';
-
-/**
- * Why-not's actions (J09-1e, as «انتشار» explains it): the identity review for a pending creator,
- * its form to correct and send again for a rejected one, support for a suspended one; «بستن»
- * under it.
- */
-export function LockedActions({
- standing,
- layout,
- onClose,
-}: LockedActionsProps) {
- const { t } = useTranslation('common');
- const isMobile = layout === 'mobile';
- const size = isMobile ? 'lg' : undefined;
-
- return (
- <>
- {standing === 'suspended' ? (
- // A desktop popover hangs from a positioned parent that also holds its trigger.
-
-
-
- ) : (
-
- )}
-
- >
- );
-}
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/LockedDialog.tsx b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/LockedDialog.tsx
deleted file mode 100644
index 94e8387..0000000
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/components/LockedDialog.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import { Typography } from '@lumina/island/atoms/typography';
-import { Modal } from '@lumina/island/molecules/modal';
-import { useTranslation } from 'react-i18next';
-
-import { ROUTES } from '../../../../../../../navigation/navigation';
-import { useDialogRoute } from '../hooks/use-dialog-route';
-import type { LockedDialogProps } from '../types';
-import { LockedActions } from './LockedActions';
-
-/**
- * The composer dialog's route opened by a creator who may not publish (J09-1e): the 420px question
- * «انتشار» would have asked, over the page. «بستن», Escape and the scrim go back to that page.
- */
-export function LockedDialog({ standing, username }: LockedDialogProps) {
- const { t } = useTranslation('common');
- const route = useDialogRoute(ROUTES.channel(username));
-
- return (
-
- }
- >
-
- {t(`publish.${standing}.reason`)}
-
-
- );
-}
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/constants.ts b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/constants.ts
index 7eda586..1fb25a8 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/constants.ts
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/constants.ts
@@ -1,17 +1,2 @@
-import type { IconName } from '@lumina/island/atoms/icon';
-import type { ResultPanelTone } from '@lumina/island/molecules/result-panel';
-
-import type { BlockedStanding } from '../../../../../../../features/post';
-
/** What the chart picker offers: the image types the API takes. */
export const CHART_ACCEPT = 'image/jpeg,image/png,image/webp';
-
-/** The blocked composer page's panel for each standing: its tone and icon (J09-1e). */
-export const LOCKED_PANEL: Record<
- BlockedStanding,
- { tone: ResultPanelTone; icon: IconName }
-> = {
- pending: { tone: 'info', icon: 'clock' },
- rejected: { tone: 'danger', icon: 'alert' },
- suspended: { tone: 'danger', icon: 'lock' },
-};
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/hooks/use-dialog-route.ts b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/hooks/use-dialog-route.ts
deleted file mode 100644
index 2fe35dd..0000000
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/hooks/use-dialog-route.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { useRouter } from 'next/navigation';
-import { useState } from 'react';
-
-import type { DialogRoute } from '../types';
-
-/**
- * The dialog that intercepts /compose/prediction plays its exit before its route changes. Closed,
- * it goes back to the page under it, or to `fallback` when there is no history to go back to.
- * Finished, it goes to `href` so back never reopens an empty composer, the `@modal` slot empties
- * there, and `href` is read again from the server: back when `href` is the page under it, else in
- * place of its own history entry.
- */
-export function useDialogRoute(fallback: string): DialogRoute {
- const router = useRouter();
- const [exit, setExit] = useState<'back' | 'done' | null>(null);
-
- return {
- open: exit === null,
- close: () => setExit('back'),
- finish: (href, { isUnder = false } = {}) => {
- setExit('done');
- if (isUnder) {
- // Replacing would leave that page in history twice. The refresh waits for the back to
- // land, or it would read /compose/prediction again.
- window.addEventListener('popstate', () => router.refresh(), {
- once: true,
- });
- router.back();
- return;
- }
- router.replace(href);
- // Over the creator's own channel `href` is already rendered under the dialog: the refresh,
- // queued after the replace, renders it again with the new prediction.
- router.refresh();
- },
- onExited: () => {
- if (exit !== 'back') return;
- if (window.history.length > 1) router.back();
- else router.push(fallback);
- },
- };
-}
diff --git a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/types.ts b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/types.ts
index 03d7305..089e3d3 100644
--- a/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/types.ts
+++ b/platforms/market/src/app/screens/(flow)/compose/prediction/organisms/prediction-composer/types.ts
@@ -1,6 +1,5 @@
import type { ReactNode, RefObject } from 'react';
-import type { BlockedStanding } from '../../../../../../../features/post';
import type { PredictionComposerPageModel } from '../../../../../../../features/prediction';
/** mobile: a pushed page with a pinned footer. desktop: the 960px workspace, as page or dialog. */
@@ -64,35 +63,3 @@ export type FieldGroupProps = {
caption?: ReactNode;
children: ReactNode;
};
-
-export type ComposerLockedProps = {
- standing: BlockedStanding;
- layout: ComposerLayout;
- onClose: () => void;
-};
-
-export type LockedDialogProps = {
- standing: BlockedStanding;
- username: string;
-};
-
-export type LockedActionsProps = {
- standing: BlockedStanding;
- layout: ComposerLayout;
- onClose: () => void;
-};
-
-/** How the intercepted dialog leaves its route (0023). */
-export type DialogRoute = {
- /** Until it starts closing. */
- open: boolean;
- /** Closes it, then goes back to the page under it. */
- close: () => void;
- /**
- * Closes it and goes to `href`, read again: back, when `href` is the page under it (`isUnder`),
- * else in place of the dialog's history entry.
- */
- finish: (href: string, options?: { isUnder?: boolean }) => void;
- /** The Modal's `onExited`. */
- onExited: () => void;
-};
diff --git a/platforms/market/src/app/screens/(flow)/dashboard/pricing/organisms/pricing-form/components/DateTimeDialog.tsx b/platforms/market/src/app/screens/(flow)/dashboard/pricing/organisms/pricing-form/components/DateTimeDialog.tsx
index 913ca48..e1d2bbc 100644
--- a/platforms/market/src/app/screens/(flow)/dashboard/pricing/organisms/pricing-form/components/DateTimeDialog.tsx
+++ b/platforms/market/src/app/screens/(flow)/dashboard/pricing/organisms/pricing-form/components/DateTimeDialog.tsx
@@ -59,8 +59,8 @@ function clampParts(
/**
* The Shamsi date and time picker (C7 ۴.۳, 0035): day, month, year, hour and minute, each a native
* select (a wheel on phones), and for an end «بدون تاریخ پایان», so ending is one decision in one
- * place. Nothing before now can be picked, nor an end before its start: those options are left
- * out, and «تأیید» raises the pick to the earliest allowed. A bottom sheet on mobile, a centred
+ * place. Nothing before now can be picked, nor an end before its start: those options show
+ * disabled, and «تأیید» raises the pick to the earliest allowed. A bottom sheet on mobile, a centred
* modal on desktop (۸.۱).
*/
export function DateTimeDialog({
@@ -154,14 +154,9 @@ function PickerBody({
const onMinMonth = onMinYear && parts.month === min.month;
const onMinDay = onMinMonth && parts.day === min.day;
const onMinHour = onMinDay && parts.hour === min.hour;
- const months = MONTHS.filter((month) => !onMinYear || month >= min.month);
const days = Array.from(
{ length: jalaliMonthLength(parts.year, parts.month) },
(_, index) => index + 1,
- ).filter((day) => !onMinMonth || day >= min.day);
- const hours = HOURS.filter((hour) => !onMinDay || hour >= min.hour);
- const minutes = MINUTES.filter(
- (minute) => !onMinHour || minute >= min.minute,
);
const set = (key: keyof JalaliDateTime, next: number) =>
@@ -178,6 +173,7 @@ function PickerBody({
options={days.map((day) => ({
value: String(day),
label: number(day),
+ disabled: onMinMonth && day < min.day,
}))}
/>