feat(story-193): clickable code references in frontend

This commit is contained in:
Dave
2026-02-26 12:34:57 +00:00
parent 4cafc6f299
commit 77547972c4
6 changed files with 347 additions and 13 deletions

View File

@@ -2,6 +2,10 @@ export interface EditorSettings {
editor_command: string | null;
}
export interface OpenFileResult {
success: boolean;
}
const DEFAULT_API_BASE = "/api";
function buildApiUrl(path: string, baseUrl = DEFAULT_API_BASE): string {
@@ -47,4 +51,20 @@ export const settingsApi = {
baseUrl,
);
},
openFile(
path: string,
line?: number,
baseUrl?: string,
): Promise<OpenFileResult> {
const params = new URLSearchParams({ path });
if (line !== undefined) {
params.set("line", String(line));
}
return requestJson<OpenFileResult>(
`/settings/open-file?${params.toString()}`,
{ method: "POST" },
baseUrl,
);
},
};