• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💬 A React single page chat application (SPA), implementing Socket.io.

Mihail's Chat (React)

Tests

Project update (Jan. 14, 2023): After Heroku stopped their free plans the project demo site has not been accessible anymore. In order to make it accessible again, I've decided to deploy it to another platform, such as Vercel. As part of this migration I updated the main libraries used in the project. This required several changes in the codebase so that it's aligned with the breaking changes came from the updates. Currently the demo site can be seen and interacted with but the main chat functionality is not working due to the serverless nature of the platform. I am looking for alternatives and will post updates here as soon as I found a working one. The project is perfectly runnable locally.

I have written a tutorial about how I did this. You can find it here or here, or here

A React single page chat application (SPA) built with the following technologies:

  • React with TypeScript (create-react-app my-app --scripts-version=react-scripts-ts)
  • Redux
  • Express.js with Socket.io
  • styled-components (SASS)
  • Jest/Enzyme/Sinon

Screenshots

screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot

Application features:

  • Header

    1. Chat tab - blinking when new message is received until is read, i.e. when the user is on Settings page
    2. Settings tab
    3. Unread messages counter
    4. Font Awesome icons
  • Chat page

    1. Chat area (includes left aligned and right aligned messages)
    2. Message (text, datetime, left or right depending on if it's received or sent)
    3. Showing nickname only for received message
    4. Message sender - input and button. Input is cleared and focused when button is clicked
    5. Send messages with Ctrl+Enter
    6. Auto scroll to bottom when the chat area is not enough to show all messages
  • Settings page

    1. UserProfile component - possibility to change user name
    2. Interface color component - change the color theme of the app
    3. ClockDisplay component - change the time mode 12h or 24h, shown with each message
    4. Send messages with Ctrl+Enter - On/Off
    5. LanguageSwitcher - dropdown menu allowing changing the language of the app (currently English and Deutsch are supported)
    6. Reset button - resets all settings stored to local storage

    Improvements (done and pending)

    • Add video chat feature.
    • 👍 Added AM/PM time formatting for when 12h mode is selected.
    • 👍 Added possibility to send message via ENTER by default. If the setting to send messages with CTRL+ENTER is ON, then this is going to be the only way (except via mouse/touch of course).
    • 👍 Optimized for iDevices (media queries).
    • 👍 Fix blinking/active class for the Chat tab issue - related to React Router not able to properly re-render connected components https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/guides/blocked-updates.md
    • 👍 Clear input field when new message is sent.
    • 👍 Auto scroll to bottom main chat area when new messages exceed available space.
    • 👍 Prevent 'doubling messages' (or multiple messages duplicates when more clients are connected).
    • 👍 Add unit tests for the react components.
    • Add unit tests for redux stuff - reducers, store, action creators.
    • 👍 Add media queries for responsiveness - test and adjust on more devices.
    • 👍 Add demo to heroku.
    • 👍 Add nice how-to in README.
    • Add animations for the messages (animejs).
    • Add sounds (with options to turn on/off in settings).
    • Add more color themes.
    • Add welcome message (broadcasts on user connected).
    • 👍 Add icons ( use font awesome).
    • History of all the conversations.
    • Handle case when socket's connection state change (visually).
    • Handle case when there has been a socket error.
    • Handle case when a very long word (without) spaces is entered and it goes beyond the message background color.
    • 👍 Emoticons support - such as :D, :P, :), ;), 😉, ❤️, etc.
    • 👍 Link Parser - youtube link (embedded video should appear), link to an image (embedded image should appear), all other links should appear as anchor.

Demo

https://chat-ten-khaki.vercel.app

Running The App locally

To run the app, follow these steps.

  1. Ensure that NodeJS is installed.
  2. Install npm.
  3. From the project folder, execute the following commands:

To install dependencies:

  npm i

To run the client app:

  npm start

To run the server app:

  npm run server:watch

To run the tests:

  npm t

