-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
154 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
import { TrackListAPI } from "../../../widgets/trackList/index.js"; | ||
import { AlbumListAPI } from "../../../widgets/albumList/index.js"; | ||
import { ArtistCardView } from "../../../widgets/artistCard/index.js"; | ||
import { TrackListView } from "../../../widgets/trackList/index.js"; | ||
import { AlbumListView } from "../../../widgets/albumList/index.js"; | ||
import { FooterPlayerView } from "../../../widgets/footerPlayer/index.js"; | ||
import { userStore } from "../../../entities/user/model/store.js"; | ||
import { player } from "../../../shared/player/model/store.js"; | ||
import { TrackListAPI } from '../../../widgets/trackList/index.js'; | ||
import { AlbumListAPI } from '../../../widgets/albumList/index.js'; | ||
import { ArtistCardView } from '../../../widgets/artistCard/index.js'; | ||
import { TrackListView } from '../../../widgets/trackList/index.js'; | ||
import { AlbumListView } from '../../../widgets/albumList/index.js'; | ||
import { FooterPlayerView } from '../../../widgets/footerPlayer/index.js'; | ||
import { userStore } from '../../../entities/user/model/store.js'; | ||
import { player } from '../../../shared/player/model/store.js'; | ||
|
||
export class ArtistPage { | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor(params) { | ||
this.parent = document.querySelector("#root"); | ||
this.artistId = params["artistId"]; | ||
} | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor(params) { | ||
this.parent = document.querySelector('#root'); | ||
this.artistId = params['artistId']; | ||
} | ||
|
||
async render() { | ||
this.parent.innerHTML = ""; | ||
async render() { | ||
this.parent.innerHTML = ''; | ||
|
||
const artistCardView = new ArtistCardView(this.parent, this.artistId); | ||
await artistCardView.render(); | ||
const artistCardView = new ArtistCardView(this.parent, this.artistId); | ||
await artistCardView.render(); | ||
|
||
const trackListAPI = new TrackListAPI(this.artistId); | ||
const tracks = await trackListAPI.get(); | ||
const trackListView = new TrackListView(this.parent, this.artistId); | ||
await trackListView.render(tracks.slice(0, 5)); | ||
const trackListAPI = new TrackListAPI(this.artistId); | ||
const tracks = await trackListAPI.get(); | ||
const trackListView = new TrackListView(this.parent, this.artistId); | ||
await trackListView.render(tracks.slice(0, 5)); | ||
|
||
player.setTracks(tracks); | ||
player.setTracks(tracks); | ||
|
||
const albumListAPI = new AlbumListAPI(this.artistId); | ||
const albumListView = new AlbumListView(this.parent, this.artistId); | ||
const albums = await albumListAPI.get(); | ||
await albumListView.render(albums.slice(0, 5)); | ||
const albumListAPI = new AlbumListAPI(this.artistId); | ||
const albumListView = new AlbumListView(this.parent, this.artistId); | ||
const albums = await albumListAPI.get(); | ||
await albumListView.render(albums.slice(0, 5)); | ||
|
||
const footPlayerView = new FooterPlayerView(this.parent); | ||
const user = userStore.storage.user; | ||
if (user) { | ||
await footPlayerView.render(); | ||
} | ||
} | ||
const footPlayerView = new FooterPlayerView(this.parent); | ||
const user = userStore.storage.user; | ||
if (user) { | ||
await footPlayerView.render(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,28 @@ | ||
import { TrackListAPI } from "../../../widgets/trackList/index.js"; | ||
import { AlbumListAPI } from "../../../widgets/albumList/index.js"; | ||
import { AlbumListView } from "../../../widgets/albumList/index.js"; | ||
import { FooterPlayerView } from "../../../widgets/footerPlayer/index.js"; | ||
import { userStore } from "../../../entities/user/model/store.js"; | ||
import { player } from "../../../shared/player/model/store.js"; | ||
import { AlbumListAPI } from '../../../widgets/albumList/index.js'; | ||
import { AlbumListView } from '../../../widgets/albumList/index.js'; | ||
import template from './MoreAlbums.hbs'; | ||
import './MoreAlbums.scss'; | ||
|
||
export class MoreAlbumsPage { | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor(params) { | ||
this.parent = document.querySelector("#root"); | ||
this.entity = params["entity"]; | ||
this.entityId = params["id"]; | ||
} | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor(params) { | ||
this.parent = document.querySelector('#root'); | ||
this.entity = params['entity']; | ||
this.entityId = params['id']; | ||
} | ||
|
||
async render() { | ||
if (this.entity === "artist") { | ||
this.artistId = this.entityId; | ||
} | ||
|
||
this.parent.innerHTML = template(); | ||
async render() { | ||
if (this.entity === 'artist') { | ||
this.artistId = this.entityId; | ||
} | ||
|
||
const albumListAPI = new AlbumListAPI(this.artistId); | ||
const albums = await albumListAPI.get(); | ||
const albumListView = new AlbumListView(this.parent, this.artistId); | ||
await albumListView.render(albums, false); | ||
|
||
const trackListAPI = new TrackListAPI(this.artistId); | ||
const tracks = await trackListAPI.get(); | ||
player.setTracks(tracks); | ||
this.parent.innerHTML = template(); | ||
|
||
const footPlayerView = new FooterPlayerView(this.parent); | ||
const user = userStore.storage.user; | ||
if (user) { | ||
await footPlayerView.render(); | ||
} | ||
} | ||
} | ||
const albumListAPI = new AlbumListAPI(this.artistId); | ||
const albums = await albumListAPI.get(); | ||
const albumListView = new AlbumListView(this.parent, this.artistId); | ||
await albumListView.render(albums, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,22 @@ | ||
import { TrackListAPI } from "../../../widgets/trackList/index.js"; | ||
import { ArtistListAPI } from "../../../widgets/artistList/index.js"; | ||
import { ArtistListView } from "../../../widgets/artistList/index.js"; | ||
import { FooterPlayerView } from "../../../widgets/footerPlayer/index.js"; | ||
import { userStore } from "../../../entities/user/model/store.js"; | ||
import { player } from "../../../shared/player/model/store.js"; | ||
import { ArtistListAPI } from '../../../widgets/artistList/index.js'; | ||
import { ArtistListView } from '../../../widgets/artistList/index.js'; | ||
import template from './MoreArtists.hbs'; | ||
import './MoreArtists.scss'; | ||
|
||
export class MoreArtistsPage { | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor() { | ||
this.parent = document.querySelector("#root"); | ||
} | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor() { | ||
this.parent = document.querySelector('#root'); | ||
} | ||
|
||
async render() { | ||
this.parent.innerHTML = template(); | ||
async render() { | ||
this.parent.innerHTML = template(); | ||
|
||
const artistListAPI = new ArtistListAPI(); | ||
const artists = await artistListAPI.get(); | ||
const artistListView = new ArtistListView(this.parent); | ||
await artistListView.render(artists, false); | ||
|
||
const trackListAPI = new TrackListAPI(); | ||
const tracks = await trackListAPI.get(); | ||
player.setTracks(tracks); | ||
|
||
const footPlayerView = new FooterPlayerView(this.parent); | ||
const user = userStore.storage.user; | ||
if (user) { | ||
await footPlayerView.render(); | ||
} | ||
} | ||
} | ||
const artistListAPI = new ArtistListAPI(); | ||
const artists = await artistListAPI.get(); | ||
const artistListView = new ArtistListView(this.parent); | ||
await artistListView.render(artists, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,47 @@ | ||
import { TrackListAPI } from "../../../widgets/trackList/index.js"; | ||
import { TrackListView } from "../../../widgets/trackList/index.js"; | ||
import { FooterPlayerView } from "../../../widgets/footerPlayer/index.js"; | ||
import { userStore } from "../../../entities/user/model/store.js"; | ||
import { player } from "../../../shared/player/model/store.js"; | ||
import { TrackListAPI } from '../../../widgets/trackList/index.js'; | ||
import { TrackListView } from '../../../widgets/trackList/index.js'; | ||
import { FooterPlayerView } from '../../../widgets/footerPlayer/index.js'; | ||
import { userStore } from '../../../entities/user/model/store.js'; | ||
import { player } from '../../../shared/player/model/store.js'; | ||
import template from './MoreTracks.hbs'; | ||
import './MoreTracks.scss'; | ||
|
||
export class MoreTracksPage { | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor(params) { | ||
this.parent = document.querySelector("#root"); | ||
this.entity = params["entity"]; | ||
this.entityId = params["id"]; | ||
} | ||
/** | ||
* Creates an instance of the View class. | ||
*/ | ||
constructor(params) { | ||
this.parent = document.querySelector('#root'); | ||
this.entity = params['entity']; | ||
this.entityId = params['id']; | ||
} | ||
|
||
async render() { | ||
if (this.entity === "artist") { | ||
this.artistId = this.entityId; | ||
} else if (this.entity === "album") { | ||
this.albumId = this.entityId; | ||
} | ||
async render() { | ||
this.parent.innerHTML = ''; | ||
|
||
this.parent.innerHTML = template(); | ||
if (this.entity === 'artist') { | ||
this.artistId = this.entityId; | ||
} else if (this.entity === 'album') { | ||
this.albumId = this.entityId; | ||
} | ||
|
||
const trackListAPI = new TrackListAPI(this.artistId, this.albumId); | ||
const trackListView = new TrackListView(this.parent, this.artistId, this.albumId); | ||
const tracks = await trackListAPI.get(); | ||
await trackListView.render(tracks, false); | ||
this.parent.innerHTML = template(); | ||
|
||
player.setTracks(tracks); | ||
const trackListAPI = new TrackListAPI(this.artistId, this.albumId); | ||
const trackListView = new TrackListView( | ||
this.parent, | ||
this.artistId, | ||
this.albumId, | ||
); | ||
const tracks = await trackListAPI.get(); | ||
await trackListView.render(tracks, false); | ||
|
||
const footPlayerView = new FooterPlayerView(this.parent); | ||
const user = userStore.storage.user; | ||
if (user) { | ||
await footPlayerView.render(); | ||
} | ||
} | ||
} | ||
player.setTracks(tracks); | ||
|
||
const footPlayerView = new FooterPlayerView(this.parent); | ||
const user = userStore.storage.user; | ||
if (user) { | ||
await footPlayerView.render(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.