diff --git a/src/app/info-box-component/info-box.component.ts b/src/app/info-box-component/info-box.component.ts index 81da234..2483a6f 100644 --- a/src/app/info-box-component/info-box.component.ts +++ b/src/app/info-box-component/info-box.component.ts @@ -1,83 +1,81 @@ import {Component, Input, OnInit, Output} from '@angular/core'; import { MatExpansionModule } from '@angular/material/expansion'; import { Subscription } from 'rxjs'; import { WordService} from '../services/field-interaction.service'; import { Word } from '../models/models'; import {AnnotationService, TextStyleService} from '../services/annotation.service'; import { QueryService } from '../services/query.service'; import {DialogComponent} from '../dialog-component/dialog.component'; import {MatDialog} from '@angular/material'; -import { map } from 'rxjs/operators'; -import {THIS_EXPR} from '@angular/compiler/src/output/output_ast'; @Component({ selector: 'app-info-box', templateUrl: './info-box.component.html', styleUrls: ['./info-box.component.css'] }) export class InfoBoxComponent implements OnInit { @Input() manuscript: any; @Output() queryResponse: any; @Output() markupData; query: string; word: Word; subscription: Subscription; showInfo: boolean = false; expansion: boolean = true; constructor(private infoService: WordService, private matExpansionModule: MatExpansionModule, private textStyleService: TextStyleService, private queryService: QueryService, private annotationService: AnnotationService, private dialog: MatDialog ) { this.subscription = infoService.wordChange$.subscribe( word => { if (this.word === word) { this.toggleShowInfo(); this.word = null; } else { this.word = word; this.updateRDFData(word); if (!this.showInfo) { this.toggleShowInfo(); } } }); } ngOnInit() { } private toggleShowInfo() { this.showInfo = !this.showInfo; } public updateRDFData(word) { this.query = this.queryService.getQueryforResourceData( encodeURI('http://rdfh.ch/projects/0068#_W_II_1_Page131_Word206'), 'subject'); this.queryService.getData(this.query).subscribe(data => { this.queryResponse = data; }); // TODO: parse the annotations and apply them this.markupData = this.annotationService.getAnnotationMarkup(word); const fuu = 'PREFIX c: <' + decodeURI( 'http://example.org/cartoons#' ) + '> c:Tom a c:Cat. c:Jerry a c:Mouse; c:smarterThan c:Tom.' this.textStyleService.parseStyles(fuu); } private openInBrowser(word, shrunkTitle) { // TODO: Change this to actual word.iri word = encodeURI('http://rdfh.ch/projects/0068#_W_II_1_Page131_Word206'); this.dialog.open(DialogComponent, { data: { message: word, buttonText: {cancel: 'close'}, title: shrunkTitle }, }); } }