@flamingo-stack/openframe-frontend-core 0.0.802 → 0.0.804
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/build/export-map.json +1 -1
- package/dist/{case-study-card-K6HYMHL6.cjs → case-study-card-MEWJNF4N.cjs} +5 -5
- package/dist/{chunk-DSIIRR3G.cjs → chunk-2NVIGBJC.cjs} +80 -80
- package/dist/{chunk-HRMLGU6A.cjs → chunk-3EPG56RK.cjs} +8 -8
- package/dist/{chunk-UYGXJ5SQ.cjs → chunk-3WNCFZGN.cjs} +2 -2
- package/dist/{chunk-2JCY5KQL.cjs → chunk-4W77VLQV.cjs} +4 -4
- package/dist/{chunk-M7E7ILE5.cjs → chunk-55TGW6BF.cjs} +6 -6
- package/dist/{chunk-E56LN23H.cjs → chunk-66ZQ7LDR.cjs} +73 -48
- package/dist/{chunk-VMQAJIQC.cjs → chunk-6JRQ57DU.cjs} +884 -895
- package/dist/{chunk-A7NRENMU.cjs → chunk-6UGNFMZB.cjs} +36 -36
- package/dist/{chunk-Y5XHMEBB.cjs → chunk-76NE67PK.cjs} +5 -5
- package/dist/{chunk-NCQJIYDN.cjs → chunk-AC5EBHAX.cjs} +28 -28
- package/dist/{chunk-OG4XH6C5.cjs → chunk-AZJYMTBS.cjs} +33 -33
- package/dist/{chunk-D3IQHAGL.cjs → chunk-BVSZTKI3.cjs} +34 -21
- package/dist/{chunk-7E4BC3AF.cjs → chunk-F2VN3UUB.cjs} +485 -513
- package/dist/{chunk-DTBIIFZG.cjs → chunk-FLW2VL5W.cjs} +21 -21
- package/dist/{chunk-FS4TVAE7.cjs → chunk-FQ4LYYBI.cjs} +52 -52
- package/dist/{chunk-VVLL37EM.cjs → chunk-GAHXURKJ.cjs} +6 -6
- package/dist/{chunk-7MV23NNT.cjs → chunk-JLKGLPDC.cjs} +109 -21
- package/dist/{chunk-3NGJ7NPT.cjs → chunk-KVJKKVB3.cjs} +7 -7
- package/dist/{chunk-52NI57KM.cjs → chunk-LZIQXGAW.cjs} +91 -88
- package/dist/{chunk-DYDS2P5G.cjs → chunk-MEDSJCEX.cjs} +4 -4
- package/dist/{chunk-FFRFKWTZ.cjs → chunk-MHH7CHNI.cjs} +17 -14
- package/dist/{chunk-CRVXQYUZ.cjs → chunk-NBLQFJ4I.cjs} +100 -99
- package/dist/{chunk-YD344MMX.cjs → chunk-NXJ3O4WO.cjs} +15 -15
- package/dist/{chunk-YBTORXFY.cjs → chunk-PRCGRDHV.cjs} +40 -25
- package/dist/{chunk-75BFVMNA.cjs → chunk-QPBP7FKI.cjs} +52 -52
- package/dist/{chunk-ZPVFFPQM.cjs → chunk-RIRIA3FO.cjs} +4 -4
- package/dist/{chunk-XR323UBY.cjs → chunk-STLJCAIZ.cjs} +6 -3
- package/dist/{chunk-6UKH22NQ.cjs → chunk-TGOJHOQR.cjs} +2 -1
- package/dist/{chunk-FAUVDMH4.cjs → chunk-THY2XVGY.cjs} +198 -164
- package/dist/{chunk-6GCXQIUU.cjs → chunk-TT64NRFU.cjs} +4 -4
- package/dist/{chunk-3W2PBWD5.cjs → chunk-TTERV57X.cjs} +4 -4
- package/dist/{chunk-A7IT7MZO.cjs → chunk-UCBR27JM.cjs} +13 -13
- package/dist/{chunk-KVGWOJCX.cjs → chunk-V3T5MDJV.cjs} +2 -2
- package/dist/{chunk-5RGGUQ4Y.cjs → chunk-VXXOUM2K.cjs} +67 -1
- package/dist/{chunk-EJVJDLYC.cjs → chunk-WSKMV2QS.cjs} +3 -3
- package/dist/{chunk-2BUSXRZ7.cjs → chunk-XXARXK62.cjs} +26 -26
- package/dist/{chunk-HATRCNXJ.cjs → chunk-XYZBN6D7.cjs} +2 -2
- package/dist/{chunk-YMPCACQX.cjs → chunk-Z6Y5X5SF.cjs} +41 -41
- package/dist/{cloud-tenants-3SWYRUXB.cjs → cloud-tenants-LRXMISV4.cjs} +19 -19
- package/dist/components/agent-mark.d.ts.map +1 -1
- package/dist/components/agent-mark.js +2 -2
- package/dist/components/case-studies/index.cjs +35 -35
- package/dist/components/chat/approval-batch-message.d.ts +3 -1
- package/dist/components/chat/approval-batch-message.d.ts.map +1 -1
- package/dist/components/chat/approval-batch-message.js +88 -0
- package/dist/components/chat/chat-composer.d.ts +3 -1
- package/dist/components/chat/chat-composer.d.ts.map +1 -1
- package/dist/components/chat/chat-composer.js +2 -0
- package/dist/components/chat/chat-context-memory-bar.d.ts +7 -1
- package/dist/components/chat/chat-context-memory-bar.d.ts.map +1 -1
- package/dist/components/chat/chat-context-memory-bar.js +11 -5
- package/dist/components/chat/chat-message-row.d.ts.map +1 -1
- package/dist/components/chat/chat-message-row.js +3 -2
- package/dist/components/chat/embeddable-chat.d.ts +3 -0
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +1 -0
- package/dist/components/chat/entity-cards/admin-content-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/admin-content-card.js +2 -1
- package/dist/components/chat/entity-cards/blog-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/blog-card.js +6 -6
- package/dist/components/chat/entity-cards/blog-image-placeholder.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/blog-image-placeholder.js +2 -1
- package/dist/components/chat/entity-cards/case-study-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/case-study-card.js +10 -9
- package/dist/components/chat/entity-cards/customer-interview-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/customer-interview-card.js +8 -7
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/dispatch.js +12 -1
- package/dist/components/chat/entity-cards/employee-entry-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/employee-entry-card.js +3 -2
- package/dist/components/chat/entity-cards/entity-portrait-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/entity-portrait-card.js +7 -5
- package/dist/components/chat/entity-cards/investor-update-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/investor-update-card.js +2 -1
- package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/onboarding-guide-card.js +13 -2
- package/dist/components/chat/entity-cards/program-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/program-card.js +17 -5
- package/dist/components/chat/entity-cards/roadmap-card.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/roadmap-card.js +5 -4
- package/dist/components/chat/index.cjs +15 -15
- package/dist/components/chat/mingo-info-card.d.ts.map +1 -1
- package/dist/components/chat/mingo-info-card.js +3 -2
- package/dist/components/contact/index.cjs +20 -20
- package/dist/components/docs/index.cjs +23 -23
- package/dist/components/embeds/index.cjs +20 -20
- package/dist/components/embeds/markdown-image.d.ts.map +1 -1
- package/dist/components/embeds/markdown-image.js +2 -1
- package/dist/components/embeds/og-link-preview.d.ts.map +1 -1
- package/dist/components/embeds/og-link-preview.js +17 -6
- package/dist/components/embeds/twitter-embed-client.d.ts.map +1 -1
- package/dist/components/embeds/twitter-embed-client.js +3 -2
- package/dist/components/faq/index.cjs +21 -21
- package/dist/components/features/board/ticket-card.js +5 -5
- package/dist/components/features/index.cjs +19 -19
- package/dist/components/features/media-gallery-manager.d.ts.map +1 -1
- package/dist/components/features/media-gallery-manager.js +2 -1
- package/dist/components/features/notifications/notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-tile.js +3 -2
- package/dist/components/features/parallax-image-showcase.d.ts.map +1 -1
- package/dist/components/features/parallax-image-showcase.js +9 -35
- package/dist/components/features/select-button.d.ts.map +1 -1
- package/dist/components/features/select-button.js +3 -2
- package/dist/components/features/video-hover-preview.d.ts +1 -1
- package/dist/components/features/video-hover-preview.d.ts.map +1 -1
- package/dist/components/features/video-hover-preview.js +2 -1
- package/dist/components/features/video.d.ts.map +1 -1
- package/dist/components/features/video.js +13 -1
- package/dist/components/features/walkthrough-video.d.ts.map +1 -1
- package/dist/components/features/walkthrough-video.js +3 -3
- package/dist/components/help-center-pages/index.cjs +121 -121
- package/dist/components/hero-image-uploader.d.ts.map +1 -1
- package/dist/components/hero-image-uploader.js +12 -1
- package/dist/components/icon-display.d.ts.map +1 -1
- package/dist/components/icon-display.js +2 -1
- package/dist/components/index.cjs +137 -91
- package/dist/components/layout/page-layout.d.ts +1 -1
- package/dist/components/layout/page-layout.d.ts.map +1 -1
- package/dist/components/layout/title-block.d.ts +4 -2
- package/dist/components/layout/title-block.d.ts.map +1 -1
- package/dist/components/layout/title-block.js +21 -2
- package/dist/components/media-carousel.d.ts.map +1 -1
- package/dist/components/media-carousel.js +2 -1
- package/dist/components/meeting-scheduler/index.cjs +85 -85
- package/dist/components/navigation/index.cjs +22 -22
- package/dist/components/onboarding-guides/index.cjs +22 -22
- package/dist/components/platform/ScriptInfoSection.d.ts.map +1 -1
- package/dist/components/platform/ScriptInfoSection.js +12 -1
- package/dist/components/product-demo/index.cjs +30 -30
- package/dist/components/related-content/index.cjs +11 -11
- package/dist/components/shared/media-gallery-strip.d.ts.map +1 -1
- package/dist/components/shared/media-gallery-strip.js +3 -2
- package/dist/components/shared/product-release/product-release-card.d.ts.map +1 -1
- package/dist/components/shared/product-release/product-release-card.js +13 -2
- package/dist/components/tickets/index.cjs +26 -26
- package/dist/components/ui/avatar-stack.d.ts.map +1 -1
- package/dist/components/ui/avatar-stack.js +4 -4
- package/dist/components/ui/data-table/data-table-body.d.ts +6 -1
- package/dist/components/ui/data-table/data-table-body.d.ts.map +1 -1
- package/dist/components/ui/data-table/data-table-body.js +3 -1
- package/dist/components/ui/device-card.d.ts +6 -1
- package/dist/components/ui/device-card.d.ts.map +1 -1
- package/dist/components/ui/device-card.js +2 -1
- package/dist/components/ui/entity-image.d.ts.map +1 -1
- package/dist/components/ui/entity-image.js +3 -2
- package/dist/components/ui/image-gallery-modal.d.ts.map +1 -1
- package/dist/components/ui/image-gallery-modal.js +2 -1
- package/dist/components/ui/image-uploader.d.ts.map +1 -1
- package/dist/components/ui/image-uploader.js +2 -1
- package/dist/components/ui/index.cjs +37 -19
- 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 +1 -0
- package/dist/components/ui/markdown/base-components.d.ts.map +1 -1
- package/dist/components/ui/markdown/base-components.js +2 -1
- package/dist/components/ui/page-actions.d.ts.map +1 -1
- package/dist/components/ui/page-actions.js +15 -12
- package/dist/components/ui/photo-wall.d.ts +7 -3
- package/dist/components/ui/photo-wall.d.ts.map +1 -1
- package/dist/components/ui/photo-wall.js +3 -4
- package/dist/components/ui/square-avatar.d.ts +4 -1
- package/dist/components/ui/square-avatar.d.ts.map +1 -1
- package/dist/components/ui/square-avatar.js +2 -1
- package/dist/components/user-summary-stub.d.ts +1 -1
- package/dist/components/user-summary-stub.d.ts.map +1 -1
- package/dist/components/user-summary-stub.js +16 -6
- package/dist/components/vendor-display-button.d.ts.map +1 -1
- package/dist/components/vendor-display-button.js +13 -3
- package/dist/components/vendor-icon.d.ts +7 -4
- package/dist/components/vendor-icon.d.ts.map +1 -1
- package/dist/components/vendor-icon.js +22 -71
- package/dist/{devices-MQILRW53.cjs → devices-CETR72XY.cjs} +20 -20
- package/dist/{embeddable-chat-XZDZOHFY.cjs → embeddable-chat-GHBCX2BY.cjs} +85 -84
- package/dist/hooks/index.cjs +6 -6
- package/dist/hooks/ui/use-image-edge-color.d.ts.map +1 -1
- package/dist/hooks/ui/use-image-edge-color.js +4 -3
- package/dist/image-sizes.cjs +68 -0
- package/dist/index.cjs +43 -25
- package/dist/{knowledge-WQ3ABXZC.cjs → knowledge-A2MWEF23.cjs} +20 -20
- package/dist/{logs-XRSJGB3I.cjs → logs-47JODA6C.cjs} +27 -27
- package/dist/{policies-Q67ZXAGY.cjs → policies-OPIDR6XF.cjs} +23 -23
- package/dist/{remote-session-4LYKEZSY.cjs → remote-session-IQTPEG63.cjs} +8 -8
- package/dist/{scripts-YX324R4S.cjs → scripts-4MQGJWFP.cjs} +26 -26
- package/dist/{software-update-PHMXJVAC.cjs → software-update-MQIGPBZ6.cjs} +23 -23
- package/dist/styles/image-sizes.d.ts +110 -0
- package/dist/styles/image-sizes.d.ts.map +1 -0
- package/dist/styles/image-sizes.js +66 -0
- package/dist/{tickets-board-3FBVYSXR.cjs → tickets-board-QF5JNSH2.cjs} +11 -11
- package/eslint-config/base.js +12 -0
- package/eslint-config/image-sizes.js +51 -0
- package/package.json +8 -1
- package/src/components/agent-mark.tsx +3 -4
- package/src/components/chat/approval-batch-message.tsx +109 -1
- package/src/components/chat/chat-composer.tsx +4 -0
- package/src/components/chat/chat-context-memory-bar.tsx +28 -5
- package/src/components/chat/chat-message-row.tsx +3 -2
- package/src/components/chat/embeddable-chat.tsx +4 -0
- package/src/components/chat/entity-cards/admin-content-card.tsx +2 -1
- package/src/components/chat/entity-cards/blog-card.tsx +6 -6
- package/src/components/chat/entity-cards/blog-image-placeholder.tsx +2 -1
- package/src/components/chat/entity-cards/case-study-card.tsx +10 -9
- package/src/components/chat/entity-cards/customer-interview-card.tsx +8 -7
- package/src/components/chat/entity-cards/dispatch.tsx +9 -1
- package/src/components/chat/entity-cards/employee-entry-card.tsx +3 -2
- package/src/components/chat/entity-cards/entity-portrait-card.tsx +7 -5
- package/src/components/chat/entity-cards/investor-update-card.tsx +2 -1
- package/src/components/chat/entity-cards/onboarding-guide-card.tsx +10 -2
- package/src/components/chat/entity-cards/program-card.tsx +14 -5
- package/src/components/chat/entity-cards/roadmap-card.tsx +5 -4
- package/src/components/chat/mingo-info-card.tsx +3 -2
- package/src/components/embeds/markdown-image.tsx +2 -1
- package/src/components/embeds/og-link-preview.tsx +14 -6
- package/src/components/embeds/twitter-embed-client.tsx +3 -2
- package/src/components/features/board/ticket-card.tsx +7 -6
- package/src/components/features/media-gallery-manager.tsx +2 -2
- package/src/components/features/notifications/notification-tile.tsx +3 -2
- package/src/components/features/parallax-image-showcase.tsx +9 -26
- package/src/components/features/select-button.tsx +3 -2
- package/src/components/features/video-hover-preview.tsx +3 -2
- package/src/components/features/video.tsx +10 -1
- package/src/components/features/walkthrough-video.tsx +7 -10
- package/src/components/hero-image-uploader.tsx +9 -1
- package/src/components/icon-display.tsx +2 -1
- package/src/components/layout/page-layout.tsx +1 -1
- package/src/components/layout/title-block.tsx +22 -3
- package/src/components/media-carousel.tsx +2 -1
- package/src/components/platform/ScriptInfoSection.tsx +9 -1
- package/src/components/shared/media-gallery-strip.tsx +4 -2
- package/src/components/shared/product-release/product-release-card.tsx +10 -2
- package/src/components/ui/avatar-stack.tsx +6 -6
- package/src/components/ui/data-table/data-table-body.tsx +9 -0
- package/src/components/ui/device-card.tsx +7 -1
- package/src/components/ui/entity-image.tsx +3 -2
- package/src/components/ui/image-gallery-modal.tsx +2 -1
- package/src/components/ui/image-uploader.tsx +2 -1
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/markdown/base-components.tsx +2 -1
- package/src/components/ui/page-actions.tsx +28 -14
- package/src/components/ui/photo-wall.tsx +10 -14
- package/src/components/ui/square-avatar.tsx +6 -3
- package/src/components/user-summary-stub.tsx +14 -7
- package/src/components/vendor-display-button.tsx +10 -3
- package/src/components/vendor-icon.tsx +31 -97
- package/src/hooks/ui/use-image-edge-color.ts +8 -4
- package/src/styles/image-sizes.ts +114 -0
|
@@ -147,6 +147,7 @@ export * from './deleted-user-avatar';
|
|
|
147
147
|
export * from './square-avatar';
|
|
148
148
|
// THE sizes of the library's components (avatars, icons, tiles, media, text rows).
|
|
149
149
|
export * from '../../styles/component-sizes';
|
|
150
|
+
export * from '../../styles/image-sizes';
|
|
150
151
|
export * from './tab-selector';
|
|
151
152
|
export * from './tag';
|
|
152
153
|
export * from './title-content-block';
|
|
@@ -11,6 +11,7 @@ import Image from '../../../embed-shims/next-image';
|
|
|
11
11
|
*/
|
|
12
12
|
import Link from '../../../embed-shims/next-link';
|
|
13
13
|
import { useAuthedImageSrc } from '../../../hooks/use-authed-image-src';
|
|
14
|
+
import { IMAGE_SLOT } from '../../../styles/image-sizes';
|
|
14
15
|
import type { ResolveLinkResult } from '../../../types/doc-source';
|
|
15
16
|
import { cn } from '../../../utils/cn';
|
|
16
17
|
import { slugifyHeadingText } from '../../../utils/markdown-heading-id';
|
|
@@ -87,7 +88,7 @@ const MarkdownContentImage: React.FC<{ src: string; alt?: string }> = ({ src, al
|
|
|
87
88
|
alt={alt ?? 'No image available'}
|
|
88
89
|
width={400}
|
|
89
90
|
height={400}
|
|
90
|
-
sizes=
|
|
91
|
+
sizes={IMAGE_SLOT.inline}
|
|
91
92
|
className="h-auto max-h-[400px] w-auto max-w-full rounded-lg object-contain"
|
|
92
93
|
style={{ width: 'auto', height: 'auto' }}
|
|
93
94
|
/>
|
|
@@ -279,8 +279,9 @@ const ACTIONS_GAP = 'gap-[var(--spacing-system-xs)]';
|
|
|
279
279
|
* and an inert control promises nothing and cannot act on a wrong assumption before the data lands. The "…" trigger
|
|
280
280
|
* is drawn the same way (`ActionsMenuDropdown loading`).
|
|
281
281
|
*
|
|
282
|
-
* An empty list is the one placeholder
|
|
283
|
-
* be drawn.
|
|
282
|
+
* An empty list is the one placeholder, and only on `loading`: it means the action set is unknown, not known-empty, so
|
|
283
|
+
* nothing real can be drawn. A loading scope alone does not: a page that knows its actions while it loads (a list
|
|
284
|
+
* page's header) draws them as passed, an empty set as nothing, exactly as it settles. Its shape is what an empty header settles into for the variant: `icon-buttons` and `menu-primary` the
|
|
284
285
|
* square "…" trigger (`icon`), `primary-buttons` a labelled button (`label`).
|
|
285
286
|
*/
|
|
286
287
|
function UnknownActionSkeleton({ shape, fullWidth }: { shape: 'icon' | 'label'; fullWidth?: boolean }) {
|
|
@@ -296,7 +297,8 @@ export function PageActions({
|
|
|
296
297
|
className,
|
|
297
298
|
loading: loadingProp,
|
|
298
299
|
}: PageActionsProps) {
|
|
299
|
-
|
|
300
|
+
// Each variant reads the loading scope itself; it gets the caller's own flag, which alone says the action set is
|
|
301
|
+
// not known yet.
|
|
300
302
|
if (variant === 'icon-buttons') {
|
|
301
303
|
return (
|
|
302
304
|
<IconButtonsVariant
|
|
@@ -304,7 +306,7 @@ export function PageActions({
|
|
|
304
306
|
menuActions={menuActions}
|
|
305
307
|
selector={selector}
|
|
306
308
|
className={className}
|
|
307
|
-
loading={
|
|
309
|
+
loading={loadingProp}
|
|
308
310
|
/>
|
|
309
311
|
);
|
|
310
312
|
}
|
|
@@ -316,12 +318,12 @@ export function PageActions({
|
|
|
316
318
|
menuActions={menuActions || []}
|
|
317
319
|
selector={selector}
|
|
318
320
|
className={className}
|
|
319
|
-
loading={
|
|
321
|
+
loading={loadingProp}
|
|
320
322
|
/>
|
|
321
323
|
);
|
|
322
324
|
}
|
|
323
325
|
|
|
324
|
-
return <PrimaryButtonsVariant actions={actions} className={className} loading={
|
|
326
|
+
return <PrimaryButtonsVariant actions={actions} className={className} loading={loadingProp} />;
|
|
325
327
|
}
|
|
326
328
|
|
|
327
329
|
function IconButtonsVariant({
|
|
@@ -338,6 +340,9 @@ function IconButtonsVariant({
|
|
|
338
340
|
loading?: boolean;
|
|
339
341
|
}) {
|
|
340
342
|
const loading = useLoadingScope() || loadingProp;
|
|
343
|
+
// The placeholder for an action set nobody knows yet: only when the caller says so (`loading`), never because a
|
|
344
|
+
// loading scope is on (a page that knows its actions draws them, an empty set included).
|
|
345
|
+
const unknownSet = !!loadingProp;
|
|
341
346
|
const desktopActions = actions.filter(a => !a.showOnlyMobile);
|
|
342
347
|
const hasMenuActions = !!menuActions && menuActions.some(g => g.items.length > 0);
|
|
343
348
|
|
|
@@ -357,7 +362,7 @@ function IconButtonsVariant({
|
|
|
357
362
|
<React.Fragment key={actionKey(action, idx)}>{renderActionButton(action, { inert: loading })}</React.Fragment>
|
|
358
363
|
))}
|
|
359
364
|
{/* An unknown set with no menu: the trigger's square. With a menu, the trigger already is it. */}
|
|
360
|
-
{
|
|
365
|
+
{unknownSet && desktopActions.length === 0 && !hasMenuActions && <UnknownActionSkeleton shape="icon" />}
|
|
361
366
|
{hasMenuActions && <ActionsMenuDropdown groups={menuActions} loading={loading} />}
|
|
362
367
|
</div>
|
|
363
368
|
|
|
@@ -367,7 +372,7 @@ function IconButtonsVariant({
|
|
|
367
372
|
renderActionButton(singleAction, { iconOnly: true, inert: loading })
|
|
368
373
|
) : hasMobileMenuItems ? (
|
|
369
374
|
<ActionsMenuDropdown groups={mobileMenuGroups} loading={loading} />
|
|
370
|
-
) :
|
|
375
|
+
) : unknownSet ? (
|
|
371
376
|
<UnknownActionSkeleton shape="icon" />
|
|
372
377
|
) : null}
|
|
373
378
|
</div>
|
|
@@ -395,6 +400,9 @@ function PrimaryButtonsVariant({
|
|
|
395
400
|
loading?: boolean;
|
|
396
401
|
}) {
|
|
397
402
|
const loading = useLoadingScope() || loadingProp;
|
|
403
|
+
// The placeholder for an action set nobody knows yet: only when the caller says so (`loading`), never because a
|
|
404
|
+
// loading scope is on (a page that knows its actions draws them, an empty set included).
|
|
405
|
+
const unknownSet = !!loadingProp;
|
|
398
406
|
// Sort: outline first, accent last (rightmost on desktop).
|
|
399
407
|
const sortedActions = [...actions].sort((a, b) => {
|
|
400
408
|
if (a.variant === 'accent' && b.variant !== 'accent') return 1;
|
|
@@ -413,15 +421,15 @@ function PrimaryButtonsVariant({
|
|
|
413
421
|
</React.Fragment>
|
|
414
422
|
))}
|
|
415
423
|
{/* No overflow trigger in this variant: an unknown action set settles into a labelled button. */}
|
|
416
|
-
{
|
|
424
|
+
{unknownSet && desktopActions.length === 0 && <UnknownActionSkeleton shape="label" />}
|
|
417
425
|
</div>
|
|
418
426
|
|
|
419
427
|
<div className={cn('hidden items-center md:content-max-md:flex', ACTIONS_GAP, className)}>
|
|
420
428
|
<CompactPrimaryActions actions={desktopActions} loading={loading} />
|
|
421
|
-
{
|
|
429
|
+
{unknownSet && desktopActions.length === 0 && <UnknownActionSkeleton shape="icon" />}
|
|
422
430
|
</div>
|
|
423
431
|
|
|
424
|
-
<MobileBottomActions actions={sortedActions} loading={
|
|
432
|
+
<MobileBottomActions actions={sortedActions} loading={loadingProp} />
|
|
425
433
|
</>
|
|
426
434
|
);
|
|
427
435
|
}
|
|
@@ -444,6 +452,9 @@ function MenuPrimaryVariant({
|
|
|
444
452
|
loading?: boolean;
|
|
445
453
|
}) {
|
|
446
454
|
const loading = useLoadingScope() || loadingProp;
|
|
455
|
+
// The placeholder for an action set nobody knows yet: only when the caller says so (`loading`), never because a
|
|
456
|
+
// loading scope is on (a page that knows its actions draws them, an empty set included).
|
|
457
|
+
const unknownSet = !!loadingProp;
|
|
447
458
|
const desktopActions = actions.filter(a => !a.showOnlyMobile);
|
|
448
459
|
const hasMenuActions = menuActions.some(g => g.items.length > 0);
|
|
449
460
|
|
|
@@ -461,7 +472,7 @@ function MenuPrimaryVariant({
|
|
|
461
472
|
</React.Fragment>
|
|
462
473
|
))}
|
|
463
474
|
{/* An unknown set with no menu: the trigger's square. With a menu, the trigger already is it. */}
|
|
464
|
-
{
|
|
475
|
+
{unknownSet && desktopActions.length === 0 && !hasMenuActions && <UnknownActionSkeleton shape="icon" />}
|
|
465
476
|
</div>
|
|
466
477
|
|
|
467
478
|
<div className={cn('flex content-md:hidden', className)}>
|
|
@@ -470,7 +481,7 @@ function MenuPrimaryVariant({
|
|
|
470
481
|
// title row has no room for it, and hiding it entirely (what
|
|
471
482
|
// `icon-buttons` does) would leave no way to switch views at all.
|
|
472
483
|
<ActionsMenuDropdown groups={mobileMenuGroups} header={selector} loading={loading} />
|
|
473
|
-
) :
|
|
484
|
+
) : unknownSet ? (
|
|
474
485
|
<UnknownActionSkeleton shape="icon" />
|
|
475
486
|
) : null}
|
|
476
487
|
</div>
|
|
@@ -502,6 +513,9 @@ function CompactPrimaryActions({ actions, loading: loadingProp }: { actions: Pag
|
|
|
502
513
|
|
|
503
514
|
function MobileBottomActions({ actions, loading: loadingProp }: { actions: PageActionButton[]; loading?: boolean }) {
|
|
504
515
|
const loading = useLoadingScope() || loadingProp;
|
|
516
|
+
// The placeholder for an action set nobody knows yet: only when the caller says so (`loading`), never because a
|
|
517
|
+
// loading scope is on (a page that knows its actions draws them, an empty set included).
|
|
518
|
+
const unknownSet = !!loadingProp;
|
|
505
519
|
return (
|
|
506
520
|
<div
|
|
507
521
|
className={cn(
|
|
@@ -519,7 +533,7 @@ function MobileBottomActions({ actions, loading: loadingProp }: { actions: PageA
|
|
|
519
533
|
{renderActionButton(action, { fullWidth: !!action.label, inert: loading })}
|
|
520
534
|
</React.Fragment>
|
|
521
535
|
))}
|
|
522
|
-
{
|
|
536
|
+
{unknownSet && actions.length === 0 && <UnknownActionSkeleton shape="label" fullWidth />}
|
|
523
537
|
</div>
|
|
524
538
|
);
|
|
525
539
|
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
20
|
import Image, { resizedImageUrl } from '../../embed-shims/next-image';
|
|
21
|
+
import { imageWidthFor } from '../../styles/image-sizes';
|
|
21
22
|
import { cn } from '../../utils/cn';
|
|
22
23
|
import { UnifiedSkeleton } from '../loading/unified-skeleton';
|
|
23
24
|
import { useLoadingScope } from './loading-scope';
|
|
@@ -55,20 +56,15 @@ const EAGER_PHOTOS_PER_COLUMN = 2;
|
|
|
55
56
|
// A column is repeated until it is this much taller than the wall.
|
|
56
57
|
const FILL_FACTOR = 1.25;
|
|
57
58
|
const MAX_REPEATS = 8;
|
|
58
|
-
/**
|
|
59
|
-
* The widths a wall photo is asked for. A column is a fraction of the wall, so a
|
|
60
|
-
* photo is requested at the first step that covers its column on this screen
|
|
61
|
-
* (at most twice the column, for dense screens), never at the caller's one size
|
|
62
|
-
* for every viewport. Steps, not the exact width, so a resize by a few pixels
|
|
63
|
-
* asks for nothing new.
|
|
64
|
-
*/
|
|
65
|
-
const PHOTO_WIDTH_STEPS_PX = [240, 360, 480, 640, 960] as const;
|
|
66
59
|
const MAX_PIXEL_DENSITY = 2;
|
|
67
60
|
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The width to ask a photo at for a column `columnWidth` wide: the first width of the image-size table's ladder that
|
|
63
|
+
* covers the column on this screen (at most twice the column, for dense screens), so a wall photo is the same cached
|
|
64
|
+
* file every `srcset` picture of that width asks for, and a resize by a few pixels asks for nothing new.
|
|
65
|
+
*/
|
|
66
|
+
export function photoWallRequestWidth(columnWidth: number, pixelDensity: number): number {
|
|
67
|
+
return imageWidthFor(columnWidth * Math.min(Math.max(1, pixelDensity), MAX_PIXEL_DENSITY));
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
export function photoOrientation(naturalWidth: number, naturalHeight: number): PhotoOrientation {
|
|
@@ -182,7 +178,7 @@ export interface PhotoWallProps {
|
|
|
182
178
|
/** The pictures are still being fetched: show the wall's own placeholder frames. */
|
|
183
179
|
loading?: boolean;
|
|
184
180
|
/**
|
|
185
|
-
* The width a column is drawn at, as an image `sizes` value
|
|
181
|
+
* The width a column is drawn at, as an image `sizes` value from the image-size table (`IMAGE_SLOT.wall`). With it, and a
|
|
186
182
|
* size on every picture, the wall is laid out at once, on the server too, and each picture is drawn with the host's
|
|
187
183
|
* `srcset`: the first frames are in the HTML and fetched before any script runs, instead of after the wall has been
|
|
188
184
|
* measured in the browser (CU-17tkuw5xp4q: the careers hero's largest paint waited for that). Two walls given the
|
|
@@ -245,7 +241,7 @@ export function PhotoWall({
|
|
|
245
241
|
// Each picture is measured at the url it is drawn from (the boxed `Image`'s
|
|
246
242
|
// `optimizedWidth`: the host's resizer at the column's width), so it is downloaded once.
|
|
247
243
|
// Laid out up front, a picture is drawn from its own url with the host's `srcset` (`sizes`), on the server too.
|
|
248
|
-
const drawnWidth = sizedUpFront ? undefined :
|
|
244
|
+
const drawnWidth = sizedUpFront ? undefined : requestWidth;
|
|
249
245
|
const drawnUrl = useCallback((url: string) => (drawnWidth ? resizedImageUrl(url, drawnWidth) : url), [drawnWidth]);
|
|
250
246
|
// A picture whose size the host stated has its orientation now; only the others are measured.
|
|
251
247
|
const known = useMemo(() => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { type HTMLAttributes, memo, forwardRef } from 'react';
|
|
4
4
|
import Image from '../../embed-shims/next-image';
|
|
5
5
|
import { useAuthedImageSrc } from '../../hooks/use-authed-image-src';
|
|
6
|
-
import { AVATAR_SIZE, AVATAR_SIZE_PX } from '../../styles/component-sizes';
|
|
6
|
+
import { AVATAR_SIZE, AVATAR_SIZE_PX, type AvatarSize } from '../../styles/component-sizes';
|
|
7
7
|
import { cn } from '../../utils/cn';
|
|
8
8
|
import { personInitials } from '../../utils/format';
|
|
9
9
|
import { UnifiedSkeleton } from '../loading/unified-skeleton';
|
|
@@ -13,7 +13,7 @@ interface SquareAvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
src?: string;
|
|
14
14
|
alt?: string;
|
|
15
15
|
/** A step of the shared avatar scale (`AVATAR_SIZE`). */
|
|
16
|
-
size?:
|
|
16
|
+
size?: AvatarSize;
|
|
17
17
|
/** Exact pixel size (width & height). Overrides the `size` bucket dimensions —
|
|
18
18
|
* for callers with a numeric-px API (e.g. UserDisplay/MSPDisplay). */
|
|
19
19
|
sizePx?: number;
|
|
@@ -23,6 +23,8 @@ interface SquareAvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
* crest, whose round border cover slices off.
|
|
24
24
|
*/
|
|
25
25
|
fit?: 'cover' | 'contain';
|
|
26
|
+
/** A `contain` picture kept off the frame's edges (a logo on its tile). */
|
|
27
|
+
padded?: boolean;
|
|
26
28
|
fallback?: string;
|
|
27
29
|
variant?: 'square' | 'round';
|
|
28
30
|
/** Override the initials-fallback styling (font size/color). Merged over the
|
|
@@ -50,6 +52,7 @@ const SquareAvatar = memo(
|
|
|
50
52
|
size = 'md',
|
|
51
53
|
sizePx,
|
|
52
54
|
fit = 'cover',
|
|
55
|
+
padded = false,
|
|
53
56
|
fallback,
|
|
54
57
|
variant = 'square',
|
|
55
58
|
initialsClassName,
|
|
@@ -118,7 +121,7 @@ const SquareAvatar = memo(
|
|
|
118
121
|
'absolute max-w-none',
|
|
119
122
|
fit === 'contain'
|
|
120
123
|
? // A LOGO or crest must fit whole; cover would slice its edges.
|
|
121
|
-
'inset-0 h-full w-full object-contain'
|
|
124
|
+
cn('inset-0 h-full w-full object-contain', padded && 'p-1')
|
|
122
125
|
: // A portrait fills the frame; the 1px overscan hides edge seams.
|
|
123
126
|
'-inset-px h-[calc(100%+2px)] w-[calc(100%+2px)] object-cover',
|
|
124
127
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import Image from '../embed-shims/next-image';
|
|
4
|
+
import { AVATAR_SIZE_PX } from '../styles/component-sizes';
|
|
4
5
|
import { useProxiedImageUrl } from './chat/hooks/use-proxied-image-url';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -38,7 +39,7 @@ interface Props {
|
|
|
38
39
|
} | null;
|
|
39
40
|
/** Compact mode (avatar + name row, used in comment headers) */
|
|
40
41
|
compact?: boolean;
|
|
41
|
-
/** Avatar size in px for compact mode (defaults
|
|
42
|
+
/** Avatar size in px for compact mode (defaults to the avatar scale's `md`) */
|
|
42
43
|
avatarSize?: number;
|
|
43
44
|
|
|
44
45
|
/** NOT IMPLEMENTED in the stub. Would swap the avatar for ProfilePhotoUpload. */
|
|
@@ -88,7 +89,7 @@ export function UserSummary({
|
|
|
88
89
|
showEditButton = false,
|
|
89
90
|
mspPreview,
|
|
90
91
|
compact = false,
|
|
91
|
-
avatarSize =
|
|
92
|
+
avatarSize = AVATAR_SIZE_PX.md,
|
|
92
93
|
}: Props) {
|
|
93
94
|
const avatarSrc = useProxiedImageUrl(avatarUrl, { directHttps: false });
|
|
94
95
|
const mspLogoSrc = useProxiedImageUrl(mspPreview?.logoUrl, { directHttps: false });
|
|
@@ -121,8 +122,8 @@ export function UserSummary({
|
|
|
121
122
|
<Image
|
|
122
123
|
src={mspLogoSrc}
|
|
123
124
|
alt={mspPreview.name || 'MSP'}
|
|
124
|
-
width={
|
|
125
|
-
height={
|
|
125
|
+
width={AVATAR_SIZE_PX.xs}
|
|
126
|
+
height={AVATAR_SIZE_PX.xs}
|
|
126
127
|
className="absolute -bottom-1 -right-1 z-10 size-6 select-none rounded-full object-cover"
|
|
127
128
|
/>
|
|
128
129
|
)}
|
|
@@ -155,7 +156,13 @@ export function UserSummary({
|
|
|
155
156
|
{/* Avatar with badge wrapper */}
|
|
156
157
|
<div className="relative h-24 w-24 shrink-0 overflow-visible">
|
|
157
158
|
{avatarUrl ? (
|
|
158
|
-
<Image
|
|
159
|
+
<Image
|
|
160
|
+
src={avatarSrc}
|
|
161
|
+
alt={name}
|
|
162
|
+
width={AVATAR_SIZE_PX.profile}
|
|
163
|
+
height={AVATAR_SIZE_PX.profile}
|
|
164
|
+
className="rounded-full object-cover"
|
|
165
|
+
/>
|
|
159
166
|
) : (
|
|
160
167
|
<div className="flex h-full w-full items-center justify-center rounded-full border border-ods-border bg-ods-card font-heading text-3xl text-ods-text-secondary">
|
|
161
168
|
{name.charAt(0).toUpperCase()}
|
|
@@ -169,8 +176,8 @@ export function UserSummary({
|
|
|
169
176
|
<Image
|
|
170
177
|
src={mspLogoSrc}
|
|
171
178
|
alt={mspPreview.name || 'MSP Logo'}
|
|
172
|
-
width={
|
|
173
|
-
height={
|
|
179
|
+
width={AVATAR_SIZE_PX.md}
|
|
180
|
+
height={AVATAR_SIZE_PX.md}
|
|
174
181
|
className="object-cover"
|
|
175
182
|
/>
|
|
176
183
|
) : (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import Image from '../embed-shims/next-image';
|
|
4
|
+
import { IMAGE_FIXED_PX } from '../styles/image-sizes';
|
|
4
5
|
import { cn } from '../utils/cn';
|
|
5
6
|
import { getVendorLogo, type VendorWithMedia } from '../utils/vendor-media-stub';
|
|
6
7
|
import { useProxiedImageUrl } from './chat/hooks/use-proxied-image-url';
|
|
@@ -47,8 +48,8 @@ export function VendorDisplayButton({ vendor, onClick, variant = 'default', exte
|
|
|
47
48
|
<Image
|
|
48
49
|
src={logoSrc}
|
|
49
50
|
alt={`${vendor.title} logo`}
|
|
50
|
-
width={
|
|
51
|
-
height={
|
|
51
|
+
width={IMAGE_FIXED_PX.glyph}
|
|
52
|
+
height={IMAGE_FIXED_PX.glyph}
|
|
52
53
|
className="h-full w-full object-cover"
|
|
53
54
|
/>
|
|
54
55
|
</div>
|
|
@@ -69,7 +70,13 @@ export function VendorDisplayButton({ vendor, onClick, variant = 'default', exte
|
|
|
69
70
|
<Button variant="chip" data-tone="accent" onClick={handleClick} className={VENDOR_DISPLAY_BUTTON_LAYOUT_CLASS}>
|
|
70
71
|
{logoUrl ? (
|
|
71
72
|
<div className={cn(VENDOR_DISPLAY_BUTTON_LOGO_CLASS, 'border border-ods-border bg-ods-card')}>
|
|
72
|
-
<Image
|
|
73
|
+
<Image
|
|
74
|
+
src={logoSrc}
|
|
75
|
+
alt={`${vendor.title} logo`}
|
|
76
|
+
width={IMAGE_FIXED_PX.glyph}
|
|
77
|
+
height={IMAGE_FIXED_PX.glyph}
|
|
78
|
+
className="rounded object-cover"
|
|
79
|
+
/>
|
|
73
80
|
</div>
|
|
74
81
|
) : (
|
|
75
82
|
<div className={cn(VENDOR_DISPLAY_BUTTON_LOGO_CLASS, 'border border-ods-border bg-ods-border')}>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import type { AvatarSize } from '../styles/component-sizes';
|
|
4
4
|
import { cn } from '../utils/cn';
|
|
5
5
|
import { getVendorLogo, type VendorWithMedia } from '../utils/vendor-media-stub';
|
|
6
6
|
import { useProxiedImageUrl } from './chat/hooks/use-proxied-image-url';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { loadingItemProps } from './ui/loading-scope';
|
|
8
|
+
import { SquareAvatar } from './ui/square-avatar';
|
|
9
9
|
|
|
10
10
|
interface VendorIconProps {
|
|
11
11
|
vendor: VendorWithMedia & {
|
|
@@ -14,120 +14,54 @@ interface VendorIconProps {
|
|
|
14
14
|
slug?: string;
|
|
15
15
|
logo?: string | null;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/** A step of the shared avatar scale: the tile's box and the picture it fetches. */
|
|
18
|
+
size?: AvatarSize;
|
|
18
19
|
className?: string;
|
|
20
|
+
/** On a background the logo sits padded on its tile; without one it fills the tile. */
|
|
19
21
|
showBackground?: boolean;
|
|
20
22
|
backgroundStyle?: 'dark' | 'light' | 'white';
|
|
21
23
|
/** The vendor is still being read: the icon draws its skeleton, the tile's own box. A loading scope does the same. */
|
|
22
24
|
loading?: boolean;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
xl: 'w-16 h-16',
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const imageSizeMap = {
|
|
35
|
-
xs: { width: 16, height: 16 },
|
|
36
|
-
sm: { width: 20, height: 20 },
|
|
37
|
-
md: { width: 32, height: 32 },
|
|
38
|
-
lg: { width: 40, height: 40 },
|
|
39
|
-
l: { width: 38, height: 38 },
|
|
40
|
-
xl: { width: 40, height: 40 },
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Tile px per size (the `sizeClasses` box). With `showBackground={false}`
|
|
45
|
-
* the image FILLS the tile (`h-full w-full`), so it must be requested at the
|
|
46
|
-
* tile's size: requesting the padded `imageSizeMap` size there served a
|
|
47
|
-
* 32px bitmap stretched over a 40-64px tile, blurry on every display.
|
|
48
|
-
*/
|
|
49
|
-
const tilePxMap = {
|
|
50
|
-
xs: 24,
|
|
51
|
-
sm: 32,
|
|
52
|
-
md: 40,
|
|
53
|
-
lg: 48,
|
|
54
|
-
l: 56,
|
|
55
|
-
xl: 64,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const backgroundClasses = {
|
|
59
|
-
dark: 'bg-ods-bg border border-ods-border',
|
|
60
|
-
light: 'bg-ods-card border border-ods-border',
|
|
61
|
-
white: 'bg-white border border-[#E5E5E5]',
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/** A vendor's logo while it is read: the tile's own box. Carries the icon's `data-*` markers (`loadingItemProps`). */
|
|
65
|
-
function VendorIconSkeleton({
|
|
66
|
-
size = 'md',
|
|
67
|
-
className,
|
|
68
|
-
...props
|
|
69
|
-
}: {
|
|
70
|
-
size?: VendorIconProps['size'];
|
|
71
|
-
className?: string;
|
|
72
|
-
}) {
|
|
73
|
-
return (
|
|
74
|
-
<UnifiedSkeleton
|
|
75
|
-
className={cn(sizeClasses[size], 'flex-shrink-0 rounded-lg', className)}
|
|
76
|
-
{...loadingItemProps(props)}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
27
|
+
/** The tile's surface per background, over the avatar's own (`dark` is the avatar's). */
|
|
28
|
+
const BACKGROUND_CLASS = {
|
|
29
|
+
dark: '',
|
|
30
|
+
light: 'bg-ods-card',
|
|
31
|
+
white: 'bg-white border-[#E5E5E5] [--ods-avatar-initials:#333333]',
|
|
32
|
+
} as const;
|
|
80
33
|
|
|
81
34
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
35
|
+
* A vendor's logo on its tile, for comparison tables, dropdowns and cards: the lib's `SquareAvatar` (the shared avatar
|
|
36
|
+
* scale, a `contain` fit, the initials fallback and the skeleton), so a vendor logo is sized like every other avatar.
|
|
84
37
|
*/
|
|
85
38
|
export function VendorIcon({
|
|
86
39
|
vendor,
|
|
87
40
|
size = 'md',
|
|
88
|
-
className
|
|
41
|
+
className,
|
|
89
42
|
showBackground = true,
|
|
90
43
|
backgroundStyle = 'dark',
|
|
91
|
-
loading
|
|
44
|
+
loading,
|
|
92
45
|
...props
|
|
93
46
|
}: VendorIconProps) {
|
|
94
|
-
const loading = useLoadingScope() || !!loadingProp;
|
|
95
47
|
const logoUrl = getVendorLogo(vendor);
|
|
96
48
|
const logoSrc = useProxiedImageUrl(logoUrl, { directHttps: false });
|
|
97
|
-
const { width, height } = showBackground ? imageSizeMap[size] : { width: tilePxMap[size], height: tilePxMap[size] };
|
|
98
|
-
|
|
99
|
-
const containerClasses = cn(
|
|
100
|
-
sizeClasses[size],
|
|
101
|
-
'flex flex-shrink-0 items-center justify-center rounded-lg',
|
|
102
|
-
showBackground && backgroundClasses[backgroundStyle],
|
|
103
|
-
!showBackground && 'overflow-hidden',
|
|
104
|
-
className,
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
// A list's markers (`data-loading-item`) ride on the icon in both forms.
|
|
108
|
-
const markers = loadingItemProps(props);
|
|
109
|
-
if (loading) return <VendorIconSkeleton size={size} className={className} {...markers} />;
|
|
110
|
-
|
|
111
49
|
return (
|
|
112
|
-
<
|
|
113
|
-
{logoUrl ?
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
backgroundStyle === 'white' ? 'text-[#333333]' : 'text-ods-text-secondary',
|
|
126
|
-
)}
|
|
127
|
-
>
|
|
128
|
-
{vendor.title?.substring(0, 2) || '??'}
|
|
129
|
-
</div>
|
|
50
|
+
<SquareAvatar
|
|
51
|
+
src={logoUrl ? logoSrc || undefined : undefined}
|
|
52
|
+
alt={`${vendor.title} logo`}
|
|
53
|
+
fallback={vendor.title}
|
|
54
|
+
size={size}
|
|
55
|
+
fit="contain"
|
|
56
|
+
padded={showBackground}
|
|
57
|
+
loading={loading}
|
|
58
|
+
initialsClassName="uppercase text-h6"
|
|
59
|
+
className={cn(
|
|
60
|
+
'rounded-lg',
|
|
61
|
+
showBackground ? BACKGROUND_CLASS[backgroundStyle] : 'border-0 bg-transparent',
|
|
62
|
+
className,
|
|
130
63
|
)}
|
|
131
|
-
|
|
64
|
+
{...loadingItemProps(props)}
|
|
65
|
+
/>
|
|
132
66
|
);
|
|
133
67
|
}
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { useLoadingScope } from '../../components/ui/loading-scope';
|
|
5
5
|
import { resizedImageUrl } from '../../embed-shims/next-image';
|
|
6
|
+
import { IMAGE_FIXED_WIDTHS } from '../../styles/image-sizes';
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The sample is drawn this wide at most, so that is all of the picture that is downloaded. A width of the image-size
|
|
10
|
+
* table's fixed ladder (128), so the sample is a cached file a thumbnail of the same picture already asked for.
|
|
11
|
+
*/
|
|
12
|
+
const EDGE_SAMPLE_WIDTH = IMAGE_FIXED_WIDTHS[2];
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Extract the dominant edge color from an image using color bucketing.
|
|
@@ -18,7 +22,7 @@ function extractEdgeColor(img: HTMLImageElement): string {
|
|
|
18
22
|
const ctx = canvas.getContext('2d');
|
|
19
23
|
if (!ctx) return '#000000';
|
|
20
24
|
|
|
21
|
-
const maxSize =
|
|
25
|
+
const maxSize = EDGE_SAMPLE_WIDTH;
|
|
22
26
|
const scale = Math.min(maxSize / img.naturalWidth, maxSize / img.naturalHeight);
|
|
23
27
|
const w = Math.round(img.naturalWidth * scale);
|
|
24
28
|
const h = Math.round(img.naturalHeight * scale);
|
|
@@ -135,7 +139,7 @@ export function useImageEdgeColor(givenUrl: string | undefined | null, fallback
|
|
|
135
139
|
// The picture is asked for at the sample's size (a card's cover is often a
|
|
136
140
|
// multi-hundred-KB original, and this is a second request for it). When the
|
|
137
141
|
// host cannot serve that size, the original is tried once.
|
|
138
|
-
const sampleUrl = resizedImageUrl(imageUrl,
|
|
142
|
+
const sampleUrl = resizedImageUrl(imageUrl, EDGE_SAMPLE_WIDTH);
|
|
139
143
|
let triedOriginal = sampleUrl === imageUrl;
|
|
140
144
|
img.onerror = () => {
|
|
141
145
|
if (cancelled) return;
|