@estiva-app/ui 0.104.2 → 0.105.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/ContainerHeader.d.ts.map +1 -1
- package/dist/ConversationCard.d.ts +8 -2
- package/dist/ConversationCard.d.ts.map +1 -1
- package/dist/ConversationLayout.d.ts +4 -1
- package/dist/ConversationLayout.d.ts.map +1 -1
- package/dist/MoveDialog.d.ts +2 -2
- package/dist/MoveDialog.d.ts.map +1 -1
- package/dist/index.js +75 -28
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/registry.json +6 -6
- package/src/ArchiveDialog.mdx +2 -2
- package/src/ArchiveDialog.stories.tsx +5 -5
- package/src/ContainerHeader.mdx +2 -0
- package/src/ContainerHeader.test.tsx +6 -0
- package/src/ContainerHeader.tsx +3 -1
- package/src/ConversationCard.mdx +4 -2
- package/src/ConversationCard.stories.tsx +14 -0
- package/src/ConversationCard.test.tsx +130 -2
- package/src/ConversationCard.tsx +128 -56
- package/src/ConversationLayout.mdx +4 -0
- package/src/ConversationLayout.tsx +4 -1
- package/src/FormDialog.mdx +3 -3
- package/src/FormDialog.stories.tsx +5 -5
- package/src/MoveDialog.mdx +16 -16
- package/src/MoveDialog.stories.tsx +22 -22
- package/src/MoveDialog.test.tsx +58 -48
- package/src/MoveDialog.tsx +8 -7
- package/src/PageHeader.mdx +1 -0
- package/src/ReplyCard.mdx +1 -0
|
@@ -67,7 +67,10 @@ export interface ConversationLayoutProps {
|
|
|
67
67
|
* it, it opens at the newest each time it is drawn. `useLeftAt` with the same name says when it was left, for a "New" line.
|
|
68
68
|
*/
|
|
69
69
|
rememberAs?: string
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* The comments' scrolling box, in both layouts: two columns' list, and one column's Panel body. Two columns, where it
|
|
72
|
+
* scrolls is the layout's: an app reads it, and keeps no place of its own in it.
|
|
73
|
+
*/
|
|
71
74
|
bodyRef?: Ref<HTMLDivElement>
|
|
72
75
|
/** Two columns: the comments' box scrolled. */
|
|
73
76
|
onBodyScroll?: UIEventHandler<HTMLDivElement>
|
package/src/FormDialog.mdx
CHANGED
|
@@ -13,7 +13,7 @@ the button that sends it, waiting together while it sends.
|
|
|
13
13
|
## When
|
|
14
14
|
|
|
15
15
|
- A dialog that asks for something and then does it: a name, a destination, a
|
|
16
|
-
resolution. New
|
|
16
|
+
resolution. New team, Rename team, Start a topic, Move, Archive.
|
|
17
17
|
- `ready` says when there is enough to send; until then the button is greyed and
|
|
18
18
|
Enter sends nothing.
|
|
19
19
|
- Nothing to choose from: give a section's **EmptyState** as the only child and
|
|
@@ -35,7 +35,7 @@ import { FormDialog, Field, TextInput } from '@estiva-app/ui'
|
|
|
35
35
|
|
|
36
36
|
{open && (
|
|
37
37
|
<FormDialog
|
|
38
|
-
title="New
|
|
38
|
+
title="New team"
|
|
39
39
|
submitLabel="Create"
|
|
40
40
|
busyLabel="Creating…"
|
|
41
41
|
ready={!!name.trim()}
|
|
@@ -43,7 +43,7 @@ import { FormDialog, Field, TextInput } from '@estiva-app/ui'
|
|
|
43
43
|
onClose={() => setOpen(false)}
|
|
44
44
|
>
|
|
45
45
|
<p className="text-body-2 text-text-secondary">A place for files and conversations.</p>
|
|
46
|
-
<Field label="
|
|
46
|
+
<Field label="Team name">
|
|
47
47
|
<TextInput value={name} onChange={(e) => setName(e.target.value)} autoFocus />
|
|
48
48
|
</Field>
|
|
49
49
|
</FormDialog>
|
|
@@ -17,7 +17,7 @@ const meta = {
|
|
|
17
17
|
},
|
|
18
18
|
argTypes: { children: { control: false }, onSubmit: { control: false }, onClose: { control: false } },
|
|
19
19
|
args: {
|
|
20
|
-
title: 'New
|
|
20
|
+
title: 'New team',
|
|
21
21
|
submitLabel: 'Create',
|
|
22
22
|
busyLabel: 'Creating…',
|
|
23
23
|
onSubmit: () => {},
|
|
@@ -31,14 +31,14 @@ type Story = StoryObj<typeof meta>
|
|
|
31
31
|
|
|
32
32
|
/** One field and the sentence before it. Create waits for a name; Enter in the field sends. */
|
|
33
33
|
export const NewFolder: Story = {
|
|
34
|
-
name: 'New
|
|
34
|
+
name: 'New team',
|
|
35
35
|
parameters: { controls: { disable: true } },
|
|
36
36
|
render: (args) => {
|
|
37
37
|
const [name, setName] = useState('')
|
|
38
38
|
return (
|
|
39
39
|
<FormDialog {...args} ready={!!name.trim()}>
|
|
40
40
|
<p className="text-body-2 text-text-secondary">A place for files and conversations. Everyone you add to it can read what is in it.</p>
|
|
41
|
-
<Field label="
|
|
41
|
+
<Field label="Team name">
|
|
42
42
|
<TextInput value={name} onChange={(event) => setName(event.target.value)} placeholder="What is it for?" autoFocus />
|
|
43
43
|
</Field>
|
|
44
44
|
</FormDialog>
|
|
@@ -53,7 +53,7 @@ export const Sending: Story = {
|
|
|
53
53
|
render: NewFolder.render,
|
|
54
54
|
play: async ({ canvasElement }) => {
|
|
55
55
|
const page = within(canvasElement.ownerDocument.body)
|
|
56
|
-
await userEvent.type(page.getByRole('textbox', { name: '
|
|
56
|
+
await userEvent.type(page.getByRole('textbox', { name: 'Team name' }), 'Steer')
|
|
57
57
|
await userEvent.click(page.getByRole('button', { name: 'Create' }))
|
|
58
58
|
},
|
|
59
59
|
}
|
|
@@ -69,7 +69,7 @@ export const Refused: Story = {
|
|
|
69
69
|
/** Nothing to choose from: a section's empty line where the fields would be, and the button greyed. */
|
|
70
70
|
export const NothingToChoose: Story = {
|
|
71
71
|
name: 'Nothing to choose',
|
|
72
|
-
args: { title: 'Move', submitLabel: 'Move', busyLabel: 'Moving…', ready: false, children: <EmptyState scope="section" message="There is no other
|
|
72
|
+
args: { title: 'Move', submitLabel: 'Move', busyLabel: 'Moving…', ready: false, children: <EmptyState scope="section" message="There is no other team it can be moved to." /> },
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/** A Resolve: the kit's `resolve` look on the sending button, as `ResolveDialog` draws it. */
|
package/src/MoveDialog.mdx
CHANGED
|
@@ -5,20 +5,20 @@ import * as MoveDialogStories from './MoveDialog.stories'
|
|
|
5
5
|
|
|
6
6
|
# MoveDialog
|
|
7
7
|
|
|
8
|
-
Move a file to another
|
|
9
|
-
first, then what it goes under, read when the
|
|
8
|
+
Move a file to another team, under another file there, or both: the team
|
|
9
|
+
first, then what it goes under, read when the team is picked.
|
|
10
10
|
|
|
11
11
|
<Canvas of={MoveDialogStories.Topic} />
|
|
12
12
|
|
|
13
13
|
## When
|
|
14
14
|
|
|
15
|
-
- Moving any file, from its menu, its row or its
|
|
15
|
+
- Moving any file, from its menu, its row or its team. A file that may sit
|
|
16
16
|
under another passes `placesIn`; one that nests under nothing passes none, and
|
|
17
|
-
is asked only for the
|
|
18
|
-
- A file that may sit at the top of any
|
|
17
|
+
is asked only for the team.
|
|
18
|
+
- A file that may sit at the top of any team: `startAtTop`, so the top is
|
|
19
19
|
chosen for the person. Otherwise Move waits for a pick: a preselected place is
|
|
20
20
|
a move nobody chose.
|
|
21
|
-
- A file not listed in exactly one
|
|
21
|
+
- A file not listed in exactly one team: `from=""`, and no team is held
|
|
22
22
|
back. Listed in none; or in two after a move that half-worked, where moving
|
|
23
23
|
into either takes it out of the other, so Move again is the retry. Nothing is
|
|
24
24
|
chosen for the person even so; `startIn` opens it on one.
|
|
@@ -29,7 +29,7 @@ first, then what it goes under, read when the Folder is picked.
|
|
|
29
29
|
|
|
30
30
|
## When not
|
|
31
31
|
|
|
32
|
-
- Renaming, or choosing a
|
|
32
|
+
- Renaming, or choosing a team for something new → **FormDialog** with a **Select**.
|
|
33
33
|
- One value from a list on a page, not a move → **Select**.
|
|
34
34
|
|
|
35
35
|
## How
|
|
@@ -52,23 +52,23 @@ import { MoveDialog } from '@estiva-app/ui'
|
|
|
52
52
|
|
|
53
53
|
- A place is `{ id, path }`: `id` is what it goes under, its address, and `''`
|
|
54
54
|
for the top; `path` is its breadcrumb, drawn as "Brief › Notes".
|
|
55
|
-
- `placesIn` is called once per
|
|
55
|
+
- `placesIn` is called once per team, when it is picked; a rejection is said as
|
|
56
56
|
the section's empty line, with **Try again**. `places` are the ones in `from`,
|
|
57
|
-
already read; without them the
|
|
57
|
+
already read; without them the team it opens on is read at once.
|
|
58
58
|
- `onMove` gets `{ folder }`, and `parent` too when it nests (`''` for the top).
|
|
59
59
|
Answer `false` to keep it open once you have said why.
|
|
60
60
|
- `folders` undefined while they are read: the list says "Reading…".
|
|
61
61
|
- `heading`, `folderLabel`, `noFolder` and `topLabel` are for your app's words;
|
|
62
|
-
`startIn` opens it on another
|
|
62
|
+
`startIn` opens it on another team than the one it is in. An app that
|
|
63
63
|
chooses one for the person holds its `startIn` steady while the dialog is
|
|
64
64
|
open: a refusal that changes where the file is listed must not move it.
|
|
65
|
-
- Pass only the
|
|
66
|
-
app's own rules (a
|
|
65
|
+
- Pass only the teams a move can land in: filter `folders` before, by your
|
|
66
|
+
app's own rules (a team that cannot take it). A move your app refuses when
|
|
67
67
|
it is made is answered with `false`, said why, and the dialog stays.
|
|
68
|
-
- `check` adds one box under the choice that only some
|
|
68
|
+
- `check` adds one box under the choice that only some teams ask:
|
|
69
69
|
`label(folder)` gives its words there, or `undefined` to leave it out;
|
|
70
70
|
`checked` ticks it at open. `onMove` then gets `checked`, only when the box
|
|
71
|
-
was shown for the
|
|
71
|
+
was shown for the team picked.
|
|
72
72
|
|
|
73
73
|
<Canvas of={MoveDialogStories.WithABox} />
|
|
74
74
|
|
|
@@ -82,8 +82,8 @@ import { MoveDialog } from '@estiva-app/ui'
|
|
|
82
82
|
|
|
83
83
|
| It does | So you never write | Refused when written by hand |
|
|
84
84
|
|---|---|---|
|
|
85
|
-
| Reads a
|
|
86
|
-
| Offers only moves that do something, and chooses nothing for the person but the top when asked | a filter on the
|
|
85
|
+
| Reads a team's places when it is picked, once, and says when it could not, with Try again | a read state per team, or a retry row | |
|
|
86
|
+
| Offers only moves that do something, and chooses nothing for the person but the top when asked | a filter on the teams, or a preselection | |
|
|
87
87
|
| Sends on Move, says it is moving, and closes when the move went through | a busy state, or an `if (ok) onClose()` | |
|
|
88
88
|
|
|
89
89
|
## Props
|
|
@@ -12,8 +12,8 @@ const PROJECT: MovePlace = { id: '30850:a:folders', path: ['Folders: navigation
|
|
|
12
12
|
const BRIEF: MovePlace = { id: '30840:a:brief', path: ['Folders: navigation for the whole suite', 'Brief'] }
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Moving a file to another
|
|
16
|
-
* its own
|
|
15
|
+
* Moving a file to another team, under another file, or both. The places in
|
|
16
|
+
* its own team are the caller's, read before it opens; another team's are
|
|
17
17
|
* read when it is picked.
|
|
18
18
|
*/
|
|
19
19
|
const meta = {
|
|
@@ -42,34 +42,34 @@ type Story = StoryObj<typeof meta>
|
|
|
42
42
|
|
|
43
43
|
const pickSteer = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
44
44
|
const page = within(canvasElement.ownerDocument.body)
|
|
45
|
-
await userEvent.click(page.getByRole('combobox', { name: '
|
|
45
|
+
await userEvent.click(page.getByRole('combobox', { name: 'Team' }))
|
|
46
46
|
await userEvent.click(await page.findByRole('option', { name: 'Steer' }))
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/** A file that may sit under any other: its own
|
|
49
|
+
/** A file that may sit under any other: its own team first, at the top, with every other place there. */
|
|
50
50
|
export const Topic: Story = {}
|
|
51
51
|
|
|
52
|
-
/** A file that nests under nothing: only the
|
|
52
|
+
/** A file that nests under nothing: only the team is asked, and not the one it is in. Move waits for a pick. */
|
|
53
53
|
export const Project: Story = {
|
|
54
54
|
args: { title: 'Folders: navigation for the whole suite', places: undefined, placesIn: undefined },
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/** Nowhere to go in its own
|
|
57
|
+
/** Nowhere to go in its own team: one holding only this file and what is under it. */
|
|
58
58
|
export const NowhereHere: Story = {
|
|
59
59
|
name: 'Nowhere here',
|
|
60
60
|
args: { places: [] },
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/** Another
|
|
63
|
+
/** Another team could not be read: the section's empty line, with Try again. */
|
|
64
64
|
export const FolderUnreadable: Story = {
|
|
65
|
-
name: '
|
|
65
|
+
name: 'Team unreadable',
|
|
66
66
|
args: { places: [], placesIn: (): Promise<readonly MovePlace[]> => Promise.reject(new Error('down')) },
|
|
67
67
|
play: pickSteer,
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/** Another
|
|
70
|
+
/** Another team, still being read: the second list says so and waits. */
|
|
71
71
|
export const ReadingAFolder: Story = {
|
|
72
|
-
name: 'Reading a
|
|
72
|
+
name: 'Reading a team',
|
|
73
73
|
args: { placesIn: () => new Promise<readonly MovePlace[]>(() => {}) },
|
|
74
74
|
play: pickSteer,
|
|
75
75
|
}
|
|
@@ -80,26 +80,26 @@ export const UnderNone: Story = {
|
|
|
80
80
|
args: { startAtTop: false, topLabel: 'None — under none of these', places: [TOP, PROJECT] },
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
/** The
|
|
83
|
+
/** The teams are still being read: the list says so. */
|
|
84
84
|
export const ReadingFolders: Story = {
|
|
85
85
|
name: 'Reading folders',
|
|
86
86
|
args: { folders: undefined },
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/** No
|
|
89
|
+
/** No team to offer: said in the dialog's body, and Move stays greyed. */
|
|
90
90
|
export const NoOtherFolder: Story = {
|
|
91
|
-
name: 'No other
|
|
91
|
+
name: 'No other team',
|
|
92
92
|
args: { folders: [FOLDERS[0]], places: undefined, placesIn: undefined },
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
/** Another app's words, opening on the
|
|
95
|
+
/** Another app's words, opening on the team the app chose. */
|
|
96
96
|
export const AnotherAppsWords: Story = {
|
|
97
97
|
name: 'Another app’s words',
|
|
98
98
|
args: {
|
|
99
|
-
heading: 'Move to
|
|
100
|
-
folderLabel: 'Destination
|
|
101
|
-
noFolder: 'There is no other
|
|
102
|
-
description: 'Only the
|
|
99
|
+
heading: 'Move to team',
|
|
100
|
+
folderLabel: 'Destination team',
|
|
101
|
+
noFolder: 'There is no other team it can be moved to.',
|
|
102
|
+
description: 'Only the team it is listed in changes. Its issues and its conversation stay exactly as they are.',
|
|
103
103
|
title: 'Folders: navigation for the whole suite',
|
|
104
104
|
places: undefined,
|
|
105
105
|
placesIn: undefined,
|
|
@@ -108,19 +108,19 @@ export const AnotherAppsWords: Story = {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
* A file listed in two
|
|
111
|
+
* A file listed in two teams, after a move that half-worked: `from` is empty, so every team is offered, the ones
|
|
112
112
|
* it is in too, since moving into one takes it out of the other; Move again is the retry. Nothing is chosen for the
|
|
113
113
|
* person. The story opens the list.
|
|
114
114
|
*/
|
|
115
115
|
export const ListedTwice: Story = {
|
|
116
|
-
name: 'Listed in two
|
|
116
|
+
name: 'Listed in two teams',
|
|
117
117
|
args: { title: 'Folders: navigation for the whole suite', from: '', places: undefined, placesIn: undefined },
|
|
118
118
|
play: async ({ canvasElement }) => {
|
|
119
|
-
await userEvent.click(within(canvasElement.ownerDocument.body).getByRole('combobox', { name: '
|
|
119
|
+
await userEvent.click(within(canvasElement.ownerDocument.body).getByRole('combobox', { name: 'Team' }))
|
|
120
120
|
},
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
/** A box only some
|
|
123
|
+
/** A box only some teams ask, ticked as it opened: here Steer asks it and Estiva HQ does not. The story picks Steer. */
|
|
124
124
|
export const WithABox: Story = {
|
|
125
125
|
name: 'With a box',
|
|
126
126
|
args: {
|
package/src/MoveDialog.test.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @vitest-environment jsdom
|
|
2
2
|
/**
|
|
3
|
-
* Move a file to another
|
|
3
|
+
* Move a file to another team, under another file, or both (FOL-45): Peek's
|
|
4
4
|
* MoveDialog, moved into the kit (C11, 2 November) with Peek's tests, and
|
|
5
|
-
* what Leaf's and Ship's moves need beside them. A
|
|
5
|
+
* what Leaf's and Ship's moves need beside them. A team that could not be
|
|
6
6
|
* read is said as the section's empty line with its Try again (B8).
|
|
7
7
|
*/
|
|
8
8
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
@@ -44,16 +44,16 @@ const pick = async (name: string, option: string) => {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
describe('MoveDialog (FOL-45, Peek’s tests)', () => {
|
|
47
|
-
it('opens on the
|
|
47
|
+
it('opens on the team the file is in, with only real moves there', async () => {
|
|
48
48
|
render(<Fixture places={[BRIEF]} />)
|
|
49
49
|
expect(await optionsOf('Put it under')).toEqual(['Brief'])
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
it('reads another
|
|
52
|
+
it('reads another team when it is picked, and moves to its top by default', async () => {
|
|
53
53
|
const placesIn = vi.fn(async () => [TOP, BRIEF])
|
|
54
54
|
const onMove = vi.fn(async () => true)
|
|
55
55
|
render(<Fixture startAtTop placesIn={placesIn} onMove={onMove} />)
|
|
56
|
-
await pick('
|
|
56
|
+
await pick('Team', 'Steer')
|
|
57
57
|
expect(placesIn).toHaveBeenCalledWith('steer')
|
|
58
58
|
expect(await optionsOf('Put it under')).toEqual(['The top of Steer', 'Brief'])
|
|
59
59
|
await userEvent.keyboard('{Escape}')
|
|
@@ -61,13 +61,13 @@ describe('MoveDialog (FOL-45, Peek’s tests)', () => {
|
|
|
61
61
|
await waitFor(() => expect(onMove).toHaveBeenCalledWith({ folder: 'steer', parent: '' }))
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
it('asks a file that nests under nothing only for the
|
|
64
|
+
it('asks a file that nests under nothing only for the team, never offers the one it is in, and waits for a pick', async () => {
|
|
65
65
|
const onMove = vi.fn(async () => true)
|
|
66
66
|
render(<Fixture places={undefined} placesIn={undefined} onMove={onMove} />)
|
|
67
67
|
expect(screen.queryByRole('combobox', { name: 'Put it under' })).toBeNull()
|
|
68
68
|
// Nothing preselected: a Move pressed straight away would be a move nobody chose.
|
|
69
69
|
expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(true)
|
|
70
|
-
expect(await optionsOf('
|
|
70
|
+
expect(await optionsOf('Team')).toEqual(['Steer'])
|
|
71
71
|
await userEvent.click(await screen.findByRole('option', { name: 'Steer' }))
|
|
72
72
|
await userEvent.click(screen.getByRole('button', { name: 'Move' }))
|
|
73
73
|
await waitFor(() => expect(onMove).toHaveBeenCalledWith({ folder: 'steer' }))
|
|
@@ -76,7 +76,7 @@ describe('MoveDialog (FOL-45, Peek’s tests)', () => {
|
|
|
76
76
|
it('never picks a parent for a file whose parent is one kind: Move waits until the person does', async () => {
|
|
77
77
|
const onMove = vi.fn(async () => true)
|
|
78
78
|
render(<Fixture placesIn={async () => [LIVE]} onMove={onMove} />)
|
|
79
|
-
await pick('
|
|
79
|
+
await pick('Team', 'Steer')
|
|
80
80
|
await screen.findByRole('combobox', { name: 'Put it under' })
|
|
81
81
|
await waitFor(() => expect(screen.getByRole('combobox', { name: 'Put it under' }).hasAttribute('data-disabled')).toBe(false))
|
|
82
82
|
expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(true)
|
|
@@ -85,17 +85,17 @@ describe('MoveDialog (FOL-45, Peek’s tests)', () => {
|
|
|
85
85
|
await waitFor(() => expect(onMove).toHaveBeenCalledWith({ folder: 'steer', parent: LIVE.id }))
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
it('says so when the picked
|
|
88
|
+
it('says so when the picked team has nowhere to put it, and does not move', async () => {
|
|
89
89
|
render(<Fixture placesIn={async () => []} />)
|
|
90
|
-
await pick('
|
|
90
|
+
await pick('Team', 'Steer')
|
|
91
91
|
expect(await screen.findByText('There is nowhere in Steer to put it.')).toBeTruthy()
|
|
92
92
|
expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(true)
|
|
93
93
|
})
|
|
94
94
|
|
|
95
|
-
it('says a
|
|
95
|
+
it('says a team that could not be read, and reads it again on Try again', async () => {
|
|
96
96
|
const placesIn = vi.fn().mockRejectedValueOnce(new Error('down')).mockResolvedValueOnce([TOP])
|
|
97
97
|
render(<Fixture placesIn={placesIn} />)
|
|
98
|
-
await pick('
|
|
98
|
+
await pick('Team', 'Steer')
|
|
99
99
|
expect(await screen.findByText('Steer could not be read.')).toBeTruthy()
|
|
100
100
|
expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(true)
|
|
101
101
|
await userEvent.click(screen.getByRole('button', { name: 'Try again' }))
|
|
@@ -104,9 +104,9 @@ describe('MoveDialog (FOL-45, Peek’s tests)', () => {
|
|
|
104
104
|
})
|
|
105
105
|
|
|
106
106
|
describe('MoveDialog, the kit’s', () => {
|
|
107
|
-
it('says a
|
|
107
|
+
it('says a team that could not be read as the empty line beside it does, with its Try again (B8)', async () => {
|
|
108
108
|
render(<Fixture placesIn={async () => Promise.reject(new Error('down'))} />)
|
|
109
|
-
await pick('
|
|
109
|
+
await pick('Team', 'Steer')
|
|
110
110
|
const line = await screen.findByText('Steer could not be read.')
|
|
111
111
|
const empty = screen.getByText((_, element) => element?.tagName === 'P' && element.textContent === 'Steer could not be read.')
|
|
112
112
|
expect(empty).toBe(line)
|
|
@@ -115,16 +115,16 @@ describe('MoveDialog, the kit’s', () => {
|
|
|
115
115
|
expect(line.nextElementSibling).toBe(screen.getByRole('button', { name: 'Try again' }))
|
|
116
116
|
})
|
|
117
117
|
|
|
118
|
-
it('reads two picks of one
|
|
118
|
+
it('reads two picks of one team once', async () => {
|
|
119
119
|
const placesIn = vi.fn(() => new Promise<MovePlace[]>(() => {}))
|
|
120
120
|
render(<Fixture placesIn={placesIn} />)
|
|
121
|
-
await pick('
|
|
122
|
-
await pick('
|
|
123
|
-
await pick('
|
|
121
|
+
await pick('Team', 'Steer')
|
|
122
|
+
await pick('Team', 'Estiva HQ')
|
|
123
|
+
await pick('Team', 'Steer')
|
|
124
124
|
expect(placesIn).toHaveBeenCalledTimes(1)
|
|
125
125
|
})
|
|
126
126
|
|
|
127
|
-
it('reads the
|
|
127
|
+
it('reads the team it opens on when its places were not handed in', async () => {
|
|
128
128
|
const placesIn = vi.fn(async () => [TOP])
|
|
129
129
|
render(<Fixture places={undefined} placesIn={placesIn} startAtTop />)
|
|
130
130
|
await waitFor(() => expect(placesIn).toHaveBeenCalledWith('hq'))
|
|
@@ -142,41 +142,51 @@ describe('MoveDialog, the kit’s', () => {
|
|
|
142
142
|
expect(await optionsOf('Put it under')).toEqual(['None — under none of these', 'A live project'])
|
|
143
143
|
})
|
|
144
144
|
|
|
145
|
-
it('while the
|
|
145
|
+
it('while the teams are still read, says so in the list, and does not say there is nowhere to go (Leaf’s)', () => {
|
|
146
146
|
render(<Fixture folders={undefined} />)
|
|
147
|
-
expect(screen.queryByText('There is no other
|
|
148
|
-
expect(screen.getByRole('combobox', { name: '
|
|
147
|
+
expect(screen.queryByText('There is no other team it can be moved to.')).toBeNull()
|
|
148
|
+
expect(screen.getByRole('combobox', { name: 'Team' }).textContent).toContain('Reading…')
|
|
149
149
|
})
|
|
150
150
|
|
|
151
|
-
it('
|
|
151
|
+
it('asks the person to pick a team before one is chosen', () => {
|
|
152
|
+
render(<Fixture places={undefined} placesIn={undefined} />)
|
|
153
|
+
expect(screen.getByRole('combobox', { name: 'Team' }).textContent).toContain('Pick a team')
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('says “This team” when a team with no name could not be read', async () => {
|
|
157
|
+
render(<Fixture folders={[HQ, { id: 'unnamed', name: '' }]} startIn="unnamed" placesIn={async () => Promise.reject(new Error('down'))} />)
|
|
158
|
+
expect(await screen.findByText('This team could not be read.')).toBeTruthy()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it('says there is no other team when none is offered', () => {
|
|
152
162
|
render(<Fixture folders={[HQ]} places={undefined} placesIn={undefined} />)
|
|
153
|
-
expect(screen.getByText('There is no other
|
|
163
|
+
expect(screen.getByText('There is no other team it can be moved to.')).toBeTruthy()
|
|
154
164
|
expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(true)
|
|
155
165
|
})
|
|
156
166
|
|
|
157
|
-
it('takes another app’s words, and opens on the
|
|
167
|
+
it('takes another app’s words, and opens on the team it is given (Ship’s Move to team)', async () => {
|
|
158
168
|
const onMove = vi.fn(async () => true)
|
|
159
169
|
render(
|
|
160
170
|
<Fixture
|
|
161
|
-
heading="Move to
|
|
162
|
-
folderLabel="Destination
|
|
163
|
-
description="Only the
|
|
171
|
+
heading="Move to team"
|
|
172
|
+
folderLabel="Destination team"
|
|
173
|
+
description="Only the team it is listed in changes."
|
|
164
174
|
places={undefined}
|
|
165
175
|
placesIn={undefined}
|
|
166
176
|
startIn="steer"
|
|
167
177
|
onMove={onMove}
|
|
168
178
|
/>,
|
|
169
179
|
)
|
|
170
|
-
expect(screen.getByRole('dialog', { name: 'Move to
|
|
171
|
-
expect(screen.getByText('Only the
|
|
172
|
-
expect(screen.getByRole('combobox', { name: 'Destination
|
|
180
|
+
expect(screen.getByRole('dialog', { name: 'Move to team' })).toBeTruthy()
|
|
181
|
+
expect(screen.getByText('Only the team it is listed in changes.')).toBeTruthy()
|
|
182
|
+
expect(screen.getByRole('combobox', { name: 'Destination team' }).textContent).toContain('Steer')
|
|
173
183
|
await userEvent.click(screen.getByRole('button', { name: 'Move' }))
|
|
174
184
|
await waitFor(() => expect(onMove).toHaveBeenCalledWith({ folder: 'steer' }))
|
|
175
185
|
})
|
|
176
186
|
|
|
177
|
-
it('says no other
|
|
178
|
-
render(<Fixture folders={[HQ]} placesIn={undefined} noFolder="There is no other
|
|
179
|
-
expect(screen.getByText('There is no other
|
|
187
|
+
it('says no other team in the app’s words', () => {
|
|
188
|
+
render(<Fixture folders={[HQ]} placesIn={undefined} noFolder="There is no other team it can be moved to." />)
|
|
189
|
+
expect(screen.getByText('There is no other team it can be moved to.')).toBeTruthy()
|
|
180
190
|
})
|
|
181
191
|
|
|
182
192
|
it('stays open when the move is refused, and closes when it went through', async () => {
|
|
@@ -202,13 +212,13 @@ describe('MoveDialog, the kit’s', () => {
|
|
|
202
212
|
})
|
|
203
213
|
})
|
|
204
214
|
|
|
205
|
-
describe('MoveDialog, a file not listed in exactly one
|
|
215
|
+
describe('MoveDialog, a file not listed in exactly one team (`from` empty; Ship’s move, 2 November)', () => {
|
|
206
216
|
const THIRD = { id: 'third', name: 'Third' }
|
|
207
217
|
const flat = { places: undefined, placesIn: undefined, from: '' }
|
|
208
218
|
|
|
209
|
-
it('holds no
|
|
219
|
+
it('holds no team back: listed in two after a move that half-worked, or in none, every team is offered', async () => {
|
|
210
220
|
render(<Fixture {...flat} folders={[HQ, STEER, THIRD]} />)
|
|
211
|
-
expect(await optionsOf('
|
|
221
|
+
expect(await optionsOf('Team')).toEqual(['Estiva HQ', 'Steer', 'Third'])
|
|
212
222
|
})
|
|
213
223
|
|
|
214
224
|
it('chooses nothing for the person even so: Move waits for a pick, or it opens on startIn', async () => {
|
|
@@ -216,13 +226,13 @@ describe('MoveDialog, a file not listed in exactly one Folder (`from` empty; Shi
|
|
|
216
226
|
expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(true)
|
|
217
227
|
cleanup()
|
|
218
228
|
render(<Fixture {...flat} folders={[HQ, STEER, THIRD]} startIn="third" />)
|
|
219
|
-
expect(screen.getByRole('combobox', { name: '
|
|
229
|
+
expect(screen.getByRole('combobox', { name: 'Team' }).textContent).toContain('Third')
|
|
220
230
|
})
|
|
221
231
|
|
|
222
|
-
it('stays open on a refusal, and Move again is the retry, to the same
|
|
232
|
+
it('stays open on a refusal, and Move again is the retry, to the same team', async () => {
|
|
223
233
|
const onMove = vi.fn(async () => false)
|
|
224
234
|
render(<Fixture {...flat} folders={[HQ, STEER, THIRD]} onMove={onMove} />)
|
|
225
|
-
await pick('
|
|
235
|
+
await pick('Team', 'Steer')
|
|
226
236
|
await userEvent.click(screen.getByRole('button', { name: 'Move' }))
|
|
227
237
|
await waitFor(() => expect(onMove).toHaveBeenCalledTimes(1))
|
|
228
238
|
await waitFor(() => expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(false))
|
|
@@ -231,13 +241,13 @@ describe('MoveDialog, a file not listed in exactly one Folder (`from` empty; Shi
|
|
|
231
241
|
expect(onMove).toHaveBeenLastCalledWith({ folder: 'steer' })
|
|
232
242
|
})
|
|
233
243
|
|
|
234
|
-
it('asks the box only for the
|
|
244
|
+
it('asks the box only for the teams that name it, ticked as it opened, and says what it answered', async () => {
|
|
235
245
|
const onMove = vi.fn(async () => true)
|
|
236
246
|
const check = { label: (folder: string) => (folder === 'steer' ? 'Keep it a space in Steer' : undefined), checked: true }
|
|
237
247
|
render(<Fixture {...flat} folders={[HQ, STEER, THIRD]} check={check} onMove={onMove} />)
|
|
238
|
-
await pick('
|
|
248
|
+
await pick('Team', 'Third')
|
|
239
249
|
expect(screen.queryByRole('checkbox')).toBeNull()
|
|
240
|
-
await pick('
|
|
250
|
+
await pick('Team', 'Steer')
|
|
241
251
|
const box = screen.getByRole('checkbox', { name: 'Keep it a space in Steer' })
|
|
242
252
|
expect(box.getAttribute('aria-checked')).toBe('true')
|
|
243
253
|
await userEvent.click(box)
|
|
@@ -245,13 +255,13 @@ describe('MoveDialog, a file not listed in exactly one Folder (`from` empty; Shi
|
|
|
245
255
|
await waitFor(() => expect(onMove).toHaveBeenCalledWith({ folder: 'steer', checked: false }))
|
|
246
256
|
})
|
|
247
257
|
|
|
248
|
-
it('a
|
|
258
|
+
it('a team that does not ask the box moves with no answer for it, even after another team showed it ticked', async () => {
|
|
249
259
|
const onMove = vi.fn(async (_choice: MoveChoice) => true)
|
|
250
260
|
const check = { label: (folder: string) => (folder === 'steer' ? 'Keep it a space in Steer' : undefined), checked: true }
|
|
251
261
|
render(<Fixture {...flat} folders={[HQ, STEER, THIRD]} check={check} onMove={onMove} />)
|
|
252
|
-
await pick('
|
|
262
|
+
await pick('Team', 'Steer')
|
|
253
263
|
expect(screen.getByRole('checkbox', { name: 'Keep it a space in Steer' }).getAttribute('aria-checked')).toBe('true')
|
|
254
|
-
await pick('
|
|
264
|
+
await pick('Team', 'Third')
|
|
255
265
|
expect(screen.queryByRole('checkbox')).toBeNull()
|
|
256
266
|
await userEvent.click(screen.getByRole('button', { name: 'Move' }))
|
|
257
267
|
await waitFor(() => expect(onMove).toHaveBeenCalledTimes(1))
|
|
@@ -263,7 +273,7 @@ describe('MoveDialog, a file not listed in exactly one Folder (`from` empty; Shi
|
|
|
263
273
|
const onMove = vi.fn(async () => true)
|
|
264
274
|
const check = { label: (folder: string) => (folder === 'steer' ? 'Keep it a space in Steer' : undefined), checked: true }
|
|
265
275
|
render(<Fixture startAtTop placesIn={vi.fn(async () => [TOP])} check={check} onMove={onMove} />)
|
|
266
|
-
await pick('
|
|
276
|
+
await pick('Team', 'Steer')
|
|
267
277
|
expect(screen.getByRole('checkbox', { name: 'Keep it a space in Steer' }).getAttribute('aria-checked')).toBe('true')
|
|
268
278
|
await waitFor(() => expect((screen.getByRole('button', { name: 'Move' }) as HTMLButtonElement).disabled).toBe(false))
|
|
269
279
|
await userEvent.click(screen.getByRole('button', { name: 'Move' }))
|
|
@@ -273,6 +283,6 @@ describe('MoveDialog, a file not listed in exactly one Folder (`from` empty; Shi
|
|
|
273
283
|
it('listed in one again (`from` named), the one it is in is held back once more', async () => {
|
|
274
284
|
const { rerender } = render(<Fixture {...flat} folders={[HQ, STEER, THIRD]} />)
|
|
275
285
|
rerender(<Fixture {...flat} from="hq" folders={[HQ, STEER, THIRD]} />)
|
|
276
|
-
expect(await optionsOf('
|
|
286
|
+
expect(await optionsOf('Team')).toEqual(['Steer', 'Third'])
|
|
277
287
|
})
|
|
278
288
|
})
|
package/src/MoveDialog.tsx
CHANGED
|
@@ -74,9 +74,9 @@ export interface MoveDialogProps {
|
|
|
74
74
|
startIn?: string
|
|
75
75
|
/** The dialog's heading. "Move" when absent. */
|
|
76
76
|
heading?: string
|
|
77
|
-
/** The
|
|
77
|
+
/** The team field's label. "Team" when absent. */
|
|
78
78
|
folderLabel?: string
|
|
79
|
-
/** Said when no
|
|
79
|
+
/** Said when no team is offered. "There is no other team it can be moved to." when absent. */
|
|
80
80
|
noFolder?: string
|
|
81
81
|
/** A box under the choice, asked only where `label` names it; its answer comes back as `checked`. */
|
|
82
82
|
check?: MoveCheck
|
|
@@ -96,8 +96,8 @@ export function MoveDialog({
|
|
|
96
96
|
topLabel,
|
|
97
97
|
startIn,
|
|
98
98
|
heading = 'Move',
|
|
99
|
-
folderLabel = '
|
|
100
|
-
noFolder = 'There is no other
|
|
99
|
+
folderLabel = 'Team',
|
|
100
|
+
noFolder = 'There is no other team it can be moved to.',
|
|
101
101
|
check,
|
|
102
102
|
onMove,
|
|
103
103
|
onClose,
|
|
@@ -139,7 +139,8 @@ export function MoveDialog({
|
|
|
139
139
|
setPicked(undefined)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
const
|
|
142
|
+
const chosenName = destinations?.find((candidate) => candidate.id === folder)?.name
|
|
143
|
+
const folderName = chosenName || 'this team'
|
|
143
144
|
const status = nests && folder ? read[folder] : undefined
|
|
144
145
|
const targets = Array.isArray(status) ? (status as readonly MovePlace[]) : []
|
|
145
146
|
const valueOf = (place: MovePlace) => place.id || TOP
|
|
@@ -171,14 +172,14 @@ export function MoveDialog({
|
|
|
171
172
|
value={folder}
|
|
172
173
|
onChange={chooseFolder}
|
|
173
174
|
options={(destinations ?? []).map((candidate) => ({ value: candidate.id, label: candidate.name }))}
|
|
174
|
-
placeholder={destinations ? 'Pick a
|
|
175
|
+
placeholder={destinations ? 'Pick a team' : 'Reading…'}
|
|
175
176
|
ariaLabel={folderLabel}
|
|
176
177
|
/>
|
|
177
178
|
</Field>
|
|
178
179
|
{nests &&
|
|
179
180
|
folder &&
|
|
180
181
|
(status === 'failed' ? (
|
|
181
|
-
<EmptyState scope="section" message={`${
|
|
182
|
+
<EmptyState scope="section" message={`${chosenName || 'This team'} could not be read.`} action={{ label: 'Try again', onClick: () => readPlaces(folder) }} />
|
|
182
183
|
) : Array.isArray(status) && targets.length === 0 ? (
|
|
183
184
|
<EmptyState scope="section" message={`There is nowhere in ${folderName} to put it.`} />
|
|
184
185
|
) : (
|
package/src/PageHeader.mdx
CHANGED
|
@@ -87,6 +87,7 @@ import { MembersPill, PageHeader, Toolbar, ToolbarButton } from '@estiva-app/ui'
|
|
|
87
87
|
- A string `title` is one line and is cut short with an ellipsis when the
|
|
88
88
|
room runs out; everything at the right keeps its size. A node — a
|
|
89
89
|
`Breadcrumb`, an `InlineText` — is drawn as given, and cuts itself short.
|
|
90
|
+
Cut short, the title and what is `after` it stop 12px before the right group.
|
|
90
91
|
|
|
91
92
|
<Canvas of={PageHeaderStories.LongTitle} />
|
|
92
93
|
|
package/src/ReplyCard.mdx
CHANGED
|
@@ -51,6 +51,7 @@ import { ReplyCard, Thread } from '@estiva-app/ui'
|
|
|
51
51
|
|---|---|---|
|
|
52
52
|
| Shows its actions while pointed at, and holds them while a menu is open | hover state and an outside-click check | |
|
|
53
53
|
| Asks before it deletes | a confirm dialog | |
|
|
54
|
+
| Says a refusal (`deleteRefused`) only in the question it answered | clearing it when the question closes | |
|
|
54
55
|
| Says the exact date and time under the pointer, from `at` | a tooltip round the time | |
|
|
55
56
|
|
|
56
57
|
## Props
|