@linktr.ee/messaging-react 1.30.0 → 1.30.1-rc-1776660256
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/dist/{Creator-77XnrIxc.js → Creator-C8EwYYcW.js} +83 -83
- package/dist/Creator-C8EwYYcW.js.map +1 -0
- package/dist/{MediaPlayer-Bf-xPB8Z.js → MediaPlayer-dT6eJALR.js} +60 -62
- package/dist/MediaPlayer-dT6eJALR.js.map +1 -0
- package/dist/{Visitor-C9HSYm3D.js → Visitor-BACiehsg.js} +81 -78
- package/dist/Visitor-BACiehsg.js.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomMessage/index.tsx +1 -1
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +41 -41
- package/src/components/LockedAttachment/components/Creator.tsx +41 -41
- package/src/components/LockedAttachment/components/MediaPlayer.tsx +3 -8
- package/src/components/LockedAttachment/components/Visitor.tsx +49 -39
- package/src/components/LockedAttachment/index.tsx +1 -1
- package/src/components/LockedAttachment/types.ts +2 -2
- package/src/types.ts +4 -1
- package/dist/Creator-77XnrIxc.js.map +0 -1
- package/dist/MediaPlayer-Bf-xPB8Z.js.map +0 -1
- package/dist/Visitor-C9HSYm3D.js.map +0 -1
package/package.json
CHANGED
|
@@ -206,7 +206,7 @@ const CustomMessageWithContext = (props: CustomMessageWithContextProps) => {
|
|
|
206
206
|
<LockedAttachment
|
|
207
207
|
title={message.metadata?.attachment_title}
|
|
208
208
|
mimeType={message.metadata?.attachment_mime_type}
|
|
209
|
-
|
|
209
|
+
thumbnailUrl={message.metadata?.attachment_thumbnail}
|
|
210
210
|
amountText={message.metadata?.amount_text}
|
|
211
211
|
detail={message.metadata?.attachment_detail}
|
|
212
212
|
paymentStatus={message.metadata?.payment_status}
|
|
@@ -33,40 +33,40 @@ const VARIANTS = [
|
|
|
33
33
|
title: "Alicia's Workout Plan",
|
|
34
34
|
mimeType: 'video/mp4',
|
|
35
35
|
detail: '1:20',
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
thumbnailUrl: VIDEO_THUMBNAIL_BLURRED,
|
|
37
|
+
sourceUrl: VIDEO_SOURCE,
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
label: 'Audio',
|
|
41
41
|
title: 'Morning Meditation',
|
|
42
42
|
mimeType: 'audio/mpeg',
|
|
43
43
|
detail: '4:35',
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
thumbnailUrl: AUDIO_THUMBNAIL,
|
|
45
|
+
sourceUrl: AUDIO_SOURCE,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
label: 'Image',
|
|
49
49
|
title: 'Picture of my cat',
|
|
50
50
|
mimeType: 'image/jpeg',
|
|
51
51
|
detail: '3.2 MB',
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
thumbnailUrl: IMAGE_THUMBNAIL_BLURRED,
|
|
53
|
+
sourceUrl: IMAGE_SOURCE,
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
label: 'Document',
|
|
57
57
|
title: 'Strength Training Guide',
|
|
58
58
|
mimeType: 'application/zip',
|
|
59
59
|
detail: '14 files',
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
thumbnailUrl: DOCUMENT_THUMBNAIL,
|
|
61
|
+
sourceUrl: DOCUMENT_SOURCE,
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
label: 'Unknown',
|
|
65
65
|
title: 'Unknown Attachment',
|
|
66
66
|
mimeType: 'application/octet-stream',
|
|
67
67
|
detail: undefined,
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
thumbnailUrl: undefined,
|
|
69
|
+
sourceUrl: DOCUMENT_SOURCE,
|
|
70
70
|
},
|
|
71
71
|
]
|
|
72
72
|
|
|
@@ -76,28 +76,28 @@ const NO_THUMBNAIL_VARIANTS = [
|
|
|
76
76
|
title: "Alicia's Workout Plan",
|
|
77
77
|
mimeType: 'video/mp4',
|
|
78
78
|
detail: '1:20',
|
|
79
|
-
|
|
79
|
+
sourceUrl: VIDEO_SOURCE,
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
label: 'Audio',
|
|
83
83
|
title: 'Morning Meditation',
|
|
84
84
|
mimeType: 'audio/mpeg',
|
|
85
85
|
detail: '4:35',
|
|
86
|
-
|
|
86
|
+
sourceUrl: AUDIO_SOURCE,
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
label: 'Image',
|
|
90
90
|
title: 'Picture of my cat',
|
|
91
91
|
mimeType: 'image/jpeg',
|
|
92
92
|
detail: '3.2 MB',
|
|
93
|
-
|
|
93
|
+
sourceUrl: IMAGE_SOURCE,
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
label: 'Document',
|
|
97
97
|
title: 'Strength Training Guide',
|
|
98
98
|
mimeType: 'application/zip',
|
|
99
99
|
detail: '14 files',
|
|
100
|
-
|
|
100
|
+
sourceUrl: DOCUMENT_SOURCE,
|
|
101
101
|
},
|
|
102
102
|
]
|
|
103
103
|
|
|
@@ -135,15 +135,15 @@ export const Visitor: StoryFn = () => (
|
|
|
135
135
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
136
136
|
Locked
|
|
137
137
|
</td>
|
|
138
|
-
{VARIANTS.map(({ title, mimeType, detail,
|
|
138
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
139
139
|
<td key={mimeType} className="align-top">
|
|
140
140
|
<LockedAttachment
|
|
141
141
|
title={title}
|
|
142
142
|
amountText="AU$9.99"
|
|
143
|
-
|
|
143
|
+
thumbnailUrl={thumbnailUrl}
|
|
144
144
|
mimeType={mimeType}
|
|
145
145
|
detail={detail}
|
|
146
|
-
onUnlock={withDelay(() => ({
|
|
146
|
+
onUnlock={withDelay(() => ({ sourceUrl }))}
|
|
147
147
|
onDownload={() => {}}
|
|
148
148
|
/>
|
|
149
149
|
</td>
|
|
@@ -153,16 +153,16 @@ export const Visitor: StoryFn = () => (
|
|
|
153
153
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
154
154
|
Purchased
|
|
155
155
|
</td>
|
|
156
|
-
{VARIANTS.map(({ title, mimeType, detail,
|
|
156
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
157
157
|
<td key={mimeType} className="align-top">
|
|
158
158
|
<LockedAttachment
|
|
159
159
|
title={title}
|
|
160
160
|
amountText="AU$9.99"
|
|
161
|
-
|
|
161
|
+
thumbnailUrl={thumbnailUrl}
|
|
162
162
|
mimeType={mimeType}
|
|
163
163
|
detail={detail}
|
|
164
164
|
paymentStatus="paid"
|
|
165
|
-
onUnlock={withDelay(() => ({
|
|
165
|
+
onUnlock={withDelay(() => ({ sourceUrl }))}
|
|
166
166
|
onDownload={() => {}}
|
|
167
167
|
/>
|
|
168
168
|
</td>
|
|
@@ -172,12 +172,12 @@ export const Visitor: StoryFn = () => (
|
|
|
172
172
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
173
173
|
Unlocked
|
|
174
174
|
</td>
|
|
175
|
-
{VARIANTS.map(({ title, mimeType, detail,
|
|
175
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
176
176
|
<td key={mimeType} className="align-top">
|
|
177
177
|
<LockedAttachment
|
|
178
178
|
title={title}
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
thumbnailUrl={thumbnailUrl}
|
|
180
|
+
sourceUrl={sourceUrl}
|
|
181
181
|
mimeType={mimeType}
|
|
182
182
|
detail={detail}
|
|
183
183
|
amountText="AU$9.99"
|
|
@@ -199,12 +199,12 @@ export const Creator: StoryFn = () => (
|
|
|
199
199
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
200
200
|
Preview
|
|
201
201
|
</td>
|
|
202
|
-
{VARIANTS.map(({ mimeType, detail,
|
|
202
|
+
{VARIANTS.map(({ mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
203
203
|
<td key={mimeType} className="align-top">
|
|
204
204
|
<LockedAttachment
|
|
205
205
|
isPreview
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
thumbnailUrl={thumbnailUrl}
|
|
207
|
+
sourceUrl={sourceUrl}
|
|
208
208
|
mimeType={mimeType}
|
|
209
209
|
detail={detail}
|
|
210
210
|
placeholderAmountText="A$0.00"
|
|
@@ -216,12 +216,12 @@ export const Creator: StoryFn = () => (
|
|
|
216
216
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
217
217
|
Pending
|
|
218
218
|
</td>
|
|
219
|
-
{VARIANTS.map(({ title, mimeType, detail,
|
|
219
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
220
220
|
<td key={mimeType} className="align-top">
|
|
221
221
|
<LockedAttachment
|
|
222
222
|
title={title}
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
thumbnailUrl={thumbnailUrl}
|
|
224
|
+
sourceUrl={sourceUrl}
|
|
225
225
|
mimeType={mimeType}
|
|
226
226
|
detail={detail}
|
|
227
227
|
amountText="AU$9.99"
|
|
@@ -234,13 +234,13 @@ export const Creator: StoryFn = () => (
|
|
|
234
234
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
235
235
|
Sent
|
|
236
236
|
</td>
|
|
237
|
-
{VARIANTS.map(({ title, mimeType, detail,
|
|
237
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
238
238
|
<td key={mimeType} className="align-top">
|
|
239
239
|
<LockedAttachment
|
|
240
240
|
|
|
241
241
|
title={title}
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
thumbnailUrl={thumbnailUrl}
|
|
243
|
+
sourceUrl={sourceUrl}
|
|
244
244
|
mimeType={mimeType}
|
|
245
245
|
detail={detail}
|
|
246
246
|
amountText="AU$9.99"
|
|
@@ -252,12 +252,12 @@ export const Creator: StoryFn = () => (
|
|
|
252
252
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
253
253
|
Sold
|
|
254
254
|
</td>
|
|
255
|
-
{VARIANTS.map(({ title, mimeType, detail,
|
|
255
|
+
{VARIANTS.map(({ title, mimeType, detail, thumbnailUrl, sourceUrl }) => (
|
|
256
256
|
<td key={mimeType} className="align-top">
|
|
257
257
|
<LockedAttachment
|
|
258
258
|
title={title}
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
thumbnailUrl={thumbnailUrl}
|
|
260
|
+
sourceUrl={sourceUrl}
|
|
261
261
|
mimeType={mimeType}
|
|
262
262
|
detail={detail}
|
|
263
263
|
amountText="AU$9.99"
|
|
@@ -278,11 +278,11 @@ export const NoThumbnail: StoryFn = () => (
|
|
|
278
278
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
279
279
|
Creator
|
|
280
280
|
</td>
|
|
281
|
-
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail,
|
|
281
|
+
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail, sourceUrl }) => (
|
|
282
282
|
<td key={mimeType} className="align-top">
|
|
283
283
|
<LockedAttachment
|
|
284
284
|
title={title}
|
|
285
|
-
|
|
285
|
+
sourceUrl={sourceUrl}
|
|
286
286
|
mimeType={mimeType}
|
|
287
287
|
detail={detail}
|
|
288
288
|
amountText="AU$9.99"
|
|
@@ -294,14 +294,14 @@ export const NoThumbnail: StoryFn = () => (
|
|
|
294
294
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
295
295
|
Locked
|
|
296
296
|
</td>
|
|
297
|
-
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail,
|
|
297
|
+
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail, sourceUrl }) => (
|
|
298
298
|
<td key={mimeType} className="align-top">
|
|
299
299
|
<LockedAttachment
|
|
300
300
|
title={title}
|
|
301
301
|
amountText="AU$9.99"
|
|
302
302
|
mimeType={mimeType}
|
|
303
303
|
detail={detail}
|
|
304
|
-
onUnlock={withDelay(() => ({
|
|
304
|
+
onUnlock={withDelay(() => ({ sourceUrl }))}
|
|
305
305
|
onDownload={() => {}}
|
|
306
306
|
/>
|
|
307
307
|
</td>
|
|
@@ -311,11 +311,11 @@ export const NoThumbnail: StoryFn = () => (
|
|
|
311
311
|
<td className="text-xs font-medium text-black/40 pr-4 align-top pt-2">
|
|
312
312
|
Unlocked
|
|
313
313
|
</td>
|
|
314
|
-
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail,
|
|
314
|
+
{NO_THUMBNAIL_VARIANTS.map(({ title, mimeType, detail, sourceUrl }) => (
|
|
315
315
|
<td key={mimeType} className="align-top">
|
|
316
316
|
<LockedAttachment
|
|
317
317
|
title={title}
|
|
318
|
-
|
|
318
|
+
sourceUrl={sourceUrl}
|
|
319
319
|
mimeType={mimeType}
|
|
320
320
|
detail={detail}
|
|
321
321
|
amountText="AU$9.99"
|
|
@@ -43,7 +43,7 @@ const CloseButton: React.FC<CloseButtonProps> = (props) => {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
interface CollapsedThumbnailProps {
|
|
46
|
-
|
|
46
|
+
thumbnailUrl?: string
|
|
47
47
|
mimeType: string
|
|
48
48
|
overlayIcon?: React.ElementType
|
|
49
49
|
darkOverlay?: boolean
|
|
@@ -51,7 +51,7 @@ interface CollapsedThumbnailProps {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const CollapsedThumbnail: React.FC<CollapsedThumbnailProps> = (props) => {
|
|
54
|
-
const {
|
|
54
|
+
const { thumbnailUrl, mimeType, overlayIcon: OverlayIcon, darkOverlay, onClick } = props
|
|
55
55
|
return (
|
|
56
56
|
<button
|
|
57
57
|
type="button"
|
|
@@ -63,9 +63,9 @@ const CollapsedThumbnail: React.FC<CollapsedThumbnailProps> = (props) => {
|
|
|
63
63
|
onClick={onClick}
|
|
64
64
|
aria-label={OverlayIcon ? 'Toggle preview' : undefined}
|
|
65
65
|
>
|
|
66
|
-
{
|
|
66
|
+
{thumbnailUrl ? (
|
|
67
67
|
<img
|
|
68
|
-
src={
|
|
68
|
+
src={thumbnailUrl}
|
|
69
69
|
alt=""
|
|
70
70
|
className="absolute inset-0 h-full w-full object-cover"
|
|
71
71
|
/>
|
|
@@ -91,13 +91,13 @@ const CollapsedThumbnail: React.FC<CollapsedThumbnailProps> = (props) => {
|
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
interface AudioPreviewProps {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
sourceUrl?: string
|
|
95
|
+
thumbnailUrl?: string
|
|
96
96
|
mimeType: string
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const AudioPreview: React.FC<AudioPreviewProps> = (props) => {
|
|
100
|
-
const {
|
|
100
|
+
const { sourceUrl, thumbnailUrl, mimeType } = props
|
|
101
101
|
const [playing, setPlaying] = useState(false)
|
|
102
102
|
const [played, setPlayed] = useState(0)
|
|
103
103
|
const [seeking, setSeeking] = useState(false)
|
|
@@ -137,7 +137,7 @@ const AudioPreview: React.FC<AudioPreviewProps> = (props) => {
|
|
|
137
137
|
setPlaying(false)
|
|
138
138
|
setPlayed(0)
|
|
139
139
|
setAudioReady(false)
|
|
140
|
-
}, [
|
|
140
|
+
}, [sourceUrl])
|
|
141
141
|
|
|
142
142
|
const getFraction = useCallback(
|
|
143
143
|
(e: MouseEvent | TouchEvent | React.MouseEvent | React.TouchEvent) => {
|
|
@@ -185,10 +185,10 @@ const AudioPreview: React.FC<AudioPreviewProps> = (props) => {
|
|
|
185
185
|
|
|
186
186
|
return (
|
|
187
187
|
<div className="relative">
|
|
188
|
-
{
|
|
188
|
+
{sourceUrl && (
|
|
189
189
|
<audio
|
|
190
190
|
ref={audioRef}
|
|
191
|
-
src={
|
|
191
|
+
src={sourceUrl}
|
|
192
192
|
loop
|
|
193
193
|
onCanPlay={() => setAudioReady(true)}
|
|
194
194
|
onEnded={() => {
|
|
@@ -200,12 +200,12 @@ const AudioPreview: React.FC<AudioPreviewProps> = (props) => {
|
|
|
200
200
|
</audio>
|
|
201
201
|
)}
|
|
202
202
|
<CollapsedThumbnail
|
|
203
|
-
|
|
203
|
+
thumbnailUrl={thumbnailUrl}
|
|
204
204
|
mimeType={mimeType}
|
|
205
|
-
overlayIcon={
|
|
206
|
-
onClick={
|
|
205
|
+
overlayIcon={sourceUrl && audioReady ? (playing ? PauseIcon : PlayIcon) : undefined}
|
|
206
|
+
onClick={sourceUrl && audioReady ? toggle : undefined}
|
|
207
207
|
/>
|
|
208
|
-
{
|
|
208
|
+
{sourceUrl && audioReady && (
|
|
209
209
|
<div className="absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent">
|
|
210
210
|
<div
|
|
211
211
|
ref={trackRef}
|
|
@@ -250,22 +250,22 @@ const AudioPreview: React.FC<AudioPreviewProps> = (props) => {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
interface VideoPreviewProps {
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
sourceUrl?: string
|
|
254
|
+
thumbnailUrl?: string
|
|
255
255
|
mimeType: string
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
const VideoPreview: React.FC<VideoPreviewProps> = (props) => {
|
|
259
|
-
const {
|
|
259
|
+
const { sourceUrl, thumbnailUrl, mimeType } = props
|
|
260
260
|
const [expanded, setExpanded] = useState(false)
|
|
261
261
|
const collapse = () => setExpanded(false)
|
|
262
262
|
|
|
263
263
|
useEffect(() => {
|
|
264
264
|
setExpanded(false)
|
|
265
|
-
}, [
|
|
265
|
+
}, [sourceUrl])
|
|
266
266
|
|
|
267
|
-
if (!
|
|
268
|
-
return <CollapsedThumbnail
|
|
267
|
+
if (!sourceUrl) {
|
|
268
|
+
return <CollapsedThumbnail thumbnailUrl={thumbnailUrl} mimeType={mimeType} />
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
return (
|
|
@@ -275,9 +275,9 @@ const VideoPreview: React.FC<VideoPreviewProps> = (props) => {
|
|
|
275
275
|
})}
|
|
276
276
|
>
|
|
277
277
|
<MediaPlayer
|
|
278
|
-
source={
|
|
278
|
+
source={sourceUrl}
|
|
279
279
|
mimeType={mimeType}
|
|
280
|
-
poster={
|
|
280
|
+
poster={thumbnailUrl}
|
|
281
281
|
playing={expanded}
|
|
282
282
|
loop
|
|
283
283
|
controls={false}
|
|
@@ -292,9 +292,9 @@ const VideoPreview: React.FC<VideoPreviewProps> = (props) => {
|
|
|
292
292
|
onClick={() => setExpanded(true)}
|
|
293
293
|
aria-label="Expand video preview"
|
|
294
294
|
>
|
|
295
|
-
{
|
|
295
|
+
{thumbnailUrl ? (
|
|
296
296
|
<img
|
|
297
|
-
src={
|
|
297
|
+
src={thumbnailUrl}
|
|
298
298
|
alt=""
|
|
299
299
|
className="absolute inset-0 h-full w-full object-cover"
|
|
300
300
|
/>
|
|
@@ -317,22 +317,22 @@ const VideoPreview: React.FC<VideoPreviewProps> = (props) => {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
interface ImagePreviewProps {
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
sourceUrl?: string
|
|
321
|
+
thumbnailUrl?: string
|
|
322
322
|
mimeType: string
|
|
323
323
|
title?: string
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
327
|
-
const {
|
|
327
|
+
const { sourceUrl, thumbnailUrl, mimeType, title } = props
|
|
328
328
|
const [expanded, setExpanded] = useState(false)
|
|
329
329
|
const collapse = () => setExpanded(false)
|
|
330
330
|
|
|
331
331
|
useEffect(() => {
|
|
332
332
|
setExpanded(false)
|
|
333
|
-
}, [
|
|
333
|
+
}, [sourceUrl])
|
|
334
334
|
|
|
335
|
-
if (expanded &&
|
|
335
|
+
if (expanded && sourceUrl) {
|
|
336
336
|
return (
|
|
337
337
|
<div className="relative">
|
|
338
338
|
<button
|
|
@@ -341,7 +341,7 @@ const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
|
341
341
|
onClick={collapse}
|
|
342
342
|
aria-label="Close preview"
|
|
343
343
|
>
|
|
344
|
-
<img src={
|
|
344
|
+
<img src={sourceUrl} alt={title ?? ''} className="block w-full" />
|
|
345
345
|
</button>
|
|
346
346
|
<CloseButton onClose={collapse} />
|
|
347
347
|
</div>
|
|
@@ -350,10 +350,10 @@ const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
|
350
350
|
|
|
351
351
|
return (
|
|
352
352
|
<CollapsedThumbnail
|
|
353
|
-
|
|
353
|
+
thumbnailUrl={thumbnailUrl}
|
|
354
354
|
mimeType={mimeType}
|
|
355
|
-
overlayIcon={
|
|
356
|
-
onClick={
|
|
355
|
+
overlayIcon={sourceUrl ? EyeSlashIcon : undefined}
|
|
356
|
+
onClick={sourceUrl ? () => setExpanded(true) : undefined}
|
|
357
357
|
/>
|
|
358
358
|
)
|
|
359
359
|
}
|
|
@@ -363,8 +363,8 @@ const CreatorCard: React.FC<CreatorCardProps> = (props) => {
|
|
|
363
363
|
const {
|
|
364
364
|
title,
|
|
365
365
|
mimeType = 'application/octet-stream',
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
thumbnailUrl,
|
|
367
|
+
sourceUrl,
|
|
368
368
|
detail,
|
|
369
369
|
amountText,
|
|
370
370
|
placeholderTitle = 'Attachment title',
|
|
@@ -380,17 +380,17 @@ const CreatorCard: React.FC<CreatorCardProps> = (props) => {
|
|
|
380
380
|
let mediaPreview: React.ReactNode
|
|
381
381
|
if (isPreview && sourceType === 'audio') {
|
|
382
382
|
mediaPreview = (
|
|
383
|
-
<AudioPreview
|
|
383
|
+
<AudioPreview sourceUrl={sourceUrl} thumbnailUrl={thumbnailUrl} mimeType={mimeType} />
|
|
384
384
|
)
|
|
385
385
|
} else if (isPreview && sourceType === 'video') {
|
|
386
386
|
mediaPreview = (
|
|
387
|
-
<VideoPreview
|
|
387
|
+
<VideoPreview sourceUrl={sourceUrl} thumbnailUrl={thumbnailUrl} mimeType={mimeType} />
|
|
388
388
|
)
|
|
389
389
|
} else if (isPreview && sourceType === 'image') {
|
|
390
390
|
mediaPreview = (
|
|
391
391
|
<ImagePreview
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
sourceUrl={sourceUrl}
|
|
393
|
+
thumbnailUrl={thumbnailUrl}
|
|
394
394
|
mimeType={mimeType}
|
|
395
395
|
title={title}
|
|
396
396
|
/>
|
|
@@ -403,7 +403,7 @@ const CreatorCard: React.FC<CreatorCardProps> = (props) => {
|
|
|
403
403
|
: LockIcon
|
|
404
404
|
mediaPreview = (
|
|
405
405
|
<CollapsedThumbnail
|
|
406
|
-
|
|
406
|
+
thumbnailUrl={thumbnailUrl}
|
|
407
407
|
mimeType={mimeType}
|
|
408
408
|
overlayIcon={lockedOverlayIcon}
|
|
409
409
|
darkOverlay
|
|
@@ -412,7 +412,7 @@ const CreatorCard: React.FC<CreatorCardProps> = (props) => {
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
return (
|
|
415
|
-
<div className="relative w-[280px] select-none overflow-hidden rounded-[24px] bg-white shadow-
|
|
415
|
+
<div className="relative w-[280px] select-none overflow-hidden rounded-[24px] bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]">
|
|
416
416
|
{onDismiss && (
|
|
417
417
|
<button
|
|
418
418
|
type="button"
|
|
@@ -197,14 +197,15 @@ const MediaPlayer: React.FC<MediaPlayerProps> = ({
|
|
|
197
197
|
if (controls) setPlaying((p) => !p)
|
|
198
198
|
}}
|
|
199
199
|
>
|
|
200
|
-
{poster
|
|
200
|
+
{/* For audio, poster persists as a visual background. For video, hide once loaded. */}
|
|
201
|
+
{poster && (sourceType === 'audio' || initialLoad) && (
|
|
201
202
|
<img
|
|
202
203
|
src={poster}
|
|
203
204
|
alt=""
|
|
204
205
|
className="absolute inset-0 h-full w-full object-cover"
|
|
205
206
|
/>
|
|
206
207
|
)}
|
|
207
|
-
{!poster && (
|
|
208
|
+
{!poster && (sourceType === 'audio' || initialLoad) && (
|
|
208
209
|
<div className="absolute inset-0 flex items-center justify-center">
|
|
209
210
|
{renderTypeIcon(mimeType, {
|
|
210
211
|
className: 'size-12 text-black/20',
|
|
@@ -212,11 +213,6 @@ const MediaPlayer: React.FC<MediaPlayerProps> = ({
|
|
|
212
213
|
})}
|
|
213
214
|
</div>
|
|
214
215
|
)}
|
|
215
|
-
{initialLoad && poster && (
|
|
216
|
-
<div className="absolute inset-0 z-20">
|
|
217
|
-
<img src={poster} alt="" className="h-full w-full object-cover" />
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
216
|
<div className="absolute inset-0">
|
|
221
217
|
{sourceType === 'audio' ? (
|
|
222
218
|
<audio
|
|
@@ -242,7 +238,6 @@ const MediaPlayer: React.FC<MediaPlayerProps> = ({
|
|
|
242
238
|
<video
|
|
243
239
|
ref={playerRef as React.RefObject<HTMLVideoElement>}
|
|
244
240
|
src={source}
|
|
245
|
-
poster={poster}
|
|
246
241
|
loop={loop}
|
|
247
242
|
muted={muted}
|
|
248
243
|
playsInline
|