# Pull Request Template ## Description This PR includes the following updates: 1. Updated the design system color tokens by introducing new tokens for surfaces, overlays, buttons, labels, and cards, along with refinements to existing shades. 2. Refreshed both light and dark themes with adjusted background, border, and solid colors. 3. Replaced static Inter font files with the Inter variable font (including italic), supporting weights from 100–900. 4. Added custom font weights (420, 440, 460, 520) along with custom typography classes to enable more fine-grained and consistent typography control. ## Type of change - [x] New feature (non-breaking change which adds functionality) ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] 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 - [ ] 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: Pranav <pranav@chatwoot.com>
230 lines
6.3 KiB
Vue
230 lines
6.3 KiB
Vue
<script>
|
|
import Spinner from 'shared/components/Spinner.vue';
|
|
import { useAlert } from 'dashboard/composables';
|
|
import { mapGetters } from 'vuex';
|
|
import { useAgentsList } from 'dashboard/composables/useAgentsList';
|
|
|
|
import ThumbnailGroup from 'dashboard/components/widgets/ThumbnailGroup.vue';
|
|
import MultiselectDropdownItems from 'shared/components/ui/MultiselectDropdownItems.vue';
|
|
import NextButton from 'dashboard/components-next/button/Button.vue';
|
|
|
|
export default {
|
|
components: {
|
|
Spinner,
|
|
ThumbnailGroup,
|
|
MultiselectDropdownItems,
|
|
NextButton,
|
|
},
|
|
props: {
|
|
conversationId: {
|
|
type: [Number, String],
|
|
required: true,
|
|
},
|
|
},
|
|
setup() {
|
|
const { agentsList } = useAgentsList(false);
|
|
return {
|
|
agentsList,
|
|
};
|
|
},
|
|
data() {
|
|
return {
|
|
selectedWatchers: [],
|
|
showDropDown: false,
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters({
|
|
watchersUiFlas: 'conversationWatchers/getUIFlags',
|
|
currentUser: 'getCurrentUser',
|
|
}),
|
|
watchersFromStore() {
|
|
return this.$store.getters['conversationWatchers/getByConversationId'](
|
|
this.conversationId
|
|
);
|
|
},
|
|
watchersList: {
|
|
get() {
|
|
return this.selectedWatchers;
|
|
},
|
|
set(participants) {
|
|
this.selectedWatchers = [...participants];
|
|
const userIds = participants.map(el => el.id);
|
|
this.updateParticipant(userIds);
|
|
},
|
|
},
|
|
isUserWatching() {
|
|
return this.selectedWatchers.some(
|
|
watcher => watcher.id === this.currentUser.id
|
|
);
|
|
},
|
|
thumbnailList() {
|
|
return this.selectedWatchers.slice(0, 4);
|
|
},
|
|
moreAgentCount() {
|
|
const maxThumbnailCount = 4;
|
|
return this.watchersList.length - maxThumbnailCount;
|
|
},
|
|
moreThumbnailsText() {
|
|
if (this.moreAgentCount > 1) {
|
|
return this.$t('CONVERSATION_PARTICIPANTS.REMANING_PARTICIPANTS_TEXT', {
|
|
count: this.moreAgentCount,
|
|
});
|
|
}
|
|
return this.$t('CONVERSATION_PARTICIPANTS.REMANING_PARTICIPANT_TEXT', {
|
|
count: 1,
|
|
});
|
|
},
|
|
showMoreThumbs() {
|
|
return this.moreAgentCount > 0;
|
|
},
|
|
totalWatchersText() {
|
|
if (this.selectedWatchers.length > 1) {
|
|
return this.$t('CONVERSATION_PARTICIPANTS.TOTAL_PARTICIPANTS_TEXT', {
|
|
count: this.selectedWatchers.length,
|
|
});
|
|
}
|
|
return this.$t('CONVERSATION_PARTICIPANTS.TOTAL_PARTICIPANT_TEXT', {
|
|
count: 1,
|
|
});
|
|
},
|
|
},
|
|
watch: {
|
|
conversationId() {
|
|
this.fetchParticipants();
|
|
},
|
|
watchersFromStore(participants = []) {
|
|
this.selectedWatchers = [...participants];
|
|
},
|
|
},
|
|
mounted() {
|
|
this.fetchParticipants();
|
|
this.$store.dispatch('agents/get');
|
|
},
|
|
methods: {
|
|
fetchParticipants() {
|
|
const conversationId = this.conversationId;
|
|
this.$store.dispatch('conversationWatchers/show', { conversationId });
|
|
},
|
|
async updateParticipant(userIds) {
|
|
const conversationId = this.conversationId;
|
|
let alertMessage = this.$t(
|
|
'CONVERSATION_PARTICIPANTS.API.SUCCESS_MESSAGE'
|
|
);
|
|
|
|
try {
|
|
await this.$store.dispatch('conversationWatchers/update', {
|
|
conversationId,
|
|
userIds,
|
|
});
|
|
} catch (error) {
|
|
alertMessage =
|
|
error?.message ||
|
|
this.$t('CONVERSATION_PARTICIPANTS.API.ERROR_MESSAGE');
|
|
} finally {
|
|
useAlert(alertMessage);
|
|
}
|
|
this.fetchParticipants();
|
|
},
|
|
onOpenDropdown() {
|
|
this.showDropDown = true;
|
|
},
|
|
onCloseDropdown() {
|
|
this.showDropDown = false;
|
|
},
|
|
onClickItem(agent) {
|
|
const isAgentSelected = this.watchersList.some(
|
|
participant => participant.id === agent.id
|
|
);
|
|
|
|
if (isAgentSelected) {
|
|
const updatedList = this.watchersList.filter(
|
|
participant => participant.id !== agent.id
|
|
);
|
|
|
|
this.watchersList = [...updatedList];
|
|
} else {
|
|
this.watchersList = [...this.watchersList, agent];
|
|
}
|
|
},
|
|
onSelfAssign() {
|
|
this.watchersList = [...this.selectedWatchers, this.currentUser];
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="relative">
|
|
<div class="flex justify-between">
|
|
<div class="flex justify-between w-full mb-1">
|
|
<div>
|
|
<p v-if="watchersList.length" class="m-0 text-sm total-watchers">
|
|
<Spinner v-if="watchersUiFlas.isFetching" size="tiny" />
|
|
{{ totalWatchersText }}
|
|
</p>
|
|
<p v-else class="m-0 text-sm text-n-slate-10">
|
|
{{ $t('CONVERSATION_PARTICIPANTS.NO_PARTICIPANTS_TEXT') }}
|
|
</p>
|
|
</div>
|
|
<NextButton
|
|
v-tooltip.left="$t('CONVERSATION_PARTICIPANTS.ADD_PARTICIPANTS')"
|
|
slate
|
|
ghost
|
|
sm
|
|
icon="i-lucide-settings"
|
|
class="relative -top-1"
|
|
:title="$t('CONVERSATION_PARTICIPANTS.ADD_PARTICIPANTS')"
|
|
@click="onOpenDropdown"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center justify-between">
|
|
<ThumbnailGroup
|
|
:more-thumbnails-text="moreThumbnailsText"
|
|
:show-more-thumbnails-count="showMoreThumbs"
|
|
:users-list="thumbnailList"
|
|
/>
|
|
<p v-if="isUserWatching" class="m-0 text-sm text-n-slate-10">
|
|
{{ $t('CONVERSATION_PARTICIPANTS.YOU_ARE_WATCHING') }}
|
|
</p>
|
|
<NextButton
|
|
v-else
|
|
link
|
|
xs
|
|
icon="i-lucide-arrow-right"
|
|
class="!gap-1"
|
|
:label="$t('CONVERSATION_PARTICIPANTS.WATCH_CONVERSATION')"
|
|
@click="onSelfAssign"
|
|
/>
|
|
</div>
|
|
<div
|
|
v-on-clickaway="
|
|
() => {
|
|
onCloseDropdown();
|
|
}
|
|
"
|
|
:class="{
|
|
'block visible': showDropDown,
|
|
'hidden invisible': !showDropDown,
|
|
}"
|
|
class="border rounded-lg shadow-lg bg-n-alpha-3 absolute backdrop-blur-[100px] border-n-strong dark:border-n-strong p-2 z-[9999] box-border top-8 w-full"
|
|
>
|
|
<div class="flex items-center justify-between mb-1">
|
|
<h4
|
|
class="m-0 overflow-hidden text-sm whitespace-nowrap text-ellipsis text-n-slate-12"
|
|
>
|
|
{{ $t('CONVERSATION_PARTICIPANTS.ADD_PARTICIPANTS') }}
|
|
</h4>
|
|
<NextButton ghost slate xs icon="i-lucide-x" @click="onCloseDropdown" />
|
|
</div>
|
|
<MultiselectDropdownItems
|
|
:options="agentsList"
|
|
:selected-items="selectedWatchers"
|
|
has-thumbnail
|
|
@select="onClickItem"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|