@dataclouder/ngx-lessons 0.0.31 → 0.0.33

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.
Files changed (86) hide show
  1. package/README.md +56 -10
  2. package/fesm2022/dataclouder-ngx-lessons.mjs +292 -81
  3. package/fesm2022/dataclouder-ngx-lessons.mjs.map +1 -1
  4. package/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.d.ts +9 -5
  5. package/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.d.ts +3 -1
  6. package/lib/components/lesson-mini-components/components/lessons.clases.d.ts +1 -0
  7. package/lib/models/simple-agents.d.ts +2 -0
  8. package/lib/services/lesson-ai.service.d.ts +15 -2
  9. package/lib/services/lesson-utils.service.d.ts +10 -1
  10. package/package.json +1 -1
  11. package/public-api.d.ts +1 -0
  12. package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.html +0 -40
  13. package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.scss +0 -120
  14. package/src/lib/components/dc-lessons/dc-lesson-card/dc-lesson-card.component.ts +0 -82
  15. package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.css +0 -1
  16. package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.html +0 -46
  17. package/src/lib/components/dc-lessons/dc-lesson-component-adder/dc-lesson-component-adder.component.ts +0 -52
  18. package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.css +0 -90
  19. package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.html +0 -67
  20. package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.scss +0 -0
  21. package/src/lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component.ts +0 -356
  22. package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.css +0 -1
  23. package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.html +0 -72
  24. package/src/lib/components/dc-lessons/dc-lesson-metadata-editor/dc-lesson-metadata-editor.component.ts +0 -60
  25. package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.html +0 -23
  26. package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.scss +0 -3
  27. package/src/lib/components/dc-lessons/dc-lesson-renderer/dc-lesson-renderer.component.ts +0 -332
  28. package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.html +0 -5
  29. package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.scss +0 -3
  30. package/src/lib/components/dc-lessons/lesson-form/lesson-form.component.ts +0 -14
  31. package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.html +0 -30
  32. package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.scss +0 -17
  33. package/src/lib/components/dc-lessons/lesson-list/dc-lesson-list.component.ts +0 -170
  34. package/src/lib/components/dc-lessons/lessons.component.ts +0 -10
  35. package/src/lib/components/lesson-mini-components/components/ComponentBuilder.ts +0 -82
  36. package/src/lib/components/lesson-mini-components/components/ComponentWithForm.ts +0 -25
  37. package/src/lib/components/lesson-mini-components/components/lesson-dynamic.component.ts +0 -13
  38. package/src/lib/components/lesson-mini-components/components/lessons.clases.ts +0 -220
  39. package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.html +0 -62
  40. package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.scss +0 -15
  41. package/src/lib/components/lesson-mini-components/components/selector/selector-builder/selector-builder.component.ts +0 -70
  42. package/src/lib/components/lesson-mini-components/components/selector/selector.component.html +0 -1
  43. package/src/lib/components/lesson-mini-components/components/selector/selector.component.scss +0 -12
  44. package/src/lib/components/lesson-mini-components/components/selector/selector.component.spec.ts +0 -25
  45. package/src/lib/components/lesson-mini-components/components/selector/selector.component.ts +0 -47
  46. package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.html +0 -13
  47. package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.scss +0 -0
  48. package/src/lib/components/lesson-mini-components/components/speaker/speaker-builder/speaker-builder.component.ts +0 -40
  49. package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.html +0 -9
  50. package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.scss +0 -3
  51. package/src/lib/components/lesson-mini-components/components/speaker/speaker.component.ts +0 -33
  52. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.html +0 -24
  53. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.scss +0 -15
  54. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.spec.ts +0 -25
  55. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer-buider/text-writer-buider.component.ts +0 -29
  56. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.html +0 -4
  57. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.scss +0 -8
  58. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.spec.ts +0 -25
  59. package/src/lib/components/lesson-mini-components/components/text-writer/text-writer.component.ts +0 -61
  60. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.css +0 -3
  61. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.html +0 -9
  62. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcher.component.ts +0 -32
  63. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.css +0 -3
  64. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.html +0 -28
  65. package/src/lib/components/lesson-mini-components/components/translationSwitcher/translationSwitcherBuilder/translationSwitcherBuilder.component.ts +0 -30
  66. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.html +0 -18
  67. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.scss +0 -3
  68. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.spec.ts +0 -25
  69. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary-builder/verb-summary-builder.component.ts +0 -25
  70. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.html +0 -15
  71. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.scss +0 -27
  72. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.spec.ts +0 -25
  73. package/src/lib/components/lesson-mini-components/components/verb-summary/verb-summary.component.ts +0 -46
  74. package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.html +0 -19
  75. package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.scss +0 -0
  76. package/src/lib/components/lesson-mini-components/components/word-summary/word-summary-builder/word-summary-builder.component.ts +0 -27
  77. package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.html +0 -14
  78. package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.scss +0 -22
  79. package/src/lib/components/lesson-mini-components/components/word-summary/word-summary.component.ts +0 -51
  80. package/src/lib/models/lessons.pipes.ts +0 -38
  81. package/src/lib/models/models.ts +0 -92
  82. package/src/lib/models/notion.models.ts +0 -43
  83. package/src/lib/services/lesson-ai.service.ts +0 -103
  84. package/src/lib/services/lesson-notion.service.ts +0 -161
  85. package/src/lib/services/lesson-utils.service.ts +0 -181
  86. package/src/public-api.ts +0 -25
