This commit is contained in:
Saifeddine ALOUI 2023-07-09 19:45:43 +02:00
parent e615d12d8e
commit 9892504163
2 changed files with 4 additions and 1 deletions

View File

@ -113,6 +113,7 @@
<PersonalitiesCommands <PersonalitiesCommands
v-if="personalities_ready" v-if="personalities_ready"
:commandsList="this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands" :commandsList="this.$store.state.mountedPersArr[this.$store.state.config.active_personality_id].commands"
:sendCommand="sendMessageEvent"
ref="personalityCMD" ref="personalityCMD"
></PersonalitiesCommands> ></PersonalitiesCommands>
</div> </div>

View File

@ -5,7 +5,7 @@
<i data-feather="command" class="w-6 h-6"></i> <i data-feather="command" class="w-6 h-6"></i>
</button> </button>
<div v-if="showMenu" id="commands-menu-items" class="absolute mt-4 bg-white border border-gray-300 z-10"> <div v-if="showMenu" id="commands-menu-items" class="absolute mt-4 bg-white border border-gray-300 z-10">
<button v-for="command in commands" :key="command.value" @click.prevent="execute_cmd(command.value)" class="menu-button py-2 px-4 cursor-pointer bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 hover:bg-blue-400" :class="{ 'bg-blue-400 text-white': hoveredCommand === command.value }" :title="command.help" @mouseover="hoveredCommand = command.value" @mouseout="hoveredCommand = null" @click="executeCommand(command.value)"> <button v-for="command in commands" :key="command.value" @click.prevent="execute_cmd(command.value)" class="menu-button py-2 px-4 cursor-pointer bg-blue-500 text-white dark:bg-blue-200 dark:text-gray-800 hover:bg-blue-400" :class="{ 'bg-blue-400 text-white': hoveredCommand === command.value }" :title="command.help" @mouseover="hoveredCommand = command.value" @mouseout="hoveredCommand = null">
{{ command.name }} {{ command.name }}
</button> </button>
</div> </div>
@ -40,6 +40,7 @@ props: {
type: Array, type: Array,
required: true, required: true,
}, },
sendCommand:Function
}, },
data() { data() {
return { return {
@ -55,6 +56,7 @@ methods: {
}, },
execute_cmd(cmd) { execute_cmd(cmd) {
this.showMenu = !this.showMenu; this.showMenu = !this.showMenu;
this.sendCommand(cmd);
}, },
showHelp(command) { showHelp(command) {
this.showHelpText = true; this.showHelpText = true;