fix: button inside tooltip is triggered twice

This commit is contained in:
Shariq Ansari 2025-03-22 14:37:37 +05:30
parent 72e499e845
commit ff52cf33d1
6 changed files with 128 additions and 105 deletions

View File

@ -43,25 +43,29 @@
attachment.is_private ? __('Make public') : __('Make private') attachment.is_private ? __('Make public') : __('Make private')
" "
> >
<Button <div>
class="!size-5" <Button
@click.stop=" class="!size-5"
togglePrivate(attachment.name, attachment.is_private) @click.stop="
" togglePrivate(attachment.name, attachment.is_private)
> "
<FeatherIcon >
:name="attachment.is_private ? 'lock' : 'unlock'" <FeatherIcon
class="size-3 text-ink-gray-7" :name="attachment.is_private ? 'lock' : 'unlock'"
/> class="size-3 text-ink-gray-7"
</Button> />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Delete attachment')"> <Tooltip :text="__('Delete attachment')">
<Button <div>
class="!size-5" <Button
@click.stop="() => deleteAttachment(attachment.name)" class="!size-5"
> @click.stop="() => deleteAttachment(attachment.name)"
<FeatherIcon name="trash-2" class="size-3 text-ink-gray-7" /> >
</Button> <FeatherIcon name="trash-2" class="size-3 text-ink-gray-7" />
</Button>
</div>
</Tooltip> </Tooltip>
</div> </div>
</div> </div>

View File

@ -42,9 +42,11 @@
@click.stop @click.stop
> >
<Tooltip :text="__('Change Status')"> <Tooltip :text="__('Change Status')">
<Button variant="ghosted" class="hover:bg-surface-gray-4"> <div>
<TaskStatusIcon :status="task.status" /> <Button variant="ghosted" class="hover:bg-surface-gray-4">
</Button> <TaskStatusIcon :status="task.status" />
</Button>
</div>
</Tooltip> </Tooltip>
</Dropdown> </Dropdown>
<Dropdown <Dropdown

View File

@ -52,22 +52,21 @@
v-for="assignee in assignees" v-for="assignee in assignees"
:key="assignee.name" :key="assignee.name"
> >
<Button <div>
:label="getUser(assignee.name).full_name" <Button :label="getUser(assignee.name).full_name" theme="gray">
theme="gray" <template #prefix>
> <UserAvatar :user="assignee.name" size="sm" />
<template #prefix> </template>
<UserAvatar :user="assignee.name" size="sm" /> <template #suffix>
</template> <FeatherIcon
<template #suffix> v-if="assignee.name !== owner"
<FeatherIcon class="h-3.5"
v-if="assignee.name !== owner" name="x"
class="h-3.5" @click.stop="removeValue(assignee.name)"
name="x" />
@click.stop="removeValue(assignee.name)" </template>
/> </Button>
</template> </div>
</Button>
</Tooltip> </Tooltip>
</div> </div>
<ErrorMessage class="mt-2" v-if="error" :message="__(error)" /> <ErrorMessage class="mt-2" v-if="error" :message="__(error)" />

View File

@ -51,15 +51,17 @@
</div> </div>
<div> <div>
<Tooltip text="Delete Invitation"> <Tooltip text="Delete Invitation">
<Button <div>
icon="x" <Button
variant="ghost" icon="x"
:loading=" variant="ghost"
pendingInvitations.delete.loading && :loading="
pendingInvitations.delete.params.name === user.name pendingInvitations.delete.loading &&
" pendingInvitations.delete.params.name === user.name
@click="pendingInvitations.delete.submit(user.name)" "
/> @click="pendingInvitations.delete.submit(user.name)"
/>
</div>
</Tooltip> </Tooltip>
</div> </div>
</li> </li>

View File

