@estiva-app/ui 0.98.1 → 0.100.0
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/README.md +4 -2
- package/dist/AppProvider.d.ts +6 -3
- package/dist/AppProvider.d.ts.map +1 -1
- package/dist/ArchiveDialog.d.ts +35 -0
- package/dist/ArchiveDialog.d.ts.map +1 -0
- package/dist/AttachedCard.d.ts +13 -2
- package/dist/AttachedCard.d.ts.map +1 -1
- package/dist/Card.d.ts +6 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/ChipInput.d.ts +3 -1
- package/dist/ChipInput.d.ts.map +1 -1
- package/dist/CollapsibleSection.d.ts +27 -2
- package/dist/CollapsibleSection.d.ts.map +1 -1
- package/dist/CommentBox.d.ts +2 -2
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/ConfirmDialog.d.ts +15 -2
- package/dist/ConfirmDialog.d.ts.map +1 -1
- package/dist/ConversationCard.d.ts +12 -1
- package/dist/ConversationCard.d.ts.map +1 -1
- package/dist/ConversationLayout.d.ts +20 -5
- package/dist/ConversationLayout.d.ts.map +1 -1
- package/dist/ConversationMenu.d.ts +5 -1
- package/dist/ConversationMenu.d.ts.map +1 -1
- package/dist/ConversationPlace.d.ts +17 -0
- package/dist/ConversationPlace.d.ts.map +1 -0
- package/dist/DocumentEditor.d.ts +38 -0
- package/dist/DocumentEditor.d.ts.map +1 -1
- package/dist/DocumentField.d.ts +50 -0
- package/dist/DocumentField.d.ts.map +1 -0
- package/dist/EditableText.d.ts +38 -4
- package/dist/EditableText.d.ts.map +1 -1
- package/dist/EmptyState.d.ts +10 -5
- package/dist/EmptyState.d.ts.map +1 -1
- package/dist/FormDialog.d.ts +38 -0
- package/dist/FormDialog.d.ts.map +1 -0
- package/dist/InlineText.d.ts.map +1 -1
- package/dist/Menu.d.ts +11 -3
- package/dist/Menu.d.ts.map +1 -1
- package/dist/MoveDialog.d.ts +64 -0
- package/dist/MoveDialog.d.ts.map +1 -0
- package/dist/NavItem.d.ts +9 -2
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/NavTree.d.ts +16 -3
- package/dist/NavTree.d.ts.map +1 -1
- package/dist/PinnedComment.d.ts +3 -1
- package/dist/PinnedComment.d.ts.map +1 -1
- package/dist/ReactionHorizon.d.ts +3 -1
- package/dist/ReactionHorizon.d.ts.map +1 -1
- package/dist/RepliesRow.d.ts +5 -3
- package/dist/RepliesRow.d.ts.map +1 -1
- package/dist/ResolveDialog.d.ts +3 -1
- package/dist/ResolveDialog.d.ts.map +1 -1
- package/dist/SelectionToolbar.d.ts +2 -2
- package/dist/Thread.d.ts +6 -3
- package/dist/Thread.d.ts.map +1 -1
- package/dist/commentBoxFrame.d.ts.map +1 -1
- package/dist/conversation.examples.d.ts +4 -1
- package/dist/conversation.examples.d.ts.map +1 -1
- package/dist/conversationScroll.d.ts +80 -0
- package/dist/conversationScroll.d.ts.map +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +228 -69
- package/dist/editor.js.map +4 -4
- package/dist/eslint/index.js +2 -2
- package/dist/eslint/index.js.map +2 -2
- package/dist/eslint/no-field-outside-a-form.d.ts +2 -2
- package/dist/eslint/no-field-outside-a-form.d.ts.map +1 -1
- package/dist/eslint/no-native-title.d.ts +1 -1
- package/dist/eslint/no-native-title.d.ts.map +1 -1
- package/dist/formBusy.d.ts +5 -2
- package/dist/formBusy.d.ts.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2242 -1471
- package/dist/index.js.map +4 -4
- package/dist/looks.d.ts +8 -0
- package/dist/looks.d.ts.map +1 -1
- package/dist/seenOnScreen.d.ts +27 -0
- package/dist/seenOnScreen.d.ts.map +1 -0
- package/dist/showInConversation.d.ts +31 -0
- package/dist/showInConversation.d.ts.map +1 -0
- package/dist/threadCard.d.ts +13 -0
- package/dist/threadCard.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +953 -126
- package/src/AppProvider.mdx +4 -0
- package/src/AppProvider.test.tsx +34 -2
- package/src/AppProvider.tsx +17 -6
- package/src/ArchiveDialog.mdx +70 -0
- package/src/ArchiveDialog.stories.tsx +64 -0
- package/src/ArchiveDialog.test.tsx +90 -0
- package/src/ArchiveDialog.tsx +70 -0
- package/src/AttachedCard.mdx +6 -0
- package/src/AttachedCard.stories.tsx +9 -1
- package/src/AttachedCard.test.tsx +111 -2
- package/src/AttachedCard.tsx +77 -7
- package/src/Card.mdx +20 -1
- package/src/Card.stories.tsx +20 -0
- package/src/Card.test.tsx +87 -1
- package/src/Card.tsx +51 -3
- package/src/ChipInput.mdx +7 -1
- package/src/ChipInput.stories.tsx +9 -0
- package/src/ChipInput.test.tsx +42 -0
- package/src/ChipInput.tsx +7 -3
- package/src/CollapsibleSection.mdx +20 -1
- package/src/CollapsibleSection.stories.tsx +19 -1
- package/src/CollapsibleSection.test.tsx +85 -2
- package/src/CollapsibleSection.tsx +54 -15
- package/src/CommentBox.mdx +2 -1
- package/src/CommentBox.test.tsx +81 -1
- package/src/CommentBox.tsx +32 -11
- package/src/ConfirmDialog.mdx +25 -3
- package/src/ConfirmDialog.stories.tsx +27 -0
- package/src/ConfirmDialog.test.tsx +87 -1
- package/src/ConfirmDialog.tsx +39 -8
- package/src/ConversationCard.mdx +7 -0
- package/src/ConversationCard.states.test.tsx +67 -0
- package/src/ConversationCard.stories.tsx +27 -1
- package/src/ConversationCard.test.tsx +76 -0
- package/src/ConversationCard.tsx +65 -53
- package/src/ConversationLayout.mdx +34 -4
- package/src/ConversationLayout.scroll.test.tsx +411 -0
- package/src/ConversationLayout.stories.tsx +107 -1
- package/src/ConversationLayout.test.tsx +133 -0
- package/src/ConversationLayout.tsx +141 -16
- package/src/ConversationMenu.mdx +3 -0
- package/src/ConversationMenu.stories.tsx +12 -0
- package/src/ConversationMenu.test.tsx +17 -0
- package/src/ConversationMenu.tsx +7 -3
- package/src/ConversationPlace.mdx +53 -0
- package/src/ConversationPlace.stories.tsx +48 -0
- package/src/ConversationPlace.test.tsx +51 -0
- package/src/ConversationPlace.tsx +30 -0
- package/src/DocumentEditor.mdx +2 -1
- package/src/DocumentEditor.tsx +118 -64
- package/src/DocumentField.mdx +83 -0
- package/src/DocumentField.stories.tsx +110 -0
- package/src/DocumentField.test.tsx +281 -0
- package/src/DocumentField.tsx +199 -0
- package/src/EditableText.buttons.test.tsx +318 -0
- package/src/EditableText.mdx +50 -2
- package/src/EditableText.stories.tsx +96 -2
- package/src/EditableText.tsx +189 -5
- package/src/EmptyState.mdx +33 -8
- package/src/EmptyState.stories.tsx +26 -1
- package/src/EmptyState.test.tsx +63 -2
- package/src/EmptyState.tsx +28 -6
- package/src/Form.mdx +3 -1
- package/src/FormDialog.mdx +78 -0
- package/src/FormDialog.stories.tsx +90 -0
- package/src/FormDialog.test.tsx +183 -0
- package/src/FormDialog.tsx +93 -0
- package/src/InlineText.mdx +1 -0
- package/src/InlineText.tsx +2 -1
- package/src/Menu.test.tsx +80 -0
- package/src/Menu.tsx +35 -14
- package/src/MenuItem.mdx +12 -0
- package/src/MenuItem.stories.tsx +39 -1
- package/src/MoveDialog.mdx +85 -0
- package/src/MoveDialog.stories.tsx +134 -0
- package/src/MoveDialog.test.tsx +239 -0
- package/src/MoveDialog.tsx +186 -0
- package/src/NavItem.mdx +15 -0
- package/src/NavItem.stories.tsx +15 -0
- package/src/NavItem.test.tsx +64 -1
- package/src/NavItem.tsx +10 -2
- package/src/NavTree.mdx +26 -4
- package/src/NavTree.stories.tsx +59 -0
- package/src/NavTree.test.tsx +232 -2
- package/src/NavTree.tsx +93 -43
- package/src/PinnedComment.mdx +6 -1
- package/src/PinnedComment.stories.tsx +11 -1
- package/src/PinnedComment.tsx +15 -2
- package/src/ReactionHorizon.mdx +2 -0
- package/src/ReactionHorizon.stories.tsx +3 -0
- package/src/ReactionHorizon.test.tsx +32 -0
- package/src/ReactionHorizon.tsx +28 -11
- package/src/RepliesRow.mdx +6 -3
- package/src/RepliesRow.stories.tsx +3 -0
- package/src/RepliesRow.test.tsx +24 -0
- package/src/RepliesRow.tsx +12 -6
- package/src/ReplyCard.mdx +8 -0
- package/src/ReplyCard.stories.tsx +45 -1
- package/src/ResolveDialog.mdx +2 -0
- package/src/ResolveDialog.test.tsx +21 -0
- package/src/ResolveDialog.tsx +11 -39
- package/src/SelectionToolbar.tsx +2 -2
- package/src/Textarea.mdx +1 -0
- package/src/Thread.mdx +20 -1
- package/src/Thread.stories.tsx +94 -3
- package/src/Thread.test.tsx +11 -0
- package/src/Thread.tsx +56 -12
- package/src/commentBoxFrame.tsx +2 -2
- package/src/conversation.examples.tsx +10 -2
- package/src/conversationScroll.ts +155 -0
- package/src/editor.ts +1 -0
- package/src/editorSelection.test.tsx +53 -0
- package/src/eslint/no-field-outside-a-form.test.ts +4 -0
- package/src/eslint/no-field-outside-a-form.ts +2 -2
- package/src/eslint/no-native-title.ts +1 -1
- package/src/formBusy.ts +5 -2
- package/src/index.ts +16 -6
- package/src/looks.ts +10 -0
- package/src/registry/registry.test.ts +12 -6
- package/src/seenOnScreen.test.tsx +241 -0
- package/src/seenOnScreen.ts +146 -0
- package/src/showInConversation.test.tsx +168 -0
- package/src/showInConversation.ts +93 -0
- package/src/threadCard.ts +16 -0
- package/stories/Choosing.mdx +8 -3
- package/tailwind-preset.js +7 -0
package/src/ReactionHorizon.tsx
CHANGED
|
@@ -7,23 +7,40 @@ export interface ReactionHorizonProps {
|
|
|
7
7
|
cut?: boolean
|
|
8
8
|
/** What the app calls what is said, in the plural: "messages" in Peek. Default "comments". */
|
|
9
9
|
noun?: string
|
|
10
|
+
/** Older comments are still being read and the whole read will need the line: its room is kept, unseen, so nothing moves when it lands. */
|
|
11
|
+
keepRoom?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The words of the line, for `omitted` older ones. */
|
|
15
|
+
function Said({ limit, omitted, noun }: { limit: number; omitted: number; noun: string }) {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
Reactions are shown for the latest {limit} {noun} and replies here. {omitted} older {omitted === 1 ? 'one was' : 'ones were'} not checked.
|
|
19
|
+
</>
|
|
20
|
+
)
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
/**
|
|
13
24
|
* The line that says reactions are read only so far back, and how many older comments were not checked. Nothing is
|
|
14
25
|
* drawn when every one was. Peek's, moved with the conversation.
|
|
15
26
|
*/
|
|
16
|
-
export function ReactionHorizon({ limit, omitted, cut = false, noun = 'comments' }: ReactionHorizonProps) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Reactions are shown for the latest {limit} {noun} and replies here. {omitted} older {omitted === 1 ? 'one was' : 'ones were'} not checked.
|
|
23
|
-
</>
|
|
24
|
-
)}
|
|
25
|
-
{omitted > 0 && cut && ' '}
|
|
26
|
-
{cut && 'Some reactions may be missing.'}
|
|
27
|
+
export function ReactionHorizon({ limit, omitted, cut = false, noun = 'comments', keepRoom = false }: ReactionHorizonProps) {
|
|
28
|
+
// While the rest is read, the room of the line it will be, with one older one, unseen: as Peek kept it (PEE-7), so
|
|
29
|
+
// the newest comments do not move up under a reader at the bottom when the rest lands.
|
|
30
|
+
const room = keepRoom && omitted <= 0 && (
|
|
31
|
+
<p aria-hidden className="invisible text-caption text-text-muted">
|
|
32
|
+
<Said limit={limit} omitted={1} noun={noun} />
|
|
27
33
|
</p>
|
|
28
34
|
)
|
|
35
|
+
if (omitted <= 0 && !cut) return room || null
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<p className="text-caption text-text-muted">
|
|
39
|
+
{omitted > 0 && <Said limit={limit} omitted={omitted} noun={noun} />}
|
|
40
|
+
{omitted > 0 && cut && ' '}
|
|
41
|
+
{cut && 'Some reactions may be missing.'}
|
|
42
|
+
</p>
|
|
43
|
+
{room}
|
|
44
|
+
</>
|
|
45
|
+
)
|
|
29
46
|
}
|
package/src/RepliesRow.mdx
CHANGED
|
@@ -5,7 +5,7 @@ import * as Stories from './RepliesRow.stories'
|
|
|
5
5
|
|
|
6
6
|
# RepliesRow
|
|
7
7
|
|
|
8
|
-
The way into a thread, under its comment: who replied, "2 replies", the last reply's time, and "
|
|
8
|
+
The way into a thread, under its comment: who replied, "2 replies", the last reply's time, and how many are new ("2 new") until they are read.
|
|
9
9
|
|
|
10
10
|
<Canvas of={Stories.Several} />
|
|
11
11
|
|
|
@@ -14,7 +14,10 @@ The way into a thread, under its comment: who replied, "2 replies", the last rep
|
|
|
14
14
|
- Under a comment with replies: **ConversationCard** draws it from its `replies`.
|
|
15
15
|
- `onOpen` where the row itself opens the thread (one column, the thread under its comment); without it, the card around it does.
|
|
16
16
|
- `open` while that thread is open under it: the chevron turns down and the row stays marked, and a press closes it. The whole card around it opens and closes the thread too.
|
|
17
|
+
- `newCount`, how many replies are new: "2 new", and the row's name says it too ("3 replies, 2 new, open the thread"). Given, it decides; 0 says nothing new.
|
|
18
|
+
- `isNew` alone, for an app that knows only that one is new: "1 new", and the row's name stays the count.
|
|
17
19
|
|
|
20
|
+
<Canvas of={Stories.NewSeveral} />
|
|
18
21
|
<Canvas of={Stories.New} />
|
|
19
22
|
<Canvas of={Stories.Open} />
|
|
20
23
|
|
|
@@ -28,7 +31,7 @@ The way into a thread, under its comment: who replied, "2 replies", the last rep
|
|
|
28
31
|
```tsx
|
|
29
32
|
import { RepliesRow } from '@estiva-app/ui'
|
|
30
33
|
|
|
31
|
-
<RepliesRow count={3} faces={faces} last="12:02 PM"
|
|
34
|
+
<RepliesRow count={3} faces={faces} last="12:02 PM" newCount={2} onOpen={() => openUnder(comment)} />
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
- Faces and the last time show in Signal; in the other themes the row is the icon and the count.
|
|
@@ -38,7 +41,7 @@ import { RepliesRow } from '@estiva-app/ui'
|
|
|
38
41
|
| It does | So you never write | Refused when written by hand |
|
|
39
42
|
|---|---|---|
|
|
40
43
|
| Says "1 reply" or "2 replies" | the plural | |
|
|
41
|
-
| Shows "
|
|
44
|
+
| Shows how many are new until they are read ("2 new"; "1 new" for `isNew`), in the warning colour when urgent | the chip and its colour | |
|
|
42
45
|
|
|
43
46
|
## Props
|
|
44
47
|
|
|
@@ -23,6 +23,9 @@ export const One: Story = { args: { count: 1, faces: [TWO] } }
|
|
|
23
23
|
/** A reply not read yet. */
|
|
24
24
|
export const New: Story = { args: { isNew: true } }
|
|
25
25
|
|
|
26
|
+
/** Several replies not read yet: how many, from `newCount`. */
|
|
27
|
+
export const NewSeveral: Story = { name: 'New, how many', args: { newCount: 2 } }
|
|
28
|
+
|
|
26
29
|
/** A reply not read yet, in an urgent thread. */
|
|
27
30
|
export const Urgent: Story = { args: { isNew: true, urgent: true } }
|
|
28
31
|
|
package/src/RepliesRow.test.tsx
CHANGED
|
@@ -45,3 +45,27 @@ describe('RepliesRow', () => {
|
|
|
45
45
|
expect(container.querySelectorAll('img, [data-avatar], [aria-label="Person two"]').length).toBeGreaterThan(0)
|
|
46
46
|
})
|
|
47
47
|
})
|
|
48
|
+
|
|
49
|
+
describe('RepliesRow, how many are new (newCount)', () => {
|
|
50
|
+
it('says how many replies are new, not "1 new" whatever the count (Ship: "3 replies, 2 new")', () => {
|
|
51
|
+
render(<RepliesRow count={3} newCount={2} />)
|
|
52
|
+
expect(screen.getByText('2 new')).toBeTruthy()
|
|
53
|
+
expect(screen.queryByText('1 new')).toBeNull()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('says nothing new when none is, whatever isNew says', () => {
|
|
57
|
+
render(<RepliesRow count={3} newCount={0} isNew />)
|
|
58
|
+
expect(screen.queryByText(/ new$/)).toBeNull()
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('says how many are new in the name a press reads, before what the press does', () => {
|
|
62
|
+
render(<RepliesRow count={3} newCount={2} onOpen={() => {}} />)
|
|
63
|
+
expect(screen.getByRole('button', { name: '3 replies, 2 new, open the thread' })).toBeTruthy()
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('with isNew alone, says "1 new" and keeps its name as it was (Peek passes no count)', () => {
|
|
67
|
+
render(<RepliesRow count={3} isNew onOpen={() => {}} />)
|
|
68
|
+
expect(screen.getByText('1 new')).toBeTruthy()
|
|
69
|
+
expect(screen.getByRole('button', { name: '3 replies, open the thread' })).toBeTruthy()
|
|
70
|
+
})
|
|
71
|
+
})
|
package/src/RepliesRow.tsx
CHANGED
|
@@ -13,6 +13,8 @@ export interface RepliesRowProps {
|
|
|
13
13
|
last?: string
|
|
14
14
|
/** "1 new": a reply you have not read. */
|
|
15
15
|
isNew?: boolean
|
|
16
|
+
/** How many replies you have not read: "2 new", and the row's name says it too. Given, it decides over `isNew`; 0 is none. */
|
|
17
|
+
newCount?: number
|
|
16
18
|
/** The "1 new" chip in the warning colour, for an urgent thread. */
|
|
17
19
|
urgent?: boolean
|
|
18
20
|
/** Opens the thread. Absent, the row only says how many (the card around it opens the thread). */
|
|
@@ -28,13 +30,17 @@ const BOX_CLASSES =
|
|
|
28
30
|
'group/replies flex shrink-0 items-center gap-2 rounded-lg border border-transparent px-2 py-1.5 transition-colors hover:border-accent-outline hover:bg-accent-wash'
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
* The way into a thread, under its comment: who replied, "2 replies", the last reply's time, and
|
|
32
|
-
* read. Peek's, moved with the conversation; in every app the row a thread opens from, the same in every theme
|
|
33
|
+
* The way into a thread, under its comment: who replied, "2 replies", the last reply's time, and how many are new
|
|
34
|
+
* ("2 new") until they are read. Peek's, moved with the conversation; in every app the row a thread opens from, the same in every theme
|
|
33
35
|
* (Katerina, 31 October), each in its own colours.
|
|
34
36
|
*/
|
|
35
|
-
export function RepliesRow({ count, faces, last, isNew = false, urgent = false, onOpen, open = false }: RepliesRowProps) {
|
|
37
|
+
export function RepliesRow({ count, faces, last, isNew = false, newCount, urgent = false, onOpen, open = false }: RepliesRowProps) {
|
|
36
38
|
const withFaces = !!faces && faces.length > 0
|
|
37
39
|
const label = `${count} ${count === 1 ? 'reply' : 'replies'}`
|
|
40
|
+
// How many are new: the app's count, or one for `isNew` (all an app without a count can say).
|
|
41
|
+
const fresh = newCount ?? (isNew ? 1 : 0)
|
|
42
|
+
// Its name says how many are new only with the app's count: with `isNew` alone it stays as it was.
|
|
43
|
+
const name = newCount ? `${label}, ${newCount} new` : label
|
|
38
44
|
const inner = (
|
|
39
45
|
<>
|
|
40
46
|
{withFaces && (
|
|
@@ -62,10 +68,10 @@ export function RepliesRow({ count, faces, last, isNew = false, urgent = false,
|
|
|
62
68
|
/>
|
|
63
69
|
</>
|
|
64
70
|
)
|
|
65
|
-
const chip =
|
|
71
|
+
const chip = fresh > 0 && (
|
|
66
72
|
<>
|
|
67
73
|
<span className="h-0.5 w-0.5 shrink-0 rounded-full bg-text-muted" />
|
|
68
|
-
<Chip type={urgent ? 'warning' : 'brand'} label=
|
|
74
|
+
<Chip type={urgent ? 'warning' : 'brand'} label={`${fresh} new`} />
|
|
69
75
|
</>
|
|
70
76
|
)
|
|
71
77
|
if (!onOpen) {
|
|
@@ -78,7 +84,7 @@ export function RepliesRow({ count, faces, last, isNew = false, urgent = false,
|
|
|
78
84
|
}
|
|
79
85
|
return (
|
|
80
86
|
// @estiva-escape(no-raw-element): the row is the thread's way in, Peek's replies row; no kit button takes a face stack, a count, a time and the new chip in one press
|
|
81
|
-
<button type="button" className={cn(ROW_CLASSES, 'cursor-pointer text-left')} onClick={onOpen} aria-expanded={open} aria-label={`${
|
|
87
|
+
<button type="button" className={cn(ROW_CLASSES, 'cursor-pointer text-left')} onClick={onOpen} aria-expanded={open} aria-label={`${name}, ${open ? 'close' : 'open'} the thread`} data-interactive>
|
|
82
88
|
<span className={cn(BOX_CLASSES, open && OPEN_CLASSES)}>{inner}</span>
|
|
83
89
|
{chip}
|
|
84
90
|
</button>
|
package/src/ReplyCard.mdx
CHANGED
|
@@ -13,10 +13,17 @@ One reply in a thread: the same pieces as a comment, without replies of its own
|
|
|
13
13
|
|
|
14
14
|
- **A reply**, inside a **Thread**, in time order.
|
|
15
15
|
- `timeHref`: its time is a link to it, "Link to this".
|
|
16
|
+
- `at`, its moment: the time says the exact date and time under the pointer; a time that is a link says it, then "Link to this".
|
|
16
17
|
- `own` on yours: Edit and Delete in its menu.
|
|
18
|
+
- `id` on every reply: on the card as `data-reply-id`, what a link to it shows (`showInConversation`) and what **Thread** watches to say it was seen.
|
|
19
|
+
- In the app's own words: `noun`, what the delete question calls it ("Delete this reply?" by default, "Delete this message?" with `message`, its button "Delete message"); `deleteLabel`, the Delete row's words; `moreLabel`, the ⋯ button's name and tooltip ("More actions" by default). With `menuLabel` and `editLabel`, as a comment takes them.
|
|
17
20
|
|
|
18
21
|
<Canvas of={Stories.Yours} />
|
|
19
22
|
|
|
23
|
+
<Canvas of={Stories.InAnAppsWords} />
|
|
24
|
+
|
|
25
|
+
<Canvas of={Stories.DeleteInAnAppsWords} />
|
|
26
|
+
|
|
20
27
|
<Canvas of={Stories.Linked} />
|
|
21
28
|
|
|
22
29
|
## When not
|
|
@@ -44,6 +51,7 @@ import { ReplyCard, Thread } from '@estiva-app/ui'
|
|
|
44
51
|
|---|---|---|
|
|
45
52
|
| Shows its actions while pointed at, and holds them while a menu is open | hover state and an outside-click check | |
|
|
46
53
|
| Asks before it deletes | a confirm dialog | |
|
|
54
|
+
| Says the exact date and time under the pointer, from `at` | a tooltip round the time | |
|
|
47
55
|
|
|
48
56
|
## Props
|
|
49
57
|
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
|
2
2
|
import { useState } from 'react'
|
|
3
3
|
import { userEvent, within } from 'storybook/test'
|
|
4
4
|
import { ReplyCard, type ReplyCardProps } from './ConversationCard'
|
|
5
|
-
import { Column, EditBox, Files, ONE, SHORT, SOME, WithCard, YOU, useReactions } from './conversation.examples'
|
|
5
|
+
import { AT, Column, EditBox, Files, ONE, SHORT, SOME, WithCard, YOU, useReactions } from './conversation.examples'
|
|
6
6
|
import type { ReactionCount } from './ReactionRow'
|
|
7
7
|
|
|
8
8
|
/** One reply, live: point at it to react, and on your own edit or delete it. */
|
|
@@ -64,5 +64,49 @@ export const Linked: Story = {
|
|
|
64
64
|
},
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/** With its moment, `at`: the time says the exact date and time under the pointer. The story points at it. */
|
|
68
|
+
export const ExactTime: Story = {
|
|
69
|
+
name: 'Exact time',
|
|
70
|
+
render: (args) => <Live {...args} at={AT + 32 * 60_000} />,
|
|
71
|
+
play: async ({ canvasElement }) => {
|
|
72
|
+
await userEvent.hover(within(canvasElement).getByText('11:40 AM'))
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Its time a link, with its moment: the exact time, then where the link goes. The story points at it. */
|
|
77
|
+
export const LinkedExactTime: Story = {
|
|
78
|
+
name: 'Time is a link, exact time',
|
|
79
|
+
render: (args) => <Live {...args} at={AT + 32 * 60_000} timeHref="#reply" />,
|
|
80
|
+
play: async ({ canvasElement }) => {
|
|
81
|
+
await userEvent.hover(within(canvasElement).getByRole('link', { name: '11:40 AM' }))
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Points at the reply and opens its ⋯ by the name it is given. */
|
|
86
|
+
async function openMenu(canvasElement: HTMLElement, name: string) {
|
|
87
|
+
await userEvent.hover(within(canvasElement).getByText(SHORT))
|
|
88
|
+
await userEvent.click(within(canvasElement).getByRole('button', { name }))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Yours, in an app's own words: the ⋯ named "Message actions", its Delete row "Delete message", and the question
|
|
93
|
+
* asking about a message. The story points at it and opens the menu.
|
|
94
|
+
*/
|
|
95
|
+
export const InAnAppsWords: Story = {
|
|
96
|
+
name: "In an app's words",
|
|
97
|
+
render: (args) => <Live {...args} author={YOU} own noun="message" deleteLabel="Delete message" moreLabel="Message actions" />,
|
|
98
|
+
play: async ({ canvasElement }) => openMenu(canvasElement, 'Message actions'),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The delete question in the app's noun: "Delete this message?", answered by "Delete message". The story asks it. */
|
|
102
|
+
export const DeleteInAnAppsWords: Story = {
|
|
103
|
+
name: "In an app's words, deleting",
|
|
104
|
+
render: (args) => <Live {...args} author={YOU} own noun="message" deleteLabel="Delete message" moreLabel="Message actions" />,
|
|
105
|
+
play: async ({ canvasElement }) => {
|
|
106
|
+
await openMenu(canvasElement, 'Message actions')
|
|
107
|
+
await userEvent.click(await within(canvasElement.ownerDocument.body).findByRole('menuitem', { name: 'Delete message' }))
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
|
|
67
111
|
/** Nothing can be changed: no strip, reactions only shown. */
|
|
68
112
|
export const ReadOnly: Story = { name: 'Read-only', render: (args) => <Live {...args} readOnly start={SOME} /> }
|
package/src/ResolveDialog.mdx
CHANGED
|
@@ -30,6 +30,8 @@ import { ResolveDialog } from '@estiva-app/ui'
|
|
|
30
30
|
|
|
31
31
|
- Ctrl+Enter resolves from the note; Enter there is a new line.
|
|
32
32
|
- Answer `false` from `onResolve` when it was refused, and pass why in `refused`.
|
|
33
|
+
Any other answer closes it, through `onCancel`.
|
|
34
|
+
- It is a **FormDialog**: while it resolves, the note and both buttons wait.
|
|
33
35
|
|
|
34
36
|
## What it owns
|
|
35
37
|
|
|
@@ -46,6 +46,27 @@ describe('ResolveDialog', () => {
|
|
|
46
46
|
expect(onResolve).not.toHaveBeenCalled()
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
+
it('Cancel waits while it resolves, as in every form dialog', async () => {
|
|
50
|
+
const user = userEvent.setup()
|
|
51
|
+
render(<ResolveDialog onResolve={() => new Promise<void>(() => {})} onCancel={() => {}} />)
|
|
52
|
+
await user.click(screen.getByRole('button', { name: 'Resolve' }))
|
|
53
|
+
expect((screen.getByRole('button', { name: 'Cancel' }) as HTMLButtonElement).disabled).toBe(true)
|
|
54
|
+
expect((screen.getByRole('button', { name: 'Resolve' }) as HTMLButtonElement).disabled).toBe(true)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('closes itself once a resolve is not refused, and stays when it is', async () => {
|
|
58
|
+
const user = userEvent.setup()
|
|
59
|
+
const onCancel = vi.fn()
|
|
60
|
+
const { unmount } = render(<ResolveDialog onResolve={async () => false} onCancel={onCancel} />)
|
|
61
|
+
await user.click(screen.getByRole('button', { name: 'Resolve' }))
|
|
62
|
+
await vi.waitFor(() => expect((screen.getByRole('button', { name: 'Resolve' }) as HTMLButtonElement).disabled).toBe(false))
|
|
63
|
+
expect(onCancel).not.toHaveBeenCalled()
|
|
64
|
+
unmount()
|
|
65
|
+
render(<ResolveDialog onResolve={async () => true} onCancel={onCancel} />)
|
|
66
|
+
await user.click(screen.getByRole('button', { name: 'Resolve' }))
|
|
67
|
+
await vi.waitFor(() => expect(onCancel).toHaveBeenCalledOnce())
|
|
68
|
+
})
|
|
69
|
+
|
|
49
70
|
it('says why the last resolve was refused, under the note', () => {
|
|
50
71
|
render(<ResolveDialog onResolve={() => false} onCancel={() => {}} refused="The file is archived" />)
|
|
51
72
|
expect(screen.getByText(/The file is archived/)).toBeTruthy()
|
package/src/ResolveDialog.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Button } from './Button'
|
|
3
|
-
import { DialogShell } from './DialogShell'
|
|
1
|
+
import { useState } from 'react'
|
|
4
2
|
import { Field } from './Field'
|
|
5
|
-
import {
|
|
3
|
+
import { FormDialog } from './FormDialog'
|
|
6
4
|
import { Textarea } from './Textarea'
|
|
7
5
|
|
|
8
6
|
export interface ResolveDialogProps {
|
|
9
7
|
/** Resolve, with what was written (an empty string for none). Answer `false` when it was refused: the dialog stays, with `refused` under the field. */
|
|
10
8
|
onResolve: (note: string) => Promise<boolean | void> | boolean | void
|
|
9
|
+
/** Cancel, Escape, the ✕ — and a resolve that was not refused, which closes it. */
|
|
11
10
|
onCancel: () => void
|
|
12
11
|
/** Why the last resolve was refused, in plain words. */
|
|
13
12
|
refused?: string
|
|
@@ -15,44 +14,17 @@ export interface ResolveDialogProps {
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Resolve, with an optional note: the same dialog in every app (Katerina, 31 October). Ctrl+Enter resolves from the
|
|
18
|
-
* note; Enter there is a new line. Peek's, moved with the conversation
|
|
17
|
+
* note; Enter there is a new line. Peek's, moved with the conversation; a `FormDialog` since 2 November, so Cancel waits
|
|
18
|
+
* while it resolves and a resolve that went through closes it.
|
|
19
19
|
*/
|
|
20
20
|
export function ResolveDialog({ onResolve, onCancel, refused }: ResolveDialogProps) {
|
|
21
21
|
const [note, setNote] = useState('')
|
|
22
|
-
const [busy, setBusy] = useState(false)
|
|
23
|
-
const formId = useId()
|
|
24
22
|
return (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Cancel
|
|
32
|
-
</Button>
|
|
33
|
-
{/* Outlined at rest and green on hover in Signal, the kit's `resolve` look. */}
|
|
34
|
-
<Button variant="resolve" type="submit" form={formId} disabled={busy}>
|
|
35
|
-
Resolve
|
|
36
|
-
</Button>
|
|
37
|
-
</>
|
|
38
|
-
}
|
|
39
|
-
>
|
|
40
|
-
<Form
|
|
41
|
-
id={formId}
|
|
42
|
-
busy={busy}
|
|
43
|
-
onSubmit={async () => {
|
|
44
|
-
setBusy(true)
|
|
45
|
-
try {
|
|
46
|
-
await onResolve(note)
|
|
47
|
-
} finally {
|
|
48
|
-
setBusy(false)
|
|
49
|
-
}
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
<Field label="Resolution message (optional)" error={refused}>
|
|
53
|
-
<Textarea autoFocus value={note} onChange={(e) => setNote(e.target.value)} placeholder="Summarize the outcome or decision..." className="h-[109px]" />
|
|
54
|
-
</Field>
|
|
55
|
-
</Form>
|
|
56
|
-
</DialogShell>
|
|
23
|
+
// Outlined at rest and green on hover in Signal, the kit's `resolve` look.
|
|
24
|
+
<FormDialog title="Resolve" submitLabel="Resolve" submitVariant="resolve" onSubmit={() => onResolve(note)} onClose={onCancel}>
|
|
25
|
+
<Field label="Resolution message (optional)" error={refused}>
|
|
26
|
+
<Textarea autoFocus value={note} onChange={(e) => setNote(e.target.value)} placeholder="Summarize the outcome or decision..." className="h-[109px]" />
|
|
27
|
+
</Field>
|
|
28
|
+
</FormDialog>
|
|
57
29
|
)
|
|
58
30
|
}
|
package/src/SelectionToolbar.tsx
CHANGED
|
@@ -20,8 +20,8 @@ import { shortcutLabel } from './shortcuts'
|
|
|
20
20
|
* the field opened (measured 2026-09-07). Linear keeps it, and Katerina asked
|
|
21
21
|
* for the same. The editor's own selection never moved — ProseMirror keeps it
|
|
22
22
|
* while unfocused — so this only *draws* it: an inline decoration over the
|
|
23
|
-
* range, in `bg-selected` — the token
|
|
24
|
-
* mapped through edits and cleared when the field closes.
|
|
23
|
+
* range, in `bg-selected` — the token every kit editor paints `::selection` in
|
|
24
|
+
* (`EDITOR_SELECTION_CLASSES`) — mapped through edits and cleared when the field closes.
|
|
25
25
|
*
|
|
26
26
|
* A decoration rather than a second selection, because a document has one
|
|
27
27
|
* and the field needs it. Editor-internal by design (the editor owns its own
|
package/src/Textarea.mdx
CHANGED
|
@@ -17,6 +17,7 @@ TextInput's look on a multi-line field that does not resize.
|
|
|
17
17
|
## When not
|
|
18
18
|
|
|
19
19
|
- One line → **TextInput**.
|
|
20
|
+
- Formatted text that lands as a document: blocks, marks, `[` and `@` → **DocumentField**.
|
|
20
21
|
- Editing text where it is displayed → **EditableText** with `multiline`.
|
|
21
22
|
|
|
22
23
|
## How
|
package/src/Thread.mdx
CHANGED
|
@@ -18,6 +18,16 @@ A comment's replies, with the box to write one: in the right column under its ow
|
|
|
18
18
|
|
|
19
19
|
<Canvas of={Stories.Resolved} />
|
|
20
20
|
|
|
21
|
+
- A link to a reply shows it: `showInConversation`, scrolled to the middle and flashed.
|
|
22
|
+
|
|
23
|
+
<Canvas of={Stories.Shown} />
|
|
24
|
+
|
|
25
|
+
- `seen`: its replies are watched, beside or under its comment, and a new one keeps its look until it has been seen.
|
|
26
|
+
|
|
27
|
+
<Canvas of={Stories.Seen} />
|
|
28
|
+
|
|
29
|
+
<Canvas of={Stories.UnderSeen} />
|
|
30
|
+
|
|
21
31
|
<Canvas of={Stories.Under} />
|
|
22
32
|
|
|
23
33
|
## When not
|
|
@@ -37,18 +47,27 @@ import { ReplyCard, Thread } from '@estiva-app/ui'
|
|
|
37
47
|
</Thread>
|
|
38
48
|
```
|
|
39
49
|
|
|
50
|
+
- A reply is read by being seen in its thread: `useSeenOnScreen(key)` for the thread, handed to `seen`, holds the ids of the replies that have been on screen a moment. Draw each reply's `isNew` from it.
|
|
51
|
+
- Beside, where it scrolls is the thread's: it opens at its newest reply, goes to each new **ReplyCard** drawn in it (a
|
|
52
|
+
line of your own among them takes it nowhere), and stays at the bottom while cards and pictures fill in. A reply
|
|
53
|
+
deleted moves nothing. Key each reply by its own id: another thread's replies are then drawn afresh, and it opens at
|
|
54
|
+
their newest, with or without a `start`.
|
|
40
55
|
- Its replies are yours to put in time order. Who resolved it is said on the comment, not among them.
|
|
41
56
|
- Still reading: `loading`. Nobody replied yet: nothing in `children`.
|
|
42
57
|
- An app whose empty thread said nothing keeps its silence with `empty={null}`; `closeLabel` names Close in its words for a screen reader.
|
|
43
|
-
- `start.id` is put on the pinned comment as `data-thread-start`,
|
|
58
|
+
- `start.id` is put on the pinned comment as `data-thread-start`, and each **ReplyCard**'s `id` on it as `data-reply-id`, as ConversationLayout's comments carry `data-conversation-item`. Give every reply its `id`.
|
|
59
|
+
- A link to a reply or to the comment shows it: `showInConversation(id)` scrolls it to the middle of the column and flashes it, and answers `false` when it is not drawn; `showInConversationWhenDrawn(id)` waits for a thread just asked to open, up to 3 seconds, and stops when a newer link is pressed. Never a wrapper of your own round a reply to carry its id, and never a flash of your own.
|
|
44
60
|
|
|
45
61
|
## What it owns
|
|
46
62
|
|
|
47
63
|
| It does | So you never write | Refused when written by hand |
|
|
48
64
|
|---|---|---|
|
|
49
65
|
| Pins the comment at the top, and keeps the box under the replies | a header and a fixed footer | |
|
|
66
|
+
| Beside: opens at its newest reply, goes to each new one, holds still while cards load | a scroll to the bottom, a ResizeObserver | |
|
|
50
67
|
| Placeholders while reading, and a line when nobody replied | a loading and an empty state | |
|
|
51
68
|
| "Resolved" in green at the top of the column | a chip | |
|
|
69
|
+
| Says which replies have been on screen a moment, with `seen` | an IntersectionObserver and a timer per reply | |
|
|
70
|
+
| The id on each reply and on the pinned comment, and the flash when a link shows one | a wrapper with an id, a flash in your CSS | |
|
|
52
71
|
|
|
53
72
|
## Props
|
|
54
73
|
|
package/src/Thread.stories.tsx
CHANGED
|
@@ -6,6 +6,8 @@ import { ConversationCard, ReplyCard } from './ConversationCard'
|
|
|
6
6
|
import { ConversationLayout } from './ConversationLayout'
|
|
7
7
|
import { ONE, SHORT, SOME, THREE, TWO, WORDS, WriteBox, YOU, useReactions } from './conversation.examples'
|
|
8
8
|
import { MembersPill } from './MembersPill'
|
|
9
|
+
import { useSeenOnScreen } from './seenOnScreen'
|
|
10
|
+
import { showInConversation } from './showInConversation'
|
|
9
11
|
import { Thread } from './Thread'
|
|
10
12
|
|
|
11
13
|
/** A comment's replies, with the box to write one: in the right column, or under its comment. */
|
|
@@ -27,17 +29,17 @@ function Side({ children }: { children: ReactNode }) {
|
|
|
27
29
|
)
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
const START = { author: ONE, time: '11:08 AM', words: WORDS }
|
|
32
|
+
const START = { id: 'c1', author: ONE, time: '11:08 AM', words: WORDS }
|
|
31
33
|
|
|
32
34
|
function Replies({ readOnly = false }: { readOnly?: boolean }) {
|
|
33
35
|
const one = useReactions(SOME)
|
|
34
36
|
const two = useReactions()
|
|
35
37
|
return (
|
|
36
38
|
<>
|
|
37
|
-
<ReplyCard author={TWO} time="11:40 AM" reactions={one} readOnly={readOnly}>
|
|
39
|
+
<ReplyCard id="r1" author={TWO} time="11:40 AM" reactions={one} readOnly={readOnly}>
|
|
38
40
|
{SHORT}
|
|
39
41
|
</ReplyCard>
|
|
40
|
-
<ReplyCard author={THREE} time="11:52 AM" reactions={two} readOnly={readOnly}>
|
|
42
|
+
<ReplyCard id="r2" author={THREE} time="11:52 AM" reactions={two} readOnly={readOnly}>
|
|
41
43
|
A second reply, under the first, in the order they were written.
|
|
42
44
|
</ReplyCard>
|
|
43
45
|
</>
|
|
@@ -55,6 +57,56 @@ export const Column: Story = {
|
|
|
55
57
|
),
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/** A link to a reply showed it (`showInConversation`): scrolled to the middle of the column and flashed in the accent's wash, fading. The story shows the second reply. */
|
|
61
|
+
export const Shown: Story = {
|
|
62
|
+
name: 'A reply shown',
|
|
63
|
+
render: () => (
|
|
64
|
+
<Side>
|
|
65
|
+
<Thread start={START} onClose={() => {}} box={<WriteBox />}>
|
|
66
|
+
<Replies />
|
|
67
|
+
</Thread>
|
|
68
|
+
</Side>
|
|
69
|
+
),
|
|
70
|
+
play: () => {
|
|
71
|
+
showInConversation('r2')
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Read by being seen: a new reply keeps its edge until it has been on screen a moment (`useSeenOnScreen`, handed to `seen`). */
|
|
76
|
+
export const Seen: Story = {
|
|
77
|
+
name: 'New until seen',
|
|
78
|
+
render: function Render() {
|
|
79
|
+
const seen = useSeenOnScreen('story')
|
|
80
|
+
return (
|
|
81
|
+
<Side>
|
|
82
|
+
<Thread start={START} onClose={() => {}} box={<WriteBox />} seen={seen}>
|
|
83
|
+
<ReplyCard id="n1" author={TWO} time="11:40 AM" isNew={!seen.ids.has('n1')}>
|
|
84
|
+
{SHORT}
|
|
85
|
+
</ReplyCard>
|
|
86
|
+
<ReplyCard id="n2" author={THREE} time="11:52 AM" isNew={!seen.ids.has('n2')}>
|
|
87
|
+
A second reply, new too.
|
|
88
|
+
</ReplyCard>
|
|
89
|
+
</Thread>
|
|
90
|
+
</Side>
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A long thread: it opens at its newest reply, and goes to each new one. */
|
|
96
|
+
export const Long: Story = {
|
|
97
|
+
render: () => (
|
|
98
|
+
<Side>
|
|
99
|
+
<Thread start={START} onClose={() => {}} box={<WriteBox />}>
|
|
100
|
+
{Array.from({ length: 9 }, (_, i) => (
|
|
101
|
+
<ReplyCard key={i} id={`l${i}`} author={[TWO, THREE, YOU][i % 3]} time={`11:${10 + i * 4} AM`}>
|
|
102
|
+
{i % 3 === 0 ? SHORT : `Reply ${i + 1}, in the order they were written.`}
|
|
103
|
+
</ReplyCard>
|
|
104
|
+
))}
|
|
105
|
+
</Thread>
|
|
106
|
+
</Side>
|
|
107
|
+
),
|
|
108
|
+
}
|
|
109
|
+
|
|
58
110
|
/** Resolved: "Resolved" at the top. Who resolved it, and the note, are said on the comment, not among the replies. */
|
|
59
111
|
export const Resolved: Story = {
|
|
60
112
|
render: () => (
|
|
@@ -151,6 +203,45 @@ export const Under: Story = {
|
|
|
151
203
|
},
|
|
152
204
|
}
|
|
153
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Under its comment, read by being seen too: a new reply keeps its edge until it has been on screen a moment
|
|
208
|
+
* (`useSeenOnScreen` for the thread, handed to its `seen`), as in the column beside.
|
|
209
|
+
*/
|
|
210
|
+
export const UnderSeen: Story = {
|
|
211
|
+
name: 'Under its comment, new until seen',
|
|
212
|
+
render: function Render() {
|
|
213
|
+
const seen = useSeenOnScreen('story-under')
|
|
214
|
+
return (
|
|
215
|
+
<div className="flex h-[640px]">
|
|
216
|
+
<ConversationLayout
|
|
217
|
+
threads="under"
|
|
218
|
+
open="c1"
|
|
219
|
+
items={[
|
|
220
|
+
{
|
|
221
|
+
id: 'c1',
|
|
222
|
+
card: (
|
|
223
|
+
<ConversationCard author={ONE} time="11:08 AM" replies={{ count: 2, faces: [TWO, THREE], last: '11:52 AM' }}>
|
|
224
|
+
{WORDS}
|
|
225
|
+
</ConversationCard>
|
|
226
|
+
),
|
|
227
|
+
thread: (
|
|
228
|
+
<Thread place="under" box={<WriteBox />} seen={seen}>
|
|
229
|
+
<ReplyCard id="u1" author={TWO} time="11:40 AM" isNew={!seen.ids.has('u1')}>
|
|
230
|
+
{SHORT}
|
|
231
|
+
</ReplyCard>
|
|
232
|
+
<ReplyCard id="u2" author={THREE} time="11:52 AM" isNew={!seen.ids.has('u2')}>
|
|
233
|
+
A second reply, new too.
|
|
234
|
+
</ReplyCard>
|
|
235
|
+
</Thread>
|
|
236
|
+
),
|
|
237
|
+
},
|
|
238
|
+
]}
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
)
|
|
242
|
+
},
|
|
243
|
+
}
|
|
244
|
+
|
|
154
245
|
/** Your reply among them. */
|
|
155
246
|
export const WithYours: Story = {
|
|
156
247
|
name: 'With yours',
|
package/src/Thread.test.tsx
CHANGED
|
@@ -98,3 +98,14 @@ describe('Thread, under its comment (one column)', () => {
|
|
|
98
98
|
expect(container.querySelector('[data-thread-replies]')).toBeNull()
|
|
99
99
|
})
|
|
100
100
|
})
|
|
101
|
+
|
|
102
|
+
describe('Thread, the pinned comment’s exact time (B10)', () => {
|
|
103
|
+
it('says the exact date and time under the pointer, as every comment’s time does', async () => {
|
|
104
|
+
const { default: userEvent } = await import('@testing-library/user-event')
|
|
105
|
+
const user = userEvent.setup()
|
|
106
|
+
const at = Date.UTC(2026, 10, 2, 11, 8)
|
|
107
|
+
render(<Thread start={{ ...START, at }} />)
|
|
108
|
+
await user.hover(screen.getByText('11:08 AM'))
|
|
109
|
+
expect((await screen.findByRole('tooltip')).textContent).toBe(new Date(at).toLocaleString(undefined, { dateStyle: 'long', timeStyle: 'short' }))
|
|
110
|
+
})
|
|
111
|
+
})
|