Skip to content

Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬

fix: show attributes empty state with a create link in the sidebar (#16234)

Gihovani Filipp Pereira Demétrio75cdd57ab401
diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue
index 433e336e8de..6d50e9dee56 100644
--- a/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue
+++ b/app/javascript/dashboard/routes/dashboard/conversation/ContactPanel.vue
@@ -227,9 +227,6 @@ onMounted(() => {
attribute-type="contact_attribute"
attribute-from="conversation_contact_panel"
:contact-id="contact.id"
- :empty-state-message="
- $t('CONVERSATION_CUSTOM_ATTRIBUTES.NO_RECORDS_FOUND')
- "
/>
</AccordionItem>
</div>
diff --git a/app/javascript/dashboard/routes/dashboard/conversation/customAttributes/CustomAttributes.vue b/app/javascript/dashboard/routes/dashboard/conversation/customAttributes/CustomAttributes.vue
index 1c7327967f7..9c5d597c45e 100644
--- a/app/javascript/dashboard/routes/dashboard/conversation/customAttributes/CustomAttributes.vue
+++ b/app/javascript/dashboard/routes/dashboard/conversation/customAttributes/CustomAttributes.vue
@@ -7,6 +7,7 @@ import { useStore, useStoreGetters } from 'dashboard/composables/store';
import { useAlert } from 'dashboard/composables';
import { useI18n } from 'vue-i18n';
import { useUISettings } from 'dashboard/composables/useUISettings';
+import { useAdmin } from 'dashboard/composables/useAdmin';
import { copyTextToClipboard } from 'shared/helpers/clipboard';
import CustomAttribute from 'dashboard/components/CustomAttribute.vue';
import NextButton from 'dashboard/components-next/button/Button.vue';
@@ -21,10 +22,6 @@ const props = defineProps({
type: String,
required: true,
},
- emptyStateMessage: {
- type: String,
- default: '',
- },
// Combine static elements with custom attributes components
// To allow for custom ordering
staticElements: {
@@ -38,6 +35,7 @@ const getters = useStoreGetters();
const route = useRoute();
const { t } = useI18n();
const { uiSettings, updateUISettings } = useUISettings();
+const { isAdmin } = useAdmin();
const dragging = ref(false);
@@ -305,12 +303,20 @@ const evenClass = [
</template>
</Draggable>
- <p
- v-if="!displayedElements.length && emptyStateMessage"
- class="p-3 text-center"
- >
- {{ emptyStateMessage }}
- </p>
+ <div v-if="!displayedElements.length" class="p-3">
+ <p class="text-center">
+ {{ t('CONVERSATION_CUSTOM_ATTRIBUTES.NO_RECORDS_FOUND') }}
+ </p>
+ <router-link v-if="isAdmin" :to="{ name: 'attributes_list' }">
+ <NextButton
+ faded
+ xs
+ icon="i-lucide-plus"
+ class="mt-1"
+ :label="t('CONVERSATION_CUSTOM_ATTRIBUTES.ADD_BUTTON_TEXT')"
+ />
+ </router-link>
+ </div>
<!-- Show more and show less buttons show it if the combinedElements length is greater than 5 -->
<div v-if="combinedElements.length > 5" class="flex items-center px-2 py-2">
<NextButton