listmonk/frontend
Kailash Nadh b5cd9498b1 Refactore all CRUD functions to a new core package.
This is a long pending refactor. All the DB, query, CRUD, and related
logic scattered across HTTP handlers are now moved into a central
`core` package with clean, abstracted methods, decoupling HTTP
handlers from executing direct DB queries and other business logic.

eg: `core.CreateList()`, `core.GetLists()` etc.

- Remove obsolete subscriber methods.
- Move optin hook queries to core.
- Move campaign methods to `core`.
- Move all campaign methods to `core`.
- Move public page functions to `core`.
- Move all template functions to `core`.
- Move media and settings function to `core`.
- Move handler middleware functions to `core`.
- Move all bounce functions to `core`.
- Move all dashboard functions to `core`.
- Fix GetLists() not honouring type
- Fix unwrapped JSON responses.
- Clean up obsolete pre-core util function.
- Replace SQL array null check with cardinality check.
- Fix missing validations in `core` queries.
- Remove superfluous deps on internal `subimporter`.
- Add dashboard functions to `core`.
- Fix broken domain ban check.
- Fix broken subscriber check middleware.
- Remove redundant error handling.
- Remove obsolete functions.
- Remove obsolete structs.
- Remove obsolete queries and DB functions.
- Document the `core` package.
2022-05-03 10:50:29 +05:30
..
cypress Refactore all CRUD functions to a new core package. 2022-05-03 10:50:29 +05:30
fontello improved mobile navbar/sidebar (#574) 2021-11-10 00:26:34 +05:30
public Add support for custom CSS/JS in settings for admin and public pages. 2021-12-18 15:38:42 +05:30
src Sanitize HTML in Buefy dialogs. 2022-05-01 12:14:01 +05:30
.browserslistrc Rewrite frontend with Vue+Buevy and ditch React+Ant Design. 2020-07-04 00:12:14 +05:30
.editorconfig Rewrite frontend with Vue+Buevy and ditch React+Ant Design. 2020-07-04 00:12:14 +05:30
.env.sample fix: use inbuilt frontend dev server to proxy API 2020-10-03 04:50:07 +05:30
.eslintrc.js Rewrite frontend with Vue+Buevy and ditch React+Ant Design. 2020-07-04 00:12:14 +05:30
.gitignore Rewrite frontend with Vue+Buevy and ditch React+Ant Design. 2020-07-04 00:12:14 +05:30
babel.config.js Rewrite frontend with Vue+Buevy and ditch React+Ant Design. 2020-07-04 00:12:14 +05:30
cypress.json Fix broken Cypress UI tests. 2021-12-09 20:47:52 +05:30
package.json Upgrade Cypress. 2022-03-19 13:44:06 +05:30
README.md Fix typos 2022-02-13 08:54:39 -08:00
vue.config.js Add support for custom CSS/JS in settings for admin and public pages. 2021-12-18 15:38:42 +05:30
yarn.lock Bump async from 2.6.3 to 2.6.4 in /frontend 2022-04-29 17:20:14 +00:00

listmonk frontend (Vue + Buefy)

It's best if the listmonk/frontend directory is opened in an IDE as a separate project where the frontend directory is the root of the project.

For developer setup instructions, refer to the main project's README.

Globals

In main.js, Buefy and vue-i18n are attached globally. In addition:

  • $api (collection of API calls from api/index.js)
  • $utils (util functions from util.js). They are accessible within Vue as this.$api and this.$utils.

Some constants are defined in constants.js.

APIs and states

The project uses a global vuex state to centrally store the responses to pretty much all APIs (eg: fetch lists, campaigns etc.) except for a few exceptions. These are called models and have been defined in constants.js. The definitions are in store/index.js.

There is a global state loading (eg: loading.campaigns, loading.lists) that indicates whether an API call for that particular "model" is running. This can be used anywhere in the project to show loading spinners for instance. All the API definitions are in api/index.js. It also describes how each API call sets the global loading status alongside storing the API responses.

IMPORTANT: All JSON field names in GET API responses are automatically camel-cased when they're pulled for the sake of consistency in the frontend code and for complying with the linter spec in the project (Vue/AirBnB schema). For example, content_type becomes contentType. When sending responses to the backend, however, they should be snake-cased manually. This is overridden for certain calls such as /api/config and /api/settings using the preserveCase: true param in api/index.js.

Icon pack

Buefy by default uses Material Design Icons (MDI) with icon classes prefixed by mdi-.

listmonk uses only a handful of icons from the massive MDI set packed as web font, using Fontello. To add more icons to the set using fontello:

  • Go to Fontello and drag and drop frontend/fontello/config.json (This is the full MDI set converted from TTF to SVG icons to work with Fontello).
  • Use the UI to search for icons and add them to the selection (add icons from under the Custom section)
  • Download the Fontello pack and from the ZIP:
    • Copy and overwrite config.json to frontend/fontello
    • Copy fontello.woff2 to frontend/src/assets/icons.
    • Open css/fontello.css and copy the individual icon definitions and overwrite the ones in frontend/src/assets/icons/fontello.css