dynamic initials

This commit is contained in:
Andrew Gundersen 2021-03-18 15:53:32 -05:00
commit 2b61fbac96
10 changed files with 153 additions and 109 deletions

View file

@ -101,7 +101,6 @@ export default function useTextInputController(elementX: Ref) {
const onKeyDown = (e: KeyboardEvent) => {
const key = keyboardNameMap[e.keyCode]
console.log(key)
if (textInput) {

View file

@ -23,11 +23,9 @@
<script lang="ts">
import { defineComponent, ref, onMounted } from "vue";
import { defineComponent, ref, onMounted, onUnmounted } from "vue";
import draggify from "@/modules/draggify";
import { Profile } from "@/types/message/index";
import TextInput from "@/components/inputItem/textInput.vue";
import useTextInputController from
"@/components/inputItem/controllers/textCtrl";
@ -42,7 +40,7 @@ export default defineComponent({
setup() {
// Mark input item with user's initials.
let initials = ref("")
const initials = ref("")
initials.value = "IN";
// Initial position.
@ -60,19 +58,23 @@ export default defineComponent({
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]
const onUpdateProfile = (_event: any, payload: any) => {
initials.value = payload.message.first[0] + payload.message.last[0]
}
onMounted(() => {
window.ipcRenderer.on("update-profile", onUpdateProfile);
})
onUnmounted(() => {
window.ipcRenderer.removeAllListeners("update-profile");
})
return {
elementX,
elementY,
recording
recording,
initials
};
},
});