@hed-hog/lms 0.0.327 → 0.0.329

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,174 +0,0 @@
1
- 'use client';
2
-
3
- import { Badge } from '@/components/ui/badge';
4
- import { Separator } from '@/components/ui/separator';
5
- import { cn } from '@/lib/utils';
6
- import {
7
- Clock,
8
- FileText,
9
- HelpCircle,
10
- Layers,
11
- Video,
12
- type LucideIcon,
13
- } from 'lucide-react';
14
- import { useStructureStore } from './store';
15
- import type { Lesson, LessonType } from './types';
16
-
17
- const LESSON_TYPE_CONFIG: Record<
18
- LessonType,
19
- { icon: LucideIcon; color: string; label: string; bg: string }
20
- > = {
21
- video: { icon: Video, color: 'text-blue-500', label: 'Vídeo', bg: 'bg-blue-500/10' },
22
- post: { icon: FileText, color: 'text-emerald-500', label: 'Post', bg: 'bg-emerald-500/10' },
23
- questao: { icon: HelpCircle, color: 'text-amber-500', label: 'Quiz', bg: 'bg-amber-500/10' },
24
- exercicio: { icon: Layers, color: 'text-rose-500', label: 'Exercício', bg: 'bg-rose-500/10' },
25
- };
26
-
27
- interface DetailSessionProps {
28
- sessionId: string;
29
- }
30
-
31
- export function DetailSession({ sessionId }: DetailSessionProps) {
32
- const session = useStructureStore((s) => s.sessions.find((ss) => ss.id === sessionId));
33
- const lessons = useStructureStore((s) => s.lessons.filter((l) => l.sessionId === sessionId).sort((a, b) => a.order - b.order));
34
- const selectItem = useStructureStore((s) => s.selectItem);
35
-
36
- if (!session) return null;
37
-
38
- const totalMinutes = lessons.reduce((sum, l) => sum + l.duration, 0);
39
- const hours = Math.floor(totalMinutes / 60);
40
- const minutes = totalMinutes % 60;
41
-
42
- const typeCounts = lessons.reduce<Partial<Record<LessonType, number>>>(
43
- (acc, l) => ({ ...acc, [l.type]: (acc[l.type] ?? 0) + 1 }),
44
- {}
45
- );
46
-
47
- return (
48
- <div className="flex flex-col overflow-y-auto h-full">
49
- {/* Header */}
50
- <div className="flex items-center gap-3 px-4 py-4 border-b bg-muted/30 shrink-0">
51
- <div className="flex size-10 items-center justify-center rounded-lg bg-muted shrink-0">
52
- <Layers className="size-5 text-muted-foreground" />
53
- </div>
54
- <div className="min-w-0 flex-1">
55
- <h2 className="text-base font-semibold truncate">{session.title}</h2>
56
- <p className="text-xs text-muted-foreground">{session.code}</p>
57
- </div>
58
- </div>
59
-
60
- <div className="flex flex-col gap-5 p-4">
61
- {/* Stats */}
62
- <div className="grid grid-cols-2 gap-3">
63
- <StatCard label="Aulas" value={lessons.length} />
64
- <StatCard
65
- label="Duração"
66
- value={hours > 0 ? `${hours}h ${minutes}m` : `${minutes}m`}
67
- />
68
- </div>
69
-
70
- {/* Type breakdown */}
71
- {Object.entries(typeCounts).length > 0 && (
72
- <>
73
- <Separator />
74
- <div>
75
- <p className="text-xs font-medium text-muted-foreground mb-2">
76
- Tipos de aula
77
- </p>
78
- <div className="flex flex-wrap gap-2">
79
- {(Object.entries(typeCounts) as [LessonType, number][]).map(
80
- ([type, count]) => {
81
- const cfg = LESSON_TYPE_CONFIG[type];
82
- const Icon = cfg.icon;
83
- return (
84
- <div
85
- key={type}
86
- className={cn(
87
- 'flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs',
88
- cfg.bg
89
- )}
90
- >
91
- <Icon className={cn('size-3', cfg.color)} />
92
- <span className={cfg.color}>{cfg.label}</span>
93
- <span className="font-semibold">{count}</span>
94
- </div>
95
- );
96
- }
97
- )}
98
- </div>
99
- </div>
100
- </>
101
- )}
102
-
103
- {/* Lesson list */}
104
- {lessons.length > 0 && (
105
- <>
106
- <Separator />
107
- <div>
108
- <p className="text-xs font-medium text-muted-foreground mb-2">
109
- Aulas
110
- </p>
111
- <div className="flex flex-col gap-0.5">
112
- {lessons.map((lesson) => (
113
- <LessonListItem
114
- key={lesson.id}
115
- lesson={lesson}
116
- onSelect={() => selectItem(lesson.id, 'lesson')}
117
- />
118
- ))}
119
- </div>
120
- </div>
121
- </>
122
- )}
123
-
124
- {lessons.length === 0 && (
125
- <div className="flex flex-col items-center gap-2 py-8 text-center">
126
- <Layers className="size-8 text-muted-foreground/40" />
127
- <p className="text-sm text-muted-foreground">
128
- Esta sessão ainda não tem aulas.
129
- </p>
130
- </div>
131
- )}
132
- </div>
133
- </div>
134
- );
135
- }
136
-
137
- function LessonListItem({
138
- lesson,
139
- onSelect,
140
- }: {
141
- lesson: Lesson;
142
- onSelect: () => void;
143
- }) {
144
- const cfg = LESSON_TYPE_CONFIG[lesson.type];
145
- const Icon = cfg.icon;
146
-
147
- return (
148
- <button
149
- onClick={onSelect}
150
- className="flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-muted/60 cursor-pointer transition-colors text-left w-full"
151
- >
152
- <Icon className={cn('size-3.5 shrink-0', cfg.color)} />
153
- <span className="text-sm flex-1 truncate">{lesson.title}</span>
154
- <div className="flex items-center gap-1 shrink-0">
155
- <Clock className="size-3 text-muted-foreground" />
156
- <span className="text-[0.6rem] text-muted-foreground">
157
- {lesson.duration}min
158
- </span>
159
- </div>
160
- <Badge variant="outline" className="text-[0.55rem] px-1 py-0 h-4 shrink-0">
161
- {lesson.code}
162
- </Badge>
163
- </button>
164
- );
165
- }
166
-
167
- function StatCard({ label, value }: { label: string; value: string | number }) {
168
- return (
169
- <div className="flex flex-col items-center rounded-lg border bg-muted/30 py-3 gap-0.5">
170
- <span className="text-lg font-bold tabular-nums">{value}</span>
171
- <span className="text-[0.65rem] text-muted-foreground">{label}</span>
172
- </div>
173
- );
174
- }
@@ -1,185 +0,0 @@
1
- /**
2
- * Mock Data — LMS Course Structure
3
- *
4
- * ⚠️ TEMPORARY — replace when integrating with the real API.
5
- *
6
- * TODO[API]: Remove this file entirely once `useCourseStructure` fetches data
7
- * from GET /lms/courses/:id/structure. The Zustand store should then
8
- * be seeded with the server response instead of these constants.
9
- */
10
-
11
- import type {
12
- Course,
13
- Lesson,
14
- LessonStatus,
15
- LessonType,
16
- Session,
17
- VideoProvider,
18
- Visibility,
19
- } from './types';
20
-
21
- // ─────────────────────────────────────────────────────────────────────────────
22
- // Mock Data — LMS Course Structure
23
- // ─────────────────────────────────────────────────────────────────────────────
24
-
25
- export const MOCK_COURSE: Course = {
26
- id: 'course-1',
27
- code: 'REACT-ADV',
28
- name: 'React Avancado',
29
- title: 'React Avancado',
30
- description:
31
- 'Domine os conceitos avancados do React: hooks, patterns, performance e gerenciamento de estado moderno.',
32
- slug: 'react-avancado',
33
- published: true,
34
- };
35
-
36
- // Session config: title + how many lessons each gets
37
- const SESSION_CONFIG: { title: string; lessonCount: number }[] = [
38
- { title: 'Boas-vindas ao curso', lessonCount: 5 },
39
- { title: 'Hooks Avancados useReducer e useContext', lessonCount: 32 },
40
- { title: 'Patterns de Composicao', lessonCount: 31 },
41
- { title: 'Gerenciamento de Estado com Zustand', lessonCount: 8 },
42
- { title: 'Performance e Otimizacao', lessonCount: 30 },
43
- { title: 'React Server Components', lessonCount: 10 },
44
- { title: 'Data Fetching Moderno', lessonCount: 9 },
45
- { title: 'Roteamento Avancado com Next.js', lessonCount: 7 },
46
- { title: 'Formularios e Validacao com RHF', lessonCount: 11 },
47
- { title: 'Autenticacao e Seguranca', lessonCount: 9 },
48
- { title: 'Testing com React Testing Library', lessonCount: 12 },
49
- { title: 'Acessibilidade a11y', lessonCount: 6 },
50
- { title: 'Internacionalizacao i18n', lessonCount: 7 },
51
- { title: 'Animacoes com Framer Motion', lessonCount: 8 },
52
- { title: 'Arquitetura de Projetos Escalaveis', lessonCount: 10 },
53
- { title: 'Design Systems e Storybook', lessonCount: 8 },
54
- { title: 'Deploy CI/CD e DevOps', lessonCount: 7 },
55
- { title: 'Monorepos e Micro-frontends', lessonCount: 6 },
56
- { title: 'Debugging Avancado', lessonCount: 6 },
57
- { title: 'Projeto Final App Completo', lessonCount: 5 },
58
- ];
59
-
60
- export const MOCK_SESSIONS: Session[] = SESSION_CONFIG.map((s, i) => ({
61
- id: `s${i + 1}`,
62
- code: `S${String(i + 1).padStart(2, '0')}`,
63
- title: s.title,
64
- duration: s.lessonCount * 12,
65
- order: i,
66
- }));
67
-
68
- // Lesson title patterns
69
- const TITLE_PATTERNS = [
70
- 'Introducao e objetivos',
71
- 'Conceitos fundamentais',
72
- 'Configuracao do ambiente',
73
- 'Pratica guiada passo a passo',
74
- 'Exercicio: implementacao',
75
- 'Quiz de revisao',
76
- 'Caso de uso real',
77
- 'Implementacao completa',
78
- 'Debugging e troubleshooting',
79
- 'Otimizacoes e boas praticas',
80
- 'Desafio pratico',
81
- 'Revisao do modulo',
82
- 'Q e A e duvidas frequentes',
83
- 'Proximos passos',
84
- ];
85
-
86
- const LESSON_STATUSES: LessonStatus[] = [
87
- 'preparada',
88
- 'gravada',
89
- 'editada',
90
- 'finalizada',
91
- 'publicada',
92
- ];
93
-
94
- const VISIBILITIES: Visibility[] = [
95
- 'publico',
96
- 'publico',
97
- 'privado',
98
- 'restrito',
99
- ];
100
-
101
- const LESSON_TYPES: LessonType[] = [
102
- 'video',
103
- 'video',
104
- 'video',
105
- 'post',
106
- 'video',
107
- 'video',
108
- 'questao',
109
- 'exercicio',
110
- ];
111
- const PROVIDERS: VideoProvider[] = [
112
- 'youtube',
113
- 'vimeo',
114
- 'bunny',
115
- 'youtube',
116
- 'youtube',
117
- ];
118
-
119
- let _lid = 0;
120
-
121
- export const MOCK_LESSONS: Lesson[] = SESSION_CONFIG.flatMap((s, si) =>
122
- Array.from({ length: s.lessonCount }, (_, li) => {
123
- _lid += 1;
124
- const type = LESSON_TYPES[_lid % LESSON_TYPES.length] as LessonType;
125
- const isVideo = type === 'video';
126
- const provider = PROVIDERS[_lid % PROVIDERS.length] as VideoProvider;
127
- const baseTitle = TITLE_PATTERNS[li % TITLE_PATTERNS.length] as string;
128
- const title =
129
- li < TITLE_PATTERNS.length
130
- ? baseTitle
131
- : baseTitle +
132
- ' parte ' +
133
- String(Math.floor(li / TITLE_PATTERNS.length) + 1);
134
-
135
- const hasResource = li % 4 === 0;
136
-
137
- const status = LESSON_STATUSES[
138
- _lid % LESSON_STATUSES.length
139
- ] as LessonStatus;
140
- const visibility = VISIBILITIES[_lid % VISIBILITIES.length] as Visibility;
141
-
142
- const lesson: Lesson = {
143
- id: `l${_lid}`,
144
- code: `A${String(_lid).padStart(3, '0')}`,
145
- title,
146
- type,
147
- status,
148
- visibility,
149
- duration: 8 + (_lid % 32),
150
- publicDescription: `Aprenda ${s.title.toLowerCase()} de forma pratica nesta aula.`,
151
- privateDescription: li % 7 === 0 ? 'Revisar antes de publicar.' : '',
152
- sessionId: `s${si + 1}`,
153
- order: li,
154
- resources: hasResource
155
- ? [
156
- {
157
- id: `r${_lid}`,
158
- name: `material-${String(_lid).padStart(3, '0')}.pdf`,
159
- size: `${1 + (_lid % 5)}.${_lid % 9} MB`,
160
- type: 'application/pdf',
161
- public: _lid % 2 === 0,
162
- url: `https://www.w3.org/WAI/WCAG21/Techniques/pdf/PDF1.pdf`,
163
- },
164
- ]
165
- : [],
166
- };
167
-
168
- if (isVideo) {
169
- lesson.videoProvider = provider;
170
- lesson.videoUrl = `https://example.com/video/${_lid}`;
171
- lesson.autoDuration = _lid % 3 !== 0;
172
- if (li === 0) {
173
- lesson.transcription = `Transcricao completa da primeira aula de "${s.title}". Lorem ipsum dolor sit amet, consectetur adipiscing elit.`;
174
- }
175
- }
176
- if (type === 'questao') {
177
- lesson.linkedExam = `exam-${_lid}`;
178
- }
179
- if (type === 'post') {
180
- lesson.postContent = `Conteudo detalhado sobre ${s.title.toLowerCase()}...`;
181
- }
182
-
183
- return lesson;
184
- })
185
- );
@@ -1,277 +0,0 @@
1
- import type {
2
- EnterpriseAccount,
3
- EnterpriseClass,
4
- EnterpriseCourse,
5
- EnterpriseUser,
6
- } from './enterprise-types';
7
-
8
- // ── CRM Accounts (picker options) ─────────────────────────────────────────────
9
-
10
- export const MOCK_CRM_ACCOUNTS = [
11
- { id: 101, name: 'Techcorp Brasil Ltda' },
12
- { id: 102, name: 'Grupo Atlas S.A.' },
13
- { id: 103, name: 'Horizonte Engenharia Ltda' },
14
- { id: 104, name: 'MedPlus Saúde S.A.' },
15
- { id: 105, name: 'Agro Prime Comércio Ltda' },
16
- { id: 106, name: 'LogTech Transportes Ltda' },
17
- { id: 107, name: 'Inova Tech S.A.' },
18
- { id: 108, name: 'Dinâmica Consultoria Ltda' },
19
- ];
20
-
21
- // ── Accounts ───────────────────────────────────────────────────────────────────
22
-
23
- export const MOCK_ENTERPRISE_ACCOUNTS: EnterpriseAccount[] = [
24
- {
25
- id: 1,
26
- name: 'Techcorp Brasil',
27
- slug: 'techcorp-brasil',
28
- status: 'active',
29
- crmAccountId: 101,
30
- crmAccountName: 'Techcorp Brasil Ltda',
31
- portalEnabled: true,
32
- usersCount: 120,
33
- studentsCount: 104,
34
- managersCount: 14,
35
- adminsCount: 2,
36
- coursesCount: 8,
37
- classesCount: 3,
38
- licenseLimit: 150,
39
- notes: null,
40
- createdAt: '2026-01-01T10:00:00Z',
41
- updatedAt: '2026-04-10T08:30:00Z',
42
- },
43
- {
44
- id: 2,
45
- name: 'Grupo Financeiro Atlas',
46
- slug: 'grupo-financeiro-atlas',
47
- status: 'active',
48
- crmAccountId: 102,
49
- crmAccountName: 'Grupo Atlas S.A.',
50
- portalEnabled: true,
51
- usersCount: 250,
52
- studentsCount: 220,
53
- managersCount: 28,
54
- adminsCount: 2,
55
- coursesCount: 14,
56
- classesCount: 5,
57
- licenseLimit: 300,
58
- notes: null,
59
- createdAt: '2026-02-01T09:00:00Z',
60
- updatedAt: '2026-04-15T11:00:00Z',
61
- },
62
- {
63
- id: 3,
64
- name: 'Construtora Horizonte',
65
- slug: 'construtora-horizonte',
66
- status: 'active',
67
- crmAccountId: null,
68
- crmAccountName: null,
69
- portalEnabled: false,
70
- usersCount: 60,
71
- studentsCount: 52,
72
- managersCount: 6,
73
- adminsCount: 1,
74
- coursesCount: 4,
75
- classesCount: 2,
76
- licenseLimit: 80,
77
- notes: null,
78
- createdAt: '2026-03-01T08:00:00Z',
79
- updatedAt: '2026-04-01T09:00:00Z',
80
- },
81
- {
82
- id: 4,
83
- name: 'MedPlus Saúde',
84
- slug: 'medplus-saude',
85
- status: 'trial',
86
- crmAccountId: 104,
87
- crmAccountName: 'MedPlus Saúde S.A.',
88
- portalEnabled: true,
89
- usersCount: 30,
90
- studentsCount: 28,
91
- managersCount: 2,
92
- adminsCount: 1,
93
- coursesCount: 3,
94
- classesCount: 1,
95
- licenseLimit: 50,
96
- notes: null,
97
- createdAt: '2026-04-01T11:00:00Z',
98
- updatedAt: '2026-04-18T14:00:00Z',
99
- },
100
- {
101
- id: 5,
102
- name: 'Agro Prime',
103
- slug: 'agro-prime',
104
- status: 'inactive',
105
- crmAccountId: null,
106
- crmAccountName: null,
107
- portalEnabled: false,
108
- usersCount: 0,
109
- studentsCount: 0,
110
- managersCount: 0,
111
- adminsCount: 0,
112
- coursesCount: 0,
113
- classesCount: 0,
114
- licenseLimit: null,
115
- notes: null,
116
- createdAt: '2025-09-01T14:00:00Z',
117
- updatedAt: '2026-02-28T18:00:00Z',
118
- },
119
- {
120
- id: 6,
121
- name: 'LogTech Transportes',
122
- slug: 'logtech-transportes',
123
- status: 'active',
124
- crmAccountId: 106,
125
- crmAccountName: 'LogTech Transportes Ltda',
126
- portalEnabled: true,
127
- usersCount: 100,
128
- studentsCount: 88,
129
- managersCount: 10,
130
- adminsCount: 2,
131
- coursesCount: 6,
132
- classesCount: 2,
133
- licenseLimit: 120,
134
- notes: null,
135
- createdAt: '2026-01-15T09:30:00Z',
136
- updatedAt: '2026-04-12T10:00:00Z',
137
- },
138
- ];
139
-
140
- // ── Users (linked to account id=1) ─────────────────────────────────────────────
141
-
142
- export const MOCK_ENTERPRISE_USERS: EnterpriseUser[] = [
143
- {
144
- id: 1,
145
- userId: 201,
146
- name: 'Ana Beatriz Souza',
147
- email: 'ana.souza@techcorp.com.br',
148
- role: 'enterprise_admin',
149
- status: 'active',
150
- lastAccessAt: '2026-04-20T14:32:00Z',
151
- },
152
- {
153
- id: 2,
154
- userId: 202,
155
- name: 'Carlos Eduardo Lima',
156
- email: 'carlos.lima@techcorp.com.br',
157
- role: 'hr_manager',
158
- status: 'active',
159
- lastAccessAt: '2026-04-19T09:15:00Z',
160
- },
161
- {
162
- id: 3,
163
- userId: 203,
164
- name: 'Fernanda Oliveira',
165
- email: 'fernanda.oliveira@techcorp.com.br',
166
- role: 'student',
167
- status: 'active',
168
- lastAccessAt: '2026-04-18T16:00:00Z',
169
- },
170
- {
171
- id: 4,
172
- userId: 204,
173
- name: 'Ricardo Mendes',
174
- email: 'ricardo.mendes@techcorp.com.br',
175
- role: 'student',
176
- status: 'active',
177
- lastAccessAt: '2026-04-17T11:45:00Z',
178
- },
179
- {
180
- id: 5,
181
- userId: 205,
182
- name: 'Juliana Castro',
183
- email: 'juliana.castro@techcorp.com.br',
184
- role: 'viewer',
185
- status: 'inactive',
186
- lastAccessAt: null,
187
- },
188
- {
189
- id: 6,
190
- userId: 206,
191
- name: 'Marcos Vinicius Santos',
192
- email: 'marcos.santos@techcorp.com.br',
193
- role: 'student',
194
- status: 'pending',
195
- lastAccessAt: null,
196
- },
197
- ];
198
-
199
- // ── Courses (linked to account id=1) ──────────────────────────────────────────
200
-
201
- export const MOCK_ENTERPRISE_COURSES: EnterpriseCourse[] = [
202
- {
203
- id: 10,
204
- title: 'Liderança e Gestão de Equipes',
205
- slug: 'lideranca-gestao-equipes',
206
- status: 'published',
207
- modality: 'Online',
208
- enrolledCount: 45,
209
- completionRate: 72,
210
- contractedAt: '2026-01-05T00:00:00Z',
211
- },
212
- {
213
- id: 11,
214
- title: 'Compliance e Ética Corporativa',
215
- slug: 'compliance-etica-corporativa',
216
- status: 'published',
217
- modality: 'Híbrido',
218
- enrolledCount: 104,
219
- completionRate: 88,
220
- contractedAt: '2026-01-05T00:00:00Z',
221
- },
222
- {
223
- id: 12,
224
- title: 'Segurança da Informação',
225
- slug: 'seguranca-informacao',
226
- status: 'published',
227
- modality: 'Online',
228
- enrolledCount: 98,
229
- completionRate: 61,
230
- contractedAt: '2026-02-01T00:00:00Z',
231
- },
232
- {
233
- id: 13,
234
- title: 'Agile & Scrum na Prática',
235
- slug: 'agile-scrum-pratica',
236
- status: 'draft',
237
- modality: 'Presencial',
238
- enrolledCount: 0,
239
- completionRate: 0,
240
- contractedAt: '2026-03-10T00:00:00Z',
241
- },
242
- ];
243
-
244
- // ── Classes / Turmas (linked to account id=1) ──────────────────────────────────
245
-
246
- export const MOCK_ENTERPRISE_CLASSES: EnterpriseClass[] = [
247
- {
248
- id: 20,
249
- code: 'T2026-LG-01',
250
- courseTitle: 'Liderança e Gestão de Equipes',
251
- startDate: '2026-03-01',
252
- endDate: '2026-06-30',
253
- enrolledCount: 45,
254
- capacity: 50,
255
- status: 'ongoing',
256
- },
257
- {
258
- id: 21,
259
- code: 'T2026-CE-01',
260
- courseTitle: 'Compliance e Ética Corporativa',
261
- startDate: '2026-01-10',
262
- endDate: '2026-04-10',
263
- enrolledCount: 104,
264
- capacity: 120,
265
- status: 'completed',
266
- },
267
- {
268
- id: 22,
269
- code: 'T2026-SI-01',
270
- courseTitle: 'Segurança da Informação',
271
- startDate: '2026-04-15',
272
- endDate: null,
273
- enrolledCount: 98,
274
- capacity: 100,
275
- status: 'open',
276
- },
277
- ];