Show a notification when the user creates an order on limit, buys/sells on market, or cancels an order.
Implementation
I added two things to the store: an array of notifications and a flag that indicates whether there are unread notifications. There's also an action that pushes a new notification: when this action is called, the new notification is added to the list and the unread flag is set to true at the same time.
Notifications are modeled with a discriminated union type. All notifications have a timestamp, that is used to show when the notification was sent, using [react-timeago](https://github.com/nmn/react-timeago. Then every notification sub-type may have specific fields. You'll notice that all of them have amount and token properties. I decided not to include those in the base type because we may add other notifications later that won't need them.
Closes #34.
Show a notification when the user creates an order on limit, buys/sells on market, or cancels an order.
Implementation
I added two things to the store: an array of notifications and a flag that indicates whether there are unread notifications. There's also an action that pushes a new notification: when this action is called, the new notification is added to the list and the unread flag is set to true at the same time.
Notifications are modeled with a discriminated union type. All notifications have a timestamp, that is used to show when the notification was sent, using [
react-timeago
](https://github.com/nmn/react-timeago. Then every notification sub-type may have specific fields. You'll notice that all of them haveamount
andtoken
properties. I decided not to include those in the base type because we may add other notifications later that won't need them.