Skip to content

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

Merge #7205 into train L1b: Sidebar: group bots with unread messages

milind-soni656b0feac6a6
diff --cc src/components/Sidebar.tsx
index 33f92cd8ca,a6b0168255..ab83b33371
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@@ -1095,22 -1099,16 +1099,16 @@@ export const Sidebar = memo(function Si
const viewerEmail = useViewerEmail();
const parts = partitionSidebarBots(botDrag.preview(matchingBots), { universalPins, viewerEmail, welcoming: useWelcomingBot(), searching: Boolean(q) });
const saved = simpleDesk ? withPrimaryTile(parts, myDefaultBot(state.bots, viewerEmail)?.id) : { ...parts, primary: null };
- // Shown order only: a drag or Alt+Up/Down moves a bot among the rows as drawn and saves it into the saved order.
- // Shown order only: drag and Alt+Up/Down work on the saved order of the rows left in place, never on this one.
++ // Shown order only: a drag or Alt+Up/Down moves a bot among the rows as drawn and saves it into the saved order of the
++ // rows left in place; a row Unread lists is in neither.
+ const floats = (bot: Bot) => { const { waiting, working } = sidebarBotStatus(bot, state.pendingQueued); return waiting || working; };
- const { primary, unsectionedChief, pinnedBots, sectionChiefs, sectionedBots, unsectionedBots } = { ...saved, ...activeBotsFirst(saved, floats) };
+ const { primary, unsectionedChief } = saved;
- const { pinnedBots, filed, unreadBots, unreadCount, sectionChiefs, sectionedBots, unsectionedBots, inPlace } = sidebarBotRows(saved, (bot) => {
- const { waiting, working } = sidebarBotStatus(bot, state.pendingQueued);
- return waiting || working;
- }, !q, useUnreadHold(state.activeView === "chat" ? state.selectedId : null, sideLists.bots, state.newChat?.botId));
++ const { pinnedBots, filed, unreadBots, unreadCount, sectionChiefs, sectionedBots, unsectionedBots, inPlace } = sidebarBotRows(saved, floats, !q,
++ useUnreadHold(state.activeView === "chat" ? state.selectedId : null, sideLists.bots, state.newChat?.botId));
const { botChats, sectionedRooms, unsectionedRooms } = partitionSidebarGroups(visibleGroups);
- const sectionNames: string[] = [...(state.sections ?? []).filter((name) => !q || name.toLowerCase().includes(q.toLowerCase())), ...botDrag.pending];
- for (const bot of sectionedBots) {
- if (!sectionNames.includes(bot.section!)) sectionNames.push(bot.section!);
- }
- for (const bot of sectionChiefs) {
- if (!sectionNames.includes(bot.section!)) sectionNames.push(bot.section!);
- }
- for (const group of sectionedRooms) {
- if (!sectionNames.includes(group.section!)) sectionNames.push(group.section!);
- }
- const drops = botDrag.arrange({ enabled: (sections.interactive || density === "icons") && !phone, withinList: density === "icons", main: saved.unsectionedBots, sectioned: saved.sectionedBots, departments: sectionNames, bots: state.bots, taken: departmentNames(state), floats });
+ const sectionNames = sectionsInUse([...(state.sections ?? []).filter((name) => !q || name.toLowerCase().includes(q.toLowerCase())), ...botDrag.pending], [...filed, ...sectionedRooms]);
- const drops = botDrag.arrange({ enabled: (sections.interactive || density === "icons") && !phone, withinList: density === "icons", main: inPlace.unsectionedBots, sectioned: inPlace.sectionedBots, departments: sectionNames, bots: state.bots, taken: departmentNames(state) });
++ const drops = botDrag.arrange({ enabled: (sections.interactive || density === "icons") && !phone, withinList: density === "icons", main: inPlace.unsectionedBots, sectioned: inPlace.sectionedBots, departments: sectionNames, bots: state.bots, taken: departmentNames(state), floats });
const naturalSectionIds = [
...(pinnedBots.length > 0 && !universalPins && !simpleDesk ? [PINNED_SECTION_ID] : []),
...(unsectionedRooms.length > 0 ? [CHANNELS_SECTION_ID] : []),