Files
remark42/frontend
Dmitry VerkhoturovandUmputun d23d119d70 Add API methods for setting and deleting email (#483)
* add API methods for setting and deleting email

* fix service.SetStringUserDetail signature to return string

* switch table test with description to t.Run()

* remove debug logging

* clarify error handling, functions names

* add email integration test

* add information about email subscription to readme

* change email API calls method from PUT to POST

* typo fix, remove unneeded capturing of range variable

* email test draft

* fix notify mock, email notification test draft

* add MockDestination to startupT return

* fix tests

* add email retrieval for notifications sending

* fix mock for notify

* rearrange mock notify declaration

* add GET /email API handler, fix typos

* revert startupT signature change

* get rid of startupTWithDest workaround

* add rest examples for rest notification

* improve email messages formatting

* fix email send repeater location

* remove unneeded context from sendMessage

* change signatures of buildMessage functions to have same field name

* add missing authenticate call on TLS connection

* add dev user auth token to email requests

* change email verification template

* email code and tests cleanup

* replace fixed spaces with normal ones

* human-readable variables names for new comment reply notification

* rename Comment to CommentText

* add html for comment email notification

* fix comment notification html style

* fix email test

* fix notify email messages rendering

* fix comments on rest examples for email

* explicitly state email notify email template fields

* clarify email API documentation

* change email test not to check quoted-printable part of message

* Fix link color, add unsubscribe link

* fix rest examples tokens

* add UnsubscribeLink support to Email

* add unsubscribe email handler

* fix new reply notification email style
2019-12-16 16:39:55 -06:00
..
2019-11-05 12:45:06 -06:00
2019-07-29 13:47:35 -05:00
2019-07-29 13:47:35 -05:00
2019-09-29 14:09:00 -05:00
2019-04-28 19:27:36 +03:00
2019-04-28 19:27:36 +03:00
2019-10-28 02:30:49 +03:00
2019-10-28 02:46:34 +03:00
2019-10-28 02:46:34 +03:00
2019-04-28 19:27:36 +03:00
2019-04-28 19:27:36 +03:00
2019-04-28 19:27:36 +03:00
2019-10-28 02:30:49 +03:00
2019-10-28 02:30:49 +03:00

Frontend guide

Code Style

  • project uses typescript to statically analyze code
  • project uses eslint to check frontend code. You can manually run via npm run lint.
  • git hooks (via husky) installed automatically on npm install and check and try to fix code style if possible, otherwise commit will be rejected
  • if you want IDE integration, you need eslint plugin to be installed.

CSS Styles

  • although styles have scss extension, it is actually pack of post-css plugins, so syntax differs, for example in calc function.
  • component styles use BEM notation (at least it should): block__element_modifier. Also there are mix classes: block_modifier.
  • component base style resides in the component's root directory with name of component converted to kebab-case. For example ListComments style is located in ./app/components/list-comments/list-comments/scss
  • component's element style resides in its own subdirectory, with name consisting of full elements selector, for example ListComments item element is placed in __item directory under name ./list-comments__item.scss
  • each style should be required in index.ts of component's root directory

Imports

  • imports for typescript, javascript files should be without extension: ./index, not ./index.ts
  • if file resides in same directory or in subdirectory import should be relative: ./types/something
  • otherwise it should start from @app namespace: @app/common/store which mapped to /app/common/store.ts in webpack, tsconfig and jest

Testing

  • project uses jest as test harness.
  • jest check files that match regex \.test\.(j|t)s(x?)$, i.e comment.test.tsx, comment.test.js
  • tests are running on push attempt
  • example tests can be found in ./app/store/user/reducers.test.ts, ./app/components/auth-panel/auth-panel.test.tsx

Notes

  • Frontend part being bundled on docker env gets placed on /src/web and is available via http://{host}/web. for example embed.js entry point will be availabale at http://{host}/web/embed.js