@ -75,38 +75,46 @@
</Tooltip> </Tooltip>
<div class="flex gap-1.5"> <div class="flex gap-1.5">
<Tooltip v-if="callEnabled" :text="__('Make a call')"> <Tooltip v-if="callEnabled" :text="__('Make a call')">
<Button class="h-7 w-7" @click="triggerCall"> <div>
<PhoneIcon class="h-4 w-4" /> <Button class="h-7 w-7" @click="triggerCall">
</Button> <PhoneIcon class="h-4 w-4" />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Send an email')"> <Tooltip :text="__('Send an email')">
<Button class="h-7 w-7"> <div>
<Email2Icon <Button class="h-7 w-7">
class="h-4 w-4" <Email2Icon
@click=" class="h-4 w-4"
deal.data.email @click="
? openEmailBox() deal.data.email
: errorMessage(__('No email set')) ? openEmailBox()
" : errorMessage(__('No email set'))
/> "
</Button> />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Go to website')"> <Tooltip :text="__('Go to website')">
<Button class="h-7 w-7"> <div>
<LinkIcon <Button class="h-7 w-7">
class="h-4 w-4" <LinkIcon
@click=" class="h-4 w-4"
deal.data.website @click="
? openWebsite(deal.data.website) deal.data.website
: errorMessage(__('No website set')) ? openWebsite(deal.data.website)
" : errorMessage(__('No website set'))
/> "
</Button> />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Attach a file')"> <Tooltip :text="__('Attach a file')">
<Button class="size-7" @click="showFilesUploader = true"> <div>
<AttachmentIcon class="size-4" /> <Button class="size-7" @click="showFilesUploader = true">
</Button> <AttachmentIcon class="size-4" />
</Button>
</div>
</Tooltip> </Tooltip>
</div> </div>
</div> </div>

View File

@ -117,46 +117,54 @@
</Tooltip> </Tooltip>
<div class="flex gap-1.5"> <div class="flex gap-1.5">
<Tooltip v-if="callEnabled" :text="__('Make a call')"> <Tooltip v-if="callEnabled" :text="__('Make a call')">
<Button <div>
class="h-7 w-7" <Button
@click=" class="h-7 w-7"
() => @click="
lead.data.mobile_no () =>
? makeCall(lead.data.mobile_no) lead.data.mobile_no
: errorMessage(__('No phone number set')) ? makeCall(lead.data.mobile_no)
" : errorMessage(__('No phone number set'))
> "
<PhoneIcon class="h-4 w-4" /> >
</Button> <PhoneIcon class="h-4 w-4" />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Send an email')"> <Tooltip :text="__('Send an email')">
<Button class="h-7 w-7"> <div>
<Email2Icon <Button class="h-7 w-7">
class="h-4 w-4" <Email2Icon
@click=" class="h-4 w-4"
lead.data.email @click="
? openEmailBox() lead.data.email
: errorMessage(__('No email set')) ? openEmailBox()
" : errorMessage(__('No email set'))
/> "
</Button> />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Go to website')"> <Tooltip :text="__('Go to website')">
<Button class="h-7 w-7"> <div>
<LinkIcon <Button class="h-7 w-7">
class="h-4 w-4" <LinkIcon
@click=" class="h-4 w-4"
lead.data.website @click="
? openWebsite(lead.data.website) lead.data.website
: errorMessage(__('No website set')) ? openWebsite(lead.data.website)
" : errorMessage(__('No website set'))
/> "
</Button> />
</Button>
</div>
</Tooltip> </Tooltip>
<Tooltip :text="__('Attach a file')"> <Tooltip :text="__('Attach a file')">
<Button class="h-7 w-7" @click="showFilesUploader = true"> <div>
<AttachmentIcon class="h-4 w-4" /> <Button class="h-7 w-7" @click="showFilesUploader = true">
</Button> <AttachmentIcon class="h-4 w-4" />
</Button>
</div>
</Tooltip> </Tooltip>
</div> </div>
<ErrorMessage :message="__(error)" /> <ErrorMessage :message="__(error)" />