From 0957ef476b7a78b9852841b5b12ac9b34ab3685d Mon Sep 17 00:00:00 2001 From: AliReza Date: Tue, 29 Sep 2026 21:18:49 +0330 Subject: [PATCH] lighter first load, math reads left-to-right in quizzes, tickets from the server, readable separators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Every screen but home is its own chunk and preloads when the browser is idle; React and motion get their own long-cached chunks. The app entry goes from 505 kB (160 kB gzip) to 85 kB (27 kB gzip). - Quiz prompts, options and lesson examples go through MathText, so '10 + 3 - 7 - 2' reads from the left; an unpaired bracket at the edge of a math run stays with the Persian sentence. - Support lists tickets from GET /support/tickets instead of this browser's localStorage; a ticket's messages load when it is opened. - '·' next to a Persian zero read as another digit ('فصلِ ۱ · ۰' looked like ۱۰۰); a thin bar separates them now. Notification bodies show Persian digits. - A root or vertex the model already marked with coordinates is no longer labelled a second time on top of it. Co-Authored-By: Claude Opus 5.5 --- src/api/index.ts | 2 + src/api/types.ts | 10 +++++ src/app/MainApp.tsx | 58 ++++++++++++++++++++--------- src/components/ui.tsx | 8 ++++ src/diagram/plane.tsx | 8 +++- src/lib/MathText.tsx | 30 +++++++++++++-- src/lib/storage.ts | 1 - src/screens/CharactersScreen.tsx | 4 +- src/screens/HomeScreen.tsx | 4 +- src/screens/LessonScreen.tsx | 9 +++-- src/screens/MapScreen.tsx | 4 +- src/screens/NotificationsScreen.tsx | 4 +- src/screens/QuizScreen.tsx | 5 ++- src/screens/SupportScreen.tsx | 57 ++++++++++++---------------- vite.config.ts | 12 ++++++ 15 files changed, 146 insertions(+), 70 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 1f83a3a..790701a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -172,6 +172,8 @@ export const api = { support: { createTicket: (subject: string, category: string) => http.create<{ ticketId: string; status: string }>('/support/tickets', { subject, category }), + /** تیکت‌های همین کاربر، تازه‌ترین اول (۲۰ تای آخر). */ + tickets: () => http.get<{ tickets: T.TicketSummary[] }>('/support/tickets').then((r) => r.tickets), ticket: (ticketId: string) => http.get(`/support/tickets/${ticketId}`), reply: (ticketId: string, text: string) => http.create<{ messageId: string; success: boolean }>(`/support/tickets/${ticketId}/messages`, { text }), diff --git a/src/api/types.ts b/src/api/types.ts index beabb30..0f77b83 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -271,6 +271,16 @@ export interface OrderStatus { amount: number; } +/** یک ردیف از فهرستِ تیکت‌های کاربر (GET /support/tickets). */ +export interface TicketSummary { + ticketId: string; + subject: string; + category: string; + status: string; + createdAt: string; + supportReplies: number; +} + export interface Ticket { ticketId: string; subject: string; diff --git a/src/app/MainApp.tsx b/src/app/MainApp.tsx index da25127..fa92347 100644 --- a/src/app/MainApp.tsx +++ b/src/app/MainApp.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { lazy, Suspense, useEffect, useState, type ComponentType } from 'react'; import { AnimatePresence, motion } from 'motion/react'; import { CheckCircle2, XCircle } from 'lucide-react'; import { api, type Grade, type UserProfile } from '@/api'; @@ -8,25 +8,46 @@ import { isTab, type Route } from '@/nav/routes'; import { BottomNav } from '@/components/BottomNav'; import { Sheet } from '@/components/Sheet'; import { useToast } from '@/components/Toast'; -import { PrimaryButton } from '@/components/ui'; -import { AskScreen } from '@/screens/AskScreen'; -import { CharactersScreen } from '@/screens/CharactersScreen'; -import { FamilyScreen } from '@/screens/FamilyScreen'; +import { LoadingState, PrimaryButton } from '@/components/ui'; import { HomeScreen } from '@/screens/HomeScreen'; -import { InviteScreen } from '@/screens/InviteScreen'; -import { LeaderboardScreen } from '@/screens/LeaderboardScreen'; -import { LessonScreen } from '@/screens/LessonScreen'; import { LoginScreen } from '@/screens/LoginScreen'; -import { MapScreen } from '@/screens/MapScreen'; -import { NotificationsScreen } from '@/screens/NotificationsScreen'; -import { ProfileScreen } from '@/screens/ProfileScreen'; -import { QuizScreen } from '@/screens/QuizScreen'; -import { StreakScreen } from '@/screens/StreakScreen'; -import { SubscriptionScreen } from '@/screens/SubscriptionScreen'; -import { SupportScreen } from '@/screens/SupportScreen'; -import { UnitScreen } from '@/screens/UnitScreen'; import type { PaymentReturn } from './launchParams'; +/** + * خانه همراهِ خودِ اپ بار می‌شود؛ بقیه‌ی صفحه‌ها هر کدام فایلِ جدا دارند تا بارِ اول + * سبک باشد (قبلاً کلِ اپ یک فایلِ ۵۰۵ کیلوبایتی بود، و دستیار با ماژولِ شکل‌ها + * بزرگ‌ترین تکه‌اش). بعد از بالا آمدنِ خانه همه در پس‌زمینه گرفته می‌شوند + * (preloadScreens)، پس رفتن به صفحه‌ی بعدی منتظرِ شبکه نمی‌ماند. + */ +const loaders: (() => Promise)[] = []; +function screen>, K extends keyof M>(load: () => Promise, name: K) { + loaders.push(load); + return lazy(async () => ({ default: (await load())[name] })); +} +const AskScreen = screen(() => import('@/screens/AskScreen'), 'AskScreen'); +const CharactersScreen = screen(() => import('@/screens/CharactersScreen'), 'CharactersScreen'); +const FamilyScreen = screen(() => import('@/screens/FamilyScreen'), 'FamilyScreen'); +const InviteScreen = screen(() => import('@/screens/InviteScreen'), 'InviteScreen'); +const LeaderboardScreen = screen(() => import('@/screens/LeaderboardScreen'), 'LeaderboardScreen'); +const LessonScreen = screen(() => import('@/screens/LessonScreen'), 'LessonScreen'); +const MapScreen = screen(() => import('@/screens/MapScreen'), 'MapScreen'); +const NotificationsScreen = screen(() => import('@/screens/NotificationsScreen'), 'NotificationsScreen'); +const ProfileScreen = screen(() => import('@/screens/ProfileScreen'), 'ProfileScreen'); +const QuizScreen = screen(() => import('@/screens/QuizScreen'), 'QuizScreen'); +const StreakScreen = screen(() => import('@/screens/StreakScreen'), 'StreakScreen'); +const SubscriptionScreen = screen(() => import('@/screens/SubscriptionScreen'), 'SubscriptionScreen'); +const SupportScreen = screen(() => import('@/screens/SupportScreen'), 'SupportScreen'); +const UnitScreen = screen(() => import('@/screens/UnitScreen'), 'UnitScreen'); + +let preloaded = false; +function preloadScreens() { + if (preloaded) return; + preloaded = true; + const run = () => loaders.forEach((load) => void load().catch(() => {})); + if ('requestIdleCallback' in window) window.requestIdleCallback(run, { timeout: 2500 }); + else setTimeout(run, 1200); +} + interface Props { profile: UserProfile; grades: Grade[]; @@ -39,6 +60,7 @@ interface Props { /** اپِ اصلی بعد از ورود: تب‌ها، صفحه‌ها و داده‌ی مشترک. */ export function MainApp({ profile, grades, payment, start, onSignedOut, onRegistered }: Props) { + useEffect(preloadScreens, []); return ( @@ -66,7 +88,9 @@ function Screens({ onSignedOut, onRegistered }: Pick - + }> + + diff --git a/src/components/ui.tsx b/src/components/ui.tsx index 138f0cc..eabab70 100644 --- a/src/components/ui.tsx +++ b/src/components/ui.tsx @@ -154,6 +154,14 @@ export function EmptyState({ text, char = 'pi' as SeyarChar }: { text: string; c return ; } +/** + * جداکننده‌ی میانِ دو تکه‌ی متن. «·» کنارِ صفرِ فارسی (که خودش یک نقطه است) + * خوانده نمی‌شد: «فصلِ ۱ · ۰ از ۴» شبیهِ «۱۰۰» دیده می‌شد. + */ +export function Sep() { + return ; +} + export function InlineError({ children }: { children: ReactNode }) { return (
diff --git a/src/diagram/plane.tsx b/src/diagram/plane.tsx index 981802e..cd5ee98 100644 --- a/src/diagram/plane.tsx +++ b/src/diagram/plane.tsx @@ -637,8 +637,12 @@ export function Plane({ spec: raw }: { spec: PlaneSpec }) { // بیش از چهار نقطه از یک نوع (ریشه‌های سینوس) فقط نقطه می‌گیرند، نه برچسب؛ وگرنه روی هم می‌افتند. const kindCount = new Map(); markPts.forEach((m) => kindCount.set(m.kind === 'max' || m.kind === 'min' ? 'ext' : m.kind, (kindCount.get(m.kind === 'max' || m.kind === 'min' ? 'ext' : m.kind) ?? 0) + 1)); - // اگر مدل خودش روی همان ریشه یا رأس نقطه‌ی نام‌دار گذاشته، برچسبِ ما تکرار نشود - const namedXY = [...named.values()]; + // اگر مدل خودش روی همان ریشه یا رأس نقطه گذاشته (نام‌دار یا با مختصات)، برچسبِ ما + // تکرار نشود؛ وگرنه «(۳، ۰)» دو بار و روی هم نوشته می‌شد. + const namedXY = [ + ...named.values(), + ...spec.items.flatMap((it) => (it.type === 'point' && typeof it.point !== 'string' ? [it.point as XY] : [])), + ]; for (const m of markPts) { if (namedXY.some((q) => Math.abs(q[0] - m.xy[0]) < 1e-3 && Math.abs(q[1] - m.xy[1]) < 1e-3)) continue; const [px, py] = P(m.xy); diff --git a/src/lib/MathText.tsx b/src/lib/MathText.tsx index 32a11d5..34b7eaf 100644 --- a/src/lib/MathText.tsx +++ b/src/lib/MathText.tsx @@ -32,12 +32,36 @@ export function MathText({ text }: { text: string }) { run = run.slice(lead.length); const tail = EDGE_END.exec(run)?.[0] ?? ''; run = run.slice(0, run.length - tail.length); - // «(۱، −۴)» باید کامل قفل شود، ولی پرانتزِ بازِ بی‌جفت در سرِ تکه مالِ جمله است. + // «(۱، −۴)» باید کامل قفل شود، ولی پرانتزِ بی‌جفت در لبه‌ی تکه مالِ جمله است: + // در «۱۰ − ۲ (با محاسبه…)» پرانتزِ باز جزوِ جمله‌ی فارسیِ بعدی است و اگر قفل شود + // به سمتِ غلط می‌رود. + const edge = trimUnpaired(run); + const head = lead + edge.head; + run = edge.run; if (!run || !/[0-9۰-۹]/.test(run)) continue; - out.push(text.slice(last, start + lead.length)); + out.push(text.slice(last, start + head.length)); out.push({run}); - last = start + lead.length + run.length; + last = start + head.length + run.length; } out.push(text.slice(last)); return <>{out.map((n, j) => (typeof n === 'string' ? {n} : n))}; } + +const count = (s: string, ch: string) => s.split(ch).length - 1; + +/** + * پرانتزِ بازِ بی‌جفت در تهِ تکه و بسته‌ی بی‌جفت در سرش را (با فاصله‌ی کنارش) کنار + * می‌گذارد؛ `head` یعنی چه مقدار از سرِ تکه به جمله‌ی فارسی برگشت. + */ +function trimUnpaired(run: string): { head: string; run: string } { + let head = ''; + while (/[(\[]\s*$/.test(run) && count(run, '(') + count(run, '[') > count(run, ')') + count(run, ']')) { + run = run.slice(0, run.length - /\s*[(\[]\s*$/.exec(run)![0].length); + } + while (/^\s*[)\]]/.test(run) && count(run, ')') + count(run, ']') > count(run, '(') + count(run, '[')) { + const m = /^\s*[)\]]\s*/.exec(run)![0]; + head += m; + run = run.slice(m.length); + } + return { head, run }; +} diff --git a/src/lib/storage.ts b/src/lib/storage.ts index f2a913a..33f799b 100644 --- a/src/lib/storage.ts +++ b/src/lib/storage.ts @@ -27,7 +27,6 @@ export const KEYS = { deviceId: 'deviceId', onboarded: 'tadrisino.onboarded', conversationId: 'tadrisino.conversationId', - ticketIds: 'tadrisino.ticketIds', sound: 'tadrisino.sound', referralCode: 'tadrisino.referralCode', } as const; diff --git a/src/screens/CharactersScreen.tsx b/src/screens/CharactersScreen.tsx index 21db51a..e7ee113 100644 --- a/src/screens/CharactersScreen.tsx +++ b/src/screens/CharactersScreen.tsx @@ -6,7 +6,7 @@ import { useAsync } from '@/lib/useAsync'; import { SeyarMascot } from '@/mascots/SeyarMascot'; import { SEYAR_INFO, seyarFromSlug } from '@/mascots/seyar'; import { useToast } from '@/components/Toast'; -import { EmptyState, ErrorState, LoadingState, Screen, ScreenHeader } from '@/components/ui'; +import { EmptyState, ErrorState, LoadingState, Screen, ScreenHeader, Sep } from '@/components/ui'; import { friendlyError } from '@/lib/errors'; import { toFa } from '@/lib/format'; @@ -39,7 +39,7 @@ export function CharactersScreen() { امتیازِ تو: {toFa(summary?.xp ?? 0)}با امتیازِ بیشتر همراه‌های بیشتری باز می‌شن} color="#9B7BFF" back /> diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index e13d3a3..3976681 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -7,7 +7,7 @@ import { useNav } from '@/nav/Navigator'; import { SeyarMascot } from '@/mascots/SeyarMascot'; import { IslandPath } from '@/components/IslandPath'; import { IslandSheet } from '@/components/IslandSheet'; -import { EmptyState, ErrorState, LoadingState, Screen } from '@/components/ui'; +import { EmptyState, ErrorState, LoadingState, Screen, Sep } from '@/components/ui'; import { shade } from '@/lib/color'; import { toFa } from '@/lib/format'; @@ -109,7 +109,7 @@ export function HomeScreen() { >
- فصلِ {toFa(i + 1)} · {toFa(p.done)} از {toFa(p.total)} جزیره + فصلِ {toFa(i + 1)}{toFa(p.done)} از {toFa(p.total)} جزیره {isCurrentUnit && الان اینجایی}
{unit.title.replace(/^فصل\s*\S+\s*[::]\s*/, '')}
diff --git a/src/screens/LessonScreen.tsx b/src/screens/LessonScreen.tsx index 588fb4a..a8aa8af 100644 --- a/src/screens/LessonScreen.tsx +++ b/src/screens/LessonScreen.tsx @@ -6,8 +6,9 @@ import { useNav } from '@/nav/Navigator'; import { useAsync } from '@/lib/useAsync'; import { SeyarMascot } from '@/mascots/SeyarMascot'; import { moodFromServer } from '@/mascots/seyar'; -import { ErrorState, LoadingState, PrimaryButton, Screen, ScreenBody, ScreenHeader } from '@/components/ui'; +import { ErrorState, LoadingState, PrimaryButton, Screen, ScreenBody, ScreenHeader, Sep } from '@/components/ui'; import { toFa } from '@/lib/format'; +import { MathText } from '@/lib/MathText'; /** معرفیِ درس، پیش از تمرین. */ export function LessonScreen({ lessonId, nodeId }: { lessonId: number; nodeId?: string }) { @@ -29,7 +30,7 @@ export function LessonScreen({ lessonId, nodeId }: { lessonId: number; nodeId?: ref && ( {/* ترتیبِ lessonIds «درسِ بعدی اول» است، نه ترتیبِ کتاب؛ پس شماره‌ی درس از آن درنمی‌آید. */} - {ref.node.title} · {toFa(ref.node.lessonIds.length)} درس + {ref.node.title}{toFa(ref.node.lessonIds.length)} درس ) } @@ -56,7 +57,7 @@ export function LessonScreen({ lessonId, nodeId }: { lessonId: number; nodeId?: {data.example && (

مثال

-

{data.example}

+

)} @@ -69,7 +70,7 @@ export function LessonScreen({ lessonId, nodeId }: { lessonId: number; nodeId?: {toFa(i + 1)} - {step} + ))} diff --git a/src/screens/MapScreen.tsx b/src/screens/MapScreen.tsx index 8dbb77e..195558e 100644 --- a/src/screens/MapScreen.tsx +++ b/src/screens/MapScreen.tsx @@ -4,7 +4,7 @@ import { useAppData } from '@/state/AppData'; import { unitColor, unitProgress } from '@/state/curriculum'; import { useNav } from '@/nav/Navigator'; import { SeyarMascot } from '@/mascots/SeyarMascot'; -import { EmptyState, ErrorState, LoadingState, ProgressBar, Screen, ScreenHeader } from '@/components/ui'; +import { EmptyState, ErrorState, LoadingState, ProgressBar, Screen, ScreenHeader, Sep } from '@/components/ui'; import { ZigzagPath, zigzagPositions } from '@/components/ZigzagPath'; import { iconFor } from '@/components/NodeIcon'; import { toFa } from '@/lib/format'; @@ -22,7 +22,7 @@ export function MapScreen() { {gradeTitle && <>{gradeTitle}}{toFa(overall)}٪ از کلِ مسیر} color="#91ADC6" mascot={{ char: 'sigma', mood: overall > 0 ? 'happy' : 'idle' }} > diff --git a/src/screens/NotificationsScreen.tsx b/src/screens/NotificationsScreen.tsx index 0e532c0..198f793 100644 --- a/src/screens/NotificationsScreen.tsx +++ b/src/screens/NotificationsScreen.tsx @@ -4,7 +4,7 @@ import { useAppData } from '@/state/AppData'; import { useAsync } from '@/lib/useAsync'; import { useToast } from '@/components/Toast'; import { EmptyState, ErrorState, LoadingState, Screen, ScreenHeader } from '@/components/ui'; -import { relativeTime } from '@/lib/format'; +import { relativeTime, toFa } from '@/lib/format'; const STYLE: Record = { xp_earned: { icon: Star, color: '#E8A400', bg: '#FFF8E1' }, @@ -83,7 +83,7 @@ export function NotificationsScreen() { {n.title} - {n.body && {n.body}} + {n.body && {toFa(n.body)}} {relativeTime(n.createdAt)} {!n.isRead && } diff --git a/src/screens/QuizScreen.tsx b/src/screens/QuizScreen.tsx index 19f48f5..12ab4b8 100644 --- a/src/screens/QuizScreen.tsx +++ b/src/screens/QuizScreen.tsx @@ -14,6 +14,7 @@ import { useToast } from '@/components/Toast'; import { ErrorState, InlineError, LoadingState, PrimaryButton, SecondaryButton, Screen } from '@/components/ui'; import { friendlyError } from '@/lib/errors'; import { timeUntil, toFa } from '@/lib/format'; +import { MathText } from '@/lib/MathText'; import { sounds } from '@/lib/sound'; type Phase = @@ -272,7 +273,7 @@ export function QuizScreen({ lessonId, nodeId }: { lessonId?: number; nodeId?: s گزارشِ ایراد
-

{question.prompt}

+

@@ -285,7 +286,7 @@ export function QuizScreen({ lessonId, nodeId }: { lessonId?: number; nodeId?: s whileTap={{ scale: selected === null ? 0.95 : 1 }} className={`flex min-h-14 items-center justify-center gap-1.5 rounded-2xl border-2 border-b-4 px-3 py-3 font-black transition-colors ${shortOptions ? 'text-xl' : 'text-base'} ${optionClass(option.id)}`} > - {option.value} + {answer && option.id === answer.correctOptionId && } {answer && option.id === selected && !answer.correct && } diff --git a/src/screens/SupportScreen.tsx b/src/screens/SupportScreen.tsx index 62a9bd4..b1c0af2 100644 --- a/src/screens/SupportScreen.tsx +++ b/src/screens/SupportScreen.tsx @@ -1,10 +1,9 @@ import { useState } from 'react'; import { Bug, MessageCircle, Send } from 'lucide-react'; -import { api, type Ticket } from '@/api'; +import { api, type TicketSummary } from '@/api'; import { useAsync } from '@/lib/useAsync'; -import { KEYS, store } from '@/lib/storage'; import { useToast } from '@/components/Toast'; -import { InlineError, PrimaryButton, Screen, ScreenBody, ScreenHeader } from '@/components/ui'; +import { InlineError, PrimaryButton, Screen, ScreenBody, ScreenHeader, Sep } from '@/components/ui'; import { friendlyError } from '@/lib/errors'; import { toFa } from '@/lib/format'; @@ -22,15 +21,6 @@ const STATUS_LABEL: Record = { closed: 'بسته', }; -/** سرور فهرستِ تیکت‌ها را نمی‌دهد؛ شناسه‌ها را همین‌جا نگه می‌داریم. */ -function savedTicketIds(): string[] { - try { - return JSON.parse(store.get(KEYS.ticketIds) ?? '[]') as string[]; - } catch { - return []; - } -} - export function SupportScreen() { const toast = useToast(); const [mode, setMode] = useState<'ticket' | 'bug'>('ticket'); @@ -39,7 +29,8 @@ export function SupportScreen() { const [text, setText] = useState(''); const [sending, setSending] = useState(false); const [error, setError] = useState(''); - const [ticketIds, setTicketIds] = useState(savedTicketIds); + // فهرست از سرور می‌آید، پس تیکت و پاسخش با عوض شدنِ گوشی هم دیده می‌شود. + const tickets = useAsync(() => api.support.tickets(), []); async function submit() { if (!subject.trim() || !text.trim()) return; @@ -52,9 +43,7 @@ export function SupportScreen() { } else { const t = await api.support.createTicket(subject.trim(), category); await api.support.reply(t.ticketId, text.trim()); - const ids = [t.ticketId, ...ticketIds].slice(0, 20); - store.set(KEYS.ticketIds, JSON.stringify(ids)); - setTicketIds(ids); + tickets.reload(); toast('پیامت رسید؛ جواب همین‌جا و در اعلان‌ها میاد.', 'success'); } setSubject(''); @@ -116,11 +105,11 @@ export function SupportScreen() { ارسال - {ticketIds.length > 0 && ( + {!!tickets.data?.length && (

پیام‌های قبلیِ تو

- {ticketIds.map((id) => )} + {tickets.data.map((t) => )}
)} @@ -129,26 +118,24 @@ export function SupportScreen() { ); } -function TicketCard({ ticketId }: { ticketId: string }) { +function TicketCard({ summary }: { summary: TicketSummary }) { const toast = useToast(); - const ticket = useAsync(() => api.support.ticket(ticketId), [ticketId]); const [open, setOpen] = useState(false); + // پیام‌ها فقط وقتی کارت باز شود گرفته می‌شوند؛ فهرست خودش خلاصه را دارد. + const detail = useAsync(() => (open ? api.support.ticket(summary.ticketId) : Promise.resolve(null)), [open, summary.ticketId]); const [reply, setReply] = useState(''); const [sending, setSending] = useState(false); - - if (ticket.error || !ticket.data) { - return ticket.loading ?
: null; - } - const t: Ticket = ticket.data; - const staffReplies = t.messages.filter((m) => m.sender !== 'user').length; + const t = detail.data; + const status = t?.status ?? summary.status; + const staffReplies = t ? t.messages.filter((m) => m.sender !== 'user').length : summary.supportReplies; async function send() { if (!reply.trim()) return; setSending(true); try { - await api.support.reply(ticketId, reply.trim()); + await api.support.reply(summary.ticketId, reply.trim()); setReply(''); - ticket.reload(); + detail.reload(); } catch (err) { toast(friendlyError(err), 'error'); } finally { @@ -160,16 +147,20 @@ function TicketCard({ ticketId }: { ticketId: string }) {
{open && (
- {t.messages.map((m) => ( + {!t && (detail.error + ? {friendlyError(detail.error)} + :
)} + {t?.messages.map((m) => (
))} - {t.status !== 'closed' && ( + {t && status !== 'closed' && (
{ resolve: { alias: { '@': path.resolve(__dirname, './src') }, }, + build: { + rollupOptions: { + output: { + // کتابخانه‌ها با هر انتشار عوض نمی‌شوند؛ فایلِ جدا یعنی بعد از هر دیپلوی + // از کشِ مرورگر می‌آیند و فقط کدِ خودِ اپ دوباره دانلود می‌شود. + manualChunks: { + react: ['react', 'react-dom'], + motion: ['motion/react'], + }, + }, + }, + }, server: { // در توسعه /api هم‌دامنه است و به بک‌اند پاس داده می‌شود؛ CORS لازم نیست. proxy: {