MainFooter.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <footer class="footer">
  3. <div class="container">
  4. <div class="footer-content">
  5. <div id="footer-copyright">
  6. <p>© Copyright {{ siteSettings.sitename }} 2015 - 2021</p>
  7. </div>
  8. <router-link id="footer-logo" to="/">
  9. <img
  10. v-if="siteSettings.sitename === 'Musare'"
  11. :src="siteSettings.logo_blue"
  12. :alt="siteSettings.sitename || `Musare`"
  13. />
  14. <span v-else>{{ siteSettings.sitename }}</span>
  15. </router-link>
  16. <div id="footer-links">
  17. <a
  18. :href="siteSettings.github"
  19. target="_blank"
  20. title="GitHub Repository"
  21. >GitHub</a
  22. >
  23. <router-link title="About Musare" to="/about"
  24. >About</router-link
  25. >
  26. <router-link title="Musare Team" to="/team"
  27. >Team</router-link
  28. >
  29. <router-link title="News" to="/news">News</router-link>
  30. </div>
  31. <div id="footer-nightmode-toggle">
  32. <p class="is-expanded checkbox-control">
  33. <label class="switch">
  34. <input
  35. type="checkbox"
  36. id="instant-nightmode"
  37. v-model="localNightmode"
  38. />
  39. <span class="slider round"></span>
  40. </label>
  41. <label for="instant-nightmode">
  42. <p>Nightmode</p>
  43. </label>
  44. </p>
  45. </div>
  46. </div>
  47. </div>
  48. </footer>
  49. </template>
  50. <script>
  51. import Toast from "toasters";
  52. import { mapState, mapGetters, mapActions } from "vuex";
  53. export default {
  54. data() {
  55. return {
  56. siteSettings: {
  57. logo: "",
  58. sitename: "Musare",
  59. github: ""
  60. },
  61. localNightmode: null
  62. };
  63. },
  64. computed: {
  65. ...mapState({
  66. loggedIn: state => state.user.auth.loggedIn,
  67. nightmode: state => state.user.preferences.nightmode
  68. }),
  69. ...mapGetters({
  70. socket: "websockets/getSocket"
  71. })
  72. },
  73. watch: {
  74. localNightmode(newValue, oldValue) {
  75. if (oldValue === null) return;
  76. localStorage.setItem("nightmode", this.localNightmode);
  77. if (this.loggedIn) {
  78. this.socket.dispatch(
  79. "users.updatePreferences",
  80. { nightmode: this.localNightmode },
  81. res => {
  82. if (res.status !== "success") new Toast(res.message);
  83. }
  84. );
  85. }
  86. this.changeNightmode(this.localNightmode);
  87. },
  88. nightmode(nightmode) {
  89. if (this.localNightmode !== nightmode)
  90. this.localNightmode = nightmode;
  91. }
  92. },
  93. async mounted() {
  94. this.localNightmode = JSON.parse(localStorage.getItem("nightmode"));
  95. if (this.localNightmode === null) this.localNightmode = false;
  96. this.frontendDomain = await lofig.get("frontendDomain");
  97. this.siteSettings = await lofig.get("siteSettings");
  98. },
  99. methods: {
  100. ...mapActions("user/preferences", ["changeNightmode"])
  101. }
  102. };
  103. </script>
  104. <style lang="scss" scoped>
  105. .night-mode {
  106. footer.footer,
  107. footer.footer .container,
  108. footer.footer .container .footer-content {
  109. background-color: var(--dark-grey-3);
  110. }
  111. }
  112. .footer {
  113. position: relative;
  114. bottom: 0;
  115. flex-shrink: 0;
  116. padding: 20px;
  117. border-radius: 33% 33% 0% 0% / 7% 7% 0% 0%;
  118. box-shadow: 0 4px 8px 0 rgba(3, 169, 244, 0.4),
  119. 0 6px 20px 0 rgba(3, 169, 244, 0.2);
  120. background-color: var(--white);
  121. width: 100%;
  122. height: 200px;
  123. font-size: 16px;
  124. .container {
  125. position: relative;
  126. }
  127. .footer-content {
  128. display: flex;
  129. align-items: center;
  130. flex-direction: column;
  131. text-align: center;
  132. & > * {
  133. margin: 5px 0;
  134. }
  135. a:not(.button) {
  136. border: 0;
  137. }
  138. }
  139. @media (max-width: 650px) {
  140. border-radius: 0;
  141. }
  142. #footer-logo {
  143. display: block;
  144. margin-left: auto;
  145. margin-right: auto;
  146. width: 160px;
  147. order: 1;
  148. user-select: none;
  149. font-size: 2.5rem !important;
  150. line-height: 50px !important;
  151. font-family: Pacifico, cursive;
  152. color: var(--primary-color);
  153. white-space: nowrap;
  154. img {
  155. max-height: 38px;
  156. max-width: 100%;
  157. color: var(--primary-color);
  158. user-select: none;
  159. -webkit-user-drag: none;
  160. }
  161. }
  162. #footer-links {
  163. order: 3;
  164. :not(:last-child) {
  165. border-right: solid 1px var(--primary-color);
  166. }
  167. a {
  168. padding: 0 5px;
  169. color: var(--primary-color);
  170. &:first-of-type {
  171. padding: 0 5px 0 0;
  172. }
  173. &:last-of-type {
  174. padding: 0 0 0 5px;
  175. }
  176. &:hover {
  177. color: var(--primary-color);
  178. text-decoration: underline;
  179. }
  180. }
  181. }
  182. #footer-copyright {
  183. order: 4;
  184. }
  185. #footer-nightmode-toggle {
  186. order: 2;
  187. }
  188. }
  189. @media only screen and (min-width: 990px) {
  190. .footer {
  191. height: 140px;
  192. #footer-copyright {
  193. order: 3;
  194. left: 0;
  195. top: 0;
  196. position: absolute;
  197. line-height: 50px;
  198. }
  199. #footer-links {
  200. order: 2;
  201. right: 0;
  202. top: 0;
  203. position: absolute;
  204. line-height: 50px;
  205. }
  206. #footer-nightmode-toggle {
  207. order: 4;
  208. }
  209. }
  210. }
  211. </style>