kinda working

This commit is contained in:
AndzejsP 2023-06-13 12:57:28 +03:00
parent a9046e557a
commit 08cf1c3d8b
2 changed files with 20 additions and 25 deletions

View File

@ -2,8 +2,7 @@
<div class="absolute bottom-16 right-2 z-20 flex flex-col gap-3 min-w-[300px]">
<TransitionGroup name="toastItem" tag="div">
<div v-for=" t in toastArr" :key="t.id">
<div
class="flex items-center w-full max-w-xs p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
<div class="flex items-center w-full max-w-xs p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
role="alert">
<div class="flex flex-row items-center">
<slot>
@ -22,8 +21,7 @@
</slot>
</div>
<button type="button" @click="close(t.id)"
class="ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700"
>
class="ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700">
<span class="sr-only">Close</span>
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">

View File

@ -335,16 +335,18 @@
<!-- LIST OF MOUNTED PERSONALITIES -->
<div v-if="configFile.personalities"
class=" text-base font-semibold cursor-pointer select-none items-center ">
<!-- LIST -->
<div class="flex -space-x-4 items-center" v-if="mountedPersArr.length > 0">
<!-- ITEM -->
<div class="relative hover:-translate-y-2 duration-300 hover:z-10 shrink-0 "
v-for="(item, index) in mountedPersArr" :key="index + '-' + item.name">
<div class="group ">
<img :src="item.$refs.imgElement.src"
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 group-hover:border-secondary border-transparent"
:title="item.personality.name">
class="w-8 h-8 rounded-full object-fill text-red-700 border-2 active:scale-90 group-hover:border-secondary "
:class="item.selected ? 'border-secondary':'border-transparent z-0'"
:title="item.personality.name"
@click.stop="onPersonalitySelected(item)">
<span
class="hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent"
title="Unmount personality" @click.stop="unmountPersonality(item)">
@ -1368,46 +1370,41 @@ export default {
this.$refs.toast.showToast("Personality already mounted", 4, false)
return
}
pers.isMounted = true
const res = await this.mount_personality(pers.personality)
console.log('mount_personality res', res)
if (res.status) {
this.configFile.personalities = res.personalities
this.$refs.toast.showToast("Personality mounted", 4, true)
pers.isMounted = true
// this.configFile = await this.api_get_req("get_config")
// await this.getPersonalitiesArr().then(()=>{
// this.getMountedPersonalities()
// })
const res2 = await this.select_personality(pers)
if (res2.status) {
this.$refs.toast.showToast("Personality activated", 4, true)
this.$refs.toast.showToast("Selected personality:\n" + pers.personality.name, 4, true)
}
this.getMountedPersonalities()
} else {
this.$refs.toast.showToast("Could not mount personality", 4, false)
pers.isMounted = false
this.$refs.toast.showToast("Could not mount personality\nError: "+ res.error, 4, false)
}
},
async unmountPersonality(pers) {
if (!pers) { return }
pers.isMounted = false
const res = await this.unmount_personality(pers.personality)
console.log('ff', res)
if (res.status) {
this.configFile.personalities = res.personalities
this.$refs.toast.showToast("Personality unmounted", 4, true)
//this.refresh()
// this.configFile = await this.api_get_req("get_config")
// await this.getPersonalitiesArr().then(()=>{
// this.getMountedPersonalities()
// })
pers.isMounted = false
this.getMountedPersonalities()
} else {
this.$refs.toast.showToast("Could not unmount personality", 4, false)
this.$refs.toast.showToast("Could not unmount personality\nError: "+res.error, 4, false)
}