@estiva-app/ui 0.106.0 → 0.108.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 +5 -0
- package/dist/ConversationCard.d.ts.map +1 -1
- package/dist/FollowSwitch.d.ts +42 -0
- package/dist/FollowSwitch.d.ts.map +1 -0
- package/dist/MembersDialog.d.ts +25 -0
- package/dist/MembersDialog.d.ts.map +1 -1
- package/dist/MembersPill.d.ts +3 -1
- package/dist/MembersPill.d.ts.map +1 -1
- package/dist/PinnedComment.d.ts +7 -1
- package/dist/PinnedComment.d.ts.map +1 -1
- package/dist/WhoFollowsDialog.d.ts +27 -0
- package/dist/WhoFollowsDialog.d.ts.map +1 -0
- package/dist/eslint/index.js +1 -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/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1101 -959
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +281 -3
- package/src/ConversationCard.mdx +1 -0
- package/src/ConversationCard.stories.tsx +3 -0
- package/src/ConversationCard.test.tsx +22 -0
- package/src/ConversationCard.tsx +10 -2
- package/src/FollowSwitch.mdx +64 -0
- package/src/FollowSwitch.stories.tsx +54 -0
- package/src/FollowSwitch.test.tsx +139 -0
- package/src/FollowSwitch.tsx +127 -0
- package/src/MembersDialog.tsx +115 -62
- package/src/MembersPill.tsx +4 -2
- package/src/PinnedComment.tsx +11 -3
- package/src/Thread.stories.tsx +14 -1
- package/src/Thread.tsx +1 -1
- package/src/WhoFollowsDialog.mdx +65 -0
- package/src/WhoFollowsDialog.stories.tsx +40 -0
- package/src/WhoFollowsDialog.tsx +74 -0
- package/src/eslint/no-native-title.ts +1 -1
- package/src/index.ts +3 -1
- package/src/registry/registry.test.ts +6 -6
- package/stories/Choosing.mdx +2 -0
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.
|
|
8
|
-
"exports":
|
|
9
|
-
"typeExports":
|
|
7
|
+
"packageVersion": "0.108.0",
|
|
8
|
+
"exports": 250,
|
|
9
|
+
"typeExports": 259,
|
|
10
10
|
"files": null
|
|
11
11
|
},
|
|
12
12
|
"storybook": {
|
|
@@ -2765,6 +2765,12 @@
|
|
|
2765
2765
|
"required": false,
|
|
2766
2766
|
"note": "Deleted: \"This comment was deleted.\", and its replies stay."
|
|
2767
2767
|
},
|
|
2768
|
+
{
|
|
2769
|
+
"name": "unseen",
|
|
2770
|
+
"takes": "true/false",
|
|
2771
|
+
"required": false,
|
|
2772
|
+
"note": "Not read, and nothing says it was deleted (SPEC §6.5's \"not returned\"): \"This comment can't be shown.\", drawn as a deleted one is, and its replies stay (Miky, 6 November, ONE-9)."
|
|
2773
|
+
},
|
|
2768
2774
|
{
|
|
2769
2775
|
"name": "replies",
|
|
2770
2776
|
"takes": "Omit<RepliesRowProps, 'urgent'>",
|
|
@@ -4540,6 +4546,97 @@
|
|
|
4540
4546
|
"app": null,
|
|
4541
4547
|
"looks": []
|
|
4542
4548
|
},
|
|
4549
|
+
{
|
|
4550
|
+
"name": "FollowSwitch",
|
|
4551
|
+
"repo": "estiva-ui",
|
|
4552
|
+
"kind": "component",
|
|
4553
|
+
"importPath": "@estiva-app/ui",
|
|
4554
|
+
"sourceFile": "src/FollowSwitch.tsx",
|
|
4555
|
+
"purpose": "How you follow a place, in one button before its title: Not following, Important or All, and back to a group's default when you chose against it.",
|
|
4556
|
+
"purposeFrom": "page",
|
|
4557
|
+
"props": [
|
|
4558
|
+
{
|
|
4559
|
+
"name": "level",
|
|
4560
|
+
"takes": "all | important",
|
|
4561
|
+
"required": true,
|
|
4562
|
+
"note": "What lights for the viewer now: a level, or `undefined` for Not following."
|
|
4563
|
+
},
|
|
4564
|
+
{
|
|
4565
|
+
"name": "label",
|
|
4566
|
+
"takes": "text",
|
|
4567
|
+
"required": true,
|
|
4568
|
+
"note": "The place's name, for the button's accessible name."
|
|
4569
|
+
},
|
|
4570
|
+
{
|
|
4571
|
+
"name": "onChoose",
|
|
4572
|
+
"takes": "a handler",
|
|
4573
|
+
"required": false,
|
|
4574
|
+
"note": "Changes it. While its promise runs the button waits; a rejection is the caller's to report."
|
|
4575
|
+
},
|
|
4576
|
+
{
|
|
4577
|
+
"name": "readOnlyReason",
|
|
4578
|
+
"takes": "text",
|
|
4579
|
+
"required": false,
|
|
4580
|
+
"note": "Without `onChoose`: why it cannot be changed, said under the pointer (\"This team is archived\")."
|
|
4581
|
+
},
|
|
4582
|
+
{
|
|
4583
|
+
"name": "people",
|
|
4584
|
+
"takes": "true/false",
|
|
4585
|
+
"required": false,
|
|
4586
|
+
"note": "People rather than circles, as `LevelIcon`'s `people`."
|
|
4587
|
+
},
|
|
4588
|
+
{
|
|
4589
|
+
"name": "offDescription",
|
|
4590
|
+
"takes": "text",
|
|
4591
|
+
"required": false,
|
|
4592
|
+
"note": "The line under Not following."
|
|
4593
|
+
},
|
|
4594
|
+
{
|
|
4595
|
+
"name": "backTo",
|
|
4596
|
+
"takes": "text",
|
|
4597
|
+
"required": false,
|
|
4598
|
+
"note": "The name of the group whose default reaches the viewer, when they chose against it: offers \"Back to <name>’s default\"."
|
|
4599
|
+
}
|
|
4600
|
+
],
|
|
4601
|
+
"variants": [
|
|
4602
|
+
{
|
|
4603
|
+
"prop": "level",
|
|
4604
|
+
"values": [
|
|
4605
|
+
"all",
|
|
4606
|
+
"important"
|
|
4607
|
+
]
|
|
4608
|
+
}
|
|
4609
|
+
],
|
|
4610
|
+
"ownsBehaviours": [
|
|
4611
|
+
{
|
|
4612
|
+
"id": "portal",
|
|
4613
|
+
"behaviour": "Floats on top of the page"
|
|
4614
|
+
},
|
|
4615
|
+
{
|
|
4616
|
+
"id": "press-outside",
|
|
4617
|
+
"behaviour": "Closes on a press outside"
|
|
4618
|
+
},
|
|
4619
|
+
{
|
|
4620
|
+
"id": "page-keys",
|
|
4621
|
+
"behaviour": "Takes its keys by itself"
|
|
4622
|
+
},
|
|
4623
|
+
{
|
|
4624
|
+
"id": "focus",
|
|
4625
|
+
"behaviour": "Holds focus inside while open, and gives it back"
|
|
4626
|
+
},
|
|
4627
|
+
{
|
|
4628
|
+
"id": "follow",
|
|
4629
|
+
"behaviour": "Stays attached to its anchor on scroll and resize"
|
|
4630
|
+
}
|
|
4631
|
+
],
|
|
4632
|
+
"status": "stable",
|
|
4633
|
+
"migrationStage": null,
|
|
4634
|
+
"docsId": "people-followswitch--docs",
|
|
4635
|
+
"storyId": "people-followswitch--important",
|
|
4636
|
+
"docPage": "src/FollowSwitch.mdx",
|
|
4637
|
+
"app": null,
|
|
4638
|
+
"looks": []
|
|
4639
|
+
},
|
|
4543
4640
|
{
|
|
4544
4641
|
"name": "Form",
|
|
4545
4642
|
"repo": "estiva-ui",
|
|
@@ -4738,6 +4835,44 @@
|
|
|
4738
4835
|
"app": null,
|
|
4739
4836
|
"looks": []
|
|
4740
4837
|
},
|
|
4838
|
+
{
|
|
4839
|
+
"name": "GONE_CLOSED",
|
|
4840
|
+
"repo": "estiva-ui",
|
|
4841
|
+
"kind": "helper",
|
|
4842
|
+
"importPath": "@estiva-app/ui",
|
|
4843
|
+
"sourceFile": "src/PinnedComment.tsx",
|
|
4844
|
+
"purpose": "The box's `closed` under that thread, deleted or not shown, the same in every app: the line above already says why.",
|
|
4845
|
+
"purposeFrom": "comment",
|
|
4846
|
+
"props": [],
|
|
4847
|
+
"variants": [],
|
|
4848
|
+
"ownsBehaviours": [],
|
|
4849
|
+
"status": "stable",
|
|
4850
|
+
"migrationStage": null,
|
|
4851
|
+
"docsId": "conversation-pinnedcomment--docs",
|
|
4852
|
+
"storyId": "conversation-pinnedcomment--pinned",
|
|
4853
|
+
"docPage": null,
|
|
4854
|
+
"app": null,
|
|
4855
|
+
"looks": []
|
|
4856
|
+
},
|
|
4857
|
+
{
|
|
4858
|
+
"name": "goneWords",
|
|
4859
|
+
"repo": "estiva-ui",
|
|
4860
|
+
"kind": "helper",
|
|
4861
|
+
"importPath": "@estiva-app/ui",
|
|
4862
|
+
"sourceFile": "src/PinnedComment.tsx",
|
|
4863
|
+
"purpose": "What stands in a comment's place when it is gone: deleted, or not shown (SPEC §6.5).",
|
|
4864
|
+
"purposeFrom": "comment",
|
|
4865
|
+
"props": [],
|
|
4866
|
+
"variants": [],
|
|
4867
|
+
"ownsBehaviours": [],
|
|
4868
|
+
"status": "stable",
|
|
4869
|
+
"migrationStage": null,
|
|
4870
|
+
"docsId": "conversation-pinnedcomment--docs",
|
|
4871
|
+
"storyId": "conversation-pinnedcomment--pinned",
|
|
4872
|
+
"docPage": null,
|
|
4873
|
+
"app": null,
|
|
4874
|
+
"looks": []
|
|
4875
|
+
},
|
|
4741
4876
|
{
|
|
4742
4877
|
"name": "hueFor",
|
|
4743
4878
|
"repo": "estiva-ui",
|
|
@@ -5626,6 +5761,46 @@
|
|
|
5626
5761
|
"app": null,
|
|
5627
5762
|
"looks": []
|
|
5628
5763
|
},
|
|
5764
|
+
{
|
|
5765
|
+
"name": "LevelIcon",
|
|
5766
|
+
"repo": "estiva-ui",
|
|
5767
|
+
"kind": "component",
|
|
5768
|
+
"importPath": "@estiva-app/ui",
|
|
5769
|
+
"sourceFile": "src/FollowSwitch.tsx",
|
|
5770
|
+
"purpose": "How a place is followed, as one 16px icon: a dashed circle for Important, a full one for All, a dashed one with a plus, muted, for Not following.",
|
|
5771
|
+
"purposeFrom": "comment",
|
|
5772
|
+
"props": [
|
|
5773
|
+
{
|
|
5774
|
+
"name": "level",
|
|
5775
|
+
"takes": "all | important",
|
|
5776
|
+
"required": true,
|
|
5777
|
+
"note": "The level it is followed at; `undefined` draws Not following."
|
|
5778
|
+
},
|
|
5779
|
+
{
|
|
5780
|
+
"name": "people",
|
|
5781
|
+
"takes": "true/false",
|
|
5782
|
+
"required": false,
|
|
5783
|
+
"note": "People rather than circles: for a place that is a group's own (Miky, 2 Nov)."
|
|
5784
|
+
}
|
|
5785
|
+
],
|
|
5786
|
+
"variants": [
|
|
5787
|
+
{
|
|
5788
|
+
"prop": "level",
|
|
5789
|
+
"values": [
|
|
5790
|
+
"all",
|
|
5791
|
+
"important"
|
|
5792
|
+
]
|
|
5793
|
+
}
|
|
5794
|
+
],
|
|
5795
|
+
"ownsBehaviours": [],
|
|
5796
|
+
"status": "stable",
|
|
5797
|
+
"migrationStage": null,
|
|
5798
|
+
"docsId": "people-followswitch--docs",
|
|
5799
|
+
"storyId": "people-followswitch--important",
|
|
5800
|
+
"docPage": null,
|
|
5801
|
+
"app": null,
|
|
5802
|
+
"looks": []
|
|
5803
|
+
},
|
|
5629
5804
|
{
|
|
5630
5805
|
"name": "Lightbox",
|
|
5631
5806
|
"repo": "estiva-ui",
|
|
@@ -6618,6 +6793,12 @@
|
|
|
6618
6793
|
"required": false,
|
|
6619
6794
|
"note": "Opens the list — usually a `MembersDialog`."
|
|
6620
6795
|
},
|
|
6796
|
+
{
|
|
6797
|
+
"name": "label",
|
|
6798
|
+
"takes": "text",
|
|
6799
|
+
"required": false,
|
|
6800
|
+
"note": "The button's accessible name, when the list it opens is not \"members\" — \"Who follows <name>: 4\"."
|
|
6801
|
+
},
|
|
6621
6802
|
{
|
|
6622
6803
|
"name": "className",
|
|
6623
6804
|
"takes": "text",
|
|
@@ -8233,6 +8414,12 @@
|
|
|
8233
8414
|
"takes": "true/false",
|
|
8234
8415
|
"required": false,
|
|
8235
8416
|
"note": "It was deleted; its replies stay."
|
|
8417
|
+
},
|
|
8418
|
+
{
|
|
8419
|
+
"name": "unseen",
|
|
8420
|
+
"takes": "true/false",
|
|
8421
|
+
"required": false,
|
|
8422
|
+
"note": "It wasn't read, and nothing says it was deleted: \"This comment can't be shown.\", and its replies stay (ONE-9)."
|
|
8236
8423
|
}
|
|
8237
8424
|
],
|
|
8238
8425
|
"variants": [],
|
|
@@ -12285,6 +12472,97 @@
|
|
|
12285
12472
|
"app": null,
|
|
12286
12473
|
"looks": []
|
|
12287
12474
|
},
|
|
12475
|
+
{
|
|
12476
|
+
"name": "WhoFollowsDialog",
|
|
12477
|
+
"repo": "estiva-ui",
|
|
12478
|
+
"kind": "component",
|
|
12479
|
+
"importPath": "@estiva-app/ui",
|
|
12480
|
+
"sourceFile": "src/WhoFollowsDialog.tsx",
|
|
12481
|
+
"purpose": "Who follows a place, at All and at Important, with \"Add someone\" — the list a MembersPill opens beside a FollowSwitch.",
|
|
12482
|
+
"purposeFrom": "page",
|
|
12483
|
+
"props": [
|
|
12484
|
+
{
|
|
12485
|
+
"name": "title",
|
|
12486
|
+
"takes": "text",
|
|
12487
|
+
"required": true,
|
|
12488
|
+
"note": "The place's name: the title reads \"Who follows <title>\"."
|
|
12489
|
+
},
|
|
12490
|
+
{
|
|
12491
|
+
"name": "all",
|
|
12492
|
+
"takes": "MembersDialogMember[]",
|
|
12493
|
+
"required": true,
|
|
12494
|
+
"note": "Who follows it at All, in the order to draw them."
|
|
12495
|
+
},
|
|
12496
|
+
{
|
|
12497
|
+
"name": "important",
|
|
12498
|
+
"takes": "MembersDialogMember[]",
|
|
12499
|
+
"required": true,
|
|
12500
|
+
"note": "Who follows it at Important."
|
|
12501
|
+
},
|
|
12502
|
+
{
|
|
12503
|
+
"name": "candidates",
|
|
12504
|
+
"takes": "MembersDialogCandidate[]",
|
|
12505
|
+
"required": false,
|
|
12506
|
+
"note": "Who \"Add someone\" may offer. Everyone listed is left out by id; leave the viewer out yourself — they join with the switch, not by adding themselves."
|
|
12507
|
+
},
|
|
12508
|
+
{
|
|
12509
|
+
"name": "onAdd",
|
|
12510
|
+
"takes": "a handler",
|
|
12511
|
+
"required": false,
|
|
12512
|
+
"note": "Adds the people chosen. With it, the \"Add someone\" row shows and opens the same add layer as `MembersDialog`'s."
|
|
12513
|
+
},
|
|
12514
|
+
{
|
|
12515
|
+
"name": "initialView",
|
|
12516
|
+
"takes": "list | add",
|
|
12517
|
+
"required": false,
|
|
12518
|
+
"note": "`add` opens straight on the add layer, as a menu's \"Add someone…\" does."
|
|
12519
|
+
},
|
|
12520
|
+
{
|
|
12521
|
+
"name": "onClose",
|
|
12522
|
+
"takes": "a handler",
|
|
12523
|
+
"required": true,
|
|
12524
|
+
"note": null
|
|
12525
|
+
}
|
|
12526
|
+
],
|
|
12527
|
+
"variants": [
|
|
12528
|
+
{
|
|
12529
|
+
"prop": "initialView",
|
|
12530
|
+
"values": [
|
|
12531
|
+
"list",
|
|
12532
|
+
"add"
|
|
12533
|
+
]
|
|
12534
|
+
}
|
|
12535
|
+
],
|
|
12536
|
+
"ownsBehaviours": [
|
|
12537
|
+
{
|
|
12538
|
+
"id": "portal",
|
|
12539
|
+
"behaviour": "Floats on top of the page"
|
|
12540
|
+
},
|
|
12541
|
+
{
|
|
12542
|
+
"id": "press-outside",
|
|
12543
|
+
"behaviour": "Closes on a press outside"
|
|
12544
|
+
},
|
|
12545
|
+
{
|
|
12546
|
+
"id": "page-keys",
|
|
12547
|
+
"behaviour": "Takes its keys by itself"
|
|
12548
|
+
},
|
|
12549
|
+
{
|
|
12550
|
+
"id": "focus",
|
|
12551
|
+
"behaviour": "Holds focus inside while open, and gives it back"
|
|
12552
|
+
},
|
|
12553
|
+
{
|
|
12554
|
+
"id": "scroll-lock",
|
|
12555
|
+
"behaviour": "Stops the page behind it scrolling"
|
|
12556
|
+
}
|
|
12557
|
+
],
|
|
12558
|
+
"status": "stable",
|
|
12559
|
+
"migrationStage": null,
|
|
12560
|
+
"docsId": "people-whofollowsdialog--docs",
|
|
12561
|
+
"storyId": "people-whofollowsdialog--default",
|
|
12562
|
+
"docPage": "src/WhoFollowsDialog.mdx",
|
|
12563
|
+
"app": null,
|
|
12564
|
+
"looks": []
|
|
12565
|
+
},
|
|
12288
12566
|
{
|
|
12289
12567
|
"name": "whoReacted",
|
|
12290
12568
|
"repo": "estiva-ui",
|
package/src/ConversationCard.mdx
CHANGED
|
@@ -65,6 +65,7 @@ import { ConversationCard } from '@estiva-app/ui'
|
|
|
65
65
|
- **A reaction answers**: `reactions.onToggle` returns the relay's answer, `{ accepted: false, reason }` with the reason as it came. The card says "Not reacted: *why*." under the reactions in `@estiva-app/conversation`'s plain words, until the next reaction on it or until it goes; only the latest reaction's answer is said. Hold no refusal of your own.
|
|
66
66
|
- **A refusal is said only in the question it answered.** Keep it in your own state and never clear it: a question opened again says nothing until its own press is refused.
|
|
67
67
|
- **Deleted** keeps its `about`: what it was on stays above "This comment was deleted.", for the replies under it.
|
|
68
|
+
- **Not shown** (`unseen`): a comment the read did not return, with no deletion by its author (SPEC §6.5). Drawn as **Deleted**, in its own words: "This comment can’t be shown." Never say it was deleted: it may only be outside the read.
|
|
68
69
|
- `time` is your words for it ("11:08 AM"); `at` is the moment (ms), from which the card says the exact date and time on hover. Never a tooltip of your own round `time`.
|
|
69
70
|
- A press on the card is `onClick` (its thread opens); a press on a button, a link or anything marked `data-interactive` inside it is not.
|
|
70
71
|
- The strip shows while the card is pointed at or has focus, and holds while its reactions or its menu are open. A head long enough to reach it (a narrow card, a time in words, "(edited)") fades out 8px before it; nothing in the head moves.
|
|
@@ -96,6 +96,9 @@ export const DeletedOnAPart: Story = {
|
|
|
96
96
|
render: (args) => <Live {...args} deleted about={<QuotedLine words="the words this comment was on" />} replies={{ count: 2, faces: [TWO, THREE], last: '11:40 AM' }} />,
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/** Not read, and nothing says it was deleted: drawn as a deleted one, never said to be deleted (SPEC §6.5, Miky, 6 November). */
|
|
100
|
+
export const NotShown: Story = { name: 'Not shown', render: (args) => <Live {...args} unseen replies={{ count: 1, faces: [TWO], last: '11:40 AM' }} /> }
|
|
101
|
+
|
|
99
102
|
/** Pictures and files under the words. */
|
|
100
103
|
export const WithFiles: Story = { name: 'Files', render: (args) => <Live {...args} files={<Files />} /> }
|
|
101
104
|
|
|
@@ -142,6 +142,28 @@ describe('ConversationCard', () => {
|
|
|
142
142
|
expect(screen.getByText('3 replies')).toBeTruthy()
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
+
// SPEC §6.5's "not returned" (Miky, 6 November): never said to be deleted, and closed as a deleted one is.
|
|
146
|
+
it('says a comment that was not read can’t be shown, never that it was deleted, and offers nothing on it', () => {
|
|
147
|
+
render(
|
|
148
|
+
<ConversationCard author={ONE} time="11:08 AM" unseen own onDelete={() => {}} onReply={() => {}} onResolve={() => {}} replies={{ count: 1 }}>
|
|
149
|
+
Words
|
|
150
|
+
</ConversationCard>,
|
|
151
|
+
)
|
|
152
|
+
expect(screen.getByText('This comment can’t be shown.')).toBeTruthy()
|
|
153
|
+
expect(screen.queryByText('This comment was deleted.')).toBeNull()
|
|
154
|
+
expect(screen.queryByText('Words')).toBeNull()
|
|
155
|
+
expect(screen.queryByRole('button', { name: 'More actions' })).toBeNull()
|
|
156
|
+
expect(screen.queryByRole('button', { name: /resolve/i })).toBeNull()
|
|
157
|
+
expect(screen.getByText('1 reply')).toBeTruthy()
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('a thread whose comment was not read pins "can’t be shown" above its replies, not the comment’s words', () => {
|
|
161
|
+
render(<PinnedComment author={ONE} time="Today at 11:08 AM" words="The comment" unseen />)
|
|
162
|
+
expect(screen.getByText('This comment can’t be shown.')).toBeTruthy()
|
|
163
|
+
expect(screen.queryByText('The comment')).toBeNull()
|
|
164
|
+
expect(screen.queryByText('This comment was deleted.')).toBeNull()
|
|
165
|
+
})
|
|
166
|
+
|
|
145
167
|
// Leaf's column kept it, and now every app does (Katerina, 3 November): the replies still talk about that place.
|
|
146
168
|
it('a deleted comment still says what it was on, above "This comment was deleted."', () => {
|
|
147
169
|
render(
|
package/src/ConversationCard.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import { ReactionRow, type ReactionRowProps } from './ReactionRow'
|
|
|
16
16
|
import { RepliesRow, type RepliesRowProps } from './RepliesRow'
|
|
17
17
|
import { ResolveDialog } from './ResolveDialog'
|
|
18
18
|
import { exactTime, InConversationItem, InThreadCard, momentOf, SHOWN_CLASSES, useFaceLine } from './threadCard'
|
|
19
|
+
import { goneWords } from './PinnedComment'
|
|
19
20
|
import { ToolbarButton } from './Toolbar'
|
|
20
21
|
import { WithTooltip } from './Tooltip'
|
|
21
22
|
import { UnreadDot } from './UnreadDot'
|
|
@@ -96,6 +97,11 @@ export interface ConversationEntryProps {
|
|
|
96
97
|
export interface ConversationCardProps extends ConversationEntryProps {
|
|
97
98
|
/** Deleted: "This comment was deleted.", and its replies stay. */
|
|
98
99
|
deleted?: boolean
|
|
100
|
+
/**
|
|
101
|
+
* Not read, and nothing says it was deleted (SPEC §6.5's "not returned"): "This comment can't be shown.", drawn as
|
|
102
|
+
* a deleted one is, and its replies stay (Miky, 6 November, ONE-9).
|
|
103
|
+
*/
|
|
104
|
+
unseen?: boolean
|
|
99
105
|
/** Its thread: how many replied, their faces, the last time, and whether one is new. Opening it is `onReply` or `onClick`. */
|
|
100
106
|
replies?: Omit<RepliesRowProps, 'urgent'>
|
|
101
107
|
/** Reply: offered on the strip. */
|
|
@@ -377,7 +383,9 @@ function useEditing(editing: boolean | undefined, onEditingChange: ((editing: bo
|
|
|
377
383
|
* The same card in every app, each in its own colours (the record that makes one conversation). Peek's, moved.
|
|
378
384
|
*/
|
|
379
385
|
export function ConversationCard(props: ConversationCardProps) {
|
|
380
|
-
const { author, about, files, reactions, isNew = false, urgent = false, own = false, editor, deleted = false, replies, onReply, resolved, noun = 'comment', onResolve, resolveHint, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, deleteRefused, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = 'More actions', className, children } = props
|
|
386
|
+
const { author, about, files, reactions, isNew = false, urgent = false, own = false, editor, deleted: isDeleted = false, unseen = false, replies, onReply, resolved, noun = 'comment', onResolve, resolveHint, resolveRefused, onReopen, selected, onClick, onDelete, deleteNote, deleteRefused, menu, menuAfter, menuLabel, editLabel, deleteLabel, moreLabel = 'More actions', className, children } = props
|
|
387
|
+
// Not shown is drawn as deleted, in its own words.
|
|
388
|
+
const deleted = isDeleted || unseen
|
|
381
389
|
const readOnly = (props.readOnly ?? false) || deleted
|
|
382
390
|
const inThreadCard = useContext(InThreadCard)
|
|
383
391
|
|
|
@@ -462,7 +470,7 @@ export function ConversationCard(props: ConversationCardProps) {
|
|
|
462
470
|
{/* What it was on stays, where the words start: its replies still talk about that place (Leaf's; Katerina, 3 November: every app). */}
|
|
463
471
|
{!!about && <div className="relative w-full pl-8 pr-2">{about}</div>}
|
|
464
472
|
{/* 4px under it, as the words sit under it on a comment that is there. */}
|
|
465
|
-
<p className={cn('w-full pb-2 pl-8 pr-2 text-caption italic text-text-muted', !!about && 'pt-1')}>
|
|
473
|
+
<p className={cn('w-full pb-2 pl-8 pr-2 text-caption italic text-text-muted', !!about && 'pt-1')}>{goneWords(isDeleted)}</p>
|
|
466
474
|
</>
|
|
467
475
|
) : (
|
|
468
476
|
<>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as FollowSwitchStories from './FollowSwitch.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={FollowSwitchStories} />
|
|
5
|
+
|
|
6
|
+
# FollowSwitch
|
|
7
|
+
|
|
8
|
+
How you follow a place, in one button before its title: Not following,
|
|
9
|
+
Important or All, and back to a group's default when you chose against it.
|
|
10
|
+
|
|
11
|
+
<Canvas of={FollowSwitchStories.Live} />
|
|
12
|
+
|
|
13
|
+
## When
|
|
14
|
+
|
|
15
|
+
- Before a place's title, where the viewer changes how it lights for them.
|
|
16
|
+
- **LevelIcon** alone, in a list of places, where each row shows the level but
|
|
17
|
+
is not the place to change it.
|
|
18
|
+
|
|
19
|
+
## When not
|
|
20
|
+
|
|
21
|
+
- Who else follows it, and adding someone → **WhoFollowsDialog**.
|
|
22
|
+
- Being in a thing or not, with no levels → **MembersDialog**'s Join and Leave.
|
|
23
|
+
|
|
24
|
+
## How
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { FollowSwitch, LevelIcon, type FollowChoice } from '@estiva-app/ui'
|
|
28
|
+
|
|
29
|
+
const level: 'all' | 'important' | undefined = 'important'
|
|
30
|
+
|
|
31
|
+
<FollowSwitch
|
|
32
|
+
level={level}
|
|
33
|
+
label="Item one"
|
|
34
|
+
onChoose={async (choice: FollowChoice) => {}}
|
|
35
|
+
backTo={undefined}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
<LevelIcon level={level} />
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- `level` is what lights for the viewer now; `undefined` is Not following.
|
|
42
|
+
The switch is controlled: it draws the `level` it is given, so pass the new
|
|
43
|
+
one once the change is saved.
|
|
44
|
+
- `onChoose` gets `'off'`, `'important'`, `'all'`, or `'default'` from "Back to
|
|
45
|
+
Group one’s default". The button waits while its promise runs. Leave it out where
|
|
46
|
+
the level cannot change: the button then shows it and is disabled.
|
|
47
|
+
- `backTo` is the name of the group whose default the viewer chose against.
|
|
48
|
+
Leave it out when no default reaches them or they did not choose against it.
|
|
49
|
+
- `people` draws people instead of circles, for a place that is a group's own.
|
|
50
|
+
- `label` is the place's name. The button's accessible name says the level and
|
|
51
|
+
what pressing it does: "You follow it at Important: change how you follow
|
|
52
|
+
Item one".
|
|
53
|
+
|
|
54
|
+
## What it owns
|
|
55
|
+
|
|
56
|
+
| It does | So you never write | Refused when written by hand |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| Marks the level in force with a check, and Not following when there is none | a selected state per row | |
|
|
59
|
+
| Waits while `onChoose` runs, so one pick is one change | a busy flag around it | |
|
|
60
|
+
| Offers "Back to `backTo`’s default" only when `backTo` is given | a second menu section | |
|
|
61
|
+
|
|
62
|
+
## Props
|
|
63
|
+
|
|
64
|
+
<Controls of={FollowSwitchStories.Important} />
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { FollowSwitch, LevelIcon, type FollowChoice, type FollowLevel } from './FollowSwitch'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'People/FollowSwitch',
|
|
7
|
+
component: FollowSwitch,
|
|
8
|
+
args: { level: 'important', label: 'Item one', onChoose: () => {} },
|
|
9
|
+
} satisfies Meta<typeof FollowSwitch>
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
/** Following at Important: a dashed circle. Open it to pick another level. */
|
|
15
|
+
export const Important: Story = {}
|
|
16
|
+
|
|
17
|
+
/** Following at All: a full circle. */
|
|
18
|
+
export const All: Story = { args: { level: 'all' } }
|
|
19
|
+
|
|
20
|
+
/** Not following: a dashed circle with a plus, muted. */
|
|
21
|
+
export const NotFollowing: Story = { args: { level: undefined } }
|
|
22
|
+
|
|
23
|
+
/** Chose against a group's default: "Back to Group one’s default" is offered under the levels. */
|
|
24
|
+
export const AgainstADefault: Story = { args: { level: 'all', backTo: 'Group one' } }
|
|
25
|
+
|
|
26
|
+
/** A group's own place: people rather than circles. */
|
|
27
|
+
export const People: Story = { args: { level: 'important', people: true } }
|
|
28
|
+
|
|
29
|
+
/** No `onChoose`: it shows the level and cannot be changed. */
|
|
30
|
+
export const ReadOnly: Story = { args: { level: undefined, onChoose: undefined } }
|
|
31
|
+
|
|
32
|
+
/** Every icon, as a list draws them: Not following, Important and All, in circles and in people. */
|
|
33
|
+
export const Icons: Story = {
|
|
34
|
+
render: () => (
|
|
35
|
+
<div className="flex flex-col gap-3 text-text-secondary">
|
|
36
|
+
{[false, true].map((people) => (
|
|
37
|
+
<div key={String(people)} className="flex items-center gap-4">
|
|
38
|
+
{([undefined, 'important', 'all'] as const).map((level) => (
|
|
39
|
+
<LevelIcon key={level ?? 'off'} level={level} people={people} />
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Live: pick a level and the icon follows. */
|
|
48
|
+
export const Live: Story = {
|
|
49
|
+
render: (args) => {
|
|
50
|
+
const [level, setLevel] = useState<FollowLevel | undefined>('important')
|
|
51
|
+
const choose = (choice: FollowChoice) => setLevel(choice === 'off' ? undefined : choice === 'default' ? 'important' : choice)
|
|
52
|
+
return <FollowSwitch {...args} level={level} onChoose={choose} />
|
|
53
|
+
},
|
|
54
|
+
}
|