소스 검색

feat(Home): Station can request indicator

Owen Diffey 2 년 전
부모
커밋
53f20a61e3
1개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. 27 0
      frontend/src/pages/Home.vue

+ 27 - 0
frontend/src/pages/Home.vue

@@ -233,6 +233,14 @@
 								<span v-else class="songTitle"
 									>No Songs Playing</span
 								>
+								<i
+									v-if="canRequest(element)"
+									class="material-icons"
+									content="You can request songs in this station"
+									v-tippy="{ theme: 'info' }"
+								>
+									queue
+								</i>
 							</div>
 						</router-link>
 					</template>
@@ -447,6 +455,14 @@
 							}}</span
 						>
 						<span v-else class="songTitle">No Songs Playing</span>
+						<i
+							v-if="canRequest(station)"
+							class="material-icons"
+							content="You can request songs in this station"
+							v-tippy="{ theme: 'info' }"
+						>
+							queue
+						</i>
 					</div>
 				</router-link>
 				<h4 v-if="stations.length === 0">
@@ -755,6 +771,17 @@ export default {
 		isOwnerOrAdmin(station) {
 			return this.isOwner(station) || this.isAdmin();
 		},
+		canRequest(station) {
+			return (
+				station &&
+				this.loggedIn &&
+				station.requests &&
+				station.requests.enabled &&
+				(station.requests.access === "user" ||
+					(station.requests.access === "owner" &&
+						this.isOwnerOrAdmin(station)))
+			);
+		},
 		isPlaying(station) {
 			return typeof station.currentSong.title !== "undefined";
 		},