UI updates to subscriptions

Improved translation coverage
This commit is contained in:
Tzahi12345
2023-01-24 21:45:19 -05:00
parent 840e12db71
commit 970e3834be
9 changed files with 50 additions and 26 deletions

View File

@@ -9,13 +9,13 @@
<div class="col-12 mt-3">
<mat-checkbox (change)="downloadAllToggled()" [(ngModel)]="download_all"><ng-container i18n="Download all uploads subscription setting">Download all uploads</ng-container></mat-checkbox>
</div>
<div class="col-12" *ngIf="!download_all && editor_initialized">
<div class="col-12" *ngIf="editor_initialized">
<ng-container i18n="Download time range prefix">Download videos uploaded in the last</ng-container>
<mat-form-field color="accent" class="amount-select">
<input type="number" matInput [(ngModel)]="timerange_amount" (ngModelChange)="timerangeChanged($event, false)">
<input type="number" matInput [(ngModel)]="timerange_amount" (ngModelChange)="timerangeChanged($event, false)" [disabled]="download_all">
</mat-form-field>
<mat-form-field class="unit-select">
<mat-select color="accent" [(ngModel)]="timerange_unit" (ngModelChange)="timerangeChanged($event, true)">
<mat-select color="accent" [(ngModel)]="timerange_unit" (ngModelChange)="timerangeChanged($event, true)" [disabled]="download_all">
<mat-option *ngFor="let time_unit of time_units" [value]="time_unit + (timerange_amount === 1 ? '' : 's')">
{{time_unit + (timerange_amount === 1 ? '' : 's')}}
</mat-option>

View File

@@ -24,14 +24,14 @@
<div class="col-12">
<mat-checkbox [(ngModel)]="download_all"><ng-container i18n="Download all uploads subscription setting">Download all uploads</ng-container></mat-checkbox>
</div>
<div class="col-12" *ngIf="!download_all">
<div class="col-12">
<span i18n="Download time range prefix">Download videos uploaded in the last</span>
<div>
<mat-form-field color="accent" style="width: 100px; text-align: center;">
<input type="number" matInput [(ngModel)]="timerange_amount">
<input type="number" matInput [(ngModel)]="timerange_amount" [disabled]="download_all">
</mat-form-field>
<mat-form-field class="unit-select">
<mat-select color="accent" [(ngModel)]="timerange_unit">
<mat-select color="accent" [(ngModel)]="timerange_unit" [disabled]="download_all">
<mat-option *ngFor="let time_unit of time_units" [value]="time_unit + (timerange_amount === 1 ? '' : 's')">
{{time_unit + (timerange_amount === 1 ? '' : 's')}}
</mat-option>

View File

@@ -23,5 +23,5 @@
<button mat-button mat-dialog-close><ng-container i18n="Close subscription info button">Close</ng-container></button>
<button mat-stroked-button (click)="downloadArchive()" color="accent"><ng-container i18n="Export Archive button">Export Archive</ng-container></button>
<span class="spacer"></span>
<button mat-button (click)="unsubscribe()" color="warn"><ng-container i18n="Unsubscribe button">Unsubscribe</ng-container></button>
<button mat-button (click)="confirmUnsubscribe()" color="warn"><ng-container i18n="Unsubscribe button">Unsubscribe</ng-container></button>
</mat-dialog-actions>

View File

@@ -1,6 +1,7 @@
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { PostsService } from 'app/posts.services';
import { ConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.component';
@Component({
selector: 'app-subscription-info-dialog',
@@ -13,7 +14,8 @@ export class SubscriptionInfoDialogComponent implements OnInit {
unsubbedEmitter = null;
constructor(public dialogRef: MatDialogRef<SubscriptionInfoDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any, private postsService: PostsService) { }
@Inject(MAT_DIALOG_DATA) public data: any, private postsService: PostsService,
private dialog: MatDialog) { }
ngOnInit() {
if (this.data) {
@@ -22,6 +24,22 @@ export class SubscriptionInfoDialogComponent implements OnInit {
}
}
confirmUnsubscribe() {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
data: {
dialogTitle: $localize`Unsubscribe from ${this.sub['name']}:subscription name:`,
dialogText: $localize`Would you like to unsubscribe from ${this.sub['name']}:subscription name:?`,
submitText: $localize`Unsubscribe`,
warnSubmitColor: true
}
});
dialogRef.afterClosed().subscribe(confirmed => {
if (confirmed) {
this.unsubscribe();
}
});
}
unsubscribe() {
this.postsService.unsubscribe(this.sub, true).subscribe(res => {
this.unsubbedEmitter.emit(true);
@@ -30,7 +48,7 @@ export class SubscriptionInfoDialogComponent implements OnInit {
}
downloadArchive() {
this.postsService.downloadArchive(this.sub).subscribe(res => {
this.postsService.downloadArchive(null, this.sub.id).subscribe(res => {
const blob: Blob = res;
saveAs(blob, 'archive.txt');
});