Home.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. methods: {
  95. toggleModal: function (type) {
  96. this.$dispatch('toggleModal', type);
  97. }
  98. },
  99. components: { MainHeader, MainFooter }
  100. }
  101. </script>
  102. <style lang="scss">
  103. @import 'theme.scss';
  104. * { box-sizing: border-box; }
  105. html {
  106. width: 100%;
  107. height: 100%;
  108. color: rgba(0, 0, 0, 0.87);
  109. body {
  110. width: 100%;
  111. height: 100%;
  112. margin: 0;
  113. padding: 0;
  114. }
  115. }
  116. @media only screen and (min-width: 1200px) {
  117. html {
  118. font-size: 15px;
  119. }
  120. }
  121. @media only screen and (min-width: 992px) {
  122. html {
  123. font-size: 14.5px;
  124. }
  125. }
  126. @media only screen and (min-width: 0) {
  127. html {
  128. font-size: 14px;
  129. }
  130. }
  131. .ccs-button {
  132. cursor: pointer;
  133. transition: .25s ease color;
  134. font-size: 30px;
  135. }
  136. .ccs-button:hover {
  137. color: #03a9f4;
  138. }
  139. .station-blue {
  140. outline: 5px solid #03a9f4;
  141. }
  142. .station-red {
  143. outline: 5px solid #f45703;
  144. }
  145. .label {
  146. display: flex;
  147. }
  148. .g-recaptcha {
  149. display: flex;
  150. justify-content: center;
  151. margin-top: 20px;
  152. }
  153. .group {
  154. width: 100%;
  155. height: 448px;
  156. margin: 64px 0 0 0;
  157. .group-title {
  158. float: left;
  159. clear: none;
  160. width: 100%;
  161. height: 64px;
  162. line-height: 48px;
  163. text-align: center;
  164. font-size: 48px;
  165. }
  166. .group-stations {
  167. white-space: nowrap;
  168. text-align: center;
  169. overflow: hidden;
  170. float: left;
  171. clear: none;
  172. width: 100%;
  173. height: 400px;
  174. .stations-station {
  175. position: relative;
  176. top: 16px;
  177. display: inline-block;
  178. clear: none;
  179. width: 256px;
  180. height: 370px;
  181. margin: 0 16px 0 16px;
  182. box-shadow: 0 1px 6px 2px rgba(0, 0, 0, 0.25);
  183. cursor: pointer;
  184. .station-info {
  185. display: flex;
  186. flex-direction: row;
  187. align-items: center;
  188. }
  189. .station-image {
  190. width: 100%;
  191. height: 256px;
  192. object-fit: cover;
  193. }
  194. .station-grid-left {
  195. display: flex;
  196. flex-direction: column;
  197. width: 75%;
  198. text-align: left;
  199. padding-left: 10px;
  200. h3 {
  201. color: $blue;
  202. margin: 0;
  203. white-space: normal;
  204. padding-top: 10px;
  205. }
  206. p {
  207. margin: 0;
  208. white-space: normal;
  209. padding-top: 10px;
  210. }
  211. }
  212. .station-grid-right {
  213. display: flex;
  214. flex-direction: column;
  215. width: 25%;
  216. i {
  217. color: $blue;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. </style>