Giter Club home page Giter Club logo

stream-chat-angular's Introduction

Official Angular SDK for Stream Chat

The official Angular components for Stream Chat, a service for building chat applications.

tests and release workflow

Quick Links

With our component library, you can build a variety of chat use cases, including:

  • In-game chat like Overwatch or Fortnite
  • Team-style chat like Slack
  • Messaging-style chat like WhatsApp or Facebook's Messenger
  • Customer support chat like Drift or Intercom

Angular Chat Tutorial

The best way to get started is to follow the Angular Chat Tutorial. It shows you how to use this SDK to build a fully functional chat application and includes common customizations.

Free for Makers

Stream is free for most side and hobby projects. To qualify, your project/company must have no more than 5 team members and earn less than $10k in monthly revenue. For complete pricing and details visit our Chat Pricing Page.

Docs

The docs provide a brief description about the components and services in the library.

The Angular library is created using the stream-chat-js library. For the most common use cases our services should give a nice abstraction over this library, however you might need it for more advanced customization, the documentation is on our website.

Contributing

We welcome code changes that improve this library or fix a problem. Please make sure to follow all best practices and add tests, if applicable, before submitting a pull request on GitHub. We are pleased to merge your code into the official repository if it meets a need. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

We are hiring.

We recently closed a $38 million Series B funding round and are actively growing. Our APIs are used by more than a billion end-users, and by working at Stream, you have the chance to make a huge impact on a team of very strong engineers.

Check out our current openings and apply via Stream's website.

Installation

Install with NPM

Run the following command if you are using Angular 17

npm install stream-chat-angular stream-chat @ngx-translate/core

Run the following command if you are using Angular 16:

npm install stream-chat-angular stream-chat @ngx-translate/core

Run the following command if you are using Angular 15:

npm install stream-chat-angular stream-chat @ngx-translate/core@14 ngx-popperjs@15

Run the following command if you are using Angular 14:

npm install stream-chat-angular stream-chat @ngx-translate/core@14 ngx-popperjs@14

Run the following command if you are using Angular 13:

npm install stream-chat-angular stream-chat @ngx-translate/core@14 [email protected] ngx-popperjs@13 --legacy-peer-deps

Run this command if you are using Angular 12:

npm install stream-chat-angular stream-chat @ngx-translate/core@14 [email protected] ngx-popperjs@12 --legacy-peer-deps

Sample App

This repository includes a sample app to test our library.

To test the app:

Create a file named .env in the root directory with the following content:

STREAM_API_KEY=<Your API key>
STREAM_USER_ID=<Your user ID>
STREAM_USER_TOKEN=<Your user token>

The easiest way to generate a token for testing purposes is to use our token generator.

Run npm install to install dependencies.

Run npm start and navigate to http://localhost:4200/.

Preferred Node version: v16.

Customization examples

This repository includes a sample app that showcases how you can provide your own template for different components within the SDK:

To run the app:

Create a file named .env in the root directory with the following content:

STREAM_API_KEY=<Your API key>
STREAM_USER_ID=<Your user ID>
STREAM_USER_TOKEN=<Your user token>

Run npm install to install dependencies.

Run npm run start:customizations-example and navigate to http://localhost:4200/.

Preferred Node version: v16.

Local development

This repository includes a sample app to test our library.

To test the app:

Create a file named .env in the root directory with the following content:

STREAM_API_KEY=<Your API key>
STREAM_USER_ID=<Your user ID>
STREAM_USER_TOKEN=<Your user token>

Run npm install in the root of the project. You can use the npm run start:dev command to start the SampleApp with automatic reloading.

A note about the documentation:

  • Documentations for Angular services are generated from doc comments in the source files (not under source control)
  • Documentations for inputs and outputs of Angular components are generated from doc comments in the source files (not under source control)
  • Everything else in the documentation is written in mdx files located in the docusaurus folder

Preferred Node version: v16.

stream-chat-angular's People

Contributors

ciekawy avatar frozenfrank avatar jeroenleenarts avatar madsroskar avatar marco-ulge avatar oliverlaz avatar petyosi avatar semantic-release-bot avatar subjunk avatar szuperaz avatar trentcareapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stream-chat-angular's Issues

File upload button

blocked by #52

Displays the file upload icon, if clicked, it displays a file picker, where the user can pick files with accepted types. File upload can be disabled.

Setup actions automation

Upon PR open and merge, Github should run our test suite. We should run:

  • linting (use eslint-typescript)
  • unit tests
  • e2e tests

Reactions handling

Blocked by #16

Add reactions handling capabilities to the message component:

  • Add a new input: areReactionsEnabled
  • If reactions are enabled the user can toggle the reactions panel with a button

The reactions are handled by a standalone component called MessageReactions:
Inputs:

  • isSelectorOpen

Behavior (ReactionList and ReactionSelector React SDK components):

  • Show emoji selector if opened
  • Show reactions of message
  • Delete message reactions

Basic message input

Create the basic message input based on MessageInputFlat where the user can type and send the message with enter key

Enhance service documentations

Chat client and channel services are really important to users who want to create custom components. Improve the documentation with the following:

  • add type information for the method/property descriptions
  • add an example for custom event handlers

Fix auto imports

