UserCard - allow changing nick
This commit is contained in:
@@ -1,21 +1,17 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
import { useIRCStore } from "@/stores/irc";
|
||||
|
||||
const store = useIRCStore();
|
||||
const inputBuffer = ref();
|
||||
|
||||
onMounted(store.connect);
|
||||
|
||||
function send() {
|
||||
store.sendActiveBuffer(inputBuffer.value);
|
||||
inputBuffer.value = "";
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="d-flex flex-row" style="height: 100vh">
|
||||
<v-sheet border class="buffers">
|
||||
<UserCard />
|
||||
<v-divider />
|
||||
<BufferList />
|
||||
</v-sheet>
|
||||
<div class="messages d-flex flex-column">
|
||||
@@ -30,14 +26,16 @@ function send() {
|
||||
:me="store.clientInfo.nick"
|
||||
/>
|
||||
<v-sheet>
|
||||
<v-text-field
|
||||
variant="outlined"
|
||||
:placeholder="`Message ${store.activeBufferName}`"
|
||||
v-model="inputBuffer"
|
||||
hide-details
|
||||
class="ma-2"
|
||||
@keydown.enter.exact.prevent="send"
|
||||
/>
|
||||
<!-- <v-text-field -->
|
||||
<!-- variant="outlined" -->
|
||||
<!-- :placeholder="`Message ${store.activeBufferName}`" -->
|
||||
<!-- v-model="inputBuffer" -->
|
||||
<!-- hide-details -->
|
||||
<!-- class="ma-2" -->
|
||||
<!-- @keydown.enter.exact.prevent="send" -->
|
||||
<!-- /> -->
|
||||
|
||||
<InputBuffer @send="store.sendActiveBuffer" />
|
||||
</v-sheet>
|
||||
</div>
|
||||
<v-sheet class="user-list h-100" border>
|
||||
|
||||
44
irchad-web/src/components/UserCard.vue
Normal file
44
irchad-web/src/components/UserCard.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { useIRCStore } from "@/stores/irc";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
const { selfAvatar } = storeToRefs(useIRCStore());
|
||||
const { client, clientInfo, setAvatar, setNick } = useIRCStore();
|
||||
const avatarDialog = ref(false);
|
||||
const newNick = ref();
|
||||
|
||||
function changeAvatar() {
|
||||
avatarDialog.value = true;
|
||||
}
|
||||
|
||||
function submitAvatar() {
|
||||
setAvatar(selfAvatar.value);
|
||||
avatarDialog.value = false;
|
||||
if (newNick.value && clientInfo.nick !== newNick.value) {
|
||||
console.log("nick changed");
|
||||
client.changeNick(newNick.value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="avatarDialog">
|
||||
<v-card title="Edit Profile">
|
||||
<v-card-text>
|
||||
<v-text-field v-model="selfAvatar" label="Avatar URL" />
|
||||
<v-text-field v-model="newNick" label="Nick" />
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn text="OK" @click="submitAvatar" />
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<v-avatar @click="changeAvatar" v-if="selfAvatar" :image="selfAvatar" />
|
||||
{{ clientInfo.nick }}
|
||||
</v-card-title>
|
||||
<v-card-text> </v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
Reference in New Issue
Block a user