From 5066a148587ac5f5d6aa2bcafaaed8ac21545d9b Mon Sep 17 00:00:00 2001 From: An Phan Date: Sun, 14 Feb 2016 15:18:40 +0800 Subject: [PATCH] Revamp dashboard, fix #231 --- .../main-wrapper/main-content/home.vue | 228 +++++++++++++++--- .../assets/js/components/shared/song-item.vue | 53 +--- .../assets/js/components/shared/song-list.vue | 3 +- resources/assets/js/stores/song.js | 1 - 4 files changed, 204 insertions(+), 81 deletions(-) diff --git a/resources/assets/js/components/main-wrapper/main-content/home.vue b/resources/assets/js/components/main-wrapper/main-content/home.vue index 4b2a73db..a787eec5 100644 --- a/resources/assets/js/components/main-wrapper/main-content/home.vue +++ b/resources/assets/js/components/main-wrapper/main-content/home.vue @@ -5,22 +5,59 @@
-
-

Recently Played

+
+
+

Most Played Songs

- - -

No songs played yet. What ya waiting for?

-
+
    +
  1. + + + + + + + + + {{ song.title }} + {{ song.album.artist.name }} – + {{ song.playCount }} {{ song.playCount | pluralize 'play' }} + +
  2. +
+
-
-

Most Played Songs

+
+

Recently Played

- -
+
    +
  1. + + + + + + + + {{ song.title }} + {{ song.album.artist.name }} + +
  2. +
+ +

+ Your most-recent songs in this session will be displayed here.
+ Start listening! +

+
+

Top Artists

@@ -45,27 +82,22 @@ @@ -119,14 +183,112 @@ @import "resources/assets/sass/partials/_mixins.scss"; #homeWrapper { - button.play-shuffle, button.del { - i { - margin-right: 0 !important; - } - } + .top-sections { + display: flex; - .song-list-wrap { - padding: 0 !important; + > section { + flex-grow: 1; + flex-basis: 0; + + &:first-of-type { + margin-right: 8px; + } + } + + ol li { + display: flex; + + &.playing { + color: $colorHighlight; + } + + &:hover .cover { + .control { + display: block; + } + + &::before { + opacity: .7; + } + } + + .cover { + flex: 0 0 48px; + height: 48px; + background-size: cover; + position: relative; + + @include vertical-center(); + + &::before { + content: " "; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; + background: #000; + opacity: 0; + + html.touchevents & { + opacity: .7; + } + } + + .control { + border-radius: 50%; + width: 28px; + height: 28px; + background: rgba(0, 0, 0, .7); + border: 1px solid transparent; + line-height: 28px; + font-size: 13px; + text-align: center; + z-index: 1; + display: none; + color: #fff; + transition: .3s; + + &:hover { + transform: scale(1.2); + border-color: #fff; + } + + html.touchevents & { + display: block; + } + } + } + + .details { + flex: 1; + padding: 4px 8px; + position: relative; + display: flex; + flex-direction: column; + justify-content: center; + + .play-count { + background: rgba(255, 255, 255, 0.08); + position: absolute; + height: 100%; + top: 0; + left: 0; + pointer-events: none; + } + + .by { + display: block; + font-size: 90%; + opacity: .6; + margin-top: 2px; + } + } + + //border-bottom: 1px solid $color2ndBgr; + margin-bottom: 8px; + } } .none { @@ -153,5 +315,17 @@ font-weight: $fontWeight_UltraThin; } } + + @media only screen and (max-device-width: 768px) { + .top-sections { + display: block; + + > section { + &:first-of-type { + margin-right: 0; + } + } + } + } } diff --git a/resources/assets/js/components/shared/song-item.vue b/resources/assets/js/components/shared/song-item.vue index 0d490cd8..05c8f4e3 100644 --- a/resources/assets/js/components/shared/song-item.vue +++ b/resources/assets/js/components/shared/song-item.vue @@ -4,14 +4,7 @@ class="song-item" :class="{ selected: selected, playing: song.playbackState === 'playing' || song.playbackState === 'paused' }" > - - {{ song.title }} - - {{ song.title }} - + {{ song.title }} {{ song.album.artist.name }} {{ song.album.name }} {{ song.fmtLength }} @@ -27,23 +20,7 @@ import queueStore from '../../stores/queue'; export default { - props: [ - 'song', - - /** - * Whether or not we should display the play count indicators. - * - * @type {boolean} - */ - 'showPlayCount', - - /** - * The play count of the most-played song, so that we can have some percentage-base comparison. - * - * @type {integer} - */ - 'topPlayCount' - ], + props: ['song'], data() { return { @@ -121,17 +98,6 @@ .title { min-width: 192px; - padding: 0; - - span { - display: inline-block; - padding: 8px; - - &.play-count { - background: rgba(255, 255, 255, 0.08); - white-space: nowrap; - } - } } .play { @@ -150,20 +116,5 @@ &.playing { color: $colorHighlight; } - - @media only screen and (max-device-width : 768px) { - .title { - padding: 0; - - span { - display: inline; - padding: 0; - - &.play-count { - background: none; - } - } - } - } } diff --git a/resources/assets/js/components/shared/song-list.vue b/resources/assets/js/components/shared/song-list.vue index 618a89ac..e6705d02 100644 --- a/resources/assets/js/components/shared/song-list.vue +++ b/resources/assets/js/components/shared/song-list.vue @@ -514,8 +514,7 @@ } - @media only screen - and (max-device-width : 768px) { + @media only screen and (max-device-width: 768px) { table, tbody, tr { display: block; } diff --git a/resources/assets/js/stores/song.js b/resources/assets/js/stores/song.js index e71c0170..657fc5d7 100644 --- a/resources/assets/js/stores/song.js +++ b/resources/assets/js/stores/song.js @@ -244,7 +244,6 @@ export default { * @return {Array.} */ getRecent(n = 10) { - // And last, make sure the list doesn't exceed 10 items. return _.take(this.state.recent, n); },