If we need to import a library module into another library module, it can be imported from 3 places:

  • stream-chat-angular, see tsconfig -> only the sample app uses this import alias, it shouldn't be available in the lib folder
  • from dist folder (if exists) -> this is the build output of the library, the sample-app aliases this folder as stream-chat-angular
  • from the lib folder -> the correct import path

the last one is the correct import path, however, VSCode uses all three paths for auto import, which can lead to build errors, later on, what can be done:

  • move the stream-chat-angular import alias to the tsconfig of the sample-app
  • try to tell VSCode to put the lib folder as the first import path option (I don't know if such a setting is possible)

Light and dark theme

  • Add the necessary CSS class based on the current theme
  • Add a service to toggle the current theme

Experiment with generating docs from doc comments

Generate documentation for services using typedoc

Requirements for generation

  • Do not generate data for constructors and private members
  • Page title should be the service name (no "Class: " prefix)
  • File names should stay the same (or update file references in docs)
  • Update CI config to deploy generated docs

Requirements for docs

  • Add description for class
  • Add description for public members and methods
  • Convert existing service docs into doc comments

Nice to have

  • Create eslint rule to check if services have the necessary comments

Image display bug

Image display works with attachments that are generated by the Stream data generator, but there is a problem with displaying messages received from the React SDK:

Correct display from React:
Screenshot 2021-10-12 at 13 14 05

Angular:
Screenshot 2021-10-12 at 13 14 10

Differences:

  • Empty bubble in Angular
  • Image is bigger in Angular
  • img_url is used instead of image_url

Avatar component

Inputs:

  • imageUrl (optional)
  • name
  • size

Behavior:

Displays the image, if not provided or an error occurred during image load, it displays the initials instead.

Setup Angular Workspace

We should have the library and the sample app in different folders. The sample app should pick changes in the library automatically for easier development workflow.

Paginate channels

  • Add pagination to channel list, use a load more button to load more channels
  • Add loading and error indicators as well
  • Add empty state indicator
  • Add custom channel preview template

Notification component

Add a component that can display error or success notifications, add a service that can be used by components to add/hide notifications

Setup semantic release

Use conventional commits format, and have semantic release publish an artifact with each PR merge. We don't need to do the actual publishing, we can use --dry-run flag to test the setup.

Attachment preview

Blocked by #53

Add upload preview (preview delete, add and send will be handled in a separate issue). Only image preview is supported

Open/close channel list

  • Automatically hide the channel list on a give device width (based on React SDK implementation)
  • Add hamburger icon the toggle channel list (based on React SDK implementation)

Reactions enhancement

  • use the outlined symbols rather than emoji by default
  • support customization (guide) that will allow the developer to inject their own set of images or emoji
  • This is not an immediate requirement (and React does not conform to it as well) but I wonder if we can make it convenient for people to avoid that huge dependency (maybe through some sort of a DI). As a reference, this adds 90KB
  • React is not consistent with our mobile SDKs reaction types (and they have to fix it eventually). You should rather pick the ones from the current design in mobile

Message component - basic functionality

Inputs:

  • message to be displayed

Behavior:

  • Display the avatar (blocked by avatar #15)
  • Display message "bubble"
  • Display delivery/sent date (MessageTimestamp component in React SDK)
  • Display message status (sent, error etc.) (MessageStatus component in React SDK)

Out of scope

  • Message group styles (e.g. only show the avatar and date for the last message in a group)
  • Retry sending unsent messages on click
  • Delete message
  • Edit message
  • Quoted message
  • Emoji
  • HTML messages
  • Markdown parsing
  • Translation

Handle if host application uses ngx-translate as well

stream-chat-angular uses ngx-translate for translation. It is possible that the host application uses this library as well. In that case the host app and the SDK has to share the TranslateService, which means:

  • StreamChatAngular module should have a flag that should determine how to import the TranslateModule (with or without providers)
  • The host app and the SDK translations should be merged:
// Wait for loading JSON file, to avoid override issues, see https://github.com/ngx-translate/http-loader/issues/6#issuecomment-372118792
this.translateService.getTranslation('en').subscribe((t) => {
  this.streamI18nService.init('en'); // We don't need this, if we want to use custom translation keys
});
// Test that host application can use ngx-translate without any problems
this.translateService
  .get('nested.test')
  .subscribe((res) => console.log(res));
  • We have to make sure that the SDK translation keys do not clash with the host app translation keys, ngx-translate supports nested objects for translations, so we could wrap the translation object with an object like streamChat for proper isolation however I was not able to make this work with the SDK + host app setup
  • Write a guide about this in the documentation

Channel preview

  • Copy the channel preview code from React SDK
  • Update last message if new messages are received

Custom message type

  • Add a configuration option to the message list where the user can provide custom message template
  • Create a custom message template in the sample app
  • Use the custom message template

Actions handling

Blocked by #16

Add action handling capabilities to the message component:

Add a new input: enabled actions: a list of actions that are enabled (possible options: edit, delete, mute, pin, flag, qoute)
If there is at least one action enabled, the user can toggle the action list with a button

The actions are handled by a standalone component called MessageActions:
Inputs:

  • isSelectorOpen
  • enabled actions

Behavior (MessageActions React SDK component):

  • Display the enabled actions
  • The actions won't have handlers yet

Organize icons, document them
Create reusable mocks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.