110 Commits

Author SHA1 Message Date
d6113b2fc4 Add CRUDActions 2019-03-28 00:16:14 +08:00
32b527d92f Add CRUDReducer 2019-03-27 19:10:35 +08:00
58a0fb1772 Add /teams/new route 2019-03-26 20:37:15 +08:00
b38004a08a Add Modal.tsx 2019-03-26 20:33:00 +08:00
289ea00de8 Add tests more tests to TeamConnector.test.tsx 2019-03-26 14:29:44 +08:00
9dd6994498 Make HTTPClientMock#wait() to wait for all requests 2019-03-26 14:12:55 +08:00
d3f294a57c Add packages/client/src/crumbs 2019-03-25 18:30:32 +08:00
9b5809a1d5 Add Breadcrumbs 2019-03-25 17:32:12 +08:00
fbeea5ad3e Use Route in TeamManager.tsx 2019-03-25 17:21:43 +08:00
c83fa2d6d4 packages/client: Style TeamManager, fix error on delete 2019-03-25 13:28:09 +08:00
d5c4be2ac1 Sort imports 2019-03-24 09:48:08 +08:00
3bcf9d646e Style team manager 2019-03-23 22:50:44 +08:00
93b048bc10 Add correlationId to SqlLogger 2019-03-23 21:16:20 +08:00
cc360afbbe Use Route params in TeamConnector.tsx (untested)
TODO: Fix SQLite3 complaining

https://github.com/typeorm/typeorm/issues/307
2019-03-23 17:14:22 +08:00
3595a71cec Make TestUtils.tsx type safe
After spending almost two days in finding the issue, I ran across a few
TypeScript issues on their GitHub page:

- Loss of type inference converting to named parameters object
  https://github.com/Microsoft/TypeScript/issues/29791

- Parameter of a callback without a specified type next to it breaks code.
  https://github.com/Microsoft/TypeScript/issues/29799

- Convert to named parameters
  https://github.com/Microsoft/TypeScript/pull/30089

It became clear that TypeScript is unable to infer method return
arguments if a generic type is used more than once in generic parameter
object. Instead it returns {}.

For example, the following would fail on line 28:

    type Convert<A, B> = (value: A) => B

    interface IParams<C, D> {
      value: C
      convert: Convert<C, D>
      doConvert: (value: C, convert: this['convert']) => D
    }

    function doSomething<E, F>(value: E, convert: Convert<E, F>) {
      return convert(value)
    }

    function build<G, H>(params: IParams<G, H>) {
      const {value, convert} = params
      return params.doConvert(value, convert)
    }

    const outerResult = build({
      value: {
        a: {
          value: 1,
        },
        b: 'string',
      },
      convert: value => value.a,
      doConvert: (value, convert) => {
        const innerResult = doSomething(value, convert)
        innerResult.value
        console.log('innerResult:', innerResult)
        return innerResult
      },
    })

    console.log('outerResult:', outerResult)

With the message:

    Property 'value' does not exist on type '{}'.

If we replace parameter object IParams with regular ordered function
parameters, the compilation succeeds.

RyanCavanough (TS project lead) from GitHub commented:

> We don't have a separate pass to say "Go dive into the function and
> check to see if all its return statements don't rely on its parameter
> type" - doing so would be expensive in light of the fact that extremely
> few real-world functions actually behave like that in practice.

Source: https://github.com/Microsoft/TypeScript/issues/29799#issuecomment-464154659

These modifications bring type safety to TestUtils.tsx, and therefore
client-side tests of React components, while keeping almost the same
ease of use as before.
2019-03-23 15:48:52 +08:00
0af4aa9554 Fix broken RegisterForm.test.tsx 2019-03-22 14:46:09 +08:00
637b51382a Fix broken LoginForm.test.tsx 2019-03-22 14:43:43 +08:00
8f8c3b6c9c Refactor action definitions to type less 2019-03-22 13:26:58 +08:00
f2e44f477c Add better type checking when connecting components 2019-03-20 16:57:41 +05:00
150a02b344 Add team to @rondo/comments-client 2019-03-20 16:38:20 +05:00
8ae82c5065 Add ability to specify custom JSX in TestUtils 2019-03-20 15:28:05 +05:00
a628082a73 Add packages/client/src/team 2019-03-20 15:01:15 +05:00
dd358154b6 Add Narrow.tsx 2019-03-19 11:45:25 +05:00
c813407c95 Add LoginMenu.tsx 2019-03-18 20:18:52 +05:00
30a8c56119 Fix test for User firstName & lastName
Also fix CSRF token. This was probably broken since csurf middleware was
modified to use cookie instead of session storage to provide support for
single page app (SPA).
2019-03-18 15:53:05 +05:00
905501e053 packages/client: Use bloomer in login & register forms 2019-03-18 13:48:18 +05:00
003bccc9e8 projects/node: Add custom redirectTo after successful login 2019-03-18 13:13:52 +05:00
8733dc2c30 projects/node: Add Buildfile for packages/client 2019-03-18 12:46:10 +05:00
cf8aefd099 Add custom Redirect component
react-router v4 was made before React introduced a more performant
function renderToNodeStream to replace renderToString. All guides for
react-router are made using renderToString method, but I would love to
use the renderToNodeStream instead.

Since we cannot issue a 302 redirect after the page has already been
rendered (because status codes are written first), we can display a
<a> link with a text message. Once the React client-side library
hydrates the DOM Tree, the redirect should happen client side, so no
user action should be required.

This idea was taken from:
https://github.com/ReactTraining/react-router/issues/6191
2019-03-17 19:59:46 +05:00
3fae7adc4a Add isClientSide helper for server-side rendering 2019-03-17 19:42:26 +05:00
5f039f5f86 Add type to react-router context variable 2019-03-17 19:27:55 +05:00
85d5fd1110 Clear register & login forms after submit 2019-03-17 19:27:39 +05:00
5a34885605 Add withForm HOC, as well as RegisterForm 2019-03-17 15:05:02 +05:00
c2c72457db Add LoginForm to comments 2019-03-17 11:20:34 +05:00
49b77403f6 Add sample Nav 2019-03-16 16:57:09 +05:00
7b682c745c Fix react-router-dom for server-side rendering 2019-03-16 12:31:18 +05:00
10b034e7f0 Add react-router-dom, TODO fix SSR 2019-03-16 12:20:55 +05:00
360dc83ded Setup simple SSR, untested 2019-03-14 12:38:34 +05:00
6c2728228e Add render to comments-client 2019-03-13 19:07:49 +05:00
3257a6ffb4 Extract createStore into a separate module 2019-03-13 16:46:55 +05:00
ae670c8ea3 Fix compilation errors in @rondo/comments-client 2019-03-13 14:09:14 +05:00
93584575d9 Fix compile error in packages/client 2019-03-13 13:48:17 +05:00
2ed3aeac26 Add Routes to application 2019-01-24 17:55:49 +01:00
10e5775bf4 Add initial comments setup 2019-01-21 01:04:58 +01:00
6ee5077c88 Add documentation 2019-01-20 22:47:15 +01:00
380732d28a Add test for login failure 2019-01-20 22:12:51 +01:00
5c847b94e6 Add full test for LoginForm 2019-01-20 21:39:32 +01:00
bdf0aa57be Add TestUtils and a generic way to isolate connected components 2019-01-20 18:11:18 +01:00
0fcd8cbb03 Move login logic into a single folder 2019-01-20 00:48:22 +01:00
4f17f8d6a9 Return response.data from axios 2019-01-20 00:48:13 +01:00