This commit is contained in:
Andrew Gundersen 2021-03-18 11:56:47 -05:00
commit 3849a3eaa8
3 changed files with 107 additions and 41 deletions

View file

@ -5,7 +5,8 @@
:class="{ playing: recording }"
:style="{ top: `${elementY}px`, left: `${elementX}px` }"
>
AG
<div>{{ initials }}</div>
<!-- Recording animation on space bar -->
<span v-if="recording" class="play"></span>
@ -22,14 +23,16 @@
<script lang="ts">
import { defineComponent } from "vue";
import { defineComponent, ref, onMounted } from "vue";
import draggify from "@/modules/draggify";
import TextInput from "@/components/inputItem/textInput.vue"
import { Profile } from "@/types/message/index";
import TextInput from "@/components/inputItem/textInput.vue";
import useTextInputController from
"@/components/inputItem/controllers/textCtrl"
"@/components/inputItem/controllers/textCtrl";
import useAudioInputController from
"@/components/inputItem/controllers/audioCtrl"
"@/components/inputItem/controllers/audioCtrl";
export default defineComponent({
name: "InputItem",
@ -38,6 +41,10 @@ export default defineComponent({
},
setup() {
// Mark input item with user's initials.
let initials = ref("")
initials.value = "IN";
// Initial position.
const xStart = 15;
const yStart = window.innerHeight - 200;
@ -52,6 +59,16 @@ export default defineComponent({
const { typing } = useTextInputController(elementX)
const { recording } = useAudioInputController(typing)
// Update profile functionality.
const onUpdateProfile = (_event: any, payload: Profile) => {
window.localStorage.setItem("profile", JSON.stringify(payload));
initials.value = payload.first[0] + payload.last[0]
}
onMounted(() => {
window.ipcRenderer.on("update-profile", onUpdateProfile);
})
return {
elementX,
elementY,