Skip to content

Commit

Permalink
Merge pull request #4 from rajnishdargan/mtf-feature
Browse files Browse the repository at this point in the history
Issue #221304 feat: MTF Question in QuML Player
  • Loading branch information
vaivk369 authored Aug 21, 2024
2 parents 7f4e394 + 8a0538a commit 229c986
Show file tree
Hide file tree
Showing 31 changed files with 30,628 additions and 5,248 deletions.
33 changes: 31 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"private": true,
"dependencies": {
"@angular/animations": "^16.2.12",
"@angular/cdk": "^16.2.14",
"@angular/common": "^16.2.12",
"@angular/compiler": "^16.2.12",
"@angular/core": "^16.2.12",
Expand All @@ -30,8 +31,8 @@
"@angular/router": "^16.2.12",
"@project-sunbird/client-services": "5.1.2",
"@project-sunbird/sb-styles": "0.0.16",
"@project-sunbird/telemetry-sdk": "1.3.0",
"@project-sunbird/sunbird-player-sdk-v9": "6.0.5",
"@project-sunbird/telemetry-sdk": "1.3.0",
"bootstrap": "^5.3.3",
"core-js": "^2.5.4",
"document-register-element": "^1.7.2",
Expand All @@ -45,14 +46,15 @@
"zone.js": "~0.13.3"
},
"devDependencies": {
"@angular-devkit/core": "^16.2.12",
"@angular-devkit/build-angular": "^16.2.12",
"@angular-devkit/core": "^16.2.12",
"@angular/cli": "^16.2.12",
"@angular/compiler-cli": "^16.2.12",
"@angular/language-service": "^16.2.12",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"ajv": "^8.12.0",
"codelyzer": "^6.0.0",
"concat": "^1.0.3",
"copyfiles": "^2.4.1",
Expand All @@ -68,7 +70,6 @@
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.3",
"typescript": "~4.9.5",
"ajv": "^8.12.0"
"typescript": "~4.9.5"
}
}
}
2 changes: 1 addition & 1 deletion projects/quml-library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tekdi/sunbird-quml-player",
"version": "8.0.0",
"version": "9.0.0-beta.8",
"schematics": "./schematics/collection.json",
"ng-add": {
"save": "dependencies"
Expand Down
23 changes: 23 additions & 0 deletions projects/quml-library/src/lib/interfaces/mtf-interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export interface MtfOption {
label: string;
value: number;
}

export interface MtfOptions {
left: MtfOption[];
right: MtfOption[];
}

export interface MtfValidation {
required: string;
}

export interface MtfResponse {
type: string;
options: MtfOptions;
validation: MtfValidation;
}

export interface MtfInteractions {
response1: MtfResponse;
}
24 changes: 24 additions & 0 deletions projects/quml-library/src/lib/mtf/check-figure.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Directive, ElementRef, Renderer2, AfterViewInit } from '@angular/core';

@Directive({
selector: '[appCheckFigure]'
})
export class CheckFigureDirective implements AfterViewInit {

constructor(private el: ElementRef, private renderer: Renderer2) {}

ngAfterViewInit(): void {
this.checkForFigureTag();
}

checkForFigureTag(): void {
const figureTag = this.el.nativeElement.querySelector('figure');
const magnifyIcon = this.el.nativeElement.parentElement.querySelector('.zoom-icon');

if (figureTag) {
this.renderer.setStyle(magnifyIcon, 'display', 'block');
} else {
this.renderer.setStyle(magnifyIcon, 'display', 'none');
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<ng-container *ngIf="optionsShuffled && (layout === 'VERTICAL' || layout === 'DEFAULT')">
<div class="main-div">
<div id="leftSide">
<div *ngFor="let option of shuffledOptions.left" class="bubble-right">
<div [innerHTML]="option.label" appCheckFigure></div>
<div class="zoom-icon" (click)="openModal($event)"></div>
</div>
</div>
<div id="rightSide" cdkDropList (cdkDropListDropped)="onDrop($event)">
<div *ngFor="let option of shuffledOptions.right; let i = index" class="bubble-left" cdkDrag
[cdkDragData]="option" cdkDragBoundary="#rightSide">
<div [innerHTML]="option.label" appCheckFigure></div>
<div class="zoom-icon" (click)="openModal($event)"></div>
</div>
</div>
<!-- Modal -->
<div class="mft-modal modal" *ngIf="isModalVisible">
<div class="modal-content">
<span class="modal-close" (click)="closeModal()">&times;</span>
<img [src]="selectedImageSrc" />
</div>
</div>
</div>
</ng-container>

<ng-container *ngIf="optionsShuffled && layout === 'HORIZONTAL'">
<div class="horizontal-main">
<div id="topSide">
<div *ngFor="let option of shuffledOptions.left; let i = index" class="bubble-bottom">
<div [innerHTML]="option.label" appCheckFigure></div>
<div class="zoom-icon" (click)="openModal($event)"></div>
</div>
</div>
<div id="bottomSide" cdkDropList cdkDropListOrientation="horizontal" (cdkDropListDropped)="onDrop($event)">
<div *ngFor="let option of shuffledOptions.right; let i = index" class="bubble-top" [cdkDragData]="option"
cdkDrag>
<div [innerHTML]="option.label" cdkDragBoundary="#bottomSide" appCheckFigure></div>
<div class="zoom-icon" (click)="openModal($event)"></div>
</div>
</div>
<!-- Modal -->
<div class="mft-modal modal" *ngIf="isModalVisible">
<div class="modal-content">
<span class="modal-close" (click)="closeModal()">&times;</span>
<img [src]="selectedImageSrc" />
</div>
</div>
</div>
</ng-container>
Loading

0 comments on commit 229c986

Please sign in to comment.