default.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  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. {{ $vuetify.lang.t(`$vuetify.${link.name}.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. setTimeout(() => {
  126. // Chrome < 70 or FF < 60
  127. if (
  128. (this.$ua._parsed.name == "Chrome" &&
  129. parseInt(this.$ua._parsed.version.split(".")[0]) < 70) ||
  130. (this.$ua._parsed.name == "Firefox" &&
  131. parseInt(this.$ua._parsed.version.split(".")[0]) < 60)
  132. ) {
  133. this.alert.html = `<b style="background: #222; border-radius: .5rem; padding: .25rem .25rem .25rem .5rem; margin: 0 .25rem;">
  134. ${this.$ua._parsed.name} ${this.$ua._parsed.version.split(".")[0]}
  135. </b> is not supported. Consider upgrading to the latest version.`;
  136. this.alert.show = true;
  137. }
  138. }, 1000);
  139. },
  140. };
  141. </script>
  142. <style>
  143. html,
  144. body {
  145. height: 100%;
  146. background: #111;
  147. height: -webkit-fill-available; /* for MacOS/iOS overscroll */
  148. scrollbar-color: #424242 #111;
  149. }
  150. ::selection {
  151. background: #f44;
  152. color: #111;
  153. }
  154. ::-webkit-scrollbar {
  155. width: 1rem;
  156. }
  157. ::-webkit-scrollbar-track {
  158. background: #111; /* color of the tracking area */
  159. }
  160. ::-webkit-scrollbar-thumb {
  161. background-color: #333; /* color of the scroll thumb */
  162. border-radius: 1rem 0 0 1rem; /* roundness of the scroll thumb */
  163. border-bottom: 0.25rem solid #111; /* creates padding around scroll thumb */
  164. border-left: 0.25rem solid #111; /* creates padding around scroll thumb */
  165. border-top: 0.25rem solid #111; /* creates padding around scroll thumb */
  166. }
  167. ::-webkit-scrollbar-thumb:hover {
  168. background-color: #f22; /* color of the scroll thumb */
  169. border-radius: 1rem 0 0 1rem; /* roundness of the scroll thumb */
  170. border-bottom: 0.25rem solid #111; /* creates padding around scroll thumb */
  171. border-left: 0.25rem solid #111; /* creates padding around scroll thumb */
  172. border-top: 0.25rem solid #111; /* creates padding around scroll thumb */
  173. }
  174. .debug {
  175. /* usage: add class="debug" to the element */
  176. outline: 2px solid red;
  177. }
  178. .v-sheet.v-snack__wrapper {
  179. border-radius: 0.75rem !important;
  180. }
  181. .mainAltButton {
  182. margin: 0.25em;
  183. }
  184. .title-text {
  185. font-size: 3rem;
  186. }
  187. .topBar {
  188. padding: 0 3rem;
  189. width: fit-content !important;
  190. border-radius: 1rem !important;
  191. /* overflow: hidden; */
  192. }
  193. .glass {
  194. backdrop-filter: blur(16px) saturate(200%);
  195. -webkit-backdrop-filter: blur(16px) saturate(200%);
  196. background: rgba(42, 42, 42, 0.75) !important;
  197. }
  198. /* used in docs.vue */
  199. .flex-wrapper {
  200. display: flex;
  201. flex-wrap: nowrap;
  202. }
  203. @media (max-width: 768px) {
  204. /* mobile */
  205. .title-text {
  206. font-size: 2rem;
  207. }
  208. .topBar {
  209. width: calc(
  210. 100vw - 2rem
  211. ) !important; /* (2rem = mx-4) 1rem on left, 1rem on right */
  212. padding: 0;
  213. }
  214. .flex-wrapper {
  215. display: flex;
  216. flex-wrap: wrap;
  217. }
  218. }
  219. /* used in docs.vue, help.vue and faq.vue */
  220. .width-constraint {
  221. max-width: auto;
  222. margin: 0 auto;
  223. }
  224. @media (min-width: 960px) {
  225. /* tablet */
  226. .width-constraint {
  227. width: 75vw;
  228. }
  229. }
  230. @media (min-width: 1264px) {
  231. /* desktop */
  232. .width-constraint {
  233. width: 60vw;
  234. }
  235. }
  236. @media (min-width: 1904) {
  237. /* 4k/ultrawide */
  238. .width-constraint {
  239. width: 42vw;
  240. }
  241. }
  242. /* animations and all that */
  243. .swoop-in-enter-active,
  244. .swoop-in-leave-active,
  245. .swoop-out-enter-active,
  246. .swoop-out-leave-active,
  247. .swoop-left-enter-active,
  248. .swoop-left-leave-active,
  249. .swoop-right-enter-active,
  250. .swoop-right-leave-active {
  251. transition-duration: 0.1s;
  252. transition-property: opacity, transform;
  253. }
  254. .swoop-left-enter,
  255. .swoop-right-leave-active {
  256. opacity: 0;
  257. transform: translate(1rem, 0);
  258. }
  259. .swoop-left-leave-active,
  260. .swoop-right-enter {
  261. opacity: 0;
  262. transform: translate(-1rem, 0);
  263. }
  264. .swoop-in-enter,
  265. .swoop-out-leave-active {
  266. opacity: 0;
  267. transform: scale(0.9);
  268. }
  269. .swoop-in-leave-active,
  270. .swoop-out-enter {
  271. opacity: 0;
  272. transform: scale(1.1);
  273. }
  274. .fly-in-from-top {
  275. opacity: 0;
  276. transform: scale(0.8) translateY(-12rem);
  277. animation: fly-in-from-top 0.5s 0.3s ease forwards;
  278. }
  279. @keyframes fly-in-from-top {
  280. 0% {
  281. opacity: 0;
  282. transform: scale(0.8) translateY(-12rem);
  283. }
  284. 100% {
  285. opacity: 1;
  286. transform: scale(1) translateY(0);
  287. }
  288. }
  289. /* reduced-motion animations */
  290. @media (prefers-reduced-motion) {
  291. .fly-in-from-top {
  292. opacity: 1;
  293. transform: none;
  294. animation: none;
  295. }
  296. .swoop-in-enter-active,
  297. .swoop-in-leave-active,
  298. .swoop-out-enter-active,
  299. .swoop-out-leave-active,
  300. .swoop-left-enter-active,
  301. .swoop-left-leave-active,
  302. .swoop-right-enter-active,
  303. .swoop-right-leave-active {
  304. transition-duration: 0.05s;
  305. transition-property: opacity;
  306. }
  307. .swoop-left-enter,
  308. .swoop-right-leave-active {
  309. opacity: 0;
  310. transform: none;
  311. }
  312. .swoop-left-leave-active,
  313. .swoop-right-enter {
  314. opacity: 0;
  315. transform: none;
  316. }
  317. .swoop-in-enter,
  318. .swoop-out-leave-active {
  319. opacity: 0;
  320. transform: none;
  321. }
  322. .swoop-in-leave-active,
  323. .swoop-out-enter {
  324. opacity: 0;
  325. transform: none;
  326. }
  327. }
  328. </style>