]> Repos - mime-chat/commitdiff
added login page
authorAndrew Gundersen <gundersena@xavier.edu>
Thu, 4 Feb 2021 01:36:58 +0000 (19:36 -0600)
committerAndrew Gundersen <gundersena@xavier.edu>
Thu, 4 Feb 2021 01:36:58 +0000 (19:36 -0600)
13 files changed:
public/favicon.ico [deleted file]
src/App.vue
src/background.ts
src/components/login/index.vue [new file with mode: 0644]
src/components/messenger/mockMessages.ts [deleted file]
src/main.ts
src/router.ts [moved from src/router/index.ts with 52% similarity]
src/views/home.vue [moved from src/views/home/index.vue with 90% similarity]
src/views/login.vue [new file with mode: 0644]
src/views/register.vue [moved from src/views/user/register.vue with 100% similarity]
src/views/user/login.vue [deleted file]
testServer.js [new file with mode: 0644]
tsconfig.json

diff --git a/public/favicon.ico b/public/favicon.ico
deleted file mode 100644 (file)
index df36fcf..0000000
Binary files a/public/favicon.ico and /dev/null differ
index 1c8217a5634e842a58fb04caf589bcaafd523678..13dae392cf3eb5f832aa9ba34bb70521435f0862 100644 (file)
@@ -5,24 +5,22 @@
 </template>
 
 <style lang="scss">
+  html, body {
+    margin: 0;
+    padding: 0;
+  }
 
-html, body {
-  margin: 0;
-  padding: 0;
-}
-
-#app {
-  font-family: Avenir, Helvetica, Arial, sans-serif;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-  text-align: center;
-  color: #2c3e50;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    flex-direction: column;
-    height: 100vh;
-    width: 100vw;
- }
-
+  #app {
+    font-family: Avenir, Helvetica, Arial, sans-serif;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+    text-align: center;
+    color: #2c3e50;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      flex-direction: column;
+      height: 100vh;
+      width: 100vw;
+   }
 </style>
index 931f91511ab8e06c364056ba1fcc03564a52fd57..e2d0712f8a2f0a86f9958ce231b40a4558e23e98 100644 (file)
@@ -1,4 +1,9 @@
-import { app, protocol, BrowserWindow, ipcMain } from "electron";
+import { 
+  app, 
+  protocol, 
+  BrowserWindow, 
+  ipcMain 
+} from "electron";
 import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
 import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
 import * as path from "path";
@@ -26,21 +31,16 @@ function createWindow() {
     maximizable: false,
 
     // Postition at launch
-    x: 100,
-    y: 100,
+    x: 10,
+    y: 10,
 
     webPreferences: {
       devTools: false,
-
-      nodeIntegration: 
-        (process.env.ELECTRON_NODE_INTEGRATION as unknown) as boolean,
-
-      preload: path.join(__dirname, "preload.js")
-
     }
 
   });
 
+
   if (process.env.WEBPACK_DEV_SERVER_URL) {
     // Load the url of the dev server if in development mode
     win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string);
@@ -53,6 +53,7 @@ function createWindow() {
   }
 
 
