Copy the Chatwoot (v4.14.0) frontend runnable subset into frontend/ for customization: - app/javascript/ (Vue SPA: dashboard, widget, sdk, portal, superadmin) - app/views/ (ERB templates for vite-plugin-ruby entrypoint resolution) - app/helpers/, app/assets/ (Rails view helpers, static assets) - enterprise/ (Enterprise edition frontend overlay) - config/vite.json, vite.config.ts, bin/vite (Vite-Rails toolchain) - package.json, pnpm-lock.yaml, tailwind/postcss/eslint configs - Gemfile, Gemfile.lock (vite_rails gem for bin/vite binstub) Excluded Rails backend: controllers, models, services, jobs, mailers, policies, db, lib, spec, public, node_modules. Update references to the new frontend location: - .gitignore: exclude frontend build artifacts (node_modules, tmp, packs), keep frontend/bin/ and frontend/vendor/ via negation - backend/scripts/parity_frontend_smoke.sh: CHATWOOT_DIR default reference/chatwoot -> ../frontend - backend/scripts/parity_frontend_browser_smoke.mjs: same default update - AGENTS.md: add frontend section with Rails/Vite coupling notes - README: architecture tree includes frontend/
78 lines
2.2 KiB
Vue
78 lines
2.2 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import {
|
|
VOICE_CALL_STATUS,
|
|
VOICE_CALL_DIRECTION,
|
|
} from 'dashboard/components-next/message/constants';
|
|
import Icon from 'dashboard/components-next/icon/Icon.vue';
|
|
|
|
const props = defineProps({
|
|
status: { type: String, default: '' },
|
|
direction: { type: String, default: '' },
|
|
messagePreviewClass: { type: [String, Array, Object], default: '' },
|
|
});
|
|
|
|
const LABEL_KEYS = {
|
|
[VOICE_CALL_STATUS.IN_PROGRESS]: 'CONVERSATION.VOICE_CALL.CALL_IN_PROGRESS',
|
|
[VOICE_CALL_STATUS.COMPLETED]: 'CONVERSATION.VOICE_CALL.CALL_ENDED',
|
|
};
|
|
|
|
const ICON_MAP = {
|
|
[VOICE_CALL_STATUS.IN_PROGRESS]: 'i-ph-phone-call',
|
|
[VOICE_CALL_STATUS.NO_ANSWER]: 'i-ph-phone-x',
|
|
[VOICE_CALL_STATUS.FAILED]: 'i-ph-phone-x',
|
|
};
|
|
|
|
const COLOR_MAP = {
|
|
[VOICE_CALL_STATUS.IN_PROGRESS]: 'text-n-teal-9',
|
|
[VOICE_CALL_STATUS.RINGING]: 'text-n-teal-9',
|
|
[VOICE_CALL_STATUS.COMPLETED]: 'text-n-slate-11',
|
|
[VOICE_CALL_STATUS.NO_ANSWER]: 'text-n-ruby-9',
|
|
[VOICE_CALL_STATUS.FAILED]: 'text-n-ruby-9',
|
|
};
|
|
|
|
const isOutbound = computed(
|
|
() => props.direction === VOICE_CALL_DIRECTION.OUTBOUND
|
|
);
|
|
const isFailed = computed(() =>
|
|
[VOICE_CALL_STATUS.NO_ANSWER, VOICE_CALL_STATUS.FAILED].includes(props.status)
|
|
);
|
|
|
|
const labelKey = computed(() => {
|
|
if (LABEL_KEYS[props.status]) return LABEL_KEYS[props.status];
|
|
if (props.status === VOICE_CALL_STATUS.RINGING) {
|
|
return isOutbound.value
|
|
? 'CONVERSATION.VOICE_CALL.OUTGOING_CALL'
|
|
: 'CONVERSATION.VOICE_CALL.INCOMING_CALL';
|
|
}
|
|
return isFailed.value
|
|
? 'CONVERSATION.VOICE_CALL.MISSED_CALL'
|
|
: 'CONVERSATION.VOICE_CALL.INCOMING_CALL';
|
|
});
|
|
|
|
const iconName = computed(() => {
|
|
if (ICON_MAP[props.status]) return ICON_MAP[props.status];
|
|
return isOutbound.value ? 'i-ph-phone-outgoing' : 'i-ph-phone-incoming';
|
|
});
|
|
|
|
const statusColor = computed(
|
|
() => COLOR_MAP[props.status] || 'text-n-slate-11'
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<div
|
|
class="my-0 mx-2 leading-6 h-6 flex-1 min-w-0 text-sm overflow-hidden text-ellipsis whitespace-nowrap"
|
|
:class="messagePreviewClass"
|
|
>
|
|
<Icon
|
|
class="inline-block -mt-0.5 align-middle size-4"
|
|
:icon="iconName"
|
|
:class="statusColor"
|
|
/>
|
|
<span class="mx-1" :class="statusColor">
|
|
{{ $t(labelKey) }}
|
|
</span>
|
|
</div>
|
|
</template>
|