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/
77 lines
2.3 KiB
Vue
77 lines
2.3 KiB
Vue
<script setup>
|
|
import { computed } from 'vue';
|
|
import { useMapGetter } from 'dashboard/composables/store.js';
|
|
import Icon from 'next/icon/Icon.vue';
|
|
|
|
const props = defineProps({
|
|
to: { type: [Object, String], default: '' },
|
|
label: { type: String, default: '' },
|
|
icon: { type: [String, Object], default: '' },
|
|
expandable: { type: Boolean, default: false },
|
|
isExpanded: { type: Boolean, default: false },
|
|
isActive: { type: Boolean, default: false },
|
|
hasActiveChild: { type: Boolean, default: false },
|
|
getterKeys: { type: Object, default: () => ({}) },
|
|
});
|
|
|
|
const emit = defineEmits(['toggle']);
|
|
|
|
const showBadge = useMapGetter(props.getterKeys.badge);
|
|
const dynamicCount = useMapGetter(props.getterKeys.count);
|
|
const count = computed(() =>
|
|
dynamicCount.value > 99 ? '99+' : dynamicCount.value
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<component
|
|
:is="to ? 'router-link' : 'div'"
|
|
class="flex items-center gap-2 px-1.5 py-1 rounded-lg h-8 min-w-0"
|
|
role="button"
|
|
draggable="false"
|
|
:to="to"
|
|
:title="label"
|
|
:class="{
|
|
'text-n-slate-12 bg-n-alpha-2 font-medium': isActive && !hasActiveChild,
|
|
'text-n-slate-12 font-medium': hasActiveChild,
|
|
'text-n-slate-11 hover:bg-n-alpha-2': !isActive && !hasActiveChild,
|
|
}"
|
|
@click.stop="emit('toggle')"
|
|
>
|
|
<div v-if="icon" class="relative flex items-center gap-2">
|
|
<Icon v-if="icon" :icon="icon" class="size-4" />
|
|
<span
|
|
v-if="showBadge"
|
|
class="size-2 -top-px ltr:-right-px rtl:-left-px bg-n-brand absolute rounded-full border border-n-solid-2"
|
|
/>
|
|
</div>
|
|
<div class="flex items-center gap-1.5 flex-grow min-w-0 flex-1">
|
|
<span
|
|
class="truncate"
|
|
:class="{
|
|
'text-body-main': !isActive,
|
|
'font-medium text-sm': isActive || hasActiveChild,
|
|
}"
|
|
>
|
|
{{ label }}
|
|
</span>
|
|
<span
|
|
v-if="dynamicCount && !expandable"
|
|
class="rounded-md capitalize text-xs leading-5 font-medium text-center outline outline-1 px-1 flex-shrink-0"
|
|
:class="{
|
|
'text-n-slate-12 outline-n-slate-6': isActive,
|
|
'text-n-slate-11 outline-n-strong': !isActive,
|
|
}"
|
|
>
|
|
{{ count }}
|
|
</span>
|
|
</div>
|
|
<span
|
|
v-if="expandable"
|
|
v-show="isExpanded"
|
|
class="i-lucide-chevron-up size-3"
|
|
@click.stop="emit('toggle')"
|
|
/>
|
|
</component>
|
|
</template>
|