Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
UI polish round 5: table alignment, steadier panel and Settings edges
aivsomkar3ad810d49f24
diff --git a/src/components/RichTable.tsx b/src/components/RichTable.tsxindex 2f556b9b76..cd4c904025 100644--- a/src/components/RichTable.tsx+++ b/src/components/RichTable.tsx@@ -2,7 +2,7 @@ import { useDeferredValue, useEffect, useId, useMemo, useRef, useState, type Reaimport { createPortal } from "react-dom";import { useVirtualizer } from "@tanstack/react-virtual";import { ArrowDown, ArrowUp, Check, Copy, Download, Maximize2, Search, WrapText, X } from "lucide-react";-import { isTableNumber, tableCsv, tableRowOrder, type TableSort } from "@/lib/table-data";+import { isTableAmount, tableCsv, tableRowOrder, type TableSort } from "@/lib/table-data";import { intlLocale, t } from "@/lib/i18n";import { copyText } from "@/lib/copy-text";import { columnMinimums, fitsColumns } from "@/lib/table-fit";@@ -170,7 +170,7 @@ function TableViewport({ columns, rows, order, name, wrap, large, sort, onSort,))), [columns, rows]);const numeric = useMemo(() => columns.map((_, index) => {const nonempty = rows.slice(0, 200).map((row) => row[index]?.text.trim() ?? "").filter(Boolean);- return nonempty.length > 0 && nonempty.every(isTableNumber);+ return nonempty.length > 0 && nonempty.every(isTableAmount);}), [columns, rows]);const virtualizer = useVirtualizer({ count: order.length, getScrollElement: () => scroll.current, estimateSize: () => 42,getItemKey: (index) => order[index]!, overscan: 6, enabled: virtual, initialRect: { width: 800, height: 400 }, scrollMargin: headingHeight });diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex 84a2256f99..5cdfdfe8df 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -571,7 +571,7 @@ export function SettingsModal() {ref={scrollRef}data-settings-scrollclassName={cn(- "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-4 pb-8 pt-4 [mask-image:linear-gradient(to_bottom,#000_calc(100%-28px),transparent)] sm:px-8 sm:pb-7 sm:pt-[22px]",+ "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-4 pb-10 pt-4 sm:px-8 sm:pb-12 sm:pt-[22px]",SIMPLE_BUTTONS,"[&_.uppercase]:normal-case [&_.uppercase]:tracking-normal",)}diff --git a/src/components/bot-panel/Conversations.tsx b/src/components/bot-panel/Conversations.tsxindex 03a8b74652..49fdccefbf 100644--- a/src/components/bot-panel/Conversations.tsx+++ b/src/components/bot-panel/Conversations.tsx@@ -143,7 +143,7 @@ export function BotConversations({ bot }: { bot: Bot }) {title={t("botPanel.conversations.search")}aria-pressed={searching}onClick={() => (searching ? stopSearching() : setSearching(true))}- className={cn("flex size-9 shrink-0 items-center justify-center rounded-full text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink", searching && "bg-ink/[0.06] text-ink")}+ className={cn("flex size-9 shrink-0 items-center justify-center rounded-full bg-ink/[0.05] text-ink-secondary transition-colors hover:bg-ink/[0.09] hover:text-ink", searching && "bg-ink/[0.09] text-ink")}><Search size={15} aria-hidden="true" /></button>diff --git a/src/components/bot-panel/DetailsTab.tsx b/src/components/bot-panel/DetailsTab.tsxindex 9e1241135d..eca54c8c1d 100644--- a/src/components/bot-panel/DetailsTab.tsx+++ b/src/components/bot-panel/DetailsTab.tsx@@ -33,9 +33,8 @@ export function ItemRow({ item }: { item: SidebarMenuItem }) {{item.icon}</span><span className={cn("min-w-0 truncate text-[14px] font-medium", !wrapsValue && "flex-1", item.active ? "text-accent-text" : "text-ink")}>{item.label}</span>- {item.trailing- ? <span className={cn("flex items-center", wrapsValue ? "min-w-0 flex-1 justify-end text-right" : "shrink-0")}>{item.trailing}</span>- : <ChevronRight size={15} aria-hidden="true" className="shrink-0 text-ink-tertiary rtl:-scale-x-100" />}+ {item.trailing && <span className={cn("flex items-center", wrapsValue ? "min-w-0 flex-1 justify-end text-right" : "shrink-0")}>{item.trailing}</span>}+ {item.key !== "find" && <ChevronRight size={15} aria-hidden="true" className="shrink-0 text-ink-tertiary rtl:-scale-x-100" />}</button>);}diff --git a/src/lib/table-data.test.ts b/src/lib/table-data.test.tsindex 87eda02762..9df14f9f94 100644--- a/src/lib/table-data.test.ts+++ b/src/lib/table-data.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from "vitest";-import { parseTableFile, tableCsv, tableDelimiter, tableRowOrder } from "./table-data";+import { isTableAmount, parseTableFile, tableCsv, tableDelimiter, tableRowOrder } from "./table-data";describe("table data", () => {it("parses quoted CSV, embedded newlines, escaped quotes, BOM, CRLF and leading zeroes", () => {@@ -46,3 +46,10 @@ describe("table data", () => {expect(tableDelimiter("report.xlsx")).toBeNull();});});++describe("isTableAmount", () => {+ it("reads prices, grouped thousands and percentages as amounts, and words or dates as not", () => {+ for (const amount of ["612", "$612", "-$1,234.50", "€9", "12%", "1234", "0.5"]) expect(isTableAmount(amount), amount).toBe(true);+ for (const text of ["TAP Air Portugal", "Thu 18:40", "2026-11-08", "$", "1,23", "12 %%"]) expect(isTableAmount(text), text).toBe(false);+ });+});diff --git a/src/lib/table-data.ts b/src/lib/table-data.tsindex ff715e92c9..47bcb3babf 100644--- a/src/lib/table-data.ts+++ b/src/lib/table-data.ts@@ -35,6 +35,10 @@ const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "basconst NUMBER = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;export function isTableNumber(text: string): boolean { return NUMBER.test(text.trim()); }+const AMOUNT = /^[+-]?[$€£¥₹]?\d{1,3}(?:,?\d{3})*(?:\.\d+)?%?$/;+/** A cell that reads as a quantity (a plain number, a price, a percentage), so its column lines up on the right. */+export function isTableAmount(text: string): boolean { return isTableNumber(text) || AMOUNT.test(text.trim()); }+export function tableRowOrder(rows: readonly (readonly string[])[], query: string, sort: TableSort): number[] {const needle = query.trim().toLocaleLowerCase();const order = rows.flatMap((row, index) => !needle || row.some((cell) => cell.toLocaleLowerCase().includes(needle)) ? [index] : []);diff --git a/src/styles.css b/src/styles.cssindex 615fd1a24f..7a05fece45 100644--- a/src/styles.css+++ b/src/styles.css@@ -1153,6 +1153,13 @@width: 100%;border-radius: 12px;}+[data-reply-bubble] [data-table-card] thead {+ background: color-mix(in srgb, var(--color-card), var(--color-ink) 7%);+}+/* A section that opens right after a table keeps the space a heading gets elsewhere in the reply. */+[data-reply-bubble] > [data-reply-table] + * .chat-md > .md-heading:first-child {+ margin-top: 6px;+}/* A card under its own bot's bubble (and a bubble under its card) sits 12px below it, not the 16px between senders. */[data-simple-rows] > [data-tuck] > :first-child {margin-top: -4px;