Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Team access: a familiar sharing dialog, and Bot access as a list that opens it (#4167)

Milind Soni7956f13d1cfd
diff --git a/docs/team-cloud.md b/docs/team-cloud.md
index 4ef04c53bd..2d10ddce45 100644
--- a/docs/team-cloud.md
+++ b/docs/team-cloud.md
@@ -414,12 +414,13 @@ allow, folders), where it runs, its department, whom it answers to or directs, c
bot frame, withdraws a bot that stops being shown (`bot.deleted`, and their stream ends to start fresh) and sends one
that becomes shown whole.
- **The app.** The bot's Share button (the bot panel in Simple, the settings header in Advanced) opens the Share
- dialog on a team; the conversation's copy and download sit at its foot. Someone who can only view a bot sees "You
+ dialog on a team; the conversation's copy and download sit under the ⋯ of its header. Someone who can only view a bot sees "You
can view Payroll, not chat with it." where the composer would be (and in a room with that bot), opens its main chat
rather than a new one of their own, and is offered no New conversation. Off a team none of this shows.
-- **Bot access** (Settings, for a team's admins): every team bot down the side (each person's own MausBot stays out),
- each User across, and what everyone in the team gets; each cell is that person's level (the owner's says Owner), and
- the Everyone column sets it for everyone. The same sharing as the Share dialog, applied at once with Undo.
+- **Bot access** (its own Settings page, for a team's admins): one row per team bot (each person's own MausBot stays
+ out) with its owner, what everyone gets and the faces of those with their own access; a row opens that bot's Share
+ dialog. By person lists each User, and opening one shows their bots with the same level menus and Remove. The same
+ sharing as the Share dialog, applied at once with Undo.
- **Asking to chat.** Beside "You can view Payroll" sits "Ask Ada to chat" (Ada owns it; "Ask an admin to chat" when
nobody on the team does). `POST /api/bots/<id>/access-request` (anyone who can view the bot; someone who can chat
already gets 409) puts an Allow / Not now card in the owner's inbox, or each admin's when the owner is gone
diff --git a/docs/verification/evidence/team-bot-access/ask-allowed-bob.png b/docs/verification/evidence/team-bot-access/ask-allowed-bob.png
index c92d9b5b1a..8f649743bf 100644
Binary files a/docs/verification/evidence/team-bot-access/ask-allowed-bob.png and b/docs/verification/evidence/team-bot-access/ask-allowed-bob.png differ
diff --git a/docs/verification/evidence/team-bot-access/ask-bob-asked.png b/docs/verification/evidence/team-bot-access/ask-bob-asked.png
index 33b2fb02f6..0d9b0b6c83 100644
Binary files a/docs/verification/evidence/team-bot-access/ask-bob-asked.png and b/docs/verification/evidence/team-bot-access/ask-bob-asked.png differ
diff --git a/docs/verification/evidence/team-bot-access/ask-bob.png b/docs/verification/evidence/team-bot-access/ask-bob.png
index fd89e07508..170fa9e9f9 100644
Binary files a/docs/verification/evidence/team-bot-access/ask-bob.png and b/docs/verification/evidence/team-bot-access/ask-bob.png differ
diff --git a/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.png b/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.png
index 3aeae1a6a4..5c401c5e9a 100644
Binary files a/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.png and b/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.png differ
diff --git a/docs/verification/evidence/team-bot-access/before-look-member-view.png b/docs/verification/evidence/team-bot-access/before-look-member-view.png
new file mode 100644
index 0000000000..08e94b4cb2
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/before-look-member-view.png differ
diff --git a/docs/verification/evidence/team-bot-access/before-look-overview-dark.png b/docs/verification/evidence/team-bot-access/before-look-overview-dark.png
new file mode 100644
index 0000000000..1b055ce66b
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/before-look-overview-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/before-look-overview.png b/docs/verification/evidence/team-bot-access/before-look-overview.png
new file mode 100644
index 0000000000..d81824fd08
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/before-look-overview.png differ
diff --git a/docs/verification/evidence/team-bot-access/before-look-share-dialog-dark.png b/docs/verification/evidence/team-bot-access/before-look-share-dialog-dark.png
new file mode 100644
index 0000000000..d3b6b924ff
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/before-look-share-dialog-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/before-look-share-dialog.png b/docs/verification/evidence/team-bot-access/before-look-share-dialog.png
new file mode 100644
index 0000000000..31cad2be1c
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/before-look-share-dialog.png differ
diff --git a/docs/verification/evidence/team-bot-access/before-member-bob.png b/docs/verification/evidence/team-bot-access/before-member-bob.png
deleted file mode 100644
index dcb0951442..0000000000
Binary files a/docs/verification/evidence/team-bot-access/before-member-bob.png and /dev/null differ
diff --git a/docs/verification/evidence/team-bot-access/before-share-menu.png b/docs/verification/evidence/team-bot-access/before-share-menu.png
deleted file mode 100644
index 1fecffb60a..0000000000
Binary files a/docs/verification/evidence/team-bot-access/before-share-menu.png and /dev/null differ
diff --git a/docs/verification/evidence/team-bot-access/before-visibility.png b/docs/verification/evidence/team-bot-access/before-visibility.png
deleted file mode 100644
index b3d1fe23f2..0000000000
Binary files a/docs/verification/evidence/team-bot-access/before-visibility.png and /dev/null differ
diff --git a/docs/verification/evidence/team-bot-access/member-chat-cara.png b/docs/verification/evidence/team-bot-access/member-chat-cara.png
index 1e393d19e5..bbeab87da2 100644
Binary files a/docs/verification/evidence/team-bot-access/member-chat-cara.png and b/docs/verification/evidence/team-bot-access/member-chat-cara.png differ
diff --git a/docs/verification/evidence/team-bot-access/member-edit-dan-share.png b/docs/verification/evidence/team-bot-access/member-edit-dan-share.png
index df7986fda8..3d1c8599e0 100644
Binary files a/docs/verification/evidence/team-bot-access/member-edit-dan-share.png and b/docs/verification/evidence/team-bot-access/member-edit-dan-share.png differ
diff --git a/docs/verification/evidence/team-bot-access/member-none-eve.png b/docs/verification/evidence/team-bot-access/member-none-eve.png
index 631e68f034..6352175cdb 100644
Binary files a/docs/verification/evidence/team-bot-access/member-none-eve.png and b/docs/verification/evidence/team-bot-access/member-none-eve.png differ
diff --git a/docs/verification/evidence/team-bot-access/member-view-bob-share-390.png b/docs/verification/evidence/team-bot-access/member-view-bob-share-390.png
new file mode 100644
index 0000000000..9ffd4311a4
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/member-view-bob-share-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/member-view-bob-share-dark.png b/docs/verification/evidence/team-bot-access/member-view-bob-share-dark.png
new file mode 100644
index 0000000000..90cb84deff
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/member-view-bob-share-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/member-view-bob-share.png b/docs/verification/evidence/team-bot-access/member-view-bob-share.png
index 797b42db67..60ea6743c0 100644
Binary files a/docs/verification/evidence/team-bot-access/member-view-bob-share.png and b/docs/verification/evidence/team-bot-access/member-view-bob-share.png differ
diff --git a/docs/verification/evidence/team-bot-access/member-view-bob.png b/docs/verification/evidence/team-bot-access/member-view-bob.png
index 147ff4f7a7..b42d03a07d 100644
Binary files a/docs/verification/evidence/team-bot-access/member-view-bob.png and b/docs/verification/evidence/team-bot-access/member-view-bob.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-admin-390.png b/docs/verification/evidence/team-bot-access/overview-admin-390.png
new file mode 100644
index 0000000000..413fda1828
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-admin-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.png b/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.png
index ffccdaa95c..670e807dcb 100644
Binary files a/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.png and b/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-admin.png b/docs/verification/evidence/team-bot-access/overview-admin.png
index 8e3fecbd4d..1db6aeb2d0 100644
Binary files a/docs/verification/evidence/team-bot-access/overview-admin.png and b/docs/verification/evidence/team-bot-access/overview-admin.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-by-person-390.png b/docs/verification/evidence/team-bot-access/overview-by-person-390.png
new file mode 100644
index 0000000000..35e35482f2
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-by-person-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-by-person-dark.png b/docs/verification/evidence/team-bot-access/overview-by-person-dark.png
new file mode 100644
index 0000000000..8cbfdc8853
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-by-person-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-by-person.png b/docs/verification/evidence/team-bot-access/overview-by-person.png
new file mode 100644
index 0000000000..c908890749
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-by-person.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-many-bots-390.png b/docs/verification/evidence/team-bot-access/overview-many-bots-390.png
new file mode 100644
index 0000000000..250efedbf9
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-many-bots-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-many-bots.png b/docs/verification/evidence/team-bot-access/overview-many-bots.png
new file mode 100644
index 0000000000..60a747a975
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-many-bots.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-person-bots-390.png b/docs/verification/evidence/team-bot-access/overview-person-bots-390.png
new file mode 100644
index 0000000000..6f03f3d5f7
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-person-bots-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-person-bots-dark.png b/docs/verification/evidence/team-bot-access/overview-person-bots-dark.png
new file mode 100644
index 0000000000..79dcea8275
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-person-bots-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-person-bots.png b/docs/verification/evidence/team-bot-access/overview-person-bots.png
new file mode 100644
index 0000000000..9784fab2bc
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-person-bots.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-search-many-people.png b/docs/verification/evidence/team-bot-access/overview-search-many-people.png
new file mode 100644
index 0000000000..aeb6734333
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-search-many-people.png differ
diff --git a/docs/verification/evidence/team-bot-access/overview-share-everyone.png b/docs/verification/evidence/team-bot-access/overview-share-everyone.png
new file mode 100644
index 0000000000..ae23f624af
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-share-everyone.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-390.png b/docs/verification/evidence/team-bot-access/share-dialog-390.png
new file mode 100644
index 0000000000..9bdb45d4cd
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-add-person.png b/docs/verification/evidence/team-bot-access/share-dialog-add-person.png
index c75ce6c590..ada1497261 100644
Binary files a/docs/verification/evidence/team-bot-access/share-dialog-add-person.png and b/docs/verification/evidence/team-bot-access/share-dialog-add-person.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-admin-dark.png b/docs/verification/evidence/team-bot-access/share-dialog-admin-dark.png
new file mode 100644
index 0000000000..dffb318e9e
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-admin-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-admin.png b/docs/verification/evidence/team-bot-access/share-dialog-admin.png
index 10a637573f..404bd45a15 100644
Binary files a/docs/verification/evidence/team-bot-access/share-dialog-admin.png and b/docs/verification/evidence/team-bot-access/share-dialog-admin.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-advanced-dark.png b/docs/verification/evidence/team-bot-access/share-dialog-advanced-dark.png
index 5e02bed5b4..dba662f406 100644
Binary files a/docs/verification/evidence/team-bot-access/share-dialog-advanced-dark.png and b/docs/verification/evidence/team-bot-access/share-dialog-advanced-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-level-menu-390.png b/docs/verification/evidence/team-bot-access/share-dialog-level-menu-390.png
new file mode 100644
index 0000000000..b7eca8158c
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-level-menu-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-level-menu-dark.png b/docs/verification/evidence/team-bot-access/share-dialog-level-menu-dark.png
new file mode 100644
index 0000000000..9b7bdb1279
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-level-menu-dark.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-level-menu.png b/docs/verification/evidence/team-bot-access/share-dialog-level-menu.png
new file mode 100644
index 0000000000..238681aa9c
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-level-menu.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-made-owner.png b/docs/verification/evidence/team-bot-access/share-dialog-made-owner.png
new file mode 100644
index 0000000000..044da0097f
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-made-owner.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-make-owner.png b/docs/verification/evidence/team-bot-access/share-dialog-make-owner.png
new file mode 100644
index 0000000000..ee9448617a
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-make-owner.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-many-people-390.png b/docs/verification/evidence/team-bot-access/share-dialog-many-people-390.png
new file mode 100644
index 0000000000..9b4bff5cc9
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-many-people-390.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-many-people.png b/docs/verification/evidence/team-bot-access/share-dialog-many-people.png
new file mode 100644
index 0000000000..c83faa96f2
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-many-people.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-more-menu.png b/docs/verification/evidence/team-bot-access/share-dialog-more-menu.png
new file mode 100644
index 0000000000..504c5e255c
Binary files /dev/null and b/docs/verification/evidence/team-bot-access/share-dialog-more-menu.png differ
diff --git a/docs/verification/evidence/team-bot-access/share-dialog-undo-toast.png b/docs/verification/evidence/team-bot-access/share-dialog-undo-toast.png
index 2311b5eb81..e3874916c8 100644
Binary files a/docs/verification/evidence/team-bot-access/share-dialog-undo-toast.png and b/docs/verification/evidence/team-bot-access/share-dialog-undo-toast.png differ
diff --git a/docs/verification/team-bot-access.md b/docs/verification/team-bot-access.md
index e45f120591..e41dbe3933 100644
--- a/docs/verification/team-bot-access.md
+++ b/docs/verification/team-bot-access.md
@@ -33,12 +33,16 @@ pnpm exec vitest run server/cloud-team-bot-access.e2e.test.ts server/bot-access.
- `server/host/access-requests.test.ts`: the admins decide when the owner is gone, one admin's Allow settles every
copy, the owner alone decides while on the team, Not now gives nothing.
- `src/components/bot-access/AccessOverview.dom.test.ts`: Settings → Bot access lists each team bot (no one's own
- MausBot) by each User, the owner, levels below everyone's disabled, a cell or row applied at once with Undo; "Ask Cara
- to chat" asks and says so, "Ask an admin to chat" when nobody on the team owns the bot.
- `src/components/SettingsModal.groups.test.ts` shows the page to a team's admins only.
-- `src/components/bot-access/ShareBotDialog.dom.test.ts` drives the dialog: the owner first, each level, a change sent
- at once with Undo putting it back, adding a teammate, removing one, opening the bot to everyone, the read-only view
- of someone who can't edit, and no button off a team.
+ MausBot) with its owner, a plain summary and a stack of faces (+N past four); a row opens the Share dialog; the search
+ takes a bot's name or owner; By person lists each User, and opening one gives their bots at the same level menus, with
+ Remove only for their own access; the empty states; "Ask Cara to chat" asks and says so, "Ask an admin to chat" when
+ nobody on the team owns the bot. `src/components/SettingsModal.groups.test.ts` and
+ `src/components/SettingsModal.simple.test.ts` show the page to a team's admins only, as its own page in both modes.
+- `src/components/bot-access/ShareBotDialog.dom.test.ts` drives the dialog: the owner first, each level on a real menu
+ with its check, nothing below what everyone gets, a change sent at once with Undo putting it back, adding a teammate
+ from the keyboard, removing one, general access and its level, Make owner behind a confirmation and only for whoever
+ may hand the bot on, the read-only view of someone who can't edit, keys staying inside it over Settings, and no button
+ off a team.
## The pictures
@@ -49,25 +53,56 @@ node --experimental-strip-types scripts/verify-team-bot-access.ts --shots <dir>
It starts the same kind of Team Cloud, sets Payroll up through the routes, and photographs the whole app
(`scripts/testing/team-access-preview.tsx`) in a headless Chrome with a throwaway profile, at 1280×800 at 2x, each page's
every request sent as that person through the preview's proxy. It fails if the app is refused anything naming a bot, a
-room or a conversation while it is shown. `--before` takes the same setup through the older visibility route, for a
+room or a conversation while it is shown. The `-dark` pictures use the Midnight skin and the `-390` ones a 390×844
+window; the many-people and many-bots ones add six people to Payroll and bring the team to fifty bots. `--before` takes the same setup through the older visibility route, for a
checkout of the code before levels.
| | Before | After |
|---|---|---|
-| An admin's Share button (Simple) | ![](evidence/team-bot-access/before-share-menu.png) | ![](evidence/team-bot-access/share-dialog-admin.png) |
-| Advanced settings | ![](evidence/team-bot-access/before-visibility.png) | ![](evidence/team-bot-access/share-dialog-advanced-dark.png) |
-| A member who may only view | ![](evidence/team-bot-access/before-member-bob.png) | ![](evidence/team-bot-access/member-view-bob.png) |
+| The Share dialog | ![](evidence/team-bot-access/before-look-share-dialog.png) | ![](evidence/team-bot-access/share-dialog-admin.png) |
+| The Share dialog, dark | ![](evidence/team-bot-access/before-look-share-dialog-dark.png) | ![](evidence/team-bot-access/share-dialog-advanced-dark.png) |
+| Someone who can only view | ![](evidence/team-bot-access/before-look-member-view.png) | ![](evidence/team-bot-access/member-view-bob-share.png) |
+| Bot access in Settings | ![](evidence/team-bot-access/before-look-overview.png) | ![](evidence/team-bot-access/overview-admin.png) |
+| Bot access in Settings, dark | ![](evidence/team-bot-access/before-look-overview-dark.png) | ![](evidence/team-bot-access/overview-admin-advanced-dark.png) |
-| After | |
+| The Share dialog | |
|---|---|
+| Dark, Simple | ![](evidence/team-bot-access/share-dialog-admin-dark.png) |
+| A level's menu | ![](evidence/team-bot-access/share-dialog-level-menu.png) |
+| A level's menu, dark | ![](evidence/team-bot-access/share-dialog-level-menu-dark.png) |
+| The ⋯ menu | ![](evidence/team-bot-access/share-dialog-more-menu.png) |
+| Make owner, confirming | ![](evidence/team-bot-access/share-dialog-make-owner.png) |
+| Made owner, the one before still able to edit | ![](evidence/team-bot-access/share-dialog-made-owner.png) |
| Adding a teammate | ![](evidence/team-bot-access/share-dialog-add-person.png) |
| A change, with Undo | ![](evidence/team-bot-access/share-dialog-undo-toast.png) |
+| Everyone in the team: the level at the row's end | ![](evidence/team-bot-access/overview-share-everyone.png) |
+| Ten people: the list scrolls inside | ![](evidence/team-bot-access/share-dialog-many-people.png) |
+| 390px | ![](evidence/team-bot-access/share-dialog-390.png) |
+| 390px, a level's menu | ![](evidence/team-bot-access/share-dialog-level-menu-390.png) |
+| 390px, ten people | ![](evidence/team-bot-access/share-dialog-many-people-390.png) |
+
+| Bot access | |
+|---|---|
+| By person | ![](evidence/team-bot-access/overview-by-person.png) |
+| By person, dark | ![](evidence/team-bot-access/overview-by-person-dark.png) |
+| A person's bots, a level open | ![](evidence/team-bot-access/overview-person-bots.png) |
+| A person's bots, dark | ![](evidence/team-bot-access/overview-person-bots-dark.png) |
+| Fifty bots | ![](evidence/team-bot-access/overview-many-bots.png) |
+| Searching, with ten people: +N past four | ![](evidence/team-bot-access/overview-search-many-people.png) |
+| 390px, by bot | ![](evidence/team-bot-access/overview-admin-390.png) |
+| 390px, by person | ![](evidence/team-bot-access/overview-by-person-390.png) |
+| 390px, a person's bots | ![](evidence/team-bot-access/overview-person-bots-390.png) |
+| 390px, fifty bots | ![](evidence/team-bot-access/overview-many-bots-390.png) |
+
+| Each level | |
+|---|---|
| Can view: the Share dialog | ![](evidence/team-bot-access/member-view-bob-share.png) |
+| Can view: the Share dialog, dark | ![](evidence/team-bot-access/member-view-bob-share-dark.png) |
+| Can view: the Share dialog, 390px | ![](evidence/team-bot-access/member-view-bob-share-390.png) |
+| Can view | ![](evidence/team-bot-access/member-view-bob.png) |
| Can chat | ![](evidence/team-bot-access/member-chat-cara.png) |
| Can edit: the Share dialog | ![](evidence/team-bot-access/member-edit-dan-share.png) |
| No access: not in the list | ![](evidence/team-bot-access/member-none-eve.png) |
-| Bot access in Settings (Simple) | ![](evidence/team-bot-access/overview-admin.png) |
-| Bot access in Settings (Advanced) | ![](evidence/team-bot-access/overview-admin-advanced-dark.png) |
| Can view: ask the owner | ![](evidence/team-bot-access/ask-bob.png) |
| Asked | ![](evidence/team-bot-access/ask-bob-asked.png) |
| The card in the owner's inbox | ![](evidence/team-bot-access/ask-card-ada-inbox.png) |
diff --git a/scripts/verify-team-bot-access.ts b/scripts/verify-team-bot-access.ts
index db4bb5195b..d843a2bad4 100644
--- a/scripts/verify-team-bot-access.ts
+++ b/scripts/verify-team-bot-access.ts
@@ -18,11 +18,14 @@ const onlyAt = process.argv.indexOf("--only");
const only = onlyAt === -1 ? null : new Set((process.argv[onlyAt + 1] ?? "").split(",").filter(Boolean));
const CHROME = process.env.OMB_CDP_CHROME ?? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
const [WIDTH, HEIGHT] = [1280, 800];
+const PHONE = { width: 390, height: 844 };
const SUBJECT = /^\/api\/(?:bots|threads|groups|routines)\//;
/** The app's time-limited offer opens over the sidebar; its own Not now closes it. */
const DISMISS_OFFER = `(() => { const button = [...document.querySelectorAll('[data-notice="boat-offer"] button')].find((entry) => entry.textContent.trim() === "Not now");
button?.click(); return Boolean(button); })()`;
+const CROWD = ["frank", "gina", "hugo", "iris", "jon", "kim"].map((name) => ({ email: `${name}@acme.test`, role: "member" as const }));
+
const PEOPLE = {
olive: { email: "[email protected]", role: "owner" as const },
ada: { email: "[email protected]", role: "admin" as const },
@@ -77,8 +80,8 @@ async function openChrome(profile: string) {
evaluate, until,
/** The page's /api requests the server refused since the last call. */
refusals: () => refused.splice(0),
- async open(url: string) {
- await send("Emulation.setDeviceMetricsOverride", { width: WIDTH, height: HEIGHT, deviceScaleFactor: 2, mobile: false });
+ async open(url: string, size: { width: number; height: number } = { width: WIDTH, height: HEIGHT }) {
+ await send("Emulation.setDeviceMetricsOverride", { ...size, deviceScaleFactor: 2, mobile: false });
await send("Page.navigate", { url });
await until("Boolean(document.querySelector('[data-sidebar-bot-row]'))", "the sidebar", 60_000);
},
@@ -115,6 +118,10 @@ try {
await as("ada", "POST", "/api/bots", { name: "Helpdesk", title: "IT questions", color: "blue" });
if (before) await as("ada", "PATCH", `/api/bots/${payroll.id}`, { visibility: { people: [PEOPLE.bob.email, PEOPLE.cara.email, PEOPLE.dan.email] } });
else await as("ada", "PUT", `/api/bots/${payroll.id}/access`, { everyone: "none", people: { [PEOPLE.bob.email]: "view", [PEOPLE.cara.email]: "chat", [PEOPLE.dan.email]: "edit" } });
+ const sales = (await as("ada", "POST", "/api/bots", { name: "Sales notes", title: "Keeps the deal notes", color: "orange" })).bot as { id: string };
+ await as("ada", "PUT", `/api/bots/${sales.id}/access`, { everyone: "view", people: { [PEOPLE.bob.email]: "edit" } });
+ const recruiting = (await as("ada", "POST", "/api/bots", { name: "Recruiting", title: "Screens applicants", color: "purple" })).bot as { id: string };
+ await as("ada", "PUT", `/api/bots/${recruiting.id}/access`, { everyone: "none", people: { [PEOPLE.bob.email]: "view", [PEOPLE.cara.email]: "chat", [PEOPLE.dan.email]: "chat", [PEOPLE.eve.email]: "chat" } });
await as("ada", "POST", `/api/bots/${payroll.id}/messages`, { text: "When does payroll run this month?" });
for (let i = 0; i < 150; i++) {
const bots = (await as("ada", "GET", "/api/bots")).bots as Array<{ id: string; busy?: boolean }>;
@@ -138,7 +145,34 @@ try {
await page.evaluate("document.querySelector('[data-chathead-identity] button, [data-chathead-pill]')?.click(); true");
await page.until("Boolean(document.querySelector('[data-panel-share], [data-share-bot-button]'))", "the bot panel");
};
- type Shot = { name: string; who: Who; query: string; act: () => Promise<void>; after?: () => Promise<void> };
+ const openShare = async () => {
+ await openPayroll(); await openPanel(); await page.click("[data-share-bot-button]");
+ await page.until("Boolean(document.querySelector('[data-share-bot]'))", "the Share dialog");
+ };
+ const openMenu = async (label: string) => {
+ await page.click(`[data-share-bot] button[aria-label="${label}"], [data-access-overview] button[aria-label="${label}"]`, label);
+ await page.until("Boolean(document.querySelector('[role=menu]'))", "its menu");
+ };
+ const openSettings = async () => {
+ await page.until(`(() => { const trigger = document.querySelector("[data-sidebar-account]") ?? [...document.querySelectorAll('button')].find((entry) => entry.textContent.includes("[email protected]") || /^(Ada|ada@acme)/.test(entry.getAttribute("aria-label") ?? ""));
+ (trigger ?? document.querySelector('.lucide-chevron-left')?.closest('button'))?.click(); return Boolean(trigger); })()`, "the account menu");
+ await page.until(`(() => { const item = [...document.querySelectorAll('[role=menuitem]')].find((entry) => entry.textContent.trim() === "Settings"); item?.click(); return Boolean(item); })()`, "Settings in the menu");
+ await page.until(`(() => { const entry = document.querySelector("[data-settings-page='botAccess'], [data-settings-section='botAccess']"); entry?.click(); if (entry) return true;
+ const picker = document.querySelector('select[aria-label="Settings"]'); if (!picker) return false;
+ Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value").set.call(picker, "botAccess"); picker.dispatchEvent(new Event("change", { bubbles: true })); return true; })()`, "Bot access in the rail");
+ await page.until("Boolean(document.querySelector('[data-access-overview]'))", "Bot access");
+ };
+ const byPerson = async () => {
+ await openSettings();
+ await page.click("[data-access-listing='person']", "By person");
+ await page.until("Boolean(document.querySelector('[data-access-person]'))", "the people");
+ };
+ const bobsBots = async () => {
+ await byPerson();
+ await page.click('[data-access-person="[email protected]"]', "Bob's row");
+ await page.until("Boolean(document.querySelector('[data-access-person-bot]'))", "Bob's bots");
+ };
+ type Shot = { name: string; who: Who; query: string; size?: { width: number; height: number }; act: () => Promise<void>; after?: () => Promise<void> };
const SHOTS: Shot[] = before ? [
{ name: "before-share-menu", who: "ada", query: "mode=simple", act: async () => {
await openPayroll(); await openPanel(); await page.click("[data-panel-share]");
@@ -153,19 +187,24 @@ try {
} },
{ name: "before-member-bob", who: "bob", query: "mode=simple", act: openPayroll },
] : [
- { name: "share-dialog-admin", who: "ada", query: "mode=simple", act: async () => {
- await openPayroll(); await openPanel(); await page.click("[data-share-bot-button]");
- await page.until("Boolean(document.querySelector('[data-share-bot]'))", "the Share dialog");
+ { name: "share-dialog-admin", who: "ada", query: "mode=simple", act: openShare },
+ { name: "share-dialog-admin-dark", who: "ada", query: "mode=simple&skin=midnight", act: openShare },
+ { name: "share-dialog-level-menu", who: "ada", query: "mode=simple", act: async () => { await openShare(); await openMenu("What Bob can do"); } },
+ { name: "share-dialog-level-menu-dark", who: "ada", query: "mode=simple&skin=midnight", act: async () => { await openShare(); await openMenu("What Bob can do"); } },
+ { name: "share-dialog-more-menu", who: "bob", query: "mode=simple", act: async () => { await openShare(); await openMenu("More"); } },
+ { name: "share-dialog-make-owner", who: "ada", query: "mode=simple", act: async () => {
+ await openShare(); await openMenu("What Bob can do");
+ await page.click('[role=menu] [data-menu-key="owner"]', "Make owner");
+ await page.until("Boolean(document.querySelector('[data-share-make-owner]'))", "the confirmation");
} },
{ name: "share-dialog-add-person", who: "ada", query: "mode=simple", act: async () => {
- await openPayroll(); await openPanel(); await page.click("[data-share-bot-button]");
- await page.until("Boolean(document.querySelector('[data-share-bot] input'))", "the add field");
- await page.evaluate(`(() => { const field = document.querySelector('[data-share-bot] input'); field.focus(); Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set.call(field, "e"); field.dispatchEvent(new Event("input", { bubbles: true })); return true; })()`);
- await page.until("Boolean(document.querySelector('#share-bot-people [role=option]'))", "Eve in the list");
+ await openShare();
+ await page.evaluate(`(() => { const field = document.querySelector('[data-share-bot] input'); field.focus(); field.click(); return true; })()`);
+ await page.until("Boolean(document.querySelector('[data-share-suggestion]'))", "Eve in the list");
} },
{ name: "share-dialog-undo-toast", who: "ada", query: "mode=simple", act: async () => {
- await openPayroll(); await openPanel(); await page.click("[data-share-bot-button]");
- await page.evaluate(`(() => { const field = document.querySelector('select[aria-label="What Bob can do"]'); field.value = "chat"; field.dispatchEvent(new Event("change", { bubbles: true })); return true; })()`);
+ await openShare(); await openMenu("What Bob can do");
+ await page.click('[role=menu] [data-menu-key="chat"]', "Can chat");
await page.until("Boolean(document.querySelector('[data-access-toast]'))", "the Undo toast");
}, after: async () => {
await page.click("[data-access-toast] button", "Undo");
@@ -177,34 +216,46 @@ try {
await page.click("[data-share-bot-button]");
await page.until("Boolean(document.querySelector('[data-share-bot]'))", "the Share dialog");
} },
+ { name: "share-dialog-390", who: "ada", query: "mode=simple", size: PHONE, act: openShare },
+ { name: "share-dialog-level-menu-390", who: "ada", query: "mode=simple", size: PHONE, act: async () => { await openShare(); await openMenu("What Bob can do"); } },
{ name: "member-view-bob", who: "bob", query: "mode=simple", act: async () => {
await openPayroll();
await page.until("Boolean(document.querySelector('[data-testid=view-only-composer]'))", "the view-only line");
} },
{ name: "member-view-bob-share", who: "bob", query: "mode=simple", act: async () => {
- await openPayroll(); await openPanel(); await page.click("[data-share-bot-button]");
+ await openShare();
+ await page.until("Boolean(document.querySelector('[data-share-yours]'))", "Bob's own level");
+ } },
+ { name: "member-view-bob-share-dark", who: "bob", query: "mode=simple&skin=midnight", act: async () => {
+ await openShare();
+ await page.until("Boolean(document.querySelector('[data-share-yours]'))", "Bob's own level");
+ } },
+ { name: "member-view-bob-share-390", who: "bob", query: "mode=simple", size: PHONE, act: async () => {
+ await openShare();
await page.until("Boolean(document.querySelector('[data-share-yours]'))", "Bob's own level");
} },
{ name: "member-chat-cara", who: "cara", query: "mode=simple", act: openPayroll },
{ name: "member-edit-dan-share", who: "dan", query: "mode=simple", act: async () => {
- await openPayroll(); await openPanel(); await page.click("[data-share-bot-button]");
+ await openShare();
await page.until("Boolean(document.querySelector('[data-share-bot] input'))", "Dan's Share dialog");
} },
{ name: "member-none-eve", who: "eve", query: "mode=simple", act: async () => {
await page.until(`!document.querySelector(${JSON.stringify(row)})`, "a sidebar without Payroll");
} },
- { name: "overview-admin", who: "ada", query: "mode=simple", act: async () => {
- await page.click("[data-sidebar-account]", "the account menu");
- await page.until(`(() => { const item = [...document.querySelectorAll('[role=menuitem]')].find((entry) => entry.textContent.trim() === "Settings"); item?.click(); return Boolean(item); })()`, "Settings in the menu");
- await page.until("Boolean(document.querySelector('[data-access-overview]'))", "Bot access");
- await page.evaluate("document.querySelector('[data-settings-block=\"botAccess\"]').scrollIntoView({ block: 'start' }); true");
- } },
- { name: "overview-admin-advanced-dark", who: "ada", query: "mode=advanced&skin=midnight", act: async () => {
- await page.until(`(() => { const trigger = [...document.querySelectorAll('button')].find((entry) => entry.textContent.includes("[email protected]")); trigger?.click(); return Boolean(trigger); })()`, "the account menu");
- await page.until(`(() => { const item = [...document.querySelectorAll('[role=menuitem]')].find((entry) => entry.textContent.trim() === "Settings"); item?.click(); return Boolean(item); })()`, "Settings in the menu");
- await page.click("[data-settings-section='botAccess']", "Bot access in the rail");
- await page.until("Boolean(document.querySelector('[data-access-overview]'))", "Bot access");
+ { name: "overview-admin", who: "ada", query: "mode=simple", act: openSettings },
+ { name: "overview-admin-advanced-dark", who: "ada", query: "mode=advanced&skin=midnight", act: openSettings },
+ { name: "overview-admin-390", who: "ada", query: "mode=simple", size: PHONE, act: openSettings },
+ { name: "overview-share-everyone", who: "ada", query: "mode=simple", act: async () => {
+ await openSettings();
+ await page.click(`[data-access-row="${sales.id}"]`, "the Sales notes row");
+ await page.until("Boolean(document.querySelector('[data-share-bot]'))", "the Share dialog");
} },
+ { name: "overview-by-person", who: "ada", query: "mode=simple", act: byPerson },
+ { name: "overview-by-person-dark", who: "ada", query: "mode=simple&skin=midnight", act: byPerson },
+ { name: "overview-by-person-390", who: "ada", query: "mode=simple", size: PHONE, act: byPerson },
+ { name: "overview-person-bots", who: "ada", query: "mode=simple", act: async () => { await bobsBots(); await delay(500); await openMenu("What Bob can do with Payroll"); } },
+ { name: "overview-person-bots-dark", who: "ada", query: "mode=simple&skin=midnight", act: bobsBots },
+ { name: "overview-person-bots-390", who: "ada", query: "mode=simple", size: PHONE, act: bobsBots },
{ name: "ask-bob", who: "bob", query: "mode=simple", act: async () => {
await openPayroll();
await page.until("Boolean(document.querySelector('[data-ask-to-chat]'))", "Ask to chat");
@@ -225,7 +276,40 @@ try {
await openPayroll();
await page.until("!document.querySelector('[data-testid=view-only-composer]') && Boolean(document.querySelector('textarea'))", "Bob's composer");
} },
+ { name: "share-dialog-many-people", who: "ada", query: "mode=simple", act: async () => {
+ await crowd();
+ await page.open(`${ui!.previewUrl}?mode=simple`);
+ await openShare();
+ } },
+ { name: "share-dialog-many-people-390", who: "ada", query: "mode=simple", size: PHONE, act: async () => { await crowd(); await openShare(); } },
+ { name: "overview-many-bots", who: "ada", query: "mode=simple", act: async () => { await crowd(); await openSettings(); } },
+ { name: "overview-many-bots-390", who: "ada", query: "mode=simple", size: PHONE, act: async () => { await crowd(); await openSettings(); } },
+ { name: "share-dialog-made-owner", who: "ada", query: "mode=simple", act: async () => {
+ await openSettings();
+ await page.click(`[data-access-row="${recruiting.id}"]`, "the Recruiting row");
+ await page.until("Boolean(document.querySelector('[data-share-bot]'))", "the Share dialog");
+ await openMenu("What Bob can do");
+ await page.click('[role=menu] [data-menu-key="owner"]', "Make owner");
+ await page.until("Boolean(document.querySelector('[data-share-make-owner]'))", "the confirmation");
+ await page.evaluate("[...document.querySelectorAll('[data-share-make-owner] button')].find((entry) => entry.textContent === 'Make owner').click(); true");
+ await page.until("!document.querySelector('[data-share-make-owner]') && document.querySelector('[data-share-person]')?.getAttribute('data-share-person') === '[email protected]' && Boolean(document.querySelector('[data-share-person=\"[email protected]\"] [aria-haspopup=menu]'))", "Bob as owner, Ada still able to edit");
+ } },
+ { name: "overview-search-many-people", who: "ada", query: "mode=simple", act: async () => {
+ await crowd(); await openSettings();
+ await page.evaluate(`(() => { const field = document.querySelector("[data-access-search]"); Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set.call(field, "payroll"); field.dispatchEvent(new Event("input", { bubbles: true })); return true; })()`);
+ await page.until("document.querySelectorAll('[data-access-row]').length === 1", "the search");
+ } },
];
+ let crowded = false;
+ /** Ten people on Payroll and fifty bots, once. */
+ async function crowd() {
+ if (crowded) return;
+ crowded = true;
+ const added = Object.fromEntries(CROWD.map((person) => [person.email, "chat" as const]));
+ for (const person of CROWD) await team.pair(person);
+ await as("ada", "PUT", `/api/bots/${payroll.id}/access`, { everyone: "none", people: { [PEOPLE.bob.email]: "view", [PEOPLE.cara.email]: "chat", [PEOPLE.dan.email]: "edit", [PEOPLE.eve.email]: "view", ...added } });
+ for (let i = 1; i <= 46; i++) await as("ada", "POST", "/api/bots", { name: `Bot ${String(i).padStart(2, "0")} with quite a long name for the list`, title: "Filler", color: "teal" });
+ }
let serving: Who | null = null;
for (const shot of SHOTS.filter((entry) => !only || only.has(entry.name))) {
if (serving !== shot.who) {
@@ -234,7 +318,7 @@ try {
title: "Team bot access", logLevel: "warn", proxyHeaders: { ...fx.edge, authorization: `Bearer ${token[shot.who]}` } });
serving = shot.who;
}
- await page.open(`${ui!.previewUrl}?${shot.query}`);
+ await page.open(`${ui!.previewUrl}?${shot.query}`, shot.size);
await shot.act().catch(async (error: unknown) => {
await page.shoot(join(shots, `${shot.name}-failed.png`));
throw new Error(`${shot.name}: ${error instanceof Error ? error.message : String(error)} (refused: ${page.refusals().join(", ") || "nothing"})`);
diff --git a/src/components/ChatMoreMenu.tsx b/src/components/ChatMoreMenu.tsx
index 7642c924cd..46fedf0d38 100644
--- a/src/components/ChatMoreMenu.tsx
+++ b/src/components/ChatMoreMenu.tsx
@@ -181,30 +181,31 @@ export function ChatMoreMenu({ bot, phoneHeader = false }: { bot: Bot; phoneHead
export const EXPORT_ITEMS = ["copy", "download"];
-/** The bot panel's round Share button: on a team who has access, with copying or downloading this conversation below;
- * anywhere else a menu of those two. */
+/** The bot panel's round Share button: on a team who has access, with copying or downloading this conversation under
+ * the ⋯ of its header; anywhere else a menu of those two. */
export function ChatShareMenu({ bot, className }: { bot: Bot; className: string }): JSX.Element {
- return useTeamName() ? <ShareBotButton bot={bot} className={className} footer={<ExportButtons key={bot.threadId} bot={bot} />} />
+ return useTeamName() ? <ShareBotButton bot={bot} className={className} headerMenu={<ExportMore key={bot.threadId} bot={bot} />} />
: <ShareMenu key={bot.threadId} bot={bot} className={className} />;
}
-function ExportButtons({ bot }: { bot: Bot }) {
+const exportItems = (items: SidebarMenuItem[]): SidebarMenuItem[] => items.filter((item) => EXPORT_ITEMS.includes(item.key)).map((item) => ({
+ ...item, heading: undefined, separatorBefore: false, label: t(item.key === "copy" ? "chat.export.copyConversation" : "chat.export.downloadConversation"),
+}));
+
+function ExportMore({ bot }: { bot: Bot }) {
const { items } = useChatMoreItems(bot);
- return items.filter((item) => EXPORT_ITEMS.includes(item.key)).map((item) => (
- <button key={item.key} type="button" disabled={item.disabled} onClick={item.onSelect}
- className="rounded-lg px-2 py-1 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50">
- {t(item.key === "copy" ? "chat.export.copyConversation" : "chat.export.downloadConversation")}{item.trailing && <> · {item.trailing}</>}
- </button>
- ));
+ return (
+ <SidebarPopoverMenu items={exportItems(items)} ariaLabel={t("chat.more")} align="end" triggerTitle={t("chat.more")}
+ triggerClassName="flex shrink-0 rounded-md p-1.5 text-ink-secondary hover:bg-ink/[0.06] hover:text-ink aria-expanded:bg-ink/[0.06]"
+ renderTrigger={() => <MoreHorizontal size={16} aria-hidden="true" />} />
+ );
}
function ShareMenu({ bot, className }: { bot: Bot; className: string }) {
const { items } = useChatMoreItems(bot);
return (
<SidebarPopoverMenu
- items={items.filter((item) => EXPORT_ITEMS.includes(item.key)).map((item) => ({
- ...item, heading: undefined, separatorBefore: false, label: t(item.key === "copy" ? "chat.export.copyConversation" : "chat.export.downloadConversation"),
- }))}
+ items={exportItems(items)}
ariaLabel={t("chat.export.heading")}
triggerClassName="rounded-full"
triggerTitle={t("chat.export.heading")}
diff --git a/src/components/SettingsModal.simple.test.ts b/src/components/SettingsModal.simple.test.ts
index 7db88ff61e..e98e04a998 100644
--- a/src/components/SettingsModal.simple.test.ts
+++ b/src/components/SettingsModal.simple.test.ts
@@ -131,7 +131,7 @@ describe("Settings in Simple mode", () => {
it("draws five pages on the desktop, General, AI, Computer, Usage & billing and Updates, and none of the Advanced-only ones", () => {
const html = render();
expect(pages(html)).toEqual(["general", "ai", "computer", "billing", "updates"]);
- expect(SIMPLE_PAGES.map((page) => page.id)).toEqual(["general", "ai", "computer", "billing", "updates"]);
+ expect(SIMPLE_PAGES.map((page) => page.id)).toEqual(["general", "botAccess", "ai", "computer", "billing", "updates"]);
expect(html).toMatch(/General<\/span>[\s\S]*AI<\/span>[\s\S]*Computer<\/span>[\s\S]*Usage &amp; billing<\/span>[\s\S]*Updates<\/span>/);
expect(html).not.toContain("data-settings-group=");
expect(html).not.toContain("data-settings-section=");
@@ -142,6 +142,19 @@ describe("Settings in Simple mode", () => {
expect(html).toContain('data-settings-look="simple"');
});
+ it("gives a team's admins Bot access as its own page, found by its search words, and nobody else", () => {
+ fixture.config = { ...fixture.config, team: { id: "team-acme", name: "Acme" }, cloudHome: true };
+ fixture.ownerOrAdmin = true;
+ expect(pages(render())).toContain("botAccess");
+ expect(pages(render())[1]).toBe("botAccess");
+ expect(blocks(render())).not.toContain("botAccess");
+ fixture.section = "botAccess";
+ expect(currentPage(render())).toBe("botAccess");
+ fixture.section = "general";
+ fixture.ownerOrAdmin = false;
+ expect(pages(render())).not.toContain("botAccess");
+ });
+
it("files every Advanced page under one Simple page, or hides it", () => {
const placed = SIMPLE_PAGES.flatMap((page) => page.sections);
expect(new Set(placed).size).toBe(placed.length);
diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsx
index fd8ecd5611..d76900b7d5 100644
--- a/src/components/SettingsModal.tsx
+++ b/src/components/SettingsModal.tsx
@@ -116,8 +116,9 @@ export type SimpleSettingsPage = {
};
export const SIMPLE_PAGES: SimpleSettingsPage[] = [
- { id: "general", labelKey: "settings.section.general", icon: Settings, sections: ["general", "appearance", "people", "botAccess", "import", "organization", "activity"],
+ { id: "general", labelKey: "settings.section.general", icon: Settings, sections: ["general", "appearance", "people", "import", "organization", "activity"],
keywords: ["account", "theme", "looks", "open at login", "startup", "analytics", "advanced mode"] },
+ { id: "botAccess", labelKey: "settings.section.botAccess", icon: Users, sections: ["botAccess"] },
{ id: "ai", labelKey: "settings.group.ai", icon: Sparkles, sections: ["engines", "connections"] },
{ id: "computer", labelKey: "settings.simple.page.computer", icon: Monitor, sections: ["companion", "desktopWorkspaces", "computer", "logins"] },
{ id: "billing", labelKey: "settings.simple.page.billing", icon: ChartNoAxesColumn, sections: ["usage", "cloudAccount"], keywords: ["billing", "included", "allowance", "cloud hours", "voice"] },
diff --git a/src/components/SettingsSimplePages.tsx b/src/components/SettingsSimplePages.tsx
index 78000e2c51..a16d785d3d 100644
--- a/src/components/SettingsSimplePages.tsx
+++ b/src/components/SettingsSimplePages.tsx
@@ -14,7 +14,6 @@ import { EnginesSettings } from "./EnginesSettings";
import { LocalComputerSection } from "./LocalComputerSection";
import { PeopleSection } from "./PeopleSection";
import { ActivitySection } from "./ActivitySection";
-import { AccessOverview } from "./bot-access/AccessOverview";
import { BuiltInBrowserRow } from "./BrowserSettingsRows";
import { LoginsSettings } from "./LoginsSettings";
import { OrganizationSettings } from "./OrganizationSettings";
@@ -93,7 +92,6 @@ export function SimpleGeneralPage({ has, peopleOpen, onLooks }: { has: Has; peop
)}
{has("import") && <SettingsGroup label={t("settings.section.import")} block="import"><AdminOnly><ImportSettings /></AdminOnly></SettingsGroup>}
{has("organization") && <SettingsGroup label={t("settings.section.organization")} block="organization"><OrganizationSettings /></SettingsGroup>}
- {has("botAccess") && <SettingsGroup label={t("settings.section.botAccess")} block="botAccess"><AccessOverview /></SettingsGroup>}
{has("activity") && <SettingsGroup label={t("settings.section.activity")} block="activity"><ActivitySection /></SettingsGroup>}
<div data-settings-block="advanced-mode" className="scroll-mt-4">
<SettingsRows><AdvancedModeRow simple /></SettingsRows>
diff --git a/src/components/SidebarPopoverMenu.anchored.test.ts b/src/components/SidebarPopoverMenu.anchored.test.ts
index 05fd1c3536..d0c9e989fc 100644
--- a/src/components/SidebarPopoverMenu.anchored.test.ts
+++ b/src/components/SidebarPopoverMenu.anchored.test.ts
@@ -23,6 +23,13 @@ describe("anchoredMenuPosition", () => {
expect(anchoredMenuPosition(avatar, menu, viewport)).toEqual({ left: 14, top: 434 });
});
+ it("opens a choice at a row's end below it on its end edge, and above when it would run off the window", () => {
+ const end = { left: 700, right: 800, top: 200, bottom: 230 };
+ expect(anchoredMenuPosition(end, menu, viewport, false, "end")).toEqual({ left: 800 - 280, top: 236 });
+ expect(anchoredMenuPosition(end, menu, viewport, true, "end")).toEqual({ left: 700, top: 236 });
+ expect(anchoredMenuPosition({ ...end, top: 740, bottom: 770 }, menu, viewport, false, "end")).toEqual({ left: 520, top: 434 });
+ });
+
it("anchors to the trigger's right edge in RTL, and stays inside the window", () => {
const rtlRow = { left: 980, right: 1268, top: 740, bottom: 784 };
expect(anchoredMenuPosition(rtlRow, menu, viewport, true)).toEqual({ left: 1268 - 280, top: 434 });
diff --git a/src/components/SidebarPopoverMenu.tsx b/src/components/SidebarPopoverMenu.tsx
index 2be786b2b5..9f5547aad9 100644
--- a/src/components/SidebarPopoverMenu.tsx
+++ b/src/components/SidebarPopoverMenu.tsx
@@ -14,6 +14,8 @@ export interface SidebarMenuItem {
note?: string;
icon?: React.ReactNode;
active?: boolean;
+ /** one choice of several: announced as chosen or not; the row draws its own mark */
+ checked?: boolean;
attention?: boolean;
attentionTone?: "danger" | "accent";
disabled?: boolean;
@@ -42,11 +44,15 @@ const ANCHOR_GAP = 6;
type Box = { left: number; right: number; top: number; bottom: number };
type Size = { width: number; height: number };
-export function anchoredMenuPosition(anchor: Box, menu: Size, viewport: Size, rtl = false): { left: number; top: number } {
+/** `start`: above the trigger on its start edge. `end`: below it on its end edge, for a choice at the end of a row. */
+export function anchoredMenuPosition(anchor: Box, menu: Size, viewport: Size, rtl = false, align: "start" | "end" = "start"): { left: number; top: number } {
const maxLeft = Math.max(EDGE_MARGIN, viewport.width - menu.width - EDGE_MARGIN);
- const left = Math.min(Math.max(rtl ? anchor.right - menu.width : anchor.left, EDGE_MARGIN), maxLeft);
+ const startsOnRight = align === "end" ? !rtl : rtl;
+ const left = Math.min(Math.max(startsOnRight ? anchor.right - menu.width : anchor.left, EDGE_MARGIN), maxLeft);
const above = anchor.top - ANCHOR_GAP - menu.height;
- const top = above >= EDGE_MARGIN ? above : anchor.bottom + ANCHOR_GAP;
+ const below = anchor.bottom + ANCHOR_GAP;
+ const fitsBelow = below + menu.height <= viewport.height - EDGE_MARGIN;
+ const top = align === "end" ? (fitsBelow || above < EDGE_MARGIN ? below : above) : above >= EDGE_MARGIN ? above : below;
const maxTop = Math.max(EDGE_MARGIN, viewport.height - menu.height - EDGE_MARGIN);
return { left, top: Math.min(Math.max(top, EDGE_MARGIN), maxTop) };
}
@@ -69,7 +75,7 @@ const isRtl = (element: Element | null) =>
typeof getComputedStyle === "function" && element ? getComputedStyle(element).direction === "rtl" : false;
const menuItems = (menu: HTMLElement | null) =>
- menu ? [...menu.querySelectorAll<HTMLElement>(':scope > div > [role="menuitem"]:not(:disabled)')] : [];
+ menu ? [...menu.querySelectorAll<HTMLElement>(':scope > div > [role^="menuitem"]:not(:disabled)')] : [];
export function nextMenuIndex(key: string, current: number, count: number): number | null {
if (count === 0) return null;
@@ -105,7 +111,8 @@ function MenuRows({
{item.heading && <div className={MENU_HEADING}>{item.heading}</div>}
<button
type="button"
- role="menuitem"
+ role={item.checked === undefined ? "menuitem" : "menuitemradio"}
+ aria-checked={item.checked}
data-tour={item.tourId}
data-menu-key={item.key}
title={item.title}
@@ -162,6 +169,7 @@ export function SidebarPopoverMenu({
ariaLabel,
openOnHover = false,
placement = "above",
+ align = "start",
triggerClassName = "w-full",
triggerTitle,
triggerLabel,
@@ -170,6 +178,7 @@ export function SidebarPopoverMenu({
renderTrigger,
}: {
placement?: "above" | "below";
+ align?: "start" | "end";
items: SidebarMenuItem[];
ariaLabel: string;
openOnHover?: boolean;
@@ -254,7 +263,7 @@ export function SidebarPopoverMenu({
const trigger = triggerRef.current, menu = menuRef.current;
if (!trigger || !menu) return;
const viewport = { width: window.innerWidth, height: window.innerHeight };
- if (anchored) setPosition(anchoredMenuPosition(trigger.getBoundingClientRect(), { width: menu.offsetWidth, height: menu.offsetHeight }, viewport, isRtl(trigger)));
+ if (anchored) setPosition(anchoredMenuPosition(trigger.getBoundingClientRect(), { width: menu.offsetWidth, height: menu.offsetHeight }, viewport, isRtl(trigger), align));
const sub = subRef.current, row = subRowRef.current;
if (sub && row) {
setSubPosition(submenuPosition(menu.getBoundingClientRect(), row.getBoundingClientRect(), { width: sub.offsetWidth, height: sub.offsetHeight }, viewport, isRtl(trigger)));
@@ -267,7 +276,7 @@ export function SidebarPopoverMenu({
window.removeEventListener("resize", place);
window.removeEventListener("scroll", place, true);
};
- }, [anchored, motion.shown, submenu, items.length]);
+ }, [anchored, align, motion.shown, submenu, items.length]);
// Focus waits until the anchored sheet is placed: a hidden sheet cannot take focus.
useEffect(() => {
diff --git a/src/components/bot-access/AccessOverview.dom.test.ts b/src/components/bot-access/AccessOverview.dom.test.ts
index 704a7ff762..061ee67516 100644
--- a/src/components/bot-access/AccessOverview.dom.test.ts
+++ b/src/components/bot-access/AccessOverview.dom.test.ts
@@ -1,6 +1,6 @@
// @vitest-environment happy-dom
-// Settings → Bot access in a real DOM: every team bot by every User, the owner, what everyone gets, a change applied at
-// once with Undo; and a viewer's "Ask Ada to chat".
+// Settings → Bot access in a real DOM: the team's bots, each row opening the Share dialog; the team's people, each with
+// their bots at quiet level menus; and a viewer's "Ask Ada to chat".
import { createElement } from "react";
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
@@ -25,6 +25,7 @@ const { AskToChat } = await import("./AskToChat");
const ADA = { email: "[email protected]", name: "Ada", role: "admin" };
const BOB = { email: "[email protected]", name: "Bob", role: "member" };
const CARA = { email: "[email protected]", name: "Cara", role: "member" };
+const DAN = { email: "[email protected]", name: "Dan", role: "member" };
const bot = (fields: Partial<Bot>): Bot => ({
id: "x", threadId: "t", name: "X", title: "", description: "", notifications: true, color: "teal", unread: false, messages: [],
modelSelection: { instanceId: "claude", model: "claude-opus-5-5" }, yourAccess: "edit", createdBy: ADA.email, ...fields,
@@ -37,18 +38,35 @@ let host: HTMLDivElement;
let root: Root;
const settle = async () => { for (let i = 0; i < 4; i++) await new Promise((resolve) => setTimeout(resolve, 0)); };
const render = (node: ReturnType<typeof createElement>) => flushSync(() => root.render(node));
-const select = (label: string) => document.querySelector<HTMLSelectElement>(`select[aria-label="${label}"]`)!;
-const choose = (label: string, value: string) => {
- const field = select(label);
- field.value = value;
- field.dispatchEvent(new Event("change", { bubbles: true }));
+const overview = async () => { render(createElement(AccessOverview)); await settle(); };
+const botRows = () => [...document.querySelectorAll<HTMLElement>("[data-access-row]")];
+const summaryOf = (id: string) => document.querySelector(`[data-access-row="${id}"] [data-access-summary]`)!.textContent;
+const search = async (text: string) => {
+ const field = document.querySelector<HTMLInputElement>("[data-access-search]")!;
+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(field, text);
+ field.dispatchEvent(new Event("input", { bubbles: true }));
+ await settle();
+};
+const byPerson = async () => {
+ document.querySelector<HTMLElement>('[data-access-listing="person"]')!.click();
+ await settle();
+};
+const openPerson = async (email: string) => {
+ document.querySelector<HTMLElement>(`[data-access-person="${email}"]`)!.click();
+ await settle();
+};
+const choose = async (label: string, key: string) => {
+ document.querySelector<HTMLElement>(`button[aria-label="${label}"]`)!.click();
+ await settle();
+ document.querySelector<HTMLElement>(`[role="menu"] [data-menu-key="${key}"]`)!.click();
+ await settle();
};
beforeEach(() => {
server.calls.length = 0;
server.bots = [payroll, helpdesk, bobsOwn];
server.answer = {};
- setTeamPeople({ people: [{ ...ADA, you: true }, BOB, CARA], me: { ...ADA, you: true }, admin: true, needsYou: [] });
+ setTeamPeople({ people: [{ ...ADA, you: true }, BOB, CARA, DAN], me: { ...ADA, you: true }, admin: true, needsYou: [] });
host = document.createElement("div");
document.body.append(host);
root = createRoot(host);
@@ -60,32 +78,122 @@ afterEach(() => {
setTeamPeople(null);
});
-it("lists each team bot with every User's level and what everyone gets, leaving out each person's own MausBot", () => {
- render(createElement(AccessOverview));
- expect([...document.querySelectorAll("[data-access-row]")].map((row) => row.getAttribute("data-access-row"))).toEqual(["helpdesk", "payroll"]);
- expect(select("Set for everyone: Payroll").value).toBe("none");
- expect(select("What Bob can do with Payroll").value).toBe("view");
- expect(document.querySelector('[data-access-row="payroll"] [data-access-cell="[email protected]"]')!.textContent).toBe("Owner");
- expect(select("What Bob can do with Helpdesk").value).toBe("chat");
- expect([...select("What Bob can do with Helpdesk").options].filter((option) => option.disabled).map((option) => option.value)).toEqual(["none", "view"]);
+it("lists each team bot once with its owner and a plain summary, leaving out each person's own MausBot", async () => {
+ await overview();
+ expect(botRows().map((row) => row.dataset.accessRow)).toEqual(["helpdesk", "payroll"]);
+ expect(document.querySelector('[data-access-row="payroll"]')!.textContent).toContain("Owner: Cara");
+ expect(summaryOf("payroll")).toBe("Only people added");
+ expect(summaryOf("helpdesk")).toBe("Everyone can chat");
+ expect(document.querySelector("[data-access-overview] table, [data-access-overview] select")).toBeNull();
});
-it("applies a cell or a whole row at once, with Undo", async () => {
- render(createElement(AccessOverview));
- choose("What Bob can do with Payroll", "edit");
+it("says a bot nobody owns has no owner yet", async () => {
+ server.bots = [bot({ id: "orphan", name: "Orphan", createdBy: undefined, access: { everyone: "view", people: {} } })];
+ await overview();
+ expect(document.querySelector('[data-access-row="orphan"]')!.textContent).toContain("No owner yet");
+ expect(summaryOf("orphan")).toBe("Everyone can view");
+});
+
+it("stacks up to four faces of those with their own access, then +N, naming them all", async () => {
+ const people = Object.fromEntries(["a", "b", "c", "d", "e", "f"].map((name) => [`${name}@acme.test`, "chat" as const]));
+ server.bots = [bot({ id: "many", name: "Many", access: { everyone: "none", people: { ...people, [ADA.email]: "edit" } } })];
+ await overview();
+ const stack = document.querySelector<HTMLElement>("[data-access-stack]")!;
+ expect(stack.dataset.accessStack).toBe("6");
+ expect(stack.children).toHaveLength(5);
+ expect(stack.lastElementChild!.textContent).toBe("+2");
+});
+
+it("opens the bot's Share dialog from its row, and a change there applies at once with Undo", async () => {
+ await overview();
+ document.querySelector<HTMLElement>('[data-access-row="payroll"]')!.click();
await settle();
+ expect(document.querySelector("[data-share-bot]")!.getAttribute("data-share-bot")).toBe("payroll");
+ await choose("What Bob can do", "edit");
expect(server.calls.at(-1)).toEqual({ path: "/api/bots/payroll/access", body: { everyone: "none", people: { [BOB.email]: "edit" } } });
const toast = document.querySelector<HTMLElement>("[data-access-toast]")!;
- expect(toast.textContent).toContain("Payroll: Bob · Can edit");
+ expect(toast.textContent).toContain("Bob · Can edit");
toast.querySelector("button")!.click();
await settle();
expect(server.calls.at(-1)).toEqual({ path: "/api/bots/payroll/access", body: payroll.access });
- choose("What Bob can do with Payroll", "none");
+});
+
+it("searches bots by name and by owner, and says when nothing matches", async () => {
+ await overview();
+ await search("help");
+ expect(botRows().map((row) => row.dataset.accessRow)).toEqual(["helpdesk"]);
+ await search("cara");
+ expect(botRows().map((row) => row.dataset.accessRow)).toEqual(["payroll"]);
+ await search("zzz");
+ expect(botRows()).toEqual([]);
+ expect(document.querySelector("[data-access-overview]")!.textContent).toContain("No bot matches");
+});
+
+it("lists every User by person with how many bots they have, and the search follows", async () => {
+ await overview();
+ await byPerson();
+ const rows = [...document.querySelectorAll<HTMLElement>("[data-access-person]")];
+ expect(rows.map((row) => row.dataset.accessPerson)).toEqual([BOB.email, CARA.email, DAN.email]);
+ expect(rows[0]!.textContent).toContain("2 bots");
+ expect(rows[2]!.textContent).toContain("1 bot");
+ await search("dan@");
+ expect([...document.querySelectorAll<HTMLElement>("[data-access-person]")].map((row) => row.dataset.accessPerson)).toEqual([DAN.email]);
+ await search("zzz");
+ expect(document.querySelector("[data-access-overview]")!.textContent).toContain("Nobody in the team matches");
+});
+
+it("shows a person's bots with the same level menus and Remove, Undo after each, and goes back to their row", async () => {
+ await overview();
+ await byPerson();
+ await openPerson(BOB.email);
+ expect([...document.querySelectorAll<HTMLElement>("[data-access-person-bot]")].map((row) => row.dataset.accessPersonBot)).toEqual(["helpdesk", "payroll"]);
+ expect(document.querySelector('button[aria-label="What Bob can do with Payroll"]')!.textContent).toBe("Can view");
+ await choose("What Bob can do with Payroll", "edit");
+ expect(server.calls.at(-1)).toEqual({ path: "/api/bots/payroll/access", body: { everyone: "none", people: { [BOB.email]: "edit" } } });
+ const toast = document.querySelector<HTMLElement>("[data-access-toast]")!;
+ expect(toast.textContent).toContain("Payroll: Bob · Can edit");
+ toast.querySelector("button")!.click();
await settle();
+ expect(server.calls.at(-1)!.body).toEqual(payroll.access);
+ await choose("What Bob can do with Payroll", "remove");
expect(server.calls.at(-1)!.body).toEqual({ everyone: "none", people: {} });
- choose("Set for everyone: Payroll", "view");
+ expect(document.querySelector("[data-access-toast]")!.textContent).toContain("Payroll: removed Bob");
+ document.querySelector<HTMLElement>("[data-access-back]")!.click();
+ await settle();
+ expect(document.activeElement).toBe(document.querySelector(`[data-access-person="${BOB.email}"]`));
+});
+
+it("offers no Remove for access that comes from everyone, nothing below it, and says Owner on the bots they own", async () => {
+ await overview();
+ await byPerson();
+ await openPerson(BOB.email);
+ expect(document.querySelector('[data-access-person-bot="helpdesk"]')!.textContent).toContain("Everyone in Acme");
+ document.querySelector<HTMLElement>('button[aria-label="What Bob can do with Helpdesk"]')!.click();
+ await settle();
+ const keys = [...document.querySelectorAll<HTMLButtonElement>('[role="menu"] [data-menu-key]')];
+ expect(keys.map((row) => row.dataset.menuKey)).toEqual(["view", "chat", "edit"]);
+ expect(keys.filter((row) => row.disabled).map((row) => row.dataset.menuKey)).toEqual(["view"]);
+ document.querySelector<HTMLElement>("[data-access-back]")!.click();
+ await settle();
+ await openPerson(CARA.email);
+ const owned = document.querySelector('[data-access-person-bot="payroll"]')!;
+ expect(owned.textContent).toContain("Owner");
+ expect(owned.querySelector("button")).toBeNull();
+});
+
+it("says so when there are no bots, nobody but admins, or a person with no bots", async () => {
+ server.bots = [];
+ await overview();
+ expect(document.querySelector("[data-access-overview]")!.textContent).toContain("There are no team bots yet.");
+ await byPerson();
+ await openPerson(BOB.email);
+ expect(document.querySelector("[data-access-overview]")!.textContent).toContain("Bob has no bots yet.");
+ document.querySelector<HTMLElement>("[data-access-back]")!.click();
+ await settle();
+ setTeamPeople({ people: [{ ...ADA, you: true }], me: { ...ADA, you: true }, admin: true, needsYou: [] });
await settle();
- expect(server.calls.at(-1)!.body).toEqual({ everyone: "view", people: { [BOB.email]: "view" } });
+ expect(document.querySelector("[data-access-overview]")!.textContent).toContain("Nobody but admins is on the team yet.");
});
it("asks the bot's owner by name, then says it asked", async () => {
diff --git a/src/components/bot-access/AccessOverview.tsx b/src/components/bot-access/AccessOverview.tsx
index 94c445a1df..4b76e69a28 100644
--- a/src/components/bot-access/AccessOverview.tsx
+++ b/src/components/bot-access/AccessOverview.tsx
@@ -1,40 +1,70 @@
-import { useCallback, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
+import { ChevronLeft, Search } from "lucide-react";
-import { atLeast, BOT_ACCESS_LEVELS, type BotAccess, type BotAccessLevel } from "../../../shared/bot-access";
+import { sharedLevel, type BotAccess, type BotAccessLevel, type GrantedLevel } from "../../../shared/bot-access";
import { botOwner } from "../../../shared/bot-owner";
+import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
import { useStore, type Bot } from "@/state/store";
-import { useTeamPeople, type TeamPerson } from "@/state/team-people";
+import { ownerOf, useTeamPeople, type TeamPeople, type TeamPerson } from "@/state/team-people";
import { BotAvatar } from "../Avatar";
-import { Select } from "../Select";
import { PersonFace } from "../TeamOwner";
-import { accessOfBot, levelLabel, saveAccess, withPerson } from "./access";
+import { accessOfBot, levelLabel, nameOf, personOf, saveAccess, withPerson } from "./access";
import { UndoToast, useTeamName } from "./ShareBotButton";
+import { ShareBotDialog } from "./ShareBotDialog";
+import { EntryFace, LevelMenu } from "./ShareControls";
type Change = { botId: string; before: BotAccess; after: BotAccess; text: string };
+type Listing = "bot" | "person";
+
+const STACK_SHOWN = 4;
+const ROW = "flex w-full min-w-0 items-center gap-3 px-3 py-2 text-start";
+const LIST = "flex flex-col divide-y divide-hairline/30 overflow-hidden rounded-xl border border-hairline/40 bg-card";
+const SUMMARY = {
+ none: "botAccess.onlyAdded",
+ view: "botAccess.overview.everyoneView",
+ chat: "botAccess.overview.everyoneChat",
+ edit: "botAccess.overview.everyoneEdit",
+} as const satisfies Record<BotAccessLevel, string>;
/** The team's bots a person shares: each person's own MausBot is theirs alone and stays out. */
export const sharedBots = (bots: readonly Bot[]): Bot[] =>
bots.filter((bot) => !bot.hidden && !bot.defaultBot?.person).sort((a, b) => a.name.localeCompare(b.name));
-/** What a person may do with the bot by its sharing: the higher of everyone's and theirs. */
-export function cellLevel(access: BotAccess, email: string): BotAccessLevel {
- const own = access.people[email];
- return own && atLeast(own, access.everyone) ? own : access.everyone;
-}
+const hasAccess = (bot: Bot, email: string): boolean => botOwner(bot) === email || sharedLevel(accessOfBot(bot), email) !== "none";
+
+const ownerLine = (bot: Bot, team: TeamPeople): string => {
+ const owner = ownerOf(bot, team);
+ return owner ? t("botAccess.overview.ownedBy", { name: owner.name }) : t("botAccess.overview.noOwner");
+};
+
+const includes = (wanted: string, ...parts: Array<string | undefined>): boolean => parts.some((part) => part?.toLowerCase().includes(wanted));
-/** Settings → Bot access on a team, for its admins: every team bot down the side, each User across with the level they
- * have, and what everyone in the team gets. The same sharing the bot's Share dialog changes, applied at once with Undo. */
+/** Settings → Bot access on a team, for its admins: the team's bots, or its people, each opening what can change there. */
export function AccessOverview() {
const { state } = useStore();
const team = useTeamPeople();
const teamName = useTeamName();
+ const rootRef = useRef<HTMLDivElement | null>(null);
+ const [listing, setListing] = useState<Listing>("bot");
+ const [query, setQuery] = useState("");
+ const [sharingId, setSharingId] = useState<string | null>(null);
+ const [personEmail, setPersonEmail] = useState<string | null>(null);
+ const cameFrom = useRef<string | null>(null);
const [change, setChange] = useState<Change | null>(null);
const [error, setError] = useState("");
const settled = useCallback(() => setChange(null), []);
+ useEffect(() => {
+ if (personEmail || !cameFrom.current) return;
+ [...(rootRef.current?.querySelectorAll<HTMLElement>("[data-access-person]") ?? [])].find((row) => row.dataset.accessPerson === cameFrom.current)?.focus();
+ cameFrom.current = null;
+ }, [personEmail]);
if (!team || !teamName) return null;
const members = team.people.filter((person) => person.role === "member").sort((a, b) => a.name.localeCompare(b.name));
const bots = sharedBots(state.bots);
+ const sharing = sharingId ? bots.find((bot) => bot.id === sharingId) : undefined;
+ const person = personEmail ? members.find((member) => member.email === personEmail) : undefined;
+ const wanted = query.trim().toLowerCase();
const apply = async (bot: Bot, after: BotAccess, text: string) => {
setError("");
@@ -48,70 +78,157 @@ export function AccessOverview() {
};
return (
- <div className="flex flex-col gap-3" data-access-overview>
- <p className="text-[13px] leading-relaxed text-ink-secondary">{t("botAccess.overview.intro", { team: teamName })}</p>
- {bots.length === 0 ? <p className="text-[13px] text-ink-secondary">{t("botAccess.overview.noBots")}</p> : (
- <div className="max-w-full overflow-x-auto rounded-xl border border-hairline/40 bg-card">
- <table className="w-full border-collapse text-[13px]">
- <thead>
- <tr className="border-b border-hairline/40 text-left text-ink-secondary">
- <th scope="col" className="sticky left-0 z-[1] bg-card px-3 py-2 font-medium">{t("botAccess.overview.bot")}</th>
- <th scope="col" className="px-3 py-2 font-medium">{t("botAccess.everyone", { team: teamName })}</th>
- {members.map((person) => (
- <th key={person.email} scope="col" className="px-3 py-2 font-medium">
- <span className="flex items-center gap-1.5 whitespace-nowrap"><PersonFace person={person} size={18} />{person.name}</span>
- </th>
- ))}
- </tr>
- </thead>
- <tbody>
- {bots.map((bot) => <BotRow key={bot.id} bot={bot} members={members} teamName={teamName} apply={apply} />)}
- </tbody>
- </table>
+ <div ref={rootRef} className="flex min-w-0 flex-col gap-3" data-access-overview>
+ {person ? (
+ <PersonBots person={person} bots={bots.filter((bot) => hasAccess(bot, person.email))} team={team} teamName={teamName} apply={apply}
+ onBack={() => { cameFrom.current = person.email; setPersonEmail(null); }} />
+ ) : <>
+ <p className="ps-4 text-[13px] leading-relaxed text-ink-secondary">{t("botAccess.overview.intro", { team: teamName })}</p>
+ <div className="flex flex-wrap items-center gap-2">
+ <div className="relative min-w-[180px] flex-1">
+ <Search size={14} aria-hidden="true" className="pointer-events-none absolute start-2.5 top-1/2 -translate-y-1/2 text-ink-secondary" />
+ <input type="search" value={query} data-access-search aria-label={t(listing === "bot" ? "botAccess.overview.searchBots" : "botAccess.overview.searchPeople")}
+ placeholder={t(listing === "bot" ? "botAccess.overview.searchBots" : "botAccess.overview.searchPeople")}
+ onChange={(event) => setQuery(event.target.value)}
+ onKeyDown={(event) => { if (event.key === "Escape" && query) { event.preventDefault(); setQuery(""); } }}
+ className="w-full rounded-lg border border-hairline/50 bg-transparent py-1.5 pe-2.5 ps-8 text-[13px] text-ink placeholder:text-ink-secondary focus:border-focus focus:outline-none" />
+ </div>
+ <div role="group" aria-label={t("botAccess.overview.listBy")} className="flex shrink-0 rounded-full bg-raised/70 p-0.5">
+ {(["bot", "person"] as const).map((entry) => (
+ <button key={entry} type="button" aria-pressed={listing === entry} data-access-listing={entry} onClick={() => { setListing(entry); setQuery(""); }}
+ className={cn("rounded-full px-3 py-1 text-[13px] leading-[18px]", listing === entry ? "bg-menu font-medium text-ink shadow-sm" : "text-ink-secondary hover:text-ink")}>
+ {t(entry === "bot" ? "botAccess.overview.byBot" : "botAccess.overview.byPerson")}
+ </button>
+ ))}
+ </div>
</div>
- )}
- {members.length === 0 && bots.length > 0 && <p className="text-[12px] text-ink-secondary">{t("botAccess.overview.noPeople")}</p>}
- <p className="text-[12px] text-ink-secondary">{t("botAccess.admins")}</p>
+ {listing === "bot"
+ ? <BotList bots={bots.filter((bot) => !wanted || includes(wanted, bot.name, ownerOf(bot, team)?.name, botOwner(bot) ?? undefined))} anyBots={bots.length > 0} team={team} onOpen={setSharingId} />
+ : <PeopleList people={members.filter((member) => !wanted || includes(wanted, member.name, member.email))} anyPeople={members.length > 0} bots={bots} onOpen={setPersonEmail} />}
+ <p className="ps-4 text-[12px] text-ink-secondary">{t("botAccess.admins")}</p>
+ </>}
{error && <p role="alert" className="text-[13px] text-danger">{error}</p>}
+ {sharing && <ShareBotDialog bot={sharing} teamName={teamName} onClose={() => setSharingId(null)}
+ onChanged={(next) => setChange({ botId: sharing.id, ...next })} />}
{change && <UndoToast key={`${change.botId}:${change.text}:${JSON.stringify(change.after)}`} text={change.text}
onUndo={() => saveAccess(change.botId, change.before)} onDone={settled} />}
</div>
);
}
-function BotRow({ bot, members, teamName, apply }: {
- bot: Bot; members: TeamPerson[]; teamName: string; apply: (bot: Bot, after: BotAccess, text: string) => Promise<void>;
+function BotList({ bots, anyBots, team, onOpen }: { bots: Bot[]; anyBots: boolean; team: TeamPeople; onOpen: (id: string) => void }) {
+ if (!anyBots) return <p className="text-[13px] text-ink-secondary">{t("botAccess.overview.noBots")}</p>;
+ if (!bots.length) return <p className="text-[13px] text-ink-secondary">{t("botAccess.overview.noBotMatch")}</p>;
+ return (
+ <ul className={LIST}>
+ {bots.map((bot) => {
+ const access = accessOfBot(bot);
+ const owner = botOwner(bot);
+ return (
+ <li key={bot.id} className="min-w-0">
+ <button type="button" aria-haspopup="dialog" data-access-row={bot.id} onClick={() => onOpen(bot.id)} className={cn(ROW, "hover:bg-ink/[0.06] focus-visible:bg-ink/[0.06] focus-visible:outline-none")}>
+ <BotAvatar bot={bot} size={32} />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-[14px] leading-[18px] text-ink">{bot.name}</span>
+ <span className="block truncate text-[12px] leading-4 text-ink-secondary">{ownerLine(bot, team)}</span>
+ </span>
+ <span className="min-w-0 max-w-[40%] truncate text-[13px] text-ink-secondary" data-access-summary>{t(SUMMARY[access.everyone])}</span>
+ <PeopleStack entries={Object.keys(access.people).filter((entry) => entry !== owner)} team={team} />
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ );
+}
+
+function PeopleStack({ entries, team }: { entries: string[]; team: TeamPeople }) {
+ if (!entries.length) return null;
+ const names = entries.map((entry) => nameOf(entry, team)).join(", ");
+ const beyond = entries.length - STACK_SHOWN;
+ return (
+ <span role="img" aria-label={names} title={names} data-access-stack={entries.length} className="flex shrink-0 -space-x-0.5 rtl:space-x-reverse">
+ {entries.slice(0, STACK_SHOWN).map((entry) => (
+ <span key={entry} className="flex rounded-full ring-2 ring-card"><EntryFace person={personOf(entry, team)} size={22} /></span>
+ ))}
+ {beyond > 0 && <span className="flex h-[22px] min-w-[22px] items-center justify-center rounded-full bg-card px-1 text-[11px] font-medium text-ink-secondary ring-2 ring-card">+{beyond}</span>}
+ </span>
+ );
+}
+
+function PeopleList({ people, anyPeople, bots, onOpen }: { people: TeamPerson[]; anyPeople: boolean; bots: Bot[]; onOpen: (email: string) => void }) {
+ if (!anyPeople) return <p className="text-[13px] text-ink-secondary">{t("botAccess.overview.noPeople")}</p>;
+ if (!people.length) return <p className="text-[13px] text-ink-secondary">{t("botAccess.noMatch")}</p>;
+ return (
+ <ul className={LIST}>
+ {people.map((person) => {
+ const count = bots.filter((bot) => hasAccess(bot, person.email)).length;
+ return (
+ <li key={person.email} className="min-w-0">
+ <button type="button" data-access-person={person.email} onClick={() => onOpen(person.email)} className={cn(ROW, "hover:bg-ink/[0.06] focus-visible:bg-ink/[0.06] focus-visible:outline-none")}>
+ <PersonFace person={person} size={32} />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-[14px] leading-[18px] text-ink">{person.name}</span>
+ <span className="block truncate text-[12px] leading-4 text-ink-secondary">{person.email}</span>
+ </span>
+ <span className="shrink-0 text-[13px] text-ink-secondary">{count === 1 ? t("botAccess.overview.botCount.one") : t("botAccess.overview.botCount.other", { count })}</span>
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ );
+}
+
+function PersonBots({ person, bots, team, teamName, apply, onBack }: {
+ person: TeamPerson; bots: Bot[]; team: TeamPeople; teamName: string;
+ apply: (bot: Bot, after: BotAccess, text: string) => Promise<void>; onBack: () => void;
+}) {
+ return (
+ <>
+ <div>
+ <button type="button" autoFocus data-access-back onClick={onBack} className="-ms-2 flex items-center gap-1 rounded-md px-2 py-1 text-[13px] text-ink-secondary hover:bg-ink/[0.06] hover:text-ink">
+ <ChevronLeft size={14} aria-hidden="true" className="rtl:-scale-x-100" />{t("botAccess.overview.allPeople")}
+ </button>
+ </div>
+ <div className="flex min-w-0 items-center gap-3 px-3">
+ <PersonFace person={person} size={32} />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-[14px] font-medium leading-[18px] text-ink">{person.name}</span>
+ <span className="block truncate text-[12px] leading-4 text-ink-secondary">{person.email}</span>
+ </span>
+ </div>
+ {bots.length === 0 ? <p className="px-3 text-[13px] text-ink-secondary">{t("botAccess.overview.noBotsForPerson", { name: person.name })}</p> : (
+ <ul className={LIST}>
+ {bots.map((bot) => <PersonBotRow key={bot.id} bot={bot} person={person} team={team} teamName={teamName} apply={apply} />)}
+ </ul>
+ )}
+ </>
+ );
+}
+
+function PersonBotRow({ bot, person, team, teamName, apply }: {
+ bot: Bot; person: TeamPerson; team: TeamPeople; teamName: string; apply: (bot: Bot, after: BotAccess, text: string) => Promise<void>;
}) {
const access = accessOfBot(bot);
- const owner = botOwner(bot);
+ const owns = botOwner(bot) === person.email;
+ const own = access.people[person.email];
+ const level = sharedLevel(access, person.email);
return (
- <tr className="border-b border-hairline/30 last:border-b-0" data-access-row={bot.id}>
- <th scope="row" className="sticky left-0 z-[1] bg-card px-3 py-1.5 text-left font-normal">
- <span className="flex items-center gap-2 whitespace-nowrap text-ink"><BotAvatar bot={bot} size={20} />{bot.name}</span>
- </th>
- <td className="px-3 py-1.5">
- <Select variant="ghost" aria-label={t("botAccess.overview.setForEveryone", { bot: bot.name })} value={access.everyone}
- onChange={(event) => {
- const everyone = event.target.value as BotAccessLevel;
- void apply(bot, { everyone, people: access.people }, t("botAccess.overview.toastEveryone", { bot: bot.name, team: teamName, level: levelLabel(everyone) }));
- }}>
- {BOT_ACCESS_LEVELS.map((level) => <option key={level} value={level}>{level === "none" ? t("botAccess.onlyAdded") : levelLabel(level)}</option>)}
- </Select>
- </td>
- {members.map((person) => (
- <td key={person.email} className="px-3 py-1.5" data-access-cell={person.email}>
- {person.email === owner ? <span className="whitespace-nowrap px-2.5 text-ink-secondary">{t("botAccess.owner")}</span> : (
- <Select variant="ghost" aria-label={t("botAccess.overview.cell", { name: person.name, bot: bot.name })} value={cellLevel(access, person.email)}
- onChange={(event) => {
- const level = event.target.value as BotAccessLevel;
- void apply(bot, withPerson(access, person.email, level === "none" || level === access.everyone ? null : level),
- t("botAccess.overview.toastPerson", { name: person.name, bot: bot.name, level: levelLabel(level) }));
- }}>
- {BOT_ACCESS_LEVELS.map((level) => <option key={level} value={level} disabled={!atLeast(level, access.everyone)}>{levelLabel(level)}</option>)}
- </Select>
- )}
- </td>
- ))}
- </tr>
+ <li className={ROW} data-access-person-bot={bot.id}>
+ <BotAvatar bot={bot} size={32} />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-[14px] leading-[18px] text-ink">{bot.name}</span>
+ <span className="block truncate text-[12px] leading-4 text-ink-secondary">{!own && !owns && level === access.everyone ? t("botAccess.everyone", { team: teamName }) : ownerLine(bot, team)}</span>
+ </span>
+ <span className="min-w-0 shrink-0">
+ {owns ? <span className="px-2 text-[13px] text-ink-secondary">{t("botAccess.owner")}</span> : (
+ <LevelMenu value={level as GrantedLevel} floor={access.everyone} removable={Boolean(own)} label={t("botAccess.overview.cell", { name: person.name, bot: bot.name })}
+ onChange={(next) => void apply(bot, withPerson(access, person.email, next), next
+ ? t("botAccess.overview.toastPerson", { name: person.name, bot: bot.name, level: levelLabel(next) })
+ : t("botAccess.overview.toastRemoved", { name: person.name, bot: bot.name }))} />
+ )}
+ </span>
+ </li>
);
}
diff --git a/src/components/bot-access/ShareBotButton.tsx b/src/components/bot-access/ShareBotButton.tsx
index 25eb4eb4ec..d1daf705ba 100644
--- a/src/components/bot-access/ShareBotButton.tsx
+++ b/src/components/bot-access/ShareBotButton.tsx
@@ -16,8 +16,8 @@ export function useTeamName(): string | null {
return typeof team?.name === "string" && team.name ? team.name : null;
}
-/** A bot's Share button on a team: opens who has access. `footer` holds what else the button offers there. */
-export function ShareBotButton({ bot, className, footer, iconSize = 16 }: { bot: Bot; className: string; footer?: ReactNode; iconSize?: number }) {
+/** A bot's Share button on a team: opens who has access. `headerMenu` holds what else the button offers there. */
+export function ShareBotButton({ bot, className, headerMenu, iconSize = 16 }: { bot: Bot; className: string; headerMenu?: ReactNode; iconSize?: number }) {
const teamName = useTeamName();
const [open, setOpen] = useState(false);
const [change, setChange] = useState<AccessChange | null>(null);
@@ -29,7 +29,7 @@ export function ShareBotButton({ bot, className, footer, iconSize = 16 }: { bot:
aria-haspopup="dialog" onClick={() => setOpen(true)} className={className}>
<Share size={iconSize} aria-hidden="true" className="pointer-events-none" />
</button>
- {open && <ShareBotDialog bot={bot} teamName={teamName} onClose={() => setOpen(false)} onChanged={setChange} footer={footer} />}
+ {open && <ShareBotDialog bot={bot} teamName={teamName} onClose={() => setOpen(false)} onChanged={setChange} headerMenu={headerMenu} />}
{change && <UndoToast key={`${change.text}:${JSON.stringify(change.after)}`} text={change.text}
onUndo={() => saveAccess(bot.id, change.before)} onDone={settled} />}
</>
diff --git a/src/components/bot-access/ShareBotDialog.dom.test.ts b/src/components/bot-access/ShareBotDialog.dom.test.ts
index 9a4916efa0..1151cfe786 100644
--- a/src/components/bot-access/ShareBotDialog.dom.test.ts
+++ b/src/components/bot-access/ShareBotDialog.dom.test.ts
@@ -1,17 +1,18 @@
// @vitest-environment happy-dom
-// A team bot's Share dialog in a real DOM: who has access at what level, adding a teammate, a change applied at once with
-// its Undo, and what someone who can't edit the bot is shown.
+// A team bot's Share dialog in a real DOM: who has access at what level, adding a teammate from the keyboard, a change
+// applied at once with its Undo, handing the bot on, and what someone who can't edit the bot is shown.
import { createElement } from "react";
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import type { Bot } from "@/state/store";
-const server = vi.hoisted(() => ({ calls: [] as Array<{ path: string; body: unknown }>, team: true }));
+const server = vi.hoisted(() => ({ calls: [] as Array<{ path: string; body: unknown }>, team: true, refuse: "" }));
vi.mock("@/state/store", async (importOriginal) => ({
...await importOriginal<typeof import("@/state/store")>(),
api: vi.fn(async (path: string, init?: RequestInit) => {
server.calls.push({ path, body: init?.body ? JSON.parse(String(init.body)) : undefined });
+ if (server.refuse) throw new Error(server.refuse);
return { bot: {} };
}),
useStore: () => ({ state: { config: server.team ? { team: { id: "team-acme", name: "Acme" } } : {} }, dispatch: vi.fn() }),
@@ -23,6 +24,7 @@ const { ShareBotButton } = await import("./ShareBotButton");
const ADA = { email: "[email protected]", name: "Ada", role: "admin" };
const BOB = { email: "[email protected]", name: "Bob", role: "member" };
const CARA = { email: "[email protected]", name: "Cara", role: "member" };
+const DAN = { email: "[email protected]", name: "Dan", role: "member" };
const EVE = { email: "[email protected]", name: "Eve", role: "member" };
const payroll = (fields: Partial<Bot>): Bot => ({
id: "payroll", threadId: "t-main", name: "Payroll", title: "", description: "", notifications: true, color: "teal", unread: false,
@@ -33,23 +35,35 @@ const editable = payroll({ yourAccess: "edit", access: { everyone: "none", peopl
let host: HTMLDivElement;
let root: Root;
const settle = async () => { for (let i = 0; i < 4; i++) await new Promise((resolve) => setTimeout(resolve, 0)); };
-const render = (bot: Bot) => flushSync(() => root.render(createElement(ShareBotButton, { bot, className: "" })));
+const render = (bot: Bot, more?: object) => flushSync(() => root.render(createElement(ShareBotButton, { bot, className: "", ...more })));
const dialog = () => document.querySelector<HTMLElement>("[data-share-bot]");
-const open = async (bot: Bot) => {
- render(bot);
+const open = async (bot: Bot, more?: object) => {
+ render(bot, more);
host.querySelector<HTMLButtonElement>("[data-share-bot-button]")!.click();
await settle();
};
-const choose = (label: string, value: string) => {
- const field = document.querySelector<HTMLSelectElement>(`select[aria-label="${label}"]`)!;
- field.value = value;
- field.dispatchEvent(new Event("change", { bubbles: true }));
+const menuOf = (label: string) => document.querySelector<HTMLButtonElement>(`[data-share-bot] button[aria-label="${label}"]`)!;
+const rows = () => [...document.querySelectorAll<HTMLButtonElement>('[role="menu"] [data-menu-key]')];
+const openMenu = async (label: string) => { menuOf(label).click(); await settle(); };
+const choose = async (label: string, key: string) => {
+ await openMenu(label);
+ rows().find((row) => row.dataset.menuKey === key)!.click();
+ await settle();
+};
+const field = () => dialog()!.querySelector<HTMLInputElement>('input[role="combobox"]')!;
+const press = async (key: string) => {
+ const event = new KeyboardEvent("keydown", { key, bubbles: true, cancelable: true });
+ (document.activeElement ?? document.body).dispatchEvent(event);
+ await settle();
+ return event;
};
+const offered = () => [...document.querySelectorAll<HTMLElement>("[data-share-suggestion]")];
beforeEach(() => {
server.calls.length = 0;
server.team = true;
- setTeamPeople({ people: [{ ...ADA, you: true }, BOB, CARA, EVE], me: { ...ADA, you: true }, admin: true, needsYou: [] });
+ server.refuse = "";
+ setTeamPeople({ people: [{ ...ADA, you: true }, BOB, CARA, DAN, EVE], me: { ...ADA, you: true }, admin: true, needsYou: [] });
host = document.createElement("div");
document.body.append(host);
root = createRoot(host);
@@ -61,19 +75,41 @@ afterEach(() => {
setTeamPeople(null);
});
-it("lists the owner first, then each person added with their level, and what everyone in the team gets", async () => {
+it("lists the owner first as quiet text, then each person added with their level, and what everyone in the team gets", async () => {
await open(editable);
- const rows = [...dialog()!.querySelectorAll("[data-share-person]")].map((row) => row.getAttribute("data-share-person"));
- expect(rows).toEqual([ADA.email, BOB.email, CARA.email]);
- expect(document.querySelector<HTMLSelectElement>('select[aria-label="What Bob can do"]')!.value).toBe("view");
+ expect([...dialog()!.querySelectorAll("[data-share-person]")].map((row) => row.getAttribute("data-share-person"))).toEqual([ADA.email, BOB.email, CARA.email]);
+ const owner = dialog()!.querySelector(`[data-share-person="${ADA.email}"]`)!;
+ expect(owner.textContent).toContain("Ada (you)");
+ expect(owner.textContent).toContain("Owner");
+ expect(owner.querySelector("button")).toBeNull();
+ expect(menuOf("What Bob can do").textContent).toBe("Can view");
+ expect(dialog()!.querySelector("select")).toBeNull();
expect(dialog()!.querySelector("[data-share-general]")!.getAttribute("data-share-general")).toBe("none");
expect(dialog()!.textContent).toContain("Admins can always edit every bot.");
});
+it("opens a level on a real menu: each level on two lines, a check on the current one, then a divider and Remove access", async () => {
+ await open(editable);
+ await openMenu("What Bob can do");
+ expect(rows().map((row) => row.dataset.menuKey)).toEqual(["view", "chat", "edit", "owner", "remove"]);
+ expect(rows().map((row) => row.getAttribute("role"))).toEqual(["menuitemradio", "menuitemradio", "menuitemradio", "menuitem", "menuitem"]);
+ expect(rows()[0]!.textContent).toBe("Can viewRead its shared conversations");
+ expect(rows().filter((row) => row.getAttribute("aria-checked") === "true").map((row) => row.dataset.menuKey)).toEqual(["view"]);
+ expect(rows()[0]!.querySelector("svg")).not.toBeNull();
+ expect(rows()[1]!.querySelector("svg")).toBeNull();
+ expect(document.querySelectorAll('[role="menu"] [role="separator"]')).toHaveLength(1);
+ expect(rows()[3]!.parentElement!.querySelector('[role="separator"]')).not.toBeNull();
+});
+
+it("offers nothing below what everyone already gets", async () => {
+ await open(payroll({ yourAccess: "edit", access: { everyone: "chat", people: { [BOB.email]: "edit" } } }));
+ await openMenu("What Bob can do");
+ expect(rows().filter((row) => row.disabled).map((row) => row.dataset.menuKey)).toEqual(["view"]);
+});
+
it("applies a change at once, says so with Undo, and Undo puts the sharing back", async () => {
await open(editable);
- choose("What Bob can do", "edit");
- await settle();
+ await choose("What Bob can do", "edit");
expect(server.calls).toEqual([{ path: "/api/bots/payroll/access", body: { everyone: "none", people: { [BOB.email]: "edit", [CARA.email]: "chat" } } }]);
const toast = document.querySelector<HTMLElement>("[data-access-toast]")!;
expect(toast.textContent).toContain("Bob · Can edit");
@@ -83,29 +119,161 @@ it("applies a change at once, says so with Undo, and Undo puts the sharing back"
expect(document.querySelector("[data-access-toast]")).toBeNull();
});
-it("adds a teammate from the team at Can chat, removes one, and opens the bot to everyone", async () => {
+it("sends nothing when the current level is chosen again", async () => {
await open(editable);
- const field = dialog()!.querySelector<HTMLInputElement>("input")!;
- field.focus();
- await settle();
- const offered = [...document.querySelectorAll("#share-bot-people [role=option]")].map((row) => row.textContent);
- expect(offered).toEqual([expect.stringContaining("Eve")]);
- document.querySelector<HTMLElement>("#share-bot-people [role=option]")!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true }));
+ await choose("What Bob can do", "view");
+ expect(server.calls).toEqual([]);
+});
+
+it("suggests teammates not yet added, and arrow keys and Enter add one at Can chat with Undo", async () => {
+ await open(editable);
+ field().focus();
await settle();
+ expect(offered().map((row) => row.dataset.shareSuggestion)).toEqual([DAN.email, EVE.email]);
+ expect(offered()[0]!.textContent).toContain("[email protected]");
+ expect(field().getAttribute("aria-expanded")).toBe("true");
+ expect(document.getElementById(field().getAttribute("aria-activedescendant")!)!.dataset.shareSuggestion).toBe(DAN.email);
+ await press("ArrowDown");
+ expect(document.getElementById(field().getAttribute("aria-activedescendant")!)!.dataset.shareSuggestion).toBe(EVE.email);
+ await press("ArrowDown");
+ await press("ArrowUp");
+ expect(offered().find((row) => row.getAttribute("aria-selected") === "true")!.dataset.shareSuggestion).toBe(EVE.email);
+ await press("Enter");
expect(server.calls.at(-1)!.body).toEqual({ everyone: "none", people: { [BOB.email]: "view", [CARA.email]: "chat", [EVE.email]: "chat" } });
- choose("What Cara can do", "remove");
+ expect(document.querySelector("[data-access-toast]")!.textContent).toContain("Added Eve · Can chat");
+ expect(offered()).toEqual([]);
+ expect(document.activeElement).toBe(field());
+});
+
+it("closes the suggestions on Escape first, and the dialog only on the next", async () => {
+ await open(editable);
+ field().focus();
await settle();
- expect(server.calls.at(-1)!.body).toEqual({ everyone: "none", people: { [BOB.email]: "view" } });
- choose("General access", "everyone");
+ await press("Escape");
+ expect(offered()).toEqual([]);
+ expect(dialog()).not.toBeNull();
+ await press("Escape");
+ expect(dialog()).toBeNull();
+});
+
+it.each([
+ ["none", "chat"],
+ ["view", "chat"],
+ ["chat", "chat"],
+] as const)("adds someone at Can chat when everyone gets %s", async (everyone, level) => {
+ await open(payroll({ yourAccess: "edit", access: { everyone, people: {} } }));
+ field().focus();
+ await settle();
+ offered()[0]!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, cancelable: true }));
await settle();
+ expect(server.calls.at(-1)!.body).toEqual({ everyone, people: { [BOB.email]: level } });
+});
+
+it("has nobody to add when everyone can already edit", async () => {
+ await open(payroll({ yourAccess: "edit", access: { everyone: "edit", people: {} } }));
+ expect(dialog()!.querySelector('input[role="combobox"]')).toBeNull();
+ expect(dialog()!.textContent).toContain("Everyone in the team can already edit it.");
+});
+
+it("removes a person, opens the bot to everyone and sets what everyone gets, each from a quiet menu", async () => {
+ await open(editable);
+ await choose("What Cara can do", "remove");
+ expect(server.calls.at(-1)!.body).toEqual({ everyone: "none", people: { [BOB.email]: "view" } });
+ await choose("General access", "everyone");
expect(server.calls.at(-1)!.body).toEqual({ everyone: "chat", people: editable.access!.people });
+ flushSync(() => root.unmount());
+ document.body.innerHTML = "";
+ host = document.createElement("div");
+ document.body.append(host);
+ root = createRoot(host);
+ await open(payroll({ yourAccess: "edit", access: { everyone: "chat", people: {} } }));
+ expect(dialog()!.textContent).toContain("Everyone in Acme can find it and chat with it.");
+ await openMenu("What everyone in Acme can do");
+ expect(rows().map((row) => row.dataset.menuKey)).toEqual(["view", "chat", "edit"]);
+ rows()[2]!.click();
+ await settle();
+ expect(server.calls.at(-1)!.body).toEqual({ everyone: "edit", people: {} });
+ await choose("General access", "none");
+ expect(server.calls.at(-1)!.body).toEqual({ everyone: "none", people: {} });
+});
+
+it("hands the bot to someone added only after a confirmation", async () => {
+ await open(editable);
+ await choose("What Bob can do", "owner");
+ expect(server.calls).toEqual([]);
+ expect(dialog()!.querySelector(`[data-share-make-owner="${BOB.email}"]`)!.textContent).toContain("Make Bob the owner?");
+ expect(document.activeElement?.textContent).toBe("Cancel");
+ await press("Escape");
+ expect(dialog()!.querySelector("[data-share-make-owner]")).toBeNull();
+ expect(dialog()).not.toBeNull();
+ await choose("What Bob can do", "owner");
+ [...dialog()!.querySelectorAll("button")].find((button) => button.textContent === "Make owner")!.click();
+ await settle();
+ expect(server.calls).toEqual([{ path: "/api/bots/payroll/reports-to", body: { email: BOB.email } }]);
+ expect(dialog()!.querySelector("[data-share-make-owner]")).toBeNull();
+});
+
+it("stays on the confirmation and says why when the handover is refused", async () => {
+ await open(editable);
+ await choose("What Bob can do", "owner");
+ server.refuse = "Bob already has a Chief of Staff";
+ [...dialog()!.querySelectorAll("button")].find((button) => button.textContent === "Make owner")!.click();
+ await settle();
+ expect(dialog()!.querySelector("[data-share-make-owner]")!.querySelector('[role="alert"]')!.textContent).toBe("Bob already has a Chief of Staff");
+ dialog()!.focus();
+ await press("Escape");
+ expect(dialog()!.querySelector("[data-share-make-owner]")).toBeNull();
+ expect(dialog()!.querySelector('[role="alert"]')).toBeNull();
});
-it("shows someone who can't edit the bot their own level and its owner, never the list or the controls", async () => {
+it("offers Make owner only to whoever may hand it on, and never for an address nobody on the team has", async () => {
+ setTeamPeople({ people: [ADA, BOB, CARA, { ...DAN, you: true }, EVE], me: { ...DAN, you: true }, admin: false, needsYou: [] });
+ await open(payroll({ yourAccess: "edit", access: { everyone: "none", people: { [BOB.email]: "view", [DAN.email]: "edit" } } }));
+ await openMenu("What Bob can do");
+ expect(rows().map((row) => row.dataset.menuKey)).toEqual(["view", "chat", "edit", "remove"]);
+ flushSync(() => root.unmount());
+ document.body.innerHTML = "";
+ host = document.createElement("div");
+ document.body.append(host);
+ root = createRoot(host);
+ setTeamPeople({ people: [{ ...ADA, you: true }, BOB], me: { ...ADA, you: true }, admin: true, needsYou: [] });
+ await open(payroll({ yourAccess: "edit", access: { everyone: "none", people: { "@acme.test": "chat" } } }));
+ await openMenu("What @acme.test can do");
+ expect(rows().map((row) => row.dataset.menuKey)).toEqual(["view", "chat", "edit", "remove"]);
+});
+
+it("shows someone who can't edit the same layout read only: their level, the owner and the admins line", async () => {
+ setTeamPeople({ people: [ADA, { ...BOB, you: true }], me: { ...BOB, you: true }, admin: false, needsYou: [] });
await open(payroll({ yourAccess: "view" }));
- expect(dialog()!.querySelector("[data-share-yours]")!.textContent).toContain("You can view Payroll");
- expect([...dialog()!.querySelectorAll("[data-share-person]")].map((row) => row.getAttribute("data-share-person"))).toEqual([ADA.email]);
- expect(dialog()!.querySelector("input, select, [data-share-general]")).toBeNull();
+ expect([...dialog()!.querySelectorAll("[data-share-person]")].map((row) => row.getAttribute("data-share-person"))).toEqual([ADA.email, BOB.email]);
+ const yours = dialog()!.querySelector("[data-share-yours]")!;
+ expect(yours.textContent).toContain("Bob (you)");
+ expect(yours.textContent).toContain("Can view");
+ expect(dialog()!.textContent).toContain("Admins can always edit every bot.");
+ expect(dialog()!.querySelector("input, select, [data-share-general], [aria-haspopup=menu]")).toBeNull();
+});
+
+it("keeps its keys to itself over Settings, which listens on the window, and Escape closes only it", async () => {
+ const reached: string[] = [];
+ const listen = (event: KeyboardEvent) => { reached.push(event.key); };
+ window.addEventListener("keydown", listen);
+ try {
+ await open(editable);
+ field().focus();
+ await press("Tab");
+ await press("Escape");
+ await press("Escape");
+ } finally {
+ window.removeEventListener("keydown", listen);
+ }
+ expect(reached).toEqual([]);
+ expect(dialog()).toBeNull();
+});
+
+it("draws what else its opener offers in the header, with only Done at its foot", async () => {
+ await open(editable, { headerMenu: createElement("button", { type: "button", "data-more": true }, "More") });
+ expect(dialog()!.querySelector("header [data-more]")).not.toBeNull();
+ expect([...dialog()!.querySelectorAll("footer button")].map((button) => button.textContent)).toEqual(["Done"]);
});
it("is not there off a team", () => {
diff --git a/src/components/bot-access/ShareBotDialog.tsx b/src/components/bot-access/ShareBotDialog.tsx
index fcb0e51664..271f1d9aa6 100644
--- a/src/components/bot-access/ShareBotDialog.tsx
+++ b/src/components/bot-access/ShareBotDialog.tsx
@@ -1,103 +1,135 @@
-import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
+import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from "react";
import { createPortal } from "react-dom";
-import { AtSign, Lock, Users, X } from "lucide-react";
+import { Lock, Users } from "lucide-react";
-import { atLeast, GRANTED_LEVELS, type BotAccess, type BotAccessLevel, type GrantedLevel } from "../../../shared/bot-access";
+import type { BotAccess, BotAccessLevel, GrantedLevel } from "../../../shared/bot-access";
import { botOwner } from "../../../shared/bot-owner";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
-import type { Bot } from "@/state/store";
-import { ownerOf, useTeamPeople, type TeamPeople, type TeamPerson } from "@/state/team-people";
-import { Select } from "../Select";
-import { PersonFace } from "../TeamOwner";
-import { accessOfBot, addablePeople, canShare, levelLabel, levelWhenAdded, saveAccess, withPerson } from "./access";
+import { useStore, type Bot } from "@/state/store";
+import { mayChangeOwner, ownerChanged, ownerOf, useTeamPeople, type TeamPeople, type TeamPerson } from "@/state/team-people";
+import { MENU_SHEET } from "../menu-recipe";
+import { accessOfBot, addablePeople, canShare, levelLabel, levelWhenAdded, nameOf, personOf, saveAccess, saveOwner, withPerson } from "./access";
+import { choiceItem, EntryFace, LevelMenu, QuietMenu } from "./ShareControls";
export interface AccessChange { before: BotAccess; after: BotAccess; text: string }
-const REMOVE = "remove";
-
/** A bot's Share dialog on a team: who has access and at what level, and what everyone in the team gets. A change
- * applies at once; the caller shows it with Undo. */
-export function ShareBotDialog({ bot, teamName, onClose, onChanged, footer }: {
+ * applies at once; the caller shows it with Undo. `headerMenu` holds what else the opener offers there. */
+export function ShareBotDialog({ bot, teamName, onClose, onChanged, headerMenu }: {
bot: Bot;
teamName: string;
onClose: () => void;
onChanged: (change: AccessChange) => void;
- footer?: ReactNode;
+ headerMenu?: ReactNode;
}) {
const team = useTeamPeople();
+ const { dispatch } = useStore();
const dialogRef = useRef<HTMLDivElement | null>(null);
const [error, setError] = useState("");
const [busy, setBusy] = useState(false);
+ const [newOwner, setNewOwner] = useState<TeamPerson | null>(null);
const access = accessOfBot(bot);
const owner = team ? ownerOf(bot, team) : null;
const editable = canShare(bot);
+ const handsOver = mayChangeOwner(bot, team);
useEffect(() => {
const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
dialogRef.current?.focus();
return () => { if (opener?.isConnected) opener.focus(); };
}, []);
+ useEffect(() => {
+ if (document.activeElement === document.body) dialogRef.current?.focus();
+ }, [bot.access, bot.reportsTo, newOwner]);
- const apply = async (after: BotAccess, text: string) => {
+ const run = async (work: () => Promise<void>) => {
if (busy) return;
setBusy(true);
setError("");
try {
- await saveAccess(bot.id, after);
- onChanged({ before: access, after, text });
+ await work();
} catch (cause) {
setError(cause instanceof Error ? cause.message : String(cause));
} finally {
setBusy(false);
}
};
+ const apply = (after: BotAccess, text: string) => run(async () => {
+ await saveAccess(bot.id, after);
+ onChanged({ before: access, after, text });
+ });
+ const handOver = (person: TeamPerson) => run(async () => {
+ dispatch({ type: "botPatched", bot: await saveOwner(bot.id, person.email) });
+ ownerChanged();
+ setNewOwner(null);
+ });
+
+ const keepOwner = () => {
+ setError("");
+ setNewOwner(null);
+ };
+
+ const yourRow = !editable && team?.me && bot.yourAccess && bot.yourAccess !== "none"
+ ? <PersonRow person={team.me} you data-share-yours trailing={<span className="px-2 text-[13px] text-ink-secondary">{levelLabel(bot.yourAccess)}</span>} /> : null;
return createPortal(
- <div className="fixed inset-0 z-[60] flex items-center justify-center bg-black/55 p-4" onMouseDown={(event) => {
+ <div className="ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4" onMouseDown={(event) => {
if (event.target === event.currentTarget) onClose();
}}>
<div ref={dialogRef} role="dialog" aria-modal="true" aria-labelledby="share-bot-title" tabIndex={-1} data-share-bot={bot.id}
- className="flex max-h-[90vh] w-full max-w-[520px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none"
+ className="ui-modal flex max-h-full w-full max-w-[480px] flex-col text-ink shadow-2xl outline-none"
onKeyDown={(event) => {
- if (event.key === "Escape" && !event.defaultPrevented) { event.stopPropagation(); onClose(); }
+ event.stopPropagation();
+ if (event.key === "Escape" && !event.defaultPrevented) {
+ if (newOwner) keepOwner(); else onClose();
+ }
if (event.key === "Tab") trapTab(event, dialogRef.current);
}}>
- <header className="flex items-center justify-between gap-3 px-5 pb-1 pt-4">
- <h2 id="share-bot-title" className="truncate text-[17px] font-semibold">{t("botAccess.title", { bot: bot.name })}</h2>
- <button type="button" aria-label={t("common.close")} onClick={onClose} className="rounded-lg p-1.5 text-ink-secondary hover:bg-raised"><X size={18} /></button>
- </header>
- <div className="min-h-0 flex-1 overflow-y-auto px-5 pb-4 pt-2">
- {editable && team && <AddPerson team={team} access={access} owner={botOwner(bot)} disabled={busy}
- onAdd={(person, level) => void apply(withPerson(access, person.email, level), t("botAccess.toast.added", { name: person.name, level: levelLabel(level) }))} />}
- {!editable && <p className="mb-3 text-[13px] leading-relaxed text-ink-secondary" data-share-yours>{yoursLine(bot)}</p>}
-
- <h3 className="mb-1 mt-3 text-[13px] font-semibold">{t("botAccess.people")}</h3>
- <ul className="flex flex-col">
- {owner && <PersonRow person={owner} you={owner.you === true} trailing={<span className="text-[13px] text-ink-secondary">{t("botAccess.owner")}</span>} />}
- {editable && Object.entries(access.people).sort(([a], [b]) => nameOf(a, team).localeCompare(nameOf(b, team))).map(([entry, level]) => (
- <PersonRow key={entry} entry={entry} person={personOf(entry, team)} you={team?.me?.email === entry}
- trailing={<LevelSelect value={level} floor={access.everyone} disabled={busy} label={t("botAccess.levelFor", { name: nameOf(entry, team) })}
- onChange={(next) => void apply(withPerson(access, entry, next), next
- ? t("botAccess.toast.changed", { name: nameOf(entry, team), level: levelLabel(next) })
- : t("botAccess.toast.removed", { name: nameOf(entry, team) }))} />} />
- ))}
- </ul>
- <p className="mt-1.5 text-[12px] leading-relaxed text-ink-secondary">{t("botAccess.admins")}</p>
-
- {editable && <>
- <h3 className="mb-1.5 mt-4 text-[13px] font-semibold">{t("botAccess.general")}</h3>
- <GeneralAccess access={access} teamName={teamName} disabled={busy}
- onChange={(everyone) => void apply({ everyone, people: access.people }, everyone === "none"
- ? t("botAccess.toast.onlyAdded")
- : t("botAccess.toast.everyone", { team: teamName, level: levelLabel(everyone) }))} />
- </>}
- {error && <p role="alert" className="mt-3 text-[13px] text-danger">{error}</p>}
- </div>
- <footer className="flex items-center justify-between gap-3 border-t border-hairline/40 px-5 py-3">
- <div className="flex min-w-0 flex-wrap items-center gap-1">{footer}</div>
- <button type="button" onClick={onClose} className="rounded-full bg-accent px-4 py-1.5 text-[13px] font-semibold text-white hover:brightness-110">{t("common.done")}</button>
- </footer>
+ {newOwner ? (
+ <MakeOwner person={newOwner} bot={bot} busy={busy} error={error} onCancel={keepOwner} onConfirm={() => void handOver(newOwner)} />
+ ) : <>
+ <header className="flex items-center justify-between gap-3 px-5 pb-3 pt-4">
+ <h2 id="share-bot-title" className="min-w-0 truncate text-[17px] font-semibold">{t("botAccess.title", { bot: bot.name })}</h2>
+ {headerMenu}
+ </header>
+ {editable && team && (
+ <div className="relative z-10 shrink-0 px-5 pb-1">
+ <AddPerson team={team} access={access} owner={botOwner(bot)} disabled={busy}
+ onAdd={(person, level) => void apply(withPerson(access, person.email, level), t("botAccess.toast.added", { name: person.name, level: levelLabel(level) }))} />
+ </div>
+ )}
+ <div className="min-h-0 flex-1 overflow-y-auto px-5 pb-2 pt-3">
+ <h3 className="mb-1 text-[13px] font-semibold">{t("botAccess.people")}</h3>
+ <ul data-share-people className="flex max-h-[min(264px,40vh)] flex-col overflow-y-auto">
+ {owner && <PersonRow person={owner} you={owner.you === true} trailing={<span className="px-2 text-[13px] text-ink-secondary">{t("botAccess.owner")}</span>} />}
+ {yourRow}
+ {editable && Object.entries(access.people).sort(([a], [b]) => nameOf(a, team).localeCompare(nameOf(b, team))).map(([entry, level]) => {
+ const person = personOf(entry, team);
+ return (
+ <PersonRow key={entry} entry={entry} person={person} you={team?.me?.email === entry}
+ trailing={<LevelMenu value={level} floor={access.everyone} removable disabled={busy} label={t("botAccess.levelFor", { name: nameOf(entry, team) })}
+ onMakeOwner={handsOver && person ? () => { setError(""); setNewOwner(person); } : undefined}
+ onChange={(next) => void apply(withPerson(access, entry, next), next
+ ? t("botAccess.toast.changed", { name: nameOf(entry, team), level: levelLabel(next) })
+ : t("botAccess.toast.removed", { name: nameOf(entry, team) }))} />} />
+ );
+ })}
+ </ul>
+ <p className="mt-1.5 text-[12px] leading-relaxed text-ink-secondary">{t("botAccess.admins")}</p>
+ {editable && <>
+ <h3 className="mb-1.5 mt-4 text-[13px] font-semibold">{t("botAccess.general")}</h3>
+ <GeneralAccess access={access} teamName={teamName} disabled={busy}
+ onChange={(everyone) => void apply({ everyone, people: access.people }, everyone === "none"
+ ? t("botAccess.toast.onlyAdded")
+ : t("botAccess.toast.everyone", { team: teamName, level: levelLabel(everyone) }))} />
+ </>}
+ {error && <p role="alert" className="mt-3 text-[13px] text-danger">{error}</p>}
+ </div>
+ <footer className="flex shrink-0 justify-end px-5 pb-4 pt-3">
+ <button type="button" onClick={onClose} className="ui-button ui-button-primary rounded-full px-4">{t("common.done")}</button>
+ </footer>
+ </>}
</div>
</div>,
document.body,
@@ -105,52 +137,43 @@ export function ShareBotDialog({ bot, teamName, onClose, onChanged, footer }: {
}
function trapTab(event: React.KeyboardEvent, dialog: HTMLElement | null) {
- const controls = dialog?.querySelectorAll<HTMLElement>("input:enabled, select:enabled, button:enabled");
+ const controls = dialog?.querySelectorAll<HTMLElement>("input:enabled, button:enabled");
if (!controls?.length) return;
const first = controls[0]!, last = controls[controls.length - 1]!;
if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); }
}
-function yoursLine(bot: Bot): string {
- switch (bot.yourAccess) {
- case "view": return t("botAccess.yours.view", { bot: bot.name });
- case "chat": return t("botAccess.yours.chat", { bot: bot.name });
- default: return t("botAccess.yours.other", { bot: bot.name });
- }
+function MakeOwner({ person, bot, busy, error, onCancel, onConfirm }: {
+ person: TeamPerson; bot: Bot; busy: boolean; error: string; onCancel: () => void; onConfirm: () => void;
+}) {
+ return (
+ <div data-share-make-owner={person.email} className="px-5 pb-4 pt-4">
+ <h2 id="share-bot-title" className="text-[17px] font-semibold">{t("botAccess.makeOwnerTitle", { name: person.name })}</h2>
+ <p className="mt-2 text-[13px] leading-relaxed text-ink-secondary">{t("botAccess.makeOwnerBody", { name: person.name, bot: bot.name })}</p>
+ {error && <p role="alert" className="mt-3 text-[13px] text-danger">{error}</p>}
+ <div className="mt-5 flex justify-end gap-2">
+ <button type="button" autoFocus disabled={busy} onClick={onCancel} className="ui-button rounded-full px-4">{t("common.cancel")}</button>
+ <button type="button" disabled={busy} onClick={onConfirm} className="ui-button ui-button-primary rounded-full px-4">{t("botAccess.makeOwner")}</button>
+ </div>
+ </div>
+ );
}
-const personOf = (entry: string, team: TeamPeople | null): TeamPerson | null => team?.people.find((person) => person.email === entry) ?? null;
-const nameOf = (entry: string, team: TeamPeople | null): string => personOf(entry, team)?.name ?? entry;
-
-function PersonRow({ person, entry, you, trailing }: { person: TeamPerson | null; entry?: string; you: boolean; trailing: ReactNode }) {
+function PersonRow({ person, entry, you, trailing, ...data }: { person: TeamPerson | null; entry?: string; you: boolean; trailing: ReactNode; "data-share-yours"?: boolean }) {
const name = person?.name ?? entry ?? "";
return (
- <li className="flex min-h-[44px] items-center gap-3 py-1" data-share-person={person?.email ?? entry}>
- {person ? <PersonFace person={person} size={28} />
- : <span aria-hidden="true" className="inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-raised text-ink-secondary"><AtSign size={14} /></span>}
+ <li className="flex min-h-[40px] shrink-0 items-center gap-3 py-1" data-share-person={person?.email ?? entry} {...data}>
+ <EntryFace person={person} size={32} />
<span className="min-w-0 flex-1">
- <span className="block truncate text-[14px] text-ink">{you ? t("botAccess.you", { name }) : name}</span>
- {person && <span className="block truncate text-[12px] text-ink-secondary">{person.email}</span>}
+ <span className="block truncate text-[14px] leading-[18px] text-ink">{you ? t("botAccess.you", { name }) : name}</span>
+ {person && <span className="block truncate text-[12px] leading-4 text-ink-secondary">{person.email}</span>}
</span>
- <span className="shrink-0">{trailing}</span>
+ <span className="min-w-0 shrink-0">{trailing}</span>
</li>
);
}
-function LevelSelect({ value, floor, disabled, label, onChange }: {
- value: GrantedLevel; floor: BotAccessLevel; disabled: boolean; label: string; onChange: (level: GrantedLevel | null) => void;
-}) {
- const shown = atLeast(value, floor) ? value : (floor as GrantedLevel);
- return (
- <Select variant="ghost" aria-label={label} value={shown} disabled={disabled}
- onChange={(event) => onChange(event.target.value === REMOVE ? null : event.target.value as GrantedLevel)}>
- {GRANTED_LEVELS.map((level) => <option key={level} value={level} disabled={!atLeast(level, floor)}>{levelLabel(level)}</option>)}
- <option value={REMOVE}>{t("botAccess.remove")}</option>
- </Select>
- );
-}
-
function GeneralAccess({ access, teamName, disabled, onChange }: {
access: BotAccess; teamName: string; disabled: boolean; onChange: (everyone: BotAccessLevel) => void;
}) {
@@ -158,27 +181,23 @@ function GeneralAccess({ access, teamName, disabled, onChange }: {
const hint = access.everyone === "view" ? t("botAccess.everyoneHint.view", { team: teamName })
: access.everyone === "chat" ? t("botAccess.everyoneHint.chat", { team: teamName })
: access.everyone === "edit" ? t("botAccess.everyoneHint.edit", { team: teamName }) : t("botAccess.onlyAddedHint");
+ const only = t("botAccess.onlyAdded"), all = t("botAccess.everyone", { team: teamName });
return (
- <div className="flex items-start gap-3" data-share-general={access.everyone}>
- <span aria-hidden="true" className={cn("mt-0.5 inline-flex size-7 shrink-0 items-center justify-center rounded-full", everyone ? "bg-accent/15 text-accent" : "bg-raised text-ink-secondary")}>
- {everyone ? <Users size={14} /> : <Lock size={14} />}
+ <div className="flex items-center gap-3" data-share-general={access.everyone}>
+ <span aria-hidden="true" className={cn("inline-flex size-8 shrink-0 items-center justify-center rounded-full", everyone ? "bg-accent/15 text-accent" : "bg-ink/[0.08] text-ink-secondary")}>
+ {everyone ? <Users size={16} /> : <Lock size={16} />}
</span>
<div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center gap-2">
- <Select variant="ghost" aria-label={t("botAccess.general")} value={everyone ? "everyone" : "none"} disabled={disabled}
- onChange={(event) => onChange(event.target.value === "none" ? "none" : "chat")}>
- <option value="none">{t("botAccess.onlyAdded")}</option>
- <option value="everyone">{t("botAccess.everyone", { team: teamName })}</option>
- </Select>
- {everyone && (
- <Select variant="ghost" aria-label={t("botAccess.everyoneLevel", { team: teamName })} value={access.everyone} disabled={disabled}
- onChange={(event) => onChange(event.target.value as GrantedLevel)}>
- {GRANTED_LEVELS.map((level) => <option key={level} value={level}>{levelLabel(level)}</option>)}
- </Select>
- )}
+ <div className="-ms-2 flex">
+ <QuietMenu label={t("botAccess.general")} shown={everyone ? all : only} align="start" className="font-medium text-ink"
+ items={[
+ choiceItem("none", only, !everyone, () => { if (everyone) onChange("none"); }, { disabled }),
+ choiceItem("everyone", all, everyone, () => { if (!everyone) onChange("chat"); }, { disabled }),
+ ]} />
</div>
- <p className="mt-0.5 text-[12px] leading-relaxed text-ink-secondary">{hint}</p>
+ <p className="text-[12px] leading-4 text-ink-secondary">{hint}</p>
</div>
+ {everyone && <span className="shrink-0"><LevelMenu value={access.everyone as GrantedLevel} disabled={disabled} label={t("botAccess.everyoneLevel", { team: teamName })} onChange={(level) => { if (level) onChange(level); }} /></span>}
</div>
);
}
@@ -188,43 +207,62 @@ function AddPerson({ team, access, owner, disabled, onAdd }: {
}) {
const [query, setQuery] = useState("");
const [open, setOpen] = useState(false);
+ const [active, setActive] = useState(0);
+ const listId = useId();
+ const listRef = useRef<HTMLUListElement | null>(null);
const level = levelWhenAdded(access.everyone);
- const matches = useMemo(() => addablePeople(team, access, owner, query).slice(0, 8), [team, access, owner, query]);
- if (!level) return <p className="text-[13px] text-ink-secondary">{t("botAccess.everyoneEdits")}</p>;
+ const matches = useMemo(() => addablePeople(team, access, owner, query), [team, access, owner, query]);
+ const current = Math.min(active, matches.length - 1);
+ const showing = open && matches.length > 0;
+ useEffect(() => {
+ if (showing) listRef.current?.querySelector('[aria-selected="true"]')?.scrollIntoView?.({ block: "nearest" });
+ }, [showing, current]);
+ if (!level) return <p className="py-1 text-[13px] text-ink-secondary">{t("botAccess.everyoneEdits")}</p>;
const add = (person: TeamPerson) => {
+ if (disabled) return;
onAdd(person, level);
setQuery("");
+ setActive(0);
setOpen(false);
};
+ const move = (by: number) => {
+ if (!open) { setOpen(true); return; }
+ if (matches.length) setActive((current + by + matches.length) % matches.length);
+ };
return (
- <div className="relative">
- <input value={query} disabled={disabled} placeholder={t("botAccess.addPlaceholder")} aria-label={t("botAccess.addPlaceholder")}
- role="combobox" aria-expanded={open && matches.length > 0} aria-controls="share-bot-people" aria-autocomplete="list"
- onChange={(event) => { setQuery(event.target.value); setOpen(true); }}
+ <>
+ <input value={query} placeholder={t("botAccess.addPlaceholder")} aria-label={t("botAccess.addPlaceholder")}
+ role="combobox" aria-expanded={showing} aria-controls={listId} aria-autocomplete="list"
+ aria-activedescendant={showing ? `${listId}-${current}` : undefined}
+ onChange={(event) => { setQuery(event.target.value); setActive(0); setOpen(true); }}
+ onClick={() => setOpen(true)}
onFocus={() => setOpen(true)}
- onBlur={() => window.setTimeout(() => setOpen(false), 120)}
+ onBlur={() => setOpen(false)}
onKeyDown={(event) => {
- if (event.key === "Enter" && matches[0]) { event.preventDefault(); add(matches[0]); }
+ if (event.key === "ArrowDown") { event.preventDefault(); move(1); }
+ if (event.key === "ArrowUp") { event.preventDefault(); move(-1); }
+ if (event.key === "Enter" && showing) { event.preventDefault(); add(matches[current]!); }
if (event.key === "Escape" && open) { event.preventDefault(); setOpen(false); }
}}
- className="w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink placeholder:text-ink-secondary focus:border-focus focus:outline-none" />
+ className="w-full rounded-lg border border-hairline/50 bg-transparent px-3 py-2 text-[14px] text-ink placeholder:text-ink-secondary focus:border-focus focus:outline-none" />
{open && (
- <ul id="share-bot-people" role="listbox" className="absolute inset-x-0 top-full z-10 mt-1 max-h-[240px] overflow-y-auto rounded-xl border border-hairline/50 bg-card py-1 shadow-xl">
+ <ul ref={listRef} id={listId} role="listbox" onMouseDown={(event) => event.preventDefault()}
+ className={cn(MENU_SHEET, "absolute inset-x-5 top-full max-h-[min(240px,40vh)] overflow-y-auto")}>
{matches.length === 0 ? (
- <li className="px-3 py-2 text-[13px] text-ink-secondary">{query.trim() ? t("botAccess.noMatch") : t("botAccess.nobodyLeft")}</li>
- ) : matches.map((person) => (
- <li key={person.email} role="option" aria-selected="false" onMouseDown={(event) => { event.preventDefault(); add(person); }}
- className="flex cursor-pointer items-center gap-3 px-3 py-1.5 hover:bg-raised">
- <PersonFace person={person} size={24} />
+ <li className="px-2 py-1.5 text-[13px] text-ink-secondary">{query.trim() ? t("botAccess.noMatch") : t("botAccess.nobodyLeft")}</li>
+ ) : matches.map((person, index) => (
+ <li key={person.email} id={`${listId}-${index}`} role="option" aria-selected={index === current} data-share-suggestion={person.email}
+ onMouseEnter={() => setActive(index)} onMouseDown={() => add(person)}
+ className={cn("flex shrink-0 cursor-pointer items-center gap-3 rounded-md px-2 py-1", index === current && "bg-menu-hover")}>
+ <EntryFace person={person} size={32} />
<span className="min-w-0 flex-1">
- <span className="block truncate text-[13px] text-ink">{person.name}</span>
- <span className="block truncate text-[12px] text-ink-secondary">{person.email}</span>
+ <span className="block truncate text-[14px] leading-[18px] text-ink">{person.name}</span>
+ <span className="block truncate text-[12px] leading-4 text-ink-secondary">{person.email}</span>
</span>
- <span className="text-[12px] text-ink-secondary">{levelLabel(level)}</span>
</li>
))}
</ul>
)}
- </div>
+ </>
);
}
diff --git a/src/components/bot-access/ShareControls.tsx b/src/components/bot-access/ShareControls.tsx
new file mode 100644
index 0000000000..e653117f07
--- /dev/null
+++ b/src/components/bot-access/ShareControls.tsx
@@ -0,0 +1,48 @@
+import { AtSign, Check, ChevronDown } from "lucide-react";
+
+import { atLeast, GRANTED_LEVELS, type BotAccessLevel, type GrantedLevel } from "../../../shared/bot-access";
+import { cn } from "@/lib/cn";
+import { t } from "@/lib/i18n";
+import type { TeamPerson } from "@/state/team-people";
+import { SidebarPopoverMenu, type SidebarMenuItem } from "../SidebarPopoverMenu";
+import { PersonFace } from "../TeamOwner";
+import { levelHint, levelLabel } from "./access";
+
+const gutter = (checked: boolean) => (checked ? <Check size={14} aria-hidden="true" /> : <span aria-hidden="true" />);
+
+/** A choice shown as plain text with a chevron until it is opened. */
+export function QuietMenu({ label, shown, items, align = "end", className }: {
+ label: string; shown: string; items: SidebarMenuItem[]; align?: "start" | "end"; className?: string;
+}) {
+ return (
+ <SidebarPopoverMenu items={items} ariaLabel={label} align={align}
+ triggerClassName={cn("flex max-w-full items-center gap-1 rounded-md px-2 py-1 text-[13px] leading-[18px] hover:bg-ink/[0.06] aria-expanded:bg-ink/[0.06]", className ?? "text-ink-secondary hover:text-ink")}
+ renderTrigger={() => <><span className="truncate">{shown}</span><ChevronDown size={14} aria-hidden="true" className="shrink-0 opacity-70" /></>} />
+ );
+}
+
+export const choiceItem = (key: string, name: string, chosen: boolean, onSelect: () => void, more: Partial<SidebarMenuItem> = {}): SidebarMenuItem =>
+ ({ key, label: name, checked: chosen, icon: gutter(chosen), onSelect, ...more });
+
+/** A level to choose, each with what it allows; what everyone already gets is the lowest on offer. `onChange(null)` takes
+ * the person's own access away, offered only when `removable`. */
+export function LevelMenu({ value, floor = "none", removable = false, disabled = false, label, onChange, onMakeOwner }: {
+ value: GrantedLevel; floor?: BotAccessLevel; removable?: boolean; disabled?: boolean; label: string;
+ onChange: (level: GrantedLevel | null) => void; onMakeOwner?: () => void;
+}) {
+ const shown = atLeast(value, floor) ? value : (floor as GrantedLevel);
+ const items: SidebarMenuItem[] = GRANTED_LEVELS.map((level) => choiceItem(level, levelLabel(level), level === shown,
+ () => { if (level !== shown) onChange(level); }, { subtitle: levelHint(level), disabled: disabled || !atLeast(level, floor) }));
+ if (onMakeOwner) items.push({ key: "owner", label: t("botAccess.makeOwner"), icon: gutter(false), separatorBefore: true, disabled, onSelect: onMakeOwner });
+ if (removable) items.push({ key: "remove", label: t("botAccess.remove"), icon: gutter(false), separatorBefore: !onMakeOwner, disabled, onSelect: () => onChange(null) });
+ return <QuietMenu label={label} shown={levelLabel(shown)} items={items} />;
+}
+
+/** A person's face, or a plain sign for an address nobody on the team has (an `@domain` entry). */
+export function EntryFace({ person, size }: { person: TeamPerson | null; size: number }) {
+ return person ? <PersonFace person={person} size={size} /> : (
+ <span aria-hidden="true" style={{ width: size, height: size }} className="inline-flex shrink-0 items-center justify-center rounded-full bg-ink/[0.08] text-ink-secondary">
+ <AtSign size={Math.round(size / 2)} />
+ </span>
+ );
+}
diff --git a/src/components/bot-access/access.ts b/src/components/bot-access/access.ts
index 7a413dbcbb..0c0590f385 100644
--- a/src/components/bot-access/access.ts
+++ b/src/components/bot-access/access.ts
@@ -1,4 +1,4 @@
-import { accessFromVisibility, atLeast, GRANTED_LEVELS, type BotAccess, type BotAccessLevel, type GrantedLevel } from "../../../shared/bot-access";
+import { accessFromVisibility, type BotAccess, type BotAccessLevel, type GrantedLevel } from "../../../shared/bot-access";
import { api, type Bot } from "@/state/store";
import { t } from "@/lib/i18n";
import type { TeamPeople, TeamPerson } from "@/state/team-people";
@@ -12,6 +12,14 @@ const LEVEL_KEYS = {
export const levelLabel = (level: BotAccessLevel): string => t(LEVEL_KEYS[level]);
+const HINT_KEYS = {
+ view: "botAccess.levelHint.view",
+ chat: "botAccess.levelHint.chat",
+ edit: "botAccess.levelHint.edit",
+} as const;
+
+export const levelHint = (level: GrantedLevel): string => t(HINT_KEYS[level]);
+
/** The sharing this copy of the bot carries; an admin's copy from an older server carries only its visibility. */
export function accessOfBot(bot: Pick<Bot, "access" | "visibility">): BotAccess {
return bot.access ?? accessFromVisibility(bot.visibility);
@@ -20,10 +28,8 @@ export function accessOfBot(bot: Pick<Bot, "access" | "visibility">): BotAccess
/** Whether this person may change the bot's sharing; off a team nobody shares a bot. */
export const canShare = (bot: Pick<Bot, "yourAccess">): boolean => bot.yourAccess === "edit";
-/** The level a person gets when added: chat, or edit when everyone can already chat; none to give when everyone edits. */
-export function levelWhenAdded(everyone: BotAccessLevel): GrantedLevel | null {
- return GRANTED_LEVELS.find((level) => atLeast(level, "chat") && !atLeast(everyone, level)) ?? null;
-}
+/** The level a person gets when added; there is none to give when everyone already edits. */
+export const levelWhenAdded = (everyone: BotAccessLevel): GrantedLevel | null => (everyone === "edit" ? null : "chat");
/** Admins and the owner can always edit, so they are never added; everyone else on the team not yet added can be. */
export function addablePeople(team: Pick<TeamPeople, "people">, access: BotAccess, owner: string | null, query: string): TeamPerson[] {
@@ -41,6 +47,14 @@ export function withPerson(access: BotAccess, email: string, level: GrantedLevel
return { everyone: access.everyone, people };
}
+export const personOf = (entry: string, team: Pick<TeamPeople, "people"> | null): TeamPerson | null => team?.people.find((person) => person.email === entry) ?? null;
+export const nameOf = (entry: string, team: Pick<TeamPeople, "people"> | null): string => personOf(entry, team)?.name ?? entry;
+
+export async function saveOwner(botId: string, email: string): Promise<Bot> {
+ const answer = await api<{ bot: Bot }>(`/api/bots/${botId}/reports-to`, { method: "PUT", body: JSON.stringify({ email }) });
+ return answer.bot;
+}
+
export async function saveAccess(botId: string, access: BotAccess): Promise<Bot> {
const answer = await api<{ bot: Bot }>(`/api/bots/${botId}/access`, { method: "PUT", body: JSON.stringify(access) });
return answer.bot;
diff --git a/src/locales/de.json b/src/locales/de.json
index 21fc9b3d8f..5117acbcc5 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -2799,9 +2799,6 @@
"botAccess.toast.onlyAdded": "Jetzt finden ihn nur hinzugefügte Personen",
"botAccess.toast.everyone": "Alle in {team} · {level}",
"botAccess.undoFailed": "Das ließ sich nicht rückgängig machen. Öffne „Teilen“, um es zurückzustellen.",
- "botAccess.yours.view": "Du darfst {bot} und die mit dir geteilten Unterhaltungen ansehen. Wer ihn bearbeiten darf, legt fest, wer Zugriff hat.",
- "botAccess.yours.chat": "Du darfst mit {bot} chatten und eigene Unterhaltungen mit ihm beginnen. Wer ihn bearbeiten darf, legt fest, wer Zugriff hat.",
- "botAccess.yours.other": "Wer {bot} bearbeiten darf, legt fest, wer Zugriff hat.",
"botAccess.viewOnly": "Du darfst {bot} ansehen, aber nicht mit ihm chatten.",
"botAccess.viewOnlyRoom": "Du darfst {bot} nur ansehen: Du kannst diesen Raum lesen, aber nicht darin schreiben.",
"botAccess.ask": "{name} fragen, ob du chatten darfst",
@@ -2815,9 +2812,28 @@
"botAccess.overview.intro": "Wer in {team} jeden Bot ansehen, mit ihm chatten und ihn bearbeiten darf. Änderungen gelten sofort.",
"botAccess.overview.noBots": "Es gibt noch keine Team-Bots.",
"botAccess.overview.noPeople": "Außer Admins ist noch niemand im Team.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Für alle festlegen: {bot}",
"botAccess.overview.cell": "Was {name} mit {bot} darf",
- "botAccess.overview.toastEveryone": "{bot}: alle in {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Liest geteilte Unterhaltungen",
+ "botAccess.levelHint.chat": "Chattet und startet Unterhaltungen",
+ "botAccess.levelHint.edit": "Chattet, ändert und teilt den Bot",
+ "botAccess.makeOwner": "Zum Inhaber machen",
+ "botAccess.makeOwnerTitle": "{name} zum Inhaber machen?",
+ "botAccess.makeOwnerBody": "Fragen, Freigaben und Routine-Ergebnisse von {bot} gehen dann an {name}.",
+ "botAccess.overview.byBot": "Nach Bot",
+ "botAccess.overview.byPerson": "Nach Person",
+ "botAccess.overview.listBy": "Liste nach",
+ "botAccess.overview.searchBots": "Bots suchen",
+ "botAccess.overview.searchPeople": "Personen suchen",
+ "botAccess.overview.everyoneView": "Alle dürfen ansehen",
+ "botAccess.overview.everyoneChat": "Alle dürfen chatten",
+ "botAccess.overview.everyoneEdit": "Alle dürfen bearbeiten",
+ "botAccess.overview.ownedBy": "Inhaber: {name}",
+ "botAccess.overview.noOwner": "Noch kein Inhaber",
+ "botAccess.overview.noBotMatch": "Kein Bot passt",
+ "botAccess.overview.botCount.one": "1 Bot",
+ "botAccess.overview.botCount.other": "{count} Bots",
+ "botAccess.overview.noBotsForPerson": "{name} hat noch keine Bots.",
+ "botAccess.overview.allPeople": "Alle Personen",
+ "botAccess.overview.toastRemoved": "{bot}: {name} entfernt"
}
diff --git a/src/locales/en.json b/src/locales/en.json
index a51191b057..7818d0286b 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7332,9 +7332,6 @@
"botAccess.toast.onlyAdded": "Only people added can find it now",
"botAccess.toast.everyone": "Everyone in {team} · {level}",
"botAccess.undoFailed": "Couldn't undo that. Open Share to change it back.",
- "botAccess.yours.view": "You can view {bot} and the conversations shared with you. People who can edit it choose who has access.",
- "botAccess.yours.chat": "You can chat with {bot} and start your own conversations with it. People who can edit it choose who has access.",
- "botAccess.yours.other": "People who can edit {bot} choose who has access.",
"botAccess.viewOnly": "You can view {bot}, not chat with it.",
"botAccess.viewOnlyRoom": "You can only view {bot}, so you can read this room but not write in it.",
"botAccess.ask": "Ask {name} to chat",
@@ -7348,9 +7345,28 @@
"botAccess.overview.intro": "Who in {team} can view, chat with and edit each bot. Changes apply at once.",
"botAccess.overview.noBots": "There are no team bots yet.",
"botAccess.overview.noPeople": "Nobody but admins is on the team yet.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Set for everyone: {bot}",
"botAccess.overview.cell": "What {name} can do with {bot}",
- "botAccess.overview.toastEveryone": "{bot}: everyone in {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Read its shared conversations",
+ "botAccess.levelHint.chat": "Chat with it and start conversations",
+ "botAccess.levelHint.edit": "Chat with it, change it and share it",
+ "botAccess.makeOwner": "Make owner",
+ "botAccess.makeOwnerTitle": "Make {name} the owner?",
+ "botAccess.makeOwnerBody": "{bot}'s questions, approvals and routine results will go to {name}.",
+ "botAccess.overview.byBot": "By bot",
+ "botAccess.overview.byPerson": "By person",
+ "botAccess.overview.listBy": "List by",
+ "botAccess.overview.searchBots": "Search bots",
+ "botAccess.overview.searchPeople": "Search people",
+ "botAccess.overview.everyoneView": "Everyone can view",
+ "botAccess.overview.everyoneChat": "Everyone can chat",
+ "botAccess.overview.everyoneEdit": "Everyone can edit",
+ "botAccess.overview.ownedBy": "Owner: {name}",
+ "botAccess.overview.noOwner": "No owner yet",
+ "botAccess.overview.noBotMatch": "No bot matches",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bots",
+ "botAccess.overview.noBotsForPerson": "{name} has no bots yet.",
+ "botAccess.overview.allPeople": "All people",
+ "botAccess.overview.toastRemoved": "{bot}: removed {name}"
}
diff --git a/src/locales/es.json b/src/locales/es.json
index f3d50a0c48..72199ae542 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -5694,9 +5694,6 @@
"botAccess.toast.onlyAdded": "Ahora solo lo encuentran las personas añadidas",
"botAccess.toast.everyone": "Todo {team} · {level}",
"botAccess.undoFailed": "No se pudo deshacer. Abre Compartir para volver a cambiarlo.",
- "botAccess.yours.view": "Puedes ver {bot} y las conversaciones compartidas contigo. Quienes pueden editarlo eligen quién tiene acceso.",
- "botAccess.yours.chat": "Puedes chatear con {bot} y empezar tus propias conversaciones con él. Quienes pueden editarlo eligen quién tiene acceso.",
- "botAccess.yours.other": "Quienes pueden editar {bot} eligen quién tiene acceso.",
"botAccess.viewOnly": "Puedes ver {bot}, pero no chatear con él.",
"botAccess.viewOnlyRoom": "Solo puedes ver {bot}, así que puedes leer este grupo pero no escribir en él.",
"botAccess.ask": "Pedir a {name} poder chatear",
@@ -5710,9 +5707,28 @@
"botAccess.overview.intro": "Quién de {team} puede ver, chatear con y editar cada bot. Los cambios se aplican al instante.",
"botAccess.overview.noBots": "Todavía no hay bots del equipo.",
"botAccess.overview.noPeople": "Aún no hay nadie en el equipo aparte de los admins.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Elegir para todos: {bot}",
"botAccess.overview.cell": "Lo que {name} puede hacer con {bot}",
- "botAccess.overview.toastEveryone": "{bot}: todo {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Lee sus conversaciones compartidas",
+ "botAccess.levelHint.chat": "Chatea e inicia conversaciones",
+ "botAccess.levelHint.edit": "Chatea, lo cambia y lo comparte",
+ "botAccess.makeOwner": "Hacer propietario",
+ "botAccess.makeOwnerTitle": "¿Hacer propietario a {name}?",
+ "botAccess.makeOwnerBody": "Las preguntas, aprobaciones y resultados de rutinas de {bot} irán a {name}.",
+ "botAccess.overview.byBot": "Por bot",
+ "botAccess.overview.byPerson": "Por persona",
+ "botAccess.overview.listBy": "Ordenar por",
+ "botAccess.overview.searchBots": "Buscar bots",
+ "botAccess.overview.searchPeople": "Buscar personas",
+ "botAccess.overview.everyoneView": "Todos pueden ver",
+ "botAccess.overview.everyoneChat": "Todos pueden chatear",
+ "botAccess.overview.everyoneEdit": "Todos pueden editar",
+ "botAccess.overview.ownedBy": "Propietario: {name}",
+ "botAccess.overview.noOwner": "Aún sin propietario",
+ "botAccess.overview.noBotMatch": "Ningún bot coincide",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bots",
+ "botAccess.overview.noBotsForPerson": "{name} aún no tiene bots.",
+ "botAccess.overview.allPeople": "Todas las personas",
+ "botAccess.overview.toastRemoved": "{bot}: se quitó a {name}"
}
diff --git a/src/locales/fr.json b/src/locales/fr.json
index cceeaf31d4..a767fa7537 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -2745,9 +2745,6 @@
"botAccess.toast.onlyAdded": "Seules les personnes ajoutées le trouvent maintenant",
"botAccess.toast.everyone": "Tout {team} · {level}",
"botAccess.undoFailed": "Impossible d'annuler. Ouvrez Partager pour revenir en arrière.",
- "botAccess.yours.view": "Vous pouvez voir {bot} et les conversations partagées avec vous. Les personnes qui peuvent le modifier choisissent qui y a accès.",
- "botAccess.yours.chat": "Vous pouvez discuter avec {bot} et commencer vos propres conversations avec lui. Les personnes qui peuvent le modifier choisissent qui y a accès.",
- "botAccess.yours.other": "Les personnes qui peuvent modifier {bot} choisissent qui y a accès.",
"botAccess.viewOnly": "Vous pouvez voir {bot}, mais pas discuter avec lui.",
"botAccess.viewOnlyRoom": "Vous pouvez seulement voir {bot} : vous pouvez lire ce salon, mais pas y écrire.",
"botAccess.ask": "Demander à {name} de pouvoir discuter",
@@ -2761,9 +2758,28 @@
"botAccess.overview.intro": "Qui dans {team} peut voir, discuter avec et modifier chaque bot. Les changements s'appliquent tout de suite.",
"botAccess.overview.noBots": "Il n'y a pas encore de bots d'équipe.",
"botAccess.overview.noPeople": "Il n'y a encore personne d'autre que les admins dans l'équipe.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Définir pour tous : {bot}",
"botAccess.overview.cell": "Ce que {name} peut faire avec {bot}",
- "botAccess.overview.toastEveryone": "{bot} : tout {team} · {level}",
- "botAccess.overview.toastPerson": "{bot} : {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot} : {name} · {level}",
+ "botAccess.levelHint.view": "Lit ses conversations partagées",
+ "botAccess.levelHint.chat": "Discute et lance des conversations",
+ "botAccess.levelHint.edit": "Discute, le modifie et le partage",
+ "botAccess.makeOwner": "Nommer propriétaire",
+ "botAccess.makeOwnerTitle": "Nommer {name} propriétaire ?",
+ "botAccess.makeOwnerBody": "Les questions, demandes d'autorisation et résultats de routines de {bot} iront à {name}.",
+ "botAccess.overview.byBot": "Par bot",
+ "botAccess.overview.byPerson": "Par personne",
+ "botAccess.overview.listBy": "Afficher par",
+ "botAccess.overview.searchBots": "Rechercher des bots",
+ "botAccess.overview.searchPeople": "Rechercher des personnes",
+ "botAccess.overview.everyoneView": "Tout le monde peut voir",
+ "botAccess.overview.everyoneChat": "Tout le monde peut discuter",
+ "botAccess.overview.everyoneEdit": "Tout le monde peut modifier",
+ "botAccess.overview.ownedBy": "Propriétaire : {name}",
+ "botAccess.overview.noOwner": "Pas encore de propriétaire",
+ "botAccess.overview.noBotMatch": "Aucun bot ne correspond",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bots",
+ "botAccess.overview.noBotsForPerson": "{name} n'a pas encore de bots.",
+ "botAccess.overview.allPeople": "Toutes les personnes",
+ "botAccess.overview.toastRemoved": "{bot} : {name} retiré"
}
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 8dd721ff27..5db336b475 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -2745,9 +2745,6 @@
"botAccess.toast.onlyAdded": "अब सिर्फ़ जोड़े गए लोग इसे ढूँढ सकते हैं",
"botAccess.toast.everyone": "{team} में सभी · {level}",
"botAccess.undoFailed": "यह पूर्ववत नहीं हो सका। वापस बदलने के लिए शेयर खोलें।",
- "botAccess.yours.view": "आप {bot} और आपके साथ शेयर की गई बातचीत देख सकते हैं। जो इसे बदल सकते हैं, वही तय करते हैं कि ऐक्सेस किसके पास है।",
- "botAccess.yours.chat": "आप {bot} से चैट कर सकते हैं और इसके साथ अपनी बातचीत शुरू कर सकते हैं। जो इसे बदल सकते हैं, वही तय करते हैं कि ऐक्सेस किसके पास है।",
- "botAccess.yours.other": "जो {bot} को बदल सकते हैं, वही तय करते हैं कि ऐक्सेस किसके पास है।",
"botAccess.viewOnly": "आप {bot} को देख सकते हैं, उससे चैट नहीं कर सकते।",
"botAccess.viewOnlyRoom": "आप {bot} को सिर्फ़ देख सकते हैं, इसलिए यह रूम पढ़ सकते हैं पर इसमें लिख नहीं सकते।",
"botAccess.ask": "{name} से चैट की अनुमति माँगें",
@@ -2761,9 +2758,28 @@
"botAccess.overview.intro": "{team} में कौन हर बॉट को देख, उससे चैट और उसे बदल सकता है। बदलाव तुरंत लागू होते हैं।",
"botAccess.overview.noBots": "अभी कोई टीम बॉट नहीं है।",
"botAccess.overview.noPeople": "अभी टीम में एडमिन के अलावा कोई नहीं है।",
- "botAccess.overview.bot": "बॉट",
- "botAccess.overview.setForEveryone": "सबके लिए तय करें: {bot}",
"botAccess.overview.cell": "{name} {bot} के साथ क्या कर सकते हैं",
- "botAccess.overview.toastEveryone": "{bot}: {team} में सभी · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "साझा बातचीत पढ़ सकते हैं",
+ "botAccess.levelHint.chat": "चैट और नई बातचीत कर सकते हैं",
+ "botAccess.levelHint.edit": "चैट कर सकते हैं, बदल और साझा कर सकते हैं",
+ "botAccess.makeOwner": "मालिक बनाएँ",
+ "botAccess.makeOwnerTitle": "{name} को मालिक बनाएँ?",
+ "botAccess.makeOwnerBody": "{bot} के सवाल, मंज़ूरी के अनुरोध और रूटीन के नतीजे {name} को जाएँगे।",
+ "botAccess.overview.byBot": "बॉट के अनुसार",
+ "botAccess.overview.byPerson": "व्यक्ति के अनुसार",
+ "botAccess.overview.listBy": "सूची का क्रम",
+ "botAccess.overview.searchBots": "बॉट खोजें",
+ "botAccess.overview.searchPeople": "लोग खोजें",
+ "botAccess.overview.everyoneView": "सभी देख सकते हैं",
+ "botAccess.overview.everyoneChat": "सभी चैट कर सकते हैं",
+ "botAccess.overview.everyoneEdit": "सभी बदल सकते हैं",
+ "botAccess.overview.ownedBy": "मालिक: {name}",
+ "botAccess.overview.noOwner": "अभी कोई मालिक नहीं",
+ "botAccess.overview.noBotMatch": "कोई बॉट मेल नहीं खाता",
+ "botAccess.overview.botCount.one": "1 बॉट",
+ "botAccess.overview.botCount.other": "{count} बॉट",
+ "botAccess.overview.noBotsForPerson": "{name} के पास अभी कोई बॉट नहीं है।",
+ "botAccess.overview.allPeople": "सभी लोग",
+ "botAccess.overview.toastRemoved": "{bot}: {name} को हटाया"
}
diff --git a/src/locales/it.json b/src/locales/it.json
index 90e94e9268..8e0ee90285 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -6391,9 +6391,6 @@
"botAccess.toast.onlyAdded": "Ora lo trovano solo le persone aggiunte",
"botAccess.toast.everyone": "Tutti in {team} · {level}",
"botAccess.undoFailed": "Impossibile annullare. Apri Condividi per ripristinarlo.",
- "botAccess.yours.view": "Puoi vedere {bot} e le conversazioni condivise con te. Chi può modificarlo sceglie chi ha accesso.",
- "botAccess.yours.chat": "Puoi chattare con {bot} e iniziare le tue conversazioni con lui. Chi può modificarlo sceglie chi ha accesso.",
- "botAccess.yours.other": "Chi può modificare {bot} sceglie chi ha accesso.",
"botAccess.viewOnly": "Puoi vedere {bot}, ma non chattare con lui.",
"botAccess.viewOnlyRoom": "Puoi solo vedere {bot}, quindi puoi leggere questa stanza ma non scriverci.",
"botAccess.ask": "Chiedi a {name} di poter chattare",
@@ -6407,9 +6404,28 @@
"botAccess.overview.intro": "Chi in {team} può vedere, chattare con e modificare ogni bot. Le modifiche valgono subito.",
"botAccess.overview.noBots": "Non ci sono ancora bot del team.",
"botAccess.overview.noPeople": "Nel team ci sono ancora solo gli amministratori.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Imposta per tutti: {bot}",
"botAccess.overview.cell": "Cosa può fare {name} con {bot}",
- "botAccess.overview.toastEveryone": "{bot}: tutti in {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Legge le conversazioni condivise",
+ "botAccess.levelHint.chat": "Chatta e avvia conversazioni",
+ "botAccess.levelHint.edit": "Chatta, lo modifica e lo condivide",
+ "botAccess.makeOwner": "Rendi proprietario",
+ "botAccess.makeOwnerTitle": "Rendere {name} proprietario?",
+ "botAccess.makeOwnerBody": "Le domande, le approvazioni e i risultati delle routine di {bot} andranno a {name}.",
+ "botAccess.overview.byBot": "Per bot",
+ "botAccess.overview.byPerson": "Per persona",
+ "botAccess.overview.listBy": "Elenca per",
+ "botAccess.overview.searchBots": "Cerca bot",
+ "botAccess.overview.searchPeople": "Cerca persone",
+ "botAccess.overview.everyoneView": "Tutti possono vedere",
+ "botAccess.overview.everyoneChat": "Tutti possono chattare",
+ "botAccess.overview.everyoneEdit": "Tutti possono modificare",
+ "botAccess.overview.ownedBy": "Proprietario: {name}",
+ "botAccess.overview.noOwner": "Ancora senza proprietario",
+ "botAccess.overview.noBotMatch": "Nessun bot corrisponde",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bot",
+ "botAccess.overview.noBotsForPerson": "{name} non ha ancora bot.",
+ "botAccess.overview.allPeople": "Tutte le persone",
+ "botAccess.overview.toastRemoved": "{bot}: rimosso {name}"
}
diff --git a/src/locales/ja.json b/src/locales/ja.json
index c988532d85..69c733c9e8 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -6617,9 +6617,6 @@
"botAccess.toast.onlyAdded": "追加したメンバーだけが見つけられるようになりました",
"botAccess.toast.everyone": "{team} の全員 · {level}",
"botAccess.undoFailed": "元に戻せませんでした。「共有」を開いて戻してください。",
- "botAccess.yours.view": "{bot} と、あなたに共有された会話を閲覧できます。アクセスできる人は、編集できる人が決めます。",
- "botAccess.yours.chat": "{bot} とチャットし、自分の会話を始められます。アクセスできる人は、編集できる人が決めます。",
- "botAccess.yours.other": "アクセスできる人は、{bot} を編集できる人が決めます。",
"botAccess.viewOnly": "{bot} は閲覧のみで、チャットはできません。",
"botAccess.viewOnlyRoom": "{bot} は閲覧のみのため、このルームは読めますが書き込めません。",
"botAccess.ask": "{name} にチャットの許可を頼む",
@@ -6633,9 +6630,28 @@
"botAccess.overview.intro": "{team} の誰が各ボットを閲覧・チャット・編集できるか。変更はすぐに反映されます。",
"botAccess.overview.noBots": "チームのボットはまだありません。",
"botAccess.overview.noPeople": "チームにはまだ管理者しかいません。",
- "botAccess.overview.bot": "ボット",
- "botAccess.overview.setForEveryone": "全員に設定: {bot}",
"botAccess.overview.cell": "{name} が {bot} でできること",
- "botAccess.overview.toastEveryone": "{bot}: {team} の全員 · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "共有された会話を読めます",
+ "botAccess.levelHint.chat": "チャットして会話を始められます",
+ "botAccess.levelHint.edit": "チャット、変更、共有ができます",
+ "botAccess.makeOwner": "オーナーにする",
+ "botAccess.makeOwnerTitle": "{name} をオーナーにしますか?",
+ "botAccess.makeOwnerBody": "{bot} の質問、承認依頼、ルーティンの結果が {name} に届くようになります。",
+ "botAccess.overview.byBot": "ボット別",
+ "botAccess.overview.byPerson": "メンバー別",
+ "botAccess.overview.listBy": "表示順",
+ "botAccess.overview.searchBots": "ボットを検索",
+ "botAccess.overview.searchPeople": "メンバーを検索",
+ "botAccess.overview.everyoneView": "全員が閲覧可",
+ "botAccess.overview.everyoneChat": "全員がチャット可",
+ "botAccess.overview.everyoneEdit": "全員が編集可",
+ "botAccess.overview.ownedBy": "オーナー: {name}",
+ "botAccess.overview.noOwner": "オーナーはまだいません",
+ "botAccess.overview.noBotMatch": "一致するボットはありません",
+ "botAccess.overview.botCount.one": "1 個のボット",
+ "botAccess.overview.botCount.other": "{count} 個のボット",
+ "botAccess.overview.noBotsForPerson": "{name} にはまだボットがありません。",
+ "botAccess.overview.allPeople": "すべてのメンバー",
+ "botAccess.overview.toastRemoved": "{bot}: {name} を削除しました"
}
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 1e7295870c..5cc9b2ad62 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -7112,9 +7112,6 @@
"botAccess.toast.onlyAdded": "이제 추가한 사람만 찾을 수 있어요",
"botAccess.toast.everyone": "{team}의 모든 사람 · {level}",
"botAccess.undoFailed": "되돌리지 못했어요. 공유를 열어 다시 바꿔 주세요.",
- "botAccess.yours.view": "{bot}와 나에게 공유된 대화를 볼 수 있어요. 접근 권한은 편집할 수 있는 사람이 정해요.",
- "botAccess.yours.chat": "{bot}와 대화하고 나만의 대화를 시작할 수 있어요. 접근 권한은 편집할 수 있는 사람이 정해요.",
- "botAccess.yours.other": "접근 권한은 {bot}를 편집할 수 있는 사람이 정해요.",
"botAccess.viewOnly": "{bot}는 볼 수만 있고 대화할 수는 없어요.",
"botAccess.viewOnlyRoom": "{bot}는 볼 수만 있어서 이 대화방을 읽을 수는 있지만 쓸 수는 없어요.",
"settings.windowFrame.title": "창 프레임",
@@ -7132,9 +7129,28 @@
"botAccess.overview.intro": "{team}에서 누가 각 봇을 보고, 대화하고, 편집할 수 있는지예요. 변경 사항은 바로 적용돼요.",
"botAccess.overview.noBots": "아직 팀 봇이 없어요.",
"botAccess.overview.noPeople": "아직 팀에 관리자 말고는 아무도 없어요.",
- "botAccess.overview.bot": "봇",
- "botAccess.overview.setForEveryone": "모두에게 설정: {bot}",
"botAccess.overview.cell": "{name}님이 {bot}로 할 수 있는 일",
- "botAccess.overview.toastEveryone": "{bot}: {team}의 모든 사람 · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "공유된 대화를 읽을 수 있어요",
+ "botAccess.levelHint.chat": "대화하고 새 대화를 시작할 수 있어요",
+ "botAccess.levelHint.edit": "대화하고, 바꾸고, 공유할 수 있어요",
+ "botAccess.makeOwner": "소유자로 지정",
+ "botAccess.makeOwnerTitle": "{name} 님을 소유자로 지정할까요?",
+ "botAccess.makeOwnerBody": "{bot}의 질문, 승인, 루틴 결과가 {name} 님에게 가요.",
+ "botAccess.overview.byBot": "봇별",
+ "botAccess.overview.byPerson": "사람별",
+ "botAccess.overview.listBy": "목록 기준",
+ "botAccess.overview.searchBots": "봇 검색",
+ "botAccess.overview.searchPeople": "사람 검색",
+ "botAccess.overview.everyoneView": "모두 보기 가능",
+ "botAccess.overview.everyoneChat": "모두 대화 가능",
+ "botAccess.overview.everyoneEdit": "모두 편집 가능",
+ "botAccess.overview.ownedBy": "소유자: {name}",
+ "botAccess.overview.noOwner": "아직 소유자 없음",
+ "botAccess.overview.noBotMatch": "일치하는 봇이 없어요",
+ "botAccess.overview.botCount.one": "봇 1개",
+ "botAccess.overview.botCount.other": "봇 {count}개",
+ "botAccess.overview.noBotsForPerson": "{name} 님에게는 아직 봇이 없어요.",
+ "botAccess.overview.allPeople": "모든 사람",
+ "botAccess.overview.toastRemoved": "{bot}: {name} 님을 삭제했어요"
}
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 1f1500447d..0f835a3cd3 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -6514,9 +6514,6 @@
"botAccess.toast.onlyAdded": "Teraz znajdą go tylko dodane osoby",
"botAccess.toast.everyone": "Wszyscy w {team} · {level}",
"botAccess.undoFailed": "Nie udało się cofnąć. Otwórz Udostępnij, aby to zmienić z powrotem.",
- "botAccess.yours.view": "Możesz wyświetlać {bot} i rozmowy udostępnione tobie. O dostępie decydują osoby, które mogą go edytować.",
- "botAccess.yours.chat": "Możesz rozmawiać z {bot} i zaczynać z nim własne rozmowy. O dostępie decydują osoby, które mogą go edytować.",
- "botAccess.yours.other": "O dostępie decydują osoby, które mogą edytować {bot}.",
"botAccess.viewOnly": "Możesz wyświetlać {bot}, ale nie rozmawiać z nim.",
"botAccess.viewOnlyRoom": "Możesz tylko wyświetlać {bot}, więc możesz czytać ten pokój, ale nie pisać w nim.",
"botAccess.ask": "Poproś {name} o możliwość rozmowy",
@@ -6530,9 +6527,28 @@
"botAccess.overview.intro": "Kto w {team} może wyświetlać, rozmawiać z każdym botem i go edytować. Zmiany działają od razu.",
"botAccess.overview.noBots": "Nie ma jeszcze botów zespołu.",
"botAccess.overview.noPeople": "W zespole są na razie tylko administratorzy.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Ustaw dla wszystkich: {bot}",
"botAccess.overview.cell": "Co {name} może robić z {bot}",
- "botAccess.overview.toastEveryone": "{bot}: wszyscy w {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Czyta udostępnione rozmowy",
+ "botAccess.levelHint.chat": "Rozmawia i zaczyna rozmowy",
+ "botAccess.levelHint.edit": "Rozmawia, zmienia i udostępnia",
+ "botAccess.makeOwner": "Ustaw jako właściciela",
+ "botAccess.makeOwnerTitle": "Ustawić {name} jako właściciela?",
+ "botAccess.makeOwnerBody": "Pytania, zatwierdzenia i wyniki rutyn bota {bot} będą trafiać do: {name}.",
+ "botAccess.overview.byBot": "Według bota",
+ "botAccess.overview.byPerson": "Według osoby",
+ "botAccess.overview.listBy": "Lista według",
+ "botAccess.overview.searchBots": "Szukaj botów",
+ "botAccess.overview.searchPeople": "Szukaj osób",
+ "botAccess.overview.everyoneView": "Wszyscy mogą oglądać",
+ "botAccess.overview.everyoneChat": "Wszyscy mogą rozmawiać",
+ "botAccess.overview.everyoneEdit": "Wszyscy mogą edytować",
+ "botAccess.overview.ownedBy": "Właściciel: {name}",
+ "botAccess.overview.noOwner": "Jeszcze bez właściciela",
+ "botAccess.overview.noBotMatch": "Żaden bot nie pasuje",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "Boty: {count}",
+ "botAccess.overview.noBotsForPerson": "{name}: jeszcze bez botów.",
+ "botAccess.overview.allPeople": "Wszystkie osoby",
+ "botAccess.overview.toastRemoved": "{bot}: usunięto {name}"
}
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 31b7a96208..677bdc3517 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -6375,9 +6375,6 @@
"botAccess.toast.onlyAdded": "Agora só as pessoas adicionadas o encontram",
"botAccess.toast.everyone": "Todos em {team} · {level}",
"botAccess.undoFailed": "Não deu para desfazer. Abra Compartilhar para voltar atrás.",
- "botAccess.yours.view": "Você pode ver {bot} e as conversas compartilhadas com você. Quem pode editá-lo escolhe quem tem acesso.",
- "botAccess.yours.chat": "Você pode conversar com {bot} e começar suas próprias conversas com ele. Quem pode editá-lo escolhe quem tem acesso.",
- "botAccess.yours.other": "Quem pode editar {bot} escolhe quem tem acesso.",
"botAccess.viewOnly": "Você pode ver {bot}, mas não conversar com ele.",
"botAccess.viewOnlyRoom": "Você só pode ver {bot}, então pode ler este grupo, mas não escrever nele.",
"botAccess.ask": "Pedir a {name} para conversar",
@@ -6391,9 +6388,28 @@
"botAccess.overview.intro": "Quem em {team} pode ver, conversar com e editar cada bot. As mudanças valem na hora.",
"botAccess.overview.noBots": "Ainda não há bots da equipe.",
"botAccess.overview.noPeople": "Ainda não há ninguém na equipe além dos admins.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Definir para todos: {bot}",
"botAccess.overview.cell": "O que {name} pode fazer com {bot}",
- "botAccess.overview.toastEveryone": "{bot}: todos em {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Lê as conversas compartilhadas",
+ "botAccess.levelHint.chat": "Conversa e inicia conversas",
+ "botAccess.levelHint.edit": "Conversa, altera e compartilha",
+ "botAccess.makeOwner": "Tornar dono",
+ "botAccess.makeOwnerTitle": "Tornar {name} dono?",
+ "botAccess.makeOwnerBody": "As perguntas, aprovações e resultados de rotinas de {bot} irão para {name}.",
+ "botAccess.overview.byBot": "Por bot",
+ "botAccess.overview.byPerson": "Por pessoa",
+ "botAccess.overview.listBy": "Listar por",
+ "botAccess.overview.searchBots": "Buscar bots",
+ "botAccess.overview.searchPeople": "Buscar pessoas",
+ "botAccess.overview.everyoneView": "Todos podem ver",
+ "botAccess.overview.everyoneChat": "Todos podem conversar",
+ "botAccess.overview.everyoneEdit": "Todos podem editar",
+ "botAccess.overview.ownedBy": "Dono: {name}",
+ "botAccess.overview.noOwner": "Ainda sem dono",
+ "botAccess.overview.noBotMatch": "Nenhum bot corresponde",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bots",
+ "botAccess.overview.noBotsForPerson": "{name} ainda não tem bots.",
+ "botAccess.overview.allPeople": "Todas as pessoas",
+ "botAccess.overview.toastRemoved": "{bot}: {name} removido"
}
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 6dd658991b..0c29033a7c 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -6595,9 +6595,6 @@
"botAccess.toast.onlyAdded": "Теперь его находят только добавленные люди",
"botAccess.toast.everyone": "Все в {team} · {level}",
"botAccess.undoFailed": "Не удалось отменить. Откройте «Поделиться», чтобы вернуть как было.",
- "botAccess.yours.view": "Вы можете просматривать {bot} и разговоры, которыми с вами поделились. Кто имеет доступ, решают те, кто может его редактировать.",
- "botAccess.yours.chat": "Вы можете общаться с {bot} и начинать с ним свои разговоры. Кто имеет доступ, решают те, кто может его редактировать.",
- "botAccess.yours.other": "Кто имеет доступ, решают те, кто может редактировать {bot}.",
"botAccess.viewOnly": "Вы можете просматривать {bot}, но не общаться с ним.",
"botAccess.viewOnlyRoom": "Вы можете только просматривать {bot}, поэтому можете читать эту комнату, но не писать в ней.",
"botAccess.ask": "Попросить {name} разрешить общение",
@@ -6611,9 +6608,28 @@
"botAccess.overview.intro": "Кто в {team} может просматривать, общаться с каждым ботом и редактировать его. Изменения действуют сразу.",
"botAccess.overview.noBots": "Ботов команды пока нет.",
"botAccess.overview.noPeople": "В команде пока только администраторы.",
- "botAccess.overview.bot": "Бот",
- "botAccess.overview.setForEveryone": "Задать для всех: {bot}",
"botAccess.overview.cell": "Что {name} может делать с {bot}",
- "botAccess.overview.toastEveryone": "{bot}: все в {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Читает общие разговоры",
+ "botAccess.levelHint.chat": "Общается и начинает разговоры",
+ "botAccess.levelHint.edit": "Общается, меняет и делится",
+ "botAccess.makeOwner": "Сделать владельцем",
+ "botAccess.makeOwnerTitle": "Сделать {name} владельцем?",
+ "botAccess.makeOwnerBody": "Вопросы, согласования и результаты рутин бота {bot} будут приходить: {name}.",
+ "botAccess.overview.byBot": "По ботам",
+ "botAccess.overview.byPerson": "По людям",
+ "botAccess.overview.listBy": "Список по",
+ "botAccess.overview.searchBots": "Поиск ботов",
+ "botAccess.overview.searchPeople": "Поиск людей",
+ "botAccess.overview.everyoneView": "Все могут смотреть",
+ "botAccess.overview.everyoneChat": "Все могут общаться",
+ "botAccess.overview.everyoneEdit": "Все могут редактировать",
+ "botAccess.overview.ownedBy": "Владелец: {name}",
+ "botAccess.overview.noOwner": "Владельца пока нет",
+ "botAccess.overview.noBotMatch": "Такого бота нет",
+ "botAccess.overview.botCount.one": "Ботов: 1",
+ "botAccess.overview.botCount.other": "Ботов: {count}",
+ "botAccess.overview.noBotsForPerson": "{name}: ботов пока нет.",
+ "botAccess.overview.allPeople": "Все люди",
+ "botAccess.overview.toastRemoved": "{bot}: {name} удалён(а)"
}
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 25881486ab..85680619cb 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -5185,9 +5185,6 @@
"botAccess.toast.onlyAdded": "Artık onu yalnızca eklenen kişiler bulabilir",
"botAccess.toast.everyone": "{team} ekibindeki herkes · {level}",
"botAccess.undoFailed": "Geri alınamadı. Geri değiştirmek için Paylaş'ı aç.",
- "botAccess.yours.view": "{bot} botunu ve seninle paylaşılan sohbetleri görüntüleyebilirsin. Kimin erişimi olacağını onu düzenleyebilenler seçer.",
- "botAccess.yours.chat": "{bot} ile sohbet edebilir ve onunla kendi sohbetlerini başlatabilirsin. Kimin erişimi olacağını onu düzenleyebilenler seçer.",
- "botAccess.yours.other": "Kimin erişimi olacağını {bot} botunu düzenleyebilenler seçer.",
"botAccess.viewOnly": "{bot} botunu görüntüleyebilirsin ama onunla sohbet edemezsin.",
"botAccess.viewOnlyRoom": "{bot} botunu yalnızca görüntüleyebildiğin için bu odayı okuyabilirsin ama yazamazsın.",
"botAccess.ask": "{name} kişisinden sohbet izni iste",
@@ -5201,9 +5198,28 @@
"botAccess.overview.intro": "{team} ekibinde kimin her botu görüntüleyebileceği, onunla sohbet edebileceği ve onu düzenleyebileceği. Değişiklikler hemen geçerli olur.",
"botAccess.overview.noBots": "Henüz ekip botu yok.",
"botAccess.overview.noPeople": "Ekipte henüz yöneticilerden başka kimse yok.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Herkes için ayarla: {bot}",
"botAccess.overview.cell": "{name}, {bot} ile neler yapabilir",
- "botAccess.overview.toastEveryone": "{bot}: {team} ekibindeki herkes · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Paylaşılan sohbetleri okur",
+ "botAccess.levelHint.chat": "Sohbet eder ve sohbet başlatır",
+ "botAccess.levelHint.edit": "Sohbet eder, değiştirir ve paylaşır",
+ "botAccess.makeOwner": "Sahibi yap",
+ "botAccess.makeOwnerTitle": "{name} sahibi yapılsın mı?",
+ "botAccess.makeOwnerBody": "{bot} botunun soruları, onay istekleri ve rutin sonuçları {name} kişisine gidecek.",
+ "botAccess.overview.byBot": "Bota göre",
+ "botAccess.overview.byPerson": "Kişiye göre",
+ "botAccess.overview.listBy": "Listeleme",
+ "botAccess.overview.searchBots": "Bot ara",
+ "botAccess.overview.searchPeople": "Kişi ara",
+ "botAccess.overview.everyoneView": "Herkes görüntüleyebilir",
+ "botAccess.overview.everyoneChat": "Herkes sohbet edebilir",
+ "botAccess.overview.everyoneEdit": "Herkes düzenleyebilir",
+ "botAccess.overview.ownedBy": "Sahibi: {name}",
+ "botAccess.overview.noOwner": "Henüz sahibi yok",
+ "botAccess.overview.noBotMatch": "Eşleşen bot yok",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bot",
+ "botAccess.overview.noBotsForPerson": "{name} için henüz bot yok.",
+ "botAccess.overview.allPeople": "Tüm kişiler",
+ "botAccess.overview.toastRemoved": "{bot}: {name} kaldırıldı"
}
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 62c37bfb81..fb1fb8c255 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -3188,9 +3188,6 @@
"botAccess.toast.onlyAdded": "Тепер його знаходять лише додані люди",
"botAccess.toast.everyone": "Усі в {team} · {level}",
"botAccess.undoFailed": "Не вдалося скасувати. Відкрийте «Поділитися», щоб змінити назад.",
- "botAccess.yours.view": "Ви можете переглядати {bot} і розмови, якими з вами поділилися. Хто має доступ, вирішують ті, хто може його редагувати.",
- "botAccess.yours.chat": "Ви можете спілкуватися з {bot} і починати з ним власні розмови. Хто має доступ, вирішують ті, хто може його редагувати.",
- "botAccess.yours.other": "Хто має доступ, вирішують ті, хто може редагувати {bot}.",
"botAccess.viewOnly": "Ви можете переглядати {bot}, але не спілкуватися з ним.",
"botAccess.viewOnlyRoom": "Ви можете лише переглядати {bot}, тож можете читати цю кімнату, але не писати в ній.",
"botAccess.ask": "Попросити {name} дозволити спілкування",
@@ -3204,9 +3201,28 @@
"botAccess.overview.intro": "Хто в {team} може переглядати, спілкуватися з кожним ботом і редагувати його. Зміни діють одразу.",
"botAccess.overview.noBots": "Ботів команди ще немає.",
"botAccess.overview.noPeople": "У команді поки що лише адміністратори.",
- "botAccess.overview.bot": "Бот",
- "botAccess.overview.setForEveryone": "Задати для всіх: {bot}",
"botAccess.overview.cell": "Що {name} може робити з {bot}",
- "botAccess.overview.toastEveryone": "{bot}: усі в {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Читає спільні розмови",
+ "botAccess.levelHint.chat": "Спілкується й починає розмови",
+ "botAccess.levelHint.edit": "Спілкується, змінює й ділиться",
+ "botAccess.makeOwner": "Зробити власником",
+ "botAccess.makeOwnerTitle": "Зробити {name} власником?",
+ "botAccess.makeOwnerBody": "Запитання, погодження та результати рутин бота {bot} надходитимуть: {name}.",
+ "botAccess.overview.byBot": "За ботами",
+ "botAccess.overview.byPerson": "За людьми",
+ "botAccess.overview.listBy": "Список за",
+ "botAccess.overview.searchBots": "Пошук ботів",
+ "botAccess.overview.searchPeople": "Пошук людей",
+ "botAccess.overview.everyoneView": "Усі можуть переглядати",
+ "botAccess.overview.everyoneChat": "Усі можуть спілкуватися",
+ "botAccess.overview.everyoneEdit": "Усі можуть редагувати",
+ "botAccess.overview.ownedBy": "Власник: {name}",
+ "botAccess.overview.noOwner": "Власника ще немає",
+ "botAccess.overview.noBotMatch": "Такого бота немає",
+ "botAccess.overview.botCount.one": "Ботів: 1",
+ "botAccess.overview.botCount.other": "Ботів: {count}",
+ "botAccess.overview.noBotsForPerson": "{name}: ботів ще немає.",
+ "botAccess.overview.allPeople": "Усі люди",
+ "botAccess.overview.toastRemoved": "{bot}: {name} вилучено"
}
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 94655f7df8..1474e7670f 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -5185,9 +5185,6 @@
"botAccess.toast.onlyAdded": "Giờ chỉ những người được thêm mới tìm thấy nó",
"botAccess.toast.everyone": "Mọi người trong {team} · {level}",
"botAccess.undoFailed": "Không hoàn tác được. Mở Chia sẻ để đổi lại.",
- "botAccess.yours.view": "Bạn có thể xem {bot} và các cuộc trò chuyện được chia sẻ với bạn. Người có thể chỉnh sửa nó sẽ chọn ai có quyền truy cập.",
- "botAccess.yours.chat": "Bạn có thể trò chuyện với {bot} và bắt đầu cuộc trò chuyện riêng với nó. Người có thể chỉnh sửa nó sẽ chọn ai có quyền truy cập.",
- "botAccess.yours.other": "Người có thể chỉnh sửa {bot} sẽ chọn ai có quyền truy cập.",
"botAccess.viewOnly": "Bạn có thể xem {bot}, nhưng không thể trò chuyện với nó.",
"botAccess.viewOnlyRoom": "Bạn chỉ có thể xem {bot}, nên bạn đọc được phòng này nhưng không thể viết vào đó.",
"botAccess.ask": "Xin {name} cho trò chuyện",
@@ -5201,9 +5198,28 @@
"botAccess.overview.intro": "Ai trong {team} có thể xem, trò chuyện và chỉnh sửa từng bot. Thay đổi có hiệu lực ngay.",
"botAccess.overview.noBots": "Chưa có bot nào của nhóm.",
"botAccess.overview.noPeople": "Trong nhóm chưa có ai ngoài quản trị viên.",
- "botAccess.overview.bot": "Bot",
- "botAccess.overview.setForEveryone": "Đặt cho mọi người: {bot}",
"botAccess.overview.cell": "{name} có thể làm gì với {bot}",
- "botAccess.overview.toastEveryone": "{bot}: mọi người trong {team} · {level}",
- "botAccess.overview.toastPerson": "{bot}: {name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}",
+ "botAccess.levelHint.view": "Đọc các cuộc trò chuyện được chia sẻ",
+ "botAccess.levelHint.chat": "Trò chuyện và bắt đầu cuộc trò chuyện",
+ "botAccess.levelHint.edit": "Trò chuyện, thay đổi và chia sẻ",
+ "botAccess.makeOwner": "Đặt làm chủ sở hữu",
+ "botAccess.makeOwnerTitle": "Đặt {name} làm chủ sở hữu?",
+ "botAccess.makeOwnerBody": "Câu hỏi, yêu cầu phê duyệt và kết quả tác vụ định kỳ của {bot} sẽ gửi đến {name}.",
+ "botAccess.overview.byBot": "Theo bot",
+ "botAccess.overview.byPerson": "Theo người",
+ "botAccess.overview.listBy": "Liệt kê theo",
+ "botAccess.overview.searchBots": "Tìm bot",
+ "botAccess.overview.searchPeople": "Tìm người",
+ "botAccess.overview.everyoneView": "Mọi người có thể xem",
+ "botAccess.overview.everyoneChat": "Mọi người có thể trò chuyện",
+ "botAccess.overview.everyoneEdit": "Mọi người có thể chỉnh sửa",
+ "botAccess.overview.ownedBy": "Chủ sở hữu: {name}",
+ "botAccess.overview.noOwner": "Chưa có chủ sở hữu",
+ "botAccess.overview.noBotMatch": "Không có bot nào khớp",
+ "botAccess.overview.botCount.one": "1 bot",
+ "botAccess.overview.botCount.other": "{count} bot",
+ "botAccess.overview.noBotsForPerson": "{name} chưa có bot nào.",
+ "botAccess.overview.allPeople": "Tất cả mọi người",
+ "botAccess.overview.toastRemoved": "{bot}: đã gỡ {name}"
}
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 03d4383db7..8701d59f8f 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -4576,9 +4576,6 @@
"botAccess.toast.onlyAdded": "現在只有已新增的人能找到它",
"botAccess.toast.everyone": "{team} 的所有人 · {level}",
"botAccess.undoFailed": "無法復原。請開啟「分享」改回來。",
- "botAccess.yours.view": "你可以檢視 {bot} 以及分享給你的對話。能編輯它的人決定誰有存取權。",
- "botAccess.yours.chat": "你可以和 {bot} 聊天,也可以和它開始自己的對話。能編輯它的人決定誰有存取權。",
- "botAccess.yours.other": "能編輯 {bot} 的人決定誰有存取權。",
"botAccess.viewOnly": "你可以檢視 {bot},但不能和它聊天。",
"botAccess.viewOnlyRoom": "你只能檢視 {bot},所以可以閱讀這個聊天室,但不能在裡面發言。",
"botAccess.ask": "請 {name} 允許你聊天",
@@ -4592,9 +4589,28 @@
"botAccess.overview.intro": "{team} 裡誰可以檢視、和哪個機器人聊天以及編輯它。變更立即生效。",
"botAccess.overview.noBots": "還沒有團隊機器人。",
"botAccess.overview.noPeople": "團隊裡除了管理員還沒有其他人。",
- "botAccess.overview.bot": "機器人",
- "botAccess.overview.setForEveryone": "為所有人設定:{bot}",
"botAccess.overview.cell": "{name} 能對 {bot} 做什麼",
- "botAccess.overview.toastEveryone": "{bot}:{team} 的所有人 · {level}",
- "botAccess.overview.toastPerson": "{bot}:{name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}:{name} · {level}",
+ "botAccess.levelHint.view": "可閱讀共用的對話",
+ "botAccess.levelHint.chat": "可聊天並發起對話",
+ "botAccess.levelHint.edit": "可聊天、修改和共用",
+ "botAccess.makeOwner": "設為擁有者",
+ "botAccess.makeOwnerTitle": "將 {name} 設為擁有者?",
+ "botAccess.makeOwnerBody": "{bot} 的問題、核准要求和例行工作結果都會傳給 {name}。",
+ "botAccess.overview.byBot": "依機器人",
+ "botAccess.overview.byPerson": "依人員",
+ "botAccess.overview.listBy": "列表方式",
+ "botAccess.overview.searchBots": "搜尋機器人",
+ "botAccess.overview.searchPeople": "搜尋人員",
+ "botAccess.overview.everyoneView": "所有人可檢視",
+ "botAccess.overview.everyoneChat": "所有人可聊天",
+ "botAccess.overview.everyoneEdit": "所有人可編輯",
+ "botAccess.overview.ownedBy": "擁有者:{name}",
+ "botAccess.overview.noOwner": "尚無擁有者",
+ "botAccess.overview.noBotMatch": "沒有符合的機器人",
+ "botAccess.overview.botCount.one": "1 個機器人",
+ "botAccess.overview.botCount.other": "{count} 個機器人",
+ "botAccess.overview.noBotsForPerson": "{name} 還沒有機器人。",
+ "botAccess.overview.allPeople": "所有人員",
+ "botAccess.overview.toastRemoved": "{bot}:已移除 {name}"
}
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 917af6ddad..9f6f56632f 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -7316,9 +7316,6 @@
"botAccess.toast.onlyAdded": "现在只有已添加的人能找到它",
"botAccess.toast.everyone": "{team} 的所有人 · {level}",
"botAccess.undoFailed": "无法撤销。请打开「共享」改回来。",
- "botAccess.yours.view": "你可以查看 {bot} 以及共享给你的对话。能编辑它的人决定谁有访问权限。",
- "botAccess.yours.chat": "你可以和 {bot} 聊天,也可以和它开始自己的对话。能编辑它的人决定谁有访问权限。",
- "botAccess.yours.other": "能编辑 {bot} 的人决定谁有访问权限。",
"botAccess.viewOnly": "你可以查看 {bot},但不能和它聊天。",
"botAccess.viewOnlyRoom": "你只能查看 {bot},所以可以阅读这个群组聊天,但不能在里面发言。",
"botAccess.ask": "请 {name} 允许你聊天",
@@ -7332,9 +7329,28 @@
"botAccess.overview.intro": "{team} 里谁可以查看、和哪个机器人聊天以及编辑它。更改立即生效。",
"botAccess.overview.noBots": "还没有团队机器人。",
"botAccess.overview.noPeople": "团队里除了管理员还没有其他人。",
- "botAccess.overview.bot": "机器人",
- "botAccess.overview.setForEveryone": "为所有人设置:{bot}",
"botAccess.overview.cell": "{name} 能对 {bot} 做什么",
- "botAccess.overview.toastEveryone": "{bot}:{team} 的所有人 · {level}",
- "botAccess.overview.toastPerson": "{bot}:{name} · {level}"
+ "botAccess.overview.toastPerson": "{bot}:{name} · {level}",
+ "botAccess.levelHint.view": "可阅读共享的对话",
+ "botAccess.levelHint.chat": "可聊天并发起对话",
+ "botAccess.levelHint.edit": "可聊天、修改和共享",
+ "botAccess.makeOwner": "设为所有者",
+ "botAccess.makeOwnerTitle": "将 {name} 设为所有者?",
+ "botAccess.makeOwnerBody": "{bot} 的问题、审批请求和例行任务结果都会发给 {name}。",
+ "botAccess.overview.byBot": "按机器人",
+ "botAccess.overview.byPerson": "按人员",
+ "botAccess.overview.listBy": "列表方式",
+ "botAccess.overview.searchBots": "搜索机器人",
+ "botAccess.overview.searchPeople": "搜索人员",
+ "botAccess.overview.everyoneView": "所有人可查看",
+ "botAccess.overview.everyoneChat": "所有人可聊天",
+ "botAccess.overview.everyoneEdit": "所有人可编辑",
+ "botAccess.overview.ownedBy": "所有者:{name}",
+ "botAccess.overview.noOwner": "暂无所有者",
+ "botAccess.overview.noBotMatch": "没有匹配的机器人",
+ "botAccess.overview.botCount.one": "1 个机器人",
+ "botAccess.overview.botCount.other": "{count} 个机器人",
+ "botAccess.overview.noBotsForPerson": "{name} 还没有机器人。",
+ "botAccess.overview.allPeople": "所有人员",
+ "botAccess.overview.toastRemoved": "{bot}:已移除 {name}"
}