@@ -1,7 +1,7 @@
1
1
  import { ComponentRef, ElementRef, ViewContainerRef } from '@angular/core';
2
2
  import BalloonEditor from '@ckeditor/ckeditor5-build-balloon-block';
3
3
  import { StorageImageSettings } from '@dataclouder/ngx-cloud-storage';
4
- import { LessonComponentEnum, ILesson, LessonComponentInterface, DynamicContentComponent } from '../../lesson-mini-components/components/lessons.clases';
4
+ import { LessonComponentEnum, ILesson, LessonComponentInterface } from '../../lesson-mini-components/components/lessons.clases';
5
5
  import { ComponentBuildData } from '../../lesson-mini-components/components/ComponentBuilder';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class DCLessonEditorComponent {
@@ -10,10 +10,9 @@ export declare class DCLessonEditorComponent {
10
10
  dhtml: ElementRef;
11
11
  readonly lessonId: import("@angular/core").Signal<string>;
12
12
  lesson: import("@angular/core").WritableSignal<ILesson>;
13
- isCropperVisible: import("@angular/core").WritableSignal<boolean>;
14
13
  isLoadingLesson: import("@angular/core").WritableSignal<boolean>;
15
- coverBackground: import("@angular/core").Signal<string>;
16
- readonly dynamicComponentsArray: import("@angular/core").Signal<DynamicContentComponent[]>;
14
+ coverImageUrl: import("@angular/core").Signal<string>;
15
+ readonly dynamicComponentsArray: import("@angular/core").Signal<import("@dataclouder/ngx-lessons").DynamicContentComponent[]>;
17
16
  components: {
18
17
  [key: string]: ComponentRef<LessonComponentInterface>;
19
18
  };
@@ -39,8 +38,13 @@ export declare class DCLessonEditorComponent {
39
38
  * @param result The configuration data returned from the component builder dialog. Expected format: { obj: LessonComponentConfiguration }
40
39
  */
41
40
  onComponentAdded(result: ComponentBuildData): void;
42
- openCropper(): void;
43
41
  generateByAI(): Promise<void>;
42
+ /**
43
+ * Replaces encoded JSON blocks (~...~) in HTML with their 'settings.text' value.
44
+ * @param htmlInput The HTML string containing encoded JSON.
45
+ * @returns The processed HTML string with text replacements.
46
+ */
47
+ private _extractTextFromEncodedJson;
44
48
  /**
45
49
  * Handles the image upload event, updates the lesson signal via the service, and saves.
46
50
  * @param event The image upload event data.
@@ -1,7 +1,7 @@
1
1
  import { ElementRef } from '@angular/core';
2
2
  import { FormGroup, FormControl } from '@angular/forms';
3
3
  import { ILesson } from '../../lesson-mini-components/components/lessons.clases';
4
- import { IAgentCard, IMiniAgentCard } from '@dataclouder/ngx-agent-cards';
4
+ import { IAgentCard, IConversationSettings, IMiniAgentCard } from '@dataclouder/ngx-agent-cards';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class DCLessonRendererComponent {
7
7
  lessonInput: import("@angular/core").InputSignal<ILesson>;
@@ -17,11 +17,13 @@ export declare class DCLessonRendererComponent {
17
17
  chatVisible: import("@angular/core").WritableSignal<boolean>;
18
18
  agentMasterLesson: import("@angular/core").WritableSignal<IAgentCard>;
19
19
  evaluatorAgentCard: import("@angular/core").WritableSignal<IMiniAgentCard>;
20
+ conversationSettings: import("@angular/core").WritableSignal<IConversationSettings>;
20
21
  imageCover: import("@angular/core").Signal<string>;
21
22
  private components;
22
23
  mainForm: FormGroup<{
23
24
  [key: string]: FormControl<any>;
24
25
  }>;
26
+ private previousTextCoded;
25
27
  constructor();
26
28
  private _clearLessonRendering;
27
29
  private _renderLesson;
@@ -122,6 +122,7 @@ export declare abstract class LessonsAbstractService {
122
122
  abstract generateLesson(lesson: ILesson): Promise<any>;
123
123
  abstract postGenerateByAI(id: string): Promise<any>;
124
124
  abstract extractTextFromHtml(html: string): string;
125
+ abstract postImproveMDWithAI(lessonId: string, markdownText: string): Promise<any>;
125
126
  }
126
127
  export declare function provideLessonsService(serviceImplementation: Type<LessonsAbstractService>): Provider[];
127
128
  export declare const LangCodeDescription: {
@@ -0,0 +1,2 @@
1
+ import { ISimpleAgent } from '@dataclouder/ngx-agent-cards';
2
+ export declare const BasicAgentCard: ISimpleAgent;
@@ -1,9 +1,16 @@
1
- import { IAgentCard, IMiniAgentCard } from '@dataclouder/ngx-agent-cards';
1
+ import { IAgentCard, IMiniAgentCard, IConversationSettings } from '@dataclouder/ngx-agent-cards';
2
2
  import { ILesson } from '../components/lesson-mini-components/components/lessons.clases';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class LessonAIService {
5
5
  private readonly lessonService;
6
- constructor();
6
+ private readonly userService;
7
+ /**
8
+ * Builds the scenario prompt string based on lesson content and user info.
9
+ * @param lessonText The extracted text content of the lesson.
10
+ * @param userInformationPrompt The formatted string containing user details.
11
+ * @returns The complete scenario prompt string.
12
+ */
13
+ private _buildScenarioPrompt;
7
14
  /**
8
15
  * Generates the necessary agent cards for a lesson chat session.
9
16
  * @param lesson The lesson data.
@@ -13,6 +20,12 @@ export declare class LessonAIService {
13
20
  masterAgent: IAgentCard;
14
21
  evaluatorAgent: IMiniAgentCard;
15
22
  } | null>;
23
+ /**
24
+ * Generates conversation settings for a lesson, using the lesson scenario as the initial prompt.
25
+ * @param lesson The lesson data.
26
+ * @returns An IConversationSettings object configured for the lesson scenario.
27
+ */
28
+ generateConversationSettingsForLesson(lesson: ILesson): Promise<IConversationSettings | null>;
16
29
  static ɵfac: i0.ɵɵFactoryDeclaration<LessonAIService, never>;
17
30
  static ɵprov: i0.ɵɵInjectableDeclaration<LessonAIService>;
18
31
  }
@@ -1,9 +1,10 @@
1
1
  import { WritableSignal } from '@angular/core';
2
2
  import { ILesson } from '../components/lesson-mini-components/components/lessons.clases';
3
+ import { LoadingBarService } from '@dataclouder/ngx-core';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class LessonUtilsService {
5
6
  #private;
6
- constructor();
7
+ loadingBarService: LoadingBarService;
7
8
  /**
8
9
  * Validates if audios need generation for the given lesson.
9
10
  * Currently logs a placeholder message.
@@ -22,6 +23,14 @@ export declare class LessonUtilsService {
22
23
  * @returns The updated lesson object after AI generation, or null on failure.
23
24
  */
24
25
  generateByAI(lessonId: string): Promise<ILesson | null>;
26
+ /**
27
+ * Improves the provided Markdown text using AI and updates the lesson.
28
+ * Assumes the lesson is already saved before calling this.
29
+ * @param lessonId The ID of the lesson to update.
30
+ * @param markdownText The Markdown text generated from the lesson's HTML content.
31
+ * @returns The updated lesson object after AI improvement, or null on failure.
32
+ */
33
+ improveMDWithAI(lesson: ILesson, markdownText: string): Promise<string | null>;
25
34
  /**
26
35
  * Cleans orphaned components from the lesson's dynamicComponents.
27
36
  * An orphaned component is one present in dynamicComponents but its ID is not found in the textCoded HTML.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataclouder/ngx-lessons",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
package/public-api.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './lib/models/lessons.pipes';
2
2
  export * from './lib/models/notion.models';
3
+ export * from './lib/models/simple-agents';
3
4
  export * from './lib/components/dc-lessons/lesson-list/dc-lesson-list.component';
4
5
  export * from './lib/components/dc-lessons/lesson-form/lesson-form.component';
5
6
  export * from './lib/components/dc-lessons/dc-lesson-editor/dc-lesson-editor.component';
@@ -1,40 +0,0 @@
1
- <div class="card-container">
2
- @if(showOptions){
3
- <p-speeddial
4
- class="dial-button"
5
- [model]="items"
6
- [radius]="70"
7
- type="quarter-circle"
8
- direction="down-left"
9
- [buttonProps]="{ severity: 'primary', rounded: true, outlined: true, raised: true }" />
10
- }
11
- <p-card>
12
- <div class="lesson-card">
13
- <div class="photo">
14
- <img [src]="coverUrl" alt="" />
15
- </div>
16
-
17
- <span class="date">{{ lesson.createdDate | date : 'dd/MM/yyyy' }}</span>
18
-
19
- <div class="description">
20
- <h1>{{ lesson.title }}</h1>
21
- <p>{{ lesson.description }}</p>
22
- <div class="card-footer">
23
- <div class="status-tags">
24
- <span class="level-tag">Nivel {{ lesson.level }}</span>
25
- @if (lesson.taken?.status == 'passed') {
26
- <span class="status-tag success">Tomada</span>
27
- }
28
- @if (lesson.taken?.status == 'failed') {
29
- <span class="status-tag danger">Fallida</span>
30
- }
31
- </div>
32
-
33
- <div class="actions">
34
- <p-button label="Tomar lección" (onClick)="eventCard(eventType.Select)" severity="primary"> </p-button>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
39
- </p-card>
40
- </div>
@@ -1,120 +0,0 @@
1
- .card-container {
2
- position: relative;
3
- margin-bottom: 20px;
4
- margin-left: 10px;
5
- }
6
-
7
- .dial-button {
8
- position: absolute;
9
- top: 10px;
10
- right: 20px;
11
- z-index: 10;
12
- }
13
-
14
- .lesson-card {
15
- // position: relative;
16
- border-radius: 0.5rem;
17
- height: 100%;
18
- }
19
-
20
- .lesson-card .photo {
21
- position: absolute;
22
- top: 0;
23
- left: 0;
24
- right: 0;
25
- bottom: 0;
26
- z-index: 1;
27
-
28
- img {
29
- width: 100%;
30
- height: 100%;
31
- object-fit: cover;
32
- object-position: center;
33
- }
34
-
35
- /* Alternative: Add a dark overlay */
36
- &::after {
37
- content: '';
38
- position: absolute;
39
- top: 0;
40
- left: 0;
41
- width: 100%;
42
- height: 100%;
43
- background: linear-gradient(to bottom, rgb(0, 0, 0) 50%, var(--p-primary-color) 100%);
44
- opacity: 0.4;
45
- z-index: 2;
46
- pointer-events: none; /* Allows clicks to pass through */
47
- }
48
- }
49
-
50
- .description {
51
- position: relative;
52
- z-index: 2;
53
- color: white;
54
- // background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.8) 100%);
55
- height: 100%;
56
- display: flex;
57
- flex-direction: column;
58
-
59
- h1 {
60
- margin-top: 0;
61
- margin-bottom: 0.5rem;
62
- font-size: 1.5rem;
63
- }
64
-
65
- p {
66
- margin-bottom: 1rem;
67
- flex-grow: 1;
68
- }
69
- }
70
-
71
- .date {
72
- position: absolute;
73
- top: 1rem;
74
- left: 1rem;
75
- z-index: 3;
76
- background-color: rgba(0, 0, 0, 0.7);
77
- color: white;
78
- padding: 0.3rem 0.6rem;
79
- border-radius: 0.25rem;
80
- font-size: 0.8rem;
81
- }
82
-
83
- .card-footer {
84
- display: flex;
85
- justify-content: space-between;
86
- align-items: center;
87
- margin-top: auto;
88
- }
89
-
90
- .status-tags {
91
- display: flex;
92
- gap: 0.5rem;
93
-
94
- .level-tag,
95
- .status-tag {
96
- padding: 0.3rem 0.6rem;
97
- border-radius: 0.25rem;
98
- font-size: 0.8rem;
99
- }
100
-
101
- .level-tag {
102
- background-color: rgba(255, 255, 255, 0.2);
103
- }
104
-
105
- .status-tag {
106
- &.success {
107
- background-color: rgba(40, 167, 69, 0.7);
108
- }
109
-
110
- &.danger {
111
- background-color: rgba(220, 53, 69, 0.7);
112
- }
113
- }
114
- }
115
-
116
- .actions {
117
- ::ng-deep .p-button {
118
- font-size: 0.9rem;
119
- }
120
- }
@@ -1,82 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { DatePipe } from '@angular/common';
3
-
4
- import { ButtonModule } from 'primeng/button';
5
- import { PopoverModule } from 'primeng/popover';
6
-
7
- import { SpeedDialModule } from 'primeng/speeddial';
8
- import { MenuItem } from 'primeng/api';
9
- import { CardModule } from 'primeng/card';
10
-
11
- import { ILesson, ILessonWithTaken } from '../../lesson-mini-components/components/lessons.clases';
12
- import { OnActionEvent } from '@dataclouder/ngx-core';
13
-
14
- enum EventCard {
15
- Edit = 'edit',
16
- Delete = 'delete',
17
- Select = 'select',
18
- Qr = 'qr',
19
- }
20
- @Component({
21
- selector: 'dc-lesson-card',
22
- templateUrl: './dc-lesson-card.component.html',
23
- styleUrls: ['./dc-lesson-card.component.scss'],
24
- standalone: true,
25
- imports: [DatePipe, ButtonModule, PopoverModule, SpeedDialModule, CardModule],
26
- })
27
- export class DcLessonCardComponent implements OnInit {
28
- @Input() lesson: ILessonWithTaken | ILesson | any;
29
- @Input() showOptions: boolean = true;
30
-
31
- @Output() onAction: EventEmitter<OnActionEvent> = new EventEmitter();
32
-
33
- public coverUrl: string = 'assets/background/default-background.webp';
34
- public eventType = EventCard;
35
-
36
- public items: MenuItem[] = [
37
- {
38
- label: 'Editar',
39
- icon: 'pi pi-pencil',
40
- command: () => {
41
- this.eventCard(EventCard.Edit);
42
- },
43
- },
44
- {
45
- label: 'Eliminar',
46
- icon: 'pi pi-trash',
47
- command: () => {
48
- this.eventCard(EventCard.Delete);
49
- },
50
- },
51
- {
52
- label: 'Tomar lección',
53
- icon: 'pi pi-play',
54
- command: () => {
55
- this.eventCard(EventCard.Select);
56
- },
57
- },
58
- ];
59
-
60
- ngOnInit() {
61
- if (this.lesson?.media?.images![0]?.url) {
62
- this.coverUrl = this.lesson.media.images[0].url;
63
- }
64
- }
65
-
66
- public eventCard(eventType: EventCard) {
67
- switch (eventType) {
68
- case EventCard.Edit:
69
- this.onAction.emit({ action: 'edit', item: this.lesson });
70
- break;
71
- case EventCard.Delete:
72
- this.onAction.emit({ action: 'delete', item: this.lesson });
73
- break;
74
- case EventCard.Select:
75
- this.onAction.emit({ action: 'select', item: this.lesson });
76
- break;
77
- case EventCard.Qr:
78
- this.onAction.emit({ action: 'qr', item: this.lesson });
79
- break;
80
- }
81
- }
82
- }
@@ -1 +0,0 @@
1
- /* Add any specific styles for the component adder here if needed */
@@ -1,46 +0,0 @@
1
- <span>Componentes: </span>
2
- <div style="display: flex; gap: 10px; flex-wrap: wrap">
3
- <p-button
4
- severity="info"
5
- (click)="openComponentBuilder(lessonComponentEnum.Selector)"
6
- pTooltip="Agrega un selector con multiples opciones"
7
- tooltipPosition="bottom">
8
- Selector
9
- </p-button>
10
- <p-button
11
- severity="info"
12
- (click)="openComponentBuilder(lessonComponentEnum.Speaker)"
13
- pTooltip="Para que una palabra o frase sea reproducible"
14
- tooltipPosition="bottom">
15
- Speaker
16
- </p-button>
17
- <p-button
18
- severity="info"
19
- (click)="openComponentBuilder(lessonComponentEnum.TextWriter)"
20
- pTooltip="Escribe una respuesta en un cuadro de texto"
21
- tooltipPosition="bottom">
22
- Text
23
- </p-button>
24
- <p-button
25
- severity="info"
26
- (click)="openComponentBuilder(lessonComponentEnum.VerbSummary)"
27
- pTooltip="Muestra la información de un verbo"
28
- tooltipPosition="bottom">
29
- Verb
30
- </p-button>
31
- <p-button
32
- severity="info"
33
- (click)="openComponentBuilder(lessonComponentEnum.WordSummary)"
34
- pTooltip="Muestra la información de una palabra"
35
- tooltipPosition="bottom">
36
- Palabra
37
- </p-button>
38
- <p-button
39
- severity="info"
40
- (click)="openComponentBuilder(lessonComponentEnum.TranslationSwitcher)"
41
- pTooltip="Muestra el texto pero al pica cambia de idioma"
42
- tooltipPosition="bottom">
43
- Traducción
44
- </p-button>
45
- <!-- Add other buttons here if needed, following the same pattern -->
46
- </div>
@@ -1,52 +0,0 @@
1
- import { Component, EventEmitter, Output, inject } from '@angular/core'; // Added inject
2
- import { CommonModule } from '@angular/common';
3
- // PrimeNG
4
- import { ButtonModule } from 'primeng/button';
5
- import { TooltipModule } from 'primeng/tooltip';
6
- import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; // Added DialogService, DynamicDialogRef
7
- // Dataclouder
8
- import { TOAST_ALERTS_TOKEN, ToastAlertsAbstractService } from '@dataclouder/ngx-core'; // Added Toast imports
9
- // Project specific
10
- import { LessonComponentEnum, LessonComponentBuilders } from '../../lesson-mini-components/components/lessons.clases'; // Added LessonComponentBuilders
11
-
12
- @Component({
13
- selector: 'dc-lesson-component-adder',
14
- standalone: true,
15
- imports: [CommonModule, ButtonModule, TooltipModule],
16
- templateUrl: './dc-lesson-component-adder.component.html',
17
- styleUrls: ['./dc-lesson-component-adder.component.css'],
18
- providers: [DialogService], // Provide DialogService here
19
- })
20
- export class DCLessonComponentAdderComponent {
21
- // Services
22
- #dialogService = inject(DialogService);
23
- #toastService = inject(TOAST_ALERTS_TOKEN);
24
-
25
- @Output() componentAdded = new EventEmitter<any>(); // Changed Output name and type
26
-
27
- // Expose enum to the template
28
- public lessonComponentEnum = LessonComponentEnum;
29
-
30
- // Moved logic from DCLessonEditorComponent
31
- public openComponentBuilder(type: LessonComponentEnum): void {
32
- const componentToBuild = LessonComponentBuilders[type];
33
- if (!componentToBuild) {
34
- console.error(`No component builder found for type: ${type}`);
35
- this.#toastService.error({ title: 'Error', subtitle: `Componente desconocido: ${type}` });
36
- return;
37
- }
38
- const dialogRef: DynamicDialogRef = this.#dialogService.open(componentToBuild, {
39
- width: '80vw',
40
- header: 'Agregar componente',
41
- closable: true,
42
- });
43
-
44
- // Handle the result and emit the new event
45
- dialogRef.onClose.subscribe((result) => {
46
- if (result) {
47
- console.log('Component builder closed:', result);
48
- this.componentAdded.emit(result); // Emit the result when dialog closes successfully
49
- }
50
- });
51
- }
52
- }
@@ -1,90 +0,0 @@
1
- .btn {
2
- padding: 0.5rem 1rem;
3
- border-radius: 4px;
4
- border: 1px solid transparent;
5
- cursor: pointer;
6
- }
7
-
8
- .btn-primary {
9
- background-color: #007bff;
10
- color: white;
11
- }
12
-
13
- .btn-outline-primary {
14
- border-color: #007bff;
15
- color: #007bff;
16
- }
17
-
18
- .btn-secondary {
19
- background-color: #6c757d;
20
- color: white;
21
- }
22
-
23
- .btn-outline-secondary {
24
- border-color: #6c757d;
25
- color: #6c757d;
26
- }
27
-
28
- .btn-rounded {
29
- border-radius: 50%;
30
- }
31
-
32
- .form-control {
33
- padding: 0.375rem 0.75rem;
34
- border: 1px solid #ced4da;
35
- border-radius: 0.25rem;
36
- }
37
-
38
- .splitter {
39
- display: flex;
40
- gap: 1rem;
41
- }
42
-
43
- .splitter-panel {
44
- flex: 1;
45
- }
46
-
47
- .checkbox-container {
48
- display: inline-flex;
49
- align-items: center;
50
- gap: 0.5rem;
51
- cursor: pointer;
52
- }
53
-
54
- .mr-2 {
55
- margin-right: 0.5rem;
56
- }
57
-
58
- .header-cover {
59
- width: 100%;
60
- height: 250px;
61
- background-position: center;
62
- background-repeat: no-repeat;
63
- background-size: cover;
64
- position: relative;
65
- }
66
-
67
- .float-button {
68
- position: fixed;
69
- bottom: 3.5rem;
70
- right: 2rem;
71
- z-index: 1000;
72
- display: flex;
73
- gap: 1px;
74
- :host ::ng-deep .p-button {
75
- width: 4rem;
76
- height: 4rem;
77
- border-radius: 50%;
78
- }
79
- }
80
-
81
- .text-editor {
82
- width: -webkit-fill-available;
83
- overflow-y: auto;
84
- }
85
-
86
-
87
- :host ::ng-deep .p-inputtext{
88
- background: rgba(255, 255, 255, 0.2);
89
-
90
- }
@@ -1,67 +0,0 @@
1
- <div style="position: relative; margin-bottom: 20px">
2
- <div class="header-cover" [style.background-image]="coverBackground()"></div>
3
-
4
- <dc-cropper-modal
5
- style="position: absolute; top: 10px; left: 20px"
6
- [buttonLabel]="'Carga una portada'"
7
- [imgStorageSettings]="coverStorageSettings"
8
- (imageUploaded)="onImageUploaded($event)"></dc-cropper-modal>
9
- </div>
10
-
11
- <br />
12
-
13
- <!-- Lesson Metadata Editor -->
14
- <dc-lesson-metadata-editor
15
- [lesson]="lesson"
16
- [isLoadingLesson]="isLoadingLesson"
17
- (saveRequest)="saveLesson()"
18
- (importNotionRequest)="importFromNotion()"
19
- (improveNotionRequest)="improveNotionWithAI()"
20
- (generateAIRequest)="generateByAI()"
21
- (propertyChange)="updateLessonProperty($event.property, $event.value)">
22
- </dc-lesson-metadata-editor>
23
-
24
- <hr />
25
-
26
- <!-- Component Adder -->
27
- <dc-lesson-component-adder (componentAdded)="onComponentAdded($event)"></dc-lesson-component-adder>
28
-
29
- <!-- Display Added Components -->
30
- <div class="added-components-list" style="margin-top: 15px; margin-bottom: 15px">
31
- <h4>Componentes Agregados:</h4>
32
- @if (dynamicComponentsArray().length > 0) {
33
- <ul>
34
- @for (comp of dynamicComponentsArray(); track comp.id) {
35
- <li>ID: {{ comp.id }} - Tipo: {{ comp.component }}<button pButton icon="pi pi-info" (click)="showComponentDetails(comp)"></button></li>
36
- }
37
- </ul>
38
- } @else {
39
- <p>Aún no se han agregado componentes.</p>
40
- }
41
- </div>
42
-
43
- <hr />
44
-
45
- <!-- Text Editor and Renderer -->
46
- <p-splitter [style]="{ height: '80vh' }" styleClass="mb-8">
47
- <ng-template pTemplate>
48
- <ckeditor
49
- (keydown.control.s)="saveLesson($event)"
50
- class="text-editor"
51
- [editor]="editor"
52
- [ngModel]="lesson()?.textCoded"
53
- (ngModelChange)="updateLessonProperty('textCoded', $event)">
54
- </ckeditor>
55
- </ng-template>
56
-
57
- <ng-template pTemplate>
58
- <dc-lesson-renderer class="text-editor" [lessonInput]="lesson()" [test]="true"></dc-lesson-renderer>
59
- </ng-template>
60
- </p-splitter>
61
-
62
- <div class="float-button">
63
- <!-- Removed p-speeddial -->
64
- <p-button icon="pi pi-save" (click)="saveLesson()" severity="primary" [rounded]="true" [raised]="true" pTooltip="Guardar (Ctrl + S)"> </p-button>
65
- </div>
66
-
67
- <hr />