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

Commit fe10403

Browse files
author
Jeff Moore
committed
Releasing v0.10.0
1 parent cd311ed commit fe10403

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+394
-491
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
name: "Team Chat Reference Application"
1313
before_install:
1414
- |
15-
echo '{
16-
"publishKey": "${PROD_PUBLISH_KEY}",
17-
"subscribeKey": "${PROD_SUBSCRIBE_KEY}"
18-
}' >> ./src/config/pubnub-keys.json
15+
echo '
16+
REACT_APP_PUBLISH_KEY="${DEV_PUBLISH_KEY}",
17+
REACT_APP_SUBSCRIBE_KEY="${DEV_SUBSCRIBE_KEY}"
18+
' >> .env
1919
install:
2020
- npm install
2121
script:

README.md

Lines changed: 4 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
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.
66

7+
Check out the [documentation](http://pubnub.github.io/typescript-ref-app-team-chat) to learn about advanced features like profanity filtering, gifs, and link previews.
8+
79
![alt text](team-chat-preview.png "Reference App")
810

911
The application demonstrates how to build a chat application using:
@@ -34,7 +36,7 @@ To run this application you must obtain publish and subscribe keys from your Pub
3436

3537
1. Enable the **Objects** feature. **Presence** and **PubNub Functions** should have been enabled when the keyset was created.
3638

37-
1. Select a region to store your user data (e.g. *US East*).
39+
1. Select a region to store your user data (e.g. *US East*). **DO NOT** enable user, channel, or membership events.
3840

3941
1. Locate the *Publish* and *Subscribe* keys. You'll need these keys to include in this project.
4042

@@ -43,7 +45,7 @@ To run this application you must obtain publish and subscribe keys from your Pub
4345
1. Clone the GitHub repository.
4446

4547
```bash
46-
git clone git@github.com:pubnub/typescript-ref-app-team-chat.git
48+
git clone https://github.com/pubnub/typescript-ref-app-team-chat.git
4749
```
4850

4951
1. Install the project.
@@ -61,119 +63,6 @@ To run this application you must obtain publish and subscribe keys from your Pub
6163

6264
A web browser should automatically open [http://localhost:3000](http://localhost:3000), and you can explore your very own Team Chat app!
6365

64-
## Enable rich message features *(optional)*
65-
66-
### Gif Picker
67-
68-
To enable the gif picker, you need a GIPHY API key.
69-
You can sign up for a (free) developer account and create a key from the [GIPHY developer dashboard](https://developers.giphy.com/dashboard/).
70-
71-
1. Create `.env` at the root of the project to hold your environment variables. This file will no be commited.
72-
73-
1. Copy the API key from the dashboard and add it to `.env`.
74-
75-
```dotenv
76-
GIPHY_API_KEY=your-api-key
77-
```
78-
79-
1. The variable needs to be exposed to the React app by adding another line.
80-
81-
```dotenv
82-
REACT_APP_GIPHY_API_KEY=$GIPHY_API_KEY
83-
```
84-
85-
86-
1. Restart the dev server for the changes to take effect.
87-
88-
```bash
89-
npm start
90-
```
91-
92-
93-
### Image Moderation
94-
95-
In addition to message moderation, AI powered moderation can be enabled to block innapropriate images.
96-
97-
You can sign up for a (free) account and API key from the [Sightengine dashboard](https://dashboard.sightengine.com/).
98-
99-
1. Add the **API User** and **API Secret** to your `.env` file.
100-
101-
```dotenv
102-
FUNCTIONS_SIGHTENGINE_API_SECRET=your-api-secret
103-
FUNCTIONS_SIGHTENGINE_API_USER=your-api-user
104-
```
105-
106-
### /giphy command
107-
108-
The `/giphy ${message}` command shares a gif related to the message.
109-
110-
1. You should have created a GIPHY API key in the [Gif Picker](#gif-picker) section. Exposed it to the function by adding another variable that references it.
111-
112-
```dotenv
113-
FUNCTIONS_GIPHY_API_KEY=$GIPHY_API_KEY
114-
```
115-
116-
### Deploy Functions
117-
118-
Link previews, message moderation, and the `/giphy` command are powered by PubNub functions. To enable these features, you'll need to build and deploy the function code in `/server`.
119-
120-
#### Option 1: Automatic Upload
121-
122-
> Note: To manage functions from the CLI, you have to sign in to your PubNub account. This is currently not possible if you created your account with SSO.
123-
124-
1. Use the CLI to build and deploy the functions from source (in `server/src`).
125-
126-
```bash
127-
npm run deploy:functions
128-
```
129-
130-
1. Enter your PubNub account email and password (these will **not** be saved).
131-
132-
1. Select your app and keyset using the up/down arrows and return to submit.
133-
134-
#### Option 2: Manual Upload
135-
136-
1. From the PubNub dashboard, select the keyset your are using. Then, open the functions tab (on the left). Enter a module name and description, then click **Create New Module**.
137-
138-
1. Click **Create Function**, give it a name, set the event type to *Before Publish or Fire* and enter `*` for the channel pattern and click **Create**.
139-
140-
1. Use the CLI to build the functions from source (in `server/src`).
141-
142-
```bash
143-
npm run build:functions
144-
```
145-
146-
1. After running the build command, a minified and compiled version of the function is available is `server/build/transformPublishedMessages.js`. Copy the contents of the file into the functions editor and click **Save**.
147-
148-
1. Click **Start Module** from the top right to deploy your function.
149-
150-
## Documentation
151-
152-
We've included additional documentation and a detailed tutorial for building a chat app with React, Redux, and PubNub.
153-
You can view it in the `/docs` directory or run the documentation site locally.
154-
155-
### Running the docs website
156-
157-
1. If you haven't already, clone the GitHub repository
158-
159-
```bash
160-
git clone [email protected]:pubnub/typescript-ref-app-team-chat.git
161-
```
162-
163-
1. Install the dependencies
164-
165-
```bash
166-
cd typescript-ref-app-team-chat/website
167-
npm install
168-
```
169-
170-
1. Run the docs website locally.
171-
172-
```bash
173-
npm start
174-
```
175-
If the chat app is already running, you may be asked to accept a different port. Your browser should open to [http//localhost:3000](http://localhost:3000) where you can find the tutorial and docs.
176-
17766
## Further Information
17867

17968
Checkout [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.
File renamed without changes.

docs/quickstart/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_label: Introduction
66

77
Team Chat is our group chat app with features like user login, joining/leaving group conversations, send/receive messages, members online/offline presence, typing indicators, profanity filtering and more. Its UI is built in React, and uses the PubNub Redux framework to manage client state on the application.
88

9-
![team chat preview](/img/team-chat-preview.png)
9+
![team chat preview](assets/team-chat-preview.png)
1010

1111
## Features
1212

docs/quickstart/run-locally.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ To run this application you must obtain publish and subscribe keys from your Pub
3636
1. Clone the GitHub repository.
3737

3838
```bash
39-
git clone git@github.com:pubnub/typescript-ref-app-team-chat.git
39+
git clone https://github.com/pubnub/typescript-ref-app-team-chat-private.git
4040
```
4141

4242
1. Install the project.

docs/tutorial/conversation-members.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_label: Conversation Members
77
Click the membership count at the top right of a conversation, and you’ll see the conversation’s member list.
88
Online members are placed at the top of the list and have a green dot, while offline members are below, and greyed out.
99

10-
![members list](/img/team-chat-member-list.png)
10+
![members list](assets/team-chat-member-list.png)
1111

1212
The `conversationMembers/ConversationMembers/ConversationMembers.tsx` component displays the list of members that belong to the conversations.
1313
It calls the [fetchMembers](https://www.pubnub.com/docs/chat/redux/members#fetchmembers) command to get the list of members in the conversation from PubNub and stores the members in the local store.

docs/tutorial/join-conversation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_label: Join Conversation
77
When you click the "+ button" on your list of joined conversations, the app displays an overlay listing all the other available conversations.
88
Click a conversation to join it and start receiving the messages from that conversation.
99

10-
![join a conversation](/img/join-conversations.png)
10+
![join a conversation](assets/join-conversations.png)
1111

1212
The `joinedConversations/JoinConversationDialog/JoinConversationDialog.tsx` component displays the dialog with a list of conversations that are available to join.
1313
The component calls the `getAllConversations` selector to fetch all conversations from the [local store](https://www.pubnub.com/docs/chat/redux/spaces?#state-shape).

docs/tutorial/joined-conversations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Introductions conversation is automatically selected when the app launches.
1010
You can join other conversations with the + button, and leave existing conversations with the Exit button.
1111
These features are covered in the [join conversation](/docs/tutorial/join-conversation) and [leave conversation](/docs/tutorial/leave-conversation) sections of the tutorial.
1212

13-
![conversations list](/img/team-chat-my-conversations.png)
13+
![conversations list](assets/team-chat-my-conversations.png)
1414

1515
The `joinedConversations/MyConversations/MyConversations.tsx` component gets the user’s list of conversations and allows the user to select a conversation.
1616
When the app loads, it selects the Introduction conversation by default.

docs/tutorial/leave-conversation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Hover over a conversation in your list of joined conversations to display a leav
88
Click it, and you’ll leave the conversation.
99
You'll no longer receiving messages sent to that conversation.
1010

11-
![leave a conversation](/img/leave-conversation.png)
11+
![leave a conversation](assets/leave-conversation.png)
1212

1313
The `joinedConversations/MyConversations/MyConversations.tsx` component displays the icon next to the user’s conversations to leave a conversation.
1414
The next section goes over the method that is called.

docs/tutorial/login.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar_label: User Login
66

77
While the splash screen displays, the app is selecting a user for you, and retrieving the conversations to which your user is subscribed.
88

9-
![splash screen](/img/team-chat-loading-screen.png)
9+
![splash screen](assets/team-chat-loading-screen.png)
1010

1111
## Select a User
1212

docs/tutorial/messages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Along the top of the conversation pane, the app displays details about the conve
88
Below that, the app shows messages in the conversation as they arrive.
99
At the bottom, we have a component to let us input text and emoji.
1010

11-
![a conversation](/img/team-chat-conversation.png)
11+
![a conversation](assets/team-chat-conversation.png)
1212

1313
Once a conversation is selected, the `currentConversation/CurrentConversation/CurrentConversation.tsx` component displays details of the conversation as well as its messages.
1414

docs/tutorial/profanity-filter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_label: Profanity Filter
77
Filtering input is a common request, as it helps automate moderation for busy chat applications.
88
An easy way to implement profanity filtering, in real time, is to implement a serverless [PubNub Function](https://www.pubnub.com/products/functions/).
99

10-
![profanity filtered chat](/img/profanity-filter.png)
10+
![profanity filtered chat](assets/profanity-filter.png)
1111

1212
Adding a profanity filter lets you moderate chat messages in real time as they go over the network.
1313
The function detects objectionable words in any given text, and lets you censor the content in a variety of ways.
@@ -25,7 +25,7 @@ By providing the ability to program the network, PubNub Functions simplifies dep
2525
Go to your [PubNub Dashboard](https://dashboard.pubnub.com/) and create a new module, and then create a new Before Publish function.
2626
The function should be set up to trigger on a specific set of channels (such as `chat.*`) or on all channels using wildcards (`*`).
2727

28-
![create a new function dashboard](/img/function-setup-1.png)
28+
![create a new function dashboard](assets/function-setup-1.png)
2929

3030
## Copy the Function Code
3131

docs/tutorial/pubnub.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Add PubNub to your App
44
sidebar_label: PubNub Integration
55
---
66

7-
When the app first loads, it runs the `main/App.tsx` component to initialize the [pubnub client](https://www.pubnub.com/docs/chat/reference/users#initialize-pubnub) with your publish and subscribe keys that are configured in the `config/pubnub-keys.json` file.
7+
When the app first loads, it runs the `main/App.tsx` component to initialize the [pubnub client](https://www.pubnub.com/docs/chat/reference/users#initialize-pubnub) with your publish and subscribe keys that are configured in the `.env` file.
88

99
The component also calls [pubnub.addListener()](https://www.pubnub.com/docs/chat/redux/using#register-listeners) to register all listeners at once (message listener, presence listener, and so on).
1010
The listener triggers events when the app receives messages, and automatically dispatches reducers to update the local store.
@@ -13,7 +13,7 @@ The listener triggers events when the app receives messages, and automatically d
1313
import Pubnub from "pubnub";
1414
import { createPubNubListener } from "pubnub-redux";
1515
import { PubNubProvider } from "pubnub-react";
16-
import keyConfiguration from "config/pubnub-keys.json";
16+
import keyConfiguration from "config/pubnub-keys";
1717
const pubnubConfig = Object.assign(
1818
{},{
1919
restore: true,

docs/tutorial/theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const custom = {
9898
} as const;
9999
```
100100

101-
![image](/img/dark-theme.png)
101+
![image](assets/dark-theme.png)
102102

103103
## Other Changes
104104

docs/tutorial/typing-indicators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_label: Typing Indicators
77
When someone is typing, the app displays a message showing the name of the user who is typing.
88
If more than one person is typing, the message changes to reflect that multiple users are typing.
99

10-
![typing indicators](/img/typing-indicator.png)
10+
![typing indicators](assets/typing-indicator.png)
1111

1212
The `typingIndicator/TypingIndicatorDisplay/TypingIndicatorDisplay.tsx` component adds logic to display typing indicators in the app.
1313
The typing indicators are displayed to all users in a conversation as a user is typing a message.

docs/tutorial/user-details.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar_label: User Details
77
In the top left section of the UI, the app shows details for the current user.
88
These include an avatar image, the user’s name and title, and the user’s network status.
99

10-
![user details](/img/team-chat-user-details.png)
10+
![user details](assets/team-chat-user-details.png)
1111

1212
The `currentUser/MyUserDetails.tsx` component displays the details for the user like name, title and profileUrl.
1313
The component calls `getUsersById()` selector to retrieve these user details from the [local store](https://www.pubnub.com/docs/chat/redux/users#state-shape).

package-lock.json

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)