Apply the public site UI checklist.

Align header, footer, brand, homepage course preview, faculty links, and the course catalog with the documented changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
smhk1376andCursor committed 2026-10-16 14:05:33 +03:30
1 parent 8886aa8640
commit de800d27b1
139 files changed
+3120 -1356

No files matched your search

@@ -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);
+4
View File
@@ -40,8 +40,12 @@ postgresql://<user>:<password>@insaight-postgres:5432/ManagmentWebSite_Db
```env ```env
# local (.env.local) # local (.env.local)
DATABASE_URL=postgresql://<user>:<password>@<host>:5432/ManagmentWebSite_Db DATABASE_URL=postgresql://<user>:<password>@<host>: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 است). فایل محلی: `.env.local` (در gitignore است).
Production باید مستقیم به نام کانتینر `insaight-postgres` وصل شود (نه IP عمومی از داخل bridge). Production باید مستقیم به نام کانتینر `insaight-postgres` وصل شود (نه IP عمومی از داخل bridge).
+38 -21
View File
@@ -1,21 +1,38 @@
1- در بار بالا، فاصله بین دکمه ها بیشتر شود تا تناسب برقرار باشد بین فاصله های اکشن های چپ و راست # تغییرات UI سایت (چک‌لیست)
2- دکمه تماس باما کنار دکمه سرچ باشد
3- فونت بشود وزیر متن وضعیت: `[ ]` باز · `[x]` انجام‌شده · `[blocked]` منتظر ورودی کاربر
4- دکمه دانشگداه از بالا جذف شود و به دسترسی سریع برود اما به دانشکد (لینک استاتید بدون آدرس صفحه)
5- درباره ما در بعد از دوره ها باشد ## هدر و ناوبری
6- برنامه ها فعلا هاید شود (لینکش هم در دسترس نباشد) - [x] 1. فاصله بین دکمه‌های هدر بیشتر شود (تعادل اکشن‌های چپ/راست)
7- لوگو دانشکده باید گذاشته شود (بهت میدمش) اگر میتونی لوگو های اینچا https://mst.aut.ac.ir را دانلود کن) - [x] 2. دکمه «تماس با ما» کنار دکمه سرچ
8- چرا دانشگاه .... باید بردش حذف شود - [x] 4. دکمه دانشگاه از هدر حذف → دسترسی سریع با برچسب «دانشکده» (`https://mst.aut.ac.ir/`)
9- عدد بالا در چرا دانشگاه (اون یک دو سه) برداشته شود - [x] 5. «درباره ما» بعد از «دوره‌ها»
10- دانشگاه صنعتی امیرکبیر باشد در این قسمت نه امیرکبیر خالی و البته همه جا - [x] 6. «برنامه‌ها» فعلاً مخفی (بدون لینک در UI)
11- پلت رنگی عووض میشه و باید بگیریمش (اگر میتونی اینو ببین https://mst.aut.ac.ir و ازش پلت رنگی بساز) - [x] 15. «رویدادها» فعلاً مخفی از هوم/ناو
12- قبل از "رویکرد آموزشی ما" باید یک سرچ بیاید که مانند صفحه دوره ها باشد و همان عمل را صدا کن
13 کلمه "رویکرد آموزشی ما" و کلا متونی مانند این برای معرفی هر سکشن باید بزرگ تر باشد ## فوتر
14- تمام سکشن ها باید عرض یکسان داشته باشند و هیچکدام تمام صفحه نشوند - [x] 16. دسترسی سریع: سایت دانشکده + شبکه اساتید
15- رویداد ها فعلا هاید شود
16- دسترسی سریع باید سایت دانشکده و شبکه اساتید را داشته باشد ## هویت بصری
17- ماهم باید اساتید را از دانشکده کپی کنیم (خودت بخون) و صرفا رفرنسشان را داشته باشیم تا در دوره ها اگر نیاز شد بهشون لینک بدیم (به صفحشون تو دانشکده) - [x] 3. فونت وزیرمتن (Vazirmatn)
18- در صفحه دوره ها باید دسته بندی ها بزرک تر باشه، تگ ها از اون یکی یکم کوچک تر - [x] 7. لوگوی دانشکده (نشان بدون متن کناری؛ favicon از MstAut)
19- سرچ بار هامون باید آیکون باشه و با زدن آیکون سرچ بار باز بشه. یعنی همه جا سرچ آیکون با دسته بندی ها باشه و با انیمشن سرچ اینچپوپ جایگزین دسته بندی بشه (به جز هدر که دسته بندی نمی خواد) - [x] 10. همه جا «دانشگاه صنعتی امیرکبیر» (نه «امیرکبیر» کوتاه)
20 -روی کارت دوره ها همش قابل کلیک باشد ننه صرفا دکمه جزییات - [blocked] 11. پالت رنگی جدید از mst (کاربر می‌دهد)
21- لیبل روی کارت دوره ها هم کلیلک پذیر باشد تا فیلتر دسته بندی و تگ را هم انجام دهد برای کاربر. در جزییات دوره هم همین باشد
## صفحه اصلی
- [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. لیبل دسته/تگ روی کارت و جزئیات دوره کلیک‌پذیر (فیلتر)
+15
View File
@@ -44,6 +44,21 @@
| تب | `Tabs` | | تب | `Tabs` |
| اسکلتون | `Skeleton` | | اسکلتون | `Skeleton` |
| نشان | `Badge` | | نشان | `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`.
--- ---
+8 -8
View File
@@ -1,17 +1,17 @@
# Active Context # Active Context
## Current Goal ## Current Goal
تاکسونومی دوره (دسته + تگ ادمین‌محور) پیاده شد (D25). لیبل ریشهٔ منو همچنان `courseNavParentTag` = «دوره‌ها». چک‌لیست UI در `docs/Todo.Md` پیاده شد؛ سه آیتم blocked منتظر کاربر.
## Current Work ## Current Work
- جداول `course_categories` / `course_tags` + junction؛ migration `007_course_taxonomy.sql` - انجام‌شده: هدر/ناو/فوتر، فونت Vazirmatn، هوم، سرچ/کارت دوره‌ها، اسکیما اساتید (`profile_url` + `course_faculty_links`)
- ادمین: `/admin/course-categories`، `/admin/course-tags`؛ فرم دوره چندانتخابی - لوگو دانشکده اعمال شد (`/brand/mst-faculty.png` + favicon)
- عمومی: منو از تگ‌های `show_in_nav`؛ فیلتر `/professional?tag=` و `?category=` با slug - Blocked: پالت رنگی mst (۱۱)، seed اساتید پس از دسترسی (۱۷c)
- مستند: `docs/LINKS.md`، domain-rules، D25
## Current Blockers ## Current Blockers
بدون مانع. - پالت رنگی از کاربر
- دسترسی به شبکه اساتید mst برای کپی داده
## Next Steps ## Next Steps
1. `node db/migrate.mjs` سپس در صورت نیاز `node db/seed.mjs` روی محیط‌های موجود 1. دریافت پالت و به‌روزرسانی توکن‌های `globals.css`
2. محتوای واقعی دسته/تگ/دوره از پنل ادمین 2. پس از دسترسی mst: seed اساتید با `profileUrl`
+3
View File
@@ -42,7 +42,10 @@
## Next ## Next
- [x] فاز H باقی‌مانده — ایندکس‌ها، docs/README نهایی، حذف وابستگی runtime به mock، smoke script - [x] فاز H باقی‌مانده — ایندکس‌ها، docs/README نهایی، حذف وابستگی runtime به mock، smoke script
- [x] Todo UI سایت (هدر/هوم/دوره‌ها/فونت/اسکیما اساتید) — جزئیات در `docs/Todo.Md`
- [ ] محتوای واقعی از پنل ادمین (طبق دستور کاربر بعداً) - [ ] محتوای واقعی از پنل ادمین (طبق دستور کاربر بعداً)
- [x] لوگوی دانشکده (نشان بدون متن کناری + favicon)
- [ ] Todo blocked: پالت mst، seed اساتید از شبکه دانشکده
## Milestones ## Milestones
| مرحله | وضعیت | تاریخ | | مرحله | وضعیت | تاریخ |
+3 -2
View File
@@ -1,7 +1,7 @@
{ {
"meta": { "meta": {
"homeTitle": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر", "homeTitle": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر",
"homeDescription": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر؛ آموزش مدیران برای تحول در صنعت با تصمیم‌گیری داده‌محور، هوش مصنوعی و مدیریت تغییر.", "homeDescription": "مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر؛ پیوند دانش مدیریت، فناوری و تجربه برای مواجهه با مسائل کسب‌وکار.",
"professionalTitle": "دوره‌های کوتاه و گواهی‌محور | مدیریت علم و فناوری", "professionalTitle": "دوره‌های کوتاه و گواهی‌محور | مدیریت علم و فناوری",
"professionalDescription": "دوره‌های آنلاین و ترکیبی برای مدیران و متخصصان؛ فهرست دوره‌ها و اعلام علاقه به ثبت‌نام." "professionalDescription": "دوره‌های آنلاین و ترکیبی برای مدیران و متخصصان؛ فهرست دوره‌ها و اعلام علاقه به ثبت‌نام."
}, },
@@ -81,13 +81,14 @@
"offeredBy": "دانشکده مدیریت علم و فناوری — دانشگاه صنعتی امیرکبیر", "offeredBy": "دانشکده مدیریت علم و فناوری — دانشگاه صنعتی امیرکبیر",
"statsTitle": "دانشکده در یک نگاه", "statsTitle": "دانشکده در یک نگاه",
"rankTitle": "یادگیری در دانشگاه صنعتی امیرکبیر", "rankTitle": "یادگیری در دانشگاه صنعتی امیرکبیر",
"testimonialsTitle": "نظر شرکت‌کنندگان",
"advisor": "مشاوره ثبت‌نام", "advisor": "مشاوره ثبت‌نام",
"dppTitle": "یادگیری آنلاین و ترکیبی", "dppTitle": "یادگیری آنلاین و ترکیبی",
"dppBody": "محتوای به‌روز با تمرین و پروژه؛ مناسب شاغلانی که زمان محدود دارند." "dppBody": "محتوای به‌روز با تمرین و پروژه؛ مناسب شاغلانی که زمان محدود دارند."
}, },
"footer": { "footer": {
"links": "دسترسی سریع", "links": "دسترسی سریع",
"facultySite": "دانشکده",
"facultyNetwork": "شبکه اساتید",
"press": "روابط عمومی", "press": "روابط عمومی",
"careers": "همکاری با ما", "careers": "همکاری با ما",
"copyright": "© {year} مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر" "copyright": "© {year} مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر"
+7
View File
@@ -20,6 +20,7 @@
"react-dom": "19.2.8", "react-dom": "19.2.8",
"shadcn": "^4.21.0", "shadcn": "^4.21.0",
"tw-animate-css": "^1.4.0", "tw-animate-css": "^1.4.0",
"vazirmatn": "^33.0.3",
"zod": "^4.6.5" "zod": "^4.6.5"
}, },
"devDependencies": { "devDependencies": {
@@ -10565,6 +10566,12 @@
"node": ">= 0.8" "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": { "node_modules/which": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+1
View File
@@ -25,6 +25,7 @@
"react-dom": "19.2.8", "react-dom": "19.2.8",
"shadcn": "^4.21.0", "shadcn": "^4.21.0",
"tw-animate-css": "^1.4.0", "tw-animate-css": "^1.4.0",
"vazirmatn": "^33.0.3",
"zod": "^4.6.5" "zod": "^4.6.5"
}, },
"devDependencies": { "devDependencies": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

+291
View File
@@ -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(/&amp;/g, "&")
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&quot;/g, '"')
.replace(/&#39;/g, "'")
.replace(/&nbsp;/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 =
/<div class="mstf-card([^"]*)"([\s\S]*?)<\/div>\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>[^<]*<\/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"><img[^>]+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);
});
+24
View File
@@ -0,0 +1,24 @@
import fs from "node:fs";
const html = fs.readFileSync("tmp-faculty.html", "utf8");
const cardRe = /<div class="mstf-card[^"]*"[\s\S]*?<\/div>\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>[^<]*<\/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"><img[^>]+src="([^"]+)"/)?.[1];
console.log({ name, pill, dept, focus, email, phone, linkedin, scholar, img });
}
+39
View File
@@ -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();
+4 -1
View File
@@ -32,7 +32,10 @@ if (!process.env.DATABASE_URL) {
const client = new Client({ const client = new Client({
connectionString: process.env.DATABASE_URL, 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 { try {
+7 -17
View File
@@ -3,14 +3,9 @@ import { notFound } from "next/navigation";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { FormCard } from "@/components/molecules/FormCard";
import { PageHero } from "@/components/molecules/PageHero"; import { PageHero } from "@/components/molecules/PageHero";
import { ContactInterestForm } from "@/components/organisms/ContactInterestForm"; import { ContactInterestForm } from "@/components/organisms/ContactInterestForm";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { getLegalPage } from "@/lib/data/site"; import { getLegalPage } from "@/lib/data/site";
type Props = { params: Promise<{ slug: string }> }; type Props = { params: Promise<{ slug: string }> };
@@ -38,26 +33,21 @@ export default async function LegalSlugPage({ params }: Props) {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={page.title} /> <PageHero title={page.title} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container className="grid gap-10 lg:grid-cols-2"> <Container className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] lg:items-start">
<div className="space-y-5 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border sm:p-10"> <div className="min-w-0 space-y-5">
{page.body.map((paragraph) => ( {page.body.map((paragraph) => (
<p key={paragraph} className="leading-8 text-foreground/90"> <p key={paragraph} className="text-base leading-8 text-foreground/90">
{paragraph} {paragraph}
</p> </p>
))} ))}
</div> </div>
<Card className="rounded-2xl border-border/70 shadow-lg"> <FormCard title="ارسال پیام">
<CardHeader>
<CardTitle>ارسال پیام</CardTitle>
</CardHeader>
<CardContent>
<ContactInterestForm <ContactInterestForm
submitLabel={t("submit")} submitLabel={t("submit")}
successLabel={t("registerSuccess")} successLabel={t("registerSuccess")}
/> />
</CardContent> </FormCard>
</Card>
</Container> </Container>
</Section> </Section>
</main> </main>
+7 -54
View File
@@ -1,19 +1,15 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import Link from "next/link";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { Container } from "@/components/atoms/Container"; import { AboutTemplate } from "@/components/templates/AboutTemplate";
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 { getTopics } from "@/lib/data/site"; import { getTopics } from "@/lib/data/site";
import { aboutFocusAreas, siteMission } from "@/lib/site-config"; import { aboutContent } from "@/lib/site-config";
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("pages"); const t = await getTranslations("pages");
return { title: t("aboutTitle"), description: siteMission }; return {
title: t("aboutTitle"),
description: aboutContent.intro,
};
} }
export default async function AboutPage() { export default async function AboutPage() {
@@ -21,50 +17,7 @@ export default async function AboutPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero <AboutTemplate topics={topics} />
eyebrow="درباره مرکز آموزش‌های آزاد"
title="آموزش مدیریت با پشتوانه امیرکبیر"
intro="مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر، بر آموزش مدیران و تیم‌های مدیریتی برای تحول در صنعت تمرکز دارد. دوره‌های ما به تصمیم‌گیری داده‌محور، به‌کارگیری هوش مصنوعی در کسب‌وکار و مدیریت اجرای تغییر در سازمان می‌پردازند."
/>
<Section className="relative overflow-hidden">
<Container>
<p className="text-xs font-bold text-primary">آنچه می‌آموزید</p><Heading level={2} className="mt-2 text-3xl sm:text-4xl">توانمندی‌های مدیریتی برای تحول در صنعت</Heading>
<div className="mt-8 grid gap-4 sm:grid-cols-2">
{aboutFocusAreas.map((area) => (
<SurfaceCard key={area.title}>
<Heading as="h3" level={4}>
{area.title}
</Heading>
<p className="mt-2 text-sm text-muted-foreground">
{area.description}
</p>
</SurfaceCard>
))}
</div>
</Container>
</Section>
<Section tone="muted">
<Container>
<p className="text-xs font-bold text-primary">حوزه‌های آموزشی</p><Heading level={2} className="mt-2 text-3xl sm:text-4xl">موضوع مورد نیاز خود را پیدا کنید</Heading>
<div className="mt-6 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
{topics.map((topic) => (
<SurfaceCard key={topic.id} padded="sm" className="h-full">
<Link href={topic.href} className="block">
<span className="font-semibold hover:text-primary">
{topic.title}
</span>
<p className="mt-2 text-sm text-muted-foreground">
{topic.description}
</p>
</Link>
</SurfaceCard>
))}
</div>
<Link href="/programs" className={cn(buttonVariants(), "mt-8")}>
مشاهده برنامه‌های آموزشی
</Link>
</Container>
</Section>
</main> </main>
); );
} }
+6 -6
View File
@@ -21,26 +21,26 @@ export default async function AlumniPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={t("alumniTitle")} intro={t("alumniIntro")} /> <PageHero title={t("alumniTitle")} intro={t("alumniIntro")} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container> <Container>
<div className="grid gap-8 md:grid-cols-3"> <div className="grid gap-5 md:grid-cols-3">
{stories.map((story) => ( {stories.map((story) => (
<SurfaceCard <SurfaceCard
key={story.id} key={story.id}
id={story.id} id={story.id}
padded={false} padded={false}
className="group scroll-mt-24 overflow-hidden rounded-2xl" className="scroll-mt-24"
> >
<div className="relative aspect-[16/10]"> <div className="relative aspect-[16/10] bg-muted">
<Image <Image
src={story.imageUrl} src={story.imageUrl}
alt={story.name} alt={story.name}
fill fill
className="object-cover transition-transform duration-500 group-hover:scale-[1.03]" className="object-cover"
sizes="(max-width:768px) 100vw, 33vw" sizes="(max-width:768px) 100vw, 33vw"
/> />
</div> </div>
<div className="p-5"> <div className="p-6">
<BadgeLabel>{story.program}</BadgeLabel> <BadgeLabel>{story.program}</BadgeLabel>
<Heading as="h2" level={4} className="mt-3"> <Heading as="h2" level={4} className="mt-3">
{story.title} {story.title}
+7 -47
View File
@@ -1,17 +1,11 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { PageHero } from "@/components/molecules/PageHero"; 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 { 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<Metadata> { export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("pages"); const t = await getTranslations("pages");
@@ -24,49 +18,15 @@ export default async function ContactPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={t("contactTitle")} intro={t("contactIntro")} /> <PageHero title={t("contactTitle")} intro={t("contactIntro")} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container className="grid gap-10 lg:grid-cols-2"> <Container className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] lg:items-start">
<div className="space-y-5 lg:pt-4"> <ContactDetails />
<Heading level={2}>اطلاعات تماس</Heading> <FormCard title="ارسال پیام">
<div className="space-y-3 text-sm leading-7 text-muted-foreground">
<p>
<span className="font-semibold text-foreground">آدرس: </span>
{siteAddress.line}
</p>
<p dir="ltr">
<span className="font-semibold text-foreground">تلفن: </span>
{siteAddress.phone}
</p>
<p>
<span className="font-semibold text-foreground">ایمیل: </span>
<a
href={`mailto:${siteAddress.email}`}
className="text-primary hover:underline"
>
{siteAddress.email}
</a>
</p>
<a
href={siteAddress.mapUrl}
className="inline-block text-primary hover:underline"
target="_blank"
rel="noreferrer"
>
مشاهده روی نقشه
</a>
</div>
</div>
<Card className="rounded-2xl border-border/70 shadow-lg">
<CardHeader>
<CardTitle>ارسال پیام</CardTitle>
</CardHeader>
<CardContent>
<ContactInterestForm <ContactInterestForm
submitLabel={t("submit")} submitLabel={t("submit")}
successLabel={t("registerSuccess")} successLabel={t("registerSuccess")}
/> />
</CardContent> </FormCard>
</Card>
</Container> </Container>
</Section> </Section>
</main> </main>
+3 -28
View File
@@ -1,35 +1,10 @@
"use client"; "use client";
import { useEffect } from "react"; import { ErrorState } from "@/components/organisms/ErrorState";
import { DotCta } from "@/components/atoms/DotCta";
import { Button } from "@/components/ui/button";
export default function MainError({ export default function MainError(props: {
error,
reset,
}: {
error: Error & { digest?: string }; error: Error & { digest?: string };
reset: () => void; reset: () => void;
}) { }) {
useEffect(() => { return <ErrorState {...props} />;
console.error(error);
}, [error]);
return (
<div className="mx-auto flex min-h-[50vh] w-full max-w-7xl flex-col items-start justify-center px-5 py-20 sm:px-8 lg:px-12">
<p className="text-sm font-semibold text-primary">خطا</p>
<h1 className="mt-3 text-2xl font-bold tracking-tight sm:text-3xl">
بارگذاری صفحه ناموفق بود
</h1>
<p className="mt-3 max-w-md text-base leading-relaxed text-muted-foreground">
لطفاً دوباره تلاش کنید. اگر مشکل ادامه داشت، چند لحظه بعد بازگردید.
</p>
<div className="mt-8 flex flex-wrap gap-4">
<Button type="button" onClick={reset}>
تلاش مجدد
</Button>
<DotCta href="/">بازگشت به خانه</DotCta>
</div>
</div>
);
} }
+34 -24
View File
@@ -1,14 +1,23 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
import { CalendarDays, MapPin } from "lucide-react";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading"; import { Heading } from "@/components/atoms/Heading";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { TextLink } from "@/components/atoms/TextLink"; import { TextLink } from "@/components/atoms/TextLink";
import { DetailList } from "@/components/molecules/DetailList";
import { PageHero } from "@/components/molecules/PageHero"; import { PageHero } from "@/components/molecules/PageHero";
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
import { getEventById } from "@/lib/data/events"; import { getEventById } from "@/lib/data/events";
type Props = { params: Promise<{ id: string }> }; type Props = { params: Promise<{ id: string }> };
const dateFormat: Intl.DateTimeFormatOptions = {
year: "numeric",
month: "long",
day: "numeric",
};
export async function generateMetadata({ params }: Props): Promise<Metadata> { export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { id } = await params; const { id } = await params;
const event = await getEventById(id); const event = await getEventById(id);
@@ -21,36 +30,37 @@ export default async function EventDetailPage({ params }: Props) {
const event = await getEventById(id); const event = await getEventById(id);
if (!event) notFound(); if (!event) notFound();
const start = new Date(event.startDate).toLocaleDateString("fa-IR", { const start = new Date(event.startDate).toLocaleDateString("fa-IR", dateFormat);
year: "numeric",
month: "long",
day: "numeric",
});
const end = event.endDate const end = event.endDate
? new Date(event.endDate).toLocaleDateString("fa-IR", { ? new Date(event.endDate).toLocaleDateString("fa-IR", dateFormat)
year: "numeric",
month: "long",
day: "numeric",
})
: null; : null;
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={event.title} intro={event.summary} /> <PageHero title={event.title} intro={event.summary} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container narrow className="space-y-5 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border sm:p-10"> <Container narrow className="space-y-6">
<p className="text-sm"> <SurfaceCard padded as="div">
<span className="font-semibold">زمان: </span> <DetailList
{start} items={[
{end ? ` تا ${end}` : ""} {
</p> icon: CalendarDays,
<p className="text-sm"> label: "زمان",
<span className="font-semibold">مکان: </span> value: end ? `${start} تا ${end}` : start,
{event.location} },
</p> { icon: MapPin, label: "مکان", value: event.location },
<Heading level={3}>درباره رویداد</Heading> ]}
<p className="leading-8 text-foreground/90">{event.summary}</p> />
<TextLink href="/events">بازگشت به رویدادها</TextLink> </SurfaceCard>
<section className="space-y-4">
<Heading level={3} as="h2">
درباره رویداد
</Heading>
<p className="text-base leading-8 text-foreground/90">{event.summary}</p>
</section>
<TextLink href="/events" className="inline-block text-sm">
بازگشت به رویدادها
</TextLink>
</Container> </Container>
</Section> </Section>
</main> </main>
+1 -1
View File
@@ -18,7 +18,7 @@ export default async function EventsPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={t("eventsTitle")} intro={t("eventsIntro")} /> <PageHero title={t("eventsTitle")} intro={t("eventsIntro")} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container> <Container>
<div className="grid gap-4 md:grid-cols-2"> <div className="grid gap-4 md:grid-cols-2">
{events.map((event) => ( {events.map((event) => (
+2 -1
View File
@@ -1,5 +1,6 @@
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { facultyNetworkUrl } from "@/lib/site-config";
export default function FacultyPage() { export default function FacultyPage() {
redirect("https://mst.aut.ac.ir/content/31094/شبکه-اساتید"); redirect(facultyNetworkUrl);
} }
+12 -19
View File
@@ -2,11 +2,9 @@ import type { Metadata } from "next";
import Image from "next/image"; import Image from "next/image";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading";
import { Section } from "@/components/atoms/Section"; 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 { TextLink } from "@/components/atoms/TextLink";
import { PageHero } from "@/components/molecules/PageHero";
import { getArticleById } from "@/lib/data/articles"; import { getArticleById } from "@/lib/data/articles";
import { JsonLd } from "@/lib/seo/json-ld"; import { JsonLd } from "@/lib/seo/json-ld";
@@ -39,21 +37,14 @@ export default async function InsightDetailPage({ params }: Props) {
image: article.imageUrl, image: article.imageUrl,
}} }}
/> />
<Section tone="dark" className="relative overflow-hidden pb-16 pt-16 sm:pb-20 sm:pt-20"> <PageHero
<MetamorphField tone="dark" density="sparse" className="opacity-35" /> eyebrow={article.category}
<Container narrow className="relative z-[1]"> title={article.title}
<BadgeLabel>{article.category}</BadgeLabel> intro={`${article.author} · ${date}`}
<Heading as="h1" level={1} className="mt-4 text-background"> />
{article.title} <Section tone="subtle">
</Heading>
<p className="mt-3 text-sm text-background/60">
{article.author} · {date}
</p>
</Container>
</Section>
<Section className="bg-gradient-to-b from-background to-muted/40 pt-10">
<Container narrow> <Container narrow>
<div className="relative mb-10 aspect-[16/9] overflow-hidden rounded-2xl bg-muted shadow-xl"> <div className="relative mb-10 aspect-[16/9] overflow-hidden rounded-2xl bg-muted ring-1 ring-foreground/10">
<Image <Image
src={article.imageUrl} src={article.imageUrl}
alt={article.title} alt={article.title}
@@ -63,8 +54,10 @@ export default async function InsightDetailPage({ params }: Props) {
priority priority
/> />
</div> </div>
<p className="text-lg leading-9 text-foreground/90">{article.body}</p> <p className="text-base leading-8 text-foreground/90 sm:text-lg sm:leading-9">
<TextLink href="/insights" className="mt-10 inline-block"> {article.body}
</p>
<TextLink href="/insights" className="mt-10 inline-block text-sm">
بازگشت به مقالات بازگشت به مقالات
</TextLink> </TextLink>
</Container> </Container>
+1 -1
View File
@@ -18,7 +18,7 @@ export default async function InsightsPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={t("insightsTitle")} intro={t("insightsIntro")} /> <PageHero title={t("insightsTitle")} intro={t("insightsIntro")} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container> <Container>
<div className="mx-auto max-w-5xl"> <div className="mx-auto max-w-5xl">
{articles.map((article) => ( {articles.map((article) => (
+8 -5
View File
@@ -7,7 +7,11 @@ import { getCourses } from "@/lib/data/courses";
import { listPublishedCourseTags } from "@/lib/data/taxonomy"; import { listPublishedCourseTags } from "@/lib/data/taxonomy";
import { getPrograms } from "@/lib/data/programs"; import { getPrograms } from "@/lib/data/programs";
import { getCampaignBanners } from "@/lib/data/site"; 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 // Public CMS pages must read Postgres at request time — static bake at Docker
// build often has no DATABASE_URL and ships empty lists. // build often has no DATABASE_URL and ships empty lists.
@@ -42,12 +46,9 @@ export default async function MainLayout({
<SiteHeader <SiteHeader
items={navItems} items={navItems}
searchLabel={t("nav.search")} searchLabel={t("nav.search")}
contactLabel={t("nav.contact")}
brandTitle={siteShortName} brandTitle={siteShortName}
brandSubtitle={t("nav.brandSubtitle")} brandSubtitle={t("nav.brandSubtitle")}
academicsLabel={t("nav.academics")}
programSelectorTitle={t("home.programSelectorTitle")}
executiveLabel={t("home.executiveLabel")}
exploreLabel={t("home.exploreOurPrograms")}
variant="home" variant="home"
courses={courses} courses={courses}
programs={programs} programs={programs}
@@ -58,6 +59,8 @@ export default async function MainLayout({
copyright={t("footer.copyright", { year })} copyright={t("footer.copyright", { year })}
linksTitle={t("footer.links")} linksTitle={t("footer.links")}
links={[ links={[
{ label: t("footer.facultySite"), href: facultySiteUrl },
{ label: t("footer.facultyNetwork"), href: facultyNetworkUrl },
{ label: t("footer.press"), href: "/press" }, { label: t("footer.press"), href: "/press" },
{ label: t("footer.careers"), href: "/careers" }, { label: t("footer.careers"), href: "/careers" },
]} ]}
+32
View File
@@ -0,0 +1,32 @@
import Link from "next/link";
import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading";
import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
export default function NotFound() {
return (
<main id="main-content" className="bg-background">
<Container className="flex min-h-[60vh] flex-col items-start justify-center py-20">
<p className="text-sm font-bold text-primary sm:text-base">۴۰۴</p>
<Heading as="h1" level={2} className="mt-3">
صفحه مورد نظر یافت نشد
</Heading>
<p className="mt-4 max-w-md text-base leading-8 text-muted-foreground">
ممکن است این صفحه جابه‌جا یا حذف شده باشد.
</p>
<div className="mt-8 flex flex-wrap gap-3">
<Link href="/" className={cn(buttonVariants({ size: "lg" }), "font-bold")}>
بازگشت به خانه
</Link>
<Link
href="/professional"
className={buttonVariants({ variant: "outline", size: "lg" })}
>
مشاهده دوره‌ها
</Link>
</div>
</Container>
</main>
);
}
+36 -62
View File
@@ -1,14 +1,14 @@
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { import {
HomeEvents, HomeApproach,
HomeCourseSearch,
HomeHero, HomeHero,
HomeIdeas, HomeIdeas,
HomeRest, HomeRest,
type HomeLabels, type HomeLabels,
} from "@/components/templates/HomeTemplate"; } from "@/components/templates/HomeTemplate";
import { getFeaturedArticle } from "@/lib/data/articles"; import { getFeaturedArticle } from "@/lib/data/articles";
import { getEvents } from "@/lib/data/events"; import { getLatestCourses } from "@/lib/data/courses";
import { getPrograms } from "@/lib/data/programs";
import { getSiteStats, getTopics } from "@/lib/data/site"; import { getSiteStats, getTopics } from "@/lib/data/site";
async function getLabels(): Promise<HomeLabels> { async function getLabels(): Promise<HomeLabels> {
@@ -31,84 +31,57 @@ async function getLabels(): Promise<HomeLabels> {
findUsTitle: t("home.findUsTitle"), findUsTitle: t("home.findUsTitle"),
ideasEyebrow: t("home.ideasEyebrow"), ideasEyebrow: t("home.ideasEyebrow"),
linksTitle: t("footer.links"), linksTitle: t("footer.links"),
exploreCourses: t("nav.exploreCourses"),
}; };
} }
async function HeroSection() { async function orFallback<T>(
label: string,
load: () => Promise<T>,
fallback: T,
): Promise<T> {
try { try {
return await load();
} catch (err) {
console.error(`[home] ${label} failed:`, err);
return fallback;
}
}
async function HeroSection() {
const [featured, labels] = await Promise.all([ const [featured, labels] = await Promise.all([
getFeaturedArticle(), orFallback("featured article", getFeaturedArticle, null),
getLabels(), getLabels(),
]); ]);
return <HomeHero featured={featured} eyebrow={labels.ideasEyebrow} />; return <HomeHero featured={featured} eyebrow={labels.ideasEyebrow} />;
} catch (err) {
console.error("[home] HeroSection failed:", err);
const labels = await getLabels();
return <HomeHero featured={null} eyebrow={labels.ideasEyebrow} />;
}
} }
async function EventsSection() { async function CourseSearchSection() {
try { const data = await orFallback(
const [events, labels] = await Promise.all([getEvents(), getLabels()]); "latest courses",
() =>
Promise.all([getLatestCourses(6), getLabels()]),
null,
);
if (!data) return null;
const [courses, labels] = data;
return ( return (
<HomeEvents <HomeCourseSearch
events={events} courses={courses}
title={labels.eventsTitle} exploreLabel={labels.exploreCourses}
seeAllLabel={labels.seeAllEvents}
/> />
); );
} catch (err) {
console.error("[home] EventsSection failed:", err);
const labels = await getLabels();
return (
<HomeEvents
events={[]}
title={labels.eventsTitle}
seeAllLabel={labels.seeAllEvents}
/>
);
}
} }
async function RestSection() { async function RestSection() {
try { const [intersections, stats, labels] = await Promise.all([
const [programs, intersections, stats, labels] = await Promise.all([ orFallback("topics", getTopics, []),
getPrograms(), orFallback("site stats", getSiteStats, []),
getTopics(),
getSiteStats(),
getLabels(), getLabels(),
]); ]);
const carouselPrograms = programs.filter((p) =>
[
"management-core",
"evening-management",
"executive",
"leadership-fellows",
"business-analytics",
"finance",
].includes(p.slug),
);
return ( return (
<HomeRest <HomeRest labels={labels} intersections={intersections} stats={stats} />
labels={labels}
carouselPrograms={carouselPrograms}
intersections={intersections}
stats={stats}
/>
); );
} catch (err) {
console.error("[home] RestSection failed:", err);
const labels = await getLabels();
return (
<HomeRest
labels={labels}
carouselPrograms={[]}
intersections={[]}
stats={[]}
/>
);
}
} }
export default function HomePage() { export default function HomePage() {
@@ -116,7 +89,8 @@ export default function HomePage() {
<main id="main-content"> <main id="main-content">
<HeroSection /> <HeroSection />
<HomeIdeas /> <HomeIdeas />
<EventsSection /> <CourseSearchSection />
<HomeApproach />
<RestSection /> <RestSection />
</main> </main>
); );
+37 -32
View File
@@ -6,7 +6,10 @@ import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading"; import { Heading } from "@/components/atoms/Heading";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { TextLink } from "@/components/atoms/TextLink"; 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 { PageHero } from "@/components/molecules/PageHero";
import { SectionHeader } from "@/components/molecules/SectionHeader";
import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { SurfaceCard } from "@/components/molecules/SurfaceCard";
import { buttonVariants } from "@/components/ui/button"; import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@@ -43,66 +46,68 @@ export default async function ProgramDetailPage({ params }: Props) {
intro={program.blurb} intro={program.blurb}
eyebrow={program.tagline} eyebrow={program.tagline}
/> />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container className="grid gap-10 lg:grid-cols-[2fr_1fr]"> <Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
<div> <div className="min-w-0 space-y-10">
<p className="text-base leading-8 text-foreground/90">{program.body}</p> <p className="text-base leading-8 text-foreground/90">{program.body}</p>
<Heading level={2} className="mt-10"> {program.highlights.length > 0 ? (
<section className="space-y-4">
<Heading level={3} as="h2">
{t("highlights")} {t("highlights")}
</Heading> </Heading>
<ul className="mt-4 list-disc space-y-2 ps-5 text-sm leading-7"> <CheckList items={program.highlights} />
{program.highlights.map((item) => ( </section>
<li key={item}>{item}</li> ) : null}
))}
</ul>
</div> </div>
<aside className="h-fit space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border"> <aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
<p className="text-sm"> <SurfaceCard padded as="div">
<span className="font-semibold">مخاطب: </span> <DetailList
{program.audience} items={[
</p> { label: "مخاطب", value: program.audience },
<p className="text-sm"> { label: "مدت", value: program.durationLabel },
<span className="font-semibold">مدت: </span> { label: "فرمت", value: program.formatLabel },
{program.durationLabel} ]}
</p> />
<p className="text-sm">
<span className="font-semibold">فرمت: </span>
{program.formatLabel}
</p>
<Link <Link
href="/professional" href="/professional"
className={cn(buttonVariants(), "w-full")} className={cn(buttonVariants({ size: "lg" }), "mt-6 w-full font-bold")}
> >
مشاهده دوره‌ها مشاهده دوره‌ها
</Link> </Link>
<TextLink href="/programs" className="block text-sm"> </SurfaceCard>
<TextLink href="/programs" className="block px-1 text-sm">
{t("backToPrograms")} {t("backToPrograms")}
</TextLink> </TextLink>
</aside> </aside>
</Container> </Container>
</Section> </Section>
{related.length > 0 ? (
<Section tone="muted"> <Section tone="muted">
<Container> <Container>
<Heading level={2}>{t("relatedCourses")}</Heading> <SectionHeader title={t("relatedCourses")} />
<ul className="mt-6 grid gap-4 sm:grid-cols-3"> <ul className="grid gap-4 sm:grid-cols-3">
{related.map((course) => ( {related.map((course) => (
<li key={course.id}> <li key={course.id}>
<SurfaceCard padded="sm" as="div" className="h-full"> <Link href={course.registrationUrl} className="group block h-full">
<Link <SurfaceCard padded as="div" interactive className="h-full">
href={course.registrationUrl} <Heading
className="font-semibold hover:text-primary" as="h3"
level={4}
className="transition-colors group-hover:text-primary"
> >
{course.title} {course.title}
</Link> </Heading>
<p className="mt-2 line-clamp-3 text-sm text-muted-foreground"> <p className="mt-2 line-clamp-3 text-sm leading-7 text-muted-foreground">
{course.summary} {course.summary}
</p> </p>
</SurfaceCard> </SurfaceCard>
</Link>
</li> </li>
))} ))}
</ul> </ul>
</Container> </Container>
</Section> </Section>
) : null}
</main> </main>
); );
} }
+20 -23
View File
@@ -5,7 +5,9 @@ import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading"; import { Heading } from "@/components/atoms/Heading";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { BadgeLabel } from "@/components/atoms/BadgeLabel"; import { BadgeLabel } from "@/components/atoms/BadgeLabel";
import { DetailList } from "@/components/molecules/DetailList";
import { PageHero } from "@/components/molecules/PageHero"; import { PageHero } from "@/components/molecules/PageHero";
import { SectionHeader } from "@/components/molecules/SectionHeader";
import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { SurfaceCard } from "@/components/molecules/SurfaceCard";
import { buttonVariants } from "@/components/ui/button"; import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@@ -28,8 +30,8 @@ export default async function ProgramsPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero title={t("programsTitle")} intro={t("programsIntro")} /> <PageHero title={t("programsTitle")} intro={t("programsIntro")} />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container className="space-y-10"> <Container className="space-y-16">
<ProgramGroup title={t("standardGroup")} items={standard} /> <ProgramGroup title={t("standardGroup")} items={standard} />
<ProgramGroup title={t("executiveGroup")} items={executive} /> <ProgramGroup title={t("executiveGroup")} items={executive} />
</Container> </Container>
@@ -45,40 +47,35 @@ function ProgramGroup({
title: string; title: string;
items: Awaited<ReturnType<typeof getPrograms>>; items: Awaited<ReturnType<typeof getPrograms>>;
}) { }) {
if (items.length === 0) return null;
return ( return (
<div> <div>
<Heading level={2} className="mb-6"> <SectionHeader title={title} className="mb-6 sm:mb-8" />
{title}
</Heading>
<div className="grid gap-5 md:grid-cols-2"> <div className="grid gap-5 md:grid-cols-2">
{items.map((program) => ( {items.map((program) => (
<SurfaceCard key={program.id} className="flex flex-col rounded-2xl p-6 sm:p-7"> <SurfaceCard key={program.id} padded className="flex flex-col">
{program.tagline ? (
<BadgeLabel className="w-fit">{program.tagline}</BadgeLabel> <BadgeLabel className="w-fit">{program.tagline}</BadgeLabel>
) : null}
<Heading as="h3" level={3} className="mt-3"> <Heading as="h3" level={3} className="mt-3">
<Link href={program.href} className="hover:text-primary"> <Link href={program.href} className="transition-colors hover:text-primary">
{program.title} {program.title}
</Link> </Link>
</Heading> </Heading>
<p className="mt-2 flex-1 text-sm leading-relaxed text-muted-foreground"> <p className="mt-2 flex-1 text-sm leading-7 text-muted-foreground">
{program.blurb} {program.blurb}
</p> </p>
<dl className="mt-4 grid grid-cols-2 gap-2 text-xs text-muted-foreground"> <DetailList
<div> className="mt-5 border-t border-border pt-4"
<dt className="font-semibold text-foreground">مخاطب</dt> items={[
<dd>{program.audience}</dd> { label: "مخاطب", value: program.audience },
</div> { label: "مدت", value: program.durationLabel },
<div> { label: "فرمت", value: program.formatLabel },
<dt className="font-semibold text-foreground">مدت</dt> ]}
<dd>{program.durationLabel}</dd> />
</div>
<div>
<dt className="font-semibold text-foreground">فرمت</dt>
<dd>{program.formatLabel}</dd>
</div>
</dl>
<Link <Link
href={program.href} href={program.href}
className={cn(buttonVariants({ variant: "outline" }), "mt-5 w-fit")} className={cn(buttonVariants({ variant: "outline" }), "mt-6 w-fit")}
> >
جزئیات برنامه جزئیات برنامه
</Link> </Link>
+18 -15
View File
@@ -4,9 +4,10 @@ import { notFound } from "next/navigation";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { TextLink } from "@/components/atoms/TextLink"; import { TextLink } from "@/components/atoms/TextLink";
import { CheckList } from "@/components/molecules/CheckList";
import { PageHero } from "@/components/molecules/PageHero"; import { PageHero } from "@/components/molecules/PageHero";
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
import { buttonVariants } from "@/components/ui/button"; import { buttonVariants } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { getTopicBySlug } from "@/lib/data/site"; import { getTopicBySlug } from "@/lib/data/site";
@@ -31,25 +32,27 @@ export default async function TopicPage({ params }: Props) {
intro={topic.description} intro={topic.description}
imageUrl={topic.imageUrl} imageUrl={topic.imageUrl}
/> />
<Section className="bg-gradient-to-b from-background to-muted/40"> <Section tone="subtle">
<Container className="grid gap-10 lg:grid-cols-[2fr_1fr]"> <Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
<div> <div className="min-w-0 space-y-8">
<p className="text-base leading-8">{topic.body}</p> <p className="text-base leading-8 text-foreground/90">{topic.body}</p>
<ul className="mt-8 list-disc space-y-2 ps-5 text-sm"> {topic.highlights.length > 0 ? (
{topic.highlights.map((h) => ( <CheckList items={topic.highlights} />
<li key={h}>{h}</li> ) : null}
))}
</ul>
</div> </div>
<aside className="h-fit space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border"> <aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
<p className="text-sm text-muted-foreground"> <SurfaceCard padded as="div">
<p className="text-sm leading-7 text-muted-foreground">
دوره‌های مرتبط با این موضوع را در فهرست دوره‌های کوتاه ببینید. دوره‌های مرتبط با این موضوع را در فهرست دوره‌های کوتاه ببینید.
</p> </p>
<Link href="/professional" className={cn(buttonVariants())}> <Link
href="/professional"
className={cn(buttonVariants({ size: "lg" }), "mt-5 w-full font-bold")}
>
مشاهده دوره‌ها مشاهده دوره‌ها
</Link> </Link>
<Separator /> </SurfaceCard>
<TextLink href="/" className="block text-sm"> <TextLink href="/" className="block px-1 text-sm">
بازگشت به خانه بازگشت به خانه
</TextLink> </TextLink>
</aside> </aside>
+52 -13
View File
@@ -1,11 +1,17 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import Link from "next/link";
import { ArrowLeft } from "lucide-react";
import { getTranslations } from "next-intl/server"; import { getTranslations } from "next-intl/server";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading";
import { Section } from "@/components/atoms/Section"; import { Section } from "@/components/atoms/Section";
import { PageHero } from "@/components/molecules/PageHero"; import { PageHero } from "@/components/molecules/PageHero";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { SectionHeader } from "@/components/molecules/SectionHeader";
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
import { valuesContent } from "@/lib/site-config"; import { valuesContent } from "@/lib/site-config";
const FA_INDEX = ["۱", "۲", "۳", "۴", "۵", "۶"] as const;
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("pages"); const t = await getTranslations("pages");
return { title: t("valuesTitle"), description: valuesContent.intro }; return { title: t("valuesTitle"), description: valuesContent.intro };
@@ -15,24 +21,57 @@ export default async function ValuesPage() {
return ( return (
<main id="main-content"> <main id="main-content">
<PageHero <PageHero
eyebrow="ارزش‌های آموزشی ما" eyebrow={valuesContent.eyebrow}
title={valuesContent.title} title={valuesContent.title}
intro={valuesContent.intro} intro={valuesContent.intro}
/> />
<Section className="bg-gradient-to-b from-background to-muted/40">
<Section tone="subtle">
<Container> <Container>
<div className="grid gap-5 sm:grid-cols-2"> <div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
{valuesContent.items.map((item) => ( {valuesContent.items.map((item, index) => (
<Card key={item.title} className="rounded-2xl border-border/70 shadow-sm transition-[box-shadow,border-color] hover:border-primary/20 hover:shadow-md"> <SurfaceCard key={item.title} padded>
<CardHeader> <p className="text-xs font-semibold text-primary/80">
<CardTitle>{item.title}</CardTitle> {FA_INDEX[index] ?? String(index + 1)}
</CardHeader> </p>
<CardContent> <Heading as="h2" level={4} className="mt-2">
<p className="text-sm leading-7 text-muted-foreground"> {item.title}
</Heading>
<p className="mt-2 text-sm leading-7 text-muted-foreground">
{item.text} {item.text}
</p> </p>
</CardContent> </SurfaceCard>
</Card> ))}
</div>
</Container>
</Section>
<Section>
<Container>
<SectionHeader
title={valuesContent.inPractice.title}
description={valuesContent.inPractice.description}
/>
<div className="grid gap-4 md:grid-cols-3">
{valuesContent.inPractice.examples.map((example) => (
<Link
key={example.href}
href={example.href}
className="group block min-w-0 rounded-xl focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
>
<SurfaceCard padded interactive className="h-full transition-shadow">
<Heading as="h3" level={4} className="group-hover:text-primary">
{example.title}
</Heading>
<p className="mt-2 text-sm leading-7 text-muted-foreground">
{example.text}
</p>
<span className="mt-4 inline-flex items-center gap-1.5 text-sm font-semibold text-primary">
مشاهده دوره
<ArrowLeft className="size-3.5 transition-transform group-hover:-translate-x-0.5" />
</span>
</SurfaceCard>
</Link>
))} ))}
</div> </div>
</Container> </Container>
+25 -1
View File
@@ -4,6 +4,7 @@ import { ENTITIES } from "@/lib/admin/entities";
import { isAdminEntityEnabled } from "@/lib/admin/disabled-entities"; import { isAdminEntityEnabled } from "@/lib/admin/disabled-entities";
import { GenericFilters } from "@/components/organisms/admin/generic/GenericFilters"; import { GenericFilters } from "@/components/organisms/admin/generic/GenericFilters";
import { GenericTable } from "@/components/organisms/admin/generic/GenericTable"; import { GenericTable } from "@/components/organisms/admin/generic/GenericTable";
import { FacultySyncButton } from "@/components/organisms/admin/FacultySyncButton";
import { import {
AdminPage, AdminPage,
AdminPageHeader, AdminPageHeader,
@@ -12,6 +13,7 @@ import {
} from "@/components/organisms/admin/AdminPage"; } from "@/components/organisms/admin/AdminPage";
import { buttonVariants } from "@/components/ui/button"; import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { facultyNetworkUrl } from "@/lib/site-config";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
@@ -32,15 +34,37 @@ export default async function AdminEntityListPage({
const rows = await spec.list({ search, published }); const rows = await spec.list({ search, published });
const description =
entity === "faculty" ? (
<>
{rows.length} مورد
{search ? ` مطابق فیلتر «${search}»` : ""}
{" — "}
<a
href={facultyNetworkUrl}
target="_blank"
rel="noopener noreferrer"
className="underline-offset-4 hover:underline"
>
منبع: شبکه اساتید دانشکده
</a>
</>
) : (
`${rows.length} مورد${search ? ` مطابق فیلتر «${search}»` : ""}`
);
return ( return (
<AdminPage> <AdminPage>
<AdminPageHeader <AdminPageHeader
title={spec.navLabel} title={spec.navLabel}
description={`${rows.length} مورد${search ? ` مطابق فیلتر «${search}»` : ""}`} description={description}
actions={ actions={
<>
{entity === "faculty" ? <FacultySyncButton /> : null}
<Link href={`/admin/${entity}/new`} className={cn(buttonVariants())}> <Link href={`/admin/${entity}/new`} className={cn(buttonVariants())}>
+ {spec.noun} جدید + {spec.noun} جدید
</Link> </Link>
</>
} }
/> />
@@ -5,6 +5,7 @@ import {
AdminPage, AdminPage,
AdminPageHeader, AdminPageHeader,
} from "@/components/organisms/admin/AdminPage"; } from "@/components/organisms/admin/AdminPage";
import { listAdminFaculty } from "@/lib/data/admin/cms";
import { import {
listAdminCourseCategories, listAdminCourseCategories,
listAdminCourseTags, listAdminCourseTags,
@@ -18,10 +19,11 @@ export default async function EditCoursePage({
params: Promise<{ id: string }>; params: Promise<{ id: string }>;
}) { }) {
const { id } = await params; const { id } = await params;
const [course, categories, tags] = await Promise.all([ const [course, categories, tags, faculty] = await Promise.all([
getAdminCourseById(id), getAdminCourseById(id),
listAdminCourseCategories(), listAdminCourseCategories(),
listAdminCourseTags(), listAdminCourseTags(),
listAdminFaculty(),
]); ]);
if (!course) notFound(); if (!course) notFound();
@@ -33,7 +35,16 @@ export default async function EditCoursePage({
backHref="/admin/courses" backHref="/admin/courses"
backLabel="بازگشت به دوره‌ها" backLabel="بازگشت به دوره‌ها"
/> />
<CourseForm initial={course} categories={categories} tags={tags} /> <CourseForm
initial={course}
categories={categories}
tags={tags}
faculty={faculty.map((f) => ({
id: f.id,
name: f.name,
title: f.title,
}))}
/>
</AdminPage> </AdminPage>
); );
} }
+12 -2
View File
@@ -3,6 +3,7 @@ import {
AdminPage, AdminPage,
AdminPageHeader, AdminPageHeader,
} from "@/components/organisms/admin/AdminPage"; } from "@/components/organisms/admin/AdminPage";
import { listAdminFaculty } from "@/lib/data/admin/cms";
import { import {
listAdminCourseCategories, listAdminCourseCategories,
listAdminCourseTags, listAdminCourseTags,
@@ -11,9 +12,10 @@ import {
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
export default async function NewCoursePage() { export default async function NewCoursePage() {
const [categories, tags] = await Promise.all([ const [categories, tags, faculty] = await Promise.all([
listAdminCourseCategories(), listAdminCourseCategories(),
listAdminCourseTags(), listAdminCourseTags(),
listAdminFaculty(),
]); ]);
return ( return (
@@ -24,7 +26,15 @@ export default async function NewCoursePage() {
backHref="/admin/courses" backHref="/admin/courses"
backLabel="بازگشت به دوره‌ها" backLabel="بازگشت به دوره‌ها"
/> />
<CourseForm categories={categories} tags={tags} /> <CourseForm
categories={categories}
tags={tags}
faculty={faculty.map((f) => ({
id: f.id,
name: f.name,
title: f.title,
}))}
/>
</AdminPage> </AdminPage>
); );
} }
+9 -1
View File
@@ -12,7 +12,15 @@ export default async function AdminGuardLayout({
}: { }: {
children: React.ReactNode; children: React.ReactNode;
}) { }) {
const session = await verifySession(); let session: Awaited<ReturnType<typeof verifySession>> = null;
try {
session = await verifySession();
} catch (err) {
console.error(
"[admin/guard] session check failed:",
err instanceof Error ? err.message : err,
);
}
if (!session) { if (!session) {
redirect("/admin/login"); redirect("/admin/login");
} }
+1 -1
View File
@@ -56,7 +56,7 @@ function LoginForm() {
<CardHeader className="space-y-3 text-center"> <CardHeader className="space-y-3 text-center">
<div className="mx-auto relative size-14"> <div className="mx-auto relative size-14">
<Image <Image
src="/brand/amirkabir.png" src="/brand/mst-faculty.png"
alt="دانشگاه صنعتی امیرکبیر" alt="دانشگاه صنعتی امیرکبیر"
fill fill
sizes="56px" sizes="56px"
+11 -2
View File
@@ -8,6 +8,7 @@ import { revalidateSite } from "@/lib/api/revalidate";
import { getAdminCourseById } from "@/lib/data/admin/courses"; import { getAdminCourseById } from "@/lib/data/admin/courses";
import { import {
setCourseCategories, setCourseCategories,
setCourseFaculty,
setCourseTags, setCourseTags,
} from "@/lib/data/admin/taxonomy"; } from "@/lib/data/admin/taxonomy";
@@ -68,7 +69,7 @@ export async function PATCH(
return errorResponse(parsed.error.issues[0]?.message ?? "داده نادرست", 400); return errorResponse(parsed.error.issues[0]?.message ?? "داده نادرست", 400);
} }
const { categoryIds, tagIds, ...rest } = parsed.data; const { categoryIds, tagIds, facultyIds, ...rest } = parsed.data;
const sets: string[] = []; const sets: string[] = [];
const values: unknown[] = []; const values: unknown[] = [];
for (const [key, column] of Object.entries(COURSE_COLUMNS)) { for (const [key, column] of Object.entries(COURSE_COLUMNS)) {
@@ -83,7 +84,12 @@ export async function PATCH(
} }
} }
if (sets.length === 0 && categoryIds === undefined && tagIds === undefined) { if (
sets.length === 0 &&
categoryIds === undefined &&
tagIds === undefined &&
facultyIds === undefined
) {
return errorResponse("حداقل یک فیلد برای ویرایش لازم است", 400); return errorResponse("حداقل یک فیلد برای ویرایش لازم است", 400);
} }
@@ -106,6 +112,9 @@ export async function PATCH(
if (tagIds !== undefined) { if (tagIds !== undefined) {
await setCourseTags(id, tagIds); await setCourseTags(id, tagIds);
} }
if (facultyIds !== undefined) {
await setCourseFaculty(id, facultyIds);
}
const course = await getAdminCourseById(id); const course = await getAdminCourseById(id);
revalidateSite(); revalidateSite();
+2
View File
@@ -12,6 +12,7 @@ import {
} from "@/lib/data/admin/courses"; } from "@/lib/data/admin/courses";
import { import {
setCourseCategories, setCourseCategories,
setCourseFaculty,
setCourseTags, setCourseTags,
} from "@/lib/data/admin/taxonomy"; } from "@/lib/data/admin/taxonomy";
@@ -83,6 +84,7 @@ export async function POST(request: NextRequest) {
); );
await setCourseCategories(id, d.categoryIds ?? []); await setCourseCategories(id, d.categoryIds ?? []);
await setCourseTags(id, d.tagIds ?? []); await setCourseTags(id, d.tagIds ?? []);
await setCourseFaculty(id, d.facultyIds ?? []);
const course = await getAdminCourseById(id); const course = await getAdminCourseById(id);
revalidateSite(); revalidateSite();
return NextResponse.json({ ok: true, data: course }, { status: 201 }); return NextResponse.json({ ok: true, data: course }, { status: 201 });
+1
View File
@@ -21,6 +21,7 @@ const FACULTY_COLUMNS: Record<string, string> = {
department: "department", department: "department",
linkedinUrl: "linkedin_url", linkedinUrl: "linkedin_url",
scholarUrl: "scholar_url", scholarUrl: "scholar_url",
profileUrl: "profile_url",
published: "published", published: "published",
}; };
+2 -2
View File
@@ -33,12 +33,12 @@ export async function POST(request: NextRequest) {
[ [
"id", "name", "title", "focus", "bio", "image_url", "id", "name", "title", "focus", "bio", "image_url",
"email", "office", "phone", "department", "linkedin_url", "scholar_url", "email", "office", "phone", "department", "linkedin_url", "scholar_url",
"published", "profile_url", "published",
], ],
[ [
id, d.name, d.title, d.focus, d.bio, d.imageUrl, id, d.name, d.title, d.focus, d.bio, d.imageUrl,
d.email || null, d.office || null, d.phone || null, d.department || null, d.email || null, d.office || null, d.phone || null, d.department || null,
d.linkedinUrl || null, d.scholarUrl || null, d.linkedinUrl || null, d.scholarUrl || null, d.profileUrl || null,
d.published, d.published,
], ],
); );
+33
View File
@@ -0,0 +1,33 @@
import { NextResponse } from "next/server";
import { requireAdmin } from "@/lib/auth/admin";
import { errorResponse } from "@/lib/api/response";
import { syncFacultyFromMstNetwork } from "@/lib/faculty/sync-mst-network";
import { facultyNetworkUrl } from "@/lib/site-config";
export const dynamic = "force-dynamic";
export const maxDuration = 60;
/**
* POST /api/admin/faculty/sync
* Pull the live «شبکه اساتید» page (same URL as header nav) and upsert rows.
*/
export async function POST() {
const session = await requireAdmin();
if (!session) return errorResponse("عدم دسترسی — ورود لازم است", 401);
try {
const result = await syncFacultyFromMstNetwork();
return NextResponse.json({
ok: true,
data: {
...result,
url: facultyNetworkUrl,
},
});
} catch (err) {
const message =
err instanceof Error ? err.message : "همگام‌سازی اساتید ناموفق بود";
console.error("faculty sync error:", err);
return errorResponse(message, 502);
}
}
+7
View File
@@ -29,6 +29,13 @@ export async function POST(request: NextRequest) {
return NextResponse.json({ ok: true, user: { id: user.id, email: user.email, name: user.name, role: user.role } }); return NextResponse.json({ ok: true, user: { id: user.id, email: user.email, name: user.name, role: user.role } });
} catch (error) { } catch (error) {
console.error("admin login error:", error); console.error("admin login error:", error);
const message = error instanceof Error ? error.message : String(error);
if (/timeout|ECONNREFUSED|ECONNRESET|Connection terminated/i.test(message)) {
return NextResponse.json(
{ error: "اتصال به پایگاه‌داده برقرار نشد. چند ثانیه بعد دوباره تلاش کنید." },
{ status: 503 },
);
}
return NextResponse.json({ error: "خطای سرور" }, { status: 500 }); return NextResponse.json({ error: "خطای سرور" }, { status: 500 });
} }
} }
+15 -2
View File
@@ -12,8 +12,8 @@
@theme inline { @theme inline {
--color-background: var(--background); --color-background: var(--background);
--color-foreground: var(--foreground); --color-foreground: var(--foreground);
--font-sans: var(--font-iransans); --font-sans: var(--font-vazirmatn);
--font-heading: var(--font-iransans); --font-heading: var(--font-vazirmatn);
--color-sidebar-ring: var(--sidebar-ring); --color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border); --color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground); --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
@@ -220,6 +220,19 @@
radial-gradient(circle at 90% 80%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 25%); radial-gradient(circle at 90% 80%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 25%);
} }
/* Neural-field signal pulse along active synapses (MetamorphField) */
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
@keyframes metamorph-pulse {
to {
stroke-dashoffset: -126;
}
}
.metamorph-pulse {
animation: metamorph-pulse 2.8s linear infinite;
}
}
/* Scroll-driven reveals: desktop only — expensive while scrolling on phones */ /* Scroll-driven reveals: desktop only — expensive while scrolling on phones */
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) { @media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
@supports (animation-timeline: view()) { @supports (animation-timeline: view()) {
+15 -50
View File
@@ -1,5 +1,5 @@
import type { Metadata, Viewport } from "next"; import type { Metadata, Viewport } from "next";
import localFont from "next/font/local"; import { Vazirmatn } from "next/font/google";
import { NextIntlClientProvider } from "next-intl"; import { NextIntlClientProvider } from "next-intl";
import { getLocale, getMessages, getTranslations } from "next-intl/server"; import { getLocale, getMessages, getTranslations } from "next-intl/server";
import { JsonLd, organizationJsonLd } from "@/lib/seo/json-ld"; import { JsonLd, organizationJsonLd } from "@/lib/seo/json-ld";
@@ -11,51 +11,11 @@ export const viewport: Viewport = {
viewportFit: "cover", viewportFit: "cover",
}; };
const iranSans = localFont({ const vazirmatn = Vazirmatn({
src: [ subsets: ["arabic", "latin"],
{ variable: "--font-vazirmatn",
path: "../fonts/iransans/IRANSansUltraLight.woff2", display: "swap",
weight: "200", weight: ["200", "300", "400", "500", "600", "700", "800", "900"],
style: "normal",
},
{
path: "../fonts/iransans/IRANSansLight.woff2",
weight: "300",
style: "normal",
},
{
path: "../fonts/iransans/IRANSans.woff2",
weight: "400",
style: "normal",
},
{
path: "../fonts/iransans/IRANSansMedium.woff2",
weight: "500",
style: "normal",
},
{
path: "../fonts/iransans/IRANSansBold.woff2",
weight: "600",
style: "normal",
},
{
path: "../fonts/iransans/IRANSansBold.woff2",
weight: "700",
style: "normal",
},
{
path: "../fonts/iransans/IRANSansBold.woff2",
weight: "800",
style: "normal",
},
{
path: "../fonts/iransans/IRANSansBold.woff2",
weight: "900",
style: "normal",
},
],
variable: "--font-iransans",
display: "optional",
}); });
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
@@ -70,8 +30,11 @@ export async function generateMetadata(): Promise<Metadata> {
}, },
description: t("homeDescription"), description: t("homeDescription"),
icons: { icons: {
icon: [{ url: "/brand/amirkabir.png", type: "image/png" }], icon: [
apple: [{ url: "/brand/amirkabir.png", type: "image/png" }], { url: "/favicon.ico", sizes: "any" },
{ url: "/brand/mst-faculty-icon.png", type: "image/png", sizes: "256x256" },
],
apple: [{ url: "/brand/mst-faculty-icon.png", type: "image/png" }],
}, },
openGraph: { openGraph: {
type: "website", type: "website",
@@ -79,7 +42,9 @@ export async function generateMetadata(): Promise<Metadata> {
siteName: t("homeTitle"), siteName: t("homeTitle"),
title: t("homeTitle"), title: t("homeTitle"),
description: t("homeDescription"), description: t("homeDescription"),
images: [{ url: "/brand/amirkabir.png", alt: "دانشگاه صنعتی امیرکبیر" }], images: [
{ url: "/brand/mst-faculty.png", alt: "دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر" },
],
}, },
alternates: { alternates: {
canonical: "/", canonical: "/",
@@ -98,7 +63,7 @@ export default async function RootLayout({
const t = await getTranslations("nav"); const t = await getTranslations("nav");
return ( return (
<html lang={locale} dir="rtl" className={`${iranSans.variable} h-full`}> <html lang={locale} dir="rtl" className={`${vazirmatn.variable} h-full`}>
<body className="flex min-h-full min-w-0 flex-col font-sans"> <body className="flex min-h-full min-w-0 flex-col font-sans">
<NextIntlClientProvider messages={messages}> <NextIntlClientProvider messages={messages}>
<a <a
+3 -33
View File
@@ -1,40 +1,10 @@
"use client"; "use client";
import { useEffect } from "react"; import { ErrorState } from "@/components/organisms/ErrorState";
import { DotCta } from "@/components/atoms/DotCta";
import { Button } from "@/components/ui/button";
export default function ProfessionalError({ export default function ProfessionalError(props: {
error,
reset,
}: {
error: Error & { digest?: string }; error: Error & { digest?: string };
reset: () => void; reset: () => void;
}) { }) {
useEffect(() => { return <ErrorState {...props} homeHref="/professional" />;
console.error(error);
}, [error]);
return (
<div className="mx-auto flex min-h-[50vh] w-full max-w-7xl flex-col items-start justify-center bg-chart-3 px-5 py-20 text-background sm:px-8 lg:px-12">
<p className="text-sm font-semibold text-accent">خطا</p>
<h1 className="mt-3 text-2xl font-bold tracking-tight text-background sm:text-3xl">
بارگذاری صفحه ناموفق بود
</h1>
<p className="mt-3 max-w-md text-background/70">لطفاً دوباره تلاش کنید.</p>
<div className="mt-8 flex flex-wrap gap-4">
<Button
type="button"
variant="outline"
className="border-background/60 bg-transparent text-background hover:bg-background hover:text-foreground"
onClick={reset}
>
تلاش مجدد
</Button>
<DotCta href="/professional" onDark>
بازگشت
</DotCta>
</div>
</div>
);
} }
+5 -4
View File
@@ -7,6 +7,8 @@ import { listPublishedCourseTags } from "@/lib/data/taxonomy";
import { getPrograms } from "@/lib/data/programs"; import { getPrograms } from "@/lib/data/programs";
import { import {
courseNavParentTag, courseNavParentTag,
facultyNetworkUrl,
facultySiteUrl,
professionalNav, professionalNav,
siteShortName, siteShortName,
} from "@/lib/site-config"; } from "@/lib/site-config";
@@ -47,12 +49,9 @@ export default async function ProfessionalLayout({
<SiteHeader <SiteHeader
items={navItems} items={navItems}
searchLabel={t("nav.search")} searchLabel={t("nav.search")}
contactLabel={t("nav.contact")}
brandTitle={siteShortName} brandTitle={siteShortName}
brandSubtitle={t("nav.brandSubtitle")} brandSubtitle={t("nav.brandSubtitle")}
academicsLabel={t("nav.academics")}
programSelectorTitle={t("home.programSelectorTitle")}
executiveLabel={t("home.executiveLabel")}
exploreLabel={t("home.exploreOurPrograms")}
variant="professional" variant="professional"
courses={courses} courses={courses}
programs={programs} programs={programs}
@@ -63,6 +62,8 @@ export default async function ProfessionalLayout({
copyright={t("footer.copyright", { year })} copyright={t("footer.copyright", { year })}
linksTitle={t("footer.links")} linksTitle={t("footer.links")}
links={[ links={[
{ label: t("footer.facultySite"), href: facultySiteUrl },
{ label: t("footer.facultyNetwork"), href: facultyNetworkUrl },
{ label: t("footer.press"), href: "/press" }, { label: t("footer.press"), href: "/press" },
{ label: t("footer.careers"), href: "/careers" }, { label: t("footer.careers"), href: "/careers" },
]} ]}
+2 -6
View File
@@ -6,7 +6,7 @@ import {
listPublishedCourseCategories, listPublishedCourseCategories,
listPublishedCourseTags, listPublishedCourseTags,
} from "@/lib/data/taxonomy"; } from "@/lib/data/taxonomy";
import { getSiteStats, getTestimonials } from "@/lib/data/site"; import { getSiteStats } from "@/lib/data/site";
import { courseJsonLd, JsonLd } from "@/lib/seo/json-ld"; import { courseJsonLd, JsonLd } from "@/lib/seo/json-ld";
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
@@ -33,11 +33,9 @@ export default async function ProfessionalPage({
const { tag: tagRaw, category: categoryRaw } = await searchParams; const { tag: tagRaw, category: categoryRaw } = await searchParams;
const initialTag = tagRaw?.trim() ?? ""; const initialTag = tagRaw?.trim() ?? "";
const initialCategory = categoryRaw?.trim() ?? ""; const initialCategory = categoryRaw?.trim() ?? "";
const [courses, stats, testimonials, filterCategories, filterTags] = const [courses, stats, filterCategories, filterTags] = await Promise.all([
await Promise.all([
getCourses(), getCourses(),
getSiteStats(), getSiteStats(),
getTestimonials(),
listPublishedCourseCategories({ filterOnly: true }), listPublishedCourseCategories({ filterOnly: true }),
listPublishedCourseTags({ filterOnly: true }), listPublishedCourseTags({ filterOnly: true }),
]); ]);
@@ -59,11 +57,9 @@ export default async function ProfessionalPage({
dppBody: t("professional.dppBody"), dppBody: t("professional.dppBody"),
statsTitle: t("professional.statsTitle"), statsTitle: t("professional.statsTitle"),
rankTitle: t("professional.rankTitle"), rankTitle: t("professional.rankTitle"),
testimonialsTitle: t("professional.testimonialsTitle"),
}} }}
courses={courses} courses={courses}
stats={stats} stats={stats}
testimonials={testimonials}
filterCategories={filterCategories} filterCategories={filterCategories}
filterTags={filterTags} filterTags={filterTags}
initialTag={initialTag} initialTag={initialTag}
+2 -1
View File
@@ -2,7 +2,8 @@ import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
const LOGO_SRC = "/brand/amirkabir.png"; /** Faculty seal mark (transparent). Source: MST icon with side text removed. */
const LOGO_SRC = "/brand/mst-faculty.png";
type BrandLogoProps = { type BrandLogoProps = {
href?: string; href?: string;
+4 -4
View File
@@ -1,10 +1,10 @@
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
const levels = { const levels = {
1: "text-3xl font-bold tracking-tight sm:text-4xl lg:text-5xl", 1: "text-[1.65rem] font-bold leading-[1.45] tracking-tight text-pretty sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]",
2: "text-2xl font-bold tracking-tight sm:text-3xl", 2: "text-2xl font-bold leading-snug tracking-tight text-pretty sm:text-3xl lg:text-4xl",
3: "text-lg font-semibold sm:text-xl", 3: "text-lg font-semibold leading-snug sm:text-xl",
4: "text-base font-semibold sm:text-lg", 4: "text-base font-semibold leading-snug sm:text-lg",
} as const; } as const;
type HeadingProps = React.ComponentProps<"h1"> & { type HeadingProps = React.ComponentProps<"h1"> & {
+195 -88
View File
@@ -1,73 +1,34 @@
"use client"; "use client";
import { useEffect, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
type MetamorphFieldProps = { type MetamorphFieldProps = {
className?: string; className?: string;
/** `dark` = light strokes on navy/hero; `light` = ink strokes on sand/muted */ /** `dark` = light strokes on navy/hero; `light` = ink strokes on sand/muted */
tone?: "dark" | "light"; tone?: "dark" | "light";
/** Visual density of the constellation */ /** Visual density of the neural field */
density?: "sparse" | "normal"; density?: "sparse" | "normal";
}; };
type Node = { x: number; y: number; r?: number }; type Point = { x: number; y: number };
type Edge = [number, number];
/** Landscape constellation — matches typical flex section bands (≈ 2.5∶1) */ type Node = {
const NODES_NORMAL: Node[] = [ id: number;
{ x: 40, y: 60, r: 2.1 }, x: number;
{ x: 130, y: 36, r: 1.7 }, y: number;
{ x: 220, y: 88, r: 2.4 }, r: number;
{ x: 100, y: 140, r: 1.5 }, layer: number;
{ x: 190, y: 168, r: 2.0 }, active: boolean;
{ x: 310, y: 110, r: 1.6 }, };
{ x: 400, y: 48, r: 2.2 },
{ x: 480, y: 130, r: 1.8 },
{ x: 560, y: 70, r: 2.5 },
{ x: 650, y: 150, r: 1.6 },
{ x: 740, y: 40, r: 1.9 },
{ x: 830, y: 120, r: 2.1 },
{ x: 920, y: 64, r: 1.7 },
{ x: 1010, y: 140, r: 2.0 },
{ x: 1100, y: 90, r: 1.5 },
{ x: 70, y: 240, r: 2.3 },
{ x: 170, y: 280, r: 1.6 },
{ x: 280, y: 230, r: 2.0 },
{ x: 370, y: 300, r: 1.8 },
{ x: 470, y: 250, r: 2.2 },
{ x: 570, y: 310, r: 1.7 },
{ x: 680, y: 260, r: 2.4 },
{ x: 780, y: 320, r: 1.6 },
{ x: 880, y: 270, r: 2.0 },
{ x: 980, y: 330, r: 1.8 },
{ x: 1080, y: 280, r: 2.1 },
{ x: 120, y: 380, r: 1.5 },
{ x: 250, y: 410, r: 2.2 },
{ x: 390, y: 390, r: 1.7 },
{ x: 530, y: 430, r: 2.0 },
{ x: 670, y: 400, r: 1.9 },
{ x: 810, y: 440, r: 1.6 },
{ x: 950, y: 410, r: 2.3 },
{ x: 1090, y: 450, r: 1.8 },
];
const EDGES_NORMAL: Edge[] = [ type Synapse = {
[0, 1], [1, 2], [0, 3], [1, 3], [2, 4], [3, 4], [2, 5], [4, 5], d: string;
[5, 6], [5, 7], [6, 7], [6, 8], [7, 8], [8, 9], [7, 9], from: number;
[8, 10], [9, 11], [10, 11], [10, 12], [11, 12], [12, 13], [11, 13], [13, 14], to: number;
[3, 15], [4, 16], [5, 17], [7, 18], [8, 19], [9, 20], [11, 21], [12, 22], [13, 23], [14, 24], active: boolean;
[15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], weight: number;
[15, 26], [16, 27], [18, 28], [19, 29], [21, 30], [22, 31], [24, 32], [25, 33], };
[26, 27], [27, 28], [28, 29], [29, 30], [30, 31], [31, 32], [32, 33],
];
const NODES_SPARSE = NODES_NORMAL.filter((_, i) => i % 2 === 0);
const EDGES_SPARSE: Edge[] = [
[0, 1], [1, 2], [0, 3], [2, 4], [3, 4], [3, 5], [4, 6], [5, 6],
[5, 7], [6, 8], [7, 8], [7, 9], [8, 10], [9, 10], [9, 11], [10, 12],
[11, 12], [11, 13], [12, 14], [13, 14], [13, 15], [14, 16], [15, 16],
];
const VIEW_W = 1200; const VIEW_W = 1200;
const VIEW_H = 480; const VIEW_H = 480;
@@ -75,9 +36,123 @@ const VIEW_H = 480;
const ENABLE_MQ = const ENABLE_MQ =
"(min-width: 768px) and (prefers-reduced-motion: no-preference)"; "(min-width: 768px) and (prefers-reduced-motion: no-preference)";
/** Deterministic pseudo-random in [0, 1) from a seed */
function rand(seed: number) {
const x = Math.sin(seed * 12.9898 + 78.233) * 43758.5453;
return x - Math.floor(x);
}
/** Organic cubic link between two nodes (not a straight chord). */
function synapsePath(a: Point, b: Point, seed: number): string {
const dx = b.x - a.x;
const dy = b.y - a.y;
const dist = Math.hypot(dx, dy) || 1;
const nx = -dy / dist;
const ny = dx / dist;
const bulge = (rand(seed) - 0.5) * Math.min(90, dist * 0.45);
const c1x = a.x + dx * 0.35 + nx * bulge;
const c1y = a.y + dy * 0.35 + ny * bulge;
const c2x = a.x + dx * 0.7 - nx * bulge * 0.55;
const c2y = a.y + dy * 0.7 - ny * bulge * 0.55;
return `M ${a.x.toFixed(1)} ${a.y.toFixed(1)} C ${c1x.toFixed(1)} ${c1y.toFixed(1)}, ${c2x.toFixed(1)} ${c2y.toFixed(1)}, ${b.x.toFixed(1)} ${b.y.toFixed(1)}`;
}
/** /**
* Decorative constellation. Mounted only on desktop with motion allowed — * Soft layered neural net: nodes in columns, curved synapses between
* SMIL/CSS motion was too expensive on phones. * adjacent layers — reads as an AI network while staying organic.
*/
function buildNetwork(density: "sparse" | "normal"): {
nodes: Node[];
synapses: Synapse[];
} {
const layerCounts =
density === "sparse" ? [3, 4, 4, 3] : [4, 5, 6, 5, 3];
const layers = layerCounts.length;
const padX = density === "sparse" ? 110 : 80;
const padY = 48;
const nodes: Node[] = [];
let id = 0;
for (let L = 0; L < layers; L++) {
const count = layerCounts[L];
const x =
padX + (L / Math.max(1, layers - 1)) * (VIEW_W - padX * 2);
for (let i = 0; i < count; i++) {
const t = count === 1 ? 0.5 : i / (count - 1);
const y = padY + t * (VIEW_H - padY * 2);
const jitterX = (rand(id * 11 + 1) - 0.5) * 36;
const jitterY = (rand(id * 11 + 2) - 0.5) * 28;
const active = rand(id * 17) > 0.72;
nodes.push({
id,
x: x + jitterX,
y: y + jitterY,
r: active ? 7.5 : 5.2 + rand(id * 3) * 2,
layer: L,
active,
});
id += 1;
}
}
const byLayer = layerCounts.map((_, L) =>
nodes.filter((n) => n.layer === L),
);
const synapses: Synapse[] = [];
let synSeed = 0;
for (let L = 0; L < layers - 1; L++) {
const left = byLayer[L];
const right = byLayer[L + 1];
for (const a of left) {
// Each neuron fans out to 2–3 targets in the next layer
const fan = 2 + Math.floor(rand(a.id * 31) * 2);
const ranked = [...right].sort(
(p, q) =>
Math.abs(p.y - a.y) + rand(a.id + p.id) * 20 -
(Math.abs(q.y - a.y) + rand(a.id + q.id) * 20),
);
for (let k = 0; k < Math.min(fan, ranked.length); k++) {
const b = ranked[k];
const weight = 0.55 + rand(synSeed + 3) * 0.45;
const active =
(a.active || b.active) && rand(synSeed + 7) > 0.45;
synapses.push({
d: synapsePath(a, b, synSeed),
from: a.id,
to: b.id,
active,
weight,
});
synSeed += 1;
}
}
}
// A few skip connections (deeper net feel)
if (layers >= 4) {
const from = byLayer[0];
const to = byLayer[layers - 1];
for (let i = 0; i < Math.min(2, from.length, to.length); i++) {
const a = from[i];
const b = to[Math.min(to.length - 1, i + 1)];
synapses.push({
d: synapsePath(a, b, 900 + i),
from: a.id,
to: b.id,
active: true,
weight: 0.4,
});
}
}
return { nodes, synapses };
}
/**
* Decorative neural-network field — layered nodes + curved synapses.
* Evokes AI / learning systems without looking like a flowchart.
* Desktop + motion only (SVG density is heavy on phones).
*/ */
export function MetamorphField({ export function MetamorphField({
className, className,
@@ -85,6 +160,10 @@ export function MetamorphField({
density = "normal", density = "normal",
}: MetamorphFieldProps) { }: MetamorphFieldProps) {
const [enabled, setEnabled] = useState(false); const [enabled, setEnabled] = useState(false);
const { nodes, synapses } = useMemo(
() => buildNetwork(density),
[density],
);
useEffect(() => { useEffect(() => {
const mq = window.matchMedia(ENABLE_MQ); const mq = window.matchMedia(ENABLE_MQ);
@@ -96,19 +175,27 @@ export function MetamorphField({
if (!enabled) return null; if (!enabled) return null;
const nodes = density === "sparse" ? NODES_SPARSE : NODES_NORMAL; const edge =
const edges = density === "sparse" ? EDGES_SPARSE : EDGES_NORMAL; tone === "dark"
const stroke = ? "color-mix(in oklab, white 42%, transparent)"
tone === "dark" ? "color-mix(in oklab, white 55%, transparent)" : "var(--foreground)"; : "color-mix(in oklab, var(--foreground) 36%, transparent)";
const fill = const edgeActive =
tone === "dark" ? "color-mix(in oklab, white 70%, transparent)" : "var(--primary)"; tone === "dark"
? "color-mix(in oklab, var(--accent) 70%, white)"
: "var(--primary)";
const soma =
tone === "dark"
? "color-mix(in oklab, white 82%, transparent)"
: "var(--foreground)";
const accent = tone === "dark" ? "var(--accent)" : "var(--primary)"; const accent = tone === "dark" ? "var(--accent)" : "var(--primary)";
const core =
tone === "dark" ? "var(--chart-3)" : "var(--background)";
return ( return (
<div <div
className={cn( className={cn(
"pointer-events-none absolute inset-0 z-[1] overflow-hidden metamorph-field", "pointer-events-none absolute inset-0 z-[1] overflow-hidden metamorph-field",
tone === "light" ? "opacity-[0.14]" : "opacity-[0.42]", tone === "light" ? "opacity-[0.18]" : "opacity-[0.52]",
className, className,
)} )}
aria-hidden aria-hidden
@@ -120,35 +207,55 @@ export function MetamorphField({
preserveAspectRatio="xMidYMid slice" preserveAspectRatio="xMidYMid slice"
focusable="false" focusable="false"
> >
<g stroke={stroke} strokeWidth="0.9"> {synapses.map((s, i) => (
{edges.map(([a, b], i) => { <g key={`syn-${i}`}>
const n1 = nodes[a]; <path
const n2 = nodes[b]; d={s.d}
if (!n1 || !n2) return null; stroke={s.active ? edgeActive : edge}
return ( strokeWidth={s.active ? 1.35 * s.weight : 1.05 * s.weight}
<line strokeLinecap="round"
key={`e-${i}`} opacity={s.active ? 0.55 : 0.28}
x1={n1.x}
y1={n1.y}
x2={n2.x}
y2={n2.y}
opacity="0.55"
/> />
); {s.active ? (
})} <path
className="metamorph-pulse"
d={s.d}
stroke={accent}
strokeWidth={2}
strokeLinecap="round"
strokeDasharray="6 120"
opacity="0.85"
style={{ animationDelay: `${(i % 7) * 0.35}s` }}
/>
) : null}
</g> </g>
<g> ))}
{nodes.map((n, i) => (
{nodes.map((n) => (
<g key={`n-${n.id}`}>
<circle <circle
key={`n-${i}`}
cx={n.x} cx={n.x}
cy={n.y} cy={n.y}
r={n.r ?? 2} r={n.r + 10}
fill={i % 5 === 0 ? accent : fill} fill={n.active ? accent : soma}
opacity={i % 5 === 0 ? 0.85 : 0.7} opacity={n.active ? 0.16 : 0.08}
/>
<circle
cx={n.x}
cy={n.y}
r={n.r}
fill={n.active ? accent : soma}
opacity={n.active ? 0.95 : 0.75}
/>
<circle
cx={n.x}
cy={n.y}
r={n.r * 0.38}
fill={core}
opacity="0.5"
/> />
))}
</g> </g>
))}
</svg> </svg>
</div> </div>
); );
+3 -2
View File
@@ -1,12 +1,13 @@
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
type SectionProps = React.ComponentProps<"section"> & { type SectionProps = React.ComponentProps<"section"> & {
tone?: "default" | "muted" | "dark" | "accent"; tone?: "default" | "subtle" | "muted" | "dark" | "accent";
tight?: boolean; tight?: boolean;
}; };
const tones = { const tones = {
default: "bg-background text-foreground", default: "bg-background text-foreground",
subtle: "bg-gradient-to-b from-background to-muted/40 text-foreground",
muted: "bg-muted text-foreground", muted: "bg-muted text-foreground",
dark: "bg-chart-3 text-background", dark: "bg-chart-3 text-background",
accent: "bg-primary text-primary-foreground", accent: "bg-primary text-primary-foreground",
@@ -23,7 +24,7 @@ export function Section({
data-tone={tone} data-tone={tone}
className={cn( className={cn(
"motion-section relative min-w-0", "motion-section relative min-w-0",
tight ? "py-8 sm:py-10" : "py-16 sm:py-24", tight ? "py-10 sm:py-14" : "py-16 sm:py-24",
tones[tone], tones[tone],
className, className,
)} )}
+1 -33
View File
@@ -20,7 +20,7 @@ export function ProgramCard({
className?: string; className?: string;
}) { }) {
return ( return (
<Card className={cn("group h-full gap-2 border-border/70 py-6 shadow-sm transition-[box-shadow,border-color] hover:border-primary/25 hover:shadow-lg", className)}> <Card className={cn("group h-full gap-2 py-6 hover:shadow-md hover:ring-primary/25", className)}>
<CardHeader className="gap-1"> <CardHeader className="gap-1">
{program.tagline ? ( {program.tagline ? (
<p className="text-xs font-bold text-primary">{program.tagline}</p> <p className="text-xs font-bold text-primary">{program.tagline}</p>
@@ -219,38 +219,6 @@ export function EventCard({
); );
} }
export function StatItem({ value, label }: { value: string; label: string }) {
return (
<div className="text-center">
<p className="text-4xl font-extrabold text-accent">{value}</p>
<p className="mt-2 text-sm text-background/70">{label}</p>
</div>
);
}
export function QuoteBlock({
quote,
name,
role,
courseTitle,
}: {
quote: string;
name: string;
role: string;
courseTitle: string;
}) {
return (
<blockquote className="flex h-full flex-col rounded-xl bg-background/5 p-7 ring-1 ring-background/10">
<p className="flex-1 text-sm leading-8 text-background/90">«{quote}»</p>
<footer className="mt-7">
<p className="font-bold text-background">{name}</p>
<p className="mt-0.5 text-sm text-background/55">{role}</p>
<p className="mt-2 text-xs font-semibold text-accent">{courseTitle}</p>
</footer>
</blockquote>
);
}
export function IntersectionCard({ export function IntersectionCard({
title, title,
description, description,
+23
View File
@@ -0,0 +1,23 @@
import { Check } from "lucide-react";
import { cn } from "@/lib/utils";
export function CheckList({
items,
className,
}: {
items: string[];
className?: string;
}) {
return (
<ul className={cn("space-y-3", className)}>
{items.map((item) => (
<li key={item} className="flex items-start gap-3 text-base leading-8">
<span className="mt-1.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary">
<Check className="size-3" aria-hidden />
</span>
<span className="min-w-0 text-foreground/90">{item}</span>
</li>
))}
</ul>
);
}
@@ -0,0 +1,59 @@
import { Mail, MapPin, Phone } from "lucide-react";
import { Heading } from "@/components/atoms/Heading";
import { TextLink } from "@/components/atoms/TextLink";
import { siteAddress } from "@/lib/site-config";
const rowClass = "flex items-start gap-4";
const iconClass =
"flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary";
export function ContactDetails() {
return (
<div className="min-w-0 space-y-8">
<Heading level={3} as="h2">
اطلاعات تماس
</Heading>
<ul className="space-y-6 text-sm leading-7">
<li className={rowClass}>
<span className={iconClass}>
<MapPin className="size-4" aria-hidden />
</span>
<div className="min-w-0">
<p className="font-semibold text-foreground">آدرس</p>
<p className="text-muted-foreground">{siteAddress.line}</p>
<a
href={siteAddress.mapUrl}
target="_blank"
rel="noreferrer"
className="mt-1 inline-block font-medium text-primary underline-offset-4 hover:underline"
>
مشاهده روی نقشه
</a>
</div>
</li>
<li className={rowClass}>
<span className={iconClass}>
<Phone className="size-4" aria-hidden />
</span>
<div className="min-w-0">
<p className="font-semibold text-foreground">تلفن</p>
<p className="text-muted-foreground">
<span dir="ltr">{siteAddress.phone}</span>
</p>
</div>
</li>
<li className={rowClass}>
<span className={iconClass}>
<Mail className="size-4" aria-hidden />
</span>
<div className="min-w-0">
<p className="font-semibold text-foreground">ایمیل</p>
<TextLink href={`mailto:${siteAddress.email}`} tone="accent">
{siteAddress.email}
</TextLink>
</div>
</li>
</ul>
</div>
);
}
+44
View File
@@ -0,0 +1,44 @@
import type { LucideIcon } from "lucide-react";
import { cn } from "@/lib/utils";
export type DetailItem = {
label: string;
value: React.ReactNode;
icon?: LucideIcon;
emphasis?: boolean;
};
/** Label/value rows for side panels and detail pages. */
export function DetailList({
items,
className,
}: {
items: DetailItem[];
className?: string;
}) {
return (
<dl className={cn("divide-y divide-border text-sm", className)}>
{items.map((item) => (
<div
key={item.label}
className="flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0"
>
<dt className="flex items-center gap-2 text-muted-foreground">
{item.icon ? (
<item.icon className="size-4 shrink-0 text-primary" aria-hidden />
) : null}
{item.label}
</dt>
<dd
className={cn(
"text-end font-semibold",
item.emphasis ? "text-primary" : "text-foreground",
)}
>
{item.value}
</dd>
</div>
))}
</dl>
);
}
+33
View File
@@ -0,0 +1,33 @@
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { cn } from "@/lib/utils";
/** Public-site form wrapper (contact, register, legal pages). */
export function FormCard({
title,
description,
children,
className,
}: {
title: string;
description?: string;
children: React.ReactNode;
className?: string;
}) {
return (
<Card className={cn("gap-0 py-0", className)}>
<CardHeader className="gap-2 p-6 pb-0 sm:p-8 sm:pb-0">
<CardTitle className="text-lg font-bold">{title}</CardTitle>
{description ? (
<CardDescription className="leading-7">{description}</CardDescription>
) : null}
</CardHeader>
<CardContent className="p-6 sm:p-8">{children}</CardContent>
</Card>
);
}
+26 -12
View File
@@ -1,6 +1,8 @@
import Link from "next/link"; import Link from "next/link";
import Image from "next/image";
import { ArrowLeft, GraduationCap } from "lucide-react"; import { ArrowLeft, GraduationCap } from "lucide-react";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading";
import { MetamorphField } from "@/components/atoms/MetamorphField"; import { MetamorphField } from "@/components/atoms/MetamorphField";
import { buttonVariants } from "@/components/ui/button"; import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
@@ -17,41 +19,53 @@ export function HeroFeatured({
}) { }) {
return ( return (
<header className="home-hero relative isolate overflow-hidden bg-chart-3 text-background"> <header className="home-hero relative isolate overflow-hidden bg-chart-3 text-background">
<div className="pointer-events-none absolute inset-0 z-[1]" aria-hidden>
<Image
src="/brand/amirkabir-arches.png"
alt=""
fill
priority
className="scale-125 object-cover object-[62%_55%] opacity-[0.28] mix-blend-screen sm:scale-110 sm:object-[58%_50%] sm:opacity-[0.32]"
sizes="100vw"
/>
{/* Unified navy wash — keeps text clear and softens the art */}
<div className="absolute inset-0 bg-chart-3/45" />
<div className="absolute inset-0 bg-gradient-to-l from-chart-3/90 via-chart-3/40 to-chart-3/25" />
<div className="absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t from-chart-3 to-transparent" />
<MetamorphField <MetamorphField
tone="dark" tone="dark"
density="sparse" density="sparse"
className="end-0 start-auto w-[min(55vw,36rem)] opacity-20" className="opacity-[0.28]"
/> />
</div>
<Container className="relative z-[2] flex min-h-[34rem] min-w-0 items-center py-16 sm:min-h-[36rem] sm:py-20"> <Container className="relative z-[2] flex min-h-[34rem] min-w-0 items-center py-16 sm:min-h-[36rem] sm:py-20">
<div className="home-hero__copy w-full min-w-0 max-w-4xl text-start"> <div className="home-hero__copy w-full min-w-0 max-w-2xl text-start lg:max-w-3xl">
<div className="inline-flex max-w-full items-start gap-2 text-sm font-medium text-background/60"> <div className="inline-flex max-w-full items-start gap-2 text-sm font-medium text-background/60">
<GraduationCap className="mt-0.5 size-4 shrink-0" /> <GraduationCap className="mt-0.5 size-4 shrink-0" />
<span className="min-w-0 leading-7 text-pretty"> <span className="min-w-0 leading-7 text-pretty">
مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه{"\u00A0"}صنعتی{"\u00A0"}امیرکبیر مرکز آموزش‌های آزاد دانشکده مدیریت، علم و فناوری دانشگاه{"\u00A0"}صنعتی{"\u00A0"}امیرکبیر
</span> </span>
</div> </div>
<h1 className="mt-6 max-w-4xl text-[1.65rem] font-black leading-[1.45] tracking-tight sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]"> <Heading as="h1" level={1} className="mt-6 max-w-4xl">
برای تصمیم‌هایی که{" "} برای تصمیم‌هایی که{" "}
<span className="whitespace-nowrap">صنعت را پیش می‌برند</span> <span className="whitespace-nowrap">صنعت را پیش می‌برند</span>
</h1> </Heading>
<p className="mt-6 max-w-2xl border-t border-accent/60 pt-5 text-base leading-8 text-pretty text-background/65 sm:text-lg sm:leading-8"> <p className="mt-6 max-w-2xl border-t border-accent/60 pt-5 text-base leading-8 text-pretty text-background/65 sm:text-lg sm:leading-8">
دانش امیرکبیر، پشتوانه رهبری نوآور در عصر داده و هوش{"\u00A0"}مصنوعی. دانش دانشگاه صنعتی امیرکبیر، پشتوانه رهبری نوآور در عصر داده و هوش{"\u00A0"}مصنوعی.
</p> </p>
<div className="mt-9 flex flex-wrap gap-3"> <div className="mt-9 flex flex-wrap gap-3">
<Link <Link
href="/programs" href="/professional"
className={cn( className={cn(buttonVariants({ size: "lg" }), "font-bold")}
buttonVariants({ size: "lg" }),
"bg-primary font-bold text-primary-foreground hover:bg-primary/85",
)}
> >
مشاهده دوره‌ها <ArrowLeft className="size-4" /> مشاهده دوره‌ها <ArrowLeft className="size-4" />
</Link> </Link>
<Link <Link
href="/about" href="/about"
className={cn( className={cn(
buttonVariants({ variant: "outline", size: "lg" }), buttonVariants({ variant: "inverse", size: "lg" }),
"border-background/25 bg-transparent font-bold text-background hover:bg-background hover:text-foreground", "font-bold",
)} )}
> >
درباره مرکز درباره مرکز
+43 -31
View File
@@ -2,50 +2,63 @@ import Image from "next/image";
import { Container } from "@/components/atoms/Container"; import { Container } from "@/components/atoms/Container";
import { Heading } from "@/components/atoms/Heading"; import { Heading } from "@/components/atoms/Heading";
import { MetamorphField } from "@/components/atoms/MetamorphField"; import { MetamorphField } from "@/components/atoms/MetamorphField";
import { cn } from "@/lib/utils";
export function PageHero({ export function PageHero({
title, title,
intro, intro,
eyebrow, eyebrow,
imageUrl, imageUrl,
actions,
size = "default",
showField = true,
}: { }: {
title: string; title: string;
intro?: string; intro?: string;
eyebrow?: string; eyebrow?: string;
imageUrl?: string; imageUrl?: string;
actions?: React.ReactNode;
size?: "default" | "lg";
/** Decorative line field; hide when a strong photo background is enough. */
showField?: boolean;
}) { }) {
const hasPhoto = Boolean(imageUrl);
return ( return (
<header className="page-hero relative isolate overflow-hidden bg-chart-3 py-16 text-background sm:py-24"> <header
{imageUrl ? ( className={cn(
<> "page-hero relative isolate flex items-center overflow-hidden bg-chart-3 text-background",
<Image size === "lg"
src={imageUrl} ? "min-h-[34rem] py-16 sm:min-h-[38rem] sm:py-20"
alt="" : "py-16 sm:py-24",
fill
priority
className="object-cover opacity-25"
sizes="100vw"
/>
<div className="absolute inset-0 bg-gradient-to-l from-chart-3 via-chart-3/90 to-chart-3/60" />
</>
) : (
<>
<Image
src="/brand/campus-collaboration-v1.png"
alt=""
fill
priority
className="object-cover opacity-15 grayscale"
sizes="100vw"
/>
<div className="absolute inset-0 bg-gradient-to-l from-chart-3 via-chart-3/95 to-chart-3/75" />
</>
)} )}
>
<Image
src={imageUrl ?? "/brand/campus-collaboration-v1.png"}
alt=""
fill
priority
className={cn(
"object-cover",
hasPhoto ? "opacity-45" : "opacity-15 grayscale",
)}
sizes="100vw"
/>
<div
className={cn(
"absolute inset-0",
hasPhoto
? "bg-gradient-to-l from-chart-3 via-chart-3/85 to-chart-3/55"
: "bg-gradient-to-l from-chart-3 via-chart-3/90 to-chart-3/65",
)}
/>
{showField ? (
<MetamorphField <MetamorphField
tone="dark" tone="dark"
density="normal" density="normal"
className="end-0 start-auto w-[min(75vw,42rem)] opacity-45" className="end-0 start-auto w-[min(75vw,42rem)] opacity-40"
/> />
) : null}
<div className="absolute end-0 top-0 h-px w-1/3 bg-gradient-to-l from-accent to-transparent" /> <div className="absolute end-0 top-0 h-px w-1/3 bg-gradient-to-l from-accent to-transparent" />
<Container className="relative z-[2] min-w-0"> <Container className="relative z-[2] min-w-0">
<div className="page-hero__content w-full min-w-0 max-w-4xl text-start"> <div className="page-hero__content w-full min-w-0 max-w-4xl text-start">
@@ -54,11 +67,7 @@ export function PageHero({
{eyebrow} {eyebrow}
</p> </p>
) : null} ) : null}
<Heading <Heading as="h1" level={1} className="max-w-4xl text-background">
as="h1"
level={1}
className="max-w-4xl text-[1.65rem] leading-[1.45] text-pretty text-background sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]"
>
{title} {title}
</Heading> </Heading>
{intro ? ( {intro ? (
@@ -66,6 +75,9 @@ export function PageHero({
{intro} {intro}
</p> </p>
) : null} ) : null}
{actions ? (
<div className="mt-8 flex flex-wrap gap-3">{actions}</div>
) : null}
</div> </div>
</Container> </Container>
</header> </header>
@@ -0,0 +1,66 @@
import { Heading } from "@/components/atoms/Heading";
import { cn } from "@/lib/utils";
/**
* Eyebrow + title + description for every content section.
* `inverse` is for `Section` tones `dark` / `accent`.
*/
export function SectionHeader({
eyebrow,
title,
description,
inverse = false,
align = "start",
as = "h2",
className,
}: {
eyebrow?: string;
title: React.ReactNode;
description?: React.ReactNode;
inverse?: boolean;
align?: "start" | "center";
as?: "h1" | "h2";
className?: string;
}) {
return (
<div
className={cn(
"mb-10 max-w-3xl min-w-0 sm:mb-12",
align === "center" && "mx-auto text-center",
className,
)}
>
{eyebrow ? (
<p
className={cn(
"text-sm font-bold sm:text-base",
inverse ? "text-accent" : "text-primary",
)}
>
{eyebrow}
</p>
) : null}
<Heading
as={as}
level={2}
className={cn(
"break-words",
eyebrow && "mt-3",
inverse && "text-current",
)}
>
{title}
</Heading>
{description ? (
<p
className={cn(
"mt-4 text-base leading-8 sm:text-lg sm:leading-8",
inverse ? "opacity-75" : "text-muted-foreground",
)}
>
{description}
</p>
) : null}
</div>
);
}
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff. Show more