123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
- <div class="playlist-item universal-item">
- <slot name="item-icon">
- <span></span>
- </slot>
- <div class="item-title-description">
- <p class="item-title">
- {{ playlist.displayName }}
- <i
- v-if="playlist.privacy === 'private'"
- class="private-playlist-icon material-icons"
- content="This playlist is not visible to other users."
- v-tippy="{ theme: 'info' }"
- >lock</i
- >
- </p>
- <p class="item-description">
- <span v-if="showOwner"
- ><a v-if="playlist.createdBy === 'Musare'" title="Musare"
- >Musare</a
- ><user-id-to-username
- v-else
- :user-id="playlist.createdBy"
- :link="true"
- />
- •</span
- >
- <span :title="playlistLength">
- {{ playlistLength }}
- </span>
- </p>
- </div>
- <div class="universal-item-actions">
- <slot name="actions" />
- </div>
- </div>
- </template>
- <script>
- import UserIdToUsername from "@/components/UserIdToUsername.vue";
- import utils from "../../js/utils";
- export default {
- components: { UserIdToUsername },
- props: {
- playlist: { type: Object, default: () => {} },
- showOwner: { type: Boolean, default: false }
- },
- data() {
- return {
- utils
- };
- },
- computed: {
- playlistLength() {
- return `${this.totalLength(this.playlist)} • ${
- this.playlist.songs.length
- } ${this.playlist.songs.length === 1 ? "song" : "songs"}`;
- }
- },
- methods: {
- totalLength(playlist) {
- let length = 0;
- playlist.songs.forEach(song => {
- length += song.duration;
- });
- return this.utils.formatTimeLong(length);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .night-mode {
- .playlist-item {
- background-color: var(--dark-grey-2) !important;
- border: 0 !important;
- p {
- color: var(--light-grey-2) !important;
- }
- }
- }
- .playlist-item {
- width: 100%;
- height: 72px;
- column-gap: 7.5px;
- .item-title-description {
- flex: 1;
- overflow: hidden;
- .item-title {
- color: var(--dark-grey-2);
- font-size: 20px;
- line-height: 23px;
- margin-bottom: 0;
- display: flex;
- align-items: center;
- .private-playlist-icon {
- color: var(--dark-pink);
- font-size: 18px;
- margin-left: 5px;
- }
- }
- }
- .universal-item-actions {
- margin-left: none;
- div {
- display: flex;
- align-items: center;
- line-height: 1;
- button,
- .button {
- width: 100%;
- font-size: 17px;
- height: 36px;
- }
- }
- }
- }
- </style>
|