@dataclouder/ngx-lessons 0.0.30 → 0.0.31
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.
- package/fesm2022/dataclouder-ngx-lessons.mjs +1170 -449
- package/fesm2022/dataclouder-ngx-lessons.mjs.map +1 -1
- package/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.d.ts +2 -2
- package/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.d.ts +11 -0
- package/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.d.ts +39 -38
- package/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.d.ts +22 -0
- package/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.d.ts +32 -37
- package/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.d.ts +2 -4
- package/lib/components/lesson-mini-components/components/ComponentBuilder.d.ts +7 -2
- package/lib/components/lesson-mini-components/components/lessons.clases.d.ts +17 -42
- package/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.d.ts +13 -0
- package/lib/components/lesson-mini-components/components/speaker/speaker.component.d.ts +12 -0
- package/lib/services/lesson-ai.service.d.ts +18 -0
- package/lib/services/lesson-notion.service.d.ts +35 -0
- package/lib/services/lesson-utils.service.d.ts +34 -0
- package/package.json +3 -2
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.html +40 -35
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.scss +15 -2
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.ts +3 -3
- package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.css +1 -0
- package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.html +46 -0
- package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.ts +52 -0
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.html +54 -92
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.ts +268 -230
- package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.css +1 -0
- package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.html +72 -0
- package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.ts +60 -0
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.html +23 -27
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.ts +247 -186
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.ts +2 -2
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.html +3 -3
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.ts +5 -5
- package/src/lib/components/lesson-mini-components/components/ComponentBuilder.ts +23 -15
- package/src/lib/components/lesson-mini-components/components/lessons.clases.ts +32 -66
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.html +62 -58
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.ts +2 -2
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.html +1 -2
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.ts +2 -2
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.html +5 -27
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.ts +38 -25
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.html +9 -7
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.ts +30 -26
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.ts +2 -2
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.ts +2 -2
- package/src/lib/services/lesson-ai.service.ts +103 -0
- package/src/lib/services/lesson-notion.service.ts +161 -0
- package/src/lib/services/lesson-utils.service.ts +181 -0
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.spec.ts +0 -25
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@if (lesson(); as currentLesson) {
|
|
2
|
+
<div>
|
|
3
|
+
<div>
|
|
4
|
+
<div style="display: flex; gap: 10px; padding: 10px">
|
|
5
|
+
<p-button label="Guardar" severity="primary" (click)="emitSaveRequest()" />
|
|
6
|
+
<p-button label="Importar de Notion" severity="help" (click)="emitImportNotionRequest()" />
|
|
7
|
+
<p-button label="Mejorar Notion con AI" severity="help" (click)="emitImproveNotionRequest()" />
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<!-- Use one-way binding and ngModelChange for signals -->
|
|
11
|
+
<div>
|
|
12
|
+
<input
|
|
13
|
+
pInputText
|
|
14
|
+
style="width: 100%"
|
|
15
|
+
[ngModel]="currentLesson.title"
|
|
16
|
+
(ngModelChange)="onPropertyChange('title', $event)"
|
|
17
|
+
type="text"
|
|
18
|
+
placeholder="Agrega un título" />
|
|
19
|
+
</div>
|
|
20
|
+
<div style="margin-top: 4px">
|
|
21
|
+
<input
|
|
22
|
+
pInputText
|
|
23
|
+
style="width: 100%"
|
|
24
|
+
[ngModel]="currentLesson.description"
|
|
25
|
+
(ngModelChange)="onPropertyChange('description', $event)"
|
|
26
|
+
type="text"
|
|
27
|
+
placeholder="Agrega una descripción" />
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div style="display: flex; align-items: center; margin-top: 10px">
|
|
31
|
+
<input
|
|
32
|
+
pInputText
|
|
33
|
+
style="flex: auto; margin-right: 5px"
|
|
34
|
+
[ngModel]="currentLesson.prompt"
|
|
35
|
+
(ngModelChange)="onPropertyChange('prompt', $event)"
|
|
36
|
+
type="text"
|
|
37
|
+
placeholder="Prompt para IA (opcional)" />
|
|
38
|
+
<p-button severity="primary" [disabled]="isLoadingLesson()" (click)="emitGenerateAIRequest()"> Generar con IA </p-button>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div style="margin-top: 10px">
|
|
42
|
+
<label class="checkbox-container" style="margin-right: 15px">
|
|
43
|
+
<input
|
|
44
|
+
type="checkbox"
|
|
45
|
+
[ngModel]="currentLesson.isPublished"
|
|
46
|
+
(ngModelChange)="onPropertyChange('isPublished', $event)"
|
|
47
|
+
title="Cuando termines la edición marca esta casilla" />
|
|
48
|
+
<span class="checkmark"></span>
|
|
49
|
+
Publicada
|
|
50
|
+
</label>
|
|
51
|
+
|
|
52
|
+
<input
|
|
53
|
+
pInputText
|
|
54
|
+
[ngModel]="currentLesson.level"
|
|
55
|
+
(ngModelChange)="onPropertyChange('level', $event)"
|
|
56
|
+
type="number"
|
|
57
|
+
placeholder="Nivel"
|
|
58
|
+
style="width: 80px" />
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<!-- Access signal values -->
|
|
62
|
+
<div style="margin-top: 10px; font-size: 0.9em; color: var(--text-color-secondary)">
|
|
63
|
+
{{ currentLesson.baseLang | flagEmoji }} -> {{ currentLesson.targetLang | flagEmoji }} Lección para hablantes de
|
|
64
|
+
{{ currentLesson.baseLang | langDesc : 'es' }} que aprenden
|
|
65
|
+
{{ currentLesson.targetLang | langDesc : 'es' }}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
} @else {
|
|
70
|
+
<!-- Optional: Show a loading state or placeholder if lesson is undefined -->
|
|
71
|
+
<p>Cargando datos de la lección...</p>
|
|
72
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, Output, WritableSignal, signal } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { ButtonModule } from 'primeng/button';
|
|
5
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
6
|
+
import { TooltipModule } from 'primeng/tooltip'; // Added TooltipModule
|
|
7
|
+
import { ILesson } from '../../lesson-mini-components/components/lessons.clases';
|
|
8
|
+
import { FlagLanguagePipe, LangDescTranslationPipe } from '../../../models/lessons.pipes';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'dc-lesson-metadata-editor',
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [
|
|
14
|
+
CommonModule,
|
|
15
|
+
FormsModule,
|
|
16
|
+
ButtonModule,
|
|
17
|
+
InputTextModule,
|
|
18
|
+
TooltipModule, // Added TooltipModule
|
|
19
|
+
FlagLanguagePipe, // Added Pipe
|
|
20
|
+
LangDescTranslationPipe, // Added Pipe
|
|
21
|
+
],
|
|
22
|
+
templateUrl: './dc-lesson-metadata-editor.component.html',
|
|
23
|
+
styleUrls: ['./dc-lesson-metadata-editor.component.css'],
|
|
24
|
+
})
|
|
25
|
+
export class DCLessonMetadataEditorComponent {
|
|
26
|
+
// Use signal for input lesson data
|
|
27
|
+
@Input({ required: true }) lesson: WritableSignal<ILesson | undefined> = signal(undefined);
|
|
28
|
+
@Input({ required: true }) isLoadingLesson: WritableSignal<boolean> = signal(false);
|
|
29
|
+
|
|
30
|
+
// Outputs for actions
|
|
31
|
+
@Output() saveRequest = new EventEmitter<void>();
|
|
32
|
+
@Output() importNotionRequest = new EventEmitter<void>();
|
|
33
|
+
@Output() improveNotionRequest = new EventEmitter<void>();
|
|
34
|
+
@Output() generateAIRequest = new EventEmitter<void>();
|
|
35
|
+
|
|
36
|
+
// Output for property changes
|
|
37
|
+
@Output() propertyChange = new EventEmitter<{ property: keyof ILesson; value: any }>();
|
|
38
|
+
|
|
39
|
+
// Method to emit property changes, called by ngModelChange in the template
|
|
40
|
+
onPropertyChange<K extends keyof ILesson>(property: K, value: ILesson[K]): void {
|
|
41
|
+
this.propertyChange.emit({ property, value });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Methods to emit action requests
|
|
45
|
+
emitSaveRequest(): void {
|
|
46
|
+
this.saveRequest.emit();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
emitImportNotionRequest(): void {
|
|
50
|
+
this.importNotionRequest.emit();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
emitImproveNotionRequest(): void {
|
|
54
|
+
this.improveNotionRequest.emit();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
emitGenerateAIRequest(): void {
|
|
58
|
+
this.generateAIRequest.emit();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<p-drawer header="Conversation" [(visible)]="chatVisible" position="bottom" styleClass="app-bottom-overlay">
|
|
25
|
-
<dc-chat [agentCard]="agentMasterLesson" [evaluatorAgentCard]="evaluatorAgentCard"></dc-chat>
|
|
26
|
-
</p-drawer>
|
|
27
|
-
}
|
|
1
|
+
<div>
|
|
2
|
+
<div #dynamicLesson class="targetclass">
|
|
3
|
+
<ng-template #target></ng-template>
|
|
4
|
+
</div>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<br />
|
|
8
|
+
<div style="display: flex; gap: 10px">
|
|
9
|
+
@if ((mainForm.controls | keyvalue)?.length) {
|
|
10
|
+
<div>
|
|
11
|
+
<p-button label="Calificar Lección" icon="pi pi-check-circle" (click)="evaluateForms()" [rounded]="true"></p-button>
|
|
12
|
+
</div>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
<p-button icon="pi pi-verified" [rounded]="true" (click)="startAI()" label="Repasar con IA" />
|
|
16
|
+
</div>
|
|
17
|
+
<br /><br />
|
|
18
|
+
|
|
19
|
+
@if(chatVisible()) {
|
|
20
|
+
<p-drawer header="Conversation" [visible]="chatVisible()" position="bottom" styleClass="app-bottom-overlay">
|
|
21
|
+
<dc-chat [agentCard]="agentMasterLesson()" [evaluatorAgentCard]="evaluatorAgentCard()"></dc-chat>
|
|
22
|
+
</p-drawer>
|
|
23
|
+
}
|