2018-10-21 19:00:10 -04:00
|
|
|
import { DISABLE_AUTOMATIC_WRAPPING, WidgetComponent } from "../widget.component";
|
|
|
|
import { EditableWidget, WIDGET_SPOTIFY } from "../../../shared/models/widget";
|
|
|
|
import { Component } from "@angular/core";
|
2020-10-23 07:30:20 -04:00
|
|
|
import { TranslateService } from "@ngx-translate/core";
|
2018-10-21 19:00:10 -04:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
templateUrl: "spotify.widget.component.html",
|
|
|
|
styleUrls: ["spotify.widget.component.scss"],
|
|
|
|
})
|
|
|
|
export class SpotifyWidgetConfigComponent extends WidgetComponent {
|
|
|
|
|
2020-10-23 07:30:20 -04:00
|
|
|
constructor(public translate: TranslateService) {
|
2020-12-28 23:05:45 -05:00
|
|
|
super(WIDGET_SPOTIFY, "Spotify", DISABLE_AUTOMATIC_WRAPPING, translate, "spotify");
|
2018-10-21 19:00:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected OnNewWidgetPrepared(widget: EditableWidget): void {
|
|
|
|
widget.dimension.newData.uri = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected OnWidgetBeforeAdd(widget: EditableWidget): void {
|
|
|
|
this.setSpotifyUrl(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected OnWidgetBeforeEdit(widget: EditableWidget) {
|
|
|
|
this.setSpotifyUrl(widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
private setSpotifyUrl(widget: EditableWidget) {
|
|
|
|
widget.dimension.newUrl = window.location.origin + "/widgets/spotify?uri=$uri";
|
|
|
|
}
|
2020-10-23 07:30:20 -04:00
|
|
|
}
|