default.vue 8.1 KB

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