default.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <v-app dark>
  3. <!-- height = 4rem, margin-y = 1rem -->
  4. <v-app-bar
  5. app
  6. class="topBar glass elevation-0 fly-in-from-top my-4 mx-auto"
  7. >
  8. <!-- Translator desktop -->
  9. <v-tabs centered center-active color="primary" router show-arrows>
  10. <v-tab v-for="link in links" :key="link.path" :to="link.path">
  11. {{ link.name }}
  12. </v-tab>
  13. </v-tabs>
  14. </v-app-bar>
  15. <!-- abstract background -->
  16. <v-img
  17. src="/ui/abstract.svg"
  18. style="position: fixed; left: 0; right: 0; width: 100vw; height: 100vh"
  19. />
  20. <v-main style="padding-top: 4rem !important">
  21. <!-- min-height helps keep content centered, use .debug to to see it -->
  22. <center
  23. class="py-8 mx-auto d-flex flex-column justify-center items-center"
  24. style="width: 90vw; min-height: calc(100vh - 8rem)"
  25. >
  26. <nuxt />
  27. </center>
  28. </v-main>
  29. <!-- Translator mobile -->
  30. <v-menu
  31. top
  32. left
  33. offset-y
  34. rounded="lg"
  35. nudge-top="16"
  36. class="d-flex flex-column"
  37. transition="slide-y-reverse-transition"
  38. >
  39. <template v-slot:activator="{ on, attrs }">
  40. <v-btn
  41. text
  42. fab
  43. class="glass"
  44. style="
  45. border-radius: 1rem !important;
  46. position: fixed;
  47. bottom: 2rem;
  48. right: 1rem;
  49. "
  50. v-bind="attrs"
  51. v-on="on"
  52. >
  53. <v-icon>mdi-translate</v-icon>
  54. </v-btn>
  55. </template>
  56. <v-list class="py-0">
  57. <v-list-item
  58. v-for="(lang, index) in langs"
  59. :key="index"
  60. link
  61. :class="$vuetify.lang.current === lang.locale ? 'primary--text' : ''"
  62. @click="$vuetify.lang.current = lang.locale"
  63. >
  64. <v-list-item-title v-text="lang.name"></v-list-item-title>
  65. </v-list-item>
  66. </v-list>
  67. </v-menu>
  68. <!-- Debugger Notification -->
  69. <v-snackbar
  70. v-model="alert.show"
  71. :timeout="-1"
  72. class="ma-4 desktop-only"
  73. transition="slide-y-reverse-transition"
  74. color="primary"
  75. bottom
  76. left
  77. text
  78. >
  79. <v-icon color="primary" class="mr-4">mdi-alert-circle-outline</v-icon>
  80. <span class="my-auto" v-html="alert.html"></span>
  81. <template #action="{ attrs }">
  82. <v-btn
  83. v-bind="attrs"
  84. color="primary"
  85. text
  86. icon
  87. @click="alert.show = false"
  88. >
  89. <v-icon>mdi-close-circle-outline</v-icon>
  90. </v-btn>
  91. </template>
  92. </v-snackbar>
  93. </v-app>
  94. </template>
  95. <script>
  96. export default {
  97. data: () => ({
  98. links: [
  99. { name: "Home", path: "/" },
  100. { name: "Install", path: "/install" },
  101. { name: "API", path: "/docs" },
  102. { name: "Help", path: "/help" },
  103. { name: "FAQ", path: "/faq" },
  104. { name: "Donate", path: "/donate" },
  105. { name: "Links", path: "/links" },
  106. ],
  107. langs: [
  108. { name: "English", locale: "en" },
  109. { name: "Español", locale: "es" },
  110. { name: "Türkçe", locale: "tr" },
  111. { name: "Русский", locale: "ru" },
  112. // { name: "Français", locale: "fr" },
  113. // { name: "Deutsch", locale: "de" },
  114. // { name: "日本語" },
  115. ],
  116. alert: {
  117. show: false,
  118. html: "",
  119. },
  120. }),
  121. mounted() {
  122. if (process.client && navigator.language) {
  123. this.$vuetify.lang.current = navigator.language.slice(0, 2);
  124. }
  125. console.log(this.$vuetify.lang);
  126. setTimeout(() => {
  127. // Chrome < 70 or FF < 60
  128. if (
  129. (this.$ua._parsed.name == "Chrome" &&
  130. parseInt(this.$ua._parsed.version.split(".")[0]) < 70) ||
  131. (this.$ua._parsed.name == "Firefox" &&
  132. parseInt(this.$ua._parsed.version.split(".")[0]) < 60)
  133. ) {
  134. this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .25rem .25rem .5rem; margin: 0 .25rem;">
  135. ${this.$ua._parsed.name} ${this.$ua._parsed.version.split(".")[0]}
  136. </b> is not supported. Consider upgrading to the latest version.`;
  137. this.alert.show = true;
  138. }
  139. }, 1000);
  140. },
  141. };
  142. </script>
  143. <style>
  144. html,
  145. body {
  146. height: 100%;
  147. background: #111;
  148. height: -webkit-fill-available; /* for MacOS/iOS overscroll */
  149. scrollbar-color: #424242 #111;
  150. }
  151. ::selection {
  152. background: #f44;
  153. color: #111;
  154. }
  155. ::-webkit-scrollbar {
  156. width: 1rem;
  157. }
  158. ::-webkit-scrollbar-track {
  159. background: #111; /* color of the tracking area */
  160. }
  161. ::-webkit-scrollbar-thumb {
  162. background-color: #333; /* color of the scroll thumb */
  163. border-radius: 1rem 0 0 1rem; /* roundness of the scroll thumb */
  164. border-bottom: 0.25rem solid #111; /* creates padding around scroll thumb */
  165. border-left: 0.25rem solid #111; /* creates padding around scroll thumb */
  166. border-top: 0.25rem solid #111; /* creates padding around scroll thumb */
  167. }
  168. ::-webkit-scrollbar-thumb:hover {
  169. background-color: #f22; /* color of the scroll thumb */
  170. border-radius: 1rem 0 0 1rem; /* roundness of the scroll thumb */
  171. border-bottom: 0.25rem solid #111; /* creates padding around scroll thumb */
  172. border-left: 0.25rem solid #111; /* creates padding around scroll thumb */
  173. border-top: 0.25rem solid #111; /* creates padding around scroll thumb */
  174. }
  175. .debug {
  176. /* usage: add class="debug" to the element */
  177. outline: 2px solid red;
  178. }
  179. .v-sheet.v-snack__wrapper {
  180. border-radius: 0.75rem !important;
  181. }
  182. .mainAltButton {
  183. margin: 0.25em;
  184. }
  185. .title-text {
  186. font-size: 3rem;
  187. }
  188. .topBar {
  189. padding: 0 3rem;
  190. width: fit-content !important;
  191. border-radius: 1rem !important;
  192. /* overflow: hidden; */
  193. }
  194. .glass {
  195. backdrop-filter: blur(16px) saturate(200%);
  196. -webkit-backdrop-filter: blur(16px) saturate(200%);
  197. background: rgba(42, 42, 42, 0.75) !important;
  198. }
  199. /* used in docs.vue */
  200. .flex-wrapper {
  201. display: flex;
  202. flex-wrap: nowrap;
  203. }
  204. @media (max-width: 768px) {
  205. /* mobile */
  206. .title-text {
  207. font-size: 2rem;
  208. }
  209. .topBar {
  210. width: calc(
  211. 100vw - 2rem
  212. ) !important; /* (2rem = mx-4) 1rem on left, 1rem on right */
  213. padding: 0;
  214. }
  215. .flex-wrapper {
  216. display: flex;
  217. flex-wrap: wrap;
  218. }
  219. }
  220. /* used in docs.vue, help.vue and faq.vue */
  221. .width-constraint {
  222. max-width: auto;
  223. margin: 0 auto;
  224. }
  225. @media (min-width: 960px) {
  226. /* tablet */
  227. .width-constraint {
  228. width: 75vw;
  229. }
  230. }
  231. @media (min-width: 1264px) {
  232. /* desktop */
  233. .width-constraint {
  234. width: 60vw;
  235. }
  236. }
  237. @media (min-width: 1904) {
  238. /* 4k/ultrawide */
  239. .width-constraint {
  240. width: 42vw;
  241. }
  242. }
  243. /* animations and all that */
  244. .swoop-in-enter-active,
  245. .swoop-in-leave-active,
  246. .swoop-out-enter-active,
  247. .swoop-out-leave-active,
  248. .swoop-left-enter-active,
  249. .swoop-left-leave-active,
  250. .swoop-right-enter-active,
  251. .swoop-right-leave-active {
  252. transition-duration: 0.1s;
  253. transition-property: opacity, transform;
  254. }
  255. .swoop-left-enter,
  256. .swoop-right-leave-active {
  257. opacity: 0;
  258. transform: translate(1rem, 0);
  259. }
  260. .swoop-left-leave-active,
  261. .swoop-right-enter {
  262. opacity: 0;
  263. transform: translate(-1rem, 0);
  264. }
  265. .swoop-in-enter,
  266. .swoop-out-leave-active {
  267. opacity: 0;
  268. transform: scale(0.9);
  269. }
  270. .swoop-in-leave-active,
  271. .swoop-out-enter {
  272. opacity: 0;
  273. transform: scale(1.1);
  274. }
  275. .fly-in-from-top {
  276. opacity: 0;
  277. transform: scale(0.8) translateY(-12rem);
  278. animation: fly-in-from-top 0.5s 0.3s ease forwards;
  279. }
  280. @keyframes fly-in-from-top {
  281. 0% {
  282. opacity: 0;
  283. transform: scale(0.8) translateY(-12rem);
  284. }
  285. 100% {
  286. opacity: 1;
  287. transform: scale(1) translateY(0);
  288. }
  289. }
  290. /* reduced-motion animations */
  291. @media (prefers-reduced-motion) {
  292. .fly-in-from-top {
  293. opacity: 1;
  294. transform: none;
  295. animation: none;
  296. }
  297. .swoop-in-enter-active,
  298. .swoop-in-leave-active,
  299. .swoop-out-enter-active,
  300. .swoop-out-leave-active,
  301. .swoop-left-enter-active,
  302. .swoop-left-leave-active,
  303. .swoop-right-enter-active,
  304. .swoop-right-leave-active {
  305. transition-duration: 0.05s;
  306. transition-property: opacity;
  307. }
  308. .swoop-left-enter,
  309. .swoop-right-leave-active {
  310. opacity: 0;
  311. transform: none;
  312. }
  313. .swoop-left-leave-active,
  314. .swoop-right-enter {
  315. opacity: 0;
  316. transform: none;
  317. }
  318. .swoop-in-enter,
  319. .swoop-out-leave-active {
  320. opacity: 0;
  321. transform: none;
  322. }
  323. .swoop-in-leave-active,
  324. .swoop-out-enter {
  325. opacity: 0;
  326. transform: none;
  327. }
  328. }
  329. </style>