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/
85 lines
1.7 KiB
JavaScript
85 lines
1.7 KiB
JavaScript
import * as types from '../mutation-types';
|
|
|
|
const state = {
|
|
currentPage: {
|
|
me: 0,
|
|
unassigned: 0,
|
|
all: 0,
|
|
appliedFilters: 0,
|
|
},
|
|
hasEndReached: {
|
|
me: false,
|
|
unassigned: false,
|
|
all: false,
|
|
},
|
|
};
|
|
|
|
export const getters = {
|
|
getHasEndReached: $state => filter => {
|
|
return $state.hasEndReached[filter];
|
|
},
|
|
getCurrentPageFilter: $state => filter => {
|
|
return $state.currentPage[filter];
|
|
},
|
|
getCurrentPage: $state => {
|
|
return $state.currentPage;
|
|
},
|
|
};
|
|
|
|
export const actions = {
|
|
setCurrentPage({ commit }, { filter, page }) {
|
|
commit(types.default.SET_CURRENT_PAGE, { filter, page });
|
|
},
|
|
setEndReached({ commit }, { filter }) {
|
|
commit(types.default.SET_CONVERSATION_END_REACHED, { filter });
|
|
},
|
|
reset({ commit }) {
|
|
commit(types.default.CLEAR_CONVERSATION_PAGE);
|
|
},
|
|
};
|
|
|
|
export const mutations = {
|
|
[types.default.SET_CURRENT_PAGE]: ($state, { filter, page }) => {
|
|
$state.currentPage = {
|
|
...$state.currentPage,
|
|
[filter]: page,
|
|
};
|
|
},
|
|
[types.default.SET_CONVERSATION_END_REACHED]: ($state, { filter }) => {
|
|
if (filter === 'all') {
|
|
$state.hasEndReached = {
|
|
...$state.hasEndReached,
|
|
unassigned: true,
|
|
me: true,
|
|
};
|
|
}
|
|
$state.hasEndReached = {
|
|
...$state.hasEndReached,
|
|
[filter]: true,
|
|
};
|
|
},
|
|
[types.default.CLEAR_CONVERSATION_PAGE]: $state => {
|
|
$state.currentPage = {
|
|
me: 0,
|
|
unassigned: 0,
|
|
all: 0,
|
|
appliedFilters: 0,
|
|
};
|
|
|
|
$state.hasEndReached = {
|
|
me: false,
|
|
unassigned: false,
|
|
all: false,
|
|
appliedFilters: false,
|
|
};
|
|
},
|
|
};
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters,
|
|
actions,
|
|
mutations,
|
|
};
|