From d9376169bc0d778381e5c4ff64ef9900d58ce219 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 13 Jul 2019 14:51:35 -0400 Subject: scrap everything and start over with Vue --- src/App.vue | 99 ++++++++ src/assets/logo-extrasmall.svg | 190 +++++++++++++++ src/assets/logo-small.svg | 199 ++++++++++++++++ src/assets/logo.svg | 355 ++++++++++++++++++++++++++++ src/assets/page_footer.png | Bin 0 -> 12787 bytes src/components/Footer.vue | 23 ++ src/components/Logo.vue | 64 ++++++ src/components/Navigation.vue | 121 ++++++++++ src/components/News.vue | 54 +++++ src/components/ServerStatus.vue | 73 ++++++ src/main.ts | 12 + src/redirects.ts | 28 +++ src/router.ts | 79 +++++++ src/shims-tsx.d.ts | 13 ++ src/shims-vue.d.ts | 7 + src/views/About.vue | 25 ++ src/views/AccountRecovery.vue | 498 ++++++++++++++++++++++++++++++++++++++++ src/views/Home.vue | 45 ++++ src/views/News.vue | 18 ++ src/views/NotFound.vue | 6 + src/views/Registration.vue | 390 +++++++++++++++++++++++++++++++ src/views/Support.vue | 49 ++++ 22 files changed, 2348 insertions(+) create mode 100644 src/App.vue create mode 100644 src/assets/logo-extrasmall.svg create mode 100644 src/assets/logo-small.svg create mode 100644 src/assets/logo.svg create mode 100644 src/assets/page_footer.png create mode 100644 src/components/Footer.vue create mode 100644 src/components/Logo.vue create mode 100644 src/components/Navigation.vue create mode 100644 src/components/News.vue create mode 100644 src/components/ServerStatus.vue create mode 100644 src/main.ts create mode 100644 src/redirects.ts create mode 100644 src/router.ts create mode 100644 src/shims-tsx.d.ts create mode 100644 src/shims-vue.d.ts create mode 100644 src/views/About.vue create mode 100644 src/views/AccountRecovery.vue create mode 100644 src/views/Home.vue create mode 100644 src/views/News.vue create mode 100644 src/views/NotFound.vue create mode 100644 src/views/Registration.vue create mode 100644 src/views/Support.vue (limited to 'src') diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..219987a --- /dev/null +++ b/src/App.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/assets/logo-extrasmall.svg b/src/assets/logo-extrasmall.svg new file mode 100644 index 0000000..892b420 --- /dev/null +++ b/src/assets/logo-extrasmall.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/assets/logo-small.svg b/src/assets/logo-small.svg new file mode 100644 index 0000000..836dd56 --- /dev/null +++ b/src/assets/logo-small.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/src/assets/logo.svg b/src/assets/logo.svg new file mode 100644 index 0000000..c7d78b0 --- /dev/null +++ b/src/assets/logo.svg @@ -0,0 +1,355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/page_footer.png b/src/assets/page_footer.png new file mode 100644 index 0000000..72d315e Binary files /dev/null and b/src/assets/page_footer.png differ diff --git a/src/components/Footer.vue b/src/components/Footer.vue new file mode 100644 index 0000000..c454e3a --- /dev/null +++ b/src/components/Footer.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/src/components/Logo.vue b/src/components/Logo.vue new file mode 100644 index 0000000..ff81161 --- /dev/null +++ b/src/components/Logo.vue @@ -0,0 +1,64 @@ + + + diff --git a/src/components/Navigation.vue b/src/components/Navigation.vue new file mode 100644 index 0000000..199290b --- /dev/null +++ b/src/components/Navigation.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/src/components/News.vue b/src/components/News.vue new file mode 100644 index 0000000..8a58514 --- /dev/null +++ b/src/components/News.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/components/ServerStatus.vue b/src/components/ServerStatus.vue new file mode 100644 index 0000000..c35e916 --- /dev/null +++ b/src/components/ServerStatus.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..d461edb --- /dev/null +++ b/src/main.ts @@ -0,0 +1,12 @@ +import Vue from "vue" +import App from "./App.vue" +import router from "./router" +import VS2 from "vue-script2" + +Vue.config.productionTip = false +Vue.use(VS2) + +new Vue({ + router, + render: h => h(App) +}).$mount("#app") diff --git a/src/redirects.ts b/src/redirects.ts new file mode 100644 index 0000000..e122c0d --- /dev/null +++ b/src/redirects.ts @@ -0,0 +1,28 @@ +// legacy paths from the PHP website + +const redirects = [ + { + path: "/index.php", + redirect: { name: "home" }, + }, + { + path: "/news-feed.php", + redirect: { name: "news" }, + }, + { + path: "/about.php", + redirect: { name: "about" }, + }, + { + path: "/registration.php", + redirect: { name: "registration" }, + }, + { + path: "/downloads.php", + redirect: () => { + self.location.href = "https://wiki.themanaworld.org/index.php/Downloads"; + } + }, +]; + +export default redirects; diff --git a/src/router.ts b/src/router.ts new file mode 100644 index 0000000..c1902db --- /dev/null +++ b/src/router.ts @@ -0,0 +1,79 @@ +import Vue from "vue" +import Router from "vue-router" +import Home from "./views/Home.vue" +import NotFound from "./views/NotFound.vue" +import redirects from "./redirects" + +Vue.use(Router) + +const router = new Router({ + mode: "history", + base: process.env.BASE_URL, + routes: [ + { + path: "/", + name: "home", + component: Home, + }, + { + path: "/news", + name: "news", + component: () => import(/* webpackChunkName: "news" */ "./views/News.vue"), + }, + { + path: "/about", + name: "about", + component: () => import(/* webpackChunkName: "about" */ "./views/About.vue"), + }, + { + path: "/support", + name: "support", + component: () => import(/* webpackChunkName: "support" */ "./views/Support.vue"), + }, + { + path: "/recover/password", + alias: ["/recover/username"], + name: "account recovery", + component: () => import(/* webpackChunkName: "recovery" */ "./views/AccountRecovery.vue"), + }, + // BUG: normally we should be able to put this route under alias but aliases cannot have props: + { + path: "/recover/password/:emailToken", + name: "password reset", + component: () => import(/* webpackChunkName: "recovery" */ "./views/AccountRecovery.vue"), + }, + { + path: "/register", + name: "registration", + component: () => import(/* webpackChunkName: "registration" */ "./views/Registration.vue"), + }, + { + path: "/404", + alias: "*", + name: "not found", + component: NotFound, + }, + ...redirects, + ] +}); + +router.afterEach((to, from) => { + const mainTitle = document.querySelector("#app > .content > h1"); + + // scroll to the title if we're below it + if (mainTitle) { + mainTitle.scrollIntoView({ + block: "nearest", + inline: "nearest", + behavior: "smooth", + }); + } + + if (to.name && to.path !== "/") { + document.title = `${process.env.VUE_APP_TITLE} - ${to.name[0].toUpperCase() + to.name.slice(1)}`; + } else { + document.title = process.env.VUE_APP_TITLE; + } +}) + +export default router; diff --git a/src/shims-tsx.d.ts b/src/shims-tsx.d.ts new file mode 100644 index 0000000..0291e88 --- /dev/null +++ b/src/shims-tsx.d.ts @@ -0,0 +1,13 @@ +import Vue, { VNode } from "vue" + +declare global { + namespace JSX { + // tslint:disable no-empty-interface + interface Element extends VNode {} + // tslint:disable no-empty-interface + interface ElementClass extends Vue {} + interface IntrinsicElements { + [elem: string]: any + } + } +} diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts new file mode 100644 index 0000000..ea641cd --- /dev/null +++ b/src/shims-vue.d.ts @@ -0,0 +1,7 @@ +declare module "*.vue" { + import Vue from "vue" + export default Vue +} + +// vue-script2 has no types! +declare module "vue-script2" diff --git a/src/views/About.vue b/src/views/About.vue new file mode 100644 index 0000000..6eeac30 --- /dev/null +++ b/src/views/About.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/views/AccountRecovery.vue b/src/views/AccountRecovery.vue new file mode 100644 index 0000000..f02c2e0 --- /dev/null +++ b/src/views/AccountRecovery.vue @@ -0,0 +1,498 @@ + + + + + diff --git a/src/views/Home.vue b/src/views/Home.vue new file mode 100644 index 0000000..0033939 --- /dev/null +++ b/src/views/Home.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/views/News.vue b/src/views/News.vue new file mode 100644 index 0000000..24aa689 --- /dev/null +++ b/src/views/News.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/views/NotFound.vue b/src/views/NotFound.vue new file mode 100644 index 0000000..b45a4f2 --- /dev/null +++ b/src/views/NotFound.vue @@ -0,0 +1,6 @@ + diff --git a/src/views/Registration.vue b/src/views/Registration.vue new file mode 100644 index 0000000..f2c0ad0 --- /dev/null +++ b/src/views/Registration.vue @@ -0,0 +1,390 @@ + + + + + diff --git a/src/views/Support.vue b/src/views/Support.vue new file mode 100644 index 0000000..458ffe0 --- /dev/null +++ b/src/views/Support.vue @@ -0,0 +1,49 @@ + + + + + -- cgit v1.2.3-70-g09d2