@estiva-app/ui 0.95.0 โ 0.96.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/dist/AppShell.d.ts +25 -7
- package/dist/AppShell.d.ts.map +1 -1
- package/dist/ArchivedNotice.d.ts +28 -0
- package/dist/ArchivedNotice.d.ts.map +1 -0
- package/dist/Button.d.ts +4 -3
- package/dist/Button.d.ts.map +1 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/ConversationActions.d.ts +24 -0
- package/dist/ConversationActions.d.ts.map +1 -0
- package/dist/ConversationCard.d.ts +88 -0
- package/dist/ConversationCard.d.ts.map +1 -0
- package/dist/ConversationLayout.d.ts +50 -0
- package/dist/ConversationLayout.d.ts.map +1 -0
- package/dist/ConversationMenu.d.ts +24 -0
- package/dist/ConversationMenu.d.ts.map +1 -0
- package/dist/Divider.d.ts +23 -4
- package/dist/Divider.d.ts.map +1 -1
- package/dist/EditedMarker.d.ts +11 -0
- package/dist/EditedMarker.d.ts.map +1 -0
- package/dist/IconButton.d.ts +3 -3
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/LinkParts.d.ts +3 -1
- package/dist/LinkParts.d.ts.map +1 -1
- package/dist/ListColumn.d.ts +3 -1
- package/dist/ListColumn.d.ts.map +1 -1
- package/dist/MetaText.d.ts +22 -0
- package/dist/MetaText.d.ts.map +1 -0
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/PageHeader.d.ts +50 -0
- package/dist/PageHeader.d.ts.map +1 -0
- package/dist/Panel.d.ts +6 -0
- package/dist/Panel.d.ts.map +1 -1
- package/dist/PinnedComment.d.ts +17 -0
- package/dist/PinnedComment.d.ts.map +1 -0
- package/dist/QuotedLine.d.ts +16 -0
- package/dist/QuotedLine.d.ts.map +1 -0
- package/dist/ReactionHorizon.d.ts +14 -0
- package/dist/ReactionHorizon.d.ts.map +1 -0
- package/dist/RepliesRow.d.ts +26 -0
- package/dist/RepliesRow.d.ts.map +1 -0
- package/dist/ResolveDialog.d.ts +13 -0
- package/dist/ResolveDialog.d.ts.map +1 -0
- package/dist/Select.d.ts +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/Skeleton.d.ts +8 -4
- package/dist/Skeleton.d.ts.map +1 -1
- package/dist/Thread.d.ts +38 -0
- package/dist/Thread.d.ts.map +1 -0
- package/dist/TopBar.d.ts +3 -2
- package/dist/TopBar.d.ts.map +1 -1
- package/dist/UrgentMark.d.ts +6 -0
- package/dist/UrgentMark.d.ts.map +1 -0
- package/dist/commentBoxFrame.d.ts +3 -1
- package/dist/commentBoxFrame.d.ts.map +1 -1
- package/dist/conversation.examples.d.ts +52 -0
- package/dist/conversation.examples.d.ts.map +1 -0
- package/dist/editor.js +32 -24
- package/dist/editor.js.map +2 -2
- package/dist/eslint/index.js +2 -1
- package/dist/eslint/index.js.map +2 -2
- package/dist/eslint/no-native-title.d.ts +1 -1
- package/dist/eslint/no-native-title.d.ts.map +1 -1
- package/dist/eslint/no-restyled-part.d.ts.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1376 -433
- package/dist/index.js.map +4 -4
- package/dist/looks.d.ts +13 -1
- package/dist/looks.d.ts.map +1 -1
- package/dist/threadCard.d.ts +46 -0
- package/dist/threadCard.d.ts.map +1 -0
- package/package.json +1 -1
- package/registry.json +1873 -546
- package/src/AppShell.mdx +24 -10
- package/src/AppShell.stories.tsx +65 -31
- package/src/AppShell.test.tsx +92 -10
- package/src/AppShell.tsx +108 -18
- package/src/ArchivedNotice.mdx +46 -0
- package/src/ArchivedNotice.stories.tsx +52 -0
- package/src/ArchivedNotice.test.tsx +42 -0
- package/src/ArchivedNotice.tsx +71 -0
- package/src/Button.mdx +2 -2
- package/src/Button.tsx +8 -6
- package/src/Card.test.tsx +4 -4
- package/src/Card.tsx +6 -2
- package/src/CommentBox.test.tsx +2 -1
- package/src/CommentBox.tsx +14 -7
- package/src/ConfirmDialog.stories.tsx +12 -0
- package/src/ConversationActions.mdx +47 -0
- package/src/ConversationActions.stories.tsx +39 -0
- package/src/ConversationActions.tsx +96 -0
- package/src/ConversationCard.mdx +72 -0
- package/src/ConversationCard.states.test.tsx +330 -0
- package/src/ConversationCard.stories.tsx +135 -0
- package/src/ConversationCard.test.tsx +159 -0
- package/src/ConversationCard.tsx +522 -0
- package/src/ConversationLayout.mdx +61 -0
- package/src/ConversationLayout.stories.tsx +161 -0
- package/src/ConversationLayout.test.tsx +240 -0
- package/src/ConversationLayout.tsx +233 -0
- package/src/ConversationMenu.mdx +47 -0
- package/src/ConversationMenu.stories.tsx +42 -0
- package/src/ConversationMenu.test.tsx +47 -0
- package/src/ConversationMenu.tsx +57 -0
- package/src/Divider.mdx +36 -1
- package/src/Divider.stories.tsx +57 -0
- package/src/Divider.test.tsx +24 -1
- package/src/Divider.tsx +49 -9
- package/src/EditedMarker.mdx +36 -0
- package/src/EditedMarker.stories.tsx +24 -0
- package/src/EditedMarker.tsx +20 -0
- package/src/IconButton.mdx +2 -1
- package/src/IconButton.tsx +8 -5
- package/src/LinkParts.mdx +4 -0
- package/src/LinkParts.stories.tsx +10 -0
- package/src/LinkParts.tsx +5 -1
- package/src/ListColumn.tsx +9 -3
- package/src/MetaText.mdx +41 -0
- package/src/MetaText.stories.tsx +29 -0
- package/src/MetaText.tsx +38 -0
- package/src/NavItem.tsx +2 -11
- package/src/PageHeader.mdx +123 -0
- package/src/PageHeader.stories.tsx +174 -0
- package/src/PageHeader.test.tsx +99 -0
- package/src/PageHeader.tsx +105 -0
- package/src/Panel.mdx +12 -0
- package/src/Panel.stories.tsx +47 -5
- package/src/Panel.test.tsx +40 -0
- package/src/Panel.tsx +8 -2
- package/src/PinnedComment.mdx +40 -0
- package/src/PinnedComment.stories.tsx +21 -0
- package/src/PinnedComment.tsx +40 -0
- package/src/QuotedLine.mdx +44 -0
- package/src/QuotedLine.stories.tsx +30 -0
- package/src/QuotedLine.test.tsx +34 -0
- package/src/QuotedLine.tsx +33 -0
- package/src/ReactionHorizon.mdx +36 -0
- package/src/ReactionHorizon.stories.tsx +27 -0
- package/src/ReactionHorizon.tsx +27 -0
- package/src/RepliesRow.mdx +45 -0
- package/src/RepliesRow.stories.tsx +33 -0
- package/src/RepliesRow.test.tsx +47 -0
- package/src/RepliesRow.tsx +86 -0
- package/src/ReplyCard.mdx +50 -0
- package/src/ReplyCard.stories.tsx +68 -0
- package/src/ResolveDialog.mdx +44 -0
- package/src/ResolveDialog.stories.tsx +23 -0
- package/src/ResolveDialog.test.tsx +53 -0
- package/src/ResolveDialog.tsx +58 -0
- package/src/Select.tsx +12 -2
- package/src/Skeleton.stories.tsx +4 -1
- package/src/Skeleton.tsx +33 -4
- package/src/Thread.mdx +53 -0
- package/src/Thread.stories.tsx +167 -0
- package/src/Thread.test.tsx +83 -0
- package/src/Thread.tsx +113 -0
- package/src/TopBar.mdx +8 -6
- package/src/TopBar.stories.tsx +4 -3
- package/src/TopBar.tsx +8 -3
- package/src/UrgentMark.mdx +37 -0
- package/src/UrgentMark.stories.tsx +27 -0
- package/src/UrgentMark.tsx +15 -0
- package/src/commentBoxFrame.tsx +8 -4
- package/src/conversation.examples.tsx +135 -0
- package/src/eslint/no-native-title.ts +1 -1
- package/src/eslint/no-restyled-part.ts +1 -0
- package/src/index.ts +19 -2
- package/src/looks.ts +18 -2
- package/src/registry/registry.test.ts +7 -6
- package/src/threadCard.ts +84 -0
- package/stories/Choosing.mdx +21 -1
- package/tokens.css +14 -10
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
/**
|
|
3
|
+
* What Peek's own card was tested for, and the kit's card now does (Katerina, 1 November: the tests move into the kit
|
|
4
|
+
* before Peek takes its card): who may change it, read-only, an edit the app holds, new and urgent, its files. Peek's
|
|
5
|
+
* wiring keeps its own tests: who the seam says owns a message, the edit box's files and mentions, a refused edit
|
|
6
|
+
* remembered across redraws, the thread's anchors.
|
|
7
|
+
*/
|
|
8
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
9
|
+
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
|
10
|
+
import userEvent from '@testing-library/user-event'
|
|
11
|
+
import { ConversationCard, ReplyCard } from './ConversationCard'
|
|
12
|
+
import { InThreadCard } from './threadCard'
|
|
13
|
+
|
|
14
|
+
afterEach(cleanup)
|
|
15
|
+
|
|
16
|
+
const ONE = { name: 'Person one' }
|
|
17
|
+
const REACTED = { reactions: [{ emoji: '๐', by: ['a'] }], options: [], nameOf: (id: string) => id }
|
|
18
|
+
|
|
19
|
+
/** Pointed at with a plain event, as in ConversationCard.test: user-event's move reads, in jsdom, as leaving. */
|
|
20
|
+
function point(words: string) {
|
|
21
|
+
fireEvent.mouseEnter(screen.getByText(words))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function editBox(done: () => void) {
|
|
25
|
+
return (
|
|
26
|
+
<button type="button" onClick={done}>
|
|
27
|
+
Save
|
|
28
|
+
</button>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Whether `b` comes after `a` in the page. */
|
|
33
|
+
function after(a: Node, b: Node) {
|
|
34
|
+
return !!(a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('who may change it (Peek: ConversationCard.ownership)', () => {
|
|
38
|
+
it('offers Edit and Delete on your own comment', async () => {
|
|
39
|
+
render(
|
|
40
|
+
<ConversationCard author={ONE} time="11:08 AM" own editor={editBox} onDelete={() => {}}>
|
|
41
|
+
Words
|
|
42
|
+
</ConversationCard>,
|
|
43
|
+
)
|
|
44
|
+
point('Words')
|
|
45
|
+
fireEvent.click(screen.getByRole('button', { name: 'More actions' }))
|
|
46
|
+
expect(await screen.findByRole('menuitem', { name: 'Edit' })).toBeTruthy()
|
|
47
|
+
expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeTruthy()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('offers Edit and Delete on your own reply', async () => {
|
|
51
|
+
render(
|
|
52
|
+
<ReplyCard author={ONE} time="11:40 AM" own editor={editBox} onDelete={() => {}}>
|
|
53
|
+
A reply
|
|
54
|
+
</ReplyCard>,
|
|
55
|
+
)
|
|
56
|
+
point('A reply')
|
|
57
|
+
fireEvent.click(screen.getByRole('button', { name: 'More actions' }))
|
|
58
|
+
expect(await screen.findByRole('menuitem', { name: 'Edit' })).toBeTruthy()
|
|
59
|
+
expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeTruthy()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('offers neither on someone elseโs reply: with nothing else to offer, no โฏ at all', () => {
|
|
63
|
+
render(
|
|
64
|
+
<ReplyCard author={ONE} time="11:40 AM" editor={editBox} onDelete={() => {}}>
|
|
65
|
+
A reply
|
|
66
|
+
</ReplyCard>,
|
|
67
|
+
)
|
|
68
|
+
point('A reply')
|
|
69
|
+
expect(screen.queryByRole('button', { name: 'More actions' })).toBeNull()
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('read-only, an archived page (Peek: ConversationCard.readOnly)', () => {
|
|
74
|
+
it('draws no strip, even on your own comment', () => {
|
|
75
|
+
render(
|
|
76
|
+
<ConversationCard author={ONE} time="11:08 AM" own readOnly editor={editBox} onDelete={() => {}} onResolve={() => {}} onReply={() => {}}>
|
|
77
|
+
Words
|
|
78
|
+
</ConversationCard>,
|
|
79
|
+
)
|
|
80
|
+
point('Words')
|
|
81
|
+
for (const name of ['More actions', 'Resolve', 'Reply']) expect(screen.queryByRole('button', { name })).toBeNull()
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('shows its reactions, but they cannot be pressed and there is no way to react', () => {
|
|
85
|
+
const onToggle = vi.fn()
|
|
86
|
+
render(
|
|
87
|
+
<ConversationCard author={ONE} time="11:08 AM" readOnly reactions={{ ...REACTED, onToggle }}>
|
|
88
|
+
Words
|
|
89
|
+
</ConversationCard>,
|
|
90
|
+
)
|
|
91
|
+
const pill = screen.getByRole('button', { name: /๐/ }) as HTMLButtonElement
|
|
92
|
+
expect(pill.disabled).toBe(true)
|
|
93
|
+
fireEvent.click(pill)
|
|
94
|
+
expect(onToggle).not.toHaveBeenCalled()
|
|
95
|
+
expect(screen.queryByRole('button', { name: 'Add a reaction' })).toBeNull()
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('a read-only reply: no strip, and its reactions cannot be pressed', () => {
|
|
99
|
+
const onToggle = vi.fn()
|
|
100
|
+
render(
|
|
101
|
+
<ReplyCard author={ONE} time="11:40 AM" own readOnly editor={editBox} onDelete={() => {}} reactions={{ ...REACTED, onToggle }}>
|
|
102
|
+
A reply
|
|
103
|
+
</ReplyCard>,
|
|
104
|
+
)
|
|
105
|
+
point('A reply')
|
|
106
|
+
expect(screen.queryByRole('button', { name: 'More actions' })).toBeNull()
|
|
107
|
+
fireEvent.click(screen.getByRole('button', { name: /๐/ }))
|
|
108
|
+
expect(onToggle).not.toHaveBeenCalled()
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('offers no way to react where nothing writes a reaction, with no onToggle', () => {
|
|
112
|
+
render(
|
|
113
|
+
<ConversationCard author={ONE} time="11:08 AM" reactions={REACTED}>
|
|
114
|
+
Words
|
|
115
|
+
</ConversationCard>,
|
|
116
|
+
)
|
|
117
|
+
expect((screen.getByRole('button', { name: /๐/ }) as HTMLButtonElement).disabled).toBe(true)
|
|
118
|
+
expect(screen.queryByRole('button', { name: 'Add a reaction' })).toBeNull()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('a deleted comment is read-only: no strip', () => {
|
|
122
|
+
render(
|
|
123
|
+
<ConversationCard author={ONE} time="11:08 AM" deleted own onDelete={() => {}} onResolve={() => {}} replies={{ count: 1 }}>
|
|
124
|
+
Words
|
|
125
|
+
</ConversationCard>,
|
|
126
|
+
)
|
|
127
|
+
point('This comment was deleted.')
|
|
128
|
+
expect(screen.queryByRole('button', { name: 'More actions' })).toBeNull()
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
describe('an edit the app holds: refused, it opens again (Peek: ConversationCard.refusedEdit)', () => {
|
|
133
|
+
it('opens the box while the app says it is being edited, and tells the app when the box is done', async () => {
|
|
134
|
+
const user = userEvent.setup()
|
|
135
|
+
const onEditingChange = vi.fn()
|
|
136
|
+
render(
|
|
137
|
+
<ConversationCard author={ONE} time="11:08 AM" own editing onEditingChange={onEditingChange} editor={editBox}>
|
|
138
|
+
Words
|
|
139
|
+
</ConversationCard>,
|
|
140
|
+
)
|
|
141
|
+
expect(screen.queryByText('Words')).toBeNull()
|
|
142
|
+
await user.click(screen.getByRole('button', { name: 'Save' }))
|
|
143
|
+
expect(onEditingChange).toHaveBeenCalledWith(false)
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it('opens no box on a read-only card, even when the app says it is being edited', () => {
|
|
147
|
+
render(
|
|
148
|
+
<ConversationCard author={ONE} time="11:08 AM" own readOnly editing editor={editBox}>
|
|
149
|
+
Words
|
|
150
|
+
</ConversationCard>,
|
|
151
|
+
)
|
|
152
|
+
expect(screen.getByText('Words')).toBeTruthy()
|
|
153
|
+
expect(screen.queryByRole('button', { name: 'Save' })).toBeNull()
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('a reply too: its box opens while the app holds it', () => {
|
|
157
|
+
render(
|
|
158
|
+
<ReplyCard author={ONE} time="11:40 AM" own editing editor={editBox}>
|
|
159
|
+
A reply
|
|
160
|
+
</ReplyCard>,
|
|
161
|
+
)
|
|
162
|
+
expect(screen.getByRole('button', { name: 'Save' })).toBeTruthy()
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
describe('new and urgent (Peek: ConversationCard.urgent, the cardโs part)', () => {
|
|
167
|
+
it('new: the dot, and the edge in the accent outline', () => {
|
|
168
|
+
const { container } = render(
|
|
169
|
+
<ConversationCard author={ONE} time="11:08 AM" isNew>
|
|
170
|
+
Words
|
|
171
|
+
</ConversationCard>,
|
|
172
|
+
)
|
|
173
|
+
expect(container.querySelector('[data-unread]')).not.toBeNull()
|
|
174
|
+
expect(container.firstElementChild?.className).toMatch(/\bborder-accent-outline\b/)
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
it('urgent: the urgent mark in place of the dot, and the edge in the warning outline', () => {
|
|
178
|
+
const { container } = render(
|
|
179
|
+
<ConversationCard author={ONE} time="11:08 AM" isNew urgent>
|
|
180
|
+
Words
|
|
181
|
+
</ConversationCard>,
|
|
182
|
+
)
|
|
183
|
+
expect(container.querySelector('[data-urgent]')).not.toBeNull()
|
|
184
|
+
expect(container.querySelector('[data-unread]')).toBeNull()
|
|
185
|
+
expect(container.firstElementChild?.className).toMatch(/\bborder-warning-outline\b/)
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('a new reply under it marks the comment too, and its replies row says "1 new"', () => {
|
|
189
|
+
const { container } = render(
|
|
190
|
+
<ConversationCard author={ONE} time="11:08 AM" replies={{ count: 2, isNew: true }}>
|
|
191
|
+
Words
|
|
192
|
+
</ConversationCard>,
|
|
193
|
+
)
|
|
194
|
+
expect(container.firstElementChild?.className).toMatch(/\bborder-accent-outline\b/)
|
|
195
|
+
expect(screen.getByText('1 new')).toBeTruthy()
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it('read, it draws neither mark nor edge', () => {
|
|
199
|
+
const { container } = render(
|
|
200
|
+
<ConversationCard author={ONE} time="11:08 AM">
|
|
201
|
+
Words
|
|
202
|
+
</ConversationCard>,
|
|
203
|
+
)
|
|
204
|
+
expect(container.querySelector('[data-unread], [data-urgent]')).toBeNull()
|
|
205
|
+
expect(container.firstElementChild?.className).not.toMatch(/-outline\b/)
|
|
206
|
+
})
|
|
207
|
+
|
|
208
|
+
it('inside a thread drawn as one card, the dot alone says it: the one card is the edge', () => {
|
|
209
|
+
const { container } = render(
|
|
210
|
+
<InThreadCard.Provider value>
|
|
211
|
+
<ConversationCard author={ONE} time="11:08 AM" isNew>
|
|
212
|
+
Words
|
|
213
|
+
</ConversationCard>
|
|
214
|
+
</InThreadCard.Provider>,
|
|
215
|
+
)
|
|
216
|
+
expect(container.querySelector('[data-unread]')).not.toBeNull()
|
|
217
|
+
expect(container.firstElementChild?.className).not.toMatch(/\bborder-accent-outline\b/)
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
it('a new reply in a thread keeps its own edge', () => {
|
|
221
|
+
const { container } = render(
|
|
222
|
+
<InThreadCard.Provider value>
|
|
223
|
+
<ReplyCard author={ONE} time="11:40 AM" isNew>
|
|
224
|
+
A reply
|
|
225
|
+
</ReplyCard>
|
|
226
|
+
</InThreadCard.Provider>,
|
|
227
|
+
)
|
|
228
|
+
expect(container.firstElementChild?.className).toMatch(/\bborder-accent-outline\b/)
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
describe('what the review found (1 November)', () => {
|
|
233
|
+
it('says why a resolve was refused, under the note, while the dialog stays', async () => {
|
|
234
|
+
const user = userEvent.setup()
|
|
235
|
+
render(
|
|
236
|
+
<ConversationCard author={ONE} time="11:08 AM" onResolve={() => false} resolveRefused="The file is archived">
|
|
237
|
+
Words
|
|
238
|
+
</ConversationCard>,
|
|
239
|
+
)
|
|
240
|
+
point('Words')
|
|
241
|
+
fireEvent.click(screen.getByRole('button', { name: 'Resolve' }))
|
|
242
|
+
const dialog = await screen.findByRole('dialog')
|
|
243
|
+
await user.click(screen.getByRole('button', { name: 'Resolve' }))
|
|
244
|
+
expect(dialog.isConnected).toBe(true)
|
|
245
|
+
expect(screen.getByText(/The file is archived/)).toBeTruthy()
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
it('a double click picks a word: it is not a second press', () => {
|
|
249
|
+
const onClick = vi.fn()
|
|
250
|
+
render(
|
|
251
|
+
<ConversationCard author={ONE} time="11:08 AM" onClick={onClick}>
|
|
252
|
+
Words
|
|
253
|
+
</ConversationCard>,
|
|
254
|
+
)
|
|
255
|
+
fireEvent.click(screen.getByText('Words'), { detail: 1 })
|
|
256
|
+
fireEvent.click(screen.getByText('Words'), { detail: 2 })
|
|
257
|
+
expect(onClick).toHaveBeenCalledOnce()
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
it('words picked by a drag are not a press', () => {
|
|
261
|
+
const onClick = vi.fn()
|
|
262
|
+
render(
|
|
263
|
+
<ConversationCard author={ONE} time="11:08 AM" onClick={onClick}>
|
|
264
|
+
Words to pick
|
|
265
|
+
</ConversationCard>,
|
|
266
|
+
)
|
|
267
|
+
const words = screen.getByText('Words to pick')
|
|
268
|
+
const range = document.createRange()
|
|
269
|
+
range.setStart(words.firstChild!, 0)
|
|
270
|
+
range.setEnd(words.firstChild!, 5)
|
|
271
|
+
window.getSelection()!.removeAllRanges()
|
|
272
|
+
window.getSelection()!.addRange(range)
|
|
273
|
+
fireEvent.click(words, { detail: 1 })
|
|
274
|
+
expect(onClick).not.toHaveBeenCalled()
|
|
275
|
+
window.getSelection()!.removeAllRanges()
|
|
276
|
+
fireEvent.click(words, { detail: 1 })
|
|
277
|
+
expect(onClick).toHaveBeenCalledOnce()
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
it('open beside by the appโs own `selected`, a resolved comment is whole: its files show', () => {
|
|
281
|
+
render(
|
|
282
|
+
<ConversationCard author={ONE} time="11:08 AM" selected resolved={{ by: 'Person two' }} files={<span>plan.png</span>}>
|
|
283
|
+
Words
|
|
284
|
+
</ConversationCard>,
|
|
285
|
+
)
|
|
286
|
+
expect(screen.getByText('plan.png')).toBeTruthy()
|
|
287
|
+
})
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
describe('its files, what it is about, and how it was resolved', () => {
|
|
291
|
+
it('draws its files under the words, and holds them back while it is folded', () => {
|
|
292
|
+
render(
|
|
293
|
+
<ConversationCard author={ONE} time="11:08 AM" files={<span>plan.png</span>}>
|
|
294
|
+
Words
|
|
295
|
+
</ConversationCard>,
|
|
296
|
+
)
|
|
297
|
+
expect(after(screen.getByText('Words'), screen.getByText('plan.png'))).toBe(true)
|
|
298
|
+
cleanup()
|
|
299
|
+
render(
|
|
300
|
+
<ConversationCard author={ONE} time="11:08 AM" files={<span>plan.png</span>} resolved={{ by: 'Person two' }}>
|
|
301
|
+
Words
|
|
302
|
+
</ConversationCard>,
|
|
303
|
+
)
|
|
304
|
+
expect(screen.queryByText('plan.png')).toBeNull()
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
it('puts what it is about under the name and above the words (Katerina, 1 November), on a reply too', () => {
|
|
308
|
+
for (const Part of [ConversationCard, ReplyCard]) {
|
|
309
|
+
render(
|
|
310
|
+
<Part author={ONE} time="11:08 AM" about={<span>the quoted words</span>}>
|
|
311
|
+
Words
|
|
312
|
+
</Part>,
|
|
313
|
+
)
|
|
314
|
+
const name = screen.getByText('Person one')
|
|
315
|
+
const about = screen.getByText('the quoted words')
|
|
316
|
+
expect(after(name, about) && after(about, screen.getByText('Words'))).toBe(true)
|
|
317
|
+
cleanup()
|
|
318
|
+
}
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it('resolved with no note: the check by the time, and no line', () => {
|
|
322
|
+
const { container } = render(
|
|
323
|
+
<ConversationCard author={ONE} time="11:08 AM" resolved={{ by: 'Person two' }}>
|
|
324
|
+
Words
|
|
325
|
+
</ConversationCard>,
|
|
326
|
+
)
|
|
327
|
+
expect(screen.getByText('Resolved')).toBeTruthy()
|
|
328
|
+
expect(container.querySelector('[data-resolved="line"]')).toBeNull()
|
|
329
|
+
})
|
|
330
|
+
})
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { ConversationCard, type ConversationCardProps } from './ConversationCard'
|
|
4
|
+
import { Column, EditBox, Files, LONG, Mentions, ONE, SOME, THREE, TWO, WithBlock, WithCard, WORDS, YOU, useReactions } from './conversation.examples'
|
|
5
|
+
import { RichText } from './RichText'
|
|
6
|
+
import { MenuItem } from './Menu'
|
|
7
|
+
import type { ReactionCount } from './ReactionRow'
|
|
8
|
+
import { QuotedLine } from './QuotedLine'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* One comment, live: point at it for the strip, react, resolve with a note, and on your own edit or delete it.
|
|
12
|
+
*/
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'Conversation/ConversationCard',
|
|
15
|
+
component: ConversationCard,
|
|
16
|
+
parameters: { layout: 'padded' },
|
|
17
|
+
args: { author: ONE, time: '11:08 AM', children: WORDS },
|
|
18
|
+
decorators: [(Story) => <Column>{Story()}</Column>],
|
|
19
|
+
} satisfies Meta<typeof ConversationCard>
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof meta>
|
|
23
|
+
|
|
24
|
+
/** Two paragraphs in RichText's own box, as an app's words come. */
|
|
25
|
+
const RICH = [
|
|
26
|
+
{ type: 'paragraph' as const, inline: [{ text: WORDS, marks: [] }] },
|
|
27
|
+
{ type: 'paragraph' as const, inline: [{ text: 'A second paragraph, held back while it is folded.', marks: [] }] },
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
/** A card that answers: its reactions, resolve, edit and delete change it, as an app's would. */
|
|
31
|
+
function Live({ start, resolvedAt, deletable = true, ...props }: ConversationCardProps & { start?: readonly ReactionCount[]; resolvedAt?: { by: string; note?: string }; deletable?: boolean }) {
|
|
32
|
+
const reacting = useReactions(start)
|
|
33
|
+
const [resolved, setResolved] = useState(resolvedAt)
|
|
34
|
+
const [deleted, setDeleted] = useState(props.deleted ?? false)
|
|
35
|
+
return (
|
|
36
|
+
<ConversationCard
|
|
37
|
+
{...props}
|
|
38
|
+
deleted={deleted}
|
|
39
|
+
reactions={props.readOnly ? { ...reacting, onToggle: undefined } : reacting}
|
|
40
|
+
resolved={resolved}
|
|
41
|
+
onResolve={(note) => setResolved({ by: 'You', note: note || undefined })}
|
|
42
|
+
onReopen={() => setResolved(undefined)}
|
|
43
|
+
onDelete={deletable ? () => setDeleted(true) : undefined}
|
|
44
|
+
editor={props.own ? (done) => <EditBox text={typeof props.children === 'string' ? props.children : WORDS} done={done} /> : undefined}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Someone's comment. */
|
|
50
|
+
export const Comment: Story = { render: (args) => <Live {...args} /> }
|
|
51
|
+
|
|
52
|
+
/** Yours: Edit and Delete in its โฏ menu. */
|
|
53
|
+
export const Yours: Story = { render: (args) => <Live {...args} author={YOU} own /> }
|
|
54
|
+
|
|
55
|
+
/** Edited since it was sent: "(edited)", its time on hover. */
|
|
56
|
+
export const Edited: Story = { render: (args) => <Live {...args} edited="Edited 11:20 AM" /> }
|
|
57
|
+
|
|
58
|
+
/** Deleted: its replies stay under it. */
|
|
59
|
+
export const Deleted: Story = { render: (args) => <Live {...args} deleted replies={{ count: 2, faces: [TWO, THREE], last: '11:40 AM' }} /> }
|
|
60
|
+
|
|
61
|
+
/** Pictures and files under the words. */
|
|
62
|
+
export const WithFiles: Story = { name: 'Files', render: (args) => <Live {...args} files={<Files />} /> }
|
|
63
|
+
|
|
64
|
+
/** A card its author attached. */
|
|
65
|
+
export const Card: Story = { render: (args) => <Live {...args}><WithCard /></Live> }
|
|
66
|
+
|
|
67
|
+
/** On a part of the page: the words it is on, under the name and above its words. */
|
|
68
|
+
export const OnAPart: Story = { name: 'On a part', render: (args) => <Live {...args} about={<QuotedLine words="the words this comment is on" />} /> }
|
|
69
|
+
|
|
70
|
+
/** The words changed since: the bar goes grey, and it says so. */
|
|
71
|
+
export const PartChanged: Story = { name: 'Part changed', render: (args) => <Live {...args} about={<QuotedLine words="the words this comment was on" state="reworded" />} /> }
|
|
72
|
+
|
|
73
|
+
/** A block quoted from something else. */
|
|
74
|
+
export const QuotedBlock: Story = { name: 'Quoted block', render: (args) => <Live {...args}><WithBlock /></Live> }
|
|
75
|
+
|
|
76
|
+
/** With reactions: press one to add yours or take it back. */
|
|
77
|
+
export const Reactions: Story = { render: (args) => <Live {...args} start={SOME} /> }
|
|
78
|
+
|
|
79
|
+
/** With replies: the row that opens its thread. */
|
|
80
|
+
export const Replies: Story = { render: (args) => <Live {...args} replies={{ count: 3, faces: [TWO, THREE, YOU], last: '12:02 PM' }} onReply={() => {}} onClick={() => {}} /> }
|
|
81
|
+
|
|
82
|
+
/** Not read yet. */
|
|
83
|
+
export const New: Story = { render: (args) => <Live {...args} isNew /> }
|
|
84
|
+
|
|
85
|
+
/** A reply under it not read yet. */
|
|
86
|
+
export const NewReply: Story = { name: 'New reply', render: (args) => <Live {...args} replies={{ count: 2, faces: [TWO, THREE], last: '12:02 PM', isNew: true }} onClick={() => {}} /> }
|
|
87
|
+
|
|
88
|
+
/** Urgent and not read yet. */
|
|
89
|
+
export const Urgent: Story = { render: (args) => <Live {...args} isNew urgent replies={{ count: 1, faces: [TWO], last: '12:02 PM', isNew: true }} /> }
|
|
90
|
+
|
|
91
|
+
/** A person named in the words, and a link. */
|
|
92
|
+
export const WithMentions: Story = { name: 'Mentions', render: (args) => <Live {...args}><Mentions /></Live> }
|
|
93
|
+
|
|
94
|
+
/** Resolved, folded: "Resolved" by the time, who and the note above its replies; closed, its words in one line, its reactions and files held back. */
|
|
95
|
+
export const Resolved: Story = { render: (args) => <Live {...args} start={SOME} resolvedAt={{ by: 'Person two', note: 'Keeping the first one.' }} replies={{ count: 2, faces: [TWO, THREE], last: '12:02 PM' }} /> }
|
|
96
|
+
|
|
97
|
+
/** Resolved, its words in a box of their own, as the apps draw them (RichText here): folded, still their first line. */
|
|
98
|
+
export const ResolvedInABox: Story = {
|
|
99
|
+
name: 'Resolved, words in a box',
|
|
100
|
+
render: (args) => (
|
|
101
|
+
<Live {...args} resolvedAt={{ by: 'Person two', note: 'Keeping the first one.' }}>
|
|
102
|
+
<RichText blocks={RICH} />
|
|
103
|
+
</Live>
|
|
104
|
+
),
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Resolved with a long note: the whole note, on its line above the replies. */
|
|
108
|
+
export const ResolvedLongNote: Story = { name: 'Resolved, long note', render: (args) => <Live {...args} resolvedAt={{ by: 'Person two', note: 'Agreed, going with the first one, and the second goes to the list of later ideas with its reasons written beside it.' }} /> }
|
|
109
|
+
|
|
110
|
+
/** The one open beside its thread. */
|
|
111
|
+
export const Selected: Story = { render: (args) => <Live {...args} selected replies={{ count: 2, faces: [TWO, THREE], last: '12:02 PM' }} onClick={() => {}} /> }
|
|
112
|
+
|
|
113
|
+
/** Being edited, in the kit's box. */
|
|
114
|
+
export const Editing: Story = { render: (args) => <Live {...args} author={YOU} own editing /> }
|
|
115
|
+
|
|
116
|
+
/** An edit that was refused: the box opens again, and says why. */
|
|
117
|
+
export const EditRefused: Story = {
|
|
118
|
+
name: 'Edit refused',
|
|
119
|
+
render: (args) => <ConversationCard {...args} author={YOU} own editing editor={(done) => <EditBox text={WORDS} done={done} refuse />} />,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** A reaction that was refused: said under the reactions. */
|
|
123
|
+
export const ReactionRefused: Story = { name: 'Reaction refused', render: (args) => <Live {...args} start={SOME} reactionRefused="try again in a moment" /> }
|
|
124
|
+
|
|
125
|
+
/** Nothing can be changed: no strip, reactions only shown. */
|
|
126
|
+
export const ReadOnly: Story = { name: 'Read-only', render: (args) => <Live {...args} readOnly start={SOME} replies={{ count: 2, faces: [TWO, THREE], last: '12:02 PM' }} /> }
|
|
127
|
+
|
|
128
|
+
/** A long comment, at its full height. */
|
|
129
|
+
export const Long: Story = { render: (args) => <Live {...args}>{LONG}</Live> }
|
|
130
|
+
|
|
131
|
+
/** The app's own rows in its โฏ menu, between Resolve and Edit. */
|
|
132
|
+
export const MoreRows: Story = {
|
|
133
|
+
name: 'More rows',
|
|
134
|
+
render: (args) => <Live {...args} author={YOU} own menu={<MenuItem label="Item one" onClick={() => {}} />} />,
|
|
135
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'
|
|
4
|
+
import userEvent from '@testing-library/user-event'
|
|
5
|
+
import { ConversationCard, ReplyCard } from './ConversationCard'
|
|
6
|
+
|
|
7
|
+
afterEach(cleanup)
|
|
8
|
+
|
|
9
|
+
const ONE = { name: 'Person one' }
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The strip shows while the card is pointed at. Pointed at with a plain event: user-event's move onto a button
|
|
13
|
+
* inside the card reads, in jsdom, as leaving it, and the strip went before the press landed (measured; in a
|
|
14
|
+
* browser the same presses work, as the stories show).
|
|
15
|
+
*/
|
|
16
|
+
async function point(_user: ReturnType<typeof userEvent.setup>, words: string) {
|
|
17
|
+
fireEvent.mouseEnter(screen.getByText(words))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A press on a button of the strip, with a plain event for the same reason. */
|
|
21
|
+
function press(name: string) {
|
|
22
|
+
fireEvent.click(screen.getByRole('button', { name }))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('ConversationCard', () => {
|
|
26
|
+
it('asks before it deletes your comment, and says its replies stay', async () => {
|
|
27
|
+
const user = userEvent.setup()
|
|
28
|
+
const onDelete = vi.fn()
|
|
29
|
+
render(
|
|
30
|
+
<ConversationCard author={ONE} time="11:08 AM" own onDelete={onDelete} replies={{ count: 2 }}>
|
|
31
|
+
Words
|
|
32
|
+
</ConversationCard>,
|
|
33
|
+
)
|
|
34
|
+
await point(user, 'Words')
|
|
35
|
+
press('More actions')
|
|
36
|
+
await user.click(await screen.findByRole('menuitem', { name: 'Delete' }))
|
|
37
|
+
expect(onDelete).not.toHaveBeenCalled()
|
|
38
|
+
const question = await screen.findByRole('alertdialog')
|
|
39
|
+
expect(within(question).getByText('Its 2 replies stay.')).toBeTruthy()
|
|
40
|
+
await user.click(within(question).getByRole('button', { name: 'Delete comment' }))
|
|
41
|
+
expect(onDelete).toHaveBeenCalledOnce()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('offers neither Edit nor Delete on someone elseโs comment', async () => {
|
|
45
|
+
const user = userEvent.setup()
|
|
46
|
+
render(
|
|
47
|
+
<ConversationCard author={ONE} time="11:08 AM" onResolve={() => {}} onDelete={() => {}} editor={() => null}>
|
|
48
|
+
Words
|
|
49
|
+
</ConversationCard>,
|
|
50
|
+
)
|
|
51
|
+
await point(user, 'Words')
|
|
52
|
+
press('More actions')
|
|
53
|
+
await screen.findByRole('menuitem', { name: 'Resolve' })
|
|
54
|
+
expect(screen.queryByRole('menuitem', { name: 'Edit' })).toBeNull()
|
|
55
|
+
expect(screen.queryByRole('menuitem', { name: 'Delete' })).toBeNull()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('resolves with the note written in the dialog', async () => {
|
|
59
|
+
const user = userEvent.setup()
|
|
60
|
+
const onResolve = vi.fn()
|
|
61
|
+
render(
|
|
62
|
+
<ConversationCard author={ONE} time="11:08 AM" onResolve={onResolve}>
|
|
63
|
+
Words
|
|
64
|
+
</ConversationCard>,
|
|
65
|
+
)
|
|
66
|
+
await point(user, 'Words')
|
|
67
|
+
press('Resolve')
|
|
68
|
+
const dialog = await screen.findByRole('dialog')
|
|
69
|
+
await user.type(within(dialog).getByRole('textbox'), 'Going with the first one')
|
|
70
|
+
await user.click(within(dialog).getByRole('button', { name: 'Resolve' }))
|
|
71
|
+
expect(onResolve).toHaveBeenCalledWith('Going with the first one')
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
it('folds when resolved: the check by the time, who and the note above its replies, its reactions held back, and still opens its thread on a press', async () => {
|
|
75
|
+
const user = userEvent.setup()
|
|
76
|
+
const onClick = vi.fn()
|
|
77
|
+
render(
|
|
78
|
+
<ConversationCard author={ONE} time="11:08 AM" resolved={{ by: 'Person two', note: 'Done.' }} reactions={{ reactions: [{ emoji: '๐', by: ['a'] }], options: [], nameOf: (id) => id }} onClick={onClick}>
|
|
79
|
+
Words
|
|
80
|
+
</ConversationCard>,
|
|
81
|
+
)
|
|
82
|
+
// Folded (Katerina, 1 November): "โ Resolved" by the time, and "Person two โ Done." above its replies, with no "resolved";
|
|
83
|
+
// closed, its words in one line and its reactions wait.
|
|
84
|
+
expect(screen.getByText('Resolved')).toBeTruthy()
|
|
85
|
+
expect(screen.getByText('Person two')).toBeTruthy()
|
|
86
|
+
expect(screen.getByText('Done.')).toBeTruthy()
|
|
87
|
+
expect(screen.queryByText(/Person two resolved/)).toBeNull()
|
|
88
|
+
expect(screen.queryByRole('button', { name: /๐/ })).toBeNull()
|
|
89
|
+
await user.click(screen.getByText('Words'))
|
|
90
|
+
expect(onClick).toHaveBeenCalledOnce()
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('opens its thread on a press anywhere on it, beside its reactions too, but not on a reaction', () => {
|
|
94
|
+
const onClick = vi.fn()
|
|
95
|
+
render(
|
|
96
|
+
<ConversationCard author={ONE} time="11:08 AM" reactions={{ reactions: [{ emoji: '๐', by: ['a'] }], options: [], nameOf: (id) => id, onToggle: () => {} }} onClick={onClick}>
|
|
97
|
+
Words
|
|
98
|
+
</ConversationCard>,
|
|
99
|
+
)
|
|
100
|
+
const reaction = screen.getByRole('button', { name: /๐/ })
|
|
101
|
+
fireEvent.click(reaction)
|
|
102
|
+
expect(onClick).not.toHaveBeenCalled()
|
|
103
|
+
// The row the reactions stand in, beside them: it stopped every press before (31 October).
|
|
104
|
+
fireEvent.click(reaction.closest('[data-reactions]') ?? reaction.parentElement!.parentElement!)
|
|
105
|
+
expect(onClick).toHaveBeenCalledOnce()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('opens your box to edit, and closes it when the box is done', async () => {
|
|
109
|
+
const user = userEvent.setup()
|
|
110
|
+
render(
|
|
111
|
+
<ConversationCard
|
|
112
|
+
author={ONE}
|
|
113
|
+
time="11:08 AM"
|
|
114
|
+
own
|
|
115
|
+
editor={(done) => (
|
|
116
|
+
<button type="button" onClick={done}>
|
|
117
|
+
Save
|
|
118
|
+
</button>
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
Words
|
|
122
|
+
</ConversationCard>,
|
|
123
|
+
)
|
|
124
|
+
await point(user, 'Words')
|
|
125
|
+
press('More actions')
|
|
126
|
+
await user.click(await screen.findByRole('menuitem', { name: 'Edit' }))
|
|
127
|
+
await user.click(screen.getByRole('button', { name: 'Save' }))
|
|
128
|
+
expect(screen.getByText('Words')).toBeTruthy()
|
|
129
|
+
expect(screen.queryByRole('button', { name: 'Save' })).toBeNull()
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('says a deleted comment was deleted, and keeps its replies row', () => {
|
|
133
|
+
render(
|
|
134
|
+
<ConversationCard author={ONE} time="11:08 AM" deleted replies={{ count: 3 }}>
|
|
135
|
+
Words
|
|
136
|
+
</ConversationCard>,
|
|
137
|
+
)
|
|
138
|
+
expect(screen.getByText('This comment was deleted.')).toBeTruthy()
|
|
139
|
+
expect(screen.queryByText('Words')).toBeNull()
|
|
140
|
+
expect(screen.getByText('3 replies')).toBeTruthy()
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
describe('ReplyCard', () => {
|
|
145
|
+
it('asks before it deletes your reply', async () => {
|
|
146
|
+
const user = userEvent.setup()
|
|
147
|
+
const onDelete = vi.fn()
|
|
148
|
+
render(
|
|
149
|
+
<ReplyCard author={ONE} time="11:40 AM" own onDelete={onDelete}>
|
|
150
|
+
A reply
|
|
151
|
+
</ReplyCard>,
|
|
152
|
+
)
|
|
153
|
+
await point(user, 'A reply')
|
|
154
|
+
press('More actions')
|
|
155
|
+
await user.click(await screen.findByRole('menuitem', { name: 'Delete' }))
|
|
156
|
+
await user.click(within(await screen.findByRole('alertdialog')).getByRole('button', { name: 'Delete reply' }))
|
|
157
|
+
expect(onDelete).toHaveBeenCalledOnce()
|
|
158
|
+
})
|
|
159
|
+
})
|