@flamingo-stack/openframe-frontend-core 0.0.617 → 0.0.618-snapshot.20260913204500
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-UVK7AQAG.js → chunk-3BNNYHP2.js} +3 -3
- package/dist/{chunk-VHS3OYE4.js → chunk-3Z5ZIKDX.js} +2532 -2460
- package/dist/chunk-3Z5ZIKDX.js.map +1 -0
- package/dist/{chunk-BJDQZH62.cjs → chunk-4ZGUSO7M.cjs} +5 -5
- package/dist/{chunk-BJDQZH62.cjs.map → chunk-4ZGUSO7M.cjs.map} +1 -1
- package/dist/{chunk-HGPGF6SF.js → chunk-5DUTXG6P.js} +3 -3
- package/dist/{chunk-VIBREYUK.cjs → chunk-5G3L6327.cjs} +3 -3
- package/dist/{chunk-VIBREYUK.cjs.map → chunk-5G3L6327.cjs.map} +1 -1
- package/dist/{chunk-GBON2OCG.js → chunk-5WGOAJ4B.js} +3 -2
- package/dist/chunk-5WGOAJ4B.js.map +1 -0
- package/dist/{chunk-FP5WYJ3S.js → chunk-65SWJSQX.js} +8 -3
- package/dist/{chunk-FP5WYJ3S.js.map → chunk-65SWJSQX.js.map} +1 -1
- package/dist/{chunk-BLUL2TE3.js → chunk-7HWVD42H.js} +24 -4
- package/dist/chunk-7HWVD42H.js.map +1 -0
- package/dist/{chunk-HR6CHKD6.cjs → chunk-AU2Q75HU.cjs} +6 -6
- package/dist/{chunk-HR6CHKD6.cjs.map → chunk-AU2Q75HU.cjs.map} +1 -1
- package/dist/{chunk-45OAW4M2.js → chunk-D4ARG53E.js} +6 -6
- package/dist/{chunk-UXOOVP77.cjs → chunk-DV7IBKJI.cjs} +4 -4
- package/dist/{chunk-UXOOVP77.cjs.map → chunk-DV7IBKJI.cjs.map} +1 -1
- package/dist/{chunk-67XFJ442.cjs → chunk-DXR23SLZ.cjs} +523 -451
- package/dist/chunk-DXR23SLZ.cjs.map +1 -0
- package/dist/{chunk-N6CULJYR.cjs → chunk-EG4IKWY4.cjs} +3 -2
- package/dist/{chunk-N6CULJYR.cjs.map → chunk-EG4IKWY4.cjs.map} +1 -1
- package/dist/{chunk-TRY3CUWJ.cjs → chunk-EIFU6N5L.cjs} +29 -29
- package/dist/{chunk-TRY3CUWJ.cjs.map → chunk-EIFU6N5L.cjs.map} +1 -1
- package/dist/{chunk-UQEOAPAI.cjs → chunk-EYKTKDRK.cjs} +101 -58
- package/dist/chunk-EYKTKDRK.cjs.map +1 -0
- package/dist/{chunk-IW746HJ7.js → chunk-FHR2JU2J.js} +2 -2
- package/dist/{chunk-7GLJC4EO.cjs → chunk-GAPXVAS6.cjs} +151 -146
- package/dist/chunk-GAPXVAS6.cjs.map +1 -0
- package/dist/{chunk-QPAPUIF3.cjs → chunk-GNWKLE7O.cjs} +58 -38
- package/dist/chunk-GNWKLE7O.cjs.map +1 -0
- package/dist/{chunk-VNNIRX23.cjs → chunk-HF4EZICZ.cjs} +3 -3
- package/dist/{chunk-VNNIRX23.cjs.map → chunk-HF4EZICZ.cjs.map} +1 -1
- package/dist/{chunk-CXEGV3ZS.js → chunk-HPIRQWNK.js} +3 -3
- package/dist/{chunk-CGCV4QT2.js → chunk-I7RWVDN4.js} +5 -5
- package/dist/{chunk-RZURBPBS.js → chunk-J27HVNT2.js} +4 -4
- package/dist/{chunk-WFM5OAM6.js → chunk-JA2SIJ7T.js} +4 -4
- package/dist/{chunk-UVXMIZYK.js → chunk-JBXNDB5U.js} +8 -8
- package/dist/{chunk-JZELYIFZ.cjs → chunk-KQDGZS3U.cjs} +33 -33
- package/dist/{chunk-JZELYIFZ.cjs.map → chunk-KQDGZS3U.cjs.map} +1 -1
- package/dist/{chunk-7YHUP5BR.js → chunk-LPGBA4UZ.js} +3 -3
- package/dist/{chunk-2OJVGAGX.cjs → chunk-M4V2O2MT.cjs} +12 -12
- package/dist/{chunk-2OJVGAGX.cjs.map → chunk-M4V2O2MT.cjs.map} +1 -1
- package/dist/{chunk-VJJ7LGOI.js → chunk-MJRXGAXS.js} +5 -5
- package/dist/{chunk-V23BJC2Q.cjs → chunk-NOW7NGUH.cjs} +15 -15
- package/dist/{chunk-V23BJC2Q.cjs.map → chunk-NOW7NGUH.cjs.map} +1 -1
- package/dist/{chunk-GH4F4ODL.js → chunk-OD4JKGQG.js} +8 -8
- package/dist/{chunk-FMNS5NN2.cjs → chunk-P3I5KY4A.cjs} +20 -20
- package/dist/{chunk-FMNS5NN2.cjs.map → chunk-P3I5KY4A.cjs.map} +1 -1
- package/dist/{chunk-USP3UWID.cjs → chunk-QVOS4BPC.cjs} +65 -65
- package/dist/{chunk-USP3UWID.cjs.map → chunk-QVOS4BPC.cjs.map} +1 -1
- package/dist/{chunk-ZJYZOOTU.js → chunk-RTC3H5RW.js} +4 -4
- package/dist/{chunk-RU3IKVY2.js → chunk-S44BHDOI.js} +507 -464
- package/dist/chunk-S44BHDOI.js.map +1 -0
- package/dist/{chunk-6RMFEGJ4.js → chunk-SKRI6QJ5.js} +2 -2
- package/dist/{chunk-7FFKXXWY.cjs → chunk-U7MQS4CR.cjs} +88 -88
- package/dist/{chunk-7FFKXXWY.cjs.map → chunk-U7MQS4CR.cjs.map} +1 -1
- package/dist/{chunk-332JHI2D.cjs → chunk-UP2OB7RI.cjs} +11 -11
- package/dist/{chunk-332JHI2D.cjs.map → chunk-UP2OB7RI.cjs.map} +1 -1
- package/dist/{chunk-ULM5FCFN.cjs → chunk-UWPZT3FY.cjs} +6 -6
- package/dist/{chunk-ULM5FCFN.cjs.map → chunk-UWPZT3FY.cjs.map} +1 -1
- package/dist/{chunk-TSCIVH7T.js → chunk-VBIFSOPQ.js} +2 -2
- package/dist/{chunk-ZQOK4TCN.cjs → chunk-XRWY5ETC.cjs} +22 -22
- package/dist/{chunk-ZQOK4TCN.cjs.map → chunk-XRWY5ETC.cjs.map} +1 -1
- package/dist/{chunk-LFLJ3IHE.cjs → chunk-YNA7ZCDS.cjs} +28 -28
- package/dist/{chunk-LFLJ3IHE.cjs.map → chunk-YNA7ZCDS.cjs.map} +1 -1
- package/dist/{chunk-5KKLN7Q2.js → chunk-ZPJ6KYAW.js} +3 -3
- package/dist/components/case-studies/index.cjs +11 -11
- package/dist/components/case-studies/index.js +5 -5
- package/dist/components/chat/entity-cards/ai-prompt-card.d.ts +35 -0
- package/dist/components/chat/entity-cards/ai-prompt-card.d.ts.map +1 -0
- package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
- package/dist/components/chat/entity-cards/index.d.ts +2 -0
- package/dist/components/chat/entity-cards/index.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +7 -3
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +6 -2
- package/dist/components/comment-card.d.ts +26 -24
- package/dist/components/comment-card.d.ts.map +1 -1
- package/dist/components/comment-thread.d.ts +58 -0
- package/dist/components/comment-thread.d.ts.map +1 -0
- package/dist/components/contact/index.cjs +6 -6
- package/dist/components/contact/index.js +5 -5
- package/dist/components/docs/index.cjs +9 -9
- package/dist/components/docs/index.js +8 -8
- package/dist/components/embeds/index.cjs +6 -6
- package/dist/components/embeds/index.js +5 -5
- package/dist/components/faq/index.cjs +6 -6
- package/dist/components/faq/index.js +5 -5
- package/dist/components/features/index.cjs +5 -5
- package/dist/components/features/index.js +4 -4
- package/dist/components/help-center-pages/index.cjs +27 -27
- package/dist/components/help-center-pages/index.js +18 -18
- package/dist/components/index.cjs +225 -77
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +342 -194
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +40 -40
- package/dist/components/meeting-scheduler/index.cjs.map +1 -1
- package/dist/components/meeting-scheduler/index.js +8 -8
- package/dist/components/meeting-scheduler/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +8 -8
- package/dist/components/navigation/index.js +7 -7
- package/dist/components/onboarding-guides/index.cjs +8 -8
- package/dist/components/onboarding-guides/index.js +7 -7
- package/dist/components/related-content/card-registry.d.ts.map +1 -1
- package/dist/components/related-content/index.cjs +4 -4
- package/dist/components/related-content/index.js +3 -3
- package/dist/components/tickets/index.cjs +10 -10
- package/dist/components/tickets/index.js +9 -9
- package/dist/components/ui/avatar-stack.d.ts +16 -3
- package/dist/components/ui/avatar-stack.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +13 -5
- 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 +12 -4
- package/dist/components/ui/people-cell.d.ts +46 -0
- package/dist/components/ui/people-cell.d.ts.map +1 -0
- package/dist/index.cjs +19 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/types/marketing.d.ts +1 -1
- package/dist/types/marketing.d.ts.map +1 -1
- package/dist/utils/content-ref-groups.d.ts.map +1 -1
- package/dist/utils/format.d.ts +8 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +10 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +10 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/list-url.d.ts.map +1 -1
- package/dist/utils/source-icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/entity-cards/ai-prompt-card.tsx +62 -0
- package/src/components/chat/entity-cards/dispatch.tsx +3 -1
- package/src/components/chat/entity-cards/index.ts +2 -0
- package/src/components/comment-card.tsx +27 -24
- package/src/components/comment-thread.tsx +212 -0
- package/src/components/index.ts +1 -0
- package/src/components/meeting-scheduler/context-panel.tsx +1 -1
- package/src/components/meeting-scheduler/directory.tsx +1 -1
- package/src/components/related-content/__tests__/card-registry.test.tsx +7 -0
- package/src/components/related-content/card-registry.tsx +20 -1
- package/src/components/ui/__tests__/people-cell.test.tsx +97 -0
- package/src/components/ui/avatar-stack.tsx +40 -13
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/people-cell.tsx +133 -0
- package/src/components/ui/table/__tests__/header-hint.test.tsx +2 -2
- package/src/types/marketing.ts +1 -0
- package/src/utils/__tests__/list-url.test.ts +1 -0
- package/src/utils/content-ref-groups.ts +1 -0
- package/src/utils/format.ts +13 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/list-url.ts +1 -0
- package/src/utils/source-icons.ts +3 -0
- package/dist/chunk-67XFJ442.cjs.map +0 -1
- package/dist/chunk-7GLJC4EO.cjs.map +0 -1
- package/dist/chunk-BLUL2TE3.js.map +0 -1
- package/dist/chunk-GBON2OCG.js.map +0 -1
- package/dist/chunk-QPAPUIF3.cjs.map +0 -1
- package/dist/chunk-RU3IKVY2.js.map +0 -1
- package/dist/chunk-UQEOAPAI.cjs.map +0 -1
- package/dist/chunk-VHS3OYE4.js.map +0 -1
- /package/dist/{chunk-UVK7AQAG.js.map → chunk-3BNNYHP2.js.map} +0 -0
- /package/dist/{chunk-HGPGF6SF.js.map → chunk-5DUTXG6P.js.map} +0 -0
- /package/dist/{chunk-45OAW4M2.js.map → chunk-D4ARG53E.js.map} +0 -0
- /package/dist/{chunk-IW746HJ7.js.map → chunk-FHR2JU2J.js.map} +0 -0
- /package/dist/{chunk-CXEGV3ZS.js.map → chunk-HPIRQWNK.js.map} +0 -0
- /package/dist/{chunk-CGCV4QT2.js.map → chunk-I7RWVDN4.js.map} +0 -0
- /package/dist/{chunk-RZURBPBS.js.map → chunk-J27HVNT2.js.map} +0 -0
- /package/dist/{chunk-WFM5OAM6.js.map → chunk-JA2SIJ7T.js.map} +0 -0
- /package/dist/{chunk-UVXMIZYK.js.map → chunk-JBXNDB5U.js.map} +0 -0
- /package/dist/{chunk-7YHUP5BR.js.map → chunk-LPGBA4UZ.js.map} +0 -0
- /package/dist/{chunk-VJJ7LGOI.js.map → chunk-MJRXGAXS.js.map} +0 -0
- /package/dist/{chunk-GH4F4ODL.js.map → chunk-OD4JKGQG.js.map} +0 -0
- /package/dist/{chunk-ZJYZOOTU.js.map → chunk-RTC3H5RW.js.map} +0 -0
- /package/dist/{chunk-6RMFEGJ4.js.map → chunk-SKRI6QJ5.js.map} +0 -0
- /package/dist/{chunk-TSCIVH7T.js.map → chunk-VBIFSOPQ.js.map} +0 -0
- /package/dist/{chunk-5KKLN7Q2.js.map → chunk-ZPJ6KYAW.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-url.d.ts","sourceRoot":"","sources":["../../src/utils/list-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH;;;;iEAIiE;AACjE,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAKtE;
|
|
1
|
+
{"version":3,"file":"list-url.d.ts","sourceRoot":"","sources":["../../src/utils/list-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH;;;;iEAIiE;AACjE,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAKtE;AAoED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,SAAK,GAAG,MAAM,GAAG,IAAI,CAa5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-icons.d.ts","sourceRoot":"","sources":["../../src/utils/source-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"source-icons.d.ts","sourceRoot":"","sources":["../../src/utils/source-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqDpD,CAAC;AAEF;;6DAE6D;AAC7D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGxF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2DzD,CAAC;AAEF;;kEAEkE;AAClE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqDpE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEjF"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { formatDateUTC } from '../../../utils/format';
|
|
3
|
+
import {
|
|
4
|
+
EmployeeEntryBadge,
|
|
5
|
+
EmployeeEntryCard,
|
|
6
|
+
type EmployeeEntryCardData,
|
|
7
|
+
EmployeeEntryCardSkeleton,
|
|
8
|
+
} from './employee-entry-card';
|
|
9
|
+
|
|
10
|
+
/** Minimal row shape the card renders. Both the hub dashboard entry and the
|
|
11
|
+
* related-content hydrated row satisfy it structurally. */
|
|
12
|
+
export interface AiPromptCardData extends EmployeeEntryCardData {
|
|
13
|
+
published_at?: string | null;
|
|
14
|
+
/** The department the prompt is for, surfaced as a badge (the library's filter axis). */
|
|
15
|
+
department?: { name?: string | null } | null;
|
|
16
|
+
/** How many steps the prompt has. A chain (more than one) is badged. */
|
|
17
|
+
step_count?: number | null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface AiPromptCardProps {
|
|
21
|
+
entry: AiPromptCardData;
|
|
22
|
+
/** OG fallback cover. Caller computes it (hub: `useOgPlaceholderUrl`; related
|
|
23
|
+
* rail: `extras.buildOgPlaceholderUrl`). */
|
|
24
|
+
placeholderUrl?: string | null;
|
|
25
|
+
/** Owner action row (dashboard). Omit for a read-only card. */
|
|
26
|
+
actions?: React.ReactNode;
|
|
27
|
+
/** When provided, the WHOLE card becomes a link (related-rail click-through).
|
|
28
|
+
* Don't combine with `actions` (nested interactive). */
|
|
29
|
+
anchorProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* THE single Squawkbox prompt card: a thin binding over `EmployeeEntryCard`
|
|
35
|
+
* that maps the publish date to the meta date and adds the department and step
|
|
36
|
+
* count badges. Used by the people-hub dashboard (with owner `actions`) and the
|
|
37
|
+
* related-content rail (with `anchorProps`), so the card cannot drift between them.
|
|
38
|
+
*/
|
|
39
|
+
export function AiPromptCard({ entry, placeholderUrl, actions, anchorProps, className }: AiPromptCardProps) {
|
|
40
|
+
const department = entry.department?.name?.trim();
|
|
41
|
+
const steps = typeof entry.step_count === 'number' ? entry.step_count : 0;
|
|
42
|
+
return (
|
|
43
|
+
<EmployeeEntryCard
|
|
44
|
+
entry={entry}
|
|
45
|
+
dateLabel={entry.published_at ? formatDateUTC(entry.published_at, { fallback: '' }) || null : null}
|
|
46
|
+
extraBadges={
|
|
47
|
+
<>
|
|
48
|
+
{department ? <EmployeeEntryBadge>{department}</EmployeeEntryBadge> : null}
|
|
49
|
+
{steps > 1 ? <EmployeeEntryBadge>{`${steps} steps`}</EmployeeEntryBadge> : null}
|
|
50
|
+
</>
|
|
51
|
+
}
|
|
52
|
+
untitledLabel="Untitled prompt"
|
|
53
|
+
placeholderUrl={placeholderUrl}
|
|
54
|
+
actions={actions}
|
|
55
|
+
anchorProps={anchorProps}
|
|
56
|
+
className={className}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Loading skeleton matching AiPromptCard's shape (the shared employee-entry skeleton). */
|
|
62
|
+
export const AiPromptCardSkeleton = EmployeeEntryCardSkeleton;
|
|
@@ -53,6 +53,7 @@ import { PresentationLineIcon } from '../../icons-v2-generated/charts/presentati
|
|
|
53
53
|
import { CodeIcon } from '../../icons-v2-generated/coding/code-icon';
|
|
54
54
|
import { CodingCommitIcon } from '../../icons-v2-generated/coding/coding-commit-icon';
|
|
55
55
|
import { CodingPullRequestIcon } from '../../icons-v2-generated/coding/coding-pull-request-icon';
|
|
56
|
+
import { ChatQuoteIcon } from '../../icons-v2-generated/communication/chat-quote-icon';
|
|
56
57
|
import { CalendarIcon } from '../../icons-v2-generated/date-and-time/calendar-icon';
|
|
57
58
|
import { ClipboardListIcon } from '../../icons-v2-generated/documents/clipboard-list-icon';
|
|
58
59
|
import { FileContentIcon } from '../../icons-v2-generated/documents/file-content-icon';
|
|
@@ -1363,7 +1364,7 @@ function refGlyphRegistryEntries(): Record<string, ChatCardRegistryEntry> {
|
|
|
1363
1364
|
}
|
|
1364
1365
|
|
|
1365
1366
|
/** People-hub employee feeds hydrate from their EXISTING list APIs
|
|
1366
|
-
* (`/api/what-i-shipped?ids=`, `/api/how-i-work?ids=`) — entry-shaped rows
|
|
1367
|
+
* (`/api/what-i-shipped?ids=`, `/api/how-i-work?ids=`, `/api/prompts?ids=`) — entry-shaped rows
|
|
1367
1368
|
* (title / summary / author), not ChatRefs, hence the bespoke row→display
|
|
1368
1369
|
* mapping (the FAQ precedent). The destination comes from the ref (the
|
|
1369
1370
|
* server-resolved entry url) or, on a bare marker, the host's
|
|
@@ -1379,6 +1380,7 @@ function fetchedEmployeeEntryDisplayRef(item: unknown, chatRef: ChatRef): ChatRe
|
|
|
1379
1380
|
const EMPLOYEE_ENTRY_CARD_CONFIGS: Record<string, GlyphCardConfig> = {
|
|
1380
1381
|
what_i_shipped: { label: 'What I Shipped', icon: () => <Rocket02Icon size={24} /> },
|
|
1381
1382
|
how_i_work: { label: 'How I Work', icon: () => <ClipboardListIcon size={24} /> },
|
|
1383
|
+
ai_prompt: { label: 'Squawkbox', icon: () => <ChatQuoteIcon size={24} /> },
|
|
1382
1384
|
};
|
|
1383
1385
|
function employeeEntryRegistryEntries(): Record<string, ChatCardRegistryEntry> {
|
|
1384
1386
|
return registryEntries(EMPLOYEE_ENTRY_CARD_CONFIGS, (cfg, docType) => ({
|
|
@@ -25,6 +25,8 @@ export { WhatIShippedCard, WhatIShippedCardSkeleton } from './what-i-shipped-car
|
|
|
25
25
|
export type { WhatIShippedCardData, WhatIShippedCardProps } from './what-i-shipped-card';
|
|
26
26
|
export { HowIWorkCard, HowIWorkCardSkeleton } from './how-i-work-card';
|
|
27
27
|
export type { HowIWorkCardData, HowIWorkCardProps } from './how-i-work-card';
|
|
28
|
+
export { AiPromptCard, AiPromptCardSkeleton } from './ai-prompt-card';
|
|
29
|
+
export type { AiPromptCardData, AiPromptCardProps } from './ai-prompt-card';
|
|
28
30
|
|
|
29
31
|
// Moved-into-subdir flat cards
|
|
30
32
|
export { BlockCard, type BlockCardProps } from './block-card';
|
|
@@ -6,33 +6,36 @@ import { Button } from './ui/button';
|
|
|
6
6
|
import { UserSummary } from './user-summary-stub';
|
|
7
7
|
import { VendorDisplayButton } from './vendor-display-button';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/** The comment shape every comment surface renders (vendor reviews, design-doc and prompt threads). */
|
|
10
|
+
export interface CommentCardComment {
|
|
11
|
+
id: string;
|
|
12
|
+
content: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
type?: 'pro' | 'con';
|
|
15
|
+
importance?: 'Critical' | 'Important' | 'Nice-to-have';
|
|
16
|
+
createdAt: string;
|
|
17
|
+
vendor?: {
|
|
18
|
+
id: number;
|
|
19
|
+
title: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
logo: string | null;
|
|
22
|
+
category?: string | null;
|
|
23
|
+
};
|
|
24
|
+
user?: {
|
|
11
25
|
id: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
id: number;
|
|
19
|
-
title: string;
|
|
20
|
-
slug: string;
|
|
21
|
-
logo: string | null;
|
|
22
|
-
category?: string | null;
|
|
23
|
-
};
|
|
24
|
-
user?: {
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
profilePicture: string | null;
|
|
28
|
-
msp?: {
|
|
29
|
-
id: string | number;
|
|
30
|
-
name?: string | null;
|
|
31
|
-
icon_url?: string | null;
|
|
32
|
-
};
|
|
26
|
+
name: string;
|
|
27
|
+
profilePicture: string | null;
|
|
28
|
+
msp?: {
|
|
29
|
+
id: string | number;
|
|
30
|
+
name?: string | null;
|
|
31
|
+
icon_url?: string | null;
|
|
33
32
|
};
|
|
34
|
-
canDelete?: boolean;
|
|
35
33
|
};
|
|
34
|
+
canDelete?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CommentCardProps {
|
|
38
|
+
comment: CommentCardComment;
|
|
36
39
|
onViewProduct?: (vendorSlug: string) => void;
|
|
37
40
|
onDeleteComment?: (commentId: string) => void;
|
|
38
41
|
/** @deprecated Superseded by `leadWith`; the component ignores it. */
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ChevronDown } from 'lucide-react';
|
|
4
|
+
import { type ReactNode, useState } from 'react';
|
|
5
|
+
import { CommentCard, type CommentCardComment } from './comment-card';
|
|
6
|
+
import { CommentComposer } from './comment-composer';
|
|
7
|
+
import { Button } from './ui/button';
|
|
8
|
+
|
|
9
|
+
/** A root comment with its replies. Replies never nest further (single-level threads). */
|
|
10
|
+
export interface ThreadComment extends CommentCardComment {
|
|
11
|
+
replies?: CommentCardComment[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface CommentThreadProps {
|
|
15
|
+
comments: ThreadComment[];
|
|
16
|
+
/** Shown when there is nothing to list. Omit to render nothing. */
|
|
17
|
+
emptyLabel?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Post a reply to a ROOT comment. Resolve `false` to keep the typed reply (a
|
|
20
|
+
* failed post must never wipe the box). Omit and the thread is read-only.
|
|
21
|
+
*/
|
|
22
|
+
onReply?: (parentId: string, body: string) => Promise<boolean | void> | boolean | void;
|
|
23
|
+
/** Delete a root or a reply. Each card's `canDelete` still decides whether the button shows. */
|
|
24
|
+
onDelete?: (commentId: string) => Promise<unknown> | void;
|
|
25
|
+
/** Surface badges on a root (a design doc's type + status). */
|
|
26
|
+
renderBadges?: (comment: ThreadComment) => ReactNode;
|
|
27
|
+
/** Surface actions on a root, after Reply (a design doc's Resolve / Decline / Reopen). */
|
|
28
|
+
renderActions?: (comment: ThreadComment) => ReactNode;
|
|
29
|
+
replyPlaceholder?: string;
|
|
30
|
+
pending?: boolean;
|
|
31
|
+
/** Which header each ROOT card leads with; replies always lead with the commenter. */
|
|
32
|
+
leadWith?: 'vendor' | 'commenter';
|
|
33
|
+
onViewProduct?: (vendorSlug: string) => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* THE threaded comment list: root cards read in full, their replies indented
|
|
38
|
+
* beneath, and an inline reply composer per root.
|
|
39
|
+
*
|
|
40
|
+
* One component for every comment surface (design-doc sections and decision
|
|
41
|
+
* log, prompt library threads, vendor reviews), so reply behaviour, spacing and
|
|
42
|
+
* the keep-the-draft-on-failure rule cannot drift between them. Everything a
|
|
43
|
+
* surface owns (who may delete, which badges and settle actions a root carries)
|
|
44
|
+
* arrives through props; nothing in here knows about vocabularies or vendors.
|
|
45
|
+
*/
|
|
46
|
+
export function CommentThread({
|
|
47
|
+
comments,
|
|
48
|
+
emptyLabel,
|
|
49
|
+
onReply,
|
|
50
|
+
onDelete,
|
|
51
|
+
renderBadges,
|
|
52
|
+
renderActions,
|
|
53
|
+
replyPlaceholder = 'Write a reply',
|
|
54
|
+
pending = false,
|
|
55
|
+
leadWith,
|
|
56
|
+
onViewProduct,
|
|
57
|
+
}: CommentThreadProps) {
|
|
58
|
+
if (comments.length === 0) {
|
|
59
|
+
return emptyLabel ? <p className="text-ods-text-secondary text-h6">{emptyLabel}</p> : null;
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
<div className="flex flex-col gap-[var(--spacing-system-sf)]">
|
|
63
|
+
{comments.map(comment => (
|
|
64
|
+
<CommentThreadRow
|
|
65
|
+
key={comment.id}
|
|
66
|
+
comment={comment}
|
|
67
|
+
onReply={onReply}
|
|
68
|
+
onDelete={onDelete}
|
|
69
|
+
renderBadges={renderBadges}
|
|
70
|
+
renderActions={renderActions}
|
|
71
|
+
replyPlaceholder={replyPlaceholder}
|
|
72
|
+
pending={pending}
|
|
73
|
+
leadWith={leadWith}
|
|
74
|
+
onViewProduct={onViewProduct}
|
|
75
|
+
/>
|
|
76
|
+
))}
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function CommentThreadRow({
|
|
82
|
+
comment,
|
|
83
|
+
onReply,
|
|
84
|
+
onDelete,
|
|
85
|
+
renderBadges,
|
|
86
|
+
renderActions,
|
|
87
|
+
replyPlaceholder,
|
|
88
|
+
pending,
|
|
89
|
+
leadWith,
|
|
90
|
+
onViewProduct,
|
|
91
|
+
}: Omit<CommentThreadProps, 'comments' | 'emptyLabel'> & { comment: ThreadComment }) {
|
|
92
|
+
const [replyOpen, setReplyOpen] = useState(false);
|
|
93
|
+
const replies = comment.replies ?? [];
|
|
94
|
+
const actions = renderActions?.(comment);
|
|
95
|
+
const footer: ReactNode = (
|
|
96
|
+
<>
|
|
97
|
+
{renderBadges?.(comment)}
|
|
98
|
+
{replies.length > 0 ? (
|
|
99
|
+
<span className="text-ods-text-secondary text-h6">
|
|
100
|
+
{replies.length} {replies.length === 1 ? 'reply' : 'replies'}
|
|
101
|
+
</span>
|
|
102
|
+
) : null}
|
|
103
|
+
{onReply || actions ? (
|
|
104
|
+
<span className="ml-auto flex flex-wrap gap-[var(--spacing-system-xsf)]">
|
|
105
|
+
{onReply ? (
|
|
106
|
+
<Button
|
|
107
|
+
type="button"
|
|
108
|
+
variant="outline"
|
|
109
|
+
size="small-legacy"
|
|
110
|
+
onClick={() => setReplyOpen(open => !open)}
|
|
111
|
+
disabled={pending}
|
|
112
|
+
>
|
|
113
|
+
Reply
|
|
114
|
+
</Button>
|
|
115
|
+
) : null}
|
|
116
|
+
{actions}
|
|
117
|
+
</span>
|
|
118
|
+
) : null}
|
|
119
|
+
</>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<CommentCard
|
|
124
|
+
fullBody
|
|
125
|
+
comment={comment}
|
|
126
|
+
leadWith={leadWith}
|
|
127
|
+
onViewProduct={onViewProduct}
|
|
128
|
+
onDeleteComment={onDelete ? id => void onDelete(id) : undefined}
|
|
129
|
+
footer={footer}
|
|
130
|
+
>
|
|
131
|
+
{replies.length > 0 || replyOpen ? (
|
|
132
|
+
<div className="ml-[var(--spacing-system-lf)] mt-[var(--spacing-system-xsf)] flex flex-col gap-[var(--spacing-system-xsf)] border-l border-ods-border pl-[var(--spacing-system-sf)]">
|
|
133
|
+
{replies.map(reply => (
|
|
134
|
+
<CommentCard
|
|
135
|
+
key={reply.id}
|
|
136
|
+
fullBody
|
|
137
|
+
compact
|
|
138
|
+
comment={reply}
|
|
139
|
+
onDeleteComment={onDelete ? id => void onDelete(id) : undefined}
|
|
140
|
+
/>
|
|
141
|
+
))}
|
|
142
|
+
{replyOpen && onReply ? (
|
|
143
|
+
<CommentComposer
|
|
144
|
+
pending={pending}
|
|
145
|
+
onCancel={() => setReplyOpen(false)}
|
|
146
|
+
submitLabel="Reply"
|
|
147
|
+
ariaLabel="Reply"
|
|
148
|
+
placeholder={replyPlaceholder}
|
|
149
|
+
onSubmit={async ({ body }) => {
|
|
150
|
+
const ok = await onReply(comment.id, body);
|
|
151
|
+
if (ok === false) return false;
|
|
152
|
+
setReplyOpen(false);
|
|
153
|
+
return true;
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
) : null}
|
|
157
|
+
</div>
|
|
158
|
+
) : null}
|
|
159
|
+
</CommentCard>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface CommentsBlockProps {
|
|
164
|
+
/** Header label, e.g. "Comments". */
|
|
165
|
+
title: string;
|
|
166
|
+
/** Readable while collapsed: "2 open · 1 closed", "3 comments". */
|
|
167
|
+
summary: string;
|
|
168
|
+
/** Start expanded. A later flip to `true` (new activity) expands it again. */
|
|
169
|
+
defaultOpen?: boolean;
|
|
170
|
+
/** The list (usually a `CommentThread`) plus anything under it. */
|
|
171
|
+
children: ReactNode;
|
|
172
|
+
/** The root composer, rendered last while expanded. */
|
|
173
|
+
composer?: ReactNode;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* THE collapsible comments section: a chevron header carrying the thread's
|
|
178
|
+
* summary, then the thread and the root composer. Collapsing is for threads
|
|
179
|
+
* with nothing left to act on; a host passes `defaultOpen` whenever there is
|
|
180
|
+
* (content behind an accordion is content readers miss).
|
|
181
|
+
*/
|
|
182
|
+
export function CommentsBlock({ title, summary, defaultOpen = false, children, composer }: CommentsBlockProps) {
|
|
183
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
184
|
+
// New activity AFTER mount (a colleague's comment arrives) flips `defaultOpen`
|
|
185
|
+
// to true and must expand the block; collapsing again stays the reader's call.
|
|
186
|
+
// Adjusted during render, React's pattern for state that follows a prop.
|
|
187
|
+
const [seenDefaultOpen, setSeenDefaultOpen] = useState(defaultOpen);
|
|
188
|
+
if (defaultOpen !== seenDefaultOpen) {
|
|
189
|
+
setSeenDefaultOpen(defaultOpen);
|
|
190
|
+
if (defaultOpen) setOpen(true);
|
|
191
|
+
}
|
|
192
|
+
return (
|
|
193
|
+
<div className="space-y-[var(--spacing-system-sf)]">
|
|
194
|
+
<Button
|
|
195
|
+
type="button"
|
|
196
|
+
variant="transparent"
|
|
197
|
+
size="small-legacy"
|
|
198
|
+
className="px-0 text-ods-text-secondary hover:text-ods-text-primary"
|
|
199
|
+
onClick={() => setOpen(value => !value)}
|
|
200
|
+
rightIcon={<ChevronDown className={`h-4 w-4 transition-transform ${open ? 'rotate-180' : ''}`} />}
|
|
201
|
+
>
|
|
202
|
+
{`${title} · ${summary}`}
|
|
203
|
+
</Button>
|
|
204
|
+
{open ? (
|
|
205
|
+
<>
|
|
206
|
+
{children}
|
|
207
|
+
{composer}
|
|
208
|
+
</>
|
|
209
|
+
) : null}
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './categories-cart';
|
|
|
17
17
|
export * from './category-card';
|
|
18
18
|
export * from './comment-card';
|
|
19
19
|
export * from './comment-composer';
|
|
20
|
+
export * from './comment-thread';
|
|
20
21
|
export * from './content-loading-container';
|
|
21
22
|
export * from './dynamic-skeleton';
|
|
22
23
|
export * from './empty-state';
|
|
@@ -222,7 +222,7 @@ export function SchedulerContextPanel({
|
|
|
222
222
|
)}
|
|
223
223
|
{hosts.length > 3 && (
|
|
224
224
|
<div className="flex flex-col gap-[var(--spacing-system-xs)]">
|
|
225
|
-
<AvatarStack people={hosts} max={4} size="lg" />
|
|
225
|
+
<AvatarStack people={hosts} max={4} size="lg" label="Hosts" />
|
|
226
226
|
<p className="text-ods-text-secondary text-h6">{hosts.length} hosts on this calendar</p>
|
|
227
227
|
</div>
|
|
228
228
|
)}
|
|
@@ -114,7 +114,7 @@ function DirectoryRow({
|
|
|
114
114
|
{/* Hosts stay visible on mobile too — the facepile is the row's "who
|
|
115
115
|
you're booking with" signal; only the chip and next-available meta
|
|
116
116
|
collapse on narrow widths. */}
|
|
117
|
-
<AvatarStack people={link.hosts} max={3} size="md" className="flex shrink-0" />
|
|
117
|
+
<AvatarStack people={link.hosts} max={3} size="md" label="Hosts" className="flex shrink-0" />
|
|
118
118
|
|
|
119
119
|
<div className="hidden w-44 shrink-0 flex-col items-end justify-center md:flex">
|
|
120
120
|
<p className="text-ods-text-secondary text-h6">Next available</p>
|
|
@@ -63,6 +63,13 @@ const ROWS: Record<string, unknown> = {
|
|
|
63
63
|
onboarding_guide: { id: 'g1', title: 'Guide Title', section: 'Start', step_order: 1, content: 'c' },
|
|
64
64
|
what_i_shipped: { title: 'Shipped Title', summary: 's', entry_month: '2026-01-01' },
|
|
65
65
|
how_i_work: { title: 'How Title', summary: 's', session_date: '2026-01-01' },
|
|
66
|
+
ai_prompt: {
|
|
67
|
+
title: 'Prompt Title',
|
|
68
|
+
summary: 's',
|
|
69
|
+
published_at: '2026-01-01',
|
|
70
|
+
department: { name: 'Sales' },
|
|
71
|
+
step_count: 2,
|
|
72
|
+
},
|
|
66
73
|
roadmap_item: { id: 'r1', title: 'Roadmap Title', description: 'd', status: 'open', quarter: 'Q1' },
|
|
67
74
|
};
|
|
68
75
|
|
|
@@ -48,6 +48,7 @@ import type { CustomerInterview } from '../../types/customer-interview';
|
|
|
48
48
|
import type { EntityAuthor } from '../../types/entity-author';
|
|
49
49
|
import type { MSP } from '../../types/stack';
|
|
50
50
|
import type { UserProfile } from '../../types/user';
|
|
51
|
+
import { AiPromptCard, AiPromptCardSkeleton, type AiPromptCardData } from '../chat/entity-cards/ai-prompt-card';
|
|
51
52
|
// DEEP card imports — NOT the `../chat` barrel. See the import note in
|
|
52
53
|
// `related-content-section.tsx`: the barrel statically reaches
|
|
53
54
|
// @tanstack/react-query, deep paths keep this module's source graph free of it.
|
|
@@ -511,8 +512,10 @@ function decodeProgramRow(row: unknown): BaseProgramItem & Record<string, unknow
|
|
|
511
512
|
/** The two employee-entry cards already declare MINIMAL row shapes
|
|
512
513
|
* (`EmployeeEntryCardData` + one date column each), so their decoders read
|
|
513
514
|
* exactly the card's fields with nothing left over. */
|
|
514
|
-
function decodeEmployeeEntryRow(row: unknown): WhatIShippedCardData & HowIWorkCardData {
|
|
515
|
+
function decodeEmployeeEntryRow(row: unknown): WhatIShippedCardData & HowIWorkCardData & AiPromptCardData {
|
|
515
516
|
const record = asRecord(row);
|
|
517
|
+
const department = asRecord(record.department);
|
|
518
|
+
const stepCount = record.step_count;
|
|
516
519
|
return {
|
|
517
520
|
title: strOrNull(record, 'title'),
|
|
518
521
|
summary: strOrNull(record, 'summary'),
|
|
@@ -523,6 +526,9 @@ function decodeEmployeeEntryRow(row: unknown): WhatIShippedCardData & HowIWorkCa
|
|
|
523
526
|
entry_month: strOrNull(record, 'entry_month'),
|
|
524
527
|
session_date: strOrNull(record, 'session_date'),
|
|
525
528
|
discipline: strOrNull(record, 'discipline'),
|
|
529
|
+
published_at: strOrNull(record, 'published_at'),
|
|
530
|
+
department: record.department ? { name: strOrNull(department, 'name') } : null,
|
|
531
|
+
step_count: typeof stepCount === 'number' ? stepCount : null,
|
|
526
532
|
};
|
|
527
533
|
}
|
|
528
534
|
|
|
@@ -770,6 +776,19 @@ export const RELATED_CARD_REGISTRY: Record<string, RelatedCardRegistryEntry> = {
|
|
|
770
776
|
),
|
|
771
777
|
}),
|
|
772
778
|
|
|
779
|
+
/** Same shared employee-entry shape + anchor contract as What I Shipped. */
|
|
780
|
+
ai_prompt: cardEntry({
|
|
781
|
+
skeleton: () => <AiPromptCardSkeleton />,
|
|
782
|
+
decode: decodeEmployeeEntryRow,
|
|
783
|
+
render: (entry, ctx) => (
|
|
784
|
+
<AiPromptCard
|
|
785
|
+
entry={entry}
|
|
786
|
+
placeholderUrl={ctx.placeholderUrl}
|
|
787
|
+
anchorProps={ctx.linkProps ?? (ctx.href ? { href: ctx.href, ...ctx.anchorAttrs } : undefined)}
|
|
788
|
+
/>
|
|
789
|
+
),
|
|
790
|
+
}),
|
|
791
|
+
|
|
773
792
|
roadmap_item: roadmapEntry('roadmap_item'),
|
|
774
793
|
delivery_item: roadmapEntry('delivery_item'),
|
|
775
794
|
internal_task: roadmapEntry('internal_task'),
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { personFirstName } from '../../../utils/format';
|
|
5
|
+
import { AvatarStack } from '../avatar-stack';
|
|
6
|
+
import { PeopleCell, PersonCell } from '../people-cell';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The people-column contract, pinned at the primitive:
|
|
10
|
+
*
|
|
11
|
+
* · one person reads as ONE layout wherever it appears (name + second line),
|
|
12
|
+
* so a single implementation owner and a DRI look identical;
|
|
13
|
+
* · several people become first names beside a FIXED-width stack, so every
|
|
14
|
+
* multi-person row's names start at the same x;
|
|
15
|
+
* · the "+N" count, and the group's accessible name, say what they mean.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const person = (name: string, key: string | number = name) => ({
|
|
19
|
+
key,
|
|
20
|
+
name,
|
|
21
|
+
avatarUrl: null,
|
|
22
|
+
secondary: `${name} title`,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('personFirstName', () => {
|
|
26
|
+
it('takes the first word, ignoring surrounding whitespace', () => {
|
|
27
|
+
expect(personFirstName(' Ada Lovelace ')).toBe('Ada');
|
|
28
|
+
});
|
|
29
|
+
it('falls back on an empty or missing name', () => {
|
|
30
|
+
expect(personFirstName(' ')).toBeNull();
|
|
31
|
+
expect(personFirstName(null, 'friend')).toBe('friend');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('PersonCell', () => {
|
|
36
|
+
it('renders the name and the second line', () => {
|
|
37
|
+
render(<PersonCell name="Ada Lovelace" secondary="Engineer" />);
|
|
38
|
+
expect(screen.getByText('Ada Lovelace')).toBeTruthy();
|
|
39
|
+
expect(screen.getByText('Engineer')).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
it('marks an expected-but-missing second line, and names the empty state', () => {
|
|
42
|
+
render(<PersonCell secondary={null} />);
|
|
43
|
+
expect(screen.getByText('Unassigned')).toBeTruthy();
|
|
44
|
+
expect(screen.getByText('·')).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
it('becomes a button when clickable', () => {
|
|
47
|
+
render(<PersonCell name="Ada" onClick={() => {}} actionTitle="Filter by Ada" />);
|
|
48
|
+
expect(screen.getByRole('button', { name: /Ada/ }).getAttribute('title')).toBe('Filter by Ada');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('PeopleCell', () => {
|
|
53
|
+
it('renders one person exactly as PersonCell does', () => {
|
|
54
|
+
const { container: single } = render(<PeopleCell people={[person('Ada Lovelace')]} />);
|
|
55
|
+
const { container: direct } = render(<PersonCell name="Ada Lovelace" secondary="Ada Lovelace title" />);
|
|
56
|
+
expect(single.innerHTML).toBe(direct.innerHTML);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('joins first names with & and keeps the full names for assistive tech', () => {
|
|
60
|
+
render(<PeopleCell people={[person('Dmytro K'), person('Michael A'), person('Ilona K')]} />);
|
|
61
|
+
expect(screen.getByText('Dmytro & Michael & Ilona')).toBeTruthy();
|
|
62
|
+
expect(screen.getByText('Dmytro K, Michael A, Ilona K')).toBeTruthy();
|
|
63
|
+
expect(screen.queryByText('Dmytro K title')).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('reserves the same stack width for two people and for five', () => {
|
|
67
|
+
const width = (count: number) => {
|
|
68
|
+
const { unmount } = render(<PeopleCell people={Array.from({ length: count }, (_, i) => person(`P${i} X`, i))} />);
|
|
69
|
+
// `hidden`: the stack is decorative (aria-hidden) beside the names.
|
|
70
|
+
const value = screen.getByRole('group', { hidden: true }).style.width;
|
|
71
|
+
unmount();
|
|
72
|
+
return value;
|
|
73
|
+
};
|
|
74
|
+
expect(width(2)).toBe('52px');
|
|
75
|
+
expect(width(5)).toBe('52px');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('AvatarStack', () => {
|
|
80
|
+
it('in slots mode shows slots-1 faces and a count for the rest', () => {
|
|
81
|
+
render(<AvatarStack size="sm" slots={2} people={[person('A'), person('B'), person('C')]} />);
|
|
82
|
+
expect(screen.getByText('+2')).toBeTruthy();
|
|
83
|
+
expect(screen.getAllByTitle(/^[ABC]$/)).toHaveLength(1);
|
|
84
|
+
});
|
|
85
|
+
it('fills every slot with a face when the people fit', () => {
|
|
86
|
+
render(<AvatarStack size="sm" slots={2} people={[person('A'), person('B')]} />);
|
|
87
|
+
expect(screen.queryByText(/^\+/)).toBeNull();
|
|
88
|
+
});
|
|
89
|
+
it('names the group after what the people are', () => {
|
|
90
|
+
render(<AvatarStack label="Hosts" people={[person('Ada'), person('Lin')]} />);
|
|
91
|
+
expect(screen.getByRole('group', { name: 'Hosts: Ada, Lin' })).toBeTruthy();
|
|
92
|
+
});
|
|
93
|
+
it('defaults the group name to Assignees', () => {
|
|
94
|
+
render(<AvatarStack people={[person('Ada')]} />);
|
|
95
|
+
expect(screen.getByRole('group', { name: 'Assignees: Ada' })).toBeTruthy();
|
|
96
|
+
});
|
|
97
|
+
});
|