diff --git a/db/migrations/008_faculty_profile_course_links.sql b/db/migrations/008_faculty_profile_course_links.sql new file mode 100644 index 0000000..ad5e5b8 --- /dev/null +++ b/db/migrations/008_faculty_profile_course_links.sql @@ -0,0 +1,13 @@ +-- Faculty profile URL (external MST page) + course↔faculty references + +ALTER TABLE faculty_members + ADD COLUMN IF NOT EXISTS profile_url TEXT; + +CREATE TABLE IF NOT EXISTS course_faculty_links ( + course_id TEXT NOT NULL REFERENCES courses(id) ON DELETE CASCADE, + faculty_id TEXT NOT NULL REFERENCES faculty_members(id) ON DELETE CASCADE, + PRIMARY KEY (course_id, faculty_id) +); + +CREATE INDEX IF NOT EXISTS idx_course_faculty_links_faculty + ON course_faculty_links (faculty_id); diff --git a/docs/03-database.md b/docs/03-database.md index 469a405..906ed68 100644 --- a/docs/03-database.md +++ b/docs/03-database.md @@ -40,8 +40,12 @@ postgresql://:@insaight-postgres:5432/ManagmentWebSite_Db ```env # local (.env.local) DATABASE_URL=postgresql://:@:5432/ManagmentWebSite_Db +# optional — default 20000; raise if remote host is slow to accept TCP +# DATABASE_CONNECTION_TIMEOUT_MS=20000 ``` +Pool در `src/lib/db.ts` با `connectionTimeoutMillis` پیش‌فرض **۲۰ ثانیه** و TCP keepalive ساخته می‌شود (هاست ریموت گاهی بیشتر از ۵ثانیه طول می‌کشد). پس از timeout، pool ریست می‌شود تا درخواست بعدی دوباره تلاش کند. + فایل محلی: `.env.local` (در gitignore است). Production باید مستقیم به نام کانتینر `insaight-postgres` وصل شود (نه IP عمومی از داخل bridge). diff --git a/docs/Todo.Md b/docs/Todo.Md index 703df20..3b34b0f 100644 --- a/docs/Todo.Md +++ b/docs/Todo.Md @@ -1,21 +1,38 @@ -1- در بار بالا، فاصله بین دکمه ها بیشتر شود تا تناسب برقرار باشد بین فاصله های اکشن های چپ و راست -2- دکمه تماس باما کنار دکمه سرچ باشد -3- فونت بشود وزیر متن -4- دکمه دانشگداه از بالا جذف شود و به دسترسی سریع برود اما به دانشکد (لینک استاتید بدون آدرس صفحه) -5- درباره ما در بعد از دوره ها باشد -6- برنامه ها فعلا هاید شود (لینکش هم در دسترس نباشد) -7- لوگو دانشکده باید گذاشته شود (بهت میدمش) اگر میتونی لوگو های اینچا https://mst.aut.ac.ir را دانلود کن) -8- چرا دانشگاه .... باید بردش حذف شود -9- عدد بالا در چرا دانشگاه (اون یک دو سه) برداشته شود -10- دانشگاه صنعتی امیرکبیر باشد در این قسمت نه امیرکبیر خالی و البته همه جا -11- پلت رنگی عووض میشه و باید بگیریمش (اگر میتونی اینو ببین https://mst.aut.ac.ir و ازش پلت رنگی بساز) -12- قبل از "رویکرد آموزشی ما" باید یک سرچ بیاید که مانند صفحه دوره ها باشد و همان عمل را صدا کن -13 کلمه "رویکرد آموزشی ما" و کلا متونی مانند این برای معرفی هر سکشن باید بزرگ تر باشد -14- تمام سکشن ها باید عرض یکسان داشته باشند و هیچکدام تمام صفحه نشوند -15- رویداد ها فعلا هاید شود -16- دسترسی سریع باید سایت دانشکده و شبکه اساتید را داشته باشد -17- ماهم باید اساتید را از دانشکده کپی کنیم (خودت بخون) و صرفا رفرنسشان را داشته باشیم تا در دوره ها اگر نیاز شد بهشون لینک بدیم (به صفحشون تو دانشکده) -18- در صفحه دوره ها باید دسته بندی ها بزرک تر باشه، تگ ها از اون یکی یکم کوچک تر -19- سرچ بار هامون باید آیکون باشه و با زدن آیکون سرچ بار باز بشه. یعنی همه جا سرچ آیکون با دسته بندی ها باشه و با انیمشن سرچ اینچپوپ جایگزین دسته بندی بشه (به جز هدر که دسته بندی نمی خواد) -20 -روی کارت دوره ها همش قابل کلیک باشد ننه صرفا دکمه جزییات -21- لیبل روی کارت دوره ها هم کلیلک پذیر باشد تا فیلتر دسته بندی و تگ را هم انجام دهد برای کاربر. در جزییات دوره هم همین باشد +# تغییرات UI سایت (چک‌لیست) + +وضعیت: `[ ]` باز · `[x]` انجام‌شده · `[blocked]` منتظر ورودی کاربر + +## هدر و ناوبری +- [x] 1. فاصله بین دکمه‌های هدر بیشتر شود (تعادل اکشن‌های چپ/راست) +- [x] 2. دکمه «تماس با ما» کنار دکمه سرچ +- [x] 4. دکمه دانشگاه از هدر حذف → دسترسی سریع با برچسب «دانشکده» (`https://mst.aut.ac.ir/`) +- [x] 5. «درباره ما» بعد از «دوره‌ها» +- [x] 6. «برنامه‌ها» فعلاً مخفی (بدون لینک در UI) +- [x] 15. «رویدادها» فعلاً مخفی از هوم/ناو + +## فوتر +- [x] 16. دسترسی سریع: سایت دانشکده + شبکه اساتید + +## هویت بصری +- [x] 3. فونت وزیرمتن (Vazirmatn) +- [x] 7. لوگوی دانشکده (نشان بدون متن کناری؛ favicon از MstAut) +- [x] 10. همه جا «دانشگاه صنعتی امیرکبیر» (نه «امیرکبیر» کوتاه) +- [blocked] 11. پالت رنگی جدید از mst (کاربر می‌دهد) + +## صفحه اصلی +- [x] 8. حذف برد/کارت سکشن «چرا دانشگاه» +- [x] 9. حذف شماره‌های ۱–۲–۳ در «چرا دانشگاه» +- [x] 12. در هوم فقط ۶ دورهٔ آخر (بدون فیلتر/سرچ شلوغ؛ لینک به کاتالوگ) +- [x] 13. متن معرفی سکشن‌ها بزرگ‌تر +- [x] 14. عرض یکسان سکشن‌ها داخل Container (بدون full-bleed) + +## اساتید +- [x] 17a. فیلد لینک پروفایل دانشکده + اسکیما/ادمین +- [x] 17b. ارتباط اختیاری دوره↔استاد +- [x] 17c. کپی/seed اساتید از شبکه دانشکده + دکمه بروزرسانی ادمین از لینک هدر + +## صفحه دوره‌ها +- [x] 18. دسته‌ها بزرگ‌تر؛ تگ‌ها کمی کوچک‌تر +- [x] 19. سرچ آیکونی؛ با انیمیشن جایگزین دسته/تگ (هدر بدون دسته) +- [x] 20. کل کارت دوره قابل کلیک +- [x] 21. لیبل دسته/تگ روی کارت و جزئیات دوره کلیک‌پذیر (فیلتر) diff --git a/docs/design-system-rules.md b/docs/design-system-rules.md index 65ab292..08c2370 100644 --- a/docs/design-system-rules.md +++ b/docs/design-system-rules.md @@ -44,6 +44,21 @@ | تب | `Tabs` | | اسکلتون | `Skeleton` | | نشان | `Badge` | +| هیروی صفحه | `PageHero` (`size="lg"` + `actions` برای لندینگ) | +| سرتیتر بخش | `SectionHeader` (eyebrow + title + description؛ `inverse` روی بخش تیره/قرمز) | +| زمینه بخش | `Section tone="default \| subtle \| muted \| dark \| accent"` — بدون override برای `py-*` | +| جزئیات برچسب/مقدار | `DetailList` | +| فهرست نکات | `CheckList` | +| آمار | `StatGrid` | +| فرم عمومی | `FormCard` + `ContactInterestForm` | +| دکمه روی زمینه تیره | `buttonVariants({ variant: "inverse" })` یا `DotCta onDark` | +| خطا / ۴۰۴ | `ErrorState` / `(main)/not-found.tsx` | + +**قوانین تکمیلی:** +- اندازه تیترها فقط از `Heading` (level 1–4)؛ کلاس `text-*` روی تیتر override نشود. +- `Card` روی hover بلند نمی‌شود؛ فقط کارت‌های لینک‌دار با `SurfaceCard interactive`. +- پنل کناری صفحات جزئیات: `SurfaceCard padded` + `DetailList` + دکمه `size="lg" w-full`. +- رنگ خطا فقط `text-destructive`. --- diff --git a/docs/state/active-context.md b/docs/state/active-context.md index c1adfb4..579d39f 100644 --- a/docs/state/active-context.md +++ b/docs/state/active-context.md @@ -1,17 +1,17 @@ # Active Context ## Current Goal -تاکسونومی دوره (دسته + تگ ادمین‌محور) پیاده شد (D25). لیبل ریشهٔ منو همچنان `courseNavParentTag` = «دوره‌ها». +چک‌لیست UI در `docs/Todo.Md` پیاده شد؛ سه آیتم blocked منتظر کاربر. ## Current Work -- جداول `course_categories` / `course_tags` + junction؛ migration `007_course_taxonomy.sql` -- ادمین: `/admin/course-categories`، `/admin/course-tags`؛ فرم دوره چندانتخابی -- عمومی: منو از تگ‌های `show_in_nav`؛ فیلتر `/professional?tag=` و `?category=` با slug -- مستند: `docs/LINKS.md`، domain-rules، D25 +- انجام‌شده: هدر/ناو/فوتر، فونت Vazirmatn، هوم، سرچ/کارت دوره‌ها، اسکیما اساتید (`profile_url` + `course_faculty_links`) +- لوگو دانشکده اعمال شد (`/brand/mst-faculty.png` + favicon) +- Blocked: پالت رنگی mst (۱۱)، seed اساتید پس از دسترسی (۱۷c) ## Current Blockers -بدون مانع. +- پالت رنگی از کاربر +- دسترسی به شبکه اساتید mst برای کپی داده ## Next Steps -1. `node db/migrate.mjs` سپس در صورت نیاز `node db/seed.mjs` روی محیط‌های موجود -2. محتوای واقعی دسته/تگ/دوره از پنل ادمین +1. دریافت پالت و به‌روزرسانی توکن‌های `globals.css` +2. پس از دسترسی mst: seed اساتید با `profileUrl` diff --git a/docs/state/progress.md b/docs/state/progress.md index ac5305f..905a20c 100644 --- a/docs/state/progress.md +++ b/docs/state/progress.md @@ -42,7 +42,10 @@ ## Next - [x] فاز H باقی‌مانده — ایندکس‌ها، docs/README نهایی، حذف وابستگی runtime به mock، smoke script +- [x] Todo UI سایت (هدر/هوم/دوره‌ها/فونت/اسکیما اساتید) — جزئیات در `docs/Todo.Md` - [ ] محتوای واقعی از پنل ادمین (طبق دستور کاربر بعداً) +- [x] لوگوی دانشکده (نشان بدون متن کناری + favicon) +- [ ] Todo blocked: پالت mst، seed اساتید از شبکه دانشکده ## Milestones | مرحله | وضعیت | تاریخ | diff --git a/messages/fa.json b/messages/fa.json index db88676..ccf56ec 100644 --- a/messages/fa.json +++ b/messages/fa.json @@ -1,7 +1,7 @@ { "meta": { "homeTitle": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر", - "homeDescription": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر؛ آموزش مدیران برای تحول در صنعت با تصمیم‌گیری داده‌محور، هوش مصنوعی و مدیریت تغییر.", + "homeDescription": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر؛ پیوند دانش مدیریت، فناوری و تجربه برای مواجهه با مسائل کسب‌وکار.", "professionalTitle": "دوره‌های کوتاه و گواهی‌محور | مدیریت علم و فناوری", "professionalDescription": "دوره‌های آنلاین و ترکیبی برای مدیران و متخصصان؛ فهرست دوره‌ها و اعلام علاقه به ثبت‌نام." }, @@ -81,13 +81,14 @@ "offeredBy": "دانشکده مدیریت علم و فناوری — دانشگاه صنعتی امیرکبیر", "statsTitle": "دانشکده در یک نگاه", "rankTitle": "یادگیری در دانشگاه صنعتی امیرکبیر", - "testimonialsTitle": "نظر شرکت‌کنندگان", "advisor": "مشاوره ثبت‌نام", "dppTitle": "یادگیری آنلاین و ترکیبی", "dppBody": "محتوای به‌روز با تمرین و پروژه؛ مناسب شاغلانی که زمان محدود دارند." }, "footer": { "links": "دسترسی سریع", + "facultySite": "دانشکده", + "facultyNetwork": "شبکه اساتید", "press": "روابط عمومی", "careers": "همکاری با ما", "copyright": "© {year} مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر" diff --git a/package-lock.json b/package-lock.json index 6c02b50..468c7cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "react-dom": "19.2.8", "shadcn": "^4.21.0", "tw-animate-css": "^1.4.0", + "vazirmatn": "^33.0.3", "zod": "^4.6.5" }, "devDependencies": { @@ -10565,6 +10566,12 @@ "node": ">= 0.8" } }, + "node_modules/vazirmatn": { + "version": "33.0.3", + "resolved": "https://registry.npmjs.org/vazirmatn/-/vazirmatn-33.0.3.tgz", + "integrity": "sha512-fbjNc0CMjazZpIegWzz9OHGzI1APFboT+x7ZecXlUCtDe/nkyx7gtCTZnWS/+eeXG7fbfXymCPKJI8EsnM3iqw==", + "license": "OFL" + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index c1fa684..2109297 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "react-dom": "19.2.8", "shadcn": "^4.21.0", "tw-animate-css": "^1.4.0", + "vazirmatn": "^33.0.3", "zod": "^4.6.5" }, "devDependencies": { diff --git a/public/MstAutIcon.png b/public/MstAutIcon.png new file mode 100644 index 0000000..de4b0ff Binary files /dev/null and b/public/MstAutIcon.png differ diff --git a/public/MstAut_favicon.ico b/public/MstAut_favicon.ico new file mode 100644 index 0000000..4db1d71 Binary files /dev/null and b/public/MstAut_favicon.ico differ diff --git a/public/brand/amirkabir-arches.png b/public/brand/amirkabir-arches.png new file mode 100644 index 0000000..8e1787d Binary files /dev/null and b/public/brand/amirkabir-arches.png differ diff --git a/public/brand/amirkabir.png b/public/brand/amirkabir.png index 265a391..de4b0ff 100644 Binary files a/public/brand/amirkabir.png and b/public/brand/amirkabir.png differ diff --git a/public/brand/mst-faculty-full-with-text.png b/public/brand/mst-faculty-full-with-text.png new file mode 100644 index 0000000..b54e09f Binary files /dev/null and b/public/brand/mst-faculty-full-with-text.png differ diff --git a/public/brand/mst-faculty-icon.png b/public/brand/mst-faculty-icon.png new file mode 100644 index 0000000..4b4bb0e Binary files /dev/null and b/public/brand/mst-faculty-icon.png differ diff --git a/public/brand/mst-faculty.png b/public/brand/mst-faculty.png new file mode 100644 index 0000000..c930a19 Binary files /dev/null and b/public/brand/mst-faculty.png differ diff --git a/public/brand/seminar-room.jpg b/public/brand/seminar-room.jpg new file mode 100644 index 0000000..10d1343 Binary files /dev/null and b/public/brand/seminar-room.jpg differ diff --git a/public/favicon.ico b/public/favicon.ico index 265a391..4db1d71 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/images/courses/ai-fluency-brochure.jpg b/public/images/courses/ai-fluency-brochure.jpg new file mode 100644 index 0000000..783d194 Binary files /dev/null and b/public/images/courses/ai-fluency-brochure.jpg differ diff --git a/public/images/courses/ai-fluency-poster.jpg b/public/images/courses/ai-fluency-poster.jpg new file mode 100644 index 0000000..783d194 Binary files /dev/null and b/public/images/courses/ai-fluency-poster.jpg differ diff --git a/public/images/courses/ai-organizational-transformation-brochure.png b/public/images/courses/ai-organizational-transformation-brochure.png new file mode 100644 index 0000000..05ee163 Binary files /dev/null and b/public/images/courses/ai-organizational-transformation-brochure.png differ diff --git a/public/images/courses/ai-organizational-transformation-poster.png b/public/images/courses/ai-organizational-transformation-poster.png new file mode 100644 index 0000000..05ee163 Binary files /dev/null and b/public/images/courses/ai-organizational-transformation-poster.png differ diff --git a/public/images/courses/branding-brochure.jpg b/public/images/courses/branding-brochure.jpg new file mode 100644 index 0000000..e408d3f Binary files /dev/null and b/public/images/courses/branding-brochure.jpg differ diff --git a/public/images/courses/branding-marketing-practice-brochure.jpg b/public/images/courses/branding-marketing-practice-brochure.jpg new file mode 100644 index 0000000..b8f8b45 Binary files /dev/null and b/public/images/courses/branding-marketing-practice-brochure.jpg differ diff --git a/public/images/courses/branding-marketing-practice-poster.jpg b/public/images/courses/branding-marketing-practice-poster.jpg new file mode 100644 index 0000000..b8f8b45 Binary files /dev/null and b/public/images/courses/branding-marketing-practice-poster.jpg differ diff --git a/public/images/courses/branding-poster.jpg b/public/images/courses/branding-poster.jpg new file mode 100644 index 0000000..e408d3f Binary files /dev/null and b/public/images/courses/branding-poster.jpg differ diff --git a/public/images/courses/hr-prompt-engineering-brochure.jpg b/public/images/courses/hr-prompt-engineering-brochure.jpg new file mode 100644 index 0000000..0b44c9d Binary files /dev/null and b/public/images/courses/hr-prompt-engineering-brochure.jpg differ diff --git a/public/images/courses/hr-prompt-engineering-poster.jpg b/public/images/courses/hr-prompt-engineering-poster.jpg new file mode 100644 index 0000000..0b44c9d Binary files /dev/null and b/public/images/courses/hr-prompt-engineering-poster.jpg differ diff --git a/public/images/courses/managerial-dialogue-brochure.jpg b/public/images/courses/managerial-dialogue-brochure.jpg new file mode 100644 index 0000000..f595722 Binary files /dev/null and b/public/images/courses/managerial-dialogue-brochure.jpg differ diff --git a/public/images/courses/managerial-dialogue-poster.jpg b/public/images/courses/managerial-dialogue-poster.jpg new file mode 100644 index 0000000..f595722 Binary files /dev/null and b/public/images/courses/managerial-dialogue-poster.jpg differ diff --git a/public/images/courses/marketing-brochure.jpg b/public/images/courses/marketing-brochure.jpg new file mode 100644 index 0000000..fe96606 Binary files /dev/null and b/public/images/courses/marketing-brochure.jpg differ diff --git a/public/images/courses/marketing-poster.jpg b/public/images/courses/marketing-poster.jpg new file mode 100644 index 0000000..fe96606 Binary files /dev/null and b/public/images/courses/marketing-poster.jpg differ diff --git a/public/images/faculty/fac-1.png b/public/images/faculty/fac-1.png new file mode 100644 index 0000000..605cd44 Binary files /dev/null and b/public/images/faculty/fac-1.png differ diff --git a/public/images/faculty/fac-10.png b/public/images/faculty/fac-10.png new file mode 100644 index 0000000..09e3a99 Binary files /dev/null and b/public/images/faculty/fac-10.png differ diff --git a/public/images/faculty/fac-2.png b/public/images/faculty/fac-2.png new file mode 100644 index 0000000..df4c7f1 Binary files /dev/null and b/public/images/faculty/fac-2.png differ diff --git a/public/images/faculty/fac-3.png b/public/images/faculty/fac-3.png new file mode 100644 index 0000000..3c9a01b Binary files /dev/null and b/public/images/faculty/fac-3.png differ diff --git a/public/images/faculty/fac-4.png b/public/images/faculty/fac-4.png new file mode 100644 index 0000000..65a6406 Binary files /dev/null and b/public/images/faculty/fac-4.png differ diff --git a/public/images/faculty/fac-5.png b/public/images/faculty/fac-5.png new file mode 100644 index 0000000..1cc548e Binary files /dev/null and b/public/images/faculty/fac-5.png differ diff --git a/public/images/faculty/fac-6.png b/public/images/faculty/fac-6.png new file mode 100644 index 0000000..b2274a9 Binary files /dev/null and b/public/images/faculty/fac-6.png differ diff --git a/public/images/faculty/fac-7.png b/public/images/faculty/fac-7.png new file mode 100644 index 0000000..8749b36 Binary files /dev/null and b/public/images/faculty/fac-7.png differ diff --git a/public/images/faculty/fac-8.png b/public/images/faculty/fac-8.png new file mode 100644 index 0000000..be97c14 Binary files /dev/null and b/public/images/faculty/fac-8.png differ diff --git a/public/images/faculty/fac-9.png b/public/images/faculty/fac-9.png new file mode 100644 index 0000000..7112f9a Binary files /dev/null and b/public/images/faculty/fac-9.png differ diff --git a/public/images/faculty/fac-barzegar11.png b/public/images/faculty/fac-barzegar11.png new file mode 100644 index 0000000..eb802ad Binary files /dev/null and b/public/images/faculty/fac-barzegar11.png differ diff --git a/public/images/faculty/fac-m-etemad.png b/public/images/faculty/fac-m-etemad.png new file mode 100644 index 0000000..c8aaa24 Binary files /dev/null and b/public/images/faculty/fac-m-etemad.png differ diff --git a/public/images/faculty/fac-m-mohajeri.png b/public/images/faculty/fac-m-mohajeri.png new file mode 100644 index 0000000..8e099da Binary files /dev/null and b/public/images/faculty/fac-m-mohajeri.png differ diff --git a/public/images/faculty/fac-mh-vafa.png b/public/images/faculty/fac-mh-vafa.png new file mode 100644 index 0000000..6941cd1 Binary files /dev/null and b/public/images/faculty/fac-mh-vafa.png differ diff --git a/public/images/faculty/fac-mhmemarian.png b/public/images/faculty/fac-mhmemarian.png new file mode 100644 index 0000000..d3d11c4 Binary files /dev/null and b/public/images/faculty/fac-mhmemarian.png differ diff --git a/public/images/faculty/fac-mo-zamanian.png b/public/images/faculty/fac-mo-zamanian.png new file mode 100644 index 0000000..ba376b3 Binary files /dev/null and b/public/images/faculty/fac-mo-zamanian.png differ diff --git a/public/images/faculty/fac-s-ali-rohani.png b/public/images/faculty/fac-s-ali-rohani.png new file mode 100644 index 0000000..5dd7fe2 Binary files /dev/null and b/public/images/faculty/fac-s-ali-rohani.png differ diff --git a/public/images/faculty/fac-shemshak.png b/public/images/faculty/fac-shemshak.png new file mode 100644 index 0000000..d338a21 Binary files /dev/null and b/public/images/faculty/fac-shemshak.png differ diff --git a/public/images/faculty/placeholder.png b/public/images/faculty/placeholder.png new file mode 100644 index 0000000..7274a6e Binary files /dev/null and b/public/images/faculty/placeholder.png differ diff --git a/scripts/import-faculty-from-local.mjs b/scripts/import-faculty-from-local.mjs new file mode 100644 index 0000000..8caf986 --- /dev/null +++ b/scripts/import-faculty-from-local.mjs @@ -0,0 +1,291 @@ +/** + * One-shot import of MST «شبکه اساتید» from a browser-saved folder. + * + * Usage: + * node scripts/import-faculty-from-local.mjs + * node scripts/import-faculty-from-local.mjs "C:\Users\...\شبکه اساتید" + * + * Reads DATABASE_URL from .env.local. Copies avatars into public/images/faculty. + */ + +import { existsSync, readFileSync, readdirSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import pg from "pg"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); + +if (!process.env.DATABASE_URL) { + const envPath = path.join(root, ".env.local"); + if (existsSync(envPath)) { + for (const line of readFileSync(envPath, "utf8").split(/\r?\n/)) { + const match = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/); + if (match && !(match[1] in process.env)) { + process.env[match[1]] = match[2]; + } + } + } +} + +if (!process.env.DATABASE_URL) { + console.error("DATABASE_URL is not set."); + process.exit(1); +} + +function findDefaultFolder() { + const downloads = path.join(process.env.USERPROFILE || "", "Downloads"); + if (!existsSync(downloads)) return null; + const hit = readdirSync(downloads, { withFileTypes: true }).find( + (d) => d.isDirectory() && d.name.includes("شبکه"), + ); + return hit ? path.join(downloads, hit.name) : null; +} + +function findHtmlAndFiles(folder) { + const entries = readdirSync(folder, { withFileTypes: true }); + const html = entries.find((e) => e.isFile() && e.name.endsWith(".html")); + const filesDir = entries.find( + (e) => e.isDirectory() && e.name.includes("_files"), + ); + if (!html) throw new Error(`No .html in ${folder}`); + return { + htmlPath: path.join(folder, html.name), + filesDir: filesDir ? path.join(folder, filesDir.name) : undefined, + }; +} + +// Dynamic import of TS modules via Node + project ts runner is awkward; +// re-implement a minimal upsert here mirroring sync-mst-network.ts. + +function decodeEntities(s) { + return s + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/"/g, '"') + .replace(/'/g, "'") + .replace(/ /g, " ") + .trim(); +} + +function stripTags(s) { + return decodeEntities(s.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim()); +} + +function pickHref(block, classToken) { + const re = new RegExp( + `class="[^"]*${classToken}[^"]*"[^>]*href="([^"]+)"|href="([^"]+)"[^>]*class="[^"]*${classToken}[^"]*"`, + "i", + ); + const m = block.match(re); + const href = m?.[1] || m?.[2] || ""; + if (!href || href.endsWith("orcid.org/")) return ""; + return decodeEntities(href); +} + +function formatPhone(tel) { + let local = tel.replace(/\D/g, ""); + if (local.startsWith("98")) local = "0" + local.slice(2); + if (local.length === 11 && local.startsWith("021")) { + return `${local.slice(0, 3)}-${local.slice(3)}`; + } + return local || tel; +} + +function parseHtml(html) { + const cardRe = + /
\s*<\/div>/g; + const out = []; + let m; + while ((m = cardRe.exec(html))) { + const classExtra = m[1] ?? ""; + const body = m[0]; + const name = stripTags(body.match(/mstf-name">([^<]+)/)?.[1] ?? ""); + if (!name) continue; + const pill = + stripTags(body.match(/mstf-pill">([^<]+)/)?.[1] ?? "") || + "عضو هیئت علمی"; + const department = stripTags( + body.match(/mstf-dept">([\s\S]*?)<\/div>/)?.[1] ?? "", + ); + const focus = stripTags( + body.match(/mstf-int">[^<]*<\/b>\s*([^<]+)/)?.[1] ?? "", + ); + const email = decodeEntities( + body.match(/mailto:([^"'>\s]+)/)?.[1] ?? "", + ); + const telRaw = body.match(/tel:(\+?[\d]+)/)?.[1] ?? ""; + const imageSrc = decodeEntities( + body.match(/mstf-avatar">]+src="([^"]+)"/)?.[1] ?? "", + ); + const visiting = + classExtra.includes("mstf-visiting") || pill.includes("مدعو"); + out.push({ + name, + title: pill, + department, + focus: focus || (visiting ? "استاد مدعو" : "—"), + email, + phone: telRaw ? formatPhone(telRaw) : "", + linkedinUrl: pickHref(body, "mstf-i-linkedin"), + scholarUrl: pickHref(body, "mstf-i-scholar"), + imageSrc, + visiting, + }); + } + return out; +} + +function facultyId(p) { + if (p.email) { + const local = p.email + .split("@")[0] + .toLowerCase() + .replace(/[^a-z0-9]+/g, "-") + .replace(/^-|-$/g, ""); + if (local) return `fac-${local}`; + } + let h = 0; + for (let i = 0; i < p.name.length; i++) { + h = (h * 31 + p.name.charCodeAt(i)) >>> 0; + } + return `fac-${h.toString(36)}`; +} + +async function main() { + const folder = process.argv[2] || findDefaultFolder(); + if (!folder || !existsSync(folder)) { + console.error("Faculty folder not found. Pass the path as argv[2]."); + process.exit(1); + } + + const { htmlPath, filesDir } = findHtmlAndFiles(folder); + const html = readFileSync(htmlPath, "utf8"); + const list = parseHtml(html); + console.log(`Parsed ${list.length} faculty from ${htmlPath}`); + + // Use the TS sync via next-compatible dynamic import when available; + // otherwise upsert with pg directly (this script). + const { copyFileSync, mkdirSync } = await import("node:fs"); + const publicFaculty = path.join(root, "public", "images", "faculty"); + mkdirSync(publicFaculty, { recursive: true }); + + if (filesDir && existsSync(path.join(filesDir, "johndoe.png"))) { + copyFileSync( + path.join(filesDir, "johndoe.png"), + path.join(publicFaculty, "placeholder.png"), + ); + } + + const { Client } = pg; + const client = new Client({ connectionString: process.env.DATABASE_URL }); + await client.connect(); + + try { + const existing = await client.query(`SELECT * FROM faculty_members`); + const byEmail = new Map(); + const byName = new Map(); + for (const row of existing.rows) { + if (row.email) byEmail.set(row.email.toLowerCase(), row); + byName.set(row.name.replace(/\s+/g, " ").trim().toLowerCase(), row); + } + + let inserted = 0; + let updated = 0; + let images = 0; + + for (const p of list) { + const match = + (p.email && byEmail.get(p.email.toLowerCase())) || + byName.get(p.name.replace(/\s+/g, " ").trim().toLowerCase()); + const id = match?.id ?? facultyId(p); + + let imageUrl = match?.image_url || "/images/faculty/placeholder.png"; + const fileBase = p.imageSrc.split(/[/\\]/).pop() || ""; + const isPlaceholder = + !fileBase || + fileBase.toLowerCase() === "johndoe.png" || + fileBase.includes("placeholder"); + + if (filesDir && fileBase && !isPlaceholder) { + const from = path.join(filesDir, fileBase); + if (existsSync(from)) { + const destName = `${id}.png`; + copyFileSync(from, path.join(publicFaculty, destName)); + imageUrl = `/images/faculty/${destName}`; + images += 1; + } + } else if (isPlaceholder && match?.image_url && !match.image_url.includes("placeholder")) { + imageUrl = match.image_url; + } + + const title = + match?.title && !/هیئت علمی|مدعو/.test(match.title) + ? match.title + : p.title; + const bio = + match?.bio?.trim() || + [p.title, p.department].filter(Boolean).join(" — "); + + if (match) { + await client.query( + `UPDATE faculty_members SET + name=$2, title=$3, focus=$4, bio=$5, image_url=$6, + email=$7, phone=$8, department=$9, + linkedin_url=$10, scholar_url=$11, updated_at=now() + WHERE id=$1`, + [ + id, + p.name, + title, + p.focus, + bio, + imageUrl, + p.email || null, + p.phone || null, + p.department || null, + p.linkedinUrl || null, + p.scholarUrl || null, + ], + ); + updated += 1; + } else { + await client.query( + `INSERT INTO faculty_members ( + id, name, title, focus, bio, image_url, + email, phone, department, linkedin_url, scholar_url, published + ) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,true)`, + [ + id, + p.name, + title, + p.focus, + bio, + imageUrl, + p.email || null, + p.phone || null, + p.department || null, + p.linkedinUrl || null, + p.scholarUrl || null, + ], + ); + inserted += 1; + } + + const row = { id, name: p.name, email: p.email || null }; + if (p.email) byEmail.set(p.email.toLowerCase(), row); + byName.set(p.name.replace(/\s+/g, " ").trim().toLowerCase(), row); + } + + console.log( + JSON.stringify({ total: list.length, inserted, updated, images }, null, 2), + ); + } finally { + await client.end(); + } +} + +main().catch((err) => { + console.error(err); + process.exit(1); +}); diff --git a/scripts/parse-faculty-html.mjs b/scripts/parse-faculty-html.mjs new file mode 100644 index 0000000..e2b9acb --- /dev/null +++ b/scripts/parse-faculty-html.mjs @@ -0,0 +1,24 @@ +import fs from "node:fs"; + +const html = fs.readFileSync("tmp-faculty.html", "utf8"); +const cardRe = /
\s*<\/div>/g; +const cards = html.match(cardRe) ?? []; +console.log("cards", cards.length); +for (const c of cards.slice(0, 3)) { + const name = c.match(/mstf-name">([^<]+)/)?.[1]; + const pill = c.match(/mstf-pill">([^<]+)/)?.[1]; + const dept = c + .match(/mstf-dept">([\s\S]*?)<\/div>/)?.[1] + ?.replace(/<[^>]+>/g, "") + .replace(/\s+/g, " ") + .trim(); + const focus = c + .match(/mstf-int">[^<]*<\/b>\s*([^<]+)/)?.[1] + ?.trim(); + const email = c.match(/mailto:([^"'\s]+)/)?.[1]; + const phone = c.match(/tel:(\+?\d+)/)?.[1]; + const linkedin = c.match(/mstf-i-linkedin" href="([^"]+)"/)?.[1]; + const scholar = c.match(/mstf-i-scholar" href="([^"]+)"/)?.[1]; + const img = c.match(/mstf-avatar">]+src="([^"]+)"/)?.[1]; + console.log({ name, pill, dept, focus, email, phone, linkedin, scholar, img }); +} diff --git a/scripts/probe-taxonomy.mjs b/scripts/probe-taxonomy.mjs new file mode 100644 index 0000000..9742bec --- /dev/null +++ b/scripts/probe-taxonomy.mjs @@ -0,0 +1,39 @@ +import { readFileSync, existsSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import pg from "pg"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const envPath = path.join(root, ".env.local"); +if (existsSync(envPath)) { + for (const line of readFileSync(envPath, "utf8").split(/\r?\n/)) { + const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/); + if (m && !(m[1] in process.env)) process.env[m[1]] = m[2]; + } +} + +const client = new pg.Client({ connectionString: process.env.DATABASE_URL }); +await client.connect(); +const cats = await client.query( + "select slug, label, show_in_filter, published from course_categories order by sort_order", +); +const tags = await client.query( + "select slug, label, show_in_nav, show_in_filter, published from course_tags order by sort_order", +); +const links = await client.query(` + select c.slug as course, + coalesce(json_agg(distinct cat.slug) filter (where cat.slug is not null), '[]') as cats, + coalesce(json_agg(distinct t.slug) filter (where t.slug is not null), '[]') as tags + from courses c + left join course_category_links cl on cl.course_id = c.id + left join course_categories cat on cat.id = cl.category_id + left join course_tag_links tl on tl.course_id = c.id + left join course_tags t on t.id = tl.tag_id + where c.published + group by c.slug + order by c.slug +`); +console.log("CATEGORIES", cats.rows); +console.log("TAGS", tags.rows); +console.log("COURSE LINKS", links.rows); +await client.end(); diff --git a/scripts/test-db-connection.mjs b/scripts/test-db-connection.mjs index 835f84f..1209ff2 100644 --- a/scripts/test-db-connection.mjs +++ b/scripts/test-db-connection.mjs @@ -32,7 +32,10 @@ if (!process.env.DATABASE_URL) { const client = new Client({ connectionString: process.env.DATABASE_URL, - connectionTimeoutMillis: 10000, + // Match src/lib/db.ts — remote hosts often need >5–10s. + connectionTimeoutMillis: Number( + process.env.DATABASE_CONNECTION_TIMEOUT_MS ?? 20_000, + ), }); try { diff --git a/src/app/(main)/(legal)/[slug]/page.tsx b/src/app/(main)/(legal)/[slug]/page.tsx index 1af8abb..1c92930 100644 --- a/src/app/(main)/(legal)/[slug]/page.tsx +++ b/src/app/(main)/(legal)/[slug]/page.tsx @@ -3,14 +3,9 @@ import { notFound } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { Container } from "@/components/atoms/Container"; import { Section } from "@/components/atoms/Section"; +import { FormCard } from "@/components/molecules/FormCard"; import { PageHero } from "@/components/molecules/PageHero"; import { ContactInterestForm } from "@/components/organisms/ContactInterestForm"; -import { - Card, - CardContent, - CardHeader, - CardTitle, -} from "@/components/ui/card"; import { getLegalPage } from "@/lib/data/site"; type Props = { params: Promise<{ slug: string }> }; @@ -38,26 +33,21 @@ export default async function LegalSlugPage({ params }: Props) { return (
-
- -
+
+ +
{page.body.map((paragraph) => ( -

+

{paragraph}

))}
- - - ارسال پیام - - - - - + + +
diff --git a/src/app/(main)/about/page.tsx b/src/app/(main)/about/page.tsx index 2ada579..c0eb6ee 100644 --- a/src/app/(main)/about/page.tsx +++ b/src/app/(main)/about/page.tsx @@ -1,19 +1,15 @@ import type { Metadata } from "next"; -import Link from "next/link"; import { getTranslations } from "next-intl/server"; -import { Container } from "@/components/atoms/Container"; -import { Heading } from "@/components/atoms/Heading"; -import { Section } from "@/components/atoms/Section"; -import { PageHero } from "@/components/molecules/PageHero"; -import { SurfaceCard } from "@/components/molecules/SurfaceCard"; -import { buttonVariants } from "@/components/ui/button"; -import { cn } from "@/lib/utils"; +import { AboutTemplate } from "@/components/templates/AboutTemplate"; import { getTopics } from "@/lib/data/site"; -import { aboutFocusAreas, siteMission } from "@/lib/site-config"; +import { aboutContent } from "@/lib/site-config"; export async function generateMetadata(): Promise { const t = await getTranslations("pages"); - return { title: t("aboutTitle"), description: siteMission }; + return { + title: t("aboutTitle"), + description: aboutContent.intro, + }; } export default async function AboutPage() { @@ -21,50 +17,7 @@ export default async function AboutPage() { return (
- -
- -

آنچه می‌آموزید

توانمندی‌های مدیریتی برای تحول در صنعت -
- {aboutFocusAreas.map((area) => ( - - - {area.title} - -

- {area.description} -

-
- ))} -
-
-
-
- -

حوزه‌های آموزشی

موضوع مورد نیاز خود را پیدا کنید -
- {topics.map((topic) => ( - - - - {topic.title} - -

- {topic.description} -

- -
- ))} -
- - مشاهده برنامه‌های آموزشی - -
-
+
); } diff --git a/src/app/(main)/alumni/page.tsx b/src/app/(main)/alumni/page.tsx index 3aa50c2..bf4a888 100644 --- a/src/app/(main)/alumni/page.tsx +++ b/src/app/(main)/alumni/page.tsx @@ -21,26 +21,26 @@ export default async function AlumniPage() { return (
-
+
-
+
{stories.map((story) => ( -
+
{story.name}
-
+
{story.program} {story.title} diff --git a/src/app/(main)/contact/page.tsx b/src/app/(main)/contact/page.tsx index a170ae3..63a91f2 100644 --- a/src/app/(main)/contact/page.tsx +++ b/src/app/(main)/contact/page.tsx @@ -1,17 +1,11 @@ import type { Metadata } from "next"; import { getTranslations } from "next-intl/server"; import { Container } from "@/components/atoms/Container"; -import { Heading } from "@/components/atoms/Heading"; import { Section } from "@/components/atoms/Section"; import { PageHero } from "@/components/molecules/PageHero"; +import { ContactDetails } from "@/components/molecules/ContactDetails"; +import { FormCard } from "@/components/molecules/FormCard"; import { ContactInterestForm } from "@/components/organisms/ContactInterestForm"; -import { - Card, - CardContent, - CardHeader, - CardTitle, -} from "@/components/ui/card"; -import { siteAddress } from "@/lib/site-config"; export async function generateMetadata(): Promise { const t = await getTranslations("pages"); @@ -24,49 +18,15 @@ export default async function ContactPage() { return (
-
- -
- اطلاعات تماس -
-

- آدرس: - {siteAddress.line} -

-

- تلفن: - {siteAddress.phone} -

-

- ایمیل: - - {siteAddress.email} - -

- - مشاهده روی نقشه - -
-
- - - ارسال پیام - - - - - +
+ + + + +
diff --git a/src/app/(main)/error.tsx b/src/app/(main)/error.tsx index 0833300..b716e63 100644 --- a/src/app/(main)/error.tsx +++ b/src/app/(main)/error.tsx @@ -1,35 +1,10 @@ "use client"; -import { useEffect } from "react"; -import { DotCta } from "@/components/atoms/DotCta"; -import { Button } from "@/components/ui/button"; +import { ErrorState } from "@/components/organisms/ErrorState"; -export default function MainError({ - error, - reset, -}: { +export default function MainError(props: { error: Error & { digest?: string }; reset: () => void; }) { - useEffect(() => { - console.error(error); - }, [error]); - - return ( -
-

خطا

-

- بارگذاری صفحه ناموفق بود -

-

- لطفاً دوباره تلاش کنید. اگر مشکل ادامه داشت، چند لحظه بعد بازگردید. -

-
- - بازگشت به خانه -
-
- ); + return ; } diff --git a/src/app/(main)/events/[id]/page.tsx b/src/app/(main)/events/[id]/page.tsx index 09ed5eb..bc11810 100644 --- a/src/app/(main)/events/[id]/page.tsx +++ b/src/app/(main)/events/[id]/page.tsx @@ -1,14 +1,23 @@ import type { Metadata } from "next"; import { notFound } from "next/navigation"; +import { CalendarDays, MapPin } from "lucide-react"; import { Container } from "@/components/atoms/Container"; import { Heading } from "@/components/atoms/Heading"; import { Section } from "@/components/atoms/Section"; import { TextLink } from "@/components/atoms/TextLink"; +import { DetailList } from "@/components/molecules/DetailList"; import { PageHero } from "@/components/molecules/PageHero"; +import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { getEventById } from "@/lib/data/events"; type Props = { params: Promise<{ id: string }> }; +const dateFormat: Intl.DateTimeFormatOptions = { + year: "numeric", + month: "long", + day: "numeric", +}; + export async function generateMetadata({ params }: Props): Promise { const { id } = await params; const event = await getEventById(id); @@ -21,36 +30,37 @@ export default async function EventDetailPage({ params }: Props) { const event = await getEventById(id); if (!event) notFound(); - const start = new Date(event.startDate).toLocaleDateString("fa-IR", { - year: "numeric", - month: "long", - day: "numeric", - }); + const start = new Date(event.startDate).toLocaleDateString("fa-IR", dateFormat); const end = event.endDate - ? new Date(event.endDate).toLocaleDateString("fa-IR", { - year: "numeric", - month: "long", - day: "numeric", - }) + ? new Date(event.endDate).toLocaleDateString("fa-IR", dateFormat) : null; return (
-
- -

- زمان: - {start} - {end ? ` تا ${end}` : ""} -

-

- مکان: - {event.location} -

- درباره رویداد -

{event.summary}

- بازگشت به رویدادها +
+ + + + +
+ + درباره رویداد + +

{event.summary}

+
+ + بازگشت به رویدادها +
diff --git a/src/app/(main)/events/page.tsx b/src/app/(main)/events/page.tsx index 5eca9fe..0e12e90 100644 --- a/src/app/(main)/events/page.tsx +++ b/src/app/(main)/events/page.tsx @@ -18,7 +18,7 @@ export default async function EventsPage() { return (
-
+
{events.map((event) => ( diff --git a/src/app/(main)/faculty/page.tsx b/src/app/(main)/faculty/page.tsx index c88f061..573e385 100644 --- a/src/app/(main)/faculty/page.tsx +++ b/src/app/(main)/faculty/page.tsx @@ -1,5 +1,6 @@ import { redirect } from "next/navigation"; +import { facultyNetworkUrl } from "@/lib/site-config"; export default function FacultyPage() { - redirect("https://mst.aut.ac.ir/content/31094/شبکه-اساتید"); + redirect(facultyNetworkUrl); } diff --git a/src/app/(main)/insights/[id]/page.tsx b/src/app/(main)/insights/[id]/page.tsx index 703aa79..dbd8500 100644 --- a/src/app/(main)/insights/[id]/page.tsx +++ b/src/app/(main)/insights/[id]/page.tsx @@ -2,11 +2,9 @@ import type { Metadata } from "next"; import Image from "next/image"; import { notFound } from "next/navigation"; import { Container } from "@/components/atoms/Container"; -import { Heading } from "@/components/atoms/Heading"; import { Section } from "@/components/atoms/Section"; -import { BadgeLabel } from "@/components/atoms/BadgeLabel"; -import { MetamorphField } from "@/components/atoms/MetamorphField"; import { TextLink } from "@/components/atoms/TextLink"; +import { PageHero } from "@/components/molecules/PageHero"; import { getArticleById } from "@/lib/data/articles"; import { JsonLd } from "@/lib/seo/json-ld"; @@ -39,21 +37,14 @@ export default async function InsightDetailPage({ params }: Props) { image: article.imageUrl, }} /> -
- - - {article.category} - - {article.title} - -

- {article.author} · {date} -

-
-
-
+ +
-
+
{article.title}
-

{article.body}

- +

+ {article.body} +

+ بازگشت به مقالات diff --git a/src/app/(main)/insights/page.tsx b/src/app/(main)/insights/page.tsx index 49d81bb..962fe5e 100644 --- a/src/app/(main)/insights/page.tsx +++ b/src/app/(main)/insights/page.tsx @@ -18,7 +18,7 @@ export default async function InsightsPage() { return (
-
+
{articles.map((article) => ( diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 8d93546..58e1421 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -7,7 +7,11 @@ import { getCourses } from "@/lib/data/courses"; import { listPublishedCourseTags } from "@/lib/data/taxonomy"; import { getPrograms } from "@/lib/data/programs"; import { getCampaignBanners } from "@/lib/data/site"; -import { siteShortName } from "@/lib/site-config"; +import { + facultyNetworkUrl, + facultySiteUrl, + siteShortName, +} from "@/lib/site-config"; // Public CMS pages must read Postgres at request time — static bake at Docker // build often has no DATABASE_URL and ships empty lists. @@ -42,12 +46,9 @@ export default async function MainLayout({ + +

۴۰۴

+ + صفحه مورد نظر یافت نشد + +

+ ممکن است این صفحه جابه‌جا یا حذف شده باشد. +

+
+ + بازگشت به خانه + + + مشاهده دوره‌ها + +
+
+
+ ); +} diff --git a/src/app/(main)/page.tsx b/src/app/(main)/page.tsx index 44aba41..2a2fd62 100644 --- a/src/app/(main)/page.tsx +++ b/src/app/(main)/page.tsx @@ -1,14 +1,14 @@ import { getTranslations } from "next-intl/server"; import { - HomeEvents, + HomeApproach, + HomeCourseSearch, HomeHero, HomeIdeas, HomeRest, type HomeLabels, } from "@/components/templates/HomeTemplate"; import { getFeaturedArticle } from "@/lib/data/articles"; -import { getEvents } from "@/lib/data/events"; -import { getPrograms } from "@/lib/data/programs"; +import { getLatestCourses } from "@/lib/data/courses"; import { getSiteStats, getTopics } from "@/lib/data/site"; async function getLabels(): Promise { @@ -31,84 +31,57 @@ async function getLabels(): Promise { findUsTitle: t("home.findUsTitle"), ideasEyebrow: t("home.ideasEyebrow"), linksTitle: t("footer.links"), + exploreCourses: t("nav.exploreCourses"), }; } -async function HeroSection() { +async function orFallback( + label: string, + load: () => Promise, + fallback: T, +): Promise { try { - const [featured, labels] = await Promise.all([ - getFeaturedArticle(), - getLabels(), - ]); - return ; + return await load(); } catch (err) { - console.error("[home] HeroSection failed:", err); - const labels = await getLabels(); - return ; + console.error(`[home] ${label} failed:`, err); + return fallback; } } -async function EventsSection() { - try { - const [events, labels] = await Promise.all([getEvents(), getLabels()]); - return ( - - ); - } catch (err) { - console.error("[home] EventsSection failed:", err); - const labels = await getLabels(); - return ( - - ); - } +async function HeroSection() { + const [featured, labels] = await Promise.all([ + orFallback("featured article", getFeaturedArticle, null), + getLabels(), + ]); + return ; +} + +async function CourseSearchSection() { + const data = await orFallback( + "latest courses", + () => + Promise.all([getLatestCourses(6), getLabels()]), + null, + ); + if (!data) return null; + const [courses, labels] = data; + return ( + + ); } async function RestSection() { - try { - const [programs, intersections, stats, labels] = await Promise.all([ - getPrograms(), - getTopics(), - getSiteStats(), - getLabels(), - ]); - const carouselPrograms = programs.filter((p) => - [ - "management-core", - "evening-management", - "executive", - "leadership-fellows", - "business-analytics", - "finance", - ].includes(p.slug), - ); - return ( - - ); - } catch (err) { - console.error("[home] RestSection failed:", err); - const labels = await getLabels(); - return ( - - ); - } + const [intersections, stats, labels] = await Promise.all([ + orFallback("topics", getTopics, []), + orFallback("site stats", getSiteStats, []), + getLabels(), + ]); + return ( + + ); } export default function HomePage() { @@ -116,7 +89,8 @@ export default function HomePage() {
- + +
); diff --git a/src/app/(main)/programs/[slug]/page.tsx b/src/app/(main)/programs/[slug]/page.tsx index 7115ce5..53d1edb 100644 --- a/src/app/(main)/programs/[slug]/page.tsx +++ b/src/app/(main)/programs/[slug]/page.tsx @@ -6,7 +6,10 @@ import { Container } from "@/components/atoms/Container"; import { Heading } from "@/components/atoms/Heading"; import { Section } from "@/components/atoms/Section"; import { TextLink } from "@/components/atoms/TextLink"; +import { CheckList } from "@/components/molecules/CheckList"; +import { DetailList } from "@/components/molecules/DetailList"; import { PageHero } from "@/components/molecules/PageHero"; +import { SectionHeader } from "@/components/molecules/SectionHeader"; import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; @@ -43,66 +46,68 @@ export default async function ProgramDetailPage({ params }: Props) { intro={program.blurb} eyebrow={program.tagline} /> -
- -
+
+ +

{program.body}

- - {t("highlights")} - -
    - {program.highlights.map((item) => ( -
  • {item}
  • - ))} -
+ {program.highlights.length > 0 ? ( +
+ + {t("highlights")} + + +
+ ) : null}
-
-
- - {t("relatedCourses")} -
    - {related.map((course) => ( -
  • - - - {course.title} + {related.length > 0 ? ( +
    + + +
      + {related.map((course) => ( +
    • + + + + {course.title} + +

      + {course.summary} +

      +
      -

      - {course.summary} -

      - -
    • - ))} -
    -
    -
    +
  • + ))} +
+
+
+ ) : null}
); } diff --git a/src/app/(main)/programs/page.tsx b/src/app/(main)/programs/page.tsx index 34a3119..0caa483 100644 --- a/src/app/(main)/programs/page.tsx +++ b/src/app/(main)/programs/page.tsx @@ -5,7 +5,9 @@ import { Container } from "@/components/atoms/Container"; import { Heading } from "@/components/atoms/Heading"; import { Section } from "@/components/atoms/Section"; import { BadgeLabel } from "@/components/atoms/BadgeLabel"; +import { DetailList } from "@/components/molecules/DetailList"; import { PageHero } from "@/components/molecules/PageHero"; +import { SectionHeader } from "@/components/molecules/SectionHeader"; import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; @@ -28,8 +30,8 @@ export default async function ProgramsPage() { return (
-
- +
+ @@ -45,40 +47,35 @@ function ProgramGroup({ title: string; items: Awaited>; }) { + if (items.length === 0) return null; return (
- - {title} - -
+ +
{items.map((program) => ( - - {program.tagline} + + {program.tagline ? ( + {program.tagline} + ) : null} - + {program.title} -

+

{program.blurb}

-
-
-
مخاطب
-
{program.audience}
-
-
-
مدت
-
{program.durationLabel}
-
-
-
فرمت
-
{program.formatLabel}
-
-
+ جزئیات برنامه diff --git a/src/app/(main)/topics/[slug]/page.tsx b/src/app/(main)/topics/[slug]/page.tsx index 4289ceb..b96a484 100644 --- a/src/app/(main)/topics/[slug]/page.tsx +++ b/src/app/(main)/topics/[slug]/page.tsx @@ -4,9 +4,10 @@ import { notFound } from "next/navigation"; import { Container } from "@/components/atoms/Container"; import { Section } from "@/components/atoms/Section"; import { TextLink } from "@/components/atoms/TextLink"; +import { CheckList } from "@/components/molecules/CheckList"; import { PageHero } from "@/components/molecules/PageHero"; +import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { buttonVariants } from "@/components/ui/button"; -import { Separator } from "@/components/ui/separator"; import { cn } from "@/lib/utils"; import { getTopicBySlug } from "@/lib/data/site"; @@ -31,25 +32,27 @@ export default async function TopicPage({ params }: Props) { intro={topic.description} imageUrl={topic.imageUrl} /> -
- -
-

{topic.body}

-
    - {topic.highlights.map((h) => ( -
  • {h}
  • - ))} -
+
+ +
+

{topic.body}

+ {topic.highlights.length > 0 ? ( + + ) : null}
-
); } \ No newline at end of file diff --git a/src/components/organisms/admin/generic/GenericDeleteDialog.tsx b/src/components/organisms/admin/generic/GenericDeleteDialog.tsx index 231de96..022a243 100644 --- a/src/components/organisms/admin/generic/GenericDeleteDialog.tsx +++ b/src/components/organisms/admin/generic/GenericDeleteDialog.tsx @@ -58,7 +58,7 @@ export function GenericDeleteDialog({ «{subject}» برای همیشه حذف می‌شود. این عمل قابل بازگشت نیست. - {error &&

{error}

} + {error &&

{error}

} - {error &&

{error}

} + {error &&

{error}

}
); } \ No newline at end of file diff --git a/src/components/templates/AboutTemplate.tsx b/src/components/templates/AboutTemplate.tsx new file mode 100644 index 0000000..7748bfc --- /dev/null +++ b/src/components/templates/AboutTemplate.tsx @@ -0,0 +1,127 @@ +import Link from "next/link"; +import { ArrowUpLeft } from "lucide-react"; +import { DotCta } from "@/components/atoms/DotCta"; +import { Container } from "@/components/atoms/Container"; +import { Heading } from "@/components/atoms/Heading"; +import { Section } from "@/components/atoms/Section"; +import { PageHero } from "@/components/molecules/PageHero"; +import { SectionHeader } from "@/components/molecules/SectionHeader"; +import { SurfaceCard } from "@/components/molecules/SurfaceCard"; +import { buttonVariants } from "@/components/ui/button"; +import { aboutContent, facultyNetworkUrl } from "@/lib/site-config"; +import type { IntersectionTopic } from "@/lib/types"; +import { cn } from "@/lib/utils"; + +function ProseBlock({ paragraphs }: { paragraphs: string[] }) { + return ( +
+ {paragraphs.map((paragraph, index) => ( +

+ {paragraph} +

+ ))} +
+ ); +} + +export function AboutTemplate({ topics }: { topics: IntersectionTopic[] }) { + const { amirkabir, faculty, learning, topics: topicsCopy, audience } = + aboutContent; + + return ( + <> + + +
+ +

+ {aboutContent.introFollowUp} +

+
+
+ +
+ + + + +
+ +
+ + + +
+ + {faculty.ctaLabel} + +
+
+
+ +
+ + + + +
+ +
+ + +
+ {topics.map((topic) => ( + + +
+ + {topic.title} + + +
+

+ {topic.description} +

+
+ + ))} +
+

+ {topicsCopy.note} +

+ + مشاهده دوره‌ها + +
+
+ +
+ + + + +
+ + ); +} diff --git a/src/components/templates/CourseDetailTemplate.tsx b/src/components/templates/CourseDetailTemplate.tsx index e2a91b3..2f09152 100644 --- a/src/components/templates/CourseDetailTemplate.tsx +++ b/src/components/templates/CourseDetailTemplate.tsx @@ -1,12 +1,17 @@ import Image from "next/image"; -import { Clock, Layers, Tag, Wallet } from "lucide-react"; +import Link from "next/link"; +import { ArrowUpLeft, Clock, Layers, Wallet } from "lucide-react"; import { Container } from "@/components/atoms/Container"; +import { Heading } from "@/components/atoms/Heading"; import { Section } from "@/components/atoms/Section"; import { TextLink } from "@/components/atoms/TextLink"; +import { DetailList, type DetailItem } from "@/components/molecules/DetailList"; import { PageHero } from "@/components/molecules/PageHero"; +import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { CourseRegisterGate } from "@/components/organisms/CourseRegisterGate"; -import { Separator } from "@/components/ui/separator"; +import { Badge } from "@/components/ui/badge"; import type { Course } from "@/lib/types"; +import { courseCategoryHref, courseTagHref } from "@/lib/course-nav"; import { formatCoursePrice, formatLabel } from "@/lib/labels"; import { JsonLd, courseJsonLd } from "@/lib/seo/json-ld"; @@ -36,19 +41,9 @@ export function CourseDetailTemplate({ labels: CourseDetailLabels; }) { const priceLabel = formatCoursePrice(course.price); - const categoryText = - course.categories.map((c) => c.label).join(" · ") || "—"; - const specs = [ - { - icon: Tag, - label: labels.category, - value: categoryText, - }, - { - icon: Layers, - label: labels.format, - value: formatLabel(course.format), - }, + const instructors = course.instructors ?? []; + const details: DetailItem[] = [ + { icon: Layers, label: labels.format, value: formatLabel(course.format) }, ...(course.durationHours ? [ { @@ -58,16 +53,14 @@ export function CourseDetailTemplate({ }, ] : []), - ...(priceLabel - ? [ - { - icon: Wallet, - label: labels.price, - value: priceLabel, - }, - ] - : []), + { + icon: Wallet, + label: labels.price, + value: priceLabel ?? labels.priceUnset, + emphasis: Boolean(priceLabel), + }, ]; + const hasTaxonomy = course.categories.length > 0 || course.tags.length > 0; return (
@@ -75,99 +68,111 @@ export function CourseDetailTemplate({ -
- -
-
-
- {course.title} -
+
+ +
+
+ {course.title}
-

+ {labels.aboutTitle} -

+

- {course.summary} + {course.seoDescription || course.summary}

- {course.seoDescription && - course.seoDescription !== course.summary ? ( -

- {course.seoDescription} -

- ) : null}
-
-

- {labels.detailsTitle} -

-
- {specs.map((item) => ( -
-
- -
-
-
- {item.label} -
-
- {item.value} -
-
-
- ))} -
-
+ {instructors.length > 0 ? ( +
+ + اساتید + + +
+ ) : null} + + {hasTaxonomy ? ( +
+ + {labels.category} + +
+ {course.categories.map((c) => ( + + + {c.label} + + + ))} + {course.tags.map((t) => ( + + + {t.label} + + + ))} +
+
+ ) : null}
-