@pubuduth-aplicy/chat-ui 2.1.17 → 2.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubuduth-aplicy/chat-ui",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -9,19 +9,18 @@ export const Chat = () => {
9
9
  return (
10
10
  <>
11
11
  <div className='container mx-auto mb-5'>
12
- <div className='grid grid-cols-7 sm:h-[450px] md:h-[550px] rounded-lg overflow-hidden bg-gray-400 bg-clip-padding backdrop-filter backdrop-blur-lg bg-opacity-0'>
13
- <div />
12
+ <div className='grid-container'>
14
13
  {selectedConversation ? (
15
14
  <>
16
- <div className={`xs:hidden grid col-span-3 border max-h-screen overflow-y-auto`}><Sidebar /></div>
17
- <div className='col-span-4 border max-h-screen overflow-y-auto '>
15
+ <div className={`sidebarContainer`}><Sidebar /></div>
16
+ <div className='messageContainer'>
18
17
  <MessageContainer />
19
18
  </div>
20
19
  </>
21
20
  ) : (
22
21
  <>
23
- <div className='col-span-3 border max-h-screen overflow-y-auto '><Sidebar /></div>
24
- <div className='xs:hidden col-span-4 border '>
22
+ <div className='sidebarContainer'><Sidebar /></div>
23
+ <div className='messageContainer'>
25
24
  <MessageContainer />
26
25
  </div>
27
26
  </>
@@ -17,18 +17,19 @@ const Message = ({ message }: MessageProps) => {
17
17
 
18
18
  const { userId } = useChatContext();
19
19
  const fromMe = message.senderId === userId;
20
- const bubbleBgColor = fromMe ? "bg-green-400" : "bg-blue-700";
21
- const alignItems = fromMe ? "float-right" : "float-left";
20
+ const bubbleBgColor = fromMe ? "chatMessagesBubble_me" : "chatMessagesBubble_Other";
21
+ const alignItems = fromMe ? "chatMessagesBubble_me" : "chatMessagesBubble_Other";
22
+ console.log('messagedis',message);
22
23
 
23
24
 
24
25
  return (
25
26
  <>
26
- <div className='flex-grow px-8 pt-8 max-h-screen text-left text-gray-700 overflow-y-auto'>
27
- <div className="relative mb-6 text-left">
28
- <div className="text-gray-700">
29
- <div className={`relative ${alignItems} block rounded-md ${bubbleBgColor} py-3 px-4 text-white break-all overflow-wrap`}>
30
- <p className="text-sm">{message.message}</p>
31
- <div className='chat-footer opacity-50 text-xs flex gap-1 items-center float-right'>15.00</div>
27
+ <div className='chatMessage'>
28
+ <div className="chatMessagesContainer">
29
+ <div style={{color:"#374151"}}>
30
+ <div className={`chatMessagesBubble_inner ${alignItems} ${bubbleBgColor} `}>
31
+ <p style={{fontSize:"14px"}}>{message.message}</p>
32
+ <div className='chatMessagesBubble_Time'>15.00</div>
32
33
  </div>
33
34
  </div>
34
35
  {/* <div className="clear-both flex text-gray-700" /> */}
@@ -16,22 +16,22 @@ const MessageContainer = () => {
16
16
  }, [setSelectedConversation]);
17
17
 
18
18
  return (
19
- <div className='flex flex-col justify-center h-full'>
19
+ <div className='chatMessageContainer'>
20
20
 
21
21
  {!selectedConversation ? (
22
22
  <NoChatSelected />
23
23
  ) : (
24
24
  <>
25
- <div className="h-20 sticky top-0 border-b border-gray-300 bg-white py-5 px-8 text-left text-sm text-gray-800 z-50">
26
- <div className="grow shrink basis-0 self-stretch justify-start items-center px-4 gap-4 flex">
27
- <button className="text-blue-500 md:hidden">
25
+ <div className="chatMessageContainerInner">
26
+ <div className="chatMessageContainerInnerDiv">
27
+ <button className="chatMessageContainerInnerDiv_button">
28
28
  {/* <CaretLeft size={25} /> */}
29
29
  </button>
30
- <img className="w-10 h-10 rounded-circle" alt="Profile" />
31
- <div className="grow shrink basis-0 flex-col justify-start items-start gap-1 inline-flex">
32
- <div className="self-stretch justify-start items-center inline-flex">
33
- <div className="grow shrink basis-0 text-slate-900 text-base font-semibold font-inter leading-tight">
34
- {selectedConversation.firstname}
30
+ <img className="chatMessageContainerInnerImg" alt="Profile" src={selectedConversation.participantDetails.idpic}/>
31
+ <div className="chatMessageContainerOutter">
32
+ <div className="chatMessageContainerOutterDiv">
33
+ <div className="chatMessageContainerOutterDiv_name">
34
+ {selectedConversation.participantDetails.firstname}
35
35
  </div>
36
36
  </div>
37
37
  </div>
@@ -71,8 +71,8 @@ const NoChatSelected = () => {
71
71
  // const { authUser } = useAuthContext();
72
72
 
73
73
  return (
74
- <div className='flex items-center justify-center w-full h-full'>
75
- <div className='px-4 text-center sm:text-lg md:text-xl text-gray-200 font-semibold flex flex-col items-center gap-2'>
74
+ <div className='chatMessageContainerNoChat'>
75
+ <div className='chatMessageContainerNoChat_div'>
76
76
  <p>Welcome </p> {/* Safely access username */}
77
77
  <p>Select a chat to start messaging</p>
78
78
  {/* <Chat className='text-3xl md:text-6xl text-center' /> */}
@@ -26,17 +26,17 @@ const MessageInput = () => {
26
26
  };
27
27
 
28
28
  return (
29
- <form className='px-4 my-3 sticky bottom-0' onSubmit={handleSubmit}>
29
+ <form className='chatMessageInputDiv' onSubmit={handleSubmit}>
30
30
 
31
- <div className='w-full '>
31
+ <div style={{width:"100%"}}>
32
32
  <input
33
33
  type='text'
34
- className='border text-white text-sm border-none block outline-none w-full p-2.5 rounded-2xl bg-slate-500 '
34
+ className='chatMessageInput'
35
35
  placeholder='Send a message'
36
36
  value={message}
37
37
  onChange={(e) => setMessage(e.target.value)} // Update message state as the user types
38
38
  />
39
- <button type='submit' className='absolute inset-y-0 end-0 flex items-center pe-8'>
39
+ <button type='submit' className='chatMessageInputSubmit'>
40
40
  send
41
41
  {/* {loading ? <div className='loading loading-spinner'></div> : <PaperPlaneRight />} Show loading spinner if loading */}
42
42
  </button>
@@ -43,9 +43,9 @@ console.log(userId);
43
43
  // )}
44
44
  // </div>
45
45
 
46
- <div className='px-4 flex-1 overflow-auto sm:px-6 lg:px-8'>
46
+ <div className='chatMessages'>
47
47
  {messages?.length > 0 &&
48
- messages?.map((message: any) => (
48
+ messages?.messages.map((message: any) => (
49
49
  <div key={message._id} ref={lastMessageRef}>
50
50
  <Message message={message} />
51
51
  </div>
@@ -53,7 +53,7 @@ console.log(userId);
53
53
 
54
54
  {/* {loading && [...Array(3)].map((_, idx) => <MessageSkeleton key={idx} />)} */}
55
55
  {messages?.length === 0 && (
56
- <p className='text-center'>Send a message to start the conversation</p>
56
+ <p style={{textAlign:"center"}}>Send a message to start the conversation</p>
57
57
  )}
58
58
  </div>
59
59
  );
@@ -27,17 +27,17 @@ console.log(conversation);
27
27
  return (
28
28
  <>
29
29
  <div
30
- className={` h-[72px] p-2 py-3 hover:bg-sky-500 rounded justify-start items-center cursor-pointer gap-4 inline-flex
30
+ className={` chatSidebarConversationMain
31
31
  `}
32
32
  onClick={() => setSelectedConversation(conversation)}
33
33
  >
34
34
  <img
35
- className="w-12 h-12 relative rounded-[100px]"
35
+ className="chatSidebarConversationImg"
36
36
  src={conversation.participantDetails.profilePic|| conversation.participantDetails.idpic}
37
37
  />
38
- <div className="grow shrink basis-0 flex-col justify-start items-start gap-1 inline-flex">
39
- <div className="self-stretch justify-start items-center inline-flex">
40
- <div className="grow shrink basis-0 text-slate-900 text-base font-semibold font-['Inter'] leading-tight">
38
+ <div className="chatSidebarConversationContainer">
39
+ <div className="chatSidebarConversationInnerDiv">
40
+ <div className="chatSidebarConversationOuterDiv">
41
41
  {conversation.participantDetails.firstname}
42
42
  </div>
43
43
  </div>
@@ -11,7 +11,7 @@ const Conversations = () => {
11
11
  console.log("userId",userId);
12
12
  // const { loading, conversations } = useGetConversations();
13
13
  return (
14
- <div className="py-2 flex flex-col overflow-auto">
14
+ <div className="chatSidebarConversations">
15
15
  {conversations?.map((conversation: any, idx: any) => (
16
16
  <Conversation
17
17
  key={conversation._id}
@@ -36,10 +36,10 @@ const {userId} =useChatContext()
36
36
  <>
37
37
 
38
38
  <form onSubmit={handleSubmit}>
39
- <div className="self-stretch h-14 px-4 py-2 justify-start items-center gap-4 inline-flex">
40
- <div className="grow shrink basis-0 h-10 px-4 py-2 bg-neutral-100 rounded-[22px] justify-start items-center gap-4 flex">
41
- <img src={searchicon} className="w-6 h-6 pl-[2.50px] pr-[3px] pt-[2.50px] pb-[3px] justify-center items-center flex" />
42
- <input className="w-full h-5 text-slate-500 bg-neutral-100 outline-none text-base font-normal font-['Inter'] leading-tight"
39
+ <div className="chatSidebarSearchbar">
40
+ <div className="chatSidebarSearchbarContainer">
41
+ <img src={searchicon} className="chatSidebarSearchbarImg" />
42
+ <input className="chatSidebarInput"
43
43
  placeholder='Search…'
44
44
  value={search}
45
45
  onChange={(e) => setSearch(e.target.value)}
@@ -3,7 +3,7 @@ import SearchInput from "./SearchInput";
3
3
 
4
4
  export const Sidebar = () => {
5
5
  return (
6
- <div className='flex-col border-r p-4 flex '>
6
+ <div className='chatSidebarMain'>
7
7
  <SearchInput />
8
8
  <div className='divider px-3'></div>
9
9
  <Conversations />
package/src/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import '../style/tailwind.css'
1
+ import './style/style.css'
2
2
 
3
3
  export { ChatProvider } from './providers/ChatProvider';
4
4
  export { Chat } from './components/Chat';
@@ -0,0 +1,366 @@
1
+ .grid-container {
2
+ display: grid;
3
+ overflow: hidden;
4
+ grid-template-columns: repeat(1, minmax(0, 1fr));
5
+ border-radius: 0.5rem;
6
+ background-clip: padding-box;
7
+ background-color: #9CA3AF;
8
+ --bg-opacity: 0;
9
+ backdrop-blur: blur(16px);
10
+ }
11
+
12
+ .sidebarContainer {
13
+ grid-column: span 3;
14
+ overflow-y: auto;
15
+ border: 1px solid #ddd;
16
+ max-height: 100vh;
17
+ }
18
+
19
+ .messageContainer {
20
+ grid-column: span 4;
21
+ border: 1px solid;
22
+ max-height: 100vh;
23
+ overflow-y: auto;
24
+ }
25
+
26
+ .chatSidebarMain {
27
+ display: flex;
28
+ padding: 1rem;
29
+ flex-direction: column;
30
+ border-right-width: 1px;
31
+ }
32
+
33
+ .chatSidebarSearchbar {
34
+ display: inline-flex;
35
+ padding-top: 0.5rem;
36
+ padding-bottom: 0.5rem;
37
+ padding-left: 1rem;
38
+ padding-right: 1rem;
39
+ gap: 1rem;
40
+ justify-content: flex-start;
41
+ align-items: center;
42
+ align-self: stretch;
43
+ height: 3.5rem;
44
+ }
45
+
46
+ .chatSidebarSearchbarContainer {
47
+ display: flex;
48
+ padding-top: 0.5rem;
49
+ padding-bottom: 0.5rem;
50
+ padding-left: 1rem;
51
+ padding-right: 1rem;
52
+ flex-basis: 0px;
53
+ shrink: 1;
54
+ gap: 1rem;
55
+ justify-content: flex-start;
56
+ align-items: center;
57
+ height: 2.5rem;
58
+ }
59
+
60
+ .chatSidebarSearchbarImg {
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ width: 1.5rem;
65
+ height: 1.5rem;
66
+ padding-left: 2.50px;
67
+ padding-right: 3px;
68
+ padding-top: 2.50px;
69
+ padding-bottom: 3px;
70
+ }
71
+
72
+ .chatSidebarInput {
73
+ outline-style: none;
74
+ width: 100%;
75
+ height: 1.25rem;
76
+ font-size: 1rem;
77
+ line-height: 1.5rem;
78
+ font-weight: 400;
79
+ line-height: 1.25;
80
+ }
81
+
82
+ .chatSidebarConversations {
83
+ display: flex;
84
+ overflow: auto;
85
+ padding-top: 0.5rem;
86
+ padding-bottom: 0.5rem;
87
+ flex-direction: column;
88
+ }
89
+
90
+ .chatSidebarConversationMain {
91
+ display: inline-flex;
92
+ padding: 0.5rem;
93
+ padding-top: 0.75rem;
94
+ padding-bottom: 0.75rem;
95
+ gap: 1rem;
96
+ justify-content: flex-start;
97
+ align-items: center;
98
+ border-radius: 0.25rem;
99
+ cursor: pointer;
100
+ height: 72px;
101
+
102
+ :hover {
103
+ background-color: #0ea5e9;
104
+ }
105
+ }
106
+
107
+ .chatSidebarConversationImg {
108
+ position: relative;
109
+ width: 3rem;
110
+ height: 3rem;
111
+ border-radius: 100%;
112
+ }
113
+
114
+ .chatSidebarConversationContainer {
115
+ display: inline-flex;
116
+ flex-basis: 0px;
117
+ flex-direction: column;
118
+ shrink: 1;
119
+ gap: 0.25rem;
120
+ justify-content: flex-start;
121
+ align-items: flex-start;
122
+ }
123
+
124
+ .chatSidebarConversationInnerDiv {
125
+ display: inline-flex;
126
+ justify-content: flex-start;
127
+ align-items: center;
128
+ align-self: stretch;
129
+ }
130
+
131
+ .chatSidebarConversationOuterDiv {
132
+ flex-basis: 0px;
133
+ shrink: 1;
134
+ font-size: 1rem;
135
+ line-height: 1.5rem;
136
+ font-weight: 600;
137
+ line-height: 1.25;
138
+ }
139
+
140
+ .chatMessageContainer {
141
+ display: flex;
142
+ flex-direction: column;
143
+ justify-content: center;
144
+ height: 100%;
145
+ }
146
+
147
+ .chatMessageContainerInner {
148
+ position: sticky;
149
+ top: 0;
150
+ z-index: 50;
151
+ padding-top: 1.25rem;
152
+ padding-bottom: 1.25rem;
153
+ padding-left: 2rem;
154
+ padding-right: 2rem;
155
+ border-bottom-width: 1px;
156
+ border-color: #D1D5DB;
157
+ height: 5rem;
158
+ font-size: 0.875rem;
159
+ line-height: 1.25rem;
160
+ text-align: left;
161
+ color: #1F2937;
162
+ background-color: #ffffff;
163
+ }
164
+
165
+ .chatMessageContainerInnerDiv {
166
+ display: flex;
167
+ padding-left: 1rem;
168
+ padding-right: 1rem;
169
+ flex-basis: 0px;
170
+ shrink: 1;
171
+ gap: 1rem;
172
+ justify-content: flex-start;
173
+ align-items: center;
174
+ align-self: stretch;
175
+ }
176
+
177
+ .chatMessageContainerInnerDiv_button {
178
+ color: #3B82F6;
179
+ }
180
+
181
+ .chatMessageContainerInnerImg {
182
+ width: 2.5rem;
183
+ height: 2.5rem;
184
+ border-radius: 100%;
185
+ }
186
+
187
+ .chatMessageContainerOutter {
188
+ display: inline-flex;
189
+ flex-basis: 0px;
190
+ flex-direction: column;
191
+ shrink: 1;
192
+ gap: 0.25rem;
193
+ justify-content: flex-start;
194
+ align-items: flex-start;
195
+ }
196
+
197
+ .chatMessageContainerOutterDiv {
198
+ display: inline-flex;
199
+ justify-content: flex-start;
200
+ align-items: center;
201
+ align-self: stretch;
202
+ }
203
+
204
+ .chatMessageContainerOutterDiv_name {
205
+ flex-basis: 0px;
206
+ shrink: 1;
207
+ font-size: 1rem;
208
+ line-height: 1.5rem;
209
+ font-weight: 600;
210
+ line-height: 1.25;
211
+ }
212
+
213
+ .chatMessageContainerNoChat {
214
+ display: flex;
215
+ justify-content: center;
216
+ align-items: center;
217
+ width: 100%;
218
+ height: 100%;
219
+ }
220
+
221
+ .chatMessageContainerNoChat_div {
222
+ display: flex;
223
+ padding-left: 1rem;
224
+ padding-right: 1rem;
225
+ flex-direction: column;
226
+ gap: 0.5rem;
227
+ align-items: center;
228
+ font-weight: 600;
229
+ text-align: center;
230
+ color: #E5E7EB;
231
+ font-size: 1.125rem;
232
+ line-height: 1.75rem;
233
+ }
234
+
235
+ .chatMessages {
236
+ overflow: auto;
237
+ padding-left: 1rem;
238
+ padding-right: 1rem;
239
+ flex: 1 1 0%;
240
+ }
241
+
242
+ .chatMessagesBubble_me{
243
+ float: right;
244
+ background-color: #34D399;
245
+ }
246
+
247
+ .chatMessagesBubble_Other{
248
+ float: left;
249
+ background-color: #1D4ED8;
250
+ }
251
+
252
+ .chatMessage{
253
+ overflow-y: auto;
254
+ padding-left: 2rem;
255
+ padding-right: 2rem;
256
+ padding-top: 2rem;
257
+ flex-grow: 1;
258
+ max-height: 100vh;
259
+ text-align: left;
260
+ color: #374151;
261
+ }
262
+
263
+ .chatMessagesContainer{
264
+ position: relative;
265
+ margin-bottom: 1.5rem;
266
+ text-align: left;
267
+ }
268
+
269
+ .chatMessagesBubble_inner{
270
+ display: block;
271
+ position: relative;
272
+ padding-top: 0.75rem;
273
+ padding-bottom: 0.75rem;
274
+ padding-left: 1rem;
275
+ padding-right: 1rem;
276
+ border-radius: 0.375rem;
277
+ color: #ffffff;
278
+ word-break: break-all;
279
+ }
280
+
281
+ .chatMessagesBubble_Time{
282
+ display: flex;
283
+ float: right;
284
+ gap: 0.25rem;
285
+ align-items: center;
286
+ font-size: 0.75rem;
287
+ line-height: 1rem;
288
+ opacity: 0.5;
289
+ }
290
+
291
+ .chatMessageInputDiv{
292
+ position: sticky;
293
+ bottom: 0;
294
+ padding-left: 1rem;
295
+ padding-right: 1rem;
296
+ margin-top: 0.75rem;
297
+ margin-bottom: 0.75rem;
298
+ }
299
+
300
+ .chatMessageInput{
301
+ display: block;
302
+ padding: 0.625rem;
303
+ border-radius: 1rem;
304
+ border-width: 1px;
305
+ border-style: none;
306
+ outline-style: none;
307
+ width: 100%;
308
+ font-size: 0.875rem;
309
+ line-height: 1.25rem;
310
+ }
311
+
312
+ .chatMessageInputSubmit{
313
+ display: flex;
314
+ position: absolute;
315
+ top: 0;
316
+ bottom: 0;
317
+ align-items: center;
318
+ }
319
+
320
+ @media (min-width: 640px) {
321
+ .grid-container {
322
+ height: 450px;
323
+ }
324
+
325
+ .sidebarContainer {
326
+ display: none;
327
+
328
+ }
329
+
330
+ .messageContainer {
331
+ display: none;
332
+ }
333
+
334
+ .chatMessages {
335
+ padding-left: 1.5rem;
336
+ padding-right: 1.5rem;
337
+ }
338
+
339
+ }
340
+
341
+ @media (min-width: 768px) {
342
+ .grid-container {
343
+ height: 550px;
344
+ grid-template-columns: repeat(9, minmax(0, 1fr));
345
+ }
346
+
347
+ .sidebarContainer {
348
+ display: grid;
349
+ grid-column: span 3 / span 3;
350
+ }
351
+
352
+ .messageContainer {
353
+ display: grid;
354
+ grid-column: span 4 / span 4;
355
+ }
356
+
357
+ .chatMessageContainerInnerDiv_button {
358
+ display: none;
359
+ }
360
+
361
+ .chatMessages {
362
+ padding-left: 2rem;
363
+ padding-right: 2rem;
364
+ }
365
+
366
+ }