Browse to http://localhost:3000 and see the running app. In order to test, open it in two different computers, or computer and a phone, or two browsers on the same computer (one of it in incognito mode). If you are running it locally, make sure to change the host variable in Socket.ts (line:28) and its value to match your local network address - the one of the computer you are running the server app.

Heroku stopped offering free plans. Moved to Vercel.

### Deploy to Heroku This step assumes you have already a Heroku account, installed heroku-cli and did login.

1. npm build to build the project to build folder. 2. Add build folder to be committed to Git 3. Make sure that express server loads static resources from it. 4. Commit all: git commit -m 'Deploy to Heroky'. 5. Run git push heroku master. 6. Open the app from the given URL (in my case: mihails-chat.herokuapp.com).

Resources

Stargazers

Stargazers repo roster for @mihailgaberov/chat

Forkers

Forkers repo roster for @mihailgaberov/chat

Star History

Star History Chart

MIT License

Copyright (c) 2018-2023 Mihail Gaberov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

orderbook

📖 An Order Book app built with React/Typescript and powered by WebSockets.
TypeScript
264
star
2

bingo

🎱 A Bingo game built with JavaScript. It comes with a back-office app built with React.js and uses MongoDB.
JavaScript
50
star
3

pizza-app

🍕 SPA with Vue.js and C# using .NET Core
C#
46
star
4

shopping-cart-app

🛒 A real-life shopping cart application
TypeScript
23
star
5

testing-reactjs-examples

🧪 "What should we test in our React components" - presentation examples.
JavaScript
23
star
6

parking-lot

🚗 The app used in my article -> https://www.mihailgaberov.com/how-to-solve-the-parking-lot-challenge-in-javascript
JavaScript
17
star
7

bingo-blower

🎱 POC for a Bingo blower component with nice animations created with Matter.js
JavaScript
13
star
8

learn-service-workers

👷 Demo app showing how to utilize the power of Service Workers for executing heavy and slow tasks without blocking the UI.
JavaScript
8
star
9

redis-pubsub-visualized

A demo app to show visually Redis Pub/Sub pattern in action.
JavaScript
6
star
10

mickey-gallery

A media gallery app build with React, Redux and Saga, using Flickr API.
JavaScript
5
star
11

mobile-sportsbook-app

AngularJS based mobile Sportsbook application (POC)
CSS
5
star
12

microservices

React/Node.js/GraphQL Microservices app
JavaScript
5
star
13

lottoland-react-demo

A demo app to backup an internal company presentation of FE technologies.
JavaScript
4
star
14

sportsbook-like-app

A React single page application (SPA) - Sportsbook PoC
TypeScript
4
star
15

calc-expenses

A small Node.js program that reads a txt file with numbers, each on new line and returns the sum of them.
JavaScript
4
star
16

twitter-bot

A twitter bot that serves as notifier for the recent #js #javascript #nodejs #reactjs news.
JavaScript
3
star
17

js-stack-from-scratch-code

The code exercises from https://github.com/mihailgaberov/js-stack-from-scratch/
JavaScript
3
star
18

scoreboard

Football World Cup Scoreboard that shows matches and scores.
JavaScript
3
star
19

mihailgaberov.com

My personal space in the web.
JavaScript
3
star
20

weather-app

Simple app for showing the weather and sending email warnings with the temperature degrees in a preliminary selected city. It consumes openweathermap.org Weather API and Sendgrid API.
JavaScript
2
star
21

address-book

Client Side Address Book
JavaScript
2
star
22

mihailgaberov

2
star
23

what-shall-we-watch

TypeScript
2
star
24

alien-invasion-python

Exercise project from the book "Python Crash Course", 2nd edition
Python
2
star
25

misc

This repo would contain any stuff that deserves to be preserved.
HTML
2
star
26

multi-threading-nodejs

How To Use Multithreading in Node.js
JavaScript
2
star
27

react-hooks

