working on adding social people and playlists in search, testing home page in dev mode

This commit is contained in:
booploops 2021-12-28 04:35:44 -08:00
parent df6ba93242
commit 3c17e15b08
8 changed files with 293 additions and 47 deletions

View file

@ -114,6 +114,7 @@ const app = new Vue({
hints: [], hints: [],
showHints: false, showHints: false,
results: {}, results: {},
resultsSocial: {},
limit: 10 limit: 10
}, },
playerLCD: { playerLCD: {
@ -2167,6 +2168,15 @@ const app = new Vue({
}).then(function (results) { }).then(function (results) {
self.search.results = results self.search.results = results
}) })
await this.mk.api.socialSearch(this.search.term, {
types: ["playlists", "social-profiles"],
limit: 25,
with: ["serverBubbles", "lyricSnippet"],
"art[url]": "f",
"art[social-profiles:url]": "c"
}, { includeResponseMeta: !0 }).then(function (results) {
self.search.resultsSocial = results
})
}, },
isInLibrary(playParams) { isInLibrary(playParams) {
let self = this let self = this

View file

@ -1539,6 +1539,26 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
height: 100%; height: 100%;
} }
.home-page {
background: linear-gradient(0deg, black, #4c2c31);
top: 0;
padding-top: var(--navbarHeight);
.user-icon {
border-radius: 100%;
width: 128px;
height: 128px;
overflow: hidden;
box-shadow: var(--mediaItemShadow-Shadow);
}
.well.profile-well {
flex-direction: column;
justify-content: center;
align-items: center;
}
}
/* Cider */ /* Cider */
.modal-fullscreen { .modal-fullscreen {
@ -1552,6 +1572,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
height: 100%; height: 100%;
background: rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.3);
z-index: 9999; z-index: 9999;
.modal-window { .modal-window {
background: #333; background: #333;
border-radius: 10px; border-radius: 10px;
@ -1581,15 +1602,15 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
width: 100%; width: 100%;
padding: 6px; padding: 6px;
} }
.modal-content { .modal-content {
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
overflow-y: overlay; overflow-y: overlay;
} }
.modal-footer {
} .modal-footer {}
} }
} }
@ -1608,6 +1629,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
.modal-title { .modal-title {
text-align: center; text-align: center;
} }
.close-btn { .close-btn {
width: 50px; width: 50px;
height: 100%; height: 100%;
@ -1659,9 +1681,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
margin-right: 6px; margin-right: 6px;
} }
.name { .name {}
}
&:hover { &:hover {
background: var(--selected); background: var(--selected);
@ -2180,6 +2200,20 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
image-rendering: -webkit-optimize-contrast; image-rendering: -webkit-optimize-contrast;
pointer-events: none;
}
&.no-shadow {
box-shadow: none;
&::after {
display: none;
}
}
&.subtle-shadow {
box-shadow: var(--mediaItemShadow-ShadowSubtle);
}
&.shadow {
box-shadow: var(--mediaItemShadow-Shadow);
} }
} }
@ -2755,6 +2789,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
} }
&:hover { &:hover {
>.play-btn, >.play-btn,
>.menu-btn { >.menu-btn {
opacity: 1; opacity: 1;
@ -2777,6 +2812,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
&.mediaitem-video { &.mediaitem-video {
height: 200px; height: 200px;
width: 240px; width: 240px;
.artwork { .artwork {
height: 120px; height: 120px;
width: 212px; width: 212px;
@ -2786,11 +2822,22 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
&.mediaitem-brick { &.mediaitem-brick {
height: 200px; height: 200px;
width: 240px; width: 240px;
.artwork { .artwork {
height: 123px; height: 123px;
width: 220px; width: 220px;
} }
} }
&.mediaitem-small {
width: 140px;
height: 180px;
.artwork {
height: 128px;
width: 128px;
}
}
} }
/* mediaitem-square */ /* mediaitem-square */
@ -2855,6 +2902,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
} }
&:hover { &:hover {
>.play-btn, >.play-btn,
>.menu-btn { >.menu-btn {
opacity: 1; opacity: 1;
@ -2877,6 +2925,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
&.mediaitem-video { &.mediaitem-video {
height: calc(var(--frame) / 220 * 200); height: calc(var(--frame) / 220 * 200);
width: calc(var(--frame) / 220 * 240); width: calc(var(--frame) / 220 * 240);
.artwork { .artwork {
height: calc(var(--frame) / 220 * 120); height: calc(var(--frame) / 220 * 120);
width: calc(var(--frame) / 220 * 212); width: calc(var(--frame) / 220 * 212);
@ -2886,6 +2935,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
&.mediaitem-brick { &.mediaitem-brick {
height: calc(var(--frame) / 220 * 200); height: calc(var(--frame) / 220 * 200);
width: calc(var(--frame) / 220 * 240); width: calc(var(--frame) / 220 * 240);
.artwork { .artwork {
height: calc(var(--frame) / 220 * 123); height: calc(var(--frame) / 220 * 123);
width: calc(var(--frame)); width: calc(var(--frame));
@ -2959,6 +3009,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
border-radius: 0px; border-radius: 0px;
box-shadow: unset; box-shadow: unset;
background: black; background: black;
.lyric-body { .lyric-body {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -2982,6 +3033,7 @@ input[type="range"].web-slider.display--small::-webkit-slider-thumb {
} }
} }
} }
// Modular // Modular
/* Transitions */ /* Transitions */

View file

@ -1,5 +1,5 @@
<script type="text/x-template" id="mediaitem-artwork"> <script type="text/x-template" id="mediaitem-artwork">
<div class="mediaitem-artwork" :class="{'rounded': (type == 'artists')}" :key="url" :style="getStyle()" <div class="mediaitem-artwork" :class="[{'rounded': (type == 'artists')}, classes]"
v-observe-visibility="{callback: visibilityChanged}"> v-observe-visibility="{callback: visibilityChanged}">
<img :src="app.getMediaItemArtwork(url, size, width)" <img :src="app.getMediaItemArtwork(url, size, width)"
decoding="async" loading="lazy" decoding="async" loading="lazy"
@ -40,7 +40,7 @@
}, },
shadow: { shadow: {
type: String, type: String,
default: 'none' default: ''
} }
}, },
data: function () { data: function () {
@ -49,8 +49,12 @@
isVisible: false, isVisible: false,
style: { style: {
"box-shadow": "" "box-shadow": ""
},
classes: []
} }
} },
mounted() {
this.getClasses()
}, },
methods: { methods: {
getVideoPriority() { getVideoPriority() {
@ -63,18 +67,21 @@
} }
return this.videoPriority return this.videoPriority
}, },
getStyle() { getClasses() {
switch (this.shadow) { switch (this.shadow) {
case "none":
this.classes.push("no-shadow")
break;
case "large": case "large":
this.style["box-shadow"] = "var(--mediaItemShadow-Shadow)" this.classes.push("shadow")
break; break;
case "subtle": case "subtle":
this.style["box-shadow"] = "var(--mediaItemShadow-ShadowSubtle)" this.classes.push("subtle-shadow")
break; break;
default: default:
break; break;
} }
return this.style; return this.classes;
}, },
getArtworkStyle() { getArtworkStyle() {
return { return {

View file

@ -107,6 +107,9 @@
case "385": // editorial case "385": // editorial
return ["mediaitem-brick"] return ["mediaitem-brick"]
break; break;
case "small":
return ["mediaitem-small"]
break;
case "music-videos": case "music-videos":
case "uploadedVideo": case "uploadedVideo":
case "uploaded-videos": case "uploaded-videos":

View file

@ -168,6 +168,7 @@
<div class="app-sidebar-header-text"> <div class="app-sidebar-header-text">
Apple Music Apple Music
</div> </div>
<sidebar-library-item v-if="isDev" name="Home" page="home"></sidebar-library-item>
<sidebar-library-item name="Listen Now" page="listen_now"></sidebar-library-item> <sidebar-library-item name="Listen Now" page="listen_now"></sidebar-library-item>
<sidebar-library-item name="Browse" page="browse"></sidebar-library-item> <sidebar-library-item name="Browse" page="browse"></sidebar-library-item>
<sidebar-library-item name="Radio" page="radio"></sidebar-library-item> <sidebar-library-item name="Radio" page="radio"></sidebar-library-item>
@ -295,6 +296,12 @@
:title="collectionList.title"></cider-collection-list> :title="collectionList.title"></cider-collection-list>
</template> </template>
</transition> </transition>
<!-- Home -->
<transition name="wpfade">
<template v-if="page == 'home'">
<cider-home></cider-home>
</template>
</transition>
<!-- Playlist / Album page--> <!-- Playlist / Album page-->
<transition name="wpfade"> <transition name="wpfade">
<template v-if="page.includes('playlist_')"> <template v-if="page.includes('playlist_')">
@ -502,6 +509,9 @@
<!-- Listen Now --> <!-- Listen Now -->
<%- include('pages/listen_now') %> <%- include('pages/listen_now') %>
<!-- Home -->
<%- include('pages/home') %>
<!-- Playlists / Albums --> <!-- Playlists / Albums -->
<%- include('pages/cider-playlist') %> <%- include('pages/cider-playlist') %>

View file

@ -46,7 +46,8 @@
triggerEnabled: true, triggerEnabled: true,
canSeeTrigger: false, canSeeTrigger: false,
showFab: false, showFab: false,
commonKind: "song" commonKind: "song",
api: this.$root.mk.api
} }
}, },
methods: { methods: {
@ -72,12 +73,18 @@
case "artists": case "artists":
if (this.data.next && this.triggerEnabled) { if (this.data.next && this.triggerEnabled) {
this.triggerEnabled = false; this.triggerEnabled = false;
this.data.next().then(data => {
let nextFn = (data => {
console.log(data); console.log(data);
this.data.next = data.next; this.data.next = data.next;
this.data.data = this.data.data.concat(data.data); this.data.data = this.data.data.concat(data.data);
this.triggerEnabled = true; this.triggerEnabled = true;
}); });
if(typeof this.data.next == "function") {
this.data.next().then(data => next);
}else{
this.api.v3.music(this.data.next).then(data => nextFn);
}
}else{ }else{
console.log("No next page"); console.log("No next page");
this.triggerEnabled = false; this.triggerEnabled = false;

View file

@ -0,0 +1,124 @@
<script type="text/x-template" id="cider-home">
<div class="content-inner home-page">
<div class="row">
<div class="col">
<h3>Home</h3>
<div class="well profile-well">
<div class="user-icon">
<mediaitem-artwork shadow="none" :url="profile.attributes.artwork.url" size="300"></mediaitem-artwork>
</div>
<h3>{{ profile.attributes.name }}</h3>
<h4>@{{ profile.attributes.handle }}</h4>
<button class="md-btn">Share</button>
</div>
</div>
<div class="col">
<h3>Recently Played</h3>
<div class="well">
<mediaitem-list-item v-for="item in recentlyPlayed.limit(6)" :item="item"></mediaitem-list-item>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h3>Made For You</h3>
<div class="well">
<mediaitem-square kind="small" v-for="item in madeForYou" :item="item"></mediaitem-square>
</div>
</div>
<div class="col">
<h3>Your Artist Feed</h3>
<div class="well">
<mediaitem-list-item v-for="item in recentlyPlayed.limit(6)" :item="item"></mediaitem-list-item>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h3>Friends Listening To</h3>
<div class="well">
<mediaitem-square kind="small" v-for="item in friendsListeningTo" :item="item"></mediaitem-square>
</div>
</div>
</div>
</div>
</script>
<script>
Vue.component('cider-home', {
template: '#cider-home',
data: function () {
return {
app: this.$root,
madeForYou: [],
recentlyPlayed: [],
friendsListeningTo: [],
profile: {},
modify: 0
}
},
async mounted() {
let self = this
this.getListenNowData()
},
methods: {
getRecentlyPlayed() {
},
async getListenNowData() {
let self = this
this.app.mk.api.personalRecommendations("",
{
name: "listen-now",
with: "friendsMix,library,social",
"art[social-profiles:url]": "c",
"art[url]": "c,f",
"omit[resource]": "autos",
"relate[editorial-items]": "contents",
extend: ["editorialCard", "editorialVideo"],
"extend[albums]": ["artistUrl"],
"extend[library-albums]": ["artistUrl", "editorialVideo"],
"extend[playlists]": ["artistNames", "editorialArtwork", "editorialVideo"],
"extend[library-playlists]": ["artistNames", "editorialArtwork", "editorialVideo"],
"extend[social-profiles]": "topGenreNames",
"include[albums]": "artists",
"include[songs]": "artists",
"include[music-videos]": "artists",
"fields[albums]": ["artistName", "artistUrl", "artwork", "contentRating", "editorialArtwork", "editorialVideo", "name", "playParams", "releaseDate", "url"],
"fields[artists]": ["name", "url"],
"extend[stations]": ["airDate", "supportsAirTimeUpdates"],
"meta[stations]": "inflectionPoints",
types: "artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells",
platform: "web"
},
{
includeResponseMeta: !0,
reload: !0
}
).then((data) => {
console.log(data.data[1])
self.recentlyPlayed = data.data[1].relationships.contents.data
self.friendsListeningTo = data.data.filter(section => {
if (section.meta.metrics.moduleType == "11") {
return section
}
;
})[0].relationships.contents.data
self.madeForYou = data.data.filter(section => {
if (section.meta.metrics.moduleType == "6") {
return section
}
;
})[0].relationships.contents.data
});
app.mk.api.v3.music("/v1/me/social/profile/").then((response) => {
self.profile = response.data.data[0]
console.log("!!!")
console.log(response.data.data[0])
})
}
}
});
</script>

View file

@ -12,7 +12,9 @@
<div class="col"> <div class="col">
<h3>Songs</h3> <h3>Songs</h3>
</div> </div>
<div class="col-auto flex-center" @click="app.showSearchView(app.search.term, 'song', app.friendlyTypes('song'))" v-if="search.results.song.data.length >= 6"> <div class="col-auto flex-center"
@click="app.showSearchView(app.search.term, 'song', app.friendlyTypes('song'))"
v-if="search.results.song.data.length >= 6">
<button class="cd-btn-seeall">See All</button> <button class="cd-btn-seeall">See All</button>
</div> </div>
</div> </div>
@ -31,7 +33,10 @@
<h3>{{ app.friendlyTypes(section) }}</h3> <h3>{{ app.friendlyTypes(section) }}</h3>
</div> </div>
<div class="col-auto flex-center" v-if="search.results[section].data.length >= 10"> <div class="col-auto flex-center" v-if="search.results[section].data.length >= 10">
<button class="cd-btn-seeall" @click="app.showSearchView(app.search.term, section, app.friendlyTypes(section))">See All</button> <button class="cd-btn-seeall"
@click="app.showSearchView(app.search.term, section, app.friendlyTypes(section))">See
All
</button>
</div> </div>
</div> </div>
<template v-if="!app.friendlyTypes(section).includes('Video')"> <template v-if="!app.friendlyTypes(section).includes('Video')">
@ -44,6 +49,34 @@
</template> </template>
</template> </template>
</template> </template>
<template v-if="search.resultsSocial.playlist">
<div class="row">
<div class="col">
<h3>Shared Playlists</h3>
</div>
<div class="col-auto flex-center" v-if="search.resultsSocial.playlist.data.data.length >= 10">
<button class="cd-btn-seeall"
@click="app.showCollection(search.resultsSocial.playlist.data, 'Shared Playlists', 'default')">See All
</button>
</div>
</div>
<mediaitem-scroller-horizontal-large
:items="search.resultsSocial.playlist.data.data.limit(10)"></mediaitem-scroller-horizontal-large>
</template>
<template v-if="search.resultsSocial.profile">
<div class="row">
<div class="col">
<h3>People</h3>
</div>
<div class="col-auto flex-center" v-if="search.resultsSocial.profile.data.data.length >= 10">
<button class="cd-btn-seeall"
@click="app.showCollection(search.resultsSocial.profile.data, 'People', 'default')">See All
</button>
</div>
</div>
<mediaitem-scroller-horizontal-large
:items="search.resultsSocial.profile.data.data.limit(10)"></mediaitem-scroller-horizontal-large>
</template>
</div> </div>
</script> </script>