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>
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);
|
||||
@@ -40,8 +40,12 @@ postgresql://<user>:<password>@insaight-postgres:5432/ManagmentWebSite_Db
|
||||
```env
|
||||
# local (.env.local)
|
||||
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 است).
|
||||
|
||||
Production باید مستقیم به نام کانتینر `insaight-postgres` وصل شود (نه IP عمومی از داخل bridge).
|
||||
|
||||
@@ -1,21 +1,38 @@
|
||||
1- در بار بالا، فاصله بین دکمه ها بیشتر شود تا تناسب برقرار باشد بین فاصله های اکشن های چپ و راست
|
||||
2- دکمه تماس باما کنار دکمه سرچ باشد
|
||||
3- فونت بشود وزیر متن
|
||||
4- دکمه دانشگداه از بالا جذف شود و به دسترسی سریع برود اما به دانشکد (لینک استاتید بدون آدرس صفحه)
|
||||
5- درباره ما در بعد از دوره ها باشد
|
||||
6- برنامه ها فعلا هاید شود (لینکش هم در دسترس نباشد)
|
||||
7- لوگو دانشکده باید گذاشته شود (بهت میدمش) اگر میتونی لوگو های اینچا https://mst.aut.ac.ir را دانلود کن)
|
||||
8- چرا دانشگاه .... باید بردش حذف شود
|
||||
9- عدد بالا در چرا دانشگاه (اون یک دو سه) برداشته شود
|
||||
10- دانشگاه صنعتی امیرکبیر باشد در این قسمت نه امیرکبیر خالی و البته همه جا
|
||||
11- پلت رنگی عووض میشه و باید بگیریمش (اگر میتونی اینو ببین https://mst.aut.ac.ir و ازش پلت رنگی بساز)
|
||||
12- قبل از "رویکرد آموزشی ما" باید یک سرچ بیاید که مانند صفحه دوره ها باشد و همان عمل را صدا کن
|
||||
13 کلمه "رویکرد آموزشی ما" و کلا متونی مانند این برای معرفی هر سکشن باید بزرگ تر باشد
|
||||
14- تمام سکشن ها باید عرض یکسان داشته باشند و هیچکدام تمام صفحه نشوند
|
||||
15- رویداد ها فعلا هاید شود
|
||||
16- دسترسی سریع باید سایت دانشکده و شبکه اساتید را داشته باشد
|
||||
17- ماهم باید اساتید را از دانشکده کپی کنیم (خودت بخون) و صرفا رفرنسشان را داشته باشیم تا در دوره ها اگر نیاز شد بهشون لینک بدیم (به صفحشون تو دانشکده)
|
||||
18- در صفحه دوره ها باید دسته بندی ها بزرک تر باشه، تگ ها از اون یکی یکم کوچک تر
|
||||
19- سرچ بار هامون باید آیکون باشه و با زدن آیکون سرچ بار باز بشه. یعنی همه جا سرچ آیکون با دسته بندی ها باشه و با انیمشن سرچ اینچپوپ جایگزین دسته بندی بشه (به جز هدر که دسته بندی نمی خواد)
|
||||
20 -روی کارت دوره ها همش قابل کلیک باشد ننه صرفا دکمه جزییات
|
||||
21- لیبل روی کارت دوره ها هم کلیلک پذیر باشد تا فیلتر دسته بندی و تگ را هم انجام دهد برای کاربر. در جزییات دوره هم همین باشد
|
||||
# تغییرات UI سایت (چکلیست)
|
||||
|
||||
وضعیت: `[ ]` باز · `[x]` انجامشده · `[blocked]` منتظر ورودی کاربر
|
||||
|
||||
## هدر و ناوبری
|
||||
- [x] 1. فاصله بین دکمههای هدر بیشتر شود (تعادل اکشنهای چپ/راست)
|
||||
- [x] 2. دکمه «تماس با ما» کنار دکمه سرچ
|
||||
- [x] 4. دکمه دانشگاه از هدر حذف → دسترسی سریع با برچسب «دانشکده» (`https://mst.aut.ac.ir/`)
|
||||
- [x] 5. «درباره ما» بعد از «دورهها»
|
||||
- [x] 6. «برنامهها» فعلاً مخفی (بدون لینک در UI)
|
||||
- [x] 15. «رویدادها» فعلاً مخفی از هوم/ناو
|
||||
|
||||
## فوتر
|
||||
- [x] 16. دسترسی سریع: سایت دانشکده + شبکه اساتید
|
||||
|
||||
## هویت بصری
|
||||
- [x] 3. فونت وزیرمتن (Vazirmatn)
|
||||
- [x] 7. لوگوی دانشکده (نشان بدون متن کناری؛ favicon از MstAut)
|
||||
- [x] 10. همه جا «دانشگاه صنعتی امیرکبیر» (نه «امیرکبیر» کوتاه)
|
||||
- [blocked] 11. پالت رنگی جدید از mst (کاربر میدهد)
|
||||
|
||||
## صفحه اصلی
|
||||
- [x] 8. حذف برد/کارت سکشن «چرا دانشگاه»
|
||||
- [x] 9. حذف شمارههای ۱–۲–۳ در «چرا دانشگاه»
|
||||
- [x] 12. در هوم فقط ۶ دورهٔ آخر (بدون فیلتر/سرچ شلوغ؛ لینک به کاتالوگ)
|
||||
- [x] 13. متن معرفی سکشنها بزرگتر
|
||||
- [x] 14. عرض یکسان سکشنها داخل Container (بدون full-bleed)
|
||||
|
||||
## اساتید
|
||||
- [x] 17a. فیلد لینک پروفایل دانشکده + اسکیما/ادمین
|
||||
- [x] 17b. ارتباط اختیاری دوره↔استاد
|
||||
- [x] 17c. کپی/seed اساتید از شبکه دانشکده + دکمه بروزرسانی ادمین از لینک هدر
|
||||
|
||||
## صفحه دورهها
|
||||
- [x] 18. دستهها بزرگتر؛ تگها کمی کوچکتر
|
||||
- [x] 19. سرچ آیکونی؛ با انیمیشن جایگزین دسته/تگ (هدر بدون دسته)
|
||||
- [x] 20. کل کارت دوره قابل کلیک
|
||||
- [x] 21. لیبل دسته/تگ روی کارت و جزئیات دوره کلیکپذیر (فیلتر)
|
||||
@@ -44,6 +44,21 @@
|
||||
| تب | `Tabs` |
|
||||
| اسکلتون | `Skeleton` |
|
||||
| نشان | `Badge` |
|
||||
| هیروی صفحه | `PageHero` (`size="lg"` + `actions` برای لندینگ) |
|
||||
| سرتیتر بخش | `SectionHeader` (eyebrow + title + description؛ `inverse` روی بخش تیره/قرمز) |
|
||||
| زمینه بخش | `Section tone="default \| subtle \| muted \| dark \| accent"` — بدون override برای `py-*` |
|
||||
| جزئیات برچسب/مقدار | `DetailList` |
|
||||
| فهرست نکات | `CheckList` |
|
||||
| آمار | `StatGrid` |
|
||||
| فرم عمومی | `FormCard` + `ContactInterestForm` |
|
||||
| دکمه روی زمینه تیره | `buttonVariants({ variant: "inverse" })` یا `DotCta onDark` |
|
||||
| خطا / ۴۰۴ | `ErrorState` / `(main)/not-found.tsx` |
|
||||
|
||||
**قوانین تکمیلی:**
|
||||
- اندازه تیترها فقط از `Heading` (level 1–4)؛ کلاس `text-*` روی تیتر override نشود.
|
||||
- `Card` روی hover بلند نمیشود؛ فقط کارتهای لینکدار با `SurfaceCard interactive`.
|
||||
- پنل کناری صفحات جزئیات: `SurfaceCard padded` + `DetailList` + دکمه `size="lg" w-full`.
|
||||
- رنگ خطا فقط `text-destructive`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# Active Context
|
||||
|
||||
## Current Goal
|
||||
تاکسونومی دوره (دسته + تگ ادمینمحور) پیاده شد (D25). لیبل ریشهٔ منو همچنان `courseNavParentTag` = «دورهها».
|
||||
چکلیست UI در `docs/Todo.Md` پیاده شد؛ سه آیتم blocked منتظر کاربر.
|
||||
|
||||
## Current Work
|
||||
- جداول `course_categories` / `course_tags` + junction؛ migration `007_course_taxonomy.sql`
|
||||
- ادمین: `/admin/course-categories`، `/admin/course-tags`؛ فرم دوره چندانتخابی
|
||||
- عمومی: منو از تگهای `show_in_nav`؛ فیلتر `/professional?tag=` و `?category=` با slug
|
||||
- مستند: `docs/LINKS.md`، domain-rules، D25
|
||||
- انجامشده: هدر/ناو/فوتر، فونت Vazirmatn، هوم، سرچ/کارت دورهها، اسکیما اساتید (`profile_url` + `course_faculty_links`)
|
||||
- لوگو دانشکده اعمال شد (`/brand/mst-faculty.png` + favicon)
|
||||
- Blocked: پالت رنگی mst (۱۱)، seed اساتید پس از دسترسی (۱۷c)
|
||||
|
||||
## Current Blockers
|
||||
بدون مانع.
|
||||
- پالت رنگی از کاربر
|
||||
- دسترسی به شبکه اساتید mst برای کپی داده
|
||||
|
||||
## Next Steps
|
||||
1. `node db/migrate.mjs` سپس در صورت نیاز `node db/seed.mjs` روی محیطهای موجود
|
||||
2. محتوای واقعی دسته/تگ/دوره از پنل ادمین
|
||||
1. دریافت پالت و بهروزرسانی توکنهای `globals.css`
|
||||
2. پس از دسترسی mst: seed اساتید با `profileUrl`
|
||||
@@ -42,7 +42,10 @@
|
||||
|
||||
## Next
|
||||
- [x] فاز H باقیمانده — ایندکسها، docs/README نهایی، حذف وابستگی runtime به mock، smoke script
|
||||
- [x] Todo UI سایت (هدر/هوم/دورهها/فونت/اسکیما اساتید) — جزئیات در `docs/Todo.Md`
|
||||
- [ ] محتوای واقعی از پنل ادمین (طبق دستور کاربر بعداً)
|
||||
- [x] لوگوی دانشکده (نشان بدون متن کناری + favicon)
|
||||
- [ ] Todo blocked: پالت mst، seed اساتید از شبکه دانشکده
|
||||
|
||||
## Milestones
|
||||
| مرحله | وضعیت | تاریخ |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"meta": {
|
||||
"homeTitle": "مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر",
|
||||
"homeDescription": "مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر؛ آموزش مدیران برای تحول در صنعت با تصمیمگیری دادهمحور، هوش مصنوعی و مدیریت تغییر.",
|
||||
"homeDescription": "مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر؛ پیوند دانش مدیریت، فناوری و تجربه برای مواجهه با مسائل کسبوکار.",
|
||||
"professionalTitle": "دورههای کوتاه و گواهیمحور | مدیریت علم و فناوری",
|
||||
"professionalDescription": "دورههای آنلاین و ترکیبی برای مدیران و متخصصان؛ فهرست دورهها و اعلام علاقه به ثبتنام."
|
||||
},
|
||||
@@ -81,13 +81,14 @@
|
||||
"offeredBy": "دانشکده مدیریت علم و فناوری — دانشگاه صنعتی امیرکبیر",
|
||||
"statsTitle": "دانشکده در یک نگاه",
|
||||
"rankTitle": "یادگیری در دانشگاه صنعتی امیرکبیر",
|
||||
"testimonialsTitle": "نظر شرکتکنندگان",
|
||||
"advisor": "مشاوره ثبتنام",
|
||||
"dppTitle": "یادگیری آنلاین و ترکیبی",
|
||||
"dppBody": "محتوای بهروز با تمرین و پروژه؛ مناسب شاغلانی که زمان محدود دارند."
|
||||
},
|
||||
"footer": {
|
||||
"links": "دسترسی سریع",
|
||||
"facultySite": "دانشکده",
|
||||
"facultyNetwork": "شبکه اساتید",
|
||||
"press": "روابط عمومی",
|
||||
"careers": "همکاری با ما",
|
||||
"copyright": "© {year} مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"react-dom": "19.2.8",
|
||||
"shadcn": "^4.21.0",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vazirmatn": "^33.0.3",
|
||||
"zod": "^4.6.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -10565,6 +10566,12 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vazirmatn": {
|
||||
"version": "33.0.3",
|
||||
"resolved": "https://registry.npmjs.org/vazirmatn/-/vazirmatn-33.0.3.tgz",
|
||||
"integrity": "sha512-fbjNc0CMjazZpIegWzz9OHGzI1APFboT+x7ZecXlUCtDe/nkyx7gtCTZnWS/+eeXG7fbfXymCPKJI8EsnM3iqw==",
|
||||
"license": "OFL"
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"react-dom": "19.2.8",
|
||||
"shadcn": "^4.21.0",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vazirmatn": "^33.0.3",
|
||||
"zod": "^4.6.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
|
After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 766 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 69 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 174 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 302 KiB |
|
After Width: | Height: | Size: 289 KiB |
|
After Width: | Height: | Size: 289 KiB |
|
After Width: | Height: | Size: 302 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 180 KiB |
|
After Width: | Height: | Size: 180 KiB |
|
After Width: | Height: | Size: 287 KiB |
|
After Width: | Height: | Size: 287 KiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* One-shot import of MST «شبکه اساتید» from a browser-saved folder.
|
||||
*
|
||||
* Usage:
|
||||
* node scripts/import-faculty-from-local.mjs
|
||||
* node scripts/import-faculty-from-local.mjs "C:\Users\...\شبکه اساتید"
|
||||
*
|
||||
* Reads DATABASE_URL from .env.local. Copies avatars into public/images/faculty.
|
||||
*/
|
||||
|
||||
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import pg from "pg";
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
|
||||
if (!process.env.DATABASE_URL) {
|
||||
const envPath = path.join(root, ".env.local");
|
||||
if (existsSync(envPath)) {
|
||||
for (const line of readFileSync(envPath, "utf8").split(/\r?\n/)) {
|
||||
const match = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/);
|
||||
if (match && !(match[1] in process.env)) {
|
||||
process.env[match[1]] = match[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!process.env.DATABASE_URL) {
|
||||
console.error("DATABASE_URL is not set.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function findDefaultFolder() {
|
||||
const downloads = path.join(process.env.USERPROFILE || "", "Downloads");
|
||||
if (!existsSync(downloads)) return null;
|
||||
const hit = readdirSync(downloads, { withFileTypes: true }).find(
|
||||
(d) => d.isDirectory() && d.name.includes("شبکه"),
|
||||
);
|
||||
return hit ? path.join(downloads, hit.name) : null;
|
||||
}
|
||||
|
||||
function findHtmlAndFiles(folder) {
|
||||
const entries = readdirSync(folder, { withFileTypes: true });
|
||||
const html = entries.find((e) => e.isFile() && e.name.endsWith(".html"));
|
||||
const filesDir = entries.find(
|
||||
(e) => e.isDirectory() && e.name.includes("_files"),
|
||||
);
|
||||
if (!html) throw new Error(`No .html in ${folder}`);
|
||||
return {
|
||||
htmlPath: path.join(folder, html.name),
|
||||
filesDir: filesDir ? path.join(folder, filesDir.name) : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
// Dynamic import of TS modules via Node + project ts runner is awkward;
|
||||
// re-implement a minimal upsert here mirroring sync-mst-network.ts.
|
||||
|
||||
function decodeEntities(s) {
|
||||
return s
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'")
|
||||
.replace(/ /g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function stripTags(s) {
|
||||
return decodeEntities(s.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim());
|
||||
}
|
||||
|
||||
function pickHref(block, classToken) {
|
||||
const re = new RegExp(
|
||||
`class="[^"]*${classToken}[^"]*"[^>]*href="([^"]+)"|href="([^"]+)"[^>]*class="[^"]*${classToken}[^"]*"`,
|
||||
"i",
|
||||
);
|
||||
const m = block.match(re);
|
||||
const href = m?.[1] || m?.[2] || "";
|
||||
if (!href || href.endsWith("orcid.org/")) return "";
|
||||
return decodeEntities(href);
|
||||
}
|
||||
|
||||
function formatPhone(tel) {
|
||||
let local = tel.replace(/\D/g, "");
|
||||
if (local.startsWith("98")) local = "0" + local.slice(2);
|
||||
if (local.length === 11 && local.startsWith("021")) {
|
||||
return `${local.slice(0, 3)}-${local.slice(3)}`;
|
||||
}
|
||||
return local || tel;
|
||||
}
|
||||
|
||||
function parseHtml(html) {
|
||||
const cardRe =
|
||||
/<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);
|
||||
});
|
||||
@@ -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 });
|
||||
}
|
||||
@@ -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();
|
||||
@@ -32,7 +32,10 @@ if (!process.env.DATABASE_URL) {
|
||||
|
||||
const client = new Client({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
connectionTimeoutMillis: 10000,
|
||||
// Match src/lib/db.ts — remote hosts often need >5–10s.
|
||||
connectionTimeoutMillis: Number(
|
||||
process.env.DATABASE_CONNECTION_TIMEOUT_MS ?? 20_000,
|
||||
),
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
@@ -3,14 +3,9 @@ import { notFound } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { FormCard } from "@/components/molecules/FormCard";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { ContactInterestForm } from "@/components/organisms/ContactInterestForm";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { getLegalPage } from "@/lib/data/site";
|
||||
|
||||
type Props = { params: Promise<{ slug: string }> };
|
||||
@@ -38,26 +33,21 @@ export default async function LegalSlugPage({ params }: Props) {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={page.title} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-2">
|
||||
<div className="space-y-5 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border sm:p-10">
|
||||
<Section tone="subtle">
|
||||
<Container className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] lg:items-start">
|
||||
<div className="min-w-0 space-y-5">
|
||||
{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}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
<Card className="rounded-2xl border-border/70 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle>ارسال پیام</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<FormCard title="ارسال پیام">
|
||||
<ContactInterestForm
|
||||
submitLabel={t("submit")}
|
||||
successLabel={t("registerSuccess")}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</FormCard>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { AboutTemplate } from "@/components/templates/AboutTemplate";
|
||||
import { getTopics } from "@/lib/data/site";
|
||||
import { aboutFocusAreas, siteMission } from "@/lib/site-config";
|
||||
import { aboutContent } from "@/lib/site-config";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return { title: t("aboutTitle"), description: siteMission };
|
||||
return {
|
||||
title: t("aboutTitle"),
|
||||
description: aboutContent.intro,
|
||||
};
|
||||
}
|
||||
|
||||
export default async function AboutPage() {
|
||||
@@ -21,50 +17,7 @@ export default async function AboutPage() {
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
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>
|
||||
<AboutTemplate topics={topics} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -21,26 +21,26 @@ export default async function AlumniPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("alumniTitle")} intro={t("alumniIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-8 md:grid-cols-3">
|
||||
<div className="grid gap-5 md:grid-cols-3">
|
||||
{stories.map((story) => (
|
||||
<SurfaceCard
|
||||
key={story.id}
|
||||
id={story.id}
|
||||
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
|
||||
src={story.imageUrl}
|
||||
alt={story.name}
|
||||
fill
|
||||
className="object-cover transition-transform duration-500 group-hover:scale-[1.03]"
|
||||
className="object-cover"
|
||||
sizes="(max-width:768px) 100vw, 33vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-5">
|
||||
<div className="p-6">
|
||||
<BadgeLabel>{story.program}</BadgeLabel>
|
||||
<Heading as="h2" level={4} className="mt-3">
|
||||
{story.title}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { ContactDetails } from "@/components/molecules/ContactDetails";
|
||||
import { FormCard } from "@/components/molecules/FormCard";
|
||||
import { ContactInterestForm } from "@/components/organisms/ContactInterestForm";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { siteAddress } from "@/lib/site-config";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
@@ -24,49 +18,15 @@ export default async function ContactPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("contactTitle")} intro={t("contactIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-2">
|
||||
<div className="space-y-5 lg:pt-4">
|
||||
<Heading level={2}>اطلاعات تماس</Heading>
|
||||
<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>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] lg:items-start">
|
||||
<ContactDetails />
|
||||
<FormCard title="ارسال پیام">
|
||||
<ContactInterestForm
|
||||
submitLabel={t("submit")}
|
||||
successLabel={t("registerSuccess")}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</FormCard>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
|
||||
@@ -1,35 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ErrorState } from "@/components/organisms/ErrorState";
|
||||
|
||||
export default function MainError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
export default function MainError(props: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<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>
|
||||
);
|
||||
return <ErrorState {...props} />;
|
||||
}
|
||||
@@ -1,14 +1,23 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { CalendarDays, MapPin } from "lucide-react";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { DetailList } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { getEventById } from "@/lib/data/events";
|
||||
|
||||
type Props = { params: Promise<{ id: string }> };
|
||||
|
||||
const dateFormat: Intl.DateTimeFormatOptions = {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
};
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const event = await getEventById(id);
|
||||
@@ -21,36 +30,37 @@ export default async function EventDetailPage({ params }: Props) {
|
||||
const event = await getEventById(id);
|
||||
if (!event) notFound();
|
||||
|
||||
const start = new Date(event.startDate).toLocaleDateString("fa-IR", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
});
|
||||
const start = new Date(event.startDate).toLocaleDateString("fa-IR", dateFormat);
|
||||
const end = event.endDate
|
||||
? new Date(event.endDate).toLocaleDateString("fa-IR", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})
|
||||
? new Date(event.endDate).toLocaleDateString("fa-IR", dateFormat)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={event.title} intro={event.summary} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container narrow className="space-y-5 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border sm:p-10">
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">زمان: </span>
|
||||
{start}
|
||||
{end ? ` تا ${end}` : ""}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">مکان: </span>
|
||||
{event.location}
|
||||
</p>
|
||||
<Heading level={3}>درباره رویداد</Heading>
|
||||
<p className="leading-8 text-foreground/90">{event.summary}</p>
|
||||
<TextLink href="/events">بازگشت به رویدادها</TextLink>
|
||||
<Section tone="subtle">
|
||||
<Container narrow className="space-y-6">
|
||||
<SurfaceCard padded as="div">
|
||||
<DetailList
|
||||
items={[
|
||||
{
|
||||
icon: CalendarDays,
|
||||
label: "زمان",
|
||||
value: end ? `${start} تا ${end}` : start,
|
||||
},
|
||||
{ icon: MapPin, label: "مکان", value: event.location },
|
||||
]}
|
||||
/>
|
||||
</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>
|
||||
</Section>
|
||||
</main>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function EventsPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("eventsTitle")} intro={t("eventsIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{events.map((event) => (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { facultyNetworkUrl } from "@/lib/site-config";
|
||||
|
||||
export default function FacultyPage() {
|
||||
redirect("https://mst.aut.ac.ir/content/31094/شبکه-اساتید");
|
||||
redirect(facultyNetworkUrl);
|
||||
}
|
||||
@@ -2,11 +2,9 @@ import type { Metadata } from "next";
|
||||
import Image from "next/image";
|
||||
import { notFound } from "next/navigation";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { BadgeLabel } from "@/components/atoms/BadgeLabel";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { getArticleById } from "@/lib/data/articles";
|
||||
import { JsonLd } from "@/lib/seo/json-ld";
|
||||
|
||||
@@ -39,21 +37,14 @@ export default async function InsightDetailPage({ params }: Props) {
|
||||
image: article.imageUrl,
|
||||
}}
|
||||
/>
|
||||
<Section tone="dark" className="relative overflow-hidden pb-16 pt-16 sm:pb-20 sm:pt-20">
|
||||
<MetamorphField tone="dark" density="sparse" className="opacity-35" />
|
||||
<Container narrow className="relative z-[1]">
|
||||
<BadgeLabel>{article.category}</BadgeLabel>
|
||||
<Heading as="h1" level={1} className="mt-4 text-background">
|
||||
{article.title}
|
||||
</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">
|
||||
<PageHero
|
||||
eyebrow={article.category}
|
||||
title={article.title}
|
||||
intro={`${article.author} · ${date}`}
|
||||
/>
|
||||
<Section tone="subtle">
|
||||
<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
|
||||
src={article.imageUrl}
|
||||
alt={article.title}
|
||||
@@ -63,8 +54,10 @@ export default async function InsightDetailPage({ params }: Props) {
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
<p className="text-lg leading-9 text-foreground/90">{article.body}</p>
|
||||
<TextLink href="/insights" className="mt-10 inline-block">
|
||||
<p className="text-base leading-8 text-foreground/90 sm:text-lg sm:leading-9">
|
||||
{article.body}
|
||||
</p>
|
||||
<TextLink href="/insights" className="mt-10 inline-block text-sm">
|
||||
بازگشت به مقالات
|
||||
</TextLink>
|
||||
</Container>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function InsightsPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("insightsTitle")} intro={t("insightsIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="mx-auto max-w-5xl">
|
||||
{articles.map((article) => (
|
||||
|
||||
@@ -7,7 +7,11 @@ import { getCourses } from "@/lib/data/courses";
|
||||
import { listPublishedCourseTags } from "@/lib/data/taxonomy";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import { getCampaignBanners } from "@/lib/data/site";
|
||||
import { siteShortName } from "@/lib/site-config";
|
||||
import {
|
||||
facultyNetworkUrl,
|
||||
facultySiteUrl,
|
||||
siteShortName,
|
||||
} from "@/lib/site-config";
|
||||
|
||||
// Public CMS pages must read Postgres at request time — static bake at Docker
|
||||
// build often has no DATABASE_URL and ships empty lists.
|
||||
@@ -42,12 +46,9 @@ export default async function MainLayout({
|
||||
<SiteHeader
|
||||
items={navItems}
|
||||
searchLabel={t("nav.search")}
|
||||
contactLabel={t("nav.contact")}
|
||||
brandTitle={siteShortName}
|
||||
brandSubtitle={t("nav.brandSubtitle")}
|
||||
academicsLabel={t("nav.academics")}
|
||||
programSelectorTitle={t("home.programSelectorTitle")}
|
||||
executiveLabel={t("home.executiveLabel")}
|
||||
exploreLabel={t("home.exploreOurPrograms")}
|
||||
variant="home"
|
||||
courses={courses}
|
||||
programs={programs}
|
||||
@@ -58,6 +59,8 @@ export default async function MainLayout({
|
||||
copyright={t("footer.copyright", { year })}
|
||||
linksTitle={t("footer.links")}
|
||||
links={[
|
||||
{ label: t("footer.facultySite"), href: facultySiteUrl },
|
||||
{ label: t("footer.facultyNetwork"), href: facultyNetworkUrl },
|
||||
{ label: t("footer.press"), href: "/press" },
|
||||
{ label: t("footer.careers"), href: "/careers" },
|
||||
]}
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import {
|
||||
HomeEvents,
|
||||
HomeApproach,
|
||||
HomeCourseSearch,
|
||||
HomeHero,
|
||||
HomeIdeas,
|
||||
HomeRest,
|
||||
type HomeLabels,
|
||||
} from "@/components/templates/HomeTemplate";
|
||||
import { getFeaturedArticle } from "@/lib/data/articles";
|
||||
import { getEvents } from "@/lib/data/events";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import { getLatestCourses } from "@/lib/data/courses";
|
||||
import { getSiteStats, getTopics } from "@/lib/data/site";
|
||||
|
||||
async function getLabels(): Promise<HomeLabels> {
|
||||
@@ -31,84 +31,57 @@ async function getLabels(): Promise<HomeLabels> {
|
||||
findUsTitle: t("home.findUsTitle"),
|
||||
ideasEyebrow: t("home.ideasEyebrow"),
|
||||
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 {
|
||||
return await load();
|
||||
} catch (err) {
|
||||
console.error(`[home] ${label} failed:`, err);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
async function HeroSection() {
|
||||
const [featured, labels] = await Promise.all([
|
||||
getFeaturedArticle(),
|
||||
orFallback("featured article", getFeaturedArticle, null),
|
||||
getLabels(),
|
||||
]);
|
||||
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() {
|
||||
try {
|
||||
const [events, labels] = await Promise.all([getEvents(), getLabels()]);
|
||||
async function CourseSearchSection() {
|
||||
const data = await orFallback(
|
||||
"latest courses",
|
||||
() =>
|
||||
Promise.all([getLatestCourses(6), getLabels()]),
|
||||
null,
|
||||
);
|
||||
if (!data) return null;
|
||||
const [courses, labels] = data;
|
||||
return (
|
||||
<HomeEvents
|
||||
events={events}
|
||||
title={labels.eventsTitle}
|
||||
seeAllLabel={labels.seeAllEvents}
|
||||
<HomeCourseSearch
|
||||
courses={courses}
|
||||
exploreLabel={labels.exploreCourses}
|
||||
/>
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[home] EventsSection failed:", err);
|
||||
const labels = await getLabels();
|
||||
return (
|
||||
<HomeEvents
|
||||
events={[]}
|
||||
title={labels.eventsTitle}
|
||||
seeAllLabel={labels.seeAllEvents}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function RestSection() {
|
||||
try {
|
||||
const [programs, intersections, stats, labels] = await Promise.all([
|
||||
getPrograms(),
|
||||
getTopics(),
|
||||
getSiteStats(),
|
||||
const [intersections, stats, labels] = await Promise.all([
|
||||
orFallback("topics", getTopics, []),
|
||||
orFallback("site stats", getSiteStats, []),
|
||||
getLabels(),
|
||||
]);
|
||||
const carouselPrograms = programs.filter((p) =>
|
||||
[
|
||||
"management-core",
|
||||
"evening-management",
|
||||
"executive",
|
||||
"leadership-fellows",
|
||||
"business-analytics",
|
||||
"finance",
|
||||
].includes(p.slug),
|
||||
);
|
||||
return (
|
||||
<HomeRest
|
||||
labels={labels}
|
||||
carouselPrograms={carouselPrograms}
|
||||
intersections={intersections}
|
||||
stats={stats}
|
||||
/>
|
||||
<HomeRest labels={labels} 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() {
|
||||
@@ -116,7 +89,8 @@ export default function HomePage() {
|
||||
<main id="main-content">
|
||||
<HeroSection />
|
||||
<HomeIdeas />
|
||||
<EventsSection />
|
||||
<CourseSearchSection />
|
||||
<HomeApproach />
|
||||
<RestSection />
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,10 @@ import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { CheckList } from "@/components/molecules/CheckList";
|
||||
import { DetailList } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -43,66 +46,68 @@ export default async function ProgramDetailPage({ params }: Props) {
|
||||
intro={program.blurb}
|
||||
eyebrow={program.tagline}
|
||||
/>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-[2fr_1fr]">
|
||||
<div>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
|
||||
<div className="min-w-0 space-y-10">
|
||||
<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")}
|
||||
</Heading>
|
||||
<ul className="mt-4 list-disc space-y-2 ps-5 text-sm leading-7">
|
||||
{program.highlights.map((item) => (
|
||||
<li key={item}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
<CheckList items={program.highlights} />
|
||||
</section>
|
||||
) : null}
|
||||
</div>
|
||||
<aside className="h-fit space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border">
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">مخاطب: </span>
|
||||
{program.audience}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">مدت: </span>
|
||||
{program.durationLabel}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">فرمت: </span>
|
||||
{program.formatLabel}
|
||||
</p>
|
||||
<aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
|
||||
<SurfaceCard padded as="div">
|
||||
<DetailList
|
||||
items={[
|
||||
{ label: "مخاطب", value: program.audience },
|
||||
{ label: "مدت", value: program.durationLabel },
|
||||
{ label: "فرمت", value: program.formatLabel },
|
||||
]}
|
||||
/>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(buttonVariants(), "w-full")}
|
||||
className={cn(buttonVariants({ size: "lg" }), "mt-6 w-full font-bold")}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
<TextLink href="/programs" className="block text-sm">
|
||||
</SurfaceCard>
|
||||
<TextLink href="/programs" className="block px-1 text-sm">
|
||||
{t("backToPrograms")}
|
||||
</TextLink>
|
||||
</aside>
|
||||
</Container>
|
||||
</Section>
|
||||
{related.length > 0 ? (
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<Heading level={2}>{t("relatedCourses")}</Heading>
|
||||
<ul className="mt-6 grid gap-4 sm:grid-cols-3">
|
||||
<SectionHeader title={t("relatedCourses")} />
|
||||
<ul className="grid gap-4 sm:grid-cols-3">
|
||||
{related.map((course) => (
|
||||
<li key={course.id}>
|
||||
<SurfaceCard padded="sm" as="div" className="h-full">
|
||||
<Link
|
||||
href={course.registrationUrl}
|
||||
className="font-semibold hover:text-primary"
|
||||
<Link href={course.registrationUrl} className="group block h-full">
|
||||
<SurfaceCard padded as="div" interactive className="h-full">
|
||||
<Heading
|
||||
as="h3"
|
||||
level={4}
|
||||
className="transition-colors group-hover:text-primary"
|
||||
>
|
||||
{course.title}
|
||||
</Link>
|
||||
<p className="mt-2 line-clamp-3 text-sm text-muted-foreground">
|
||||
</Heading>
|
||||
<p className="mt-2 line-clamp-3 text-sm leading-7 text-muted-foreground">
|
||||
{course.summary}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Container>
|
||||
</Section>
|
||||
) : null}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,9 @@ import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { BadgeLabel } from "@/components/atoms/BadgeLabel";
|
||||
import { DetailList } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -28,8 +30,8 @@ export default async function ProgramsPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("programsTitle")} intro={t("programsIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="space-y-10">
|
||||
<Section tone="subtle">
|
||||
<Container className="space-y-16">
|
||||
<ProgramGroup title={t("standardGroup")} items={standard} />
|
||||
<ProgramGroup title={t("executiveGroup")} items={executive} />
|
||||
</Container>
|
||||
@@ -45,40 +47,35 @@ function ProgramGroup({
|
||||
title: string;
|
||||
items: Awaited<ReturnType<typeof getPrograms>>;
|
||||
}) {
|
||||
if (items.length === 0) return null;
|
||||
return (
|
||||
<div>
|
||||
<Heading level={2} className="mb-6">
|
||||
{title}
|
||||
</Heading>
|
||||
<SectionHeader title={title} className="mb-6 sm:mb-8" />
|
||||
<div className="grid gap-5 md:grid-cols-2">
|
||||
{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>
|
||||
) : null}
|
||||
<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}
|
||||
</Link>
|
||||
</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}
|
||||
</p>
|
||||
<dl className="mt-4 grid grid-cols-2 gap-2 text-xs text-muted-foreground">
|
||||
<div>
|
||||
<dt className="font-semibold text-foreground">مخاطب</dt>
|
||||
<dd>{program.audience}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<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>
|
||||
<DetailList
|
||||
className="mt-5 border-t border-border pt-4"
|
||||
items={[
|
||||
{ label: "مخاطب", value: program.audience },
|
||||
{ label: "مدت", value: program.durationLabel },
|
||||
{ label: "فرمت", value: program.formatLabel },
|
||||
]}
|
||||
/>
|
||||
<Link
|
||||
href={program.href}
|
||||
className={cn(buttonVariants({ variant: "outline" }), "mt-5 w-fit")}
|
||||
className={cn(buttonVariants({ variant: "outline" }), "mt-6 w-fit")}
|
||||
>
|
||||
جزئیات برنامه
|
||||
</Link>
|
||||
|
||||
@@ -4,9 +4,10 @@ import { notFound } from "next/navigation";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { CheckList } from "@/components/molecules/CheckList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getTopicBySlug } from "@/lib/data/site";
|
||||
|
||||
@@ -31,25 +32,27 @@ export default async function TopicPage({ params }: Props) {
|
||||
intro={topic.description}
|
||||
imageUrl={topic.imageUrl}
|
||||
/>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-[2fr_1fr]">
|
||||
<div>
|
||||
<p className="text-base leading-8">{topic.body}</p>
|
||||
<ul className="mt-8 list-disc space-y-2 ps-5 text-sm">
|
||||
{topic.highlights.map((h) => (
|
||||
<li key={h}>{h}</li>
|
||||
))}
|
||||
</ul>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
|
||||
<div className="min-w-0 space-y-8">
|
||||
<p className="text-base leading-8 text-foreground/90">{topic.body}</p>
|
||||
{topic.highlights.length > 0 ? (
|
||||
<CheckList items={topic.highlights} />
|
||||
) : null}
|
||||
</div>
|
||||
<aside className="h-fit space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
<aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
|
||||
<SurfaceCard padded as="div">
|
||||
<p className="text-sm leading-7 text-muted-foreground">
|
||||
دورههای مرتبط با این موضوع را در فهرست دورههای کوتاه ببینید.
|
||||
</p>
|
||||
<Link href="/professional" className={cn(buttonVariants())}>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(buttonVariants({ size: "lg" }), "mt-5 w-full font-bold")}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
<Separator />
|
||||
<TextLink href="/" className="block text-sm">
|
||||
</SurfaceCard>
|
||||
<TextLink href="/" className="block px-1 text-sm">
|
||||
بازگشت به خانه
|
||||
</TextLink>
|
||||
</aside>
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { 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";
|
||||
|
||||
const FA_INDEX = ["۱", "۲", "۳", "۴", "۵", "۶"] as const;
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return { title: t("valuesTitle"), description: valuesContent.intro };
|
||||
@@ -15,24 +21,57 @@ export default async function ValuesPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
eyebrow="ارزشهای آموزشی ما"
|
||||
eyebrow={valuesContent.eyebrow}
|
||||
title={valuesContent.title}
|
||||
intro={valuesContent.intro}
|
||||
/>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-5 sm:grid-cols-2">
|
||||
{valuesContent.items.map((item) => (
|
||||
<Card key={item.title} className="rounded-2xl border-border/70 shadow-sm transition-[box-shadow,border-color] hover:border-primary/20 hover:shadow-md">
|
||||
<CardHeader>
|
||||
<CardTitle>{item.title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm leading-7 text-muted-foreground">
|
||||
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
|
||||
{valuesContent.items.map((item, index) => (
|
||||
<SurfaceCard key={item.title} padded>
|
||||
<p className="text-xs font-semibold text-primary/80">
|
||||
{FA_INDEX[index] ?? String(index + 1)}
|
||||
</p>
|
||||
<Heading as="h2" level={4} className="mt-2">
|
||||
{item.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
{item.text}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</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>
|
||||
</Container>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ENTITIES } from "@/lib/admin/entities";
|
||||
import { isAdminEntityEnabled } from "@/lib/admin/disabled-entities";
|
||||
import { GenericFilters } from "@/components/organisms/admin/generic/GenericFilters";
|
||||
import { GenericTable } from "@/components/organisms/admin/generic/GenericTable";
|
||||
import { FacultySyncButton } from "@/components/organisms/admin/FacultySyncButton";
|
||||
import {
|
||||
AdminPage,
|
||||
AdminPageHeader,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
} from "@/components/organisms/admin/AdminPage";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { facultyNetworkUrl } from "@/lib/site-config";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -32,15 +34,37 @@ export default async function AdminEntityListPage({
|
||||
|
||||
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 (
|
||||
<AdminPage>
|
||||
<AdminPageHeader
|
||||
title={spec.navLabel}
|
||||
description={`${rows.length} مورد${search ? ` مطابق فیلتر «${search}»` : ""}`}
|
||||
description={description}
|
||||
actions={
|
||||
<>
|
||||
{entity === "faculty" ? <FacultySyncButton /> : null}
|
||||
<Link href={`/admin/${entity}/new`} className={cn(buttonVariants())}>
|
||||
+ {spec.noun} جدید
|
||||
</Link>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
AdminPage,
|
||||
AdminPageHeader,
|
||||
} from "@/components/organisms/admin/AdminPage";
|
||||
import { listAdminFaculty } from "@/lib/data/admin/cms";
|
||||
import {
|
||||
listAdminCourseCategories,
|
||||
listAdminCourseTags,
|
||||
@@ -18,10 +19,11 @@ export default async function EditCoursePage({
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
const [course, categories, tags] = await Promise.all([
|
||||
const [course, categories, tags, faculty] = await Promise.all([
|
||||
getAdminCourseById(id),
|
||||
listAdminCourseCategories(),
|
||||
listAdminCourseTags(),
|
||||
listAdminFaculty(),
|
||||
]);
|
||||
if (!course) notFound();
|
||||
|
||||
@@ -33,7 +35,16 @@ export default async function EditCoursePage({
|
||||
backHref="/admin/courses"
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
AdminPage,
|
||||
AdminPageHeader,
|
||||
} from "@/components/organisms/admin/AdminPage";
|
||||
import { listAdminFaculty } from "@/lib/data/admin/cms";
|
||||
import {
|
||||
listAdminCourseCategories,
|
||||
listAdminCourseTags,
|
||||
@@ -11,9 +12,10 @@ import {
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function NewCoursePage() {
|
||||
const [categories, tags] = await Promise.all([
|
||||
const [categories, tags, faculty] = await Promise.all([
|
||||
listAdminCourseCategories(),
|
||||
listAdminCourseTags(),
|
||||
listAdminFaculty(),
|
||||
]);
|
||||
|
||||
return (
|
||||
@@ -24,7 +26,15 @@ export default async function NewCoursePage() {
|
||||
backHref="/admin/courses"
|
||||
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>
|
||||
);
|
||||
}
|
||||
@@ -12,7 +12,15 @@ export default async function AdminGuardLayout({
|
||||
}: {
|
||||
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) {
|
||||
redirect("/admin/login");
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ function LoginForm() {
|
||||
<CardHeader className="space-y-3 text-center">
|
||||
<div className="mx-auto relative size-14">
|
||||
<Image
|
||||
src="/brand/amirkabir.png"
|
||||
src="/brand/mst-faculty.png"
|
||||
alt="دانشگاه صنعتی امیرکبیر"
|
||||
fill
|
||||
sizes="56px"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { revalidateSite } from "@/lib/api/revalidate";
|
||||
import { getAdminCourseById } from "@/lib/data/admin/courses";
|
||||
import {
|
||||
setCourseCategories,
|
||||
setCourseFaculty,
|
||||
setCourseTags,
|
||||
} from "@/lib/data/admin/taxonomy";
|
||||
|
||||
@@ -68,7 +69,7 @@ export async function PATCH(
|
||||
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 values: unknown[] = [];
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -106,6 +112,9 @@ export async function PATCH(
|
||||
if (tagIds !== undefined) {
|
||||
await setCourseTags(id, tagIds);
|
||||
}
|
||||
if (facultyIds !== undefined) {
|
||||
await setCourseFaculty(id, facultyIds);
|
||||
}
|
||||
|
||||
const course = await getAdminCourseById(id);
|
||||
revalidateSite();
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from "@/lib/data/admin/courses";
|
||||
import {
|
||||
setCourseCategories,
|
||||
setCourseFaculty,
|
||||
setCourseTags,
|
||||
} from "@/lib/data/admin/taxonomy";
|
||||
|
||||
@@ -83,6 +84,7 @@ export async function POST(request: NextRequest) {
|
||||
);
|
||||
await setCourseCategories(id, d.categoryIds ?? []);
|
||||
await setCourseTags(id, d.tagIds ?? []);
|
||||
await setCourseFaculty(id, d.facultyIds ?? []);
|
||||
const course = await getAdminCourseById(id);
|
||||
revalidateSite();
|
||||
return NextResponse.json({ ok: true, data: course }, { status: 201 });
|
||||
|
||||
@@ -21,6 +21,7 @@ const FACULTY_COLUMNS: Record<string, string> = {
|
||||
department: "department",
|
||||
linkedinUrl: "linkedin_url",
|
||||
scholarUrl: "scholar_url",
|
||||
profileUrl: "profile_url",
|
||||
published: "published",
|
||||
};
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ export async function POST(request: NextRequest) {
|
||||
[
|
||||
"id", "name", "title", "focus", "bio", "image_url",
|
||||
"email", "office", "phone", "department", "linkedin_url", "scholar_url",
|
||||
"published",
|
||||
"profile_url", "published",
|
||||
],
|
||||
[
|
||||
id, d.name, d.title, d.focus, d.bio, d.imageUrl,
|
||||
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,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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 } });
|
||||
} catch (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 });
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-iransans);
|
||||
--font-heading: var(--font-iransans);
|
||||
--font-sans: var(--font-vazirmatn);
|
||||
--font-heading: var(--font-vazirmatn);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--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%);
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
|
||||
@supports (animation-timeline: view()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import localFont from "next/font/local";
|
||||
import { Vazirmatn } from "next/font/google";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getMessages, getTranslations } from "next-intl/server";
|
||||
import { JsonLd, organizationJsonLd } from "@/lib/seo/json-ld";
|
||||
@@ -11,51 +11,11 @@ export const viewport: Viewport = {
|
||||
viewportFit: "cover",
|
||||
};
|
||||
|
||||
const iranSans = localFont({
|
||||
src: [
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansUltraLight.woff2",
|
||||
weight: "200",
|
||||
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",
|
||||
const vazirmatn = Vazirmatn({
|
||||
subsets: ["arabic", "latin"],
|
||||
variable: "--font-vazirmatn",
|
||||
display: "swap",
|
||||
weight: ["200", "300", "400", "500", "600", "700", "800", "900"],
|
||||
});
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
@@ -70,8 +30,11 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
},
|
||||
description: t("homeDescription"),
|
||||
icons: {
|
||||
icon: [{ url: "/brand/amirkabir.png", type: "image/png" }],
|
||||
apple: [{ url: "/brand/amirkabir.png", type: "image/png" }],
|
||||
icon: [
|
||||
{ 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: {
|
||||
type: "website",
|
||||
@@ -79,7 +42,9 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
siteName: t("homeTitle"),
|
||||
title: t("homeTitle"),
|
||||
description: t("homeDescription"),
|
||||
images: [{ url: "/brand/amirkabir.png", alt: "دانشگاه صنعتی امیرکبیر" }],
|
||||
images: [
|
||||
{ url: "/brand/mst-faculty.png", alt: "دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر" },
|
||||
],
|
||||
},
|
||||
alternates: {
|
||||
canonical: "/",
|
||||
@@ -98,7 +63,7 @@ export default async function RootLayout({
|
||||
const t = await getTranslations("nav");
|
||||
|
||||
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">
|
||||
<NextIntlClientProvider messages={messages}>
|
||||
<a
|
||||
|
||||
@@ -1,40 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ErrorState } from "@/components/organisms/ErrorState";
|
||||
|
||||
export default function ProfessionalError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
export default function ProfessionalError(props: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
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>
|
||||
);
|
||||
return <ErrorState {...props} homeHref="/professional" />;
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import { listPublishedCourseTags } from "@/lib/data/taxonomy";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import {
|
||||
courseNavParentTag,
|
||||
facultyNetworkUrl,
|
||||
facultySiteUrl,
|
||||
professionalNav,
|
||||
siteShortName,
|
||||
} from "@/lib/site-config";
|
||||
@@ -47,12 +49,9 @@ export default async function ProfessionalLayout({
|
||||
<SiteHeader
|
||||
items={navItems}
|
||||
searchLabel={t("nav.search")}
|
||||
contactLabel={t("nav.contact")}
|
||||
brandTitle={siteShortName}
|
||||
brandSubtitle={t("nav.brandSubtitle")}
|
||||
academicsLabel={t("nav.academics")}
|
||||
programSelectorTitle={t("home.programSelectorTitle")}
|
||||
executiveLabel={t("home.executiveLabel")}
|
||||
exploreLabel={t("home.exploreOurPrograms")}
|
||||
variant="professional"
|
||||
courses={courses}
|
||||
programs={programs}
|
||||
@@ -63,6 +62,8 @@ export default async function ProfessionalLayout({
|
||||
copyright={t("footer.copyright", { year })}
|
||||
linksTitle={t("footer.links")}
|
||||
links={[
|
||||
{ label: t("footer.facultySite"), href: facultySiteUrl },
|
||||
{ label: t("footer.facultyNetwork"), href: facultyNetworkUrl },
|
||||
{ label: t("footer.press"), href: "/press" },
|
||||
{ label: t("footer.careers"), href: "/careers" },
|
||||
]}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
listPublishedCourseCategories,
|
||||
listPublishedCourseTags,
|
||||
} 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";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
@@ -33,11 +33,9 @@ export default async function ProfessionalPage({
|
||||
const { tag: tagRaw, category: categoryRaw } = await searchParams;
|
||||
const initialTag = tagRaw?.trim() ?? "";
|
||||
const initialCategory = categoryRaw?.trim() ?? "";
|
||||
const [courses, stats, testimonials, filterCategories, filterTags] =
|
||||
await Promise.all([
|
||||
const [courses, stats, filterCategories, filterTags] = await Promise.all([
|
||||
getCourses(),
|
||||
getSiteStats(),
|
||||
getTestimonials(),
|
||||
listPublishedCourseCategories({ filterOnly: true }),
|
||||
listPublishedCourseTags({ filterOnly: true }),
|
||||
]);
|
||||
@@ -59,11 +57,9 @@ export default async function ProfessionalPage({
|
||||
dppBody: t("professional.dppBody"),
|
||||
statsTitle: t("professional.statsTitle"),
|
||||
rankTitle: t("professional.rankTitle"),
|
||||
testimonialsTitle: t("professional.testimonialsTitle"),
|
||||
}}
|
||||
courses={courses}
|
||||
stats={stats}
|
||||
testimonials={testimonials}
|
||||
filterCategories={filterCategories}
|
||||
filterTags={filterTags}
|
||||
initialTag={initialTag}
|
||||
|
||||
@@ -2,7 +2,8 @@ import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
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 = {
|
||||
href?: string;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const levels = {
|
||||
1: "text-3xl font-bold tracking-tight sm:text-4xl lg:text-5xl",
|
||||
2: "text-2xl font-bold tracking-tight sm:text-3xl",
|
||||
3: "text-lg font-semibold sm:text-xl",
|
||||
4: "text-base font-semibold sm:text-lg",
|
||||
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 leading-snug tracking-tight text-pretty sm:text-3xl lg:text-4xl",
|
||||
3: "text-lg font-semibold leading-snug sm:text-xl",
|
||||
4: "text-base font-semibold leading-snug sm:text-lg",
|
||||
} as const;
|
||||
|
||||
type HeadingProps = React.ComponentProps<"h1"> & {
|
||||
|
||||
@@ -1,73 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type MetamorphFieldProps = {
|
||||
className?: string;
|
||||
/** `dark` = light strokes on navy/hero; `light` = ink strokes on sand/muted */
|
||||
tone?: "dark" | "light";
|
||||
/** Visual density of the constellation */
|
||||
/** Visual density of the neural field */
|
||||
density?: "sparse" | "normal";
|
||||
};
|
||||
|
||||
type Node = { x: number; y: number; r?: number };
|
||||
type Edge = [number, number];
|
||||
type Point = { x: number; y: number };
|
||||
|
||||
/** Landscape constellation — matches typical flex section bands (≈ 2.5∶1) */
|
||||
const NODES_NORMAL: Node[] = [
|
||||
{ x: 40, y: 60, r: 2.1 },
|
||||
{ x: 130, y: 36, r: 1.7 },
|
||||
{ x: 220, y: 88, r: 2.4 },
|
||||
{ x: 100, y: 140, r: 1.5 },
|
||||
{ x: 190, y: 168, r: 2.0 },
|
||||
{ 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 },
|
||||
];
|
||||
type Node = {
|
||||
id: number;
|
||||
x: number;
|
||||
y: number;
|
||||
r: number;
|
||||
layer: number;
|
||||
active: boolean;
|
||||
};
|
||||
|
||||
const EDGES_NORMAL: Edge[] = [
|
||||
[0, 1], [1, 2], [0, 3], [1, 3], [2, 4], [3, 4], [2, 5], [4, 5],
|
||||
[5, 6], [5, 7], [6, 7], [6, 8], [7, 8], [8, 9], [7, 9],
|
||||
[8, 10], [9, 11], [10, 11], [10, 12], [11, 12], [12, 13], [11, 13], [13, 14],
|
||||
[3, 15], [4, 16], [5, 17], [7, 18], [8, 19], [9, 20], [11, 21], [12, 22], [13, 23], [14, 24],
|
||||
[15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25],
|
||||
[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],
|
||||
];
|
||||
type Synapse = {
|
||||
d: string;
|
||||
from: number;
|
||||
to: number;
|
||||
active: boolean;
|
||||
weight: number;
|
||||
};
|
||||
|
||||
const VIEW_W = 1200;
|
||||
const VIEW_H = 480;
|
||||
@@ -75,9 +36,123 @@ const VIEW_H = 480;
|
||||
const ENABLE_MQ =
|
||||
"(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 —
|
||||
* SMIL/CSS motion was too expensive on phones.
|
||||
* Soft layered neural net: nodes in columns, curved synapses between
|
||||
* 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({
|
||||
className,
|
||||
@@ -85,6 +160,10 @@ export function MetamorphField({
|
||||
density = "normal",
|
||||
}: MetamorphFieldProps) {
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
const { nodes, synapses } = useMemo(
|
||||
() => buildNetwork(density),
|
||||
[density],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const mq = window.matchMedia(ENABLE_MQ);
|
||||
@@ -96,19 +175,27 @@ export function MetamorphField({
|
||||
|
||||
if (!enabled) return null;
|
||||
|
||||
const nodes = density === "sparse" ? NODES_SPARSE : NODES_NORMAL;
|
||||
const edges = density === "sparse" ? EDGES_SPARSE : EDGES_NORMAL;
|
||||
const stroke =
|
||||
tone === "dark" ? "color-mix(in oklab, white 55%, transparent)" : "var(--foreground)";
|
||||
const fill =
|
||||
tone === "dark" ? "color-mix(in oklab, white 70%, transparent)" : "var(--primary)";
|
||||
const edge =
|
||||
tone === "dark"
|
||||
? "color-mix(in oklab, white 42%, transparent)"
|
||||
: "color-mix(in oklab, var(--foreground) 36%, transparent)";
|
||||
const edgeActive =
|
||||
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 core =
|
||||
tone === "dark" ? "var(--chart-3)" : "var(--background)";
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"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,
|
||||
)}
|
||||
aria-hidden
|
||||
@@ -120,35 +207,55 @@ export function MetamorphField({
|
||||
preserveAspectRatio="xMidYMid slice"
|
||||
focusable="false"
|
||||
>
|
||||
<g stroke={stroke} strokeWidth="0.9">
|
||||
{edges.map(([a, b], i) => {
|
||||
const n1 = nodes[a];
|
||||
const n2 = nodes[b];
|
||||
if (!n1 || !n2) return null;
|
||||
return (
|
||||
<line
|
||||
key={`e-${i}`}
|
||||
x1={n1.x}
|
||||
y1={n1.y}
|
||||
x2={n2.x}
|
||||
y2={n2.y}
|
||||
opacity="0.55"
|
||||
{synapses.map((s, i) => (
|
||||
<g key={`syn-${i}`}>
|
||||
<path
|
||||
d={s.d}
|
||||
stroke={s.active ? edgeActive : edge}
|
||||
strokeWidth={s.active ? 1.35 * s.weight : 1.05 * s.weight}
|
||||
strokeLinecap="round"
|
||||
opacity={s.active ? 0.55 : 0.28}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{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>
|
||||
{nodes.map((n, i) => (
|
||||
))}
|
||||
|
||||
{nodes.map((n) => (
|
||||
<g key={`n-${n.id}`}>
|
||||
<circle
|
||||
key={`n-${i}`}
|
||||
cx={n.x}
|
||||
cy={n.y}
|
||||
r={n.r ?? 2}
|
||||
fill={i % 5 === 0 ? accent : fill}
|
||||
opacity={i % 5 === 0 ? 0.85 : 0.7}
|
||||
r={n.r + 10}
|
||||
fill={n.active ? accent : soma}
|
||||
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>
|
||||
))}
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type SectionProps = React.ComponentProps<"section"> & {
|
||||
tone?: "default" | "muted" | "dark" | "accent";
|
||||
tone?: "default" | "subtle" | "muted" | "dark" | "accent";
|
||||
tight?: boolean;
|
||||
};
|
||||
|
||||
const tones = {
|
||||
default: "bg-background text-foreground",
|
||||
subtle: "bg-gradient-to-b from-background to-muted/40 text-foreground",
|
||||
muted: "bg-muted text-foreground",
|
||||
dark: "bg-chart-3 text-background",
|
||||
accent: "bg-primary text-primary-foreground",
|
||||
@@ -23,7 +24,7 @@ export function Section({
|
||||
data-tone={tone}
|
||||
className={cn(
|
||||
"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],
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function ProgramCard({
|
||||
className?: string;
|
||||
}) {
|
||||
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">
|
||||
{program.tagline ? (
|
||||
<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({
|
||||
title,
|
||||
description,
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import { ArrowLeft, GraduationCap } from "lucide-react";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -17,41 +19,53 @@ export function HeroFeatured({
|
||||
}) {
|
||||
return (
|
||||
<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
|
||||
tone="dark"
|
||||
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">
|
||||
<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">
|
||||
<GraduationCap className="mt-0.5 size-4 shrink-0" />
|
||||
<span className="min-w-0 leading-7 text-pretty">
|
||||
مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه{"\u00A0"}صنعتی{"\u00A0"}امیرکبیر
|
||||
</span>
|
||||
</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>
|
||||
</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">
|
||||
دانش امیرکبیر، پشتوانه رهبری نوآور در عصر داده و هوش{"\u00A0"}مصنوعی.
|
||||
دانش دانشگاه صنعتی امیرکبیر، پشتوانه رهبری نوآور در عصر داده و هوش{"\u00A0"}مصنوعی.
|
||||
</p>
|
||||
<div className="mt-9 flex flex-wrap gap-3">
|
||||
<Link
|
||||
href="/programs"
|
||||
className={cn(
|
||||
buttonVariants({ size: "lg" }),
|
||||
"bg-primary font-bold text-primary-foreground hover:bg-primary/85",
|
||||
)}
|
||||
href="/professional"
|
||||
className={cn(buttonVariants({ size: "lg" }), "font-bold")}
|
||||
>
|
||||
مشاهده دورهها <ArrowLeft className="size-4" />
|
||||
</Link>
|
||||
<Link
|
||||
href="/about"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "outline", size: "lg" }),
|
||||
"border-background/25 bg-transparent font-bold text-background hover:bg-background hover:text-foreground",
|
||||
buttonVariants({ variant: "inverse", size: "lg" }),
|
||||
"font-bold",
|
||||
)}
|
||||
>
|
||||
درباره مرکز
|
||||
|
||||
@@ -2,50 +2,63 @@ import Image from "next/image";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function PageHero({
|
||||
title,
|
||||
intro,
|
||||
eyebrow,
|
||||
imageUrl,
|
||||
actions,
|
||||
size = "default",
|
||||
showField = true,
|
||||
}: {
|
||||
title: string;
|
||||
intro?: string;
|
||||
eyebrow?: 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 (
|
||||
<header className="page-hero relative isolate overflow-hidden bg-chart-3 py-16 text-background sm:py-24">
|
||||
{imageUrl ? (
|
||||
<>
|
||||
<Image
|
||||
src={imageUrl}
|
||||
alt=""
|
||||
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" />
|
||||
</>
|
||||
<header
|
||||
className={cn(
|
||||
"page-hero relative isolate flex items-center overflow-hidden bg-chart-3 text-background",
|
||||
size === "lg"
|
||||
? "min-h-[34rem] py-16 sm:min-h-[38rem] sm:py-20"
|
||||
: "py-16 sm:py-24",
|
||||
)}
|
||||
>
|
||||
<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
|
||||
tone="dark"
|
||||
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" />
|
||||
<Container className="relative z-[2] min-w-0">
|
||||
<div className="page-hero__content w-full min-w-0 max-w-4xl text-start">
|
||||
@@ -54,11 +67,7 @@ export function PageHero({
|
||||
{eyebrow}
|
||||
</p>
|
||||
) : null}
|
||||
<Heading
|
||||
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]"
|
||||
>
|
||||
<Heading as="h1" level={1} className="max-w-4xl text-background">
|
||||
{title}
|
||||
</Heading>
|
||||
{intro ? (
|
||||
@@ -66,6 +75,9 @@ export function PageHero({
|
||||
{intro}
|
||||
</p>
|
||||
) : null}
|
||||
{actions ? (
|
||||
<div className="mt-8 flex flex-wrap gap-3">{actions}</div>
|
||||
) : null}
|
||||
</div>
|
||||
</Container>
|
||||
</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>
|
||||
);
|
||||
}
|
||||