123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <template>
- <div class="universal-item queue-item">
- <add-to-playlist-dropdown v-if="showPlaylistDropdown" :song="song" />
- <div id="thumbnail-and-info">
- <img
- class="item-thumbnail"
- :src="song.ytThumbnail ? song.ytThumbnail : song.thumbnail"
- onerror="this.src='/assets/notes-transparent.png'"
- />
- <div id="song-info">
- <h4
- class="item-title"
- :style="
- song.artists.length < 1 ? { fontSize: '16px' } : null
- "
- :title="song.title"
- >
- {{ song.title }}
- </h4>
- <h5
- class="item-description"
- v-if="song.artists"
- :title="song.artists.join(', ')"
- >
- {{ song.artists.join(", ") }}
- </h5>
- <p
- id="song-request-time"
- v-if="
- station.type === 'community' &&
- station.partyMode === true
- "
- >
- Requested by
- <strong>
- <user-id-to-username
- :user-id="song.requestedBy"
- :link="true"
- />
- {{
- formatDistance(
- parseISO(song.requestedAt),
- new Date(),
- {
- addSuffix: true
- }
- )
- }}
- </strong>
- </p>
- </div>
- </div>
- <div id="duration-and-actions">
- <p id="song-duration">
- {{ utils.formatTime(song.duration) }}
- </p>
- <div class="universal-item-actions">
- <i
- v-if="
- $parent.loggedIn &&
- !song.simpleSong &&
- song.likes !== -1 &&
- song.dislikes !== -1
- "
- class="material-icons report-icon"
- @click="reportQueueSong(song)"
- >
- flag
- </i>
- <i
- class="material-icons"
- @click="showPlaylistDropdown = !showPlaylistDropdown"
- >queue</i
- >
- <i
- v-if="
- $parent.isAdminOnly() &&
- !song.simpleSong &&
- song.likes !== -1 &&
- song.dislikes !== -1
- "
- class="material-icons edit-icon"
- @click="$parent.$parent.$parent.editSong(song)"
- >
- edit
- </i>
- <i
- v-if="
- station.type === 'community' &&
- ($parent.isOwnerOnly() || $parent.isAdminOnly())
- "
- class="material-icons delete-icon"
- @click="$parent.removeFromQueue(song.songId)"
- >delete_forever</i
- >
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapActions } from "vuex";
- import { formatDistance, parseISO } from "date-fns";
- import AddToPlaylistDropdown from "../../../../../components/ui/AddToPlaylistDropdown.vue";
- import UserIdToUsername from "../../../../../components/common/UserIdToUsername.vue";
- import utils from "../../../../../../js/utils";
- export default {
- components: { UserIdToUsername, AddToPlaylistDropdown },
- props: {
- song: {
- type: Object,
- default: () => {}
- },
- station: {
- type: Object,
- default: () => {
- return { type: "community", partyMode: false };
- }
- }
- },
- data() {
- return {
- utils,
- showPlaylistDropdown: false
- };
- },
- methods: {
- reportQueueSong(song) {
- this.updateReportQueueSong(song);
- this.openModal({ sector: "station", modal: "report" });
- },
- ...mapActions("station", ["updateReportQueueSong"]),
- ...mapActions("modalVisibility", ["openModal"]),
- formatDistance,
- parseISO
- }
- };
- </script>
- <style lang="scss" scoped>
- .night-mode {
- .queue-item {
- background-color: var(--dark-grey-2) !important;
- border: 0 !important;
- }
- }
- /deep/ #nav-dropdown {
- margin-top: 36px;
- /deep/ .nav-dropdown-items {
- position: absolute;
- right: 0;
- }
- }
- .queue-item {
- #thumbnail-and-info,
- #duration-and-actions {
- display: flex;
- align-items: center;
- }
- #duration-and-actions {
- margin-left: 5px;
- .universal-item-actions div i {
- margin-left: 5px;
- }
- }
- #thumbnail-and-info {
- width: calc(100% - 120px);
- }
- #song-info {
- display: flex;
- flex-direction: column;
- justify-content: center;
- margin-left: 20px;
- width: calc(100% - 65px);
- *:not(i) {
- margin: 0;
- font-family: Karla, Arial, sans-serif;
- }
- #song-request-time {
- font-size: 12px;
- margin-top: 7px;
- }
- }
- #song-duration {
- font-size: 20px;
- }
- .edit-icon {
- color: var(--primary-color);
- }
- }
- </style>
|