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/
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
import { computed } from 'vue';
|
|
import { isVoiceCallEnabled } from 'dashboard/helper/inbox';
|
|
|
|
export function useChannelIcon(inbox) {
|
|
const channelTypeIconMap = {
|
|
'Channel::Api': 'i-woot-api',
|
|
'Channel::Email': 'i-woot-mail',
|
|
'Channel::FacebookPage': 'i-woot-messenger',
|
|
'Channel::Line': 'i-woot-line',
|
|
'Channel::Sms': 'i-woot-sms',
|
|
'Channel::Telegram': 'i-woot-telegram',
|
|
'Channel::TwilioSms': 'i-woot-sms',
|
|
'Channel::TwitterProfile': 'i-woot-x',
|
|
'Channel::WebWidget': 'i-woot-website',
|
|
'Channel::Whatsapp': 'i-woot-whatsapp',
|
|
'Channel::Instagram': 'i-woot-instagram',
|
|
'Channel::Tiktok': 'i-woot-tiktok',
|
|
};
|
|
|
|
const providerIconMap = {
|
|
microsoft: 'i-woot-outlook',
|
|
google: 'i-woot-gmail',
|
|
};
|
|
|
|
const channelIcon = computed(() => {
|
|
const inboxDetails = inbox.value || inbox;
|
|
const type = inboxDetails.channel_type;
|
|
let icon = channelTypeIconMap[type];
|
|
|
|
if (type === 'Channel::Email' && inboxDetails.provider) {
|
|
if (Object.keys(providerIconMap).includes(inboxDetails.provider)) {
|
|
icon = providerIconMap[inboxDetails.provider];
|
|
}
|
|
}
|
|
|
|
// Special case for Twilio whatsapp
|
|
if (type === 'Channel::TwilioSms' && inboxDetails.medium === 'whatsapp') {
|
|
icon = 'i-woot-whatsapp';
|
|
}
|
|
|
|
// Special case for voice-enabled inboxes (Twilio, WhatsApp, etc.)
|
|
if (isVoiceCallEnabled(inboxDetails)) {
|
|
icon = 'i-woot-voice';
|
|
}
|
|
|
|
return icon ?? 'i-ri-global-fill';
|
|
});
|
|
|
|
return channelIcon;
|
|
}
|