@estiva-app/ui 0.97.0 → 0.98.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/ConversationCard.d.ts +24 -6
- package/dist/ConversationCard.d.ts.map +1 -1
- package/dist/ConversationLayout.d.ts +18 -6
- package/dist/ConversationLayout.d.ts.map +1 -1
- package/dist/ConversationMenu.d.ts +14 -5
- package/dist/ConversationMenu.d.ts.map +1 -1
- package/dist/Thread.d.ts +9 -2
- package/dist/Thread.d.ts.map +1 -1
- package/dist/index.js +149 -66
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/registry.json +134 -18
- package/src/ConversationCard.mdx +3 -2
- package/src/ConversationCard.states.test.tsx +25 -5
- package/src/ConversationCard.stories.tsx +3 -3
- package/src/ConversationCard.test.tsx +4 -4
- package/src/ConversationCard.tsx +56 -36
- package/src/ConversationLayout.mdx +12 -0
- package/src/ConversationLayout.stories.tsx +47 -0
- package/src/ConversationLayout.test.tsx +100 -0
- package/src/ConversationLayout.tsx +98 -20
- package/src/ConversationMenu.mdx +5 -2
- package/src/ConversationMenu.stories.tsx +19 -1
- package/src/ConversationMenu.test.tsx +17 -4
- package/src/ConversationMenu.tsx +37 -16
- package/src/Thread.mdx +2 -0
- package/src/Thread.test.tsx +17 -0
- package/src/Thread.tsx +32 -8
- package/src/linkedFrom.test.tsx +18 -0
- package/src/linkedFrom.ts +2 -2
- package/stories/Choosing.mdx +1 -1
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.
|
|
7
|
+
"packageVersion": "0.98.0",
|
|
8
8
|
"exports": 229,
|
|
9
9
|
"typeExports": 234,
|
|
10
10
|
"files": null
|
|
@@ -2662,7 +2662,19 @@
|
|
|
2662
2662
|
"name": "resolved",
|
|
2663
2663
|
"takes": "{ by: string; note?: string; at?: string }",
|
|
2664
2664
|
"required": false,
|
|
2665
|
-
"note": "Resolved, by whom, with what note and when (`at`, in the app's words)."
|
|
2665
|
+
"note": "Resolved, by whom, with what note and when (`at`, in the app's words): \"✓ Resolved\" by the time, who and the note on hover; \"Person two → the note · time\" above the replies row."
|
|
2666
|
+
},
|
|
2667
|
+
{
|
|
2668
|
+
"name": "noun",
|
|
2669
|
+
"takes": "text",
|
|
2670
|
+
"required": false,
|
|
2671
|
+
"note": "What the comment is called in the delete question: \"Delete this comment?\" by default."
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
"name": "resolveHint",
|
|
2675
|
+
"takes": "text",
|
|
2676
|
+
"required": false,
|
|
2677
|
+
"note": "Beside Resolve in the ⋯ menu, how the app's box resolves too, as its key hint: Peek's \"->\"."
|
|
2666
2678
|
},
|
|
2667
2679
|
{
|
|
2668
2680
|
"name": "onResolve",
|
|
@@ -2712,6 +2724,12 @@
|
|
|
2712
2724
|
"required": false,
|
|
2713
2725
|
"note": "A link to it: the time is then the link, \"Link to this\", as a reply's is."
|
|
2714
2726
|
},
|
|
2727
|
+
{
|
|
2728
|
+
"name": "timeLabel",
|
|
2729
|
+
"takes": "text",
|
|
2730
|
+
"required": false,
|
|
2731
|
+
"note": "The time's tooltip when it is a link, in the app's words: \"Link to this\" by default; Peek's \"Link to this message\"."
|
|
2732
|
+
},
|
|
2715
2733
|
{
|
|
2716
2734
|
"name": "edited",
|
|
2717
2735
|
"takes": "text",
|
|
@@ -2800,13 +2818,31 @@
|
|
|
2800
2818
|
"name": "deleteNote",
|
|
2801
2819
|
"takes": "anything",
|
|
2802
2820
|
"required": false,
|
|
2803
|
-
"note": "The app's
|
|
2821
|
+
"note": "The app's own words under the delete question, what deleting does there, in place of the kit's: \"It is deleted for everyone.\", and on a comment how many replies stay."
|
|
2804
2822
|
},
|
|
2805
2823
|
{
|
|
2806
2824
|
"name": "menu",
|
|
2807
2825
|
"takes": "anything",
|
|
2808
2826
|
"required": false,
|
|
2809
|
-
"note": "The app's own rows in the ⋯ menu: `MenuItem`s."
|
|
2827
|
+
"note": "The app's own rows in the ⋯ menu, after Resolve: `MenuItem`s."
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
"name": "menuAfter",
|
|
2831
|
+
"takes": "anything",
|
|
2832
|
+
"required": false,
|
|
2833
|
+
"note": "The app's own rows in the ⋯ menu after Edit, before Delete: Peek's \"View details\"."
|
|
2834
|
+
},
|
|
2835
|
+
{
|
|
2836
|
+
"name": "menuLabel",
|
|
2837
|
+
"takes": "text",
|
|
2838
|
+
"required": false,
|
|
2839
|
+
"note": "A heading over the menu's first rows, in the app's words: Peek's \"Utilities\"."
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
"name": "editLabel",
|
|
2843
|
+
"takes": "text",
|
|
2844
|
+
"required": false,
|
|
2845
|
+
"note": "Edit's words in the ⋯ menu: \"Edit\" by default; Peek's \"Edit message\"."
|
|
2810
2846
|
},
|
|
2811
2847
|
{
|
|
2812
2848
|
"name": "className",
|
|
@@ -2823,9 +2859,7 @@
|
|
|
2823
2859
|
"storyId": "conversation-conversationcard--comment",
|
|
2824
2860
|
"docPage": "src/ConversationCard.mdx",
|
|
2825
2861
|
"app": null,
|
|
2826
|
-
"looks": [
|
|
2827
|
-
"[&>div]:line-clamp-1 [&>div]:max-h-[1lh] [&>div>*:not(p):not(ul):not(ol):not(blockquote):not(pre):not(div:only-child)]:hidden [&>div>div:only-child>*:not(p):not(ul):not(ol):not(blockquote):not(pre)]:hidden"
|
|
2828
|
-
]
|
|
2862
|
+
"looks": []
|
|
2829
2863
|
},
|
|
2830
2864
|
{
|
|
2831
2865
|
"name": "ConversationLayout",
|
|
@@ -2870,7 +2904,19 @@
|
|
|
2870
2904
|
"name": "above",
|
|
2871
2905
|
"takes": "anything",
|
|
2872
2906
|
"required": false,
|
|
2873
|
-
"note": "Above the comments, inside their list:
|
|
2907
|
+
"note": "Above the comments, inside their list: placeholders while older comments are read, a note."
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
"name": "below",
|
|
2911
|
+
"takes": "anything",
|
|
2912
|
+
"required": false,
|
|
2913
|
+
"note": "Two columns: under the comments, inside their list, or under the empty line: a `ReactionHorizon`."
|
|
2914
|
+
},
|
|
2915
|
+
{
|
|
2916
|
+
"name": "top",
|
|
2917
|
+
"takes": "anything",
|
|
2918
|
+
"required": false,
|
|
2919
|
+
"note": "Two columns: at the top of the column however few the comments are, over the room a short conversation leaves: an `ArchivedNotice`."
|
|
2874
2920
|
},
|
|
2875
2921
|
{
|
|
2876
2922
|
"name": "loading",
|
|
@@ -2880,9 +2926,21 @@
|
|
|
2880
2926
|
},
|
|
2881
2927
|
{
|
|
2882
2928
|
"name": "empty",
|
|
2883
|
-
"takes": "
|
|
2929
|
+
"takes": "anything",
|
|
2930
|
+
"required": false,
|
|
2931
|
+
"note": "What an empty conversation says: words, or the app's own `EmptyState` (a read that failed says so)."
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
"name": "bodyRef",
|
|
2935
|
+
"takes": "Ref<HTMLDivElement>",
|
|
2936
|
+
"required": false,
|
|
2937
|
+
"note": "Two columns: the comments' scrolling box, for an app that keeps its own place in it (where it was left, its \"New\" line, following what arrives)."
|
|
2938
|
+
},
|
|
2939
|
+
{
|
|
2940
|
+
"name": "onBodyScroll",
|
|
2941
|
+
"takes": "UIEventHandler<HTMLDivElement>",
|
|
2884
2942
|
"required": false,
|
|
2885
|
-
"note": "
|
|
2943
|
+
"note": "Two columns: the comments' box scrolled."
|
|
2886
2944
|
},
|
|
2887
2945
|
{
|
|
2888
2946
|
"name": "header",
|
|
@@ -2894,7 +2952,7 @@
|
|
|
2894
2952
|
"name": "title",
|
|
2895
2953
|
"takes": "anything",
|
|
2896
2954
|
"required": false,
|
|
2897
|
-
"note": "
|
|
2955
|
+
"note": "Its name: one column's, in its header. Two columns, said with the message if the column breaks (the page's own bar is `header`)."
|
|
2898
2956
|
},
|
|
2899
2957
|
{
|
|
2900
2958
|
"name": "actions",
|
|
@@ -2933,7 +2991,7 @@
|
|
|
2933
2991
|
"kind": "component",
|
|
2934
2992
|
"importPath": "@estiva-app/ui",
|
|
2935
2993
|
"sourceFile": "src/ConversationMenu.tsx",
|
|
2936
|
-
"purpose": "The ⋯ menu of a comment or a reply: Resolve or Reopen
|
|
2994
|
+
"purpose": "The ⋯ menu of a comment or a reply: Resolve or Reopen and the app's own rows; then Edit on your own; then Delete on your own, apart.",
|
|
2937
2995
|
"purposeFrom": "page",
|
|
2938
2996
|
"props": [
|
|
2939
2997
|
{
|
|
@@ -2954,11 +3012,23 @@
|
|
|
2954
3012
|
"required": false,
|
|
2955
3013
|
"note": null
|
|
2956
3014
|
},
|
|
3015
|
+
{
|
|
3016
|
+
"name": "resolveHint",
|
|
3017
|
+
"takes": "text",
|
|
3018
|
+
"required": false,
|
|
3019
|
+
"note": "Beside Resolve, how the app's box resolves too, as its key hint: Peek's \"->\"."
|
|
3020
|
+
},
|
|
2957
3021
|
{
|
|
2958
3022
|
"name": "children",
|
|
2959
3023
|
"takes": "anything",
|
|
2960
3024
|
"required": false,
|
|
2961
|
-
"note": "The app's own rows,
|
|
3025
|
+
"note": "The app's own rows, after Resolve: `MenuItem`s."
|
|
3026
|
+
},
|
|
3027
|
+
{
|
|
3028
|
+
"name": "label",
|
|
3029
|
+
"takes": "text",
|
|
3030
|
+
"required": false,
|
|
3031
|
+
"note": "A heading over Resolve and the app's rows, in the app's words: Peek's \"Utilities\"."
|
|
2962
3032
|
},
|
|
2963
3033
|
{
|
|
2964
3034
|
"name": "onEdit",
|
|
@@ -2966,6 +3036,18 @@
|
|
|
2966
3036
|
"required": false,
|
|
2967
3037
|
"note": "Offered on your own only."
|
|
2968
3038
|
},
|
|
3039
|
+
{
|
|
3040
|
+
"name": "editLabel",
|
|
3041
|
+
"takes": "text",
|
|
3042
|
+
"required": false,
|
|
3043
|
+
"note": "Edit's words: \"Edit\" by default; Peek's \"Edit message\"."
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
"name": "after",
|
|
3047
|
+
"takes": "anything",
|
|
3048
|
+
"required": false,
|
|
3049
|
+
"note": "The app's own rows after Edit, before Delete: Peek's \"View details\"."
|
|
3050
|
+
},
|
|
2969
3051
|
{
|
|
2970
3052
|
"name": "onDelete",
|
|
2971
3053
|
"takes": "a handler",
|
|
@@ -8533,6 +8615,12 @@
|
|
|
8533
8615
|
"required": false,
|
|
8534
8616
|
"note": "A link to it: the time is then the link, \"Link to this\", as a reply's is."
|
|
8535
8617
|
},
|
|
8618
|
+
{
|
|
8619
|
+
"name": "timeLabel",
|
|
8620
|
+
"takes": "text",
|
|
8621
|
+
"required": false,
|
|
8622
|
+
"note": "The time's tooltip when it is a link, in the app's words: \"Link to this\" by default; Peek's \"Link to this message\"."
|
|
8623
|
+
},
|
|
8536
8624
|
{
|
|
8537
8625
|
"name": "edited",
|
|
8538
8626
|
"takes": "text",
|
|
@@ -8621,13 +8709,31 @@
|
|
|
8621
8709
|
"name": "deleteNote",
|
|
8622
8710
|
"takes": "anything",
|
|
8623
8711
|
"required": false,
|
|
8624
|
-
"note": "The app's
|
|
8712
|
+
"note": "The app's own words under the delete question, what deleting does there, in place of the kit's: \"It is deleted for everyone.\", and on a comment how many replies stay."
|
|
8625
8713
|
},
|
|
8626
8714
|
{
|
|
8627
8715
|
"name": "menu",
|
|
8628
8716
|
"takes": "anything",
|
|
8629
8717
|
"required": false,
|
|
8630
|
-
"note": "The app's own rows in the ⋯ menu: `MenuItem`s."
|
|
8718
|
+
"note": "The app's own rows in the ⋯ menu, after Resolve: `MenuItem`s."
|
|
8719
|
+
},
|
|
8720
|
+
{
|
|
8721
|
+
"name": "menuAfter",
|
|
8722
|
+
"takes": "anything",
|
|
8723
|
+
"required": false,
|
|
8724
|
+
"note": "The app's own rows in the ⋯ menu after Edit, before Delete: Peek's \"View details\"."
|
|
8725
|
+
},
|
|
8726
|
+
{
|
|
8727
|
+
"name": "menuLabel",
|
|
8728
|
+
"takes": "text",
|
|
8729
|
+
"required": false,
|
|
8730
|
+
"note": "A heading over the menu's first rows, in the app's words: Peek's \"Utilities\"."
|
|
8731
|
+
},
|
|
8732
|
+
{
|
|
8733
|
+
"name": "editLabel",
|
|
8734
|
+
"takes": "text",
|
|
8735
|
+
"required": false,
|
|
8736
|
+
"note": "Edit's words in the ⋯ menu: \"Edit\" by default; Peek's \"Edit message\"."
|
|
8631
8737
|
},
|
|
8632
8738
|
{
|
|
8633
8739
|
"name": "className",
|
|
@@ -8644,9 +8750,7 @@
|
|
|
8644
8750
|
"storyId": "conversation-replycard--reply",
|
|
8645
8751
|
"docPage": "src/ReplyCard.mdx",
|
|
8646
8752
|
"app": null,
|
|
8647
|
-
"looks": [
|
|
8648
|
-
"[&>div]:line-clamp-1 [&>div]:max-h-[1lh] [&>div>*:not(p):not(ul):not(ol):not(blockquote):not(pre):not(div:only-child)]:hidden [&>div>div:only-child>*:not(p):not(ul):not(ol):not(blockquote):not(pre)]:hidden"
|
|
8649
|
-
]
|
|
8753
|
+
"looks": []
|
|
8650
8754
|
},
|
|
8651
8755
|
{
|
|
8652
8756
|
"name": "ResolveDialog",
|
|
@@ -10173,6 +10277,18 @@
|
|
|
10173
10277
|
"required": false,
|
|
10174
10278
|
"note": "Closes the column."
|
|
10175
10279
|
},
|
|
10280
|
+
{
|
|
10281
|
+
"name": "closeLabel",
|
|
10282
|
+
"takes": "text",
|
|
10283
|
+
"required": false,
|
|
10284
|
+
"note": "Close's name for a screen reader, in the app's words (\"Close thread\")."
|
|
10285
|
+
},
|
|
10286
|
+
{
|
|
10287
|
+
"name": "empty",
|
|
10288
|
+
"takes": "anything",
|
|
10289
|
+
"required": false,
|
|
10290
|
+
"note": "Beside: what an empty thread says, words or the app's own `EmptyState`."
|
|
10291
|
+
},
|
|
10176
10292
|
{
|
|
10177
10293
|
"name": "title",
|
|
10178
10294
|
"takes": "anything",
|
package/src/ConversationCard.mdx
CHANGED
|
@@ -13,7 +13,8 @@ One comment, the same in every app: who, when, the words, files, cards, reaction
|
|
|
13
13
|
|
|
14
14
|
- **A comment** in any conversation: in the comments beside a page, or filling the page with its thread beside it (**ConversationLayout**).
|
|
15
15
|
- `own` on yours: Edit (with `editor`) and Delete (with `onDelete`) in its menu. The card asks before it deletes.
|
|
16
|
-
- `resolved`:
|
|
16
|
+
- `resolved`: "✓ Resolved" by the time, with who, when and the note on hover; "Person two → the note · time" above its replies row. Nothing of the comment is hidden: its words, cards, files and reactions stay.
|
|
17
|
+
- `noun`: what the delete question calls it, "Delete this comment?" by default; a direct message says `message`.
|
|
17
18
|
- `about` on a comment on a part of the page: a **QuotedLine** under the name, above the words.
|
|
18
19
|
- `isNew`, `urgent`: the dot or the urgent mark, and a hairline, until it is read.
|
|
19
20
|
|
|
@@ -65,7 +66,7 @@ import { ConversationCard } from '@estiva-app/ui'
|
|
|
65
66
|
| Shows its actions while pointed at, and holds them while a menu is open | hover state and an outside-click check | |
|
|
66
67
|
| Asks before it deletes | a confirm dialog | |
|
|
67
68
|
| Opens the Resolve dialog, and closes it once resolved | a dialog and its open state | |
|
|
68
|
-
| Says it is resolved, with who and the note, and
|
|
69
|
+
| Says it is resolved, with who and the note, and hides nothing of it | a resolved line or chip of your own | |
|
|
69
70
|
|
|
70
71
|
## Props
|
|
71
72
|
|
|
@@ -277,18 +277,38 @@ describe('what the review found (1 November)', () => {
|
|
|
277
277
|
expect(onClick).toHaveBeenCalledOnce()
|
|
278
278
|
})
|
|
279
279
|
|
|
280
|
-
it('
|
|
280
|
+
it('asks about a direct message as a message (Katerina, 1 November), and about a comment by default', async () => {
|
|
281
281
|
render(
|
|
282
|
-
<ConversationCard author={ONE} time="11:08 AM"
|
|
282
|
+
<ConversationCard author={ONE} time="11:08 AM" own onDelete={() => {}} noun="message">
|
|
283
283
|
Words
|
|
284
284
|
</ConversationCard>,
|
|
285
285
|
)
|
|
286
|
-
|
|
286
|
+
point('Words')
|
|
287
|
+
fireEvent.click(screen.getByRole('button', { name: 'More actions' }))
|
|
288
|
+
fireEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }))
|
|
289
|
+
expect(await screen.findByText('Delete this message?')).toBeTruthy()
|
|
290
|
+
expect(screen.getByRole('button', { name: 'Delete message' })).toBeTruthy()
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
|
|
294
|
+
describe('an app’s own words (Katerina, 1 November: Peek reads as it did)', () => {
|
|
295
|
+
it('says the app’s words under the delete question, in place of the kit’s, the replies’ line too', async () => {
|
|
296
|
+
render(
|
|
297
|
+
<ConversationCard author={ONE} time="11:08 AM" own onDelete={() => {}} replies={{ count: 2 }} deleteNote={<p>The app’s own words about what deleting does, and the replies.</p>}>
|
|
298
|
+
Words
|
|
299
|
+
</ConversationCard>,
|
|
300
|
+
)
|
|
301
|
+
point('Words')
|
|
302
|
+
fireEvent.click(screen.getByRole('button', { name: 'More actions' }))
|
|
303
|
+
fireEvent.click(await screen.findByRole('menuitem', { name: 'Delete' }))
|
|
304
|
+
expect(await screen.findByText('The app’s own words about what deleting does, and the replies.')).toBeTruthy()
|
|
305
|
+
expect(screen.queryByText('It is deleted for everyone.')).toBeNull()
|
|
306
|
+
expect(screen.queryByText('Its 2 replies stay.')).toBeNull()
|
|
287
307
|
})
|
|
288
308
|
})
|
|
289
309
|
|
|
290
310
|
describe('its files, what it is about, and how it was resolved', () => {
|
|
291
|
-
it('draws its files under the words, and
|
|
311
|
+
it('draws its files under the words, and keeps them once resolved: nothing folds (Katerina, 1 November)', () => {
|
|
292
312
|
render(
|
|
293
313
|
<ConversationCard author={ONE} time="11:08 AM" files={<span>plan.png</span>}>
|
|
294
314
|
Words
|
|
@@ -301,7 +321,7 @@ describe('its files, what it is about, and how it was resolved', () => {
|
|
|
301
321
|
Words
|
|
302
322
|
</ConversationCard>,
|
|
303
323
|
)
|
|
304
|
-
expect(screen.
|
|
324
|
+
expect(after(screen.getByText('Words'), screen.getByText('plan.png'))).toBe(true)
|
|
305
325
|
})
|
|
306
326
|
|
|
307
327
|
it('puts what it is about under the name and above the words (Katerina, 1 November), on a reply too', () => {
|
|
@@ -24,7 +24,7 @@ type Story = StoryObj<typeof meta>
|
|
|
24
24
|
/** Two paragraphs in RichText's own box, as an app's words come. */
|
|
25
25
|
const RICH = [
|
|
26
26
|
{ type: 'paragraph' as const, inline: [{ text: WORDS, marks: [] }] },
|
|
27
|
-
{ type: 'paragraph' as const, inline: [{ text: 'A second paragraph
|
|
27
|
+
{ type: 'paragraph' as const, inline: [{ text: 'A second paragraph: a resolved comment shows all of it.', marks: [] }] },
|
|
28
28
|
]
|
|
29
29
|
|
|
30
30
|
/** A card that answers: its reactions, resolve, edit and delete change it, as an app's would. */
|
|
@@ -91,10 +91,10 @@ export const Urgent: Story = { render: (args) => <Live {...args} isNew urgent re
|
|
|
91
91
|
/** A person named in the words, and a link. */
|
|
92
92
|
export const WithMentions: Story = { name: 'Mentions', render: (args) => <Live {...args}><Mentions /></Live> }
|
|
93
93
|
|
|
94
|
-
/** Resolved
|
|
94
|
+
/** Resolved: "Resolved" by the time, who and the note above its replies; its words, reactions and files all stay. */
|
|
95
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
96
|
|
|
97
|
-
/** Resolved, its words in a box of their own, as the apps draw them (RichText here):
|
|
97
|
+
/** Resolved, its words in a box of their own, as the apps draw them (RichText here): all of them shown. */
|
|
98
98
|
export const ResolvedInABox: Story = {
|
|
99
99
|
name: 'Resolved, words in a box',
|
|
100
100
|
render: (args) => (
|
|
@@ -71,7 +71,7 @@ describe('ConversationCard', () => {
|
|
|
71
71
|
expect(onResolve).toHaveBeenCalledWith('Going with the first one')
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
it('
|
|
74
|
+
it('resolved: the check by the time, who and the note above its replies, nothing of it hidden, and still opens its thread on a press', async () => {
|
|
75
75
|
const user = userEvent.setup()
|
|
76
76
|
const onClick = vi.fn()
|
|
77
77
|
render(
|
|
@@ -79,13 +79,13 @@ describe('ConversationCard', () => {
|
|
|
79
79
|
Words
|
|
80
80
|
</ConversationCard>,
|
|
81
81
|
)
|
|
82
|
-
//
|
|
83
|
-
//
|
|
82
|
+
// "✓ Resolved" by the time, and "Person two → Done." above its replies, with no "resolved"; its words and its reactions
|
|
83
|
+
// stay (Katerina, 1 November: nothing folds).
|
|
84
84
|
expect(screen.getByText('Resolved')).toBeTruthy()
|
|
85
85
|
expect(screen.getByText('Person two')).toBeTruthy()
|
|
86
86
|
expect(screen.getByText('Done.')).toBeTruthy()
|
|
87
87
|
expect(screen.queryByText(/Person two resolved/)).toBeNull()
|
|
88
|
-
expect(screen.
|
|
88
|
+
expect(screen.getByRole('button', { name: /👍/ })).toBeTruthy()
|
|
89
89
|
await user.click(screen.getByText('Words'))
|
|
90
90
|
expect(onClick).toHaveBeenCalledOnce()
|
|
91
91
|
})
|
package/src/ConversationCard.tsx
CHANGED
|
@@ -34,6 +34,8 @@ export interface ConversationEntryProps {
|
|
|
34
34
|
time: ReactNode
|
|
35
35
|
/** A link to it: the time is then the link, "Link to this", as a reply's is. */
|
|
36
36
|
timeHref?: string
|
|
37
|
+
/** The time's tooltip when it is a link, in the app's words: "Link to this" by default; Peek's "Link to this message". */
|
|
38
|
+
timeLabel?: string
|
|
37
39
|
/** When it was last edited, in the app's words for the tooltip ("Edited 11:20 AM"): draws "(edited)". */
|
|
38
40
|
edited?: string
|
|
39
41
|
/** The words, as the app draws them: text, mentions, links, attached cards, quoted blocks. */
|
|
@@ -60,10 +62,19 @@ export interface ConversationEntryProps {
|
|
|
60
62
|
onEditingChange?: (editing: boolean) => void
|
|
61
63
|
/** Delete, after the card has asked. */
|
|
62
64
|
onDelete?: () => Promise<boolean | void> | boolean | void
|
|
63
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* The app's own words under the delete question, what deleting does there, in place of the kit's: "It is deleted for
|
|
67
|
+
* everyone.", and on a comment how many replies stay. A string is one paragraph; a node is drawn as given.
|
|
68
|
+
*/
|
|
64
69
|
deleteNote?: ReactNode
|
|
65
|
-
/** The app's own rows in the ⋯ menu: `MenuItem`s. */
|
|
70
|
+
/** The app's own rows in the ⋯ menu, after Resolve: `MenuItem`s. */
|
|
66
71
|
menu?: ReactNode
|
|
72
|
+
/** The app's own rows in the ⋯ menu after Edit, before Delete: Peek's "View details". */
|
|
73
|
+
menuAfter?: ReactNode
|
|
74
|
+
/** A heading over the menu's first rows, in the app's words: Peek's "Utilities". */
|
|
75
|
+
menuLabel?: string
|
|
76
|
+
/** Edit's words in the ⋯ menu: "Edit" by default; Peek's "Edit message". */
|
|
77
|
+
editLabel?: string
|
|
67
78
|
/** Placement only. */
|
|
68
79
|
className?: string
|
|
69
80
|
}
|
|
@@ -76,11 +87,18 @@ export interface ConversationCardProps extends ConversationEntryProps {
|
|
|
76
87
|
/** Reply: offered on the strip. */
|
|
77
88
|
onReply?: () => void
|
|
78
89
|
/**
|
|
79
|
-
* Resolved, by whom, with what note and when (`at`, in the app's words)
|
|
80
|
-
*
|
|
81
|
-
*
|
|
90
|
+
* Resolved, by whom, with what note and when (`at`, in the app's words): "✓ Resolved" by the time, who and the note on
|
|
91
|
+
* hover; "Person two → the note · time" above the replies row. Nothing of the comment is hidden: its words, cards,
|
|
92
|
+
* files and reactions stay (Katerina, 1 November: nothing folds, in any app).
|
|
82
93
|
*/
|
|
83
94
|
resolved?: { by: string; note?: string; at?: string }
|
|
95
|
+
/**
|
|
96
|
+
* What the comment is called in the delete question: "Delete this comment?" by default. A direct message says
|
|
97
|
+
* `message` (Katerina, 1 November: "comment" reads wrong in a private chat).
|
|
98
|
+
*/
|
|
99
|
+
noun?: string
|
|
100
|
+
/** Beside Resolve in the ⋯ menu, how the app's box resolves too, as its key hint: Peek's "->". */
|
|
101
|
+
resolveHint?: string
|
|
84
102
|
/** Resolve, with the note written in the dialog the card opens. Offered on the strip and in the menu. */
|
|
85
103
|
onResolve?: (note: string) => Promise<boolean | void> | boolean | void
|
|
86
104
|
/** Why the last resolve was refused, in plain words: said under the note, while the dialog stays open (`onResolve` answered `false`). */
|
|
@@ -95,7 +113,7 @@ export interface ConversationCardProps extends ConversationEntryProps {
|
|
|
95
113
|
export type ReplyCardProps = ConversationEntryProps
|
|
96
114
|
|
|
97
115
|
/** The face, the name, the time and "(edited)", with the new mark at the far right. `meta`: after "(edited)". */
|
|
98
|
-
function Head({ author, time, timeHref, edited, isNew, urgent, meta }: Pick<ConversationEntryProps, 'author' | 'time' | 'timeHref' | 'edited' | 'isNew' | 'urgent'> & { meta?: ReactNode }) {
|
|
116
|
+
function Head({ author, time, timeHref, timeLabel = 'Link to this', edited, isNew, urgent, meta }: Pick<ConversationEntryProps, 'author' | 'time' | 'timeHref' | 'timeLabel' | 'edited' | 'isNew' | 'urgent'> & { meta?: ReactNode }) {
|
|
99
117
|
return (
|
|
100
118
|
<div className="flex w-full items-center gap-2">
|
|
101
119
|
<div className="flex min-w-0 flex-1 items-center gap-2">
|
|
@@ -104,7 +122,7 @@ function Head({ author, time, timeHref, edited, isNew, urgent, meta }: Pick<Conv
|
|
|
104
122
|
</span>
|
|
105
123
|
<span className="min-w-0 truncate text-body-2-strong text-text-primary">{author.name}</span>
|
|
106
124
|
{timeHref ? (
|
|
107
|
-
<WithTooltip label=
|
|
125
|
+
<WithTooltip label={timeLabel} wrapperClassName="shrink-0">
|
|
108
126
|
<MetaText className="contents">
|
|
109
127
|
<Link href={timeHref} variant="quiet" data-interactive>
|
|
110
128
|
{time}
|
|
@@ -129,7 +147,7 @@ function attentionOf(fresh: boolean, urgent: boolean, inThreadCard: boolean) {
|
|
|
129
147
|
}
|
|
130
148
|
|
|
131
149
|
/**
|
|
132
|
-
*
|
|
150
|
+
* Who resolved it and the note (Katerina, 1 November), "Person two → Keeping the first one. · 12:30 PM", in the
|
|
133
151
|
* thread's own line (the dot in the faces' column). No "resolved": the check by the time says it.
|
|
134
152
|
*/
|
|
135
153
|
function EndedLine({ by, note, at }: { by: string; note: string; at?: string }) {
|
|
@@ -165,18 +183,10 @@ function ResolvedCheck({ by, note, at }: { by: string; note?: string; at?: strin
|
|
|
165
183
|
)
|
|
166
184
|
}
|
|
167
185
|
|
|
168
|
-
/**
|
|
169
|
-
|
|
170
|
-
* the cards and pictures among them held back, at either level, then one line, cut with … where the text allows.
|
|
171
|
-
* Text blocks stay: paragraphs, lists, quotes, code.
|
|
172
|
-
*/
|
|
173
|
-
const FOLDED_WORDS_CLASSES =
|
|
174
|
-
'[&>div]:line-clamp-1 [&>div]:max-h-[1lh] [&>div>*:not(p):not(ul):not(ol):not(blockquote):not(pre):not(div:only-child)]:hidden [&>div>div:only-child>*:not(p):not(ul):not(ol):not(blockquote):not(pre)]:hidden'
|
|
175
|
-
|
|
176
|
-
/** The words' own look: Peek's message body, 14px secondary, blocks 8px apart. `oneLine`: folded, the first line only. */
|
|
177
|
-
function Words({ children, oneLine = false }: { children: ReactNode; oneLine?: boolean }) {
|
|
186
|
+
/** The words' own look: Peek's message body, 14px secondary, blocks 8px apart. */
|
|
187
|
+
function Words({ children }: { children: ReactNode }) {
|
|
178
188
|
return (
|
|
179
|
-
<div className=
|
|
189
|
+
<div className="relative w-full break-words pb-2 pl-8 pr-2 pt-1">
|
|
180
190
|
<div className="flex flex-col gap-2 text-body-2 text-text-secondary">{children}</div>
|
|
181
191
|
</div>
|
|
182
192
|
)
|
|
@@ -247,11 +257,11 @@ function useEditing(editing: boolean | undefined, onEditingChange: ((editing: bo
|
|
|
247
257
|
|
|
248
258
|
/**
|
|
249
259
|
* One comment: who, when, the words, files, cards, reactions, and the way into its replies, with the strip on hover
|
|
250
|
-
* and the ⋯ menu. Resolved, it
|
|
260
|
+
* and the ⋯ menu. Resolved, it says who resolved it and the note; nothing of it is hidden.
|
|
251
261
|
* The same card in every app, each in its own colours (the record that makes one conversation). Peek's, moved.
|
|
252
262
|
*/
|
|
253
263
|
export function ConversationCard(props: ConversationCardProps) {
|
|
254
|
-
const { author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, deleted = false, replies, onReply, resolved, onResolve, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, menu, className, children } = props
|
|
264
|
+
const { author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, deleted = false, replies, onReply, resolved, noun = 'comment', onResolve, resolveHint, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, menu, menuAfter, menuLabel, editLabel, className, children } = props
|
|
255
265
|
const readOnly = (props.readOnly ?? false) || deleted
|
|
256
266
|
const inThreadCard = useContext(InThreadCard)
|
|
257
267
|
|
|
@@ -278,7 +288,7 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
278
288
|
// Once its picker or menu has closed: the strip only if the card is still pointed at.
|
|
279
289
|
const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)))
|
|
280
290
|
// The ⋯ menu only when it has a row to show: Resolve or Reopen, the app's rows, or Edit and Delete on your own.
|
|
281
|
-
const offersMenu = !!resolves || !!menu || (own && (!!editor || !!onDelete))
|
|
291
|
+
const offersMenu = !!resolves || !!menu || !!menuAfter || (own && (!!editor || !!onDelete))
|
|
282
292
|
const showStrip = hovered && !isEditing && !readOnly
|
|
283
293
|
const react = reactions?.onToggle
|
|
284
294
|
// Read-only with no replies, there is nothing to open: no box to write in, no thread to read (Peek's way, Katerina, 1 November).
|
|
@@ -286,10 +296,6 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
286
296
|
const reply = onReply ?? item?.show
|
|
287
297
|
const marked = selected ?? (item && !item.under ? item.open : undefined)
|
|
288
298
|
const under = !!item?.under
|
|
289
|
-
// Closed: its thread is not open, under it or beside it (the layout's, or the app's own `selected`).
|
|
290
|
-
const closed = !inThreadCard && !marked
|
|
291
|
-
// Folded: resolved, its thread closed, the words' first line only (Katerina, 1 November).
|
|
292
|
-
const folded = !!resolved && closed
|
|
293
299
|
const repliesRow = replies && replies.count > 0 && (
|
|
294
300
|
<RepliesRow {...replies} onOpen={replies.onOpen ?? (under ? item?.toggle : undefined)} open={replies.open ?? (under && !!item?.open)} urgent={urgent} />
|
|
295
301
|
)
|
|
@@ -334,6 +340,7 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
334
340
|
author={author}
|
|
335
341
|
time={props.time}
|
|
336
342
|
timeHref={props.timeHref}
|
|
343
|
+
timeLabel={props.timeLabel}
|
|
337
344
|
edited={props.edited}
|
|
338
345
|
isNew={isNew}
|
|
339
346
|
urgent={urgent}
|
|
@@ -343,15 +350,15 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
343
350
|
// Under the name, above the words (Katerina, 1 November).
|
|
344
351
|
<div className="relative w-full pl-8 pr-2 pt-0.5">{about}</div>
|
|
345
352
|
)}
|
|
346
|
-
<Words
|
|
353
|
+
<Words>
|
|
347
354
|
{children}
|
|
348
355
|
</Words>
|
|
349
356
|
</>
|
|
350
357
|
)}
|
|
351
|
-
{!deleted && files &&
|
|
358
|
+
{!deleted && files && (
|
|
352
359
|
<div className="relative flex w-full flex-wrap items-start gap-2 pb-2 pl-8 pr-2">{files}</div>
|
|
353
360
|
)}
|
|
354
|
-
|
|
361
|
+
<Reactions reactions={reactions} refused={reactionRefused} readOnly={readOnly} />
|
|
355
362
|
{resolved?.note && (
|
|
356
363
|
// Who resolved it and the note, above the way into the replies; the check by the time says "Resolved" (Katerina, 1 November).
|
|
357
364
|
<div className="relative w-full pb-1">
|
|
@@ -397,7 +404,11 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
397
404
|
resolved={!!resolved}
|
|
398
405
|
onResolve={onResolve && (() => setResolving(true))}
|
|
399
406
|
onReopen={onReopen}
|
|
407
|
+
resolveHint={resolveHint}
|
|
408
|
+
label={menuLabel}
|
|
400
409
|
onEdit={own && editor ? () => setEditing(true) : undefined}
|
|
410
|
+
editLabel={editLabel}
|
|
411
|
+
after={menuAfter}
|
|
401
412
|
onDelete={own && onDelete ? () => setDeleting(true) : undefined}
|
|
402
413
|
>
|
|
403
414
|
{menu}
|
|
@@ -409,9 +420,15 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
409
420
|
)}
|
|
410
421
|
</Card>
|
|
411
422
|
{deleting && onDelete && (
|
|
412
|
-
<ConfirmDialog title=
|
|
413
|
-
|
|
414
|
-
|
|
423
|
+
<ConfirmDialog title={`Delete this ${noun}?`} confirmLabel={`Delete ${noun}`} destructive onConfirm={onDelete} onClose={() => setDeleting(false)}>
|
|
424
|
+
{deleteNote !== undefined ? (
|
|
425
|
+
typeof deleteNote === 'string' ? <p>{deleteNote}</p> : deleteNote
|
|
426
|
+
) : (
|
|
427
|
+
<>
|
|
428
|
+
<p>It is deleted for everyone.</p>
|
|
429
|
+
{replies && replies.count > 0 && <p>Its {replies.count === 1 ? 'reply stays' : `${replies.count} replies stay`}.</p>}
|
|
430
|
+
</>
|
|
431
|
+
)}
|
|
415
432
|
</ConfirmDialog>
|
|
416
433
|
)}
|
|
417
434
|
{resolving && onResolve && (
|
|
@@ -434,7 +451,7 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
434
451
|
* when it has one. Peek's, moved with the conversation.
|
|
435
452
|
*/
|
|
436
453
|
export function ReplyCard(props: ReplyCardProps) {
|
|
437
|
-
const { author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, onDelete, deleteNote, menu, className, children } = props
|
|
454
|
+
const { author, about, files, reactions, reactionRefused, isNew = false, urgent = false, own = false, editor, onDelete, deleteNote, menu, menuAfter, menuLabel, editLabel, className, children } = props
|
|
438
455
|
const readOnly = props.readOnly ?? false
|
|
439
456
|
const [hovered, setHovered] = useState(false)
|
|
440
457
|
const [menuOpen, setMenuOpen] = useState(false)
|
|
@@ -442,7 +459,7 @@ export function ReplyCard(props: ReplyCardProps) {
|
|
|
442
459
|
const [deleting, setDeleting] = useState(false)
|
|
443
460
|
const [editing, setEditing] = useEditing(props.editing, props.onEditingChange)
|
|
444
461
|
const isEditing = editing && !readOnly && !!editor
|
|
445
|
-
const offersMenu = !!menu || (own && (!!editor || !!onDelete))
|
|
462
|
+
const offersMenu = !!menu || !!menuAfter || (own && (!!editor || !!onDelete))
|
|
446
463
|
const showStrip = hovered && !isEditing && !readOnly && (offersMenu || !!reactions?.onToggle)
|
|
447
464
|
const root = useRef<HTMLDivElement>(null)
|
|
448
465
|
const settle = () => requestAnimationFrame(() => setHovered(stillHere(root.current)))
|
|
@@ -474,7 +491,7 @@ export function ReplyCard(props: ReplyCardProps) {
|
|
|
474
491
|
<Editing author={author}>{editor(() => setEditing(false))}</Editing>
|
|
475
492
|
) : (
|
|
476
493
|
<div className="flex flex-col items-start px-2 pt-2">
|
|
477
|
-
<Head author={author} time={props.time} timeHref={props.timeHref} edited={props.edited} isNew={isNew} urgent={urgent} />
|
|
494
|
+
<Head author={author} time={props.time} timeHref={props.timeHref} timeLabel={props.timeLabel} edited={props.edited} isNew={isNew} urgent={urgent} />
|
|
478
495
|
{/* As on a comment: under the name, above the words. */}
|
|
479
496
|
{about && <div className="w-full pl-8 pr-2 pt-0.5">{about}</div>}
|
|
480
497
|
<Words>{children}</Words>
|
|
@@ -504,7 +521,10 @@ export function ReplyCard(props: ReplyCardProps) {
|
|
|
504
521
|
setMenuOpen(next)
|
|
505
522
|
if (!next) settle()
|
|
506
523
|
}}
|
|
524
|
+
label={menuLabel}
|
|
507
525
|
onEdit={own && editor ? () => setEditing(true) : undefined}
|
|
526
|
+
editLabel={editLabel}
|
|
527
|
+
after={menuAfter}
|
|
508
528
|
onDelete={own && onDelete ? () => setDeleting(true) : undefined}
|
|
509
529
|
>
|
|
510
530
|
{menu}
|
|
@@ -516,7 +536,7 @@ export function ReplyCard(props: ReplyCardProps) {
|
|
|
516
536
|
</Card>
|
|
517
537
|
{deleting && onDelete && (
|
|
518
538
|
<ConfirmDialog title="Delete this reply?" confirmLabel="Delete reply" destructive onConfirm={onDelete} onClose={() => setDeleting(false)}>
|
|
519
|
-
|
|
539
|
+
{deleteNote === undefined ? <p>It is deleted for everyone.</p> : typeof deleteNote === 'string' ? <p>{deleteNote}</p> : deleteNote}
|
|
520
540
|
</ConfirmDialog>
|
|
521
541
|
)}
|
|
522
542
|
</>
|