From aedee7ce26f306ff6f66a31ecac19b1cc6166247 Mon Sep 17 00:00:00 2001 From: Aaron Benmohan John Date: Sat, 25 Apr 2026 19:32:48 +0530 Subject: [PATCH 1/2] feat(command-line): add profile search --- .../src/ts/commandline/lists/navigation.ts | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/commandline/lists/navigation.ts b/frontend/src/ts/commandline/lists/navigation.ts index fc81b9b6ea77..017af4215ae2 100644 --- a/frontend/src/ts/commandline/lists/navigation.ts +++ b/frontend/src/ts/commandline/lists/navigation.ts @@ -1,7 +1,10 @@ import { navigate } from "../../controllers/route-controller"; import { isAuthenticated } from "../../states/core"; import { toggleFullscreen } from "../../utils/misc"; -import { Command } from "../types"; +import { Command, withValidation } from "../types"; +import { remoteValidation } from "../../utils/remote-validation"; +import { UserNameSchema } from "@monkeytype/schemas/users"; +import Ape from "../../ape"; const commands: Command[] = [ { @@ -50,6 +53,28 @@ const commands: Command[] = [ isAuthenticated() ? void navigate("/account") : void navigate("/login"); }, }, + withValidation({ + id: "searchProfile", + display: "Search Profile", + alias: "profile user search find lookup", + icon: "fa-search", + input: true, + validation: { + schema: UserNameSchema, + debounceDelay: 1000, + isValid: remoteValidation( + async (name) => Ape.users.getProfile({ params: { uidOrName: name } }), + { + on4xx: () => "Unknown user", + }, + ), + }, + exec: ({ input }): void => { + const username = input?.trim(); + if (username === undefined || username === "") return; + void navigate(`/profile/${username}`); + }, + }), { id: "toggleFullscreen", display: "Toggle Fullscreen", From bbc85885f67f1e8f99246f1d503ac41dd6d815ec Mon Sep 17 00:00:00 2001 From: Aaron Benmohan John Date: Thu, 30 Apr 2026 21:44:17 +0530 Subject: [PATCH 2/2] removed unnecessary trim() --- frontend/src/ts/commandline/lists/navigation.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/ts/commandline/lists/navigation.ts b/frontend/src/ts/commandline/lists/navigation.ts index 017af4215ae2..8d628167d414 100644 --- a/frontend/src/ts/commandline/lists/navigation.ts +++ b/frontend/src/ts/commandline/lists/navigation.ts @@ -70,9 +70,8 @@ const commands: Command[] = [ ), }, exec: ({ input }): void => { - const username = input?.trim(); - if (username === undefined || username === "") return; - void navigate(`/profile/${username}`); + if (input === undefined) return; + void navigate(`/profile/${input}`); }, }), {