fix: design

This commit is contained in:
sajjadtalkhabi
2026-05-19 22:53:05 +03:30
parent c82701888a
commit 8990ceaddd
44 changed files with 2678 additions and 435 deletions
+54 -12
View File
@@ -1,6 +1,50 @@
// Maps the FE's 7-value `sessionType` to the spec's 3-value `type`.
const SESSION_TYPE_TO_SPEC = {
in_person: 'offline',
online: 'online',
video: 'content',
audio: 'content',
text: 'content',
slide: 'content',
pdf: 'content',
}
const makeSession = (overrides) => {
const sessionType = overrides.sessionType ?? ''
const sessionConfig = overrides.sessionConfig ?? {}
const startsAt = overrides.startsAt ?? sessionConfig.startTime ?? null
const location = overrides.location ?? sessionConfig.location ?? null
const link = overrides.link ?? sessionConfig.meetingLink ?? null
return {
// --- spec ---
id: overrides.id,
courseId: overrides.courseId ?? null,
title: overrides.title ?? '',
description: overrides.description ?? '',
type: overrides.type ?? SESSION_TYPE_TO_SPEC[sessionType] ?? null,
startsAt,
location,
link,
media: overrides.media ?? [],
// --- ui-only ---
image: overrides.image ?? '',
courseTemplate: overrides.courseTemplate ?? null,
sessionType,
sessionTypeFa: overrides.sessionTypeFa ?? '',
durationMinutes: overrides.durationMinutes ?? 0,
order: overrides.order ?? 1,
sessionConfig,
materials: overrides.materials ?? [],
usedInTerms: overrides.usedInTerms ?? [],
createdAt: overrides.createdAt ?? '',
}
}
export const adminSessions = [
{
makeSession({
id: 101,
courseId: 11,
title: 'مقدمه‌ای بر اخلاق اسلامی',
description: 'جلسه نخست؛ تعاریف و چارچوب دوره.',
image: 'https://picsum.photos/seed/session1/200/200',
@@ -13,15 +57,14 @@ export const adminSessions = [
startTime: '2025-09-25T16:00:00.000Z',
location: 'سالن آمفی‌تئاتر ۲ - مدرسه قم',
},
materials: [],
usedInTerms: [{ termId: 1 }],
createdAt: '2025-09-10T08:00:00.000Z',
},
{
}),
makeSession({
id: 102,
courseId: 12,
title: 'تفسیر سوره حمد',
description: 'تحلیل آیات سوره حمد.',
image: '',
courseTemplate: { id: 2, title: 'مفاهیم قرآنی' },
sessionType: 'online',
sessionTypeFa: 'آنلاین',
@@ -32,15 +75,14 @@ export const adminSessions = [
platform: 'google_meet',
startTime: '2025-10-04T19:00:00.000Z',
},
materials: [],
usedInTerms: [{ termId: 1 }],
createdAt: '2025-09-25T08:00:00.000Z',
},
{
}),
makeSession({
id: 103,
courseId: 13,
title: 'احکام نماز جماعت',
description: 'مرور احکام و شرایط نماز جماعت.',
image: '',
courseTemplate: { id: 3, title: 'فقه عبادات' },
sessionType: 'video',
sessionTypeFa: 'ویدئو',
@@ -50,12 +92,12 @@ export const adminSessions = [
minWatchedPercent: 80,
mustCompleteBeforeNext: true,
},
materials: [],
usedInTerms: [],
createdAt: '2026-01-12T08:00:00.000Z',
},
}),
]
export { makeSession, SESSION_TYPE_TO_SPEC }
export const sessionAttendance = new Map([
[
101,