Git Product home page Git Product logo

Comments (11)

supersnager avatar supersnager commented on July 29, 2024 1

@startupgurukul Thank you for your explains.
I will add support for new kind of messages. This will be probably divided into few small update steps.

First the <Message /> component should be modified to allow to pass any content as children, or from model.content property - for any custom content messages.
Note to myself: add <Message.Content /> Component.
For backward compatiblity current message type should have default set to "text" or "default" (or maybe "html" because now it uses dangerouslysetinnerhtml internally)
Maybe: new <Message.Content /> component should be typed instead of <Message />?

Next add predefined components for common types like image, video, etc

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024 1

32439f7
https://github.com/chatscope/chat-ui-kit-react/releases/tag/v1.1.0

I will add some documentation later.

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024 1

Added some examples to Storybook:
https://chatscope.io/storybook/react/?path=/docs/components-message--html-content
https://chatscope.io/storybook/react/?path=/docs/components-message--text-content
https://chatscope.io/storybook/react/?path=/docs/components-message--image-content
https://chatscope.io/storybook/react/?path=/docs/components-message--custom-content

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024

Hello @startupgurukul thank you for your feedback.

We have this feature on our roadmap.
I'd like to hear from you, what approach would be better (and why)?

  1. Dedicated component for each kind of message e.g. ImageMessage, FileMessage
  2. One parametrized Message component

from chat-ui-kit-react.

no-1ne avatar no-1ne commented on July 29, 2024

Thank you for the reply.

Keeping message structure fixed with keys: type & payload. While rendering logic changes based on type of message . Few message types like image video and file can be pre handled by library while still giving an option to customise for other message types

For example ,
type: image and payload: path to image
type: text and payload: message text
type: video, file and payload: path

This keeps message structure simple and based on type of message render components accordingly this enables users to extend it to any type of message they like

Here is how alibabas chat ui handles it

const initialMessages = [ { type: 'text', content: { text: 'message text' }, user: { avatar: '//gw.alicdn.com/tfs/TB1DYHLwMHqK1RjSZFEXXcGMXXa-56-62.svg' }, }, { type: 'image', content: { picUrl: '//img.alicdn.com/tfs/TB1p_nirYr1gK0jSZR0XXbP8XXa-300-300.png', }, }, ];

switch (type) {
  case 'text':
    return <Bubble content={content.text} />;
  case 'image':
    return (
      <Bubble type="image">
        <img src={content.picUrl} alt="" />
      </Bubble>
    );
  default:
    return null;
}

Source: https://chatui.io/components/chat

from chat-ui-kit-react.

GhazanfarKhan avatar GhazanfarKhan commented on July 29, 2024

When are you releasing this feature @supersnager ?

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024

@GhazanfarKhan Today/tommorow depending on your timezone ;)

from chat-ui-kit-react.

no-1ne avatar no-1ne commented on July 29, 2024

Awesome and thank you :)

from chat-ui-kit-react.

GhazanfarKhan avatar GhazanfarKhan commented on July 29, 2024

Awesome work.

from chat-ui-kit-react.

no-1ne avatar no-1ne commented on July 29, 2024

it would be perfect if there is an onclick listener for message (to be exact, on click of image thumbnail the flexibility of doing something)

from chat-ui-kit-react.

supersnager avatar supersnager commented on July 29, 2024

@startupgurukul I will add it.

from chat-ui-kit-react.

Related Issues (20)

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.