From d62561f6e8878ca7983805abbded665a62c887ce Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Sat, 20 Feb 2021 10:47:28 -0600 Subject: [PATCH 1/3] factored out window styling to app.vue and other style improvments --- src/App.vue | 79 +++++++++++++++++++++++++++++++++++---- src/background/run.ts | 2 +- src/background/session.ts | 4 +- src/background/window.ts | 3 ++ src/views/home.vue | 14 +++---- src/views/login.vue | 53 +++++++++++++++++++------- 6 files changed, 124 insertions(+), 31 deletions(-) diff --git a/src/App.vue b/src/App.vue index 13dae39..d3e2d89 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,10 +1,26 @@ diff --git a/src/background/run.ts b/src/background/run.ts index d3ab521..eeafe21 100644 --- a/src/background/run.ts +++ b/src/background/run.ts @@ -14,7 +14,7 @@ export async function main() { // create main window. await createWindow({ width: 350, - height: 525, + height: 500, resizable: true }); diff --git a/src/background/session.ts b/src/background/session.ts index 5959e2e..7ca7f36 100644 --- a/src/background/session.ts +++ b/src/background/session.ts @@ -23,8 +23,8 @@ interface TextMessage { content: string; } -const ip = 'ws://127.0.0.1'; -const port = 8081; +const ip = 'ws://localhost'; +const port = 8760; const reconnectTimeout = 3000; //ms let socket: WebSocket; let success = false; diff --git a/src/background/window.ts b/src/background/window.ts index 8967dea..036999a 100644 --- a/src/background/window.ts +++ b/src/background/window.ts @@ -55,6 +55,9 @@ export const createWindow = async (options: WindowSettings): Promise => { width: options.width, height: options.height, resizable: options.resizable, + frame: false, + minWidth: 350, + minHeight: 500, webPreferences: { // Use pluginOptions.nodeIntegration, leave this alone // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info diff --git a/src/views/home.vue b/src/views/home.vue index 677474b..0551f88 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -22,11 +22,11 @@ export default defineComponent({ diff --git a/src/views/login.vue b/src/views/login.vue index 25f9bbf..a5b9eed 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,5 +1,6 @@ @@ -81,13 +89,12 @@ export default defineComponent({ From 8ff21026a5ae3c619e46b832e7e9c5f4593aec88 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Sat, 20 Feb 2021 15:39:00 -0600 Subject: [PATCH 2/3] ui enhancements, transparent title bar and custom exit buttons --- src/App.vue | 22 ++- src/components/messageView/index.vue | 24 ++- src/components/messageView/mockMessages.ts | 161 ++++++++++++++++++++ src/components/taInput/textDetails/text.vue | 2 +- src/views/home.vue | 8 +- src/views/login.vue | 28 +++- src/views/splash.vue | 9 +- 7 files changed, 227 insertions(+), 27 deletions(-) create mode 100644 src/components/messageView/mockMessages.ts diff --git a/src/App.vue b/src/App.vue index d3e2d89..8f6d51d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,15 +3,13 @@ - - - - + + + + + @@ -27,7 +25,6 @@ } #app { - font-family: Avenir, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -43,15 +40,15 @@ .titlebar { position: fixed; - display: flex; - width: 100vw; height: 54px; -webkit-user-select: none; -webkit-app-region: drag; - background-color: #EBEBEB; + background-color: red; + + opacity: 0.0; border: none; outline:none; @@ -59,7 +56,8 @@ } .menu { - margin-left: 13px; + position: fixed; + margin-left: 20px; margin-top: 20px; } diff --git a/src/components/messageView/index.vue b/src/components/messageView/index.vue index 261e718..d75ef73 100644 --- a/src/components/messageView/index.vue +++ b/src/components/messageView/index.vue @@ -4,6 +4,7 @@ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" :viewBox="scrollView" + @click="emittMessage" > @@ -21,6 +22,12 @@ + + diff --git a/src/components/messageView/mockMessages.ts b/src/components/messageView/mockMessages.ts deleted file mode 100644 index 6284c82..0000000 --- a/src/components/messageView/mockMessages.ts +++ /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; \ No newline at end of file diff --git a/src/components/messageView/viewDetails/offsetCalculator.ts b/src/components/messageView/viewDetails/offsetCalculator.ts index a04e5ab..01be800 100644 --- a/src/components/messageView/viewDetails/offsetCalculator.ts +++ b/src/components/messageView/viewDetails/offsetCalculator.ts @@ -5,7 +5,7 @@ import { ref } from "vue"; export default function useOffsetCalculator() { const xOffset = ref(0); const yOffset = ref(0); - const firstChildMarginTop = 0; + const firstChildMarginTop = 45; let previousMessageHeight = 0; const messagePadding = 15; diff --git a/src/components/messageView/viewDetails/transitions.ts b/src/components/messageView/viewDetails/transitions.ts index 8d85701..493725e 100644 --- a/src/components/messageView/viewDetails/transitions.ts +++ b/src/components/messageView/viewDetails/transitions.ts @@ -33,9 +33,12 @@ export default function useTransitions() { const animateMessage = async (el: SVGGElement) => { + // Where the message gets translated to. const elTransform = `translate(${messageOffset.x} ${messageOffset.y})`; + const viewTransform = `translate(0 ${-vB})`; + // Shift of view height > window height. if (shift) { await shiftAnimate(el, elTransform, messageView, viewTransform); } else { @@ -44,6 +47,7 @@ export default function useTransitions() { rendering.value = false; } + // Get height of messageView. const beforeEnter: VueTransitionCallback = () => { rendering.value = true; // query DOM for messageView element diff --git a/src/components/taInput/index.vue b/src/components/taInput/index.vue index 91fb570..b0f3a28 100644 --- a/src/components/taInput/index.vue +++ b/src/components/taInput/index.vue @@ -1,17 +1,33 @@