@linktr.ee/messaging-react 1.34.0 → 1.35.0-rc-1777516745

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.
@@ -20,7 +20,7 @@ const AUDIO_THUMBNAIL = '/audio-thumbnail.jpg'
20
20
  const AUDIO_SOURCE = '/audio-source.mp3'
21
21
 
22
22
  const meta: Meta = {
23
- title: 'Components/LockedAttachment',
23
+ title: 'LockedAttachment',
24
24
  parameters: { layout: 'fullscreen' },
25
25
  }
26
26
  export default meta
@@ -137,7 +137,10 @@ export const Received: StoryFn = () => {
137
137
  }, 1500)
138
138
  }}
139
139
  onDownloadClick={() => alert('Download clicked')}
140
- onFetchSource={async () => ({ sourceUrl: sourceUrl, thumbnailUrl: thumbnailUnlockedUrl })}
140
+ onFetchSource={async () => ({
141
+ sourceUrl: sourceUrl,
142
+ thumbnailUrl: thumbnailUnlockedUrl,
143
+ })}
141
144
  />
142
145
  </td>
143
146
  )
@@ -147,23 +150,34 @@ export const Received: StoryFn = () => {
147
150
  <td className="text-xs text-right font-medium text-black/40 pr-4 align-top pt-2">
148
151
  Unlocked
149
152
  </td>
150
- {VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, thumbnailUnlockedUrl, sourceUrl }) => (
151
- <td key={mimeType} className="align-top">
152
- <LockedAttachment.Visitor
153
- title={title}
154
- thumbnailUrl={thumbnailUrl}
155
- mimeType={mimeType}
156
- detail={detail}
157
- amountText="AU$9.99"
158
- paymentStatus="paid"
159
- onUnlockClick={() => alert('Unlock clicked')}
160
- onDownloadClick={() => alert('Download clicked')}
161
- onFetchSource={async () => ({ sourceUrl: sourceUrl, thumbnailUrl: thumbnailUnlockedUrl })}
162
- />
163
- </td>
164
- ))}
153
+ {VARIANTS.map(
154
+ ({
155
+ title,
156
+ mimeType,
157
+ detail,
158
+ thumbnailUrl,
159
+ thumbnailUnlockedUrl,
160
+ sourceUrl,
161
+ }) => (
162
+ <td key={mimeType} className="align-top">
163
+ <LockedAttachment.Visitor
164
+ title={title}
165
+ thumbnailUrl={thumbnailUrl}
166
+ mimeType={mimeType}
167
+ detail={detail}
168
+ amountText="AU$9.99"
169
+ paymentStatus="paid"
170
+ onUnlockClick={() => alert('Unlock clicked')}
171
+ onDownloadClick={() => alert('Download clicked')}
172
+ onFetchSource={async () => ({
173
+ sourceUrl: sourceUrl,
174
+ thumbnailUrl: thumbnailUnlockedUrl,
175
+ })}
176
+ />
177
+ </td>
178
+ )
179
+ )}
165
180
  </tr>
166
-
167
181
  </tbody>
168
182
  </Table>
169
183
  )
@@ -194,7 +208,10 @@ export const Sent: StoryFn = () => (
194
208
  detail={detail}
195
209
  onFetchSource={async () => {
196
210
  await new Promise((resolve) => setTimeout(resolve, 1500))
197
- return { sourceUrl: sourceUrl, thumbnailUrl: thumbnailUnlockedUrl }
211
+ return {
212
+ sourceUrl: sourceUrl,
213
+ thumbnailUrl: thumbnailUnlockedUrl,
214
+ }
198
215
  }}
199
216
  />
200
217
  </td>
@@ -222,42 +239,66 @@ export const Sent: StoryFn = () => (
222
239
  <td className="text-xs text-right font-medium text-black/40 pr-4 align-top pt-2">
223
240
  Sent
224
241
  </td>
225
- {VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, thumbnailUnlockedUrl, sourceUrl }) => (
226
- <td key={mimeType} className="align-top">
227
- <LockedAttachment.Creator
228
- title={title}
229
- thumbnailUrl={thumbnailUrl}
230
- mimeType={mimeType}
231
- detail={detail}
232
- amountText="AU$9.99"
233
- onFetchSource={async () => {
234
- await new Promise((resolve) => setTimeout(resolve, 1500))
235
- return { sourceUrl: sourceUrl, thumbnailUrl: thumbnailUnlockedUrl }
236
- }}
237
- />
238
- </td>
239
- ))}
242
+ {VARIANTS.map(
243
+ ({
244
+ title,
245
+ mimeType,
246
+ detail,
247
+ thumbnailUrl,
248
+ thumbnailUnlockedUrl,
249
+ sourceUrl,
250
+ }) => (
251
+ <td key={mimeType} className="align-top">
252
+ <LockedAttachment.Creator
253
+ title={title}
254
+ thumbnailUrl={thumbnailUrl}
255
+ mimeType={mimeType}
256
+ detail={detail}
257
+ amountText="AU$9.99"
258
+ onFetchSource={async () => {
259
+ await new Promise((resolve) => setTimeout(resolve, 1500))
260
+ return {
261
+ sourceUrl: sourceUrl,
262
+ thumbnailUrl: thumbnailUnlockedUrl,
263
+ }
264
+ }}
265
+ />
266
+ </td>
267
+ )
268
+ )}
240
269
  </tr>
