Skip to content

Commit

Permalink
Merge pull request #144 from Antony-jeban/fix/lint-issues
Browse files Browse the repository at this point in the history
fix: fixed all the lint issues
  • Loading branch information
mathkruger authored Sep 24, 2024
2 parents 9a444f0 + b39a98d commit f42c6d2
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 38 deletions.
10 changes: 5 additions & 5 deletions src/app/components/content-list/content-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ export class ContentListComponent extends SettingsBase implements OnInit {
});
}

homeRoute(){
homeRoute() {
return this.router.url === "/";
}

getPlayerStatus() {
this.playerService.getPlayerStatus().subscribe((item) => {
this.playerState = item;
if (this.playerState?.item.type == "track") {
this.currentAlbum = this.playerState?.item.album.id
} else if (this.playerState?.item.type == "episode") {
this.currentAlbum = this.playerState?.item.show.id
if (this.playerState?.item.type === "track") {
this.currentAlbum = this.playerState?.item.album.id;
} else if (this.playerState?.item.type === "episode") {
this.currentAlbum = this.playerState?.item.show.id;
} else {
this.currentAlbum = "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class LanguageSwitcherComponent implements OnInit {

currentLang: any;
languages: any[] = [];
hidden: boolean = true;
hidden = true;

ngOnInit() {
const defaultLanguage = window.localStorage.getItem("languageSelected") || this.translate.getDefaultLang();
Expand All @@ -37,7 +37,7 @@ export class LanguageSwitcherComponent implements OnInit {
this.translate.getTranslation(x.code).subscribe(t => {
x.flag = t.FlagCode,
x.name = t.LanguageName,
x.direction = t.direction
x.direction = t.direction;
});
});
}
Expand Down
18 changes: 9 additions & 9 deletions src/app/components/player/player.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ export class PlayerComponent extends SettingsBase implements OnInit, OnChanges {
(this.playerStatus?.item?.duration_ms || 0)) *
100;
this.seekStyle = {
background: `linear-gradient(to ${this.defaultLanguage != 'he' ? 'right' : 'left'}, var(--spt-green) 0%, var(--spt-green) ${progressPercentage}%, #343a40 ${progressPercentage}%, #343a40 100%)`,
background: `linear-gradient(to ${this.defaultLanguage !== 'he' ? 'right' : 'left'}, var(--spt-green) 0%, var(--spt-green) ${progressPercentage}%, #343a40 ${progressPercentage}%, #343a40 100%)`,
};
}

addScript() {
const script = document.createElement('script')
script.async = true
script.src = "https://sdk.scdn.co/spotify-player.js"
document.head.appendChild(script)
const script = document.createElement('script');
script.async = true;
script.src = "https://sdk.scdn.co/spotify-player.js";
document.head.appendChild(script);
}

initPlayer() {
Expand All @@ -113,7 +113,7 @@ export class PlayerComponent extends SettingsBase implements OnInit, OnChanges {
name: "Litefy Player",
getOAuthToken: (cb) => {
cb(token);
this.addScript()
this.addScript();
},
});

Expand Down Expand Up @@ -207,18 +207,18 @@ export class PlayerComponent extends SettingsBase implements OnInit, OnChanges {
this.playerService.getCurrentState().subscribe((item) => {
this.playerStatus = item;

if (this.playerStatus?.item.type == "track") {
if (this.playerStatus?.item.type === "track") {
this.trackTitle = this.playerStatus?.item.name;
this.trackAlbum = this.playerStatus?.item.album.name;
this.trackAuthor = this.playerStatus?.item.album.artists[0]?.name;
this.trackImage = this.playerStatus?.item.album.images[2].url;
this.trackId = this.playerStatus?.item.id;
this.albumId = 'album/' + this.playerStatus?.item.album.id;
this.artistId = 'artist/' + this.playerStatus?.item.album.artists[0]?.id;
} else if (this.playerStatus?.item.type == "episode") {
} else if (this.playerStatus?.item.type === "episode") {
this.trackTitle = this.playerStatus?.item.name;
this.trackAlbum = this.playerStatus?.item.show.name;
this.trackAuthor = this.playerStatus?.item.show.publisher;;
this.trackAuthor = this.playerStatus?.item.show.publisher;
this.trackImage = this.playerStatus?.item.images[2].url;
this.trackId = this.playerStatus?.item.id;
this.albumId = 'show/' + this.playerStatus?.item.show.id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
import { By } from "@angular/platform-browser";
import { DebugElement } from "@angular/core";
import { waitForAsync, ComponentFixture, TestBed } from "@angular/core/testing";

import { YoutubePlayerComponent } from "./youtube-player.component";

describe("YoutubePlayerComponent", () => {
let component: YoutubePlayerComponent;
let fixture: ComponentFixture<YoutubePlayerComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [YoutubePlayerComponent],
}).compileComponents();
Expand Down
8 changes: 4 additions & 4 deletions src/app/pages/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class HomeComponent implements OnInit {
topArtists: SpotifyApi.PagingObject<SpotifyApi.ArtistObjectFull>;
topTracks: SpotifyApi.PagingObject<SpotifyApi.TrackObjectFull>;
featuredPlaylists: SpotifyApi.PagingObject<SpotifyApi.PlaylistObjectSimplified>;

requisicoesCompletas = false;

activeUser: User;

range = "medium_term"
range = "medium_term";

ngOnInit() {
this.getAllHomeData();
Expand All @@ -55,7 +55,7 @@ export class HomeComponent implements OnInit {
});
}

changeRange(recievedRange: any){
changeRange(recievedRange: any) {
this.range = recievedRange;
this.getAllHomeData();
const shortButt = document.getElementById("short_term");
Expand All @@ -68,5 +68,5 @@ export class HomeComponent implements OnInit {
clickedButt.style.backgroundColor = "#0e512a";
}


}
7 changes: 6 additions & 1 deletion src/app/pages/playlist/playlist.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { TranslateService } from "@ngx-translate/core";
})
export class PlaylistComponent extends SettingsBase implements OnInit {

constructor(private playlistService: SpotifyPlaylistService, private activatedRoute: ActivatedRoute, injector: Injector, public translateService: TranslateService,) {
constructor(
private playlistService: SpotifyPlaylistService,
private activatedRoute: ActivatedRoute,
injector: Injector,
public translateService: TranslateService
) {
super(injector);
}

Expand Down
7 changes: 2 additions & 5 deletions src/app/pages/settings/settings.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';

import { SettingsComponent } from './settings.component';

describe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ SettingsComponent ]
})
Expand Down
2 changes: 2 additions & 0 deletions src/app/pages/show/show.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// tslint:disable:max-line-length

import { SpotifyShowService } from '@services/spotify-show.service';
import { AppModule } from './../../app.module';
import { waitForAsync, ComponentFixture, inject, TestBed } from '@angular/core/testing';
Expand Down
4 changes: 2 additions & 2 deletions src/app/pipes/number-locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export class NumberLocale implements PipeTransform {

}

transform(value: number | string, locale: string = 'pt') : string {
transform(value: number | string, locale: string = 'pt'): string {
return new Intl.NumberFormat(locale, {
minimumFractionDigits: 0
}).format(Number(value));
}
}
}
6 changes: 3 additions & 3 deletions src/app/services/settings.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("SettingsService", () => {

it("#setSettings should save settings to Local Storage", () => {
service.setSettings([settingsObj]);

const result = window.localStorage.getItem(keySettings);

expect(result).toBe(JSON.stringify([settingsObj]));
Expand All @@ -34,7 +34,7 @@ describe("SettingsService", () => {

result.subscribe(res => {
expect(res).toBeNull();
})
});
}));

it("#getSettings should return settings object from observable if there are settings stored", waitForAsync(() => {
Expand All @@ -44,7 +44,7 @@ describe("SettingsService", () => {

result.subscribe(res => {
expect(res).toEqual([settingsObj]);
})
});
}));

it("#hasLocalstorageData should return true if there is settings data in Local Storage", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/spotify-user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export class SpotifyUserService {
}

getUserTopArtists(range: any): Observable<SpotifyApi.UsersTopArtistsResponse> {
range = (range !== '') ? range : "medium_term"
range = (range !== '') ? range : "medium_term";
return this.service.Get('https://api.spotify.com/v1/me/top/artists?limit=24&time_range=' + range);
}

getUserTopTracks(range: any): Observable<SpotifyApi.UsersTopTracksResponse> {
range = (range !== '') ? range : "medium_term"
range = (range !== '') ? range : "medium_term";
return this.service.Get('https://api.spotify.com/v1/me/top/tracks?time_range=' + range);
}

Expand Down

0 comments on commit f42c6d2

Please sign in to comment.