+  // Websockets config.
   win.webContents.on('did-finish-load', () => {
 
     // Define the websocket
@@ -90,6 +91,7 @@ function createWindow() {
   win.on("closed", () => {
     win = null;
   });
+
 }
 
 // Quit when all windows are closed.
@@ -126,13 +128,17 @@ app.on("ready", async () => {
 
 // Exit cleanly on request from parent process in development mode.
 if (isDevelopment) {
+
+  // For windows.
   if (process.platform === "win32") {
     process.on("message", data => {
       if (data === "graceful-exit") {
         app.quit();
       }
     });
-  } else {
+  } 
+
+  else {
     process.on("SIGTERM", () => {
       app.quit();
     });
diff --git a/src/components/login/index.vue b/src/components/login/index.vue
new file mode 100644 (file)
index 0000000..5fb8776
--- /dev/null
@@ -0,0 +1,23 @@
+<template>
+  Login Componant
+</template>
+
+<script lang="ts">
+
+export default {
+
+  name: "Login",
+
+};
+
+</script>
+
+<style lang="scss" scoped>
+  #messenger {
+    width: 350px;
+    height: 500px;
+    background-color: #e6e6e6;
+    box-shadow: 0px 3px 10px 0px rgba(0, 0, 0, 0.3);
+    // border-radius: 20px;
+  }
+</style>
\ No newline at end of file
diff --git a/src/components/messenger/mockMessages.ts b/src/components/messenger/mockMessages.ts
deleted file mode 100644 (file)
index 8bda834..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-import { Message } from "@/types/message/index";
-
-const Messages: Message[] = [
-    {
-        content: "Welcome",
-        context: "ai",
-        subContext: "",
-        modifier: "ai",
-        id: "2",
-        time: ""
-    },
-    {
-        content:
-            "add friend",
-        context: "launch",
-        subContext: "",
-        modifier: "sf",
-        id: "1",
-        time: ""
-    },
-    {
-        content: "Did you mean to addcontact?",
-        context: "addcontact",
-        subContext: "",
-        modifier: "ai",
-        id: "5",
-        time: ""
-    },
-    {
-        content: "yes",
-        context: "fulfill",
-        subContext: "",
-        modifier: "sf",
-        id: "6",
-        time: ""
-    },
-
-    {
-        content: "Hey Anna, did you get the paper done?",
-        context: "Mesage from Tommy McConville",
-        subContext: "New Conversation",
-        modifier: "ai",
-        id: "3",
-        time: ""
-    },
-    {
-        content: "Hey do you know Enrique Hernandez?",
-        context: "Message from Crimata",
-        subContext: "",
-        modifier: "ai",
-        id: "7",
-        time: ""
-    },
-
-    {
-        content: "Yes posting it online soon.",
-        context: "You to Tommy McConville",
-        subContext: "",
-        modifier: "sf",
-        id: "4",
-        time: ""
-    },
-    {
-        content: "Hey do you know Enrique Hernandez?",
-        context: "Message from Crimata",
-        subContext: "",
-        modifier: "ai",
-        id: "8",
-        time: ""
-    },
-    {
-        content: "Hey Anna, did you get the paper done?",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "9",
-        time: ""
-    },
-    {
-        content: "Hey Anna, did you get the paper done?",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "10",
-        time: ""
-    },
-    {
-        content: "Yes posting it online soon.",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "sf",
-        id: "11",
-        time: ""
-    },
-    {
-        content:
-            "I can be there at 5 pm tomorrow to greet you at a Chick file with my almond and chive salad.",
-        context: "You to Tommy McConville",
-        subContext: "",
-        modifier: "sf",
-        id: "12",
-        time: ""
-    },
-    {
-        content: "Hey Anna, did you get the paper done?",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "13",
-        time: ""
-    },
-    {
-        content: "Hey Anna, did you get the paper done?",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "14",
-        time: ""
-    },
-    {
-        content: "Yes posting it online soon.",
-        context: "You to Tommy McConville",
-        subContext: "",
-        modifier: "sf",
-        id: "15",
-        time: ""
-    },
-    {
-        content: "Sweet, thanks!",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "16",
-        time: ""
-    },
-    {
-        content: "Hey do you know Enrique Hernandez?",
-        context: "Message from Crimata AI",
-        subContext: "",
-        modifier: "ai",
-        id: "17",
-        time: ""
-    },
-    {
-        content: "Yes posting it online soon.",
-        context: "You to Tommy McConville",
-        subContext: "",
-        modifier: "sf",
-        id: "18",
-        time: ""
-    },
-    {
-        content: "Sweet, thanks!",
-        context: "Message from Tommy McConville",
-        subContext: "",
-        modifier: "ai",
-        id: "19",
-        time: ""
-    },
-];
-export default Messages;
index 531bb906a096c75b882cc0190647253b63a7b359..c03e8b6d47a03f51da61947a331d05231399d078 100644 (file)
@@ -1,16 +1,18 @@
-import { createApp } from "vue";
+// src/main.ts
+
 import App from "./App.vue";
 import router from "./router";
 
-// animation library
+import mitt from "mitt";
 import anime from "animejs";
+import { createApp } from "vue";
 
-// event handler library
-import mitt from "mitt";
+// Handle events.
 const emitter = mitt();
 
-createApp(App)
-  .use(router)
-  .provide("animejs", anime)
-  .provide("mitt", emitter)
-  .mount("#app");
+const app = createApp(App)
+
+app.use(router)
+app.provide("animejs", anime)
+app.provide("mitt", emitter)
+app.mount("#app");
similarity index 52%
rename from src/router/index.ts
rename to src/router.ts
index b44e9eb765575a7b5572dad82cdb8a5badb02f52..07537f32eecf873c2417e9d44fd66d0b4efdfad4 100644 (file)
@@ -5,18 +5,28 @@ import {
     RouteRecordRaw 
 } from "vue-router";
 
-import HomeIndex from "../views/home/index.vue";
+import Home from "./views/home.vue";
+import Login from "./views/login.vue";
 
+// Define the routes (/*) for the app here.
 const routes: Array<RouteRecordRaw> = [
+
   {
     path: "/",
     name: "Home",
-    component: HomeIndex
+    component: Home
   },
+
+  {
+    path: "/login",
+    name: "Login",
+    component: Login
+  },
+
 ];
 
 const router = createRouter({
-  history: process.env.IS_ELECTRON ? createWebHashHistory() : createWebHistory(process.env.BASE_URL),
+  history: createWebHashHistory(),
   routes
 });
 
similarity index 90%
rename from src/views/home/index.vue
rename to src/views/home.vue
index a0a4eda2065f64808fc3812403c78be024584ec8..b65ef78501d9fe77ddb98ac98571202c6240173a 100644 (file)
@@ -3,10 +3,15 @@
 </template>
 
 <script lang="ts">
+
 import { defineComponent } from "vue";
 import Messenger from "@/components/messenger/index.vue";
+
 export default defineComponent({
-  name: "HomeIndex",
+    
+  name: "Home",
   components: { Messenger },
+
 });
+
 </script>
diff --git a/src/views/login.vue b/src/views/login.vue
new file mode 100644 (file)
index 0000000..7226a87
--- /dev/null
@@ -0,0 +1,17 @@
+<template>
+    <Login />
+</template>
+
+<script lang="ts">
+
+import { defineComponent } from "vue";
+import Login from "@/components/login/index.vue";
+
+export default defineComponent({
+
+  name: "Login",
+  components: { Login },
+
+});
+
+</script>
\ No newline at end of file
diff --git a/src/views/user/login.vue b/src/views/user/login.vue
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/testServer.js b/testServer.js
new file mode 100644 (file)
index 0000000..03e4a04
--- /dev/null
@@ -0,0 +1,44 @@
+const WebSocket = require("ws");
+
+const testMessage = {
+  content: 'Hello from test server!' ,
+  context: 'test message',
+  subContext: '',
+  modifiers: 'ai',
+  id: "0",
+  time: 'test'
+}
+const wss = new WebSocket.Server({
+  port: 8080
+  // perMessageDeflate: {
+  //   zlibDeflateOptions: {
+  //     // See zlib defaults.
+  //     chunkSize: 1024,
+  //     memLevel: 7,
+  //     level: 3
+  //   },
+  //   zlibInflateOptions: {
+  //     chunkSize: 10 * 1024
+  //   },
+  //   // Other options settable:
+  //   clientNoContextTakeover: true, // Defaults to negotiated value.
+  //   serverNoContextTakeover: true, // Defaults to negotiated value.
+  //   serverMaxWindowBits: 10, // Defaults to negotiated value.
+  //   // Below options specified as default values.
+  //   concurrencyLimit: 10, // Limits zlib concurrency for perf.
+  //   threshold: 1024 // Size (in bytes) below which messages
+  //   // should not be compressed.
+  // }
+});
+
+wss.on("connection", function connection(ws, req) {
+  ws.on("message", function incoming(message) {
+    console.log(message)
+    // const parsed = JSON.parse(message)
+    //   console.log(parsed)
+  });
+
+  const ip = req.socket.remoteAddress;
+  console.log("received connection from", ip);
+  ws.send(JSON.stringify(testMessage));
+});
index c9e770ca2fee235b92c1d38dec3d395336aff400..3a86ecc31563d5fd434b4f145258f615d30b457d 100644 (file)
@@ -31,6 +31,7 @@
     ]
   },
   "include": [
+    "src/*.ts",
     "src/**/*.ts",
     "src/**/*.tsx",
     "src/**/*.vue",