@dataclouder/ngx-lessons 0.0.31 → 0.0.32
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 +4 -5
- package/fesm2022/dataclouder-ngx-lessons.mjs.map +1 -1
- package/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.d.ts +1 -1
- package/package.json +1 -1
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.html +0 -40
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.scss +0 -120
- package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.ts +0 -82
- package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.css +0 -1
- package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.html +0 -46
- package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.ts +0 -52
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.css +0 -90
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.html +0 -67
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.scss +0 -0
- package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.ts +0 -356
- package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.css +0 -1
- package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.html +0 -72
- package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.ts +0 -60
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.html +0 -23
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.scss +0 -3
- package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.ts +0 -332
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.html +0 -5
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.scss +0 -3
- package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.ts +0 -14
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.html +0 -30
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.scss +0 -17
- package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.ts +0 -170
- package/src/lib/components/dc-lessons/lessons.component.ts +0 -10
- package/src/lib/components/lesson-mini-components/components/ComponentBuilder.ts +0 -82
- package/src/lib/components/lesson-mini-components/components/ComponentWithForm.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/lesson-dynamic.component.ts +0 -13
- package/src/lib/components/lesson-mini-components/components/lessons.clases.ts +0 -220
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.html +0 -62
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.scss +0 -15
- package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.ts +0 -70
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.html +0 -1
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.scss +0 -12
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/selector/selector.component.ts +0 -47
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.html +0 -13
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.scss +0 -0
- package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.ts +0 -40
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.html +0 -9
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.scss +0 -3
- package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.ts +0 -33
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.html +0 -24
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.scss +0 -15
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.ts +0 -29
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.html +0 -4
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.scss +0 -8
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.ts +0 -61
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.css +0 -3
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.html +0 -9
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.ts +0 -32
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.css +0 -3
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.html +0 -28
- package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.ts +0 -30
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.html +0 -18
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.scss +0 -3
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.html +0 -15
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.scss +0 -27
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.spec.ts +0 -25
- package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.ts +0 -46
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.html +0 -19
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.scss +0 -0
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.ts +0 -27
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.html +0 -14
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.scss +0 -22
- package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.ts +0 -51
- package/src/lib/models/lessons.pipes.ts +0 -38
- package/src/lib/models/models.ts +0 -92
- package/src/lib/models/notion.models.ts +0 -43
- package/src/lib/services/lesson-ai.service.ts +0 -103
- package/src/lib/services/lesson-notion.service.ts +0 -161
- package/src/lib/services/lesson-utils.service.ts +0 -181
- package/src/public-api.ts +0 -25
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { UntypedFormControl } from '@angular/forms';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'app-component-form',
|
|
6
|
-
template: '<div>no template</div>',
|
|
7
|
-
})
|
|
8
|
-
export abstract class ComponentWithForm implements OnInit {
|
|
9
|
-
// @Input() settings: LessonCompSettings;
|
|
10
|
-
|
|
11
|
-
public control: UntypedFormControl = new UntypedFormControl();
|
|
12
|
-
public status: string;
|
|
13
|
-
|
|
14
|
-
ngOnInit(): void {
|
|
15
|
-
this.control.valueChanges.subscribe(() => {
|
|
16
|
-
this.status = 'basic';
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public validate(): void {
|
|
21
|
-
// TODO: generic method to evaluate
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public abstract evaluate(): boolean;
|
|
25
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import { LessonCompSettings } from './lessons.clases';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'app-lesson-component',
|
|
7
|
-
template: '<div>no template</div>',
|
|
8
|
-
standalone: true,
|
|
9
|
-
})
|
|
10
|
-
// This is the base class for all the components that are going to be used in the lessons.
|
|
11
|
-
export class LessonDynamicComponent {
|
|
12
|
-
@Input() settings: LessonCompSettings = {} as LessonCompSettings;
|
|
13
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { UntypedFormControl } from '@angular/forms';
|
|
2
|
-
import { InjectionToken, Type } from '@angular/core';
|
|
3
|
-
import { Provider } from '@angular/core';
|
|
4
|
-
|
|
5
|
-
import { SelectorBuilderComponent } from './selector/selector-builder/selector-builder.component';
|
|
6
|
-
import { SelectorComponent } from './selector/selector.component';
|
|
7
|
-
|
|
8
|
-
import { TextWriterBuiderComponent } from './text-writer/text-writer-buider/text-writer-buider.component';
|
|
9
|
-
import { TextWriterComponent } from './text-writer/text-writer.component';
|
|
10
|
-
import { TranslationSwitcherBuilderComponent } from './translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component';
|
|
11
|
-
import { TranslationSwitcherComponent } from './translationSwitcher/translationSwitcher.component';
|
|
12
|
-
import { SpeakerBuilderComponent } from './speaker/speaker-builder/speaker-builder.component';
|
|
13
|
-
import { SpeakerComponent } from './speaker/speaker.component';
|
|
14
|
-
|
|
15
|
-
export type LessonComponentsType = 'selector' | 'speaker' | 'text-writer' | 'verb-summary' | 'word-summary';
|
|
16
|
-
|
|
17
|
-
export enum LessonComponentEnum {
|
|
18
|
-
Selector = 'selector',
|
|
19
|
-
Speaker = 'speaker',
|
|
20
|
-
TextWriter = 'textWriter',
|
|
21
|
-
VerbSummary = 'verbSummary',
|
|
22
|
-
WordSummary = 'wordSummary',
|
|
23
|
-
TranslationSwitcher = 'translationSwitcher',
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const LessonComponentBuilders = {
|
|
27
|
-
[LessonComponentEnum.Selector]: SelectorBuilderComponent,
|
|
28
|
-
[LessonComponentEnum.Speaker]: SpeakerBuilderComponent,
|
|
29
|
-
[LessonComponentEnum.TextWriter]: TextWriterBuiderComponent,
|
|
30
|
-
// [LessonComponentEnum.VerbSummary]: VerbSummaryBuilderComponent,
|
|
31
|
-
// [LessonComponentEnum.WordSummary]: WordSummaryBuilderComponent,
|
|
32
|
-
[LessonComponentEnum.TranslationSwitcher]: TranslationSwitcherBuilderComponent,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const LessonComponents = {
|
|
36
|
-
[LessonComponentEnum.Selector]: SelectorComponent,
|
|
37
|
-
[LessonComponentEnum.Speaker]: SpeakerComponent,
|
|
38
|
-
[LessonComponentEnum.TextWriter]: TextWriterComponent,
|
|
39
|
-
// [LessonComponentEnum.VerbSummary]: VerbSummaryComponent,
|
|
40
|
-
// [LessonComponentEnum.WordSummary]: WordSummaryComponent,
|
|
41
|
-
[LessonComponentEnum.TranslationSwitcher]: TranslationSwitcherComponent,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export function getLessonComponentClass(type: LessonComponentsType) {
|
|
45
|
-
return LessonComponents[type];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface LessonCompSettings {
|
|
49
|
-
response?: string;
|
|
50
|
-
responses?: string; // en caso de que haya multiples respuestas
|
|
51
|
-
options?: string[]; // optiones para visualizar
|
|
52
|
-
text?: string;
|
|
53
|
-
hint?: string;
|
|
54
|
-
explanation?: string;
|
|
55
|
-
}
|
|
56
|
-
// Make LessonComponentConfiguration generic for settings
|
|
57
|
-
export interface LessonComponentConfiguration<T extends LessonCompSettings = LessonCompSettings> {
|
|
58
|
-
id?: string;
|
|
59
|
-
component: LessonComponentEnum;
|
|
60
|
-
settings?: T; // for component that need and standards
|
|
61
|
-
inputs?: Record<string, any>; // for whatever component.
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface StorageFile {
|
|
65
|
-
bucket: string;
|
|
66
|
-
url: string;
|
|
67
|
-
path: string; // path where the file is in the storage
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface AudioStorage extends StorageFile {
|
|
71
|
-
text?: string;
|
|
72
|
-
voiceType?: string;
|
|
73
|
-
}
|
|
74
|
-
// Make SpeakerCompConfiguration extend the generic base interface
|
|
75
|
-
export interface SpeakerCompConfiguration extends LessonComponentConfiguration<LessonCompSettings & { voice: string }> {
|
|
76
|
-
audio: AudioStorage;
|
|
77
|
-
// settings is now inherited correctly via the generic type argument
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface LessonComponentInterface {
|
|
81
|
-
// Update config to use the generic form
|
|
82
|
-
config: LessonComponentConfiguration<any>;
|
|
83
|
-
|
|
84
|
-
control?: UntypedFormControl;
|
|
85
|
-
|
|
86
|
-
validate?(): boolean | null;
|
|
87
|
-
evaluate?(): boolean | null;
|
|
88
|
-
}
|
|
89
|
-
// nuevs
|
|
90
|
-
|
|
91
|
-
// import { UntypedFormControl } from '@angular/forms';
|
|
92
|
-
|
|
93
|
-
// import { LessonComponents } from '../models/lessons.class';
|
|
94
|
-
|
|
95
|
-
export const LESSONS_TOKEN = new InjectionToken<LessonsAbstractService>('Lessons Service');
|
|
96
|
-
|
|
97
|
-
// Removed duplicate LessonComponentEnum definition
|
|
98
|
-
// Removed duplicate StorageFile definition
|
|
99
|
-
|
|
100
|
-
export interface ImgStorageData extends StorageFile {
|
|
101
|
-
fullPath: string; // path + name
|
|
102
|
-
resolutions: any;
|
|
103
|
-
resolution: string;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export type LessonImage = ImgStorageData & { type: string };
|
|
107
|
-
|
|
108
|
-
// Removed duplicate LessonCompSettings definition
|
|
109
|
-
// Removed duplicate LessonComponentConfiguration definition
|
|
110
|
-
|
|
111
|
-
// New way of render components
|
|
112
|
-
export interface DynamicContentComponent {
|
|
113
|
-
id: string; // duplicated id
|
|
114
|
-
component: LessonComponentEnum; // name of the component
|
|
115
|
-
inputs: Record<string, any>;
|
|
116
|
-
config: LessonComponentConfiguration<any>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
type StorageType = StorageFile & { type: string };
|
|
120
|
-
|
|
121
|
-
export interface Media {
|
|
122
|
-
audios?: StorageType[];
|
|
123
|
-
images?: StorageType[];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface ILessonExtra {
|
|
127
|
-
notionPageId?: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface ILesson {
|
|
131
|
-
// me faltan los comentarios
|
|
132
|
-
_id: any;
|
|
133
|
-
id: string;
|
|
134
|
-
title: string;
|
|
135
|
-
description: string;
|
|
136
|
-
isPublished: boolean;
|
|
137
|
-
// isPrivate: boolean;
|
|
138
|
-
textCoded: string;
|
|
139
|
-
authorId: string;
|
|
140
|
-
authorEmail: string;
|
|
141
|
-
tags: string[];
|
|
142
|
-
media: Media;
|
|
143
|
-
// Update components array to use generic form
|
|
144
|
-
components: Array<LessonComponentConfiguration<any>>;
|
|
145
|
-
dynamicComponents: Record<string, DynamicContentComponent>;
|
|
146
|
-
baseLang: string;
|
|
147
|
-
targetLang: string;
|
|
148
|
-
|
|
149
|
-
generatedByAI: boolean;
|
|
150
|
-
prompt: string;
|
|
151
|
-
level: number;
|
|
152
|
-
extras: ILessonExtra;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface ILessonWithTaken extends ILesson {
|
|
156
|
-
// FIXME: moved to lessons lib
|
|
157
|
-
|
|
158
|
-
taken: any;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Think on someway of getting the toast alerts service
|
|
162
|
-
|
|
163
|
-
export abstract class LessonsAbstractService {
|
|
164
|
-
abstract getLessons(paginator?: any): Promise<any>;
|
|
165
|
-
abstract getLesson(id: string): Promise<any>;
|
|
166
|
-
abstract postLesson(lesson: ILesson): Promise<any>;
|
|
167
|
-
abstract updateLesson(lesson: ILesson): Promise<any>;
|
|
168
|
-
abstract deleteLesson(id: string): Promise<any>;
|
|
169
|
-
abstract generateLesson(lesson: ILesson): Promise<any>;
|
|
170
|
-
abstract postGenerateByAI(id: string): Promise<any>;
|
|
171
|
-
abstract extractTextFromHtml(html: string): string;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// my-service.provider.ts
|
|
175
|
-
export function provideLessonsService(serviceImplementation: Type<LessonsAbstractService>): Provider[] {
|
|
176
|
-
return [
|
|
177
|
-
{
|
|
178
|
-
provide: LESSONS_TOKEN,
|
|
179
|
-
useExisting: serviceImplementation,
|
|
180
|
-
},
|
|
181
|
-
];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// export type LessonComponentsType = 'selector' | 'speaker' | 'text-writer' | 'verb-summary' | 'word-summary';
|
|
185
|
-
|
|
186
|
-
// export function getLessonComponentClass(type: LessonComponentsType) {
|
|
187
|
-
// // return LessonComponents[type];
|
|
188
|
-
// return null;
|
|
189
|
-
// }
|
|
190
|
-
|
|
191
|
-
// Removed duplicate LessonComponentConfiguration definition
|
|
192
|
-
// Removed duplicate StorageFile definition
|
|
193
|
-
// Removed duplicate AudioStorage definition
|
|
194
|
-
// Removed duplicate SpeakerCompConfiguration definition
|
|
195
|
-
// Removed duplicate LessonComponentInterface definition
|
|
196
|
-
|
|
197
|
-
// export const LessonComponents = {
|
|
198
|
-
// [LessonComponentEnum.Selector]: 1,
|
|
199
|
-
// [LessonComponentEnum.Speaker]: 2,
|
|
200
|
-
// [LessonComponentEnum.TextWriter]: 3,
|
|
201
|
-
// [LessonComponentEnum.VerbSummary]: 4,
|
|
202
|
-
// [LessonComponentEnum.WordSummary]: 5,
|
|
203
|
-
// [LessonComponentEnum.TranslationSwitcher]: 6,
|
|
204
|
-
// }
|
|
205
|
-
|
|
206
|
-
export const LangCodeDescription = {
|
|
207
|
-
es: 'Spanish',
|
|
208
|
-
en: 'English',
|
|
209
|
-
it: 'Italian',
|
|
210
|
-
pt: 'Portuguese',
|
|
211
|
-
fr: 'French',
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export const LangCodeDescriptionEs = {
|
|
215
|
-
es: 'Español',
|
|
216
|
-
en: 'Inglés',
|
|
217
|
-
it: 'Italiano',
|
|
218
|
-
pt: 'Portugués',
|
|
219
|
-
fr: 'Frances',
|
|
220
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
<div>
|
|
3
|
-
<p-message>Construcción del componente de Selección, sirve para hacer una pregunta y mostrar varias opciones, ejemplo:</p-message>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<div>
|
|
7
|
-
<span>En que año llegó cristobal colon a america?</span>
|
|
8
|
-
<app-selector [config]="sampleConfig"></app-selector>
|
|
9
|
-
</div>
|
|
10
|
-
|
|
11
|
-
<hr />
|
|
12
|
-
|
|
13
|
-
<div>
|
|
14
|
-
<form class="builder-form" [formGroup]="formGroup">
|
|
15
|
-
<input class="form-input" type="text" pInputText fullWidth formControlName="response" placeholder="Respuesta Correcta..." />
|
|
16
|
-
<br />
|
|
17
|
-
|
|
18
|
-
<input class="form-input" type="" pInputText fullWidth formControlName="hint" placeholder="Escribe una pista para esta pregunta" />
|
|
19
|
-
|
|
20
|
-
<br />
|
|
21
|
-
<input
|
|
22
|
-
class="form-input"
|
|
23
|
-
type="text"
|
|
24
|
-
pInputText
|
|
25
|
-
fullWidth
|
|
26
|
-
formControlName="explanation"
|
|
27
|
-
placeholder="Excribe una explicación para la respuesta" />
|
|
28
|
-
|
|
29
|
-
<hr />
|
|
30
|
-
<h6>Opciones</h6>
|
|
31
|
-
|
|
32
|
-
<div class="form-group" formArrayName="options">
|
|
33
|
-
@for (item of optionsForm.controls; track item; let i = $index) {
|
|
34
|
-
<div
|
|
35
|
-
style="display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-direction: column"
|
|
36
|
-
>
|
|
37
|
-
<div>
|
|
38
|
-
<input type="text" pInputText fullWidth [formControlName]="i" />
|
|
39
|
-
<p-button (click)="deleteFormArrayByIndex('options', i)" icon="pi pi-times" severity="danger"></p-button>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
}
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<p-button (click)="pushControlToFormArray('options')" label="Agregar Opción" [text]="true" severity="help"></p-button>
|
|
46
|
-
</form>
|
|
47
|
-
|
|
48
|
-
<!-- <button nbButton (click)="isRendered = !isRendered"> Renderizar </button> -->
|
|
49
|
-
|
|
50
|
-
@if (isRendered) {
|
|
51
|
-
<div>
|
|
52
|
-
<!-- TODO: probably i need to pass some params -->
|
|
53
|
-
<app-selector></app-selector>
|
|
54
|
-
</div>
|
|
55
|
-
}
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<div>
|
|
59
|
-
<p-button (click)="copyToClipboard()" [disabled]="formGroup.invalid" label="Copia Código" [rounded]="true"></p-button>
|
|
60
|
-
<p-button (click)="showCode()" [disabled]="formGroup.invalid" label="Mostrar" [rounded]="true" severity="secondary"></p-button>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { UntypedFormArray, FormsModule, ReactiveFormsModule, FormBuilder } from '@angular/forms';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { InputTextModule } from 'primeng/inputtext';
|
|
6
|
-
import { ButtonModule } from 'primeng/button';
|
|
7
|
-
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
8
|
-
import { MessageModule } from 'primeng/message';
|
|
9
|
-
|
|
10
|
-
import { ComponentBuilder } from '../../ComponentBuilder';
|
|
11
|
-
import { SelectorComponent } from '../selector.component';
|
|
12
|
-
import { LessonComponentConfiguration, LessonComponentEnum } from '../../lessons.clases';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'app-selector-builder',
|
|
16
|
-
templateUrl: './selector-builder.component.html',
|
|
17
|
-
styleUrls: ['./selector-builder.component.scss'],
|
|
18
|
-
standalone: true,
|
|
19
|
-
imports: [FormsModule, ReactiveFormsModule, SelectorComponent, InputTextModule, ButtonModule, MessageModule],
|
|
20
|
-
})
|
|
21
|
-
export class SelectorBuilderComponent extends ComponentBuilder implements OnInit {
|
|
22
|
-
constructor(
|
|
23
|
-
protected override formBuilder: FormBuilder,
|
|
24
|
-
// protected override toastrService: ToastService,
|
|
25
|
-
protected override ref: DynamicDialogRef,
|
|
26
|
-
) {
|
|
27
|
-
super(formBuilder, null);
|
|
28
|
-
}
|
|
29
|
-
public sampleConfig: LessonComponentConfiguration = {
|
|
30
|
-
id: '1',
|
|
31
|
-
component: LessonComponentEnum.Selector,
|
|
32
|
-
settings: {
|
|
33
|
-
options: ['fourteen ninety-two', 'fourteen ninety-six', 'fifteen ninety-one'],
|
|
34
|
-
response: 'fourteen ninety-two',
|
|
35
|
-
hint: 'Pista para la respuesta',
|
|
36
|
-
explanation: 'Explicación de la respuesta',
|
|
37
|
-
responses: 'Opción 1, Opción 2, Opción 3',
|
|
38
|
-
text: 'Texto de la pregunta',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// public formGroup = this.formBuilder.group({
|
|
43
|
-
// options: this.formBuilder.array([]),
|
|
44
|
-
// response: ['', Validators.required],
|
|
45
|
-
// hint: [],
|
|
46
|
-
// explanation: [],
|
|
47
|
-
// });
|
|
48
|
-
|
|
49
|
-
ngOnInit(): void {
|
|
50
|
-
this.formGroup.get('response');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public isRendered;
|
|
54
|
-
|
|
55
|
-
//TODO Probablemente estos 3 pueden irse a una clase abstracta
|
|
56
|
-
|
|
57
|
-
public pushControlToFormArray(controlName: string): void {
|
|
58
|
-
this.formGroup.controls.options.push(this.formBuilder.control(''));
|
|
59
|
-
// (this.formGroup.get(controlName) as UntypedFormArray).push(this.formBuilder.control(''));
|
|
60
|
-
console.log(this.formGroup.controls.options);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public deleteFormArrayByIndex(controlName: string, index: number): void {
|
|
64
|
-
(this.formGroup.get(controlName) as UntypedFormArray).removeAt(index);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get optionsForm(): UntypedFormArray {
|
|
68
|
-
return this.formGroup.get('options') as UntypedFormArray;
|
|
69
|
-
}
|
|
70
|
-
}
|
package/src/lib/components/lesson-mini-components/components/selector/selector.component.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p-select [class]="status" placeholder="Selecciona" [options]="config.settings.options" [formControl]="control"></p-select>
|
package/src/lib/components/lesson-mini-components/components/selector/selector.component.spec.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { SelectorComponent } from './selector.component';
|
|
4
|
-
|
|
5
|
-
describe('SelectorComponent', () => {
|
|
6
|
-
let component: SelectorComponent;
|
|
7
|
-
let fixture: ComponentFixture<SelectorComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [SelectorComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(SelectorComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { SelectModule } from 'primeng/select';
|
|
5
|
-
|
|
6
|
-
import { ComponentWithForm } from '../ComponentWithForm';
|
|
7
|
-
import { LessonComponentConfiguration, LessonComponentInterface } from '../lessons.clases';
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'app-selector',
|
|
11
|
-
templateUrl: './selector.component.html',
|
|
12
|
-
styleUrls: ['./selector.component.scss'],
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [FormsModule, ReactiveFormsModule, SelectModule],
|
|
15
|
-
})
|
|
16
|
-
export class SelectorComponent extends ComponentWithForm implements LessonComponentInterface {
|
|
17
|
-
public isFilled = false;
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
}
|
|
22
|
-
@Input() config: LessonComponentConfiguration;
|
|
23
|
-
|
|
24
|
-
public evaluate() {
|
|
25
|
-
let result;
|
|
26
|
-
if (this.control.value == null) {
|
|
27
|
-
result = null;
|
|
28
|
-
} else {
|
|
29
|
-
result = this.control.value?.toLowerCase().trim() === this.config.settings.response.toLowerCase().trim();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (result) {
|
|
33
|
-
this.status = 'success';
|
|
34
|
-
} else {
|
|
35
|
-
this.status = 'danger';
|
|
36
|
-
}
|
|
37
|
-
this.isFilled = true;
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public override validate() {
|
|
42
|
-
if (this.control.invalid) {
|
|
43
|
-
this.status = 'warning';
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
<div>
|
|
3
|
-
<h5>Constructor de Speaker</h5>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<lib-ngx-tts (ttsGenerated)="handleTtsGenerated($event)"></lib-ngx-tts>
|
|
7
|
-
|
|
8
|
-
<br />
|
|
9
|
-
<div>
|
|
10
|
-
<p-button (click)="copyToClipboard()" [disabled]="formGroup.invalid" label="Copia Código" [rounded]="true"></p-button>
|
|
11
|
-
<p-button (click)="showCode()" [disabled]="!tts()" label="Mostrar" [rounded]="true" severity="secondary"></p-button>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
File without changes
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Component, signal } from '@angular/core';
|
|
2
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
-
import { ComponentBuilder } from '../../ComponentBuilder';
|
|
4
|
-
import { ButtonModule } from 'primeng/button';
|
|
5
|
-
import { InputTextModule } from 'primeng/inputtext';
|
|
6
|
-
import { DropdownModule } from 'primeng/dropdown';
|
|
7
|
-
import { NgxTtsComponent, TTSGenerated } from '@dataclouder/ngx-tts';
|
|
8
|
-
import { LessonComponentConfiguration, LessonCompSettings } from '../../lessons.clases';
|
|
9
|
-
|
|
10
|
-
@Component({
|
|
11
|
-
selector: 'app-speaker-builder',
|
|
12
|
-
templateUrl: './speaker-builder.component.html',
|
|
13
|
-
styleUrls: ['./speaker-builder.component.scss'],
|
|
14
|
-
standalone: true,
|
|
15
|
-
imports: [FormsModule, ReactiveFormsModule, InputTextModule, ButtonModule, DropdownModule, NgxTtsComponent],
|
|
16
|
-
})
|
|
17
|
-
export class SpeakerBuilderComponent extends ComponentBuilder {
|
|
18
|
-
public tts = signal<TTSGenerated | undefined>(undefined);
|
|
19
|
-
|
|
20
|
-
public handleTtsGenerated(event: TTSGenerated): void {
|
|
21
|
-
console.log('TTS generated:', event);
|
|
22
|
-
this.tts.set(event);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Update return type and add settings object
|
|
26
|
-
protected override getCode(): LessonComponentConfiguration<LessonCompSettings & { voice: string }> {
|
|
27
|
-
const ttsValue = this.tts();
|
|
28
|
-
if (!ttsValue) {
|
|
29
|
-
// Handle the case where tts is undefined, maybe throw an error or return a default config
|
|
30
|
-
console.error('TTS data is not generated yet.');
|
|
31
|
-
// Depending on requirements, you might return a default/empty config or throw
|
|
32
|
-
return { component: this.questionType, inputs: {} }; // Example: return empty inputs
|
|
33
|
-
}
|
|
34
|
-
const code: LessonComponentConfiguration<LessonCompSettings & { voice: string }> = {
|
|
35
|
-
component: this.questionType,
|
|
36
|
-
inputs: { tts: ttsValue },
|
|
37
|
-
};
|
|
38
|
-
return code;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// ❌ can use this until i copy services to this lib
|
|
2
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
3
|
-
import { ButtonModule } from 'primeng/button';
|
|
4
|
-
import { SpeakerCompConfiguration } from '../lessons.clases';
|
|
5
|
-
import { TTSGenerated } from '@dataclouder/ngx-tts';
|
|
6
|
-
|
|
7
|
-
// import { CONVERSATION_AI_TOKEN } from '@dataclouder/ngx-agent-cards';
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'app-speaker',
|
|
10
|
-
templateUrl: './speaker.component.html',
|
|
11
|
-
styleUrls: ['./speaker.component.scss'],
|
|
12
|
-
standalone: true,
|
|
13
|
-
imports: [ButtonModule],
|
|
14
|
-
})
|
|
15
|
-
export class SpeakerComponent implements OnInit {
|
|
16
|
-
ngOnInit(): void {
|
|
17
|
-
// throw new Error('Method not implemented.');
|
|
18
|
-
}
|
|
19
|
-
@Input() config: SpeakerCompConfiguration;
|
|
20
|
-
@Input() tts: TTSGenerated | undefined;
|
|
21
|
-
|
|
22
|
-
// voiceOptions = VoiceOptions;
|
|
23
|
-
// constructor(private speachService: SpeechService, private audioService: AudioService) {}
|
|
24
|
-
// ngOnInit(): void {}
|
|
25
|
-
public speach() {
|
|
26
|
-
console.log('should speech but will do in next version');
|
|
27
|
-
// if (this.config.audio) {
|
|
28
|
-
// this.audioService.playAudio(this.config.audio.url);
|
|
29
|
-
// } else {
|
|
30
|
-
// this.speachService.speach(this.config.settings.text);
|
|
31
|
-
// }
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<div>
|
|
2
|
-
<div>
|
|
3
|
-
<h5>Constructor de formulario con texto</h5>
|
|
4
|
-
</div>
|
|
5
|
-
|
|
6
|
-
<div>
|
|
7
|
-
<form class="builder-form" [formGroup]="formGroup">
|
|
8
|
-
<input pInputText type="text" nbInput fullWidth formControlName="response" placeholder="Respuesta" />
|
|
9
|
-
|
|
10
|
-
<input pInputText class="form-input" type="" nbInput fullWidth formControlName="hint"
|
|
11
|
-
placeholder="Escribe una pista para esta pregunta" />
|
|
12
|
-
|
|
13
|
-
<input pInputText class="form-input" type="text" nbInput fullWidth formControlName="explanation"
|
|
14
|
-
placeholder="Excribe una explicación para la respuesta" />
|
|
15
|
-
</form>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div>
|
|
19
|
-
<p-button (click)="copyToClipboard()" [disabled]="formGroup.invalid" label="Copia Código"
|
|
20
|
-
[rounded]="true"></p-button>
|
|
21
|
-
<p-button (click)="showCode()" [disabled]="formGroup.invalid" label="Mostrar" [rounded]="true"
|
|
22
|
-
severity="secondary"></p-button>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { TextWriterBuiderComponent } from './text-writer-buider.component';
|
|
4
|
-
|
|
5
|
-
describe('TextWriterBuiderComponent', () => {
|
|
6
|
-
let component: TextWriterBuiderComponent;
|
|
7
|
-
let fixture: ComponentFixture<TextWriterBuiderComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [TextWriterBuiderComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(TextWriterBuiderComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|