Skip to content

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

Owners and Admins can invite someone from the sidebar

milind-soni25f63c4cf9b1
diff --git a/docs/team-cloud.md b/docs/team-cloud.md
index 368ac5748a..59160b3432 100644
--- a/docs/team-cloud.md
+++ b/docs/team-cloud.md
@@ -10,7 +10,9 @@ keeps people apart on it. The bot box ([bot-box.md](bot-box.md)) is what makes t
- **Signing in.** Each person pairs from the app with a link the Admin signs for them; the machine shows the team's name
wherever a server names itself. Owners and Admins get everything an admin session can do (Super admin and Admin in the
app); a Member (User) uses each bot as far as it is shared with them (below, "Who can use a bot"), uses rooms and
- makes routines, and connects no app and makes no webhook.
+ makes routines, and connects no app and makes no webhook. Owners and Admins also get **Invite someone** under People in
+ the sidebar, in Simple too and when they are alone on the team: it opens the team's People page on the Cloud in their
+ browser, where they sign in if that browser hasn't yet.
- **Conversations.** A bot's main chat is the team's: everyone who sees the bot reads and writes it. Teammates are
in the @ list too, and whatever is addressed to one of them reaches their inbox (below, "One inbox per person"). "New conversation"
is yours alone: no other Member and no Admin, the Super admin included, sees it, writes in it or learns of it, in
diff --git a/src/components/SidebarPeople.test.ts b/src/components/SidebarPeople.test.ts
index 6559684eeb..32604d68d6 100644
--- a/src/components/SidebarPeople.test.ts
+++ b/src/components/SidebarPeople.test.ts
@@ -40,6 +40,34 @@ describe("the team's people in the sidebar", () => {
expect(render(createElement(SidebarPeople, { compact: false }))).toBe("");
});
+ it("gives a team's admins Invite someone under People, opening the team's People page, even alone on a new team", () => {
+ const team = { id: "team-acme", name: "Acme", cloudPage: "https://cloud.example.test/cloud" };
+ const config = { team } as AppState["config"];
+ const invite = 'href="https://cloud.example.test/cloud/team/team-acme/people"';
+ setTeamPeople({ ...asBen, admin: true });
+ const listed = render(createElement(SidebarPeople, { compact: false }), { config });
+ expect(listed).toContain(invite);
+ expect(listed).toContain("Invite someone</span>");
+ expect(listed.indexOf("[email protected]")).toBeLessThan(listed.indexOf(invite));
+ setTeamPeople({ ...asBen, people: [BEN], admin: true });
+ const alone = render(createElement(SidebarPeople, { compact: false }), { config });
+ expect(alone).toContain(">People<");
+ expect(alone).toContain(invite);
+ const rail = render(createElement(SidebarPeople, { compact: true }), { config });
+ expect(rail).toContain(invite);
+ expect(rail).toContain('aria-label="Invite someone"');
+ });
+
+ it("offers Invite someone to nobody else, and not where no Cloud page runs the team", () => {
+ const config = { team: { id: "team-acme", name: "Acme", cloudPage: "https://cloud.example.test/cloud" } } as AppState["config"];
+ setTeamPeople(asBen);
+ expect(render(createElement(SidebarPeople, { compact: false }), { config })).not.toContain("Invite someone");
+ setTeamPeople({ ...asBen, people: [BEN] });
+ expect(render(createElement(SidebarPeople, { compact: false }), { config })).toBe("");
+ setTeamPeople({ ...asBen, admin: true });
+ expect(render(createElement(SidebarPeople, { compact: false }), { config: { team: { id: "team-acme", name: "Acme" } } as AppState["config"] })).not.toContain("Invite someone");
+ });
+
it("counts the asks waiting on you on your inbox row, and shows no count when none wait", () => {
setTeamPeople(asBen);
const inbox = (openAsks?: number) => bot({ id: "mc", name: "Ben's Chief", chiefOfStaff: true, reportsTo: BEN.email,
diff --git a/src/components/SidebarPeople.tsx b/src/components/SidebarPeople.tsx
index 611049c6c9..81b75f3235 100644
--- a/src/components/SidebarPeople.tsx
+++ b/src/components/SidebarPeople.tsx
@@ -1,6 +1,8 @@
// On a Team Cloud: the team's people, with their pictures. Your own row opens your inbox, your chat with your Chief where
// everything sent to you arrives, with the inbox's list beside it, and counts the asks waiting on you there. Anyone
-// else's puts @their name in the composer, which reaches their inbox once sent.
+// else's puts @their name in the composer, which reaches their inbox once sent. For the team's admins, one more row opens
+// the team's People page, where invitations are sent, so someone alone on a new team still has a way to bring people in.
+import { UserPlus } from "lucide-react";
import { botOwner } from "../../shared/bot-owner";
import { openAsksOf } from "@/lib/bot-unread";
import { cn } from "@/lib/cn";
@@ -28,13 +30,20 @@ function openComposer(state: Pick<AppState, "activeView" | "selectedId" | "group
return bot ? `bot:${bot.id}:${bot.threadId}` : null;
}
+/** Where a team's admins invite people: the Team admin's People page on the Cloud that runs this team. */
+export function teamPeoplePage(team: { id: string; cloudPage?: string } | null | undefined): string | null {
+ return team?.cloudPage ? `${team.cloudPage}/team/${encodeURIComponent(team.id)}/people` : null;
+}
+
const focusComposer = () => requestAnimationFrame(() => document.querySelector<HTMLTextAreaElement>('[data-tour="composer"] textarea')?.focus());
export function SidebarPeople({ compact }: { compact: boolean }) {
const team = useTeamPeople();
const { state, dispatch } = useStore();
const showThreads = useShowThreads();
- if (!team || team.people.length < 2) return null;
+ if (!team) return null;
+ const invite = team.admin ? teamPeoplePage(state.config?.team) : null;
+ if (team.people.length < 2 && !invite) return null;
const me = team.me;
const people = [...team.people].sort((a, b) => Number(Boolean(b.you)) - Number(Boolean(a.you)) || a.name.localeCompare(b.name));
const inbox = inboxBotOf(state.bots, me?.email);
@@ -76,6 +85,15 @@ export function SidebarPeople({ compact }: { compact: boolean }) {
</li>
);
})}
+ {invite && (
+ <li>
+ <a href={invite} target="_blank" rel="noreferrer" aria-label={t("sidebar.people.invite")} title={t("sidebar.people.invite")} data-people-invite
+ className={cn("flex w-full min-w-0 items-center gap-2 rounded-lg text-left text-[13px] text-ink-secondary hover:bg-raised/60 hover:text-ink", compact ? "justify-center p-1" : "px-2 py-1")}>
+ <UserPlus aria-hidden="true" size={compact ? 18 : 15} strokeWidth={1.75} className="shrink-0" />
+ {!compact && <span className="min-w-0 flex-1 truncate">{t("sidebar.people.invite")}</span>}
+ </a>
+ </li>
+ )}
</ul>
</section>
);
diff --git a/src/locales/de.json b/src/locales/de.json
index 69ff67dbcc..fe500a9660 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -746,6 +746,7 @@
"sidebar.people.you": "{name} (du)",
"sidebar.people.yourInbox": "Dein Posteingang: alles, was an dich geht",
"sidebar.people.yourInboxWaiting": "Dein Posteingang: wartet auf dich, {count}",
+ "sidebar.people.invite": "Jemanden einladen",
"inbox.panel.title": "Posteingang",
"inbox.empty": "Noch nichts für dich.",
"inbox.waitsOnYou": "Wartet auf dich",
diff --git a/src/locales/en.json b/src/locales/en.json
index 2dc463d346..1c0306eec0 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -2039,6 +2039,7 @@
"sidebar.people.you": "{name} (you)",
"sidebar.people.yourInbox": "Your inbox: everything sent to you",
"sidebar.people.yourInboxWaiting": "Your inbox: waiting on you, {count}",
+ "sidebar.people.invite": "Invite someone",
"inbox.panel.title": "Inbox",
"inbox.empty": "Nothing for you yet.",
"inbox.waitsOnYou": "Waits on you",
diff --git a/src/locales/es.json b/src/locales/es.json
index 312451deba..40ef843751 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -1673,6 +1673,7 @@
"sidebar.people.you": "{name} (tú)",
"sidebar.people.yourInbox": "Tu bandeja de entrada: todo lo que te envían",
"sidebar.people.yourInboxWaiting": "Tu bandeja de entrada: te esperan, {count}",
+ "sidebar.people.invite": "Invitar a alguien",
"inbox.panel.title": "Bandeja de entrada",
"inbox.empty": "Aún nada para ti.",
"inbox.waitsOnYou": "Te espera",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index e35c88773f..7d8f5d0437 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -657,6 +657,7 @@
"sidebar.people.you": "{name} (vous)",
"sidebar.people.yourInbox": "Votre boîte de réception : tout ce qu'on vous envoie",
"sidebar.people.yourInboxWaiting": "Votre boîte de réception : en attente de vous, {count}",
+ "sidebar.people.invite": "Inviter quelqu'un",
"inbox.panel.title": "Boîte de réception",
"inbox.empty": "Rien pour vous pour l'instant.",
"inbox.waitsOnYou": "Vous attend",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 3330da0f9a..b814e0f400 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -657,6 +657,7 @@
"sidebar.people.you": "{name} (आप)",
"sidebar.people.yourInbox": "आपका इनबॉक्स: आपको भेजा गया सब कुछ",
"sidebar.people.yourInboxWaiting": "आपका इनबॉक्स: आपके इंतज़ार में, {count}",
+ "sidebar.people.invite": "किसी को आमंत्रित करें",
"inbox.panel.title": "इनबॉक्स",
"inbox.empty": "अभी आपके लिए कुछ नहीं है।",
"inbox.waitsOnYou": "आपके इंतज़ार में",
diff --git a/src/locales/it.json b/src/locales/it.json
index 3192f02ce3..da858b0198 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -6269,6 +6269,7 @@
"sidebar.people.you": "{name} (tu)",
"sidebar.people.yourInbox": "La tua posta in arrivo: tutto ciò che ti viene inviato",
"sidebar.people.yourInboxWaiting": "La tua posta in arrivo: in attesa di te, {count}",
+ "sidebar.people.invite": "Invita qualcuno",
"inbox.panel.title": "Posta in arrivo",
"inbox.empty": "Ancora niente per te.",
"inbox.waitsOnYou": "Ti aspetta",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 0e9bf7b0dc..b90097139b 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -1839,6 +1839,7 @@
"sidebar.people.you": "{name}(あなた)",
"sidebar.people.yourInbox": "あなたの受信箱:あなた宛てのものがすべて届きます",
"sidebar.people.yourInboxWaiting": "あなたの受信箱:あなたの対応待ち、{count} 件",
+ "sidebar.people.invite": "メンバーを招待",
"inbox.panel.title": "受信箱",
"inbox.empty": "あなた宛てのものはまだありません。",
"inbox.waitsOnYou": "あなたの対応待ち",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index e6f4cadd85..9d75e3453a 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -1922,6 +1922,7 @@
"sidebar.people.you": "{name}(나)",
"sidebar.people.yourInbox": "받은편지함: 나에게 온 모든 것",
"sidebar.people.yourInboxWaiting": "받은편지함: 나를 기다리는 것 {count}개",
+ "sidebar.people.invite": "다른 사람 초대",
"inbox.panel.title": "받은편지함",
"inbox.empty": "아직 나에게 온 것이 없어요.",
"inbox.waitsOnYou": "나를 기다리고 있어요",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 5ebfec6702..54093c01b7 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -6408,6 +6408,7 @@
"sidebar.people.you": "{name} (ty)",
"sidebar.people.yourInbox": "Twoja skrzynka: wszystko, co do ciebie trafia",
"sidebar.people.yourInboxWaiting": "Twoja skrzynka: czeka na ciebie, {count}",
+ "sidebar.people.invite": "Zaproś kogoś",
"inbox.panel.title": "Skrzynka",
"inbox.empty": "Na razie nic dla ciebie.",
"inbox.waitsOnYou": "Czeka na ciebie",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 8fe32c2164..734f547b0d 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -1734,6 +1734,7 @@
"sidebar.people.you": "{name} (você)",
"sidebar.people.yourInbox": "Sua caixa de entrada: tudo o que é enviado para você",
"sidebar.people.yourInboxWaiting": "Sua caixa de entrada: esperando por você, {count}",
+ "sidebar.people.invite": "Convidar alguém",
"inbox.panel.title": "Caixa de entrada",
"inbox.empty": "Nada para você ainda.",
"inbox.waitsOnYou": "Esperando por você",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index ee6cc7fa62..19ce2e67c2 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -1838,6 +1838,7 @@
"sidebar.people.you": "{name} (вы)",
"sidebar.people.yourInbox": "Ваши входящие: всё, что вам отправили",
"sidebar.people.yourInboxWaiting": "Ваши входящие: ждут вас, {count}",
+ "sidebar.people.invite": "Пригласить кого-нибудь",
"inbox.panel.title": "Входящие",
"inbox.empty": "Для вас пока ничего нет.",
"inbox.waitsOnYou": "Ждёт вас",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 9868a6c55e..b696c56d01 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -1382,6 +1382,7 @@
"sidebar.people.you": "{name} (sen)",
"sidebar.people.yourInbox": "Gelen kutun: sana gönderilen her şey",
"sidebar.people.yourInboxWaiting": "Gelen kutun: seni bekliyor, {count}",
+ "sidebar.people.invite": "Birini davet et",
"inbox.panel.title": "Gelen kutusu",
"inbox.empty": "Henüz sizin için bir şey yok.",
"inbox.waitsOnYou": "Sizi bekliyor",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 14c34fd934..a6a4007db9 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -774,6 +774,7 @@
"sidebar.people.you": "{name} (ви)",
"sidebar.people.yourInbox": "Ваші вхідні: усе, що вам надіслали",
"sidebar.people.yourInboxWaiting": "Ваші вхідні: чекає на вас, {count}",
+ "sidebar.people.invite": "Запросити когось",
"inbox.panel.title": "Вхідні",
"inbox.empty": "Поки що для вас нічого немає.",
"inbox.waitsOnYou": "Чекає на вас",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 475c50665f..92625c4b5a 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -1382,6 +1382,7 @@
"sidebar.people.you": "{name} (bạn)",
"sidebar.people.yourInbox": "Hộp thư của bạn: mọi thứ gửi cho bạn",
"sidebar.people.yourInboxWaiting": "Hộp thư của bạn: đang chờ bạn, {count}",
+ "sidebar.people.invite": "Mời ai đó",
"inbox.panel.title": "Hộp thư",
"inbox.empty": "Chưa có gì cho bạn.",
"inbox.waitsOnYou": "Đang chờ bạn",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 6128add6cb..9cb1e28600 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -1216,6 +1216,7 @@
"sidebar.people.you": "{name}(你)",
"sidebar.people.yourInbox": "你的收件匣:寄給你的一切都在這裡",
"sidebar.people.yourInboxWaiting": "你的收件匣:待你處理,{count}",
+ "sidebar.people.invite": "邀請他人",
"inbox.panel.title": "收件匣",
"inbox.empty": "還沒有給你的內容。",
"inbox.waitsOnYou": "待你處理",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 51a6d7ce1e..7bf707147e 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -2022,6 +2022,7 @@
"sidebar.people.you": "{name}(你)",
"sidebar.people.yourInbox": "你的收件箱:发给你的一切都在这里",
"sidebar.people.yourInboxWaiting": "你的收件箱:待你处理,{count}",
+ "sidebar.people.invite": "邀请他人",
"inbox.panel.title": "收件箱",
"inbox.empty": "还没有给你的内容。",
"inbox.waitsOnYou": "待你处理",