added the ability to save playlists
added local db system (lowdb) playlists are now downloaded as a zip from the streaming menupull/11/head
parent
0095ea1271
commit
d245904c0d
@ -0,0 +1,3 @@
|
|||||||
|
.mat-spinner {
|
||||||
|
margin-left: 5%;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<h4 mat-dialog-title>{{inputTitle}}</h4>
|
||||||
|
<mat-dialog-content>
|
||||||
|
<div>
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput (keyup.enter)="enterPressed()" [(ngModel)]="inputText" [placeholder]="inputPlaceholder">
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions>
|
||||||
|
<button mat-button mat-dialog-close>Cancel</button>
|
||||||
|
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
|
||||||
|
<button mat-button [disabled]="!inputText" type="submit" (click)="enterPressed()">{{submitText}}</button>
|
||||||
|
<div class="mat-spinner" *ngIf="inputSubmitted">
|
||||||
|
<mat-spinner [diameter]="25"></mat-spinner>
|
||||||
|
</div>
|
||||||
|
</mat-dialog-actions>
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { InputDialogComponent } from './input-dialog.component';
|
||||||
|
|
||||||
|
describe('InputDialogComponent', () => {
|
||||||
|
let component: InputDialogComponent;
|
||||||
|
let fixture: ComponentFixture<InputDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ InputDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(InputDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
import { Component, OnInit, Input, Inject, EventEmitter } from '@angular/core';
|
||||||
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-input-dialog',
|
||||||
|
templateUrl: './input-dialog.component.html',
|
||||||
|
styleUrls: ['./input-dialog.component.css']
|
||||||
|
})
|
||||||
|
export class InputDialogComponent implements OnInit {
|
||||||
|
|
||||||
|
inputTitle: string;
|
||||||
|
inputPlaceholder: string;
|
||||||
|
submitText: string;
|
||||||
|
|
||||||
|
inputText = '';
|
||||||
|
|
||||||
|
inputSubmitted = false;
|
||||||
|
|
||||||
|
doneEmitter: EventEmitter<any> = null;
|
||||||
|
onlyEmitOnDone = false;
|
||||||
|
|
||||||
|
constructor(public dialogRef: MatDialogRef<InputDialogComponent>,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.inputTitle = this.data.inputTitle;
|
||||||
|
this.inputPlaceholder = this.data.inputPlaceholder;
|
||||||
|
this.submitText = this.data.submitText;
|
||||||
|
|
||||||
|
// checks if emitter exists, if so don't autoclose as it should be handled by caller
|
||||||
|
if (this.data.doneEmitter) {
|
||||||
|
this.doneEmitter = this.data.doneEmitter;
|
||||||
|
this.onlyEmitOnDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enterPressed() {
|
||||||
|
// validates input -- TODO: add custom validator
|
||||||
|
if (this.inputText) {
|
||||||
|
// only emit if emitter is passed
|
||||||
|
if (this.onlyEmitOnDone) {
|
||||||
|
this.doneEmitter.emit(this.inputText);
|
||||||
|
this.inputSubmitted = true;
|
||||||
|
} else {
|
||||||
|
this.dialogRef.close(this.inputText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue