@flamingo-stack/openframe-frontend-core 0.0.396 → 0.0.397-snapshot.20260710042522
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/{chunk-EKYE2VJU.js → chunk-3MMYFUWX.js} +4 -4
- package/dist/{chunk-HWJUWOXK.cjs → chunk-5IZDYGPU.cjs} +12 -12
- package/dist/{chunk-HWJUWOXK.cjs.map → chunk-5IZDYGPU.cjs.map} +1 -1
- package/dist/{chunk-OP3H7VB2.js → chunk-5SGIFYSA.js} +2 -2
- package/dist/{chunk-AODSKL5I.cjs → chunk-BIQH2W35.cjs} +9 -9
- package/dist/{chunk-AODSKL5I.cjs.map → chunk-BIQH2W35.cjs.map} +1 -1
- package/dist/{chunk-H4WIS6RJ.js → chunk-D3EAVXAQ.js} +2 -2
- package/dist/{chunk-XQILJ7FF.cjs → chunk-I4D6KJLI.cjs} +5 -5
- package/dist/{chunk-XQILJ7FF.cjs.map → chunk-I4D6KJLI.cjs.map} +1 -1
- package/dist/{chunk-TIC3UE6L.js → chunk-JAO2PKOU.js} +2 -2
- package/dist/{chunk-2PTEK3D6.js → chunk-KOIH637Y.js} +2 -2
- package/dist/{chunk-GA3R77TB.js → chunk-LHICE5MK.js} +2 -2
- package/dist/{chunk-CCV6Z3CL.cjs → chunk-MBWSBKSG.cjs} +26 -26
- package/dist/{chunk-CCV6Z3CL.cjs.map → chunk-MBWSBKSG.cjs.map} +1 -1
- package/dist/{chunk-PQXUY6SB.js → chunk-MH5U4ZMV.js} +2 -2
- package/dist/{chunk-SV7IJPIH.js → chunk-NLYOIYUB.js} +5456 -5015
- package/dist/chunk-NLYOIYUB.js.map +1 -0
- package/dist/{chunk-STEM5CPV.js → chunk-PKRHMZBN.js} +4 -4
- package/dist/{chunk-Y36KVLBX.cjs → chunk-PZIZOFPY.cjs} +1260 -819
- package/dist/chunk-PZIZOFPY.cjs.map +1 -0
- package/dist/{chunk-J2UHW4UM.js → chunk-QCUHIPG3.js} +2 -2
- package/dist/{chunk-KRMGVMIO.cjs → chunk-QOMEGWOM.cjs} +31 -31
- package/dist/{chunk-KRMGVMIO.cjs.map → chunk-QOMEGWOM.cjs.map} +1 -1
- package/dist/{chunk-HNXZFKDQ.cjs → chunk-THE2AFUN.cjs} +62 -62
- package/dist/{chunk-HNXZFKDQ.cjs.map → chunk-THE2AFUN.cjs.map} +1 -1
- package/dist/{chunk-NFRHBR7W.js → chunk-WR74UUVM.js} +4 -4
- package/dist/{chunk-RUYZ5QMK.cjs → chunk-WRS7OVIT.cjs} +37 -37
- package/dist/{chunk-RUYZ5QMK.cjs.map → chunk-WRS7OVIT.cjs.map} +1 -1
- package/dist/{chunk-FAUC7EA3.js → chunk-WX3MHQRH.js} +4 -4
- package/dist/{chunk-6DGQPKVA.cjs → chunk-XFOSQQKD.cjs} +26 -26
- package/dist/{chunk-6DGQPKVA.cjs.map → chunk-XFOSQQKD.cjs.map} +1 -1
- package/dist/{chunk-HEH47UTC.cjs → chunk-XQ35TKEM.cjs} +15 -15
- package/dist/{chunk-HEH47UTC.cjs.map → chunk-XQ35TKEM.cjs.map} +1 -1
- package/dist/{chunk-NAFW3LKI.cjs → chunk-Y2QAEMGF.cjs} +7 -7
- package/dist/{chunk-NAFW3LKI.cjs.map → chunk-Y2QAEMGF.cjs.map} +1 -1
- package/dist/{chunk-VSPNWVIE.cjs → chunk-YSI6FXZH.cjs} +59 -59
- package/dist/{chunk-VSPNWVIE.cjs.map → chunk-YSI6FXZH.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +8 -8
- package/dist/components/case-studies/index.js +2 -2
- package/dist/components/chat/entity-cards/blog-card.d.ts +6 -3
- package/dist/components/chat/entity-cards/blog-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/case-study-card.d.ts +7 -3
- package/dist/components/chat/entity-cards/case-study-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/customer-interview-card.d.ts +6 -3
- package/dist/components/chat/entity-cards/customer-interview-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/entity-portrait-card.d.ts +59 -0
- package/dist/components/chat/entity-cards/entity-portrait-card.d.ts.map +1 -0
- package/dist/components/chat/entity-cards/index.d.ts +3 -0
- package/dist/components/chat/entity-cards/index.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/investor-update-card.d.ts +6 -3
- package/dist/components/chat/entity-cards/investor-update-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts +4 -2
- package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/program-card.d.ts +17 -5
- package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/use-cover-image-fallback.d.ts +26 -0
- package/dist/components/chat/entity-cards/use-cover-image-fallback.d.ts.map +1 -0
- package/dist/components/chat/index.cjs +10 -2
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +9 -1
- package/dist/components/chat/types/entities/program-types.d.ts +23 -0
- package/dist/components/chat/types/entities/program-types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/docs/index.cjs +5 -5
- package/dist/components/docs/index.js +4 -4
- package/dist/components/embeds/index.cjs +3 -3
- package/dist/components/embeds/index.js +2 -2
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/cards-strip.d.ts.map +1 -1
- package/dist/components/features/index.cjs +6 -2
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.d.ts +1 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/index.js +5 -1
- package/dist/components/features/video-bites-strip.d.ts.map +1 -1
- package/dist/components/features/video-center-badge.d.ts +36 -0
- package/dist/components/features/video-center-badge.d.ts.map +1 -0
- package/dist/components/features/video.d.ts +7 -0
- package/dist/components/features/video.d.ts.map +1 -1
- package/dist/components/help-center-pages/index.cjs +20 -20
- package/dist/components/help-center-pages/index.js +11 -11
- package/dist/components/index.cjs +134 -120
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +23 -9
- package/dist/components/index.js.map +1 -1
- package/dist/components/media-carousel.d.ts.map +1 -1
- package/dist/components/navigation/index.cjs +2 -2
- package/dist/components/navigation/index.js +1 -1
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/onboarding-guides/index.js +4 -4
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +5 -5
- package/dist/components/tickets/index.js +4 -4
- package/dist/components/ui/crossfade-panels.d.ts +52 -0
- package/dist/components/ui/crossfade-panels.d.ts.map +1 -0
- package/dist/components/ui/index.cjs +12 -2
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +11 -1
- package/dist/components/ui/tab-navigation.d.ts +6 -2
- package/dist/components/ui/tab-navigation.d.ts.map +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -1
- package/package.json +4 -4
- package/src/components/chat/entity-cards/blog-card.tsx +40 -7
- package/src/components/chat/entity-cards/case-study-card.tsx +32 -6
- package/src/components/chat/entity-cards/customer-interview-card.tsx +31 -6
- package/src/components/chat/entity-cards/entity-portrait-card.tsx +201 -0
- package/src/components/chat/entity-cards/index.ts +18 -0
- package/src/components/chat/entity-cards/investor-update-card.tsx +28 -2
- package/src/components/chat/entity-cards/onboarding-guide-card.tsx +30 -1
- package/src/components/chat/entity-cards/program-card.tsx +69 -17
- package/src/components/chat/entity-cards/use-cover-image-fallback.ts +50 -0
- package/src/components/chat/types/entities/program-types.ts +34 -0
- package/src/components/features/cards-strip.tsx +122 -8
- package/src/components/features/index.ts +1 -0
- package/src/components/features/video-bites-strip.tsx +77 -15
- package/src/components/features/video-center-badge.tsx +76 -0
- package/src/components/features/video.tsx +51 -7
- package/src/components/media-carousel.tsx +2 -4
- package/src/components/ui/crossfade-panels.tsx +88 -0
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/tab-navigation.tsx +31 -14
- package/src/styles/app-globals.css +23 -0
- package/dist/chunk-SV7IJPIH.js.map +0 -1
- package/dist/chunk-Y36KVLBX.cjs.map +0 -1
- /package/dist/{chunk-EKYE2VJU.js.map → chunk-3MMYFUWX.js.map} +0 -0
- /package/dist/{chunk-OP3H7VB2.js.map → chunk-5SGIFYSA.js.map} +0 -0
- /package/dist/{chunk-H4WIS6RJ.js.map → chunk-D3EAVXAQ.js.map} +0 -0
- /package/dist/{chunk-TIC3UE6L.js.map → chunk-JAO2PKOU.js.map} +0 -0
- /package/dist/{chunk-2PTEK3D6.js.map → chunk-KOIH637Y.js.map} +0 -0
- /package/dist/{chunk-GA3R77TB.js.map → chunk-LHICE5MK.js.map} +0 -0
- /package/dist/{chunk-PQXUY6SB.js.map → chunk-MH5U4ZMV.js.map} +0 -0
- /package/dist/{chunk-STEM5CPV.js.map → chunk-PKRHMZBN.js.map} +0 -0
- /package/dist/{chunk-J2UHW4UM.js.map → chunk-QCUHIPG3.js.map} +0 -0
- /package/dist/{chunk-NFRHBR7W.js.map → chunk-WR74UUVM.js.map} +0 -0
- /package/dist/{chunk-FAUC7EA3.js.map → chunk-WX3MHQRH.js.map} +0 -0
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ProgramCard (pure presentation). Generic card for podcasts / webinars /
|
|
5
|
-
* events.
|
|
6
|
-
* horizontal for chat-inline)
|
|
5
|
+
* events. Three densities — `default` (wide horizontal detail, archive
|
|
6
|
+
* pages), `sm` (compact horizontal for chat-inline), and `portrait`
|
|
7
|
+
* (vertical rail/strip card).
|
|
8
|
+
*
|
|
9
|
+
* `portrait` exists because mixed-content rails MUST share ONE card anatomy
|
|
10
|
+
* (2026 card-UI practice: a rail mixes content types, never card layouts —
|
|
11
|
+
* mixing orientations/aspects in one scroller is the anti-pattern). It
|
|
12
|
+
* renders the SAME three zones as the other portrait entity cards
|
|
13
|
+
* (CaseStudyCard et al.): wide media slot → fixed 72px title zone → fixed
|
|
14
|
+
* 60px person/meta footer, p-6 / gap-6. The program's identity lives in the
|
|
15
|
+
* Azeret Mono title and the date · duration meta line — not in a different
|
|
16
|
+
* layout.
|
|
7
17
|
*
|
|
8
18
|
* The card writes NO click logic — callers wrap with their own anchor
|
|
9
19
|
* and pass the resolved detail URL via `href`.
|
|
@@ -34,16 +44,19 @@ import {
|
|
|
34
44
|
COMPACT_CARD_TITLE,
|
|
35
45
|
COMPACT_CARD_TITLE_ROW,
|
|
36
46
|
} from '../utils/compact-card-classes'
|
|
37
|
-
import
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
import {
|
|
48
|
+
programItemToStripProfile,
|
|
49
|
+
type BaseProgramItem,
|
|
50
|
+
type ProgramAuthorRef,
|
|
51
|
+
type ProgramConfig,
|
|
52
|
+
type ProgramMedia,
|
|
53
|
+
type ProgramHost,
|
|
42
54
|
} from '../types/entities/program-types'
|
|
55
|
+
import { EntityPortraitCard } from './entity-portrait-card'
|
|
43
56
|
import { useEntityCardLink } from './use-entity-card-link'
|
|
44
57
|
import { useEntityCardPlaceholder } from './use-entity-card-placeholder'
|
|
45
58
|
|
|
46
|
-
type CardSize = 'default' | 'sm'
|
|
59
|
+
type CardSize = 'default' | 'sm' | 'portrait'
|
|
47
60
|
|
|
48
61
|
/**
|
|
49
62
|
* Format a Date with date-fns pinned to UTC. `date-fns` `format()` reads the
|
|
@@ -115,6 +128,8 @@ export interface ProgramCardProps<T extends BaseProgramItem> {
|
|
|
115
128
|
media?: ProgramMedia[]
|
|
116
129
|
renderMeta?: (item: T) => React.ReactNode
|
|
117
130
|
size?: CardSize
|
|
131
|
+
/** Portrait density: render the content-type chip. Mixed rails only; single-type rails pass false. Default true. */
|
|
132
|
+
showTypeBadge?: boolean
|
|
118
133
|
/** Detail URL resolved by the caller. */
|
|
119
134
|
href: string
|
|
120
135
|
/** When `_blank`, opens in a new tab. Set by chat dispatch via
|
|
@@ -212,6 +227,7 @@ export function ProgramCard<T extends BaseProgramItem>({
|
|
|
212
227
|
media = [],
|
|
213
228
|
renderMeta,
|
|
214
229
|
size = 'default',
|
|
230
|
+
showTypeBadge = true,
|
|
215
231
|
href,
|
|
216
232
|
target: targetProp,
|
|
217
233
|
rel: relProp,
|
|
@@ -237,24 +253,60 @@ export function ProgramCard<T extends BaseProgramItem>({
|
|
|
237
253
|
const accentColor = 'var(--color-accent-primary)'
|
|
238
254
|
const isScheduled = 'status' in item && (item as any).status === 'scheduled'
|
|
239
255
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
})()
|
|
244
|
-
const compactCover = coverImage || placeholderUrl || null
|
|
245
|
-
let typeMeta: string | null = null
|
|
256
|
+
// Compact per-type meta (duration / location / start time) — shared by the
|
|
257
|
+
// `sm` and `portrait` densities.
|
|
258
|
+
const compactTypeMeta = (): string | null => {
|
|
246
259
|
if (config.type === 'podcast' && 'duration_seconds' in item && !isScheduled) {
|
|
247
260
|
const dur = (item as any).duration_seconds
|
|
248
|
-
if (typeof dur === 'number' && dur > 0)
|
|
261
|
+
if (typeof dur === 'number' && dur > 0) return formatDurationCompact(dur)
|
|
249
262
|
} else if (config.type === 'event' && 'location_name' in item) {
|
|
250
263
|
const loc = (item as any).location_name
|
|
251
|
-
if (typeof loc === 'string' && loc.trim().length > 0)
|
|
264
|
+
if (typeof loc === 'string' && loc.trim().length > 0) return loc
|
|
252
265
|
} else if (config.type === 'webinar' && 'start_at' in item) {
|
|
253
266
|
const w = item as any
|
|
254
267
|
const time = formatTimeWithTimezone(w.start_at, w.timezone ?? null)
|
|
255
268
|
const dur = formatDurationFromRange(w.start_at, w.end_at)
|
|
256
|
-
|
|
269
|
+
return dur ? `${time} · ${dur}` : time
|
|
257
270
|
}
|
|
271
|
+
return null
|
|
272
|
+
}
|
|
273
|
+
const compactDate = (() => {
|
|
274
|
+
try { return formatUtc(new Date(item.date), 'MMM d, yyyy') } catch { return '' }
|
|
275
|
+
})()
|
|
276
|
+
|
|
277
|
+
if (size === 'portrait') {
|
|
278
|
+
// Rail/strip density — mapped onto the shared <EntityPortraitCard> shell
|
|
279
|
+
// (media aspect-[1200/630] → h-[72px] title → h-[60px] footer, p-6/gap-6).
|
|
280
|
+
// Person = author-first via programItemToStripProfile (author → primary
|
|
281
|
+
// host); the date · duration meta line fills the subtitle when the
|
|
282
|
+
// profile has no job title.
|
|
283
|
+
const profile = programItemToStripProfile(item as { author?: ProgramAuthorRef | null; hosts?: ProgramHost[] | null })
|
|
284
|
+
const dateMeta = [compactDate, compactTypeMeta()].filter(Boolean).join(' · ')
|
|
285
|
+
return (
|
|
286
|
+
<EntityPortraitCard
|
|
287
|
+
href={href}
|
|
288
|
+
target={target}
|
|
289
|
+
rel={rel}
|
|
290
|
+
typeLabel={showTypeBadge ? config.labels.singular : undefined}
|
|
291
|
+
imageUrl={coverImage}
|
|
292
|
+
placeholderUrl={placeholderUrl}
|
|
293
|
+
imageAlt={item.title}
|
|
294
|
+
title={item.title}
|
|
295
|
+
titleClassName="font-['Azeret_Mono'] font-semibold text-lg leading-6"
|
|
296
|
+
person={
|
|
297
|
+
profile
|
|
298
|
+
? { name: profile.name, avatarUrl: profile.avatarUrl, subtitle: profile.subtitle || dateMeta }
|
|
299
|
+
: { name: config.labels.singular, subtitle: dateMeta }
|
|
300
|
+
}
|
|
301
|
+
className={className}
|
|
302
|
+
/>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (size === 'sm') {
|
|
307
|
+
const itemDate = compactDate
|
|
308
|
+
const compactCover = coverImage || placeholderUrl || null
|
|
309
|
+
const typeMeta = compactTypeMeta()
|
|
258
310
|
const subtitleParts = [itemDate, typeMeta, config.labels?.singular].filter(
|
|
259
311
|
(s): s is string => typeof s === 'string' && s.length > 0,
|
|
260
312
|
)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* THE common cover-image fallback chain for entity cards:
|
|
5
|
+
* real cover → branded placeholder → nothing (hide the media element).
|
|
6
|
+
*
|
|
7
|
+
* One hook so no card hand-rolls its own `imageError` state / `displayImage`
|
|
8
|
+
* ternary (they drift: the pre-hook BlogCard chain couldn't recover from a
|
|
9
|
+
* FAILING placeholder, EntityPortraitCard duplicated the same logic with
|
|
10
|
+
* different state). Cards wire `src` + `onError` and render their own
|
|
11
|
+
* empty-state when `src` is null.
|
|
12
|
+
*
|
|
13
|
+
* Implementation note: state is the SET of candidate URLs that failed, and
|
|
14
|
+
* `src` is derived — so a prop change (new cover URL) re-resolves instantly
|
|
15
|
+
* with no reset effect, and a URL that failed once isn't retried in a loop.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { useCallback, useState, type SyntheticEvent } from 'react'
|
|
19
|
+
|
|
20
|
+
export interface CoverImageFallback {
|
|
21
|
+
/** Resolved source: first non-failed of [imageUrl, placeholderUrl], else null. */
|
|
22
|
+
src: string | null
|
|
23
|
+
/** Wire to the media element's `onError`. */
|
|
24
|
+
onError: () => void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useCoverImageFallback(
|
|
28
|
+
imageUrl?: string | null,
|
|
29
|
+
placeholderUrl?: string | null,
|
|
30
|
+
): CoverImageFallback {
|
|
31
|
+
const [failed, setFailed] = useState<ReadonlySet<string>>(() => new Set())
|
|
32
|
+
|
|
33
|
+
const src =
|
|
34
|
+
imageUrl && !failed.has(imageUrl) ? imageUrl
|
|
35
|
+
: placeholderUrl && !failed.has(placeholderUrl) ? placeholderUrl
|
|
36
|
+
: null
|
|
37
|
+
|
|
38
|
+
const onError = useCallback(() => {
|
|
39
|
+
if (!src) return
|
|
40
|
+
setFailed(prev => new Set(prev).add(src))
|
|
41
|
+
}, [src])
|
|
42
|
+
|
|
43
|
+
return { src, onError }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Fallback for cards with NO placeholder chain (compact/sm image slots):
|
|
47
|
+
* a broken cover simply disappears, leaving the slot's background. */
|
|
48
|
+
export const hideOnError = (e: SyntheticEvent<HTMLImageElement>) => {
|
|
49
|
+
;(e.currentTarget as HTMLImageElement).style.display = 'none'
|
|
50
|
+
}
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { ReactNode } from 'react';
|
|
20
|
+
import {
|
|
21
|
+
toStripProfile,
|
|
22
|
+
type VideoBiteStripProfile,
|
|
23
|
+
} from '../../../features/video-bites-shared';
|
|
20
24
|
|
|
21
25
|
// ============================================================================
|
|
22
26
|
// HOST TYPES
|
|
@@ -34,6 +38,36 @@ export interface ProgramHost {
|
|
|
34
38
|
role?: string; // e.g., "Host", "Speaker", "Guest"
|
|
35
39
|
}
|
|
36
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Client-safe author subset hydrated onto program items from the entity's
|
|
43
|
+
* `author_id → profiles` FK join (podcast episodes / webinars). Deliberately
|
|
44
|
+
* excludes `email` — this shape is serialized into public payloads.
|
|
45
|
+
*/
|
|
46
|
+
export interface ProgramAuthorRef {
|
|
47
|
+
id?: string | null;
|
|
48
|
+
full_name?: string | null;
|
|
49
|
+
avatar_url?: string | null;
|
|
50
|
+
job_title?: string | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Video-bites overlay profile for a program item: internal author first
|
|
55
|
+
* (`author_id → profiles`), then the provider-synced primary host (Livestorm
|
|
56
|
+
* speakers / Podbean hosts). Host `role` is a raw provider enum (e.g.
|
|
57
|
+
* `team_member`) — never display copy, so it is not used as the subtitle.
|
|
58
|
+
* Routes through `toStripProfile` (the SSoT — null on missing names).
|
|
59
|
+
*/
|
|
60
|
+
export function programItemToStripProfile(item: {
|
|
61
|
+
author?: ProgramAuthorRef | null;
|
|
62
|
+
hosts?: ProgramHost[] | null;
|
|
63
|
+
}): VideoBiteStripProfile | null {
|
|
64
|
+
const fromAuthor = toStripProfile(item.author);
|
|
65
|
+
if (fromAuthor) return fromAuthor;
|
|
66
|
+
const host = Array.isArray(item.hosts) ? item.hosts[0] : null;
|
|
67
|
+
if (!host?.name) return null;
|
|
68
|
+
return toStripProfile({ full_name: host.name, avatar_url: host.avatar_url ?? null });
|
|
69
|
+
}
|
|
70
|
+
|
|
37
71
|
// ============================================================================
|
|
38
72
|
// DATABASE ROW TYPES
|
|
39
73
|
// ============================================================================
|
|
@@ -284,6 +284,11 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
284
284
|
// modulo the copy width each frame, so warps are invisible to it.
|
|
285
285
|
const marqueePosRef = useRef(0);
|
|
286
286
|
const glideRemainingRef = useRef(0);
|
|
287
|
+
// Velocity envelope (px/s): the marquee EASES between 0 and autoScrollSpeed
|
|
288
|
+
// (~250ms time constant) instead of binary stop/start — pause decelerates,
|
|
289
|
+
// resume accelerates from the current position (GSAP-marquee behavior;
|
|
290
|
+
// hard cuts read as jank).
|
|
291
|
+
const speedEnvRef = useRef(0);
|
|
287
292
|
useEffect(() => {
|
|
288
293
|
if (!marqueeActive) return;
|
|
289
294
|
const scroller = scrollerRef.current;
|
|
@@ -301,11 +306,21 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
301
306
|
const tick = (now: number) => {
|
|
302
307
|
const dt = Math.min(now - last, 100) / 1000; // clamp tab-wake jumps
|
|
303
308
|
last = now;
|
|
309
|
+
// Container-level pause (industry-standard marquee behavior): the
|
|
310
|
+
// marquee freezes whenever a hover-capable pointer is ANYWHERE over the
|
|
311
|
+
// cards row — content must never move under a pointing cursor. Per-card
|
|
312
|
+
// activeKey still pauses for keyboard focus (no pointer involved).
|
|
304
313
|
const paused =
|
|
305
|
-
(pauseOnHover && activeKeyRef.current !== null) ||
|
|
314
|
+
(pauseOnHover && (hoverPointerRef.current.inside || activeKeyRef.current !== null)) ||
|
|
306
315
|
!nearViewportRef.current ||
|
|
307
316
|
document.visibilityState === 'hidden' ||
|
|
308
317
|
now < Math.max(chevronSuppressUntilRef.current, userScrollSuppressUntilRef.current);
|
|
318
|
+
// Ease the marquee velocity toward its target (0 when paused) — smooth
|
|
319
|
+
// decel on hover, smooth accel on leave, always from the CURRENT position.
|
|
320
|
+
const targetSpeed = paused ? 0 : autoScrollSpeed;
|
|
321
|
+
speedEnvRef.current += (targetSpeed - speedEnvRef.current) * Math.min(1, dt / 0.25);
|
|
322
|
+
if (targetSpeed === 0 && speedEnvRef.current < 0.5) speedEnvRef.current = 0;
|
|
323
|
+
|
|
309
324
|
const glide = glideRemainingRef.current;
|
|
310
325
|
if (glide !== 0) {
|
|
311
326
|
// Ease-out toward the chevron target; runs even while "paused"
|
|
@@ -318,20 +333,26 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
318
333
|
glideRemainingRef.current = Math.abs(glide - step) < 0.5 ? 0 : glide - step;
|
|
319
334
|
marqueePosRef.current = wrap(marqueePosRef.current + step);
|
|
320
335
|
scroller.scrollLeft = marqueePosRef.current;
|
|
321
|
-
} else if (
|
|
336
|
+
} else if (speedEnvRef.current > 0) {
|
|
322
337
|
// Resync after external movement (user scroll, seam warp).
|
|
323
338
|
if (Math.abs(scroller.scrollLeft - marqueePosRef.current) > 1.5) {
|
|
324
339
|
marqueePosRef.current = scroller.scrollLeft;
|
|
325
340
|
}
|
|
326
|
-
marqueePosRef.current = wrap(marqueePosRef.current +
|
|
341
|
+
marqueePosRef.current = wrap(marqueePosRef.current + speedEnvRef.current * dt);
|
|
327
342
|
scroller.scrollLeft = marqueePosRef.current;
|
|
328
343
|
} else {
|
|
329
344
|
marqueePosRef.current = scroller.scrollLeft;
|
|
330
345
|
}
|
|
346
|
+
// Track moved under a possibly-stationary pointer → re-resolve which
|
|
347
|
+
// card is hovered (declared below; stable useCallback identity, called
|
|
348
|
+
// lazily per frame so source order is irrelevant — deliberately NOT a
|
|
349
|
+
// dep, same as the activeKeyRef read above).
|
|
350
|
+
syncHoverIfScrolled();
|
|
331
351
|
raf = requestAnimationFrame(tick);
|
|
332
352
|
};
|
|
333
353
|
raf = requestAnimationFrame(tick);
|
|
334
354
|
return () => cancelAnimationFrame(raf);
|
|
355
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- syncHoverIfScrolled is identity-stable
|
|
335
356
|
}, [marqueeActive, autoScrollSpeed, pauseOnHover]);
|
|
336
357
|
|
|
337
358
|
// ---- hover / overlay state -----------------------------------------------------
|
|
@@ -357,6 +378,72 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
357
378
|
setActiveKey(current => (current === key ? null : current));
|
|
358
379
|
}, []);
|
|
359
380
|
|
|
381
|
+
// ---- container-level hover pause + pointer-tracked activation sync ---------
|
|
382
|
+
// TWO separate concerns, deliberately decoupled (matches how production
|
|
383
|
+
// marquees — react-fast-marquee, GSAP — behave):
|
|
384
|
+
//
|
|
385
|
+
// 1. MARQUEE PAUSE is container-level: `hoverPointerRef.inside` is true
|
|
386
|
+
// whenever a hover-capable pointer is over the SCROLLER (the cards row).
|
|
387
|
+
// The rAF freezes on it, so content NEVER auto-moves under a pointing
|
|
388
|
+
// cursor — which is what made per-card boundary pausing feel flaky
|
|
389
|
+
// (cards sliding under/away from a stationary pointer don't emit
|
|
390
|
+
// pointerenter/leave, gaps caused stutter-steps, seam warps swapped the
|
|
391
|
+
// hovered card's identity mid-playback).
|
|
392
|
+
//
|
|
393
|
+
// 2. CARD ACTIVATION (overlay + video playback) stays per-card: the card/
|
|
394
|
+
// cell pointer handlers are the zero-latency path, and the
|
|
395
|
+
// elementFromPoint sync below re-resolves the card under the pointer
|
|
396
|
+
// whenever the track moves WHILE the pointer is inside (user wheel
|
|
397
|
+
// scroll, chevron glide, seam warp) — scoped to THIS strip's scroller so
|
|
398
|
+
// stacked strips can never activate/pause each other.
|
|
399
|
+
const hoverPointerRef = useRef<{ x: number; y: number; inside: boolean }>({ x: 0, y: 0, inside: false });
|
|
400
|
+
const lastHoverSyncScrollRef = useRef(-1);
|
|
401
|
+
const syncHoverToPointer = useCallback(() => {
|
|
402
|
+
const p = hoverPointerRef.current;
|
|
403
|
+
if (!p.inside) return;
|
|
404
|
+
const el = typeof document !== 'undefined' ? document.elementFromPoint(p.x, p.y) : null;
|
|
405
|
+
const cardEl = el?.closest?.('[data-strip-card-key]') as HTMLElement | null;
|
|
406
|
+
// Strip-scoped: a card from ANOTHER CardsStrip under the tracked point
|
|
407
|
+
// must read as "no card here" (stacked strips share the viewport).
|
|
408
|
+
const scoped = cardEl && scrollerRef.current?.contains(cardEl) ? cardEl : null;
|
|
409
|
+
const key = scoped?.getAttribute('data-strip-card-key') ?? null;
|
|
410
|
+
const current = activeKeyRef.current;
|
|
411
|
+
if (key === current) return;
|
|
412
|
+
if (current !== null) deactivate(current);
|
|
413
|
+
if (key !== null) activate(key);
|
|
414
|
+
}, [activate, deactivate]);
|
|
415
|
+
// Hover-capable pointers only (mouse/pen) — touch drags must not fake hover.
|
|
416
|
+
const onHoverPointerEnter = useCallback((e: React.PointerEvent) => {
|
|
417
|
+
if (e.pointerType === 'touch') return;
|
|
418
|
+
hoverPointerRef.current = { x: e.clientX, y: e.clientY, inside: true };
|
|
419
|
+
}, []);
|
|
420
|
+
const onHoverPointerMove = useCallback((e: React.PointerEvent) => {
|
|
421
|
+
if (e.pointerType === 'touch') return;
|
|
422
|
+
hoverPointerRef.current = { x: e.clientX, y: e.clientY, inside: true };
|
|
423
|
+
}, []);
|
|
424
|
+
const onHoverPointerLeave = useCallback((e: React.PointerEvent) => {
|
|
425
|
+
if (e.pointerType === 'touch') return;
|
|
426
|
+
hoverPointerRef.current.inside = false;
|
|
427
|
+
// The pointer left the whole scroller — no card can be hovered anymore
|
|
428
|
+
// (covers leave events swallowed by DOM churn under the cursor).
|
|
429
|
+
const current = activeKeyRef.current;
|
|
430
|
+
if (current !== null) deactivate(current);
|
|
431
|
+
}, [deactivate]);
|
|
432
|
+
/** Re-sync hover only when the track actually moved under the pointer.
|
|
433
|
+
* KNOWN HOT-PATH COST (intentional): while the marquee runs with the
|
|
434
|
+
* pointer parked over strip whitespace (no card → not paused), scrollLeft
|
|
435
|
+
* changes every frame, so this invokes `document.elementFromPoint` ~60×/s
|
|
436
|
+
* — a synchronous hit-test. It's inherent to detecting a card sliding
|
|
437
|
+
* under a stationary cursor; any throttle trades hover latency for it.
|
|
438
|
+
* Revisit only if profiling flags it on pages with many stacked strips. */
|
|
439
|
+
const syncHoverIfScrolled = useCallback(() => {
|
|
440
|
+
const scroller = scrollerRef.current;
|
|
441
|
+
if (!scroller) return;
|
|
442
|
+
if (scroller.scrollLeft === lastHoverSyncScrollRef.current) return;
|
|
443
|
+
lastHoverSyncScrollRef.current = scroller.scrollLeft;
|
|
444
|
+
syncHoverToPointer();
|
|
445
|
+
}, [syncHoverToPointer]);
|
|
446
|
+
|
|
360
447
|
// ---- shared card-mount gate (by ITEM index, across both copies) -------------
|
|
361
448
|
// A card and its clone show identical content half a copy-width apart. If
|
|
362
449
|
// each card gated its own expensive content (e.g. video players), a seam warp
|
|
@@ -433,6 +520,15 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
433
520
|
const onUserScrollIntent = useCallback(() => {
|
|
434
521
|
userScrollSuppressUntilRef.current = performance.now() + USER_SCROLL_SUPPRESS_MS;
|
|
435
522
|
}, []);
|
|
523
|
+
// Suppress ONLY on genuine horizontal-scroll intent. Vertical page-scroll
|
|
524
|
+
// wheel events over the strip and plain clicks (pointerdown) used to arm the
|
|
525
|
+
// 3s suppression — the "marquee resumes only after a delay" bug.
|
|
526
|
+
const onWheelIntent = useCallback((e: React.WheelEvent) => {
|
|
527
|
+
if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) onUserScrollIntent();
|
|
528
|
+
}, [onUserScrollIntent]);
|
|
529
|
+
const onPointerDownIntent = useCallback((e: React.PointerEvent) => {
|
|
530
|
+
if (e.pointerType === 'touch') onUserScrollIntent();
|
|
531
|
+
}, [onUserScrollIntent]);
|
|
436
532
|
|
|
437
533
|
// Never-ending strip: warp across the clone seam on EVERY scroll (manual
|
|
438
534
|
// wheel/drag/chevron included — the rAF only wraps while the marquee runs,
|
|
@@ -445,7 +541,12 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
445
541
|
marqueeActiveRef.current = marqueeActive;
|
|
446
542
|
const onSeamWarp = useCallback(() => {
|
|
447
543
|
const scroller = scrollerRef.current;
|
|
448
|
-
if (!scroller
|
|
544
|
+
if (!scroller) return;
|
|
545
|
+
// Every scroll (native wheel/drag, smooth chevron scroll, marquee) moves
|
|
546
|
+
// cards under a possibly-stationary pointer — re-resolve hover regardless
|
|
547
|
+
// of marquee state (pointerenter/leave never fire for track motion).
|
|
548
|
+
syncHoverIfScrolled();
|
|
549
|
+
if (!marqueeActiveRef.current) return;
|
|
449
550
|
const half = singleCopyWidthRef.current;
|
|
450
551
|
if (half <= 0) return;
|
|
451
552
|
let sl = scroller.scrollLeft;
|
|
@@ -459,7 +560,7 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
459
560
|
marqueePosRef.current = sl;
|
|
460
561
|
}
|
|
461
562
|
lastScrollLeftRef.current = sl;
|
|
462
|
-
}, []);
|
|
563
|
+
}, [syncHoverIfScrolled]);
|
|
463
564
|
|
|
464
565
|
// ---- render ----------------------------------------------------------------
|
|
465
566
|
|
|
@@ -468,6 +569,15 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
468
569
|
// Seam assertion (see normalization comment above).
|
|
469
570
|
return (props.renderCard as (item: unknown, ctx: CardStripRenderCtx) => React.ReactNode)(item, ctx);
|
|
470
571
|
}
|
|
572
|
+
// Per-child DESKTOP cell-width hint: heterogeneous card designs need
|
|
573
|
+
// heterogeneous cells (wide horizontal cards vs 400px vertical cards —
|
|
574
|
+
// variable widths are native to the engine, exactly like bite ratios).
|
|
575
|
+
// Read from the child ELEMENT's `data-strip-cell-width` prop; mobile keeps
|
|
576
|
+
// the strip-level width (wide cards stack vertically below md anyway).
|
|
577
|
+
const hintedWidth = React.isValidElement(item)
|
|
578
|
+
? (item.props as Record<string, unknown>)['data-strip-cell-width']
|
|
579
|
+
: undefined;
|
|
580
|
+
const desktopWidth = typeof hintedWidth === 'number' ? hintedWidth : cardWidthDesktop;
|
|
471
581
|
// Managed cell — the ONLY place cell width / activation / clone a11y are
|
|
472
582
|
// encoded for children mode.
|
|
473
583
|
return (
|
|
@@ -476,7 +586,8 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
476
586
|
// clones).
|
|
477
587
|
<div
|
|
478
588
|
className="shrink-0 self-stretch"
|
|
479
|
-
style={{ width: ctx.isMobile ? cardWidthMobile :
|
|
589
|
+
style={{ width: ctx.isMobile ? cardWidthMobile : desktopWidth, maxWidth: STRIP_CELL_MAX_WIDTH }}
|
|
590
|
+
data-strip-card-key={ctx.cardKey}
|
|
480
591
|
onPointerEnter={ctx.isTouch ? undefined : () => ctx.onActivate(ctx.cardKey)}
|
|
481
592
|
onPointerLeave={ctx.isTouch ? undefined : () => ctx.onDeactivate(ctx.cardKey)}
|
|
482
593
|
// Keyboard pause parity (focus bubbles from the card's anchor; WCAG 2.2.2).
|
|
@@ -520,9 +631,12 @@ export function CardsStrip<T = unknown>(props: CardsStripProps<T>): React.ReactE
|
|
|
520
631
|
<div
|
|
521
632
|
ref={scrollerRef}
|
|
522
633
|
className="overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
523
|
-
onWheel={
|
|
634
|
+
onWheel={onWheelIntent}
|
|
524
635
|
onTouchStart={onUserScrollIntent}
|
|
525
|
-
onPointerDown={
|
|
636
|
+
onPointerDown={onPointerDownIntent}
|
|
637
|
+
onPointerEnter={onHoverPointerEnter}
|
|
638
|
+
onPointerMove={onHoverPointerMove}
|
|
639
|
+
onPointerLeave={onHoverPointerLeave}
|
|
526
640
|
onScroll={onSeamWarp}
|
|
527
641
|
>
|
|
528
642
|
<div ref={trackRef} data-copies={copies} className="flex w-max items-stretch gap-4">
|
|
@@ -60,6 +60,7 @@ export * from './warning-block'
|
|
|
60
60
|
// `video-bites-shared` is the SERVER-SAFE leaf (also its own published subpath).
|
|
61
61
|
export * from './cards-strip'
|
|
62
62
|
export * from './video'
|
|
63
|
+
export * from './video-center-badge'
|
|
63
64
|
export * from './video-ratio-tabs'
|
|
64
65
|
export * from './video-bites-shared'
|
|
65
66
|
export * from './video-bites-strip'
|
|
@@ -36,9 +36,12 @@ import {
|
|
|
36
36
|
sortBitesByCreatedAtDesc,
|
|
37
37
|
type VideoBiteStripProfile,
|
|
38
38
|
} from './video-bites-shared';
|
|
39
|
+
import Image from '../../embed-shims/next-image';
|
|
39
40
|
import { CardsStrip, STRIP_CELL_MAX_WIDTH } from './cards-strip';
|
|
41
|
+
import { useCoverImageFallback } from '../chat/entity-cards/use-cover-image-fallback';
|
|
40
42
|
import { UserDisplay } from '../user-display';
|
|
41
43
|
import { Chevron02RightIcon } from '../icons-v2-generated/arrows/chevron-02-right-icon';
|
|
44
|
+
import { VideoPlayBadge } from './video-center-badge';
|
|
42
45
|
|
|
43
46
|
// NOTE: the title constant / profile adapter / sort comparator live in the
|
|
44
47
|
// server-safe leaf `video-bites-shared.ts` (its own published subpath). The
|
|
@@ -252,7 +255,23 @@ export function VideoBiteCard({
|
|
|
252
255
|
io.observe(el);
|
|
253
256
|
return () => io.disconnect();
|
|
254
257
|
}, [gateControlled]);
|
|
255
|
-
const
|
|
258
|
+
const showMedia = gateControlled ? playerMounted : isNear;
|
|
259
|
+
|
|
260
|
+
// Player mounts at NEAR-VIEWPORT (not on first hover) so hover playback is
|
|
261
|
+
// INSTANT for any card the user can reach — mounting on activation made
|
|
262
|
+
// freshly-scrolled cards stall for seconds while MuxPlayer initialized and
|
|
263
|
+
// buffered. Always-mounted players are visually safe now that every bite
|
|
264
|
+
// carries a poster: the player renders with a transparent media background
|
|
265
|
+
// over the card's poster layer, so a not-yet-decoded player never shows as
|
|
266
|
+
// a black rectangle (the original wrap-seam flash came from POSTERLESS
|
|
267
|
+
// mounted players, not from mounting itself).
|
|
268
|
+
const showPlayer = showMedia;
|
|
269
|
+
|
|
270
|
+
// Poster resolution — THE shared entity-card cover fallback chain
|
|
271
|
+
// (use-cover-image-fallback): the bite's real thumbnail_url, dropped on
|
|
272
|
+
// load error. When it resolves to null (no thumbnail yet, or it failed)
|
|
273
|
+
// the media zone falls back to the first-frame <video> facade below.
|
|
274
|
+
const { src: posterSrc, onError: onPosterError } = useCoverImageFallback(bite.thumbnail_url);
|
|
256
275
|
|
|
257
276
|
const navigate = () => {
|
|
258
277
|
if (bite.onNavigate) bite.onNavigate();
|
|
@@ -342,26 +361,65 @@ export function VideoBiteCard({
|
|
|
342
361
|
// same as the old single-box layout). Editor mode: width-driven.
|
|
343
362
|
style={{ aspectRatio: cssAspect, ...(height !== undefined ? { height, maxWidth: STRIP_CELL_MAX_WIDTH } : {}) }}
|
|
344
363
|
>
|
|
345
|
-
{
|
|
364
|
+
{showMedia ? (
|
|
346
365
|
// Clones: `inert` (not just the wrapper's aria-hidden) — the player's
|
|
347
366
|
// shadow-DOM center control is otherwise still tab-reachable inside a
|
|
348
367
|
// hidden subtree (axe aria-hidden-focus). Hover preview on clones
|
|
349
368
|
// keeps working: playback is driven imperatively from the CARD's own
|
|
350
369
|
// pointer handlers, never from focus/clicks on the player chrome.
|
|
351
370
|
<div className="absolute inset-0" inert={isClone || undefined}>
|
|
352
|
-
{/*
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
371
|
+
{/* Poster layer. Preferred: the bite's REAL thumbnail (generated at
|
|
372
|
+
Vizard-ingestion time by vizard-persistence-utils via Shotstack
|
|
373
|
+
capture — the provider sends no cover), resolved through the
|
|
374
|
+
shared cover fallback chain. Fallback when it's absent or fails
|
|
375
|
+
to load: the <Video> component's `firstFrameOnly` facade paints
|
|
376
|
+
the `#t=0.1` frame. Either way the box is never a black
|
|
377
|
+
rectangle, and original + clone paint the IDENTICAL image so the
|
|
378
|
+
marquee's wrap seam stays pixel-invisible. */}
|
|
379
|
+
{posterSrc ? (
|
|
380
|
+
<Image
|
|
381
|
+
src={posterSrc}
|
|
382
|
+
alt=""
|
|
383
|
+
fill
|
|
384
|
+
unoptimized
|
|
385
|
+
onError={onPosterError}
|
|
386
|
+
className="object-cover"
|
|
387
|
+
/>
|
|
388
|
+
) : (
|
|
389
|
+
<Video kind="file" url={bite.url} firstFrameOnly layout="fill" />
|
|
390
|
+
)}
|
|
391
|
+
|
|
392
|
+
{/* Play affordance for every non-playing state (resting poster,
|
|
393
|
+
facade, mounted-but-paused): <VideoPlayBadge> — a pixel replica
|
|
394
|
+
of MuxPlayer's pre-play center button (media-chrome's own PAUSED
|
|
395
|
+
center control is a different, smaller bare glyph, so the
|
|
396
|
+
mounted player runs chromeless and the replica keeps all states
|
|
397
|
+
identical to the mux button). Hidden while playing. */}
|
|
398
|
+
{!isActive && <VideoPlayBadge className="absolute inset-0 z-10 m-auto" />}
|
|
399
|
+
{showPlayer && (
|
|
400
|
+
// `--media-background-color: transparent` (inherited into
|
|
401
|
+
// media-chrome) — the freshly-mounted player must not blank the
|
|
402
|
+
// facade behind it with its default black fill while it loads.
|
|
403
|
+
<div
|
|
404
|
+
className="absolute inset-0"
|
|
405
|
+
style={{ '--media-background-color': 'transparent' } as React.CSSProperties}
|
|
406
|
+
>
|
|
407
|
+
{/* CONTROLLED hover playback keyed to CARD hover (`isActive`): the
|
|
408
|
+
detail overlay is part of the card, so moving the pointer onto
|
|
409
|
+
it keeps playing. Sound at 50% (pre-activation: muted start +
|
|
410
|
+
live unmute on the user's first gesture); CHROMELESS — the
|
|
411
|
+
card's mux-replica badge above is the play affordance for
|
|
412
|
+
every non-playing state. */}
|
|
413
|
+
<Video
|
|
414
|
+
kind="file"
|
|
415
|
+
url={bite.url}
|
|
416
|
+
poster={bite.thumbnail_url}
|
|
417
|
+
playWhenHovered={isActive}
|
|
418
|
+
chromeless
|
|
419
|
+
layout="fill"
|
|
420
|
+
/>
|
|
421
|
+
</div>
|
|
422
|
+
)}
|
|
365
423
|
</div>
|
|
366
424
|
) : (
|
|
367
425
|
// Aspect-matched placeholder until the card nears the viewport (CLS-free).
|
|
@@ -391,6 +449,10 @@ export function VideoBiteCard({
|
|
|
391
449
|
return rootRef?.(node);
|
|
392
450
|
}}
|
|
393
451
|
aria-hidden={isClone || undefined}
|
|
452
|
+
// Hit-test marker for the strip engine's pointer-tracked hover re-sync
|
|
453
|
+
// (cards move under a stationary pointer — see cards-strip.tsx). The
|
|
454
|
+
// hover area is exactly this card root: media + overlay + toolbar.
|
|
455
|
+
data-strip-card-key={key}
|
|
394
456
|
className={cn(
|
|
395
457
|
'relative rounded-md border border-ods-border bg-ods-card overflow-hidden group/card',
|
|
396
458
|
height !== undefined ? 'shrink-0' : 'w-full',
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* THE center media glyphs — the single visual identity for every play/unmute
|
|
5
|
+
* affordance over video, across the whole project: a SOLID WHITE GLYPH
|
|
6
|
+
* (`text-ods-text-primary`), NO background disc, with a soft drop-shadow for
|
|
7
|
+
* legibility over arbitrary frames.
|
|
8
|
+
*
|
|
9
|
+
* Consumers:
|
|
10
|
+
* - <VideoBiteCard> resting/paused posters (md)
|
|
11
|
+
* - <YouTubeFacade> poster (lg)
|
|
12
|
+
* - <MediaCarousel> video thumbnails (sm)
|
|
13
|
+
* - <FilePlayer>'s unmute chip (VideoUnmuteGlyph, md)
|
|
14
|
+
* - MuxPlayer's native center pre-play button is stripped to the same bare
|
|
15
|
+
* white glyph via CSS (`mux-player::part(center play button)` in
|
|
16
|
+
* styles/app-globals.css) so full players match too.
|
|
17
|
+
*
|
|
18
|
+
* Glyph paths are media-chrome's own (filled triangle / filled volume-off) so
|
|
19
|
+
* the replica and the real player chrome stay pixel-consistent.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import React from 'react'
|
|
23
|
+
import { cn } from '../../utils/cn'
|
|
24
|
+
|
|
25
|
+
export type VideoCenterBadgeSize = 'sm' | 'md' | 'lg'
|
|
26
|
+
|
|
27
|
+
const SIZES: Record<VideoCenterBadgeSize, number> = {
|
|
28
|
+
sm: 20, // gallery thumbnails
|
|
29
|
+
md: 56, // strip cards + unmute chip
|
|
30
|
+
lg: 64, // hero facades
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Soft legibility shadow — NOT a background (per design: bare glyphs). */
|
|
34
|
+
const GLYPH_SHADOW = 'drop-shadow(0 1px 4px rgba(0,0,0,0.5))'
|
|
35
|
+
|
|
36
|
+
export interface VideoPlayBadgeProps {
|
|
37
|
+
size?: VideoCenterBadgeSize
|
|
38
|
+
className?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Bare white play glyph (media-chrome's filled triangle). Decorative
|
|
42
|
+
* (`pointer-events-none`) — the host surface owns activation. */
|
|
43
|
+
export function VideoPlayBadge({ size = 'md', className }: VideoPlayBadgeProps): React.ReactElement {
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
className={cn('pointer-events-none flex items-center justify-center text-ods-text-primary transition-colors', className)}
|
|
47
|
+
style={{ filter: GLYPH_SHADOW }}
|
|
48
|
+
>
|
|
49
|
+
<svg aria-hidden viewBox="0 0 24 24" fill="currentColor" style={{ width: SIZES[size], height: SIZES[size] }}>
|
|
50
|
+
<path d="m6 21 15-9L6 3v18Z" />
|
|
51
|
+
</svg>
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface VideoUnmuteGlyphProps {
|
|
57
|
+
size?: VideoCenterBadgeSize
|
|
58
|
+
className?: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Bare white muted-volume glyph (filled, material volume_off — the same
|
|
62
|
+
* family as media-chrome's mute icon). Rendered by FilePlayer's unmute
|
|
63
|
+
* button; exported here so play + unmute share one identity. */
|
|
64
|
+
export function VideoUnmuteGlyph({ size = 'md', className }: VideoUnmuteGlyphProps): React.ReactElement {
|
|
65
|
+
return (
|
|
66
|
+
<svg
|
|
67
|
+
aria-hidden
|
|
68
|
+
viewBox="0 0 24 24"
|
|
69
|
+
fill="currentColor"
|
|
70
|
+
className={className}
|
|
71
|
+
style={{ width: SIZES[size], height: SIZES[size], filter: GLYPH_SHADOW }}
|
|
72
|
+
>
|
|
73
|
+
<path d="M16.5 12A4.5 4.5 0 0 0 14 7.97v2.21l2.45 2.45c.03-.2.05-.41.05-.63Zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51A8.796 8.796 0 0 0 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06a8.99 8.99 0 0 0 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z" />
|
|
74
|
+
</svg>
|
|
75
|
+
)
|
|
76
|
+
}
|