241
270
  <tr>
242
271
  <td className="text-xs text-right font-medium text-black/40 pr-4 align-top pt-2">
243
272
  Sold
244
273
  </td>
245
- {VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, thumbnailUnlockedUrl, sourceUrl }) => (
246
- <td key={mimeType} className="align-top">
247
- <LockedAttachment.Creator
248
- title={title}
249
- thumbnailUrl={thumbnailUrl}
250
- mimeType={mimeType}
251
- detail={detail}
252
- amountText="AU$9.99"
253
- paymentStatus="paid"
254
- onFetchSource={async () => {
255
- await new Promise((resolve) => setTimeout(resolve, 1500))
256
- return { sourceUrl: sourceUrl, thumbnailUrl: thumbnailUnlockedUrl }
257
- }}
258
- />
259
- </td>
260
- ))}
274
+ {VARIANTS.map(
275
+ ({
276
+ title,
277
+ mimeType,
278
+ detail,
279
+ thumbnailUrl,
280
+ thumbnailUnlockedUrl,
281
+ sourceUrl,
282
+ }) => (
283
+ <td key={mimeType} className="align-top">
284
+ <LockedAttachment.Creator
285
+ title={title}
286
+ thumbnailUrl={thumbnailUrl}
287
+ mimeType={mimeType}
288
+ detail={detail}
289
+ amountText="AU$9.99"
290
+ paymentStatus="paid"
291
+ onFetchSource={async () => {
292
+ await new Promise((resolve) => setTimeout(resolve, 1500))
293
+ return {
294
+ sourceUrl: sourceUrl,
295
+ thumbnailUrl: thumbnailUnlockedUrl,
296
+ }
297
+ }}
298
+ />
299
+ </td>
300
+ )
301
+ )}
261
302
  </tr>
262
303
  </tbody>
263
304
  </Table>
@@ -5,7 +5,7 @@ import type { LocalMessage } from 'stream-chat'
5
5
  import { MediaMessage } from '.'
6
6
 
