Comments (11)
@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.
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.
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.
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)?
- Dedicated component for each kind of message e.g. ImageMessage, FileMessage
- One parametrized Message component
from chat-ui-kit-react.
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.
When are you releasing this feature @supersnager ?
from chat-ui-kit-react.
@GhazanfarKhan Today/tommorow depending on your timezone ;)
from chat-ui-kit-react.
Awesome and thank you :)
from chat-ui-kit-react.
Awesome work.
from chat-ui-kit-react.
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.
@startupgurukul I will add it.
from chat-ui-kit-react.
Related Issues (20)
- MessageGroup.Footer with Avatar looks odd
- Expose onKeyPress for MessageInput
- Allow using send button when there is no message text HOT 3
- Scroll to message on browser-native find
- Regarding Chat Reply UI of one another user HOT 1
- IOS 16 version issue of clicking button as Message.CustomContent HOT 3
- Unexpected overflow on ChatContainer HOT 2
- transitionning between the chatcontainer and the sidebar in mobile display HOT 3
- Simple styling with tailwind
- Unexpected width and height change inside components in Message.HtmlContent. HOT 1
- [HELP] How to use the streaming message feature? HOT 4
- Not working on Next.js HOT 4
- Bug: unable to use scroll bar when using custom css HOT 1
- The requested module '/node_modules/prop-types/index.js' does not provide an export named 'default' HOT 1
- Getting started!
- Warning from FontAwesomeIcon about using defaultProps
- Set message input value from another component HOT 1
- Is there a way to actually set a proper max-length for MessageInput? HOT 1
- Avatar isn't displayed when custom content is used
- Sass deprecation warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chat-ui-kit-react.