Skip to content

Commit

Permalink
Merge pull request #104 from frontend-park-mail-ru/NM-103
Browse files Browse the repository at this point in the history
Nm 103
  • Loading branch information
MatiXxD authored Dec 17, 2024
2 parents 995f7d1 + d5459a2 commit a3e3743
Show file tree
Hide file tree
Showing 11 changed files with 595 additions and 577 deletions.
30 changes: 15 additions & 15 deletions src/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "./colors.scss";
@use "./components.scss";
@use './colors.scss';
@use './components.scss';

html,
body {
Expand All @@ -8,7 +8,7 @@ body {
padding: 0;
background: linear-gradient(180deg, #172b7b 0%, #020718 100%);
background-attachment: fixed;
font-family: "Comfortaa", sans-serif;
font-family: 'Comfortaa', sans-serif;
font-size: 18px;
font-weight: 300;
margin: 0;
Expand Down Expand Up @@ -102,8 +102,7 @@ h5 {
font-weight: 300;
}


input[type="range"] {
input[type='range'] {
-webkit-appearance: none;
appearance: none;
width: 100%;
Expand All @@ -114,7 +113,7 @@ input[type="range"] {
border-radius: 16px;
}

input[type="range"]::-webkit-slider-runnable-track {
input[type='range']::-webkit-slider-runnable-track {
height: 15px;
background: #ccc;
border-radius: 16px;
Expand All @@ -128,7 +127,7 @@ input[type="range"]::-webkit-slider-runnable-track {
}
}

input[type="range"]::-moz-range-track {
input[type='range']::-moz-range-track {
height: 15px;
background: #ccc;
border-radius: 16px;
Expand All @@ -142,15 +141,15 @@ input[type="range"]::-moz-range-track {
}
}

input[type="range"]::-webkit-slider-thumb {
input[type='range']::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
height: 15px;
width: 15px;
background-color: #f1f1f1;
border-radius: 50%;
border: 2px solid #FF5F0F;
box-shadow: -407px 0 0 400px #FF5F0F;
border: 2px solid #ff5f0f;
box-shadow: -607px 0 0 600px #ff5f0f;

@media (max-width: 1024px) {
height: 12px;
Expand All @@ -163,14 +162,15 @@ input[type="range"]::-webkit-slider-thumb {
}
}


input[type="range"]::-moz-range-thumb {
input[type='range']::-moz-range-thumb {
-webkit-appearance: none;
appearance: none;
height: 15px;
width: 15px;
background-color: #f1f1f1;
border-radius: 50%;
border: 1px solid #FF5F0F;
box-shadow: -407px 0 0 400px #FF5F0F;
border: 2px solid #ff5f0f;
box-shadow: -607px 0 0 600px #ff5f0f;

@media (max-width: 1024px) {
height: 12px;
Expand All @@ -181,4 +181,4 @@ input[type="range"]::-moz-range-thumb {
height: 10px;
width: 10px;
}
}
}
89 changes: 47 additions & 42 deletions src/pages/edit-profile/ui/editProfile.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
import { UploadAvatarView } from "../../../widgets/uploadAvatar/index.js";
import { EditUserView } from "../../../widgets/editUser/index.js";
import { userStore } from "../../../entities/user/index.js";
import { PUBLIC_ERRORS } from "../../../shared/lib/index.js";
import { eventBus } from "../../../shared/lib/index.js";
import { UploadAvatarView } from '../../../widgets/uploadAvatar/index.js';
import { EditUserView } from '../../../widgets/editUser/index.js';
import { userStore } from '../../../entities/user/index.js';
import { PUBLIC_ERRORS } from '../../../shared/lib/index.js';
import { eventBus } from '../../../shared/lib/index.js';
import { player } from '../../../shared/player/model/store.js';

export class EditProfilePage {
parent;
username;

constructor(params) {
this.parent = document.querySelector("#root");
this.username = params["username"];
}

async render() {
this.parent.innerHTML = "";

await userStore.checkAuth();
if (!userStore.isAuth()) {
console.error(PUBLIC_ERRORS.UNAUTHORIZED);
return;
}

const user = userStore.storage.user;

if (user.username != this.username) {
console.error(PUBLIC_ERRORS.FORBIDDEN);
eventBus.emit("navigate", "/");
return;
}

this.pageContent = document.createElement("div");
this.pageContent.classList.add("page_content");
this.parent.appendChild(this.pageContent);

const uploadAvatarView = new UploadAvatarView(this.pageContent, user.id);
await uploadAvatarView.render();

const editUserView = new EditUserView(this.pageContent, user.id);
await editUserView.render();

eventBus.emit("hidePlayer");
}
parent;
username;

constructor(params) {
this.parent = document.querySelector('#root');
this.username = params['username'];
}

async render() {
this.parent.innerHTML = '';

await userStore.checkAuth();
if (!userStore.isAuth()) {
console.error(PUBLIC_ERRORS.UNAUTHORIZED);
return;
}

const user = userStore.storage.user;

if (user.username != this.username) {
console.error(PUBLIC_ERRORS.FORBIDDEN);
eventBus.emit('navigate', '/');
return;
}

this.pageContent = document.createElement('div');
this.pageContent.classList.add('page_content');
this.parent.appendChild(this.pageContent);

const uploadAvatarView = new UploadAvatarView(this.pageContent, user.id);
await uploadAvatarView.render();

const editUserView = new EditUserView(this.pageContent, user.id);
await editUserView.render();

if (userStore.storage.user.isAuthorized && player.isReady()) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
}
}
58 changes: 29 additions & 29 deletions src/pages/more-albums/ui/MoreAlbums.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@ import { AlbumListAPI } from '../../../widgets/albumList/index.js';
import { AlbumListView } from '../../../widgets/albumList/index.js';

export class MoreAlbumsPage {
/**
* Creates an instance of the View class.
*/
constructor(params) {
this.parent = document.querySelector('#root');
this.type = params['type']
this.entity = params['entity'];
this.entityId = params['id'];
}

async render() {
this.parent.innerHTML = '';

if (this.entity === 'artist') {
this.artistId = this.entityId;
}

if (this.type === 'favorite') {
this.favorite = this.type;
}
/**
* Creates an instance of the View class.
*/
constructor(params) {
this.parent = document.querySelector('#root');
this.type = params['type'];
this.entity = params['entity'];
this.entityId = params['id'];
}

async render() {
this.parent.innerHTML = '';

if (this.entity === 'artist') {
this.artistId = this.entityId;
}

if (this.type === 'favorite') {
this.favorite = this.type;
}

this.pageContent = document.createElement('div');
this.pageContent.classList.add('page_content');
this.parent.appendChild(this.pageContent);

const albumListAPI = new AlbumListAPI(this.artistId);
let albums = !this.favorite
? await albumListAPI.get()
: await albumListAPI.getFavorite();
const albumListAPI = new AlbumListAPI(this.artistId);
let albums = !this.favorite
? await albumListAPI.get()
: await albumListAPI.getFavorite();

const albumListView = new AlbumListView(this.pageContent, this.artistId);
await albumListView.render(albums, this.favorite);

if (userStore.storage.user.isAuthorized) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
if (userStore.storage.user.isAuthorized && player.isReady()) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
}
}
42 changes: 21 additions & 21 deletions src/pages/more-artists/ui/MoreArtists.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ import { ArtistListAPI } from '../../../widgets/artistList/index.js';
import { ArtistListView } from '../../../widgets/artistList/index.js';

export class MoreArtistsPage {
/**
* Creates an instance of the View class.
*/
constructor(params) {
this.parent = document.querySelector('#root');
this.type = params['type']
}
/**
* Creates an instance of the View class.
*/
constructor(params) {
this.parent = document.querySelector('#root');
this.type = params['type'];
}

async render() {
this.parent.innerHTML = '';
async render() {
this.parent.innerHTML = '';

if (this.type === 'favorite') {
this.favorite = this.type;
}
if (this.type === 'favorite') {
this.favorite = this.type;
}

this.pageContent = document.createElement('div');
this.pageContent.classList.add('page_content');
this.parent.appendChild(this.pageContent);

const artistListAPI = new ArtistListAPI();
let artists = !this.favorite
? await artistListAPI .get()
: await artistListAPI .getFavorite();
const artistListAPI = new ArtistListAPI();
let artists = !this.favorite
? await artistListAPI.get()
: await artistListAPI.getFavorite();

const artistListView = new ArtistListView(this.pageContent);
await artistListView.render(artists, this.favorite);

if (userStore.storage.user.isAuthorized) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
if (userStore.storage.user.isAuthorized && player.isReady()) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
}
}
40 changes: 20 additions & 20 deletions src/pages/more-playlists/ui/morePlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ import { PlaylistListAPI } from '../../../widgets/playlistList/index.js';
import { PlaylistListView } from '../../../widgets/playlistList/index.js';

export class MorePlaylistsPage {
/**
* Creates an instance of the View class.
*/
constructor(params) {
this.parent = document.querySelector('#root');
this.type = params['type']
}
/**
* Creates an instance of the View class.
*/
constructor(params) {
this.parent = document.querySelector('#root');
this.type = params['type'];
}

async render() {
this.parent.innerHTML = '';

if (this.type === 'favorite') {
this.favorite = this.type;
}
if (this.type === 'favorite') {
this.favorite = this.type;
}

this.pageContent = document.createElement('div');
this.pageContent.classList.add('page_content');
this.parent.appendChild(this.pageContent);

const playlistListAPI = new PlaylistListAPI();
let playlists = !this.favorite
? await playlistListAPI.get()
: await playlistListAPI.getFavorite();
const playlistListAPI = new PlaylistListAPI();
let playlists = !this.favorite
? await playlistListAPI.get()
: await playlistListAPI.getFavorite();

const playlistListView = new PlaylistListView(this.pageContent);
await playlistListView.render(playlists, false, this.favorite);

if (userStore.storage.user.isAuthorized) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
}
if (userStore.storage.user.isAuthorized && player.isReady()) {
eventBus.emit('showPlayer');
} else {
eventBus.emit('hidePlayer');
}
}
}
Loading

0 comments on commit a3e3743

Please sign in to comment.