diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html index bf4c102c..b5913445 100644 --- a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html +++ b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.html @@ -1,5 +1,5 @@ -
+
@if (iconUrl) { @@ -11,6 +11,8 @@
{{ title }}
{{ description }}
+ +
@if (showCardContent) {
diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss index df4faa9c..246be4da 100644 --- a/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss +++ b/frontend/projects/shared-call-components/src/lib/components/cards/base-card/base-card.component.scss @@ -15,6 +15,11 @@ align-items: center; gap: 16px; padding: 20px 20px 10px 20px; + position: relative; +} + +.card-header.balancedPadding { + padding: 20px !important; } .card-content { @@ -60,6 +65,7 @@ .text-container { display: flex; flex-direction: column; + flex-grow: 1; } .card-title { diff --git a/frontend/projects/shared-call-components/src/lib/components/cards/pro-feature/pro-feature.component.ts b/frontend/projects/shared-call-components/src/lib/components/cards/pro-feature/pro-feature.component.ts index 081fbbb6..23befdd5 100644 --- a/frontend/projects/shared-call-components/src/lib/components/cards/pro-feature/pro-feature.component.ts +++ b/frontend/projects/shared-call-components/src/lib/components/cards/pro-feature/pro-feature.component.ts @@ -1,40 +1,64 @@ -import { Component } from '@angular/core'; +import { ChangeDetectorRef, Component } from '@angular/core'; import { BaseCardComponent } from '../base-card/base-card.component'; import { MatButtonModule } from '@angular/material/button'; +import { MatChipsModule } from '@angular/material/chips'; +import { NotificationService } from '../../../services'; @Component({ selector: 'ov-pro-feature-card', standalone: true, - imports: [BaseCardComponent, MatButtonModule], + imports: [BaseCardComponent, MatButtonModule, MatChipsModule], template: ` -
-

Upgrade to OpenVidu PRO

-

- Unlock this feature by upgrading to a Pro account. You can upgrade your account and start using this - feature. -

-
- -
+
+ + PRO +
`, styles: ` - .pro-feature-content { - padding: 25px; - text-align: center; + .pro-feature-card { + cursor: pointer; + } + + ::ng-deep .mat-mdc-standard-chip:not(.mdc-evolution-chip--disabled) { + background-color: #077692 !important; + border-radius: 8px; + border: 1px solid #077692; + } + ::ng-deep .mat-mdc-standard-chip:not(.mdc-evolution-chip--disabled) .mdc-evolution-chip__text-label { + color: #ffffff !important; + font-weight: bold; } ` }) export class ProFeatureCardComponent extends BaseCardComponent { + constructor( + cdr: ChangeDetectorRef, + private notificationService: NotificationService + ) { + super(cdr); + } + + showDialog() { + this.notificationService.showDialog({ + title: 'Upgrade to OpenVidu PRO', + message: + 'Unlock this feature by upgrading to a Pro account. You can upgrade your account and start using this feature.', + confirmText: 'Upgrade to Pro', + cancelText: 'Cancel', + confirmCallback: this.goToOpenVidu.bind(this) + }); + } goToOpenVidu() { window.open('https://openvidu.io/pricing/', '_blank'); } diff --git a/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.scss b/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.scss index ca840a20..0690c39c 100644 --- a/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.scss +++ b/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.scss @@ -1,3 +1,15 @@ +.dialog-title { + text-align: center; +} button { margin-right: 8px; } + +.dialog-action { + margin: auto; +} + +.confirm-button { + background-color: #007bff; + color: white; +} diff --git a/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.ts b/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.ts index 130e0510..b82aa4c9 100644 --- a/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.ts +++ b/frontend/projects/shared-call-components/src/lib/components/dialog/dialog.component.ts @@ -1,16 +1,19 @@ -import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Inject, inject } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; -import { MatDialogActions, MatDialogContent, MatDialogRef } from '@angular/material/dialog'; +import { MAT_DIALOG_DATA, MatDialogActions, MatDialogContent, MatDialogRef } from '@angular/material/dialog'; +import type { DialogOptions } from '../../models'; @Component({ selector: 'ov-dialog', standalone: true, imports: [MatButtonModule, MatDialogActions, MatDialogContent], - template: `

Delete file

- Would you like to delete? - - - + template: `

{{ data.title }}

+ {{ data.message }} + + + `, styleUrl: './dialog.component.scss', changeDetection: ChangeDetectionStrategy.OnPush @@ -18,7 +21,14 @@ import { MatDialogActions, MatDialogContent, MatDialogRef } from '@angular/mater export class DialogComponent { readonly dialogRef = inject(MatDialogRef); - close(): void { + constructor(@Inject(MAT_DIALOG_DATA) public data: DialogOptions) {} + + close(type: 'confirm' | 'cancel'): void { this.dialogRef.close(); + if (type === 'confirm' && this.data.confirmCallback) { + this.data.confirmCallback(); + } else if (type === 'cancel' && this.data.cancelCallback) { + this.data.cancelCallback(); + } } } diff --git a/frontend/projects/shared-call-components/src/lib/models/index.ts b/frontend/projects/shared-call-components/src/lib/models/index.ts index 2977738a..2030760a 100644 --- a/frontend/projects/shared-call-components/src/lib/models/index.ts +++ b/frontend/projects/shared-call-components/src/lib/models/index.ts @@ -1,2 +1,3 @@ export * from './sidenav.model'; +export * from './notification.model'; export { ApplicationMode } from './context.model'; diff --git a/frontend/projects/shared-call-components/src/lib/models/notification.model.ts b/frontend/projects/shared-call-components/src/lib/models/notification.model.ts new file mode 100644 index 00000000..0289ee9d --- /dev/null +++ b/frontend/projects/shared-call-components/src/lib/models/notification.model.ts @@ -0,0 +1,8 @@ +export interface DialogOptions { + title?: string; + message: string; + confirmText?: string; + cancelText?: string; + cancelCallback?: () => void; + confirmCallback?: () => void; +} diff --git a/frontend/projects/shared-call-components/src/lib/services/notification/notification.service.ts b/frontend/projects/shared-call-components/src/lib/services/notification/notification.service.ts index 68362b24..74d255ff 100644 --- a/frontend/projects/shared-call-components/src/lib/services/notification/notification.service.ts +++ b/frontend/projects/shared-call-components/src/lib/services/notification/notification.service.ts @@ -5,13 +5,7 @@ import { MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { SpinnerComponent } from '../../components/spinner/spinner.component'; import { DialogComponent } from '../../components/dialog/dialog.component'; - -export interface DialogOptions { - title?: string; - message: string; - confirmText?: string; - cancelText?: string; -} +import { DialogOptions } from '../../models'; @Injectable({ providedIn: 'root' @@ -55,9 +49,9 @@ export class NotificationService { // Método para mostrar un diálogo showDialog(options: DialogOptions): void { this.dialog.open(DialogComponent, { - data: options, // Pasa las opciones al componente del diálogo + data: options, width: '400px', - disableClose: true // Evita que se cierre haciendo clic fuera del diálogo + disableClose: true }); }