Home.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div class="app">
  3. <main-header></main-header>
  4. <div class="group">
  5. <div class="group-title">Official Stations</div>
  6. <div class="group-stations">
  7. <div class="stations-station" v-for="station in stations.official" v-link="{ path: '/official/' + station._id }" @click="this.$dispatch('joinStation', station._id)" v-bind:class="station.class">
  8. <img class="station-image" :src="station.currentSong.thumbnail" onerror="this.src='/assets/notes.png'" />
  9. <div class="station-info">
  10. <div class="station-grid-left">
  11. <h3>{{ station.displayName }}</h3>
  12. <p>{{ station.description }}</p>
  13. </div>
  14. <div class="station-grid-right">
  15. <div>{{ station.userCount }}&nbsp;&nbsp;<i class="material-icons">perm_identity</i></div>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="group">
  22. <div class="group-title">Community Stations <i class="material-icons ccs-button" @click="toggleModal('ccs')" v-if="$parent.loggedIn">add</i></div>
  23. <div class="group-stations">
  24. <div class="stations-station" v-for="station in stations.community" v-link="{ path: '/community/' + station._id }" @click="this.$dispatch('joinStation', station._id)" v-bind:class="station.class">
  25. <img class="station-image" :src="station.currentSong.thumbnail" onerror="this.src='/assets/notes.png'" />
  26. <div class="station-info">
  27. <div class="station-grid-left">
  28. <h3>{{ station.displayName }}</h3>
  29. <p>{{ station.description }}</p>
  30. </div>
  31. <div class="station-grid-right">
  32. <div>{{ station.userCount }}&nbsp;&nbsp;<i class="material-icons">perm_identity</i></div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <main-footer></main-footer>
  39. </div>
  40. </template>
  41. <script>
  42. import MainHeader from '../MainHeader.vue';
  43. import MainFooter from '../MainFooter.vue';
  44. import auth from '../../auth';
  45. export default {
  46. data() {
  47. return {
  48. isRegisterActive: false,
  49. isLoginActive: false,
  50. recaptcha: {
  51. key: ''
  52. },
  53. stations: {
  54. official: [],
  55. community: []
  56. }
  57. }
  58. },
  59. ready() {
  60. let _this = this;
  61. auth.getStatus((authenticated, role, username, userId) => {
  62. _this.socket = _this.$parent.socket;
  63. _this.socket.emit("stations.index", data => {
  64. if (data.status === "success") data.stations.forEach(station => {
  65. if (!station.currentSong) station.currentSong = { thumbnail: '/assets/notes.png' };
  66. console.log(station.privacy);
  67. if (station.privacy !== 'public') {
  68. console.log(123);
  69. station.class = {'station-red': true}
  70. } else if (station.type === 'community') {
  71. if (station.owner === userId) {
  72. station.class = {'station-blue': true}
  73. }
  74. }
  75. if (station.type == 'official') _this.stations.official.push(station);
  76. else _this.stations.community.push(station);
  77. });
  78. });
  79. _this.socket.emit("apis.joinRoom", 'home', () => {
  80. _this.socket.on('event:stations.created', station => {
  81. console.log("CREATED!!!", station);
  82. if (!station.currentSong) station.currentSong = {thumbnail: '/assets/notes.png'};
  83. if (station.privacy !== 'public') {
  84. station.class = {'station-red': true}
  85. } else if (station.type === 'community') {
  86. if (station.owner === userId) {
  87. station.class = {'station-blue': true}
  88. }
  89. }
  90. _this.stations[station.type].push(station);
  91. });
  92. });
  93. });
  94. },
  95. methods: {
  96. toggleModal: function (type) {
  97. this.$dispatch('toggleModal', type);
  98. }
  99. },
  100. components: { MainHeader, MainFooter }
  101. }
  102. </script>
  103. <style lang="scss">
  104. @import 'theme.scss';
  105. * { box-sizing: border-box; }
  106. html {
  107. width: 100%;
  108. height: 100%;
  109. color: rgba(0, 0, 0, 0.87);
  110. body {
  111. width: 100%;
  112. height: 100%;
  113. margin: 0;
  114. padding: 0;
  115. }
  116. }
  117. @media only screen and (min-width: 1200px) {
  118. html {
  119. font-size: 15px;
  120. }
  121. }
  122. @media only screen and (min-width: 992px) {
  123. html {
  124. font-size: 14.5px;
  125. }
  126. }
  127. @media only screen and (min-width: 0) {
  128. html {
  129. font-size: 14px;
  130. }
  131. }
  132. .ccs-button {
  133. cursor: pointer;
  134. transition: .25s ease color;
  135. font-size: 30px;
  136. }
  137. .ccs-button:hover {
  138. color: #03a9f4;
  139. }
  140. .station-blue {
  141. outline: 5px solid #03a9f4;
  142. }
  143. .station-red {
  144. outline: 5px solid #f45703;
  145. }
  146. .label {
  147. display: flex;
  148. }
  149. .g-recaptcha {
  150. display: flex;
  151. justify-content: center;
  152. margin-top: 20px;
  153. }
  154. .group {
  155. width: 100%;
  156. height: 448px;
  157. margin: 64px 0 0 0;
  158. .group-title {
  159. float: left;
  160. clear: none;
  161. width: 100%;
  162. height: 64px;
  163. line-height: 48px;
  164. text-align: center;
  165. font-size: 48px;
  166. }
  167. .group-stations {
  168. white-space: nowrap;
  169. text-align: center;
  170. overflow: hidden;
  171. float: left;
  172. clear: none;
  173. width: 100%;
  174. height: 400px;
  175. .stations-station {
  176. position: relative;
  177. top: 16px;
  178. display: inline-block;
  179. clear: none;
  180. width: 256px;
  181. height: 370px;
  182. margin: 0 16px 0 16px;
  183. box-shadow: 0 1px 6px 2px rgba(0, 0, 0, 0.25);
  184. cursor: pointer;
  185. .station-info {
  186. display: flex;
  187. flex-direction: row;
  188. align-items: center;
  189. }
  190. .station-image {
  191. width: 100%;
  192. height: 256px;
  193. object-fit: cover;
  194. }
  195. .station-grid-left {
  196. display: flex;
  197. flex-direction: column;
  198. width: 75%;
  199. text-align: left;
  200. padding-left: 10px;
  201. h3 {
  202. color: $blue;
  203. margin: 0;
  204. white-space: normal;
  205. padding-top: 10px;
  206. }
  207. p {
  208. margin: 0;
  209. white-space: normal;
  210. padding-top: 10px;
  211. }
  212. }
  213. .station-grid-right {
  214. display: flex;
  215. flex-direction: column;
  216. width: 25%;
  217. i {
  218. color: $blue;
  219. }
  220. }
  221. }
  222. }
  223. }
  224. </style>