initial working version
This commit is contained in:
parent
0a3c9f71d8
commit
d963f7d8a8
23 changed files with 89 additions and 100 deletions
|
|
@ -92,7 +92,7 @@ export function newMessage ({
|
|||
audio=false,
|
||||
context=false,
|
||||
uid=uuidv4()
|
||||
}): Message {
|
||||
}) {
|
||||
return {
|
||||
text: text,
|
||||
audio: audio,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import anime from "animejs";
|
||||
import { useIpc } from '@/modules/ipc';
|
||||
import { onMounted, onUnmounted, ref, Ref } from "vue";
|
||||
import { postMessage } from "@/ipc/session";
|
||||
import { postMessage } from "@/render/ipc";
|
||||
import { newMessage, animateAudioInput } from "./helpers";
|
||||
import { invokeStopRecord, postAudioChunk } from "@/ipc/audio";
|
||||
import { invokeReturnAudio, postAudioChunk } from "@/render/ipc";
|
||||
|
||||
export default function useAudioInputController (typing: Ref) {
|
||||
|
||||
|
|
@ -28,7 +26,7 @@ export default function useAudioInputController (typing: Ref) {
|
|||
|
||||
// get audio and post new message to backend
|
||||
mediaRecorder.addEventListener('stop', (_e: Event) => {
|
||||
invokeStopRecord().then((audio: ArrayBuffer[] | Error) => {
|
||||
invokeReturnAudio().then((audio: ArrayBuffer[] | Error) => {
|
||||
console.log(audio);
|
||||
// postMessage(newMessage({audio: audio}));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Ref, ref, watch, onMounted, onUnmounted } from "vue";
|
||||
import { postMessage } from "@/ipc/session";
|
||||
import { postMessage } from "@/render/ipc";
|
||||
import { newMessage, animateTextInput } from "./helpers";
|
||||
|
||||
|
||||
export default function useTextInputController(elementX: Ref) {
|
||||
|
||||
|
||||
let textInput: HTMLInputElement | null;
|
||||
|
||||
const { side, show, hide, switchSide } = animateTextInput();
|
||||
|
|
@ -37,10 +37,10 @@ export default function useTextInputController(elementX: Ref) {
|
|||
|
||||
// Send it to the backend for processing.
|
||||
const message = newMessage({
|
||||
text: textInput.value
|
||||
text: false
|
||||
});
|
||||
|
||||
postMessage(message);
|
||||
// postMessage(message);
|
||||
|
||||
clearInput()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { ref } from 'vue';
|
||||
import useScroll from "@/render/composables/scroll";
|
||||
import useScroll from "@/render/composables/useScroll";
|
||||
|
||||
const messagesRef = ref();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,14 +14,22 @@
|
|||
|
||||
<script lang="ts">
|
||||
|
||||
import { postNavBarExit, postNavBarMin } from "@/render/ipc";
|
||||
|
||||
setup() {
|
||||
// import { postNavBarExit, postNavBarMin } from "@/render/ipc";
|
||||
import { defineComponent } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "Header",
|
||||
setup() {
|
||||
const postNavBarExit = () => {};
|
||||
const postNavBarMin = () => {};
|
||||
return {
|
||||
postNavBarExit,
|
||||
postNavBarMin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
|
@ -78,4 +86,4 @@
|
|||
.minimizeButton:active {
|
||||
background-color: #c08e38;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@
|
|||
:style="{ top: `${elementY}px`, left: `${elementX}px` }"
|
||||
>
|
||||
<div>{{ initials }}</div>
|
||||
|
||||
|
||||
|
||||
<!-- Recording animation on space bar -->
|
||||
<span v-if="recording" class="play"></span>
|
||||
<span v-if="recording" class="pause"></span>
|
||||
|
||||
<!-- Show text input on key-down -->
|
||||
<input
|
||||
id="textInput"
|
||||
type="text"
|
||||
<input
|
||||
id="textInput"
|
||||
type="text"
|
||||
/>
|
||||
|
||||
<!-- Show suggestions menu on click -->
|
||||
|
|
@ -27,24 +27,19 @@
|
|||
<script lang="ts">
|
||||
|
||||
import { defineComponent } from "vue";
|
||||
import draggify from "@/modules/draggify";
|
||||
import draggify from "@/render/composables/useDraggify";
|
||||
|
||||
import TextInput from "@/components/textInput.vue";
|
||||
|
||||
import useTextInputController from
|
||||
"@/components/controllers/inputItem.control.audio";
|
||||
import useAudioInputController from
|
||||
"@/components/controllers/inputItem.control.text";
|
||||
import useTextInputController from
|
||||
"@/render/components/controllers/inputItem.control.text";
|
||||
import useAudioInputController from
|
||||
"@/render/components/controllers/inputItem.control.audio";
|
||||
|
||||
export default defineComponent({
|
||||
name: "InputItem",
|
||||
|
||||
props: ["initials"],
|
||||
|
||||
components: {
|
||||
TextInput
|
||||
},
|
||||
|
||||
setup() {
|
||||
|
||||
// Default values for position.
|
||||
|
|
|
|||
|
|
@ -35,11 +35,8 @@
|
|||
<script lang="ts">
|
||||
|
||||
import { defineComponent, ref } from "vue";
|
||||
import { useIpc } from "@/modules/ipc";
|
||||
import { authRequest } from '@/modules/message';
|
||||
import { useProfile } from '@/modules/auth';
|
||||
import { invokeLogin } from "@/ipcRend/account";
|
||||
import { postInitSession } from "@/ipcRend/session";
|
||||
import { useProfile } from '@/render/composables/useProfile';
|
||||
import { invokeLogin } from "@/render/ipc";
|
||||
|
||||
export default defineComponent({
|
||||
name: "Login",
|
||||
|
|
@ -49,6 +46,8 @@ export default defineComponent({
|
|||
const usr = ref("");
|
||||
const pwd = ref("");
|
||||
|
||||
const { setProfile } = useProfile();
|
||||
|
||||
// Submit login credentials to the backend.
|
||||
const submitForm = async () => {
|
||||
|
||||
|
|
@ -57,12 +56,14 @@ export default defineComponent({
|
|||
const profile = await invokeLogin({
|
||||
email: usr.value,
|
||||
password: pwd.value
|
||||
});
|
||||
}) as Profile;
|
||||
|
||||
/* emit event to app.vue */
|
||||
window.postMessage(profile);
|
||||
setProfile(profile)
|
||||
|
||||
} catch (e) console.log(e);
|
||||
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
<script lang="ts">
|
||||
|
||||
import { defineComponent, onMounted, onUnmounted } from "vue";
|
||||
import Message from "@/render/components/message.vue";
|
||||
import InputItem from "@/render/components/inputItem.vue";
|
||||
import Settings from "@/render/components/settings.vue";
|
||||
import useMessages from "./controllers/messenger.control";
|
||||
|
|
@ -31,7 +30,6 @@ export default defineComponent({
|
|||
props: ["profile", "messages"],
|
||||
|
||||
components: {
|
||||
Message,
|
||||
InputItem,
|
||||
Settings
|
||||
},
|
||||
|
|
@ -39,7 +37,7 @@ export default defineComponent({
|
|||
setup(props) {
|
||||
|
||||
// Handle messages in view.
|
||||
const { messagesRef, updateMessageView } = useMessages();
|
||||
const { messagesRef } = useMessages();
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@
|
|||
<script lang="ts">
|
||||
|
||||
import { defineComponent, ref } from "vue";
|
||||
import { useIpc } from "@/modules/ipc";
|
||||
import { logoutRequest } from '@/modules/message';
|
||||
import { useProfile } from "@/modules/auth"
|
||||
import { useProfile } from "@/render/composables/useProfile"
|
||||
import { invokeLogout } from "@/render/ipc";
|
||||
|
||||
export default defineComponent({
|
||||
|
|
@ -39,8 +37,6 @@
|
|||
setup() {
|
||||
const toggleSettings = ref(false);
|
||||
|
||||
const { post, invoke } = useIpc();
|
||||
|
||||
const { clearProfile } = useProfile();
|
||||
|
||||
// Listen for escape key to close settings.
|
||||
|
|
@ -63,8 +59,8 @@
|
|||
console.log("Submitting logout request.");
|
||||
|
||||
try {
|
||||
clearProfile();
|
||||
await invokeLogout();
|
||||
clearProfile();
|
||||
} catch(e) {
|
||||
console.log('error')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue