@estiva-app/ui 0.104.3 → 0.106.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.
@@ -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 Folder, under another file, or both. The places in
16
- * its own Folder are the caller's, read before it opens; another Folder's are
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: 'Folder' }))
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 Folder first, at the top, with every other place there. */
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 Folder is asked, and not the one it is in. Move waits for a pick. */
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 Folder: one holding only this file and what is under it. */
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 Folder could not be read: the section's empty line, with Try again. */
63
+ /** Another team could not be read: the section's empty line, with Try again. */
64
64
  export const FolderUnreadable: Story = {
65
- name: 'Folder unreadable',
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 Folder, still being read: the second list says so and waits. */
70
+ /** Another team, still being read: the second list says so and waits. */
71
71
  export const ReadingAFolder: Story = {
72
- name: 'Reading a folder',
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 Folders are still being read: the list says so. */
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 Folder to offer: said in the dialog's body, and Move stays greyed. */
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 folder',
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 Folder the app chose. */
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 Folder',
100
- folderLabel: 'Destination Folder',
101
- noFolder: 'There is no other Folder it can be moved to.',
102
- description: 'Only the Folder it is listed in changes. Its issues and its conversation stay exactly as they are.',
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 Folders, after a move that half-worked: `from` is empty, so every Folder is offered, the ones
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 Folders',
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: 'Folder' }))
119
+ await userEvent.click(within(canvasElement.ownerDocument.body).getByRole('combobox', { name: 'Team' }))
120
120
  },
121
121
  }
122
122
 
123
- /** A box only some Folders ask, ticked as it opened: here Steer asks it and Estiva HQ does not. The story picks Steer. */
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: {
@@ -1,8 +1,8 @@
1
1
  // @vitest-environment jsdom
2
2
  /**
3
- * Move a file to another Folder, under another file, or both (FOL-45): Peek's
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 Folder that could not be
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 Folder the file is in, with only real moves there', async () => {
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 Folder when it is picked, and moves to its top by default', async () => {
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('Folder', 'Steer')
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 Folder, never offers the one it is in, and waits for a pick', async () => {
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('Folder')).toEqual(['Steer'])
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('Folder', 'Steer')
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 Folder has nowhere to put it, and does not move', async () => {
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('Folder', 'Steer')
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 Folder that could not be read, and reads it again on Try again', async () => {
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('Folder', 'Steer')
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 Folder that could not be read as the empty line beside it does, with its Try again (B8)', async () => {
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('Folder', 'Steer')
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 Folder once', async () => {
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('Folder', 'Steer')
122
- await pick('Folder', 'Estiva HQ')
123
- await pick('Folder', 'Steer')
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 Folder it opens on when its places were not handed in', async () => {
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 Folders are still read, says so in the list, and does not say there is nowhere to go (Leaf’s)', () => {
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 folder it can be moved to.')).toBeNull()
148
- expect(screen.getByRole('combobox', { name: 'Folder' }).textContent).toContain('Reading…')
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('says there is no other Folder when none is offered', () => {
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 folder it can be moved to.')).toBeTruthy()
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 Folder it is given (Ship’s Move to Folder)', async () => {
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 Folder"
162
- folderLabel="Destination Folder"
163
- description="Only the Folder it is listed in changes."
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 Folder' })).toBeTruthy()
171
- expect(screen.getByText('Only the Folder it is listed in changes.')).toBeTruthy()
172
- expect(screen.getByRole('combobox', { name: 'Destination Folder' }).textContent).toContain('Steer')
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 Folder in the app’s words', () => {
178
- render(<Fixture folders={[HQ]} placesIn={undefined} noFolder="There is no other Folder it can be moved to." />)
179
- expect(screen.getByText('There is no other Folder it can be moved to.')).toBeTruthy()
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 Folder (`from` empty; Ship’s move, 2 November)', () => {
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 Folder back: listed in two after a move that half-worked, or in none, every Folder is offered', async () => {
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('Folder')).toEqual(['Estiva HQ', 'Steer', 'Third'])
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: 'Folder' }).textContent).toContain('Third')
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 Folder', async () => {
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('Folder', 'Steer')
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 Folders that name it, ticked as it opened, and says what it answered', async () => {
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('Folder', 'Third')
248
+ await pick('Team', 'Third')
239
249
  expect(screen.queryByRole('checkbox')).toBeNull()
240
- await pick('Folder', 'Steer')
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 Folder that does not ask the box moves with no answer for it, even after another Folder showed it ticked', async () => {
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('Folder', 'Steer')
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('Folder', 'Third')
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('Folder', 'Steer')
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('Folder')).toEqual(['Steer', 'Third'])
286
+ expect(await optionsOf('Team')).toEqual(['Steer', 'Third'])
277
287
  })
278
288
  })
@@ -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 Folder field's label. "Folder" when absent. */
77
+ /** The team field's label. "Team" when absent. */
78
78
  folderLabel?: string
79
- /** Said when no Folder is offered. "There is no other folder it can be moved to." when absent. */
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 = 'Folder',
100
- noFolder = 'There is no other folder it can be moved to.',
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 folderName = destinations?.find((candidate) => candidate.id === folder)?.name ?? 'this folder'
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 folder' : 'Reading…'}
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={`${folderName} could not be read.`} action={{ label: 'Try again', onClick: () => readPlaces(folder) }} />
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
  ) : (
@@ -92,11 +92,17 @@ export interface ReactionRowProps {
92
92
  nameOf: (id: string) => string
93
93
  /** Who is looking: their pills are lit, and "who reacted" says "you". */
94
94
  viewer?: string
95
- /** Your reaction on or off. Absent, the row only shows (read-only, signed out). */
96
- onToggle?: (emoji: string) => void
95
+ /**
96
+ * Your reaction on or off. Absent, the row only shows (read-only, signed out). In a `ConversationCard`, answering
97
+ * with what the relay said lets the card say why a refused one did not go through.
98
+ */
99
+ onToggle?: (emoji: string) => void | Promise<ReactionAnswer | void>
97
100
  className?: string
98
101
  }
99
102
 
103
+ /** What the relay said about a reaction; `reason` as it came, said in plain words by the card. */
104
+ export type ReactionAnswer = { accepted: true } | { accepted: false; reason: unknown }
105
+
100
106
  export function ReactionRow({ reactions, options, nameOf, viewer, onToggle, className }: ReactionRowProps) {
101
107
  const shown = reactions.filter((r) => r.by.length > 0)
102
108
  if (shown.length === 0) return null
@@ -99,25 +99,54 @@ export function WithBlock() {
99
99
  )
100
100
  }
101
101
 
102
+ /**
103
+ * What the relay (or Estiva ID, or the network) says for each cause of a refusal, as an app hands it over raw. The kit
104
+ * says each in `@estiva-app/conversation`'s plain words; a story picks one to show its sentence.
105
+ */
106
+ export const RELAY_SAYS = {
107
+ 'Too long': 'invalid: content exceeds maximum size of 262144 bytes',
108
+ 'Deleted, or no longer yours to write beside': 'invalid: edit target not found or not editable by you',
109
+ 'No longer a member': 'restricted: not a channel member',
110
+ Archived: 'restricted: channel is archived',
111
+ 'Too many at once': 'rate-limited: slow down',
112
+ 'Wrong clock': 'invalid: event timestamp too far in the future',
113
+ 'Signed out': 'auth-required: authentication required',
114
+ 'Anything else': 'error: internal error',
115
+ } as const
116
+ export type RelaySays = keyof typeof RELAY_SAYS
117
+
118
+ /** What the server says when it refuses a file, as protocol's upload hands it over. */
119
+ export const SERVER_SAYS = {
120
+ 'Too large': 'upload failed: 413 {"error":"file too large: 11534336 bytes (max 10485760)"}',
121
+ 'Not a type it takes': 'upload failed: 415 unsupported content type',
122
+ 'Could not be read': 'upload failed: 422 invalid image metadata',
123
+ 'Too many at once': 'upload failed: 429 rate limit exceeded',
124
+ 'Signed out': 'upload failed: 401 authentication failed',
125
+ 'No longer a member': 'upload failed: 403 forbidden',
126
+ 'Anything else': 'upload failed: 500 internal error',
127
+ } as const
128
+ export type ServerSays = keyof typeof SERVER_SAYS
129
+
102
130
  const saved = (): Promise<SendAnswer> => new Promise((resolve) => setTimeout(() => resolve({ accepted: true }), 400))
103
- const refused = (): Promise<SendAnswer> => new Promise((resolve) => setTimeout(() => resolve({ accepted: false, reason: 'try again in a moment' }), 600))
131
+ const refused = (reason: string): Promise<SendAnswer> => new Promise((resolve) => setTimeout(() => resolve({ accepted: false, reason }), 600))
104
132
  const asBody = (text: string): JSONContent => ({ type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text }] }] })
105
133
 
106
- /** The box a comment is edited in: the kit's CommentBox, as an app hands it to the card. */
107
- export function EditBox({ text, done, refuse = false }: { text: string; done: () => void; refuse?: boolean }) {
134
+ /** The box a comment is edited in: the kit's CommentBox, as an app hands it to the card. `refuse`: why the relay says no. */
135
+ export function EditBox({ text, done, refuse }: { text: string; done: () => void; refuse?: RelaySays }) {
136
+ const answer = () => (refuse ? refused(RELAY_SAYS[refuse]) : saved())
108
137
  return (
109
138
  <CommentBox
110
139
  people={[]}
111
140
  label="Edit"
112
141
  placeholder={null}
113
- send={refuse ? refused : saved}
142
+ send={answer}
114
143
  edit={{
115
144
  body: asBody(text),
116
145
  onCancel: done,
117
146
  onSave: async () => {
118
- const answer = await (refuse ? refused() : saved())
119
- if (answer.accepted) done()
120
- return answer
147
+ const said = await answer()
148
+ if (said.accepted) done()
149
+ return said
121
150
  },
122
151
  }}
123
152
  />