From 63b07ec6c67bd839a0a8b16b5d9390dfb91fc025 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 00:35:08 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/admin.users.tsx | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/routes/admin.users.tsx b/src/routes/admin.users.tsx index eb634b4..62bd671 100644 --- a/src/routes/admin.users.tsx +++ b/src/routes/admin.users.tsx @@ -265,6 +265,51 @@ function UsersPage() { ); } +function RateInput({ + value, + onSave, +}: { + value: number | null; + onSave: (v: number | null) => void | Promise; +}) { + const [text, setText] = useState(value != null ? String(value) : ""); + useEffect(() => setText(value != null ? String(value) : ""), [value]); + const dirty = text !== (value != null ? String(value) : ""); + + const commit = () => { + if (!dirty) return; + if (text.trim() === "") return onSave(null); + const n = parseFloat(text); + if (Number.isNaN(n) || n < 0) { + toast.error("Invalid rate"); + setText(value != null ? String(value) : ""); + return; + } + onSave(n); + }; + + return ( +
+ $ + setText(e.target.value)} + onBlur={commit} + onKeyDown={(e) => { + if (e.key === "Enter") (e.target as HTMLInputElement).blur(); + }} + placeholder="—" + className="h-8 w-24" + /> + /hr +
+ ); +} + + function InviteDialog({ onCreated }: { onCreated: () => void }) { const [email, setEmail] = useState(""); const [fullName, setFullName] = useState("");