7
7
  const meta: Meta<typeof MediaMessage> = {
8
- title: 'Components/MediaMessage',
8
+ title: 'MediaMessage',
9
9
  component: MediaMessage,
10
10
  parameters: {
11
11
  layout: 'fullscreen',
@@ -13,15 +13,31 @@ const meta: Meta<typeof MediaMessage> = {
13
13
  }
14
14
  export default meta
15
15
 
16
- const base = (overrides: Partial<LocalMessage> = {}): LocalMessage => ({
17
- id: 'msg-1',
18
- text: '',
19
- type: 'regular',
20
- created_at: new Date(),
21
- updated_at: new Date(),
22
- attachments: [],
23
- ...overrides,
24
- })
16
+ type MessageAttachment = NonNullable<LocalMessage['attachments']>[number]
17
+
18
+ const base = (overrides: Partial<LocalMessage> = {}): LocalMessage => {
19
+ const defaultMessage: LocalMessage = {
20
+ id: 'msg-1',
21
+ text: '',
22
+ type: 'regular',
23
+ created_at: new Date(),
24
+ updated_at: new Date(),
25
+ deleted_at: null,
26
+ pinned_at: null,
27
+ status: 'received',
28
+ attachments: [],
29
+ }
30
+
31
+ return {
32
+ ...defaultMessage,
33
+ ...overrides,
34
+ created_at: overrides.created_at ?? defaultMessage.created_at,
35
+ updated_at: overrides.updated_at ?? defaultMessage.updated_at,
36
+ deleted_at: overrides.deleted_at ?? defaultMessage.deleted_at,
37
+ pinned_at: overrides.pinned_at ?? defaultMessage.pinned_at,
38
+ status: overrides.status ?? defaultMessage.status,
39
+ }
40
+ }
25
41
 
26
42
  const VARIANTS = [
27
43
  {
@@ -38,7 +54,8 @@ const VARIANTS = [
38
54
  label: 'Audio',
39
55
  attachment: {
40
56
  type: 'audio',
41
- asset_url: 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3',
57
+ asset_url:
58
+ 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3',
42
59
  mime_type: 'audio/mpeg',
43
60
  title: 'Morning Meditation',
44
61
  file_size: 6_900_000,
@@ -119,12 +136,17 @@ const Table: React.FC<{ children: React.ReactNode }> = ({ children }) => (
119
136
  </div>
120
137
  )
121
138
 
122
- const TableHead: React.FC<{ variants: readonly { label: string }[] }> = ({ variants }) => (
139
+ const TableHead: React.FC<{ variants: readonly { label: string }[] }> = ({
140
+ variants,
141
+ }) => (
123
142
  <thead>
124
143
  <tr>
125
144
  <th className="text-left text-xs font-medium text-black/40 pb-2" />
126
145
  {variants.map(({ label }) => (
127
- <th key={label} className="text-left text-xs font-medium text-black/40 pb-2">
146
+ <th
147
+ key={label}
148
+ className="text-left text-xs font-medium text-black/40 pb-2"
149
+ >
128
150
  {label}
129
151
  </th>
130
152
  ))}
@@ -144,7 +166,11 @@ export const Attachment: StoryFn = () => (
144
166
  <td key={label} className="align-top">
145
167
  <MediaMessage
146
168
  isMyMessage={false}
147
- message={base({ attachments: [attachment as LocalMessage['attachments'][number]] })}
169
+ message={base({
170
+ attachments: [
171
+ attachment as MessageAttachment,
172
+ ],
173
+ })}
148
174
  />
149
175
  </td>
150
176
  ))}
@@ -157,7 +183,11 @@ export const Attachment: StoryFn = () => (
157
183
  <td key={label} className="align-top">
158
184
  <MediaMessage
159
185
  isMyMessage={true}
160
- message={base({ attachments: [attachment as LocalMessage['attachments'][number]] })}
186
+ message={base({
187
+ attachments: [
188
+ attachment as MessageAttachment,
189
+ ],
190
+ })}
161
191
  />
162
192
  </td>
163
193
  ))}
@@ -178,7 +208,11 @@ export const Links: StoryFn = () => (
178
208
  <td key={label} className="align-top">
179
209
  <MediaMessage
180
210
  isMyMessage={false}
181
- message={base({ attachments: [attachment as LocalMessage['attachments'][number]] })}
211
+ message={base({
212
+ attachments: [
213
+ attachment as MessageAttachment,
214
+ ],
215
+ })}
182
216
  />
183
217
  </td>
184
218
  ))}
@@ -191,7 +225,11 @@ export const Links: StoryFn = () => (
191
225
  <td key={label} className="align-top">
192
226
  <MediaMessage
193
227
  isMyMessage={true}
194
- message={base({ attachments: [attachment as LocalMessage['attachments'][number]] })}
228
+ message={base({
229
+ attachments: [
230
+ attachment as MessageAttachment,
231
+ ],
232
+ })}
195
233
  />
196
234
  </td>
197
235
  ))}
package/src/styles.css CHANGED
@@ -185,10 +185,6 @@
185
185
  bottom: 0;
186
186
  }
187
187
 
188
- .str-chat__typing-indicator {
189
- inset-inline: auto;
190
- }
191
-
192
188
  /* Channel list load-more button overrides */
193
189
  .str-chat__channel-list .str-chat__load-more-button__button {
194
190
  background-color: #121110;