Skip to content

Commit

Permalink
feat: show tooltip on macro button hover
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Willner <[email protected]>
  • Loading branch information
dw-0 committed Apr 14, 2024
1 parent 631e64c commit 1b7c8b6
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/components/inputs/MacroButton.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<template>
<v-item-group class="d-inline-block">
<v-btn
small
:color="color"
:class="paramArray.length ? 'macroWithParameters' : ''"
:loading="loadings.includes('macro_' + macro.name)"
:disabled="disabled"
@click="doSendMacro(macro.name)">
{{ alias ? alias : macro.name.replace(/_/g, ' ') }}
</v-btn>
<v-tooltip :disabled="!hasDescription" top>
<template #activator="{ on, attrs }">
<v-btn
small
:color="color"
:class="paramArray.length ? 'macroWithParameters' : ''"
:loading="loadings.includes('macro_' + macro.name)"
:disabled="disabled"
v-bind="attrs"
v-on="on"
@click="doSendMacro(macro.name)">
{{ alias ? alias : macro.name.replace(/_/g, ' ') }}
</v-btn>
</template>
<span>{{ klipperMacro.description }}</span>
</v-tooltip>
<template v-if="paramArray.length">
<v-menu v-if="!isMobile" offset-y :close-on-content-click="false">
<template #activator="{ on, attrs }">
Expand Down Expand Up @@ -118,6 +125,8 @@ interface params {
components: { Panel },
})
export default class MacroButton extends Mixins(BaseMixin) {
DEFAULT_DESC = 'G-Code macro'
/**
* Icons
*/
Expand Down Expand Up @@ -167,6 +176,10 @@ export default class MacroButton extends Mixins(BaseMixin) {
return 200 * this.paramCols
}
get hasDescription(): boolean {
return this.klipperMacro.description && this.klipperMacro.description !== this.DEFAULT_DESC
}
@Watch('klipperMacro')
klipperMacroChange() {
this.refreshParams()
Expand Down

0 comments on commit 1b7c8b6

Please sign in to comment.