diff --git a/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.html b/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.html index 79d02ff9e85..2097078f234 100644 --- a/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.html +++ b/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.html @@ -15,21 +15,26 @@
- - - - - +
diff --git a/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.ts b/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.ts index fd3a1696228..c8b0b8c6ee9 100644 --- a/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.ts +++ b/src/themes/custom/app/item-page/simple/field-components/share-buttons/sedici-share-buttons.component.ts @@ -1,6 +1,8 @@ import { CommonModule } from '@angular/common'; import { Component, ViewChild, ElementRef, Input } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { HostWindowService } from 'src/app/shared/host-window.service'; +import { Observable } from 'rxjs'; @Component({ selector: 'sedici-share-buttons', @@ -13,9 +15,14 @@ export class SediciShareButtonsComponent { @ViewChild('elementContentToCopy') elementContentToCopy: ElementRef; @Input() link: string; + @Input() title: string; + @Input() type: string; + isMobile$: Observable; copySuccess: boolean = false; - constructor(public activeModal: NgbActiveModal) {} + constructor(public activeModal: NgbActiveModal, private windowService: HostWindowService) { + this.isMobile$ = this.windowService.isMobile(); + } copyToClipboard(element: HTMLInputElement) { navigator.clipboard.writeText(element.value).then(() => { @@ -26,6 +33,37 @@ export class SediciShareButtonsComponent { }); } + get researchGateLink(): string { + const subject = `${this.type} compartido desde sedici.unlp.edu.ar`; + const text = `¡Hola! Quiero compartir este/a ${this.type} desde el repositorio SEDICI (sedici.unlp.edu.ar).\n${this.title}\n${this.link}`; + return `https://www.researchgate.net/messages?ocmd=1&messageModalSubject=${encodeURIComponent(subject)}&messageModalText=${encodeURIComponent(text)}`; + } + + get mendeleyLink(): string { + return `https://www.mendeley.com/import/?url=${encodeURIComponent(this.link)}`; + } + + get whatsappLink(): string { + let baseURL = ''; + this.isMobile$.subscribe(isMobile => { + if (isMobile) { + baseURL = 'https://api.whatsapp.com/send'; + } else { + baseURL = 'https://web.whatsapp.com/send'; + } + }); + const message = `¡Hola! Quiero compartir este/a ${this.type} desde el repositorio SEDICI (sedici.unlp.edu.ar).\n${this.title}\n${this.link}`; + return `${baseURL}?text=${encodeURIComponent(message)}`; + } + + get linkedinLink(): string { + return `https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(this.link)}&title=${encodeURIComponent(this.title)}`; + } + + get xLink(): string { + return `https://x.com/share?text=${encodeURIComponent(this.title)}&url=${encodeURIComponent(this.link)}&via=sedici_unlp`; + } + close() { this.activeModal.close(); } diff --git a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts index 2ecce775817..fa0f3592d81 100644 --- a/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts +++ b/src/themes/custom/app/item-page/simple/item-types/untyped-item/untyped-item.component.ts @@ -105,6 +105,8 @@ export class UntypedItemComponent extends BaseComponent { centered: true, // Centra el modal }); modalRef.componentInstance.link = this.object.firstMetadataValue('dc.identifier.uri'); + modalRef.componentInstance.title = this.object.firstMetadataValue('dc.title'); + modalRef.componentInstance.type = this.object.firstMetadataValue('sedici.subtype') || this.object.firstMetadataValue('dc.type'); } get hasMetadata(): boolean {