# Pull Request Template ## Description This PR will replace the usage of `alertMixin` from the code base with the `useAlert` composable. Fixes https://linear.app/chatwoot/issue/CW-3462/replace-alertmixin-usage-with-usealert ## Type of change - [x] Breaking change (fix or feature that would cause existing functionality not to work as expected) ## How Has This Been Tested? Please refer this issue description https://linear.app/chatwoot/issue/CW-3462/replace-alertmixin-usage-with-usealert ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Sojan Jose <sojan@pepalo.com>
99 lines
2.1 KiB
Vue
99 lines
2.1 KiB
Vue
<template>
|
|
<div class="w-full h-5 ltr:-ml-1 rtl:-mr-1">
|
|
<a
|
|
v-if="href"
|
|
:href="href"
|
|
class="flex items-center gap-2 text-slate-800 dark:text-slate-100 hover:underline"
|
|
>
|
|
<emoji-or-icon
|
|
:icon="icon"
|
|
:emoji="emoji"
|
|
icon-size="14"
|
|
class="flex-shrink-0 ltr:ml-1 rtl:mr-1"
|
|
/>
|
|
<span
|
|
v-if="value"
|
|
class="overflow-hidden text-sm whitespace-nowrap text-ellipsis"
|
|
:title="value"
|
|
>
|
|
{{ value }}
|
|
</span>
|
|
<span v-else class="text-sm text-slate-300 dark:text-slate-600">{{
|
|
$t('CONTACT_PANEL.NOT_AVAILABLE')
|
|
}}</span>
|
|
|
|
<woot-button
|
|
v-if="showCopy"
|
|
type="submit"
|
|
variant="clear"
|
|
size="tiny"
|
|
color-scheme="secondary"
|
|
icon="clipboard"
|
|
class-names="p-0"
|
|
@click="onCopy"
|
|
/>
|
|
</a>
|
|
|
|
<div
|
|
v-else
|
|
class="flex items-center gap-2 text-slate-800 dark:text-slate-100"
|
|
>
|
|
<emoji-or-icon
|
|
:icon="icon"
|
|
:emoji="emoji"
|
|
icon-size="14"
|
|
class="flex-shrink-0 ltr:ml-1 rtl:mr-1"
|
|
/>
|
|
<span
|
|
v-if="value"
|
|
class="overflow-hidden text-sm whitespace-nowrap text-ellipsis"
|
|
>
|
|
{{ value }}
|
|
</span>
|
|
<span v-else class="text-sm text-slate-300 dark:text-slate-600">{{
|
|
$t('CONTACT_PANEL.NOT_AVAILABLE')
|
|
}}</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { useAlert } from 'dashboard/composables';
|
|
import EmojiOrIcon from 'shared/components/EmojiOrIcon.vue';
|
|
import { copyTextToClipboard } from 'shared/helpers/clipboard';
|
|
|
|
export default {
|
|
components: {
|
|
EmojiOrIcon,
|
|
},
|
|
props: {
|
|
href: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
icon: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
emoji: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
value: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
showCopy: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
methods: {
|
|
async onCopy(e) {
|
|
e.preventDefault();
|
|
await copyTextToClipboard(this.value);
|
|
useAlert(this.$t('CONTACT_PANEL.COPY_SUCCESSFUL'));
|
|
},
|
|
},
|
|
};
|
|
</script>
|