From 0ca0ef08e1baa880739ae11dcd758bc18d3d0d07 Mon Sep 17 00:00:00 2001 From: "Chen, Tai-Lin" Date: Fri, 1 Sep 2023 17:50:30 +0800 Subject: [PATCH 1/3] feat: add Authentication Page --- .eslintrc.js | 5 +- app/src/App.vue | 7 +- app/src/AuthenticationPage.vue | 16 ++++ app/src/components/AuthenticationPart.vue | 36 +++++++++ app/src/components/DynamicBackground.vue | 98 +++++++++++++++++++++++ app/src/components/HeaderPart.vue | 2 +- app/src/components/QuestPart.vue | 2 +- app/tailwind.config.js | 6 +- 8 files changed, 163 insertions(+), 9 deletions(-) create mode 100644 app/src/AuthenticationPage.vue create mode 100644 app/src/components/AuthenticationPart.vue create mode 100644 app/src/components/DynamicBackground.vue diff --git a/.eslintrc.js b/.eslintrc.js index f438449..2744ff7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,12 +15,15 @@ module.exports = { sourceType: 'module', }, rules: { - 'prettier/prettier': ['error', { endOfLine: 'auto', semi: false }], // We added this 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'import/extensions': 'off', camelcase: ['error', { properties: 'never', ignoreDestructuring: true }], 'no-param-reassign': ['error', { props: false }], 'no-underscore-dangle': ['error', { allow: ['_id'] }], + /* we added this */ + 'no-var': 'error', + 'no-plusplus': 'off', + 'prettier/prettier': ['error', { endOfLine: 'auto', semi: false }], }, } diff --git a/app/src/App.vue b/app/src/App.vue index e6e3717..a4d6e42 100644 --- a/app/src/App.vue +++ b/app/src/App.vue @@ -1,5 +1,8 @@ + diff --git a/app/src/components/AuthenticationPart.vue b/app/src/components/AuthenticationPart.vue new file mode 100644 index 0000000..26707d9 --- /dev/null +++ b/app/src/components/AuthenticationPart.vue @@ -0,0 +1,36 @@ + + diff --git a/app/src/components/DynamicBackground.vue b/app/src/components/DynamicBackground.vue new file mode 100644 index 0000000..6343051 --- /dev/null +++ b/app/src/components/DynamicBackground.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/app/src/components/HeaderPart.vue b/app/src/components/HeaderPart.vue index 6333239..60e000b 100644 --- a/app/src/components/HeaderPart.vue +++ b/app/src/components/HeaderPart.vue @@ -12,7 +12,7 @@ + Log in / Sign up + + diff --git a/app/src/components/VisualizationPart.vue b/app/src/components/VisualizationPart.vue index f1c9a77..ac9a061 100644 --- a/app/src/components/VisualizationPart.vue +++ b/app/src/components/VisualizationPart.vue @@ -42,7 +42,7 @@ onMounted(() => { }) onUnmounted(() => { - treeRef.value.removeEventListener('mousedown', mouseDownHandler) + treeRef?.value?.removeEventListener('mousedown', mouseDownHandler) }) diff --git a/app/src/main.js b/app/src/main.js index 84f3945..55e4c22 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -1,4 +1,5 @@ import { createApp } from 'vue' +import { createRouter, createWebHistory } from 'vue-router' import './style.css' /* import the fontawesome core */ @@ -24,7 +25,10 @@ import { faCircleQuestion, faCircleRight, } from '@fortawesome/free-regular-svg-icons' + import App from './App.vue' +import GamePage from './views/GamePage.vue' +import AuthPage from './views/AuthPage.vue' /* add icons to the library */ library.add( @@ -41,4 +45,20 @@ library.add( faTerminal ) -createApp(App).component('font-awesome-icon', FontAwesomeIcon).mount('#app') +const routes = [ + { path: '/', name: 'Home', component: AuthPage }, + { path: '/game', name: 'Game', component: GamePage }, +] + +const router = createRouter({ + history: createWebHistory(), + routes, +}) + +const app = createApp(App) + +app.component('font-awesome-icon', FontAwesomeIcon) + +app.use(router) + +app.mount('#app') diff --git a/app/src/AuthenticationPage.vue b/app/src/views/AuthPage.vue similarity index 72% rename from app/src/AuthenticationPage.vue rename to app/src/views/AuthPage.vue index b7c2280..749522b 100644 --- a/app/src/AuthenticationPage.vue +++ b/app/src/views/AuthPage.vue @@ -1,6 +1,6 @@