This repo contains working examples and presentation slides discussed in "React hooks: a new way of working with React state".
JavaScript
2
star
28

twitrender

Twitrender is a small app that leverages a big database, gathered from Twitter posts, related to certain search criteria, since 2017. It gives the users ability to search for certrain words and see how many times they have been twitted during a selected time period. Hence trender => twitrender.
Python
2
star
29

expo-react-native

Playing with Expo and React Native - https://docs.expo.dev/
JavaScript
1
star
30

react-typescript-sass-webpack-starter

Starter setup for a project using React, Typescript, SASS and Webpack.
TypeScript
1
star
31

dnd-chess-tut

Testing Drag and Drop for React
JavaScript
1
star
32

shopping-list

Real-time shopping list app
JavaScript
1
star
33

mihail-gaberov.eu

Personal blog by Mihail Gaberov.
JavaScript
1
star
34

rock-paper-scissors

A React/Redux implementation of the classic game Rock Paper Scissors.
JavaScript
1
star
35

truerng

Experimenting with TrueRNG https://ubld.it/truerng_v3
Python
1
star
36

full-stack-redux

Full stack Redux tutorial done via [this](http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html).
JavaScript
1
star
37

angular-fitness-tracker

Refreshing Angular knowledge by building a simple Fintess Tracker app.
TypeScript
1
star
38

test-react-components

Testing React components.
JavaScript
1
star
39

data-structures-and-algorithms

Data structures and algorithms
JavaScript
1
star
40

angular-chat

An Angular single page chat application (SPA), implementing SignalR.
TypeScript
1
star
41

batch-automation

Short batch scripts for running recurrent daily tasks.
Batchfile
1
star
42

es6-playground

JavaScript
1
star
43

Front-End-Quizes

Front End Quizes
JavaScript
1
star
44

playing-with-nextjs

Self-training.
JavaScript
1
star
45

mongodb-course

Repository to store course exercises.
JavaScript
1
star
46

svelte-library

Svelte
1
star
47

test-react-18

HTML
1
star
48

pusher-event-chat

https://pusher.com/tutorials/live-chat-with-node-js-mysql-and-pusher-channels-part-1/
JavaScript
1
star
49

winston

Nodejs app logging solution using Winston library (PoC)
JavaScript
1
star
50

freecodecamp-infosec-course

JavaScript
1
star
51

libreria

A small SPA built with Vue, Python and MongoDB, serving as a bookshelf.
Vue
1
star
52

caesars-game

Svelte
1
star
53

learn-rust

https://www.rust-lang.org/learn
Rust
1
star
54

arabic-roman-visualized

A demo SolidJS app that's visualizing the workings of an algorithm for converting arabic to roman numbers.
JavaScript
1
star
55

graphic-design

Storage for my graphic design endeavours
1
star
56

learning-ruby-on-rails

Learning Ruby on Rails - course project.
Ruby
1
star
57

mihailgaberov.github.io

Mihail's demos.
JavaScript
1
star
58

reactjs-winepad

A ReactJS based app done for self training via the Stoyan Stefanov's book.
JavaScript
1
star
59

multiplayer-games-with-meteor

JavaScript
1
star
60

OO-JS-Tree-Menu

A tree menu developed with pure JavaScript using object oriented approach.
JavaScript
1
star
61

node-cli-gitinit

JavaScript Command Line Interface (CLI) with Node.js for initializing Github repos
JavaScript
1
star
62

file-explorer-electron

Learning by doing: Cross-Platform Desktop Applications - Electronjs
JavaScript
1
star
63

svelte-countdown

Are you waiting eagerly for some event? Use this countdown to show the time left till it happens.
JavaScript
1
star
64

euro-jackpot

An Aurelia based application for showing current EuroJackpot draw information.
JavaScript
1
star
65

js-workshops

Repo for storing the materials from the JavaScript workshops I have done to help other people to learn JS.
JavaScript
1
star