Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit a739896

Browse files
author
Jeff
committed
Releasing v0.5.3.
1 parent 240b89d commit a739896

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,41 @@
22

33
[![Build Status](https://travis-ci.com/pubnub/typescript-ref-app-team-chat.svg?token=ey6rVJnpqsBKpxXy2fYF&branch=master)](https://travis-ci.com/pubnub/typescript-ref-app-team-chat)
44

5-
This repository contains the code for the Team Chat Reference Application hosted on [PubNub Chat Docs Page](https://www.pubnub.com/docs/chat/quickstart#quickstart).
5+
This repository contains the code for the Team Chat web reference application hosted on the [PubNub Chat Docs Page](https://www.pubnub.com/docs/chat/quickstart#quickstart). You can download the project to run on your local machine, and explore the code to see how we built it.
6+
7+
![alt text](team-chat-preview.png "Reference App")
68

79
The application demonstrates how to build a chat application using:
10+
811
- PubNub
912
- TypeScript
1013
- React
1114
- Redux
1215

13-
![alt text](team-chat-preview.png "Reference App")
14-
1516
## Requirements
1617

17-
* [Node.js](https://nodejs.org/en/)
18-
* PubNub Account (Free)
18+
- [Node.js](https://nodejs.org/en/)
19+
- [PubNub Account](#pubnub-account) (*Free*)
20+
21+
## PubNub Account
22+
23+
To run this application you must obtain publish and subscribe keys from your PubNub Account. If you don't already have an account, you can [create one for free](https://dashboard.pubnub.com/).
24+
25+
1. Sign in to your [PubNub Dashboard](https://dashboard.pubnub.com/).
26+
27+
1. Click **Create New App**.
1928

20-
### PubNub Account
29+
1. Give your app a name, and select **Chat App** as the app type.
2130

22-
If you don't already have an account, you can [create one for free](https://dashboard.pubnub.com/).
31+
1. Select a region to store your user data (e.g. *Portland*).
2332

24-
1. Sign in to your PubNub [Admin Dashboard](https://dashboard.pubnub.com/), click Create New App for PubNub Chat and give your app a name.
33+
1. Click **Create**.
2534

26-
1. Select your new app, then click its keyset.
35+
1. Click your new app to open its settings, then click its keyset.
2736

28-
1. Locate the Publish and Subscribe keys. You'll need these keys to include in this project.
37+
1. Locate the *Publish* and *Subscribe* keys. You'll need these keys to include in this project.
2938

30-
## Building the project
39+
## Running the project
3140

3241
1. Clone the GitHub repository.
3342

@@ -42,16 +51,16 @@ If you don't already have an account, you can [create one for free](https://dash
4251
npm install
4352
```
4453

45-
1. Run the project in your local environment. You may be asked to input your PubNub keys and populate sample data if you are running the app for the first time.
54+
1. Run the project in your local environment. If you are running the app for the first time, enter your PubNub keys to begin populating sample data.
4655

4756
```bash
4857
npm start
4958
```
5059

51-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
60+
A web browser should automatically open [http://localhost:3000](http://localhost:3000), and you can explore your very own Team Chat app!
5261

5362
## Further Information
5463

55-
Visit the [PubNub Chat Docs](https://www.pubnub.com/docs/chat) page for more information on how to use the React and Redux SDKs to add in-app chat to your applications.
64+
Visit the [PubNub Chat Docs](https://www.pubnub.com/docs/chat) page for more information about how to use the React and Redux SDKs to add in-app chat to your applications.
5665

57-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). Special thanks to Elvis Wolcott and Mark Erikson.
66+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). Special thanks to Martin Lagrange, Elvis Wolcott, and Mark Erikson.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"polished": "^3.4.1",
1616
"pubnub": "^4.27.0",
1717
"pubnub-react": "^2.0.0-beta.4",
18-
"pubnub-redux": "^0.1.31-alpha",
18+
"pubnub-redux": "^0.0.2-beta",
1919
"react": "^16.9.0",
2020
"react-dom": "^16.9.0",
2121
"react-pose": "^4.0.8",

src/features/currentConversation/Message/Message.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,21 @@ interface MessageProps {
3030
}
3131

3232
const Message = ({ message, avatar }: MessageProps) => {
33-
/*
34-
TODO: THere is a bug here. The message sender may not be loaded here due to errors in timing.
35-
But, usually, it does get loaded when the members in the conversation get loaded.
36-
if (message.message.sender === undefined) {
37-
return null;
38-
}
39-
*/
33+
// show unknown sender when sender is missing
34+
let sender = message.sender || { id: "unknown", name: "Unknown" };
4035

4136
return (
4237
<Wrapper>
4338
<Avatar>
4439
{avatar ? (
4540
avatar
4641
) : (
47-
<UserInitialsAvatar
48-
size={36}
49-
name={message.sender.name}
50-
uuid={message.sender.id}
51-
/>
42+
<UserInitialsAvatar size={36} name={sender.name} uuid={sender.id} />
5243
)}
5344
</Avatar>
5445
<Body>
5546
<Header>
56-
<SenderName>{message.sender.name}</SenderName>
47+
<SenderName>{sender.name}</SenderName>
5748
<TimeSent>{convertTimestampToTime(message.timetoken)}</TimeSent>
5849
</Header>
5950
<Content>{message.message.content.body}</Content>

0 commit comments

Comments
 (0)