Git Product home page Git Product logo

open-chat-labs / open-chat Goto Github PK

View Code? Open in Web Editor NEW
156.0 5.0 46.0 183.1 MB

This is the main repository for the OpenChat application which runs on the Internet Computer

Home Page: https://oc.app

License: GNU Affero General Public License v3.0

Rust 46.18% JavaScript 4.72% TypeScript 22.35% Shell 1.27% Svelte 25.22% SCSS 0.15% Dockerfile 0.01% ASL 0.10%
chat-application internet-computer

open-chat's People

Contributors

archetypal-one avatar csepreghy avatar dependabot[bot] avatar fxgst avatar hpeebles avatar hwrdwlwz avatar julianjelfs avatar megrogan avatar mraszyk avatar nolyoi avatar seerssocial avatar sensycheung avatar sideffect0 avatar wyattbenno777 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

open-chat's Issues

Comprehensive error handling system

make sure that regardless of the machine that we are in, errors are handled correctly.

Make sure that errors are logged appropriately and that the user is informed in an appropriate way either via error page or toast.

Investigate virtualising the main chat message list

The performance seems relatively good on the main chat list at the moment. But, it is unbounded and that's never a good thing. If the user loads a lot of messages and then tries to switch back and forth between chats, then all the messages need to be re-rendered and that can get a little bit laggy (will obviously be a lot worse on mobile).

We would like to be able to only render the slice that the user is actually looking at. There are solutions to this available, but we have some interesting additional requirements. We need to be able to support:

  • reverse infinite scroll with async lookup of new messages.
  • adding messages to either end of the list.
  • scrolling programmatically to any point in the list
  • modifying the underlying list without losing scroll position
  • having at least a somewhat meaningful scrollbar ideally

Whether or not we can come up with a solution that covers all of these requirements is uncertain.

Have a closer look at markdown

Currently using svelte-markdown. Don't know how big the lib is.

The advantage of this lib is that it does not use @html so it should be xss safe out of the box. But it might be big and it might be slow. We could use some other markdown lib and combine it with dompurify to avoid xss.

Scroll selected chat into view

we can indirectly select a chat (via participant click or message click) when that chat is scrolled out of view in the left panel. We should make sure that the selected chat is always scrolled into view.

Make sure that front end error handling is correct

There are several different scenarios to consider.

Anticipated errors received from the api e.g. username already exists etc
Half-anticipated errors from the api e.g. 403 / 401
Unanticipated errors from the api e.g. 500
Unhandled errors in the front-end outside of api calls.

Need to make sure that errors are always caught and that they are recorded somehow. We should probably use some sort of client side error logging framework for this e.g.

  • sentry
  • bugsnag
  • rollbar
  • firebase

open-chat: `dfx deploy` with `@dfinity/authentication` integration blocked by 2Mb size limit

@hpeebles just showed me in a meeting how they are running into the dfx deploy 2Mb file size limit when trying to deploy this application once they started to emulate the wallet integration I described in slack.

@hpeebles

  • This is a front-and-center blocker right now, right? Any known workarounds?
  • Will you please link to a git commit that this can be reproduced on? e.g. could be a temporary branch we can use to repro and try different candidate solutions to fix

Image optimisation

Started using some slightly hefty images which are nice, but need optimising.

manifest file not working correctly for ios

Adding to home screen does work to a degree but the icon does not work. Perhaps this is something to do with the fact that we are using an svg? Have not tried it on Android.

Also, signing into the IC does not work on my phone when it is done from the app saved to home screen - which is weird.

Allow users to create events (primarily in group chats)

In my circle of friends we almost always organise events via WhatsApp and it would be nice to provide a better UX for this.

Users could create events, which at first would just need a title + start date (+ optional end date), then participants can mark themselves as yes/no/maybe.

We can then show an app level calendar with all of your events.

Lazy load files, audio and video

Currently we load the data for all media and file messages when the message itself is loaded and place it in indexdb. This keeps things simple but it is not optimal since we then load data that the user may never interact with. We should instead lazy load everything but images.

Registration issues

when signing out and back in as another user, the in memory state from the previous user hangs around.

registration steps should be forms so that you can press enter to hit the cta

when you hit lets go, it goes into a horrible janky loop - figure out why and fix it (the reason why is that we alternate between loading_user which does not display the register component and register_user which does - until the canister is ready. Not sure what the best solution is)

store chat summary data in indexdb

currently we store messages (well events) and media / data in indexdb. We can also store chat summary objects themselves. That way, after the initial load by the user (on a particular device) we will always have a last updated timestamp and we can just load the diff rather than needing to load the initial data.

Create a toast component

This is useful for general feedback on successful operations and also for alerting on any error that occurs.

Feels like this is just a really simple writable store and a global component with a transition.

Implement TypeStates

Currently the context in an xstate machine has a single shape regardless of the state that the machine is in. This is ok, but leads to some woolliness in the types. In fact, the rules of the machine should guarantee that certain properties of the context are available in certain states.

Typestates are designed to help us express this: https://xstate.js.org/docs/guides/typescript.html#typestates

Create build process in github actions

We want to make a start on a proper build process. Step one is to build the front end including linting and unit tests, when attempting to PR to master.

delete chat actor when a chat is deleted

if a chat is selected and then it is removed, the chat still appears selected in the middle panel and this is because the chat actor (stored in the home machine) still exists. It needs to be removed as part of the merge process when receiving updates. We could also clean up the messages from indexdb though that's not really necessary.

Use indexDB to cache chat messages

Add an indexDB layer in between the UI and the front end service to get chat messages. Messages are immutable so we want to store them all on the client if we possibly can. This should greatly reduce the load on the back end. And it will also allow us to throw away messages from the UI when switching between chats. This should ease any performance issues with the main chat list and remove the need to virtualise the list which would be quite a complex endeavour.

change add participants UI to add mulitiple

adding participants to an existing group is done one by one at the moment which is pretty slow if you want to add several.

We should change it to add multiple at the same time if desired, like when we create the group. Ideally we can just created shared UI for multiple user selection and do it that way.

make sure chat list is not rendered when it is not visible

on mobile the chat list is still being rendered (and updated behind the scenes) when we are looking at a specific chat on mobile. This is inefficient and I can see if causing cpu spikes in the performance trace.

image

Conversely we should also ensure that the middle panel is not rendered at all when the use is looking at the left panel. This should also deal with the glitch on mobile when the left and middle panels seems to be half visible at the same time.

Also seems like there is a possibility that the markdown parser is contributing to performance degradation on large lists.

All of this would go away with a virtual list so I still think that should really be a priority.

Support upload of audio files

Certainly via file upload but also ideally via recording.

When in China I noticed people doing this all the time - particularly taxi drivers just because it's easier than typing.

disambiguate and encrypt cached data

We need to consider the scenario where multiple different users use the same device. In this scenario we need to ensure that the cached data on the client is a) isolated and b) secure. For this the data must be sharded according to some unique property of the user e.g. their Principal and it must also be encrypted (how to do that - TBD).

Looks like we might be able to encrypt index db using dexie and dexie-encrypted.

Note, that it is probably not necessary to shard messages / events since they are keyed by chatId anyway. We will need to shard chats by userId though. Both stores still need to be encrypted though.

Make the registration load as a lazy async module

The registration process is somewhat complicated and also includes a bundle of country telephone code info. A user only needs all this stuff once so it's worth trying to remove it from the main bundle, just so we can keep things as light as possible.

Block and unblock users

need to understand why there is a block and unblock on the group canister as well as the user canister

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.