fix(site): simplify context labels and remove unrelated mocks

This commit is contained in:
Michael Suchacz committed 2026-09-14 08:53:28 +00:00
1 parent df01d8b536
commit 8cfc3da83c
2 files changed
+17 -21

No files matched your search

@@ -384,19 +384,27 @@ export const ContextUsageIndicator: FC<{
hasResourceIssues ? "Some context resources failed to load." : "",
].filter((note) => note !== "");
const statusNote = statusNotes.length > 0 ? ` ${statusNotes.join(" ")}` : "";
const ariaLabel = hasPercent
? `${usage?.estimated ? "Estimated context usage" : "Context usage"} ${percentLabel}. ${formatTokenCount(usedTokens)} of ${formatTokenCount(contextLimitTokens)} tokens used.${statusNote}`
: statusNote !== ""
? `Context usage.${statusNote}`
let ariaLabel = "Context usage";
if (hasPercent) {
const label = usage?.estimated
? "Estimated context usage"
: "Context usage";
ariaLabel = `${label} ${percentLabel}. ${formatTokenCount(usedTokens)} of ${formatTokenCount(contextLimitTokens)} tokens used.${statusNote}`;
} else if (statusNote !== "") {
ariaLabel = `Context usage.${statusNote}`;
}
let usageLabel = "Context usage will appear after sending a message.";
if (hasPercent) {
const prefix = usage?.estimated ? "Estimated: " : "";
usageLabel = `${prefix}${percentLabel} - ${formatTokenCountCompact(usedTokens)} / ${formatTokenCountCompact(contextLimitTokens)} context used`;
} else if (hasReportedUsage) {
usageLabel = "Context usage unavailable";
}
const panelContent = (
<div className="text-xs text-content-primary">
{hasPercent
? `${usage?.estimated ? "Estimated: " : ""}${percentLabel} - ${formatTokenCountCompact(usedTokens)} / ${formatTokenCountCompact(contextLimitTokens)} context used`
: hasReportedUsage
? "Context usage unavailable"
: "Context usage will appear after sending a message."}
{usageLabel}
{hasPercent && usage?.estimated && (
<div className="mt-1 max-w-64 text-content-secondary">
Based on the compacted summary only, excluding other prompt content
-12
View File
@@ -4,8 +4,6 @@ import { HttpResponse, http } from "msw";
import type {
CreateUserSecretRequest,
CreateWorkspaceBuildRequest,
ListInboxNotificationsResponse,
Preset,
UpdateUserSecretRequest,
UserSecret,
} from "#/api/typesGenerated";
@@ -14,13 +12,6 @@ import * as M from "./entities";
import { MockGroup, MockWorkspaceQuota } from "./entities";
export const handlers = [
http.get("/api/v2/notifications/inbox", () => {
return HttpResponse.json<ListInboxNotificationsResponse>({
notifications: [],
unread_count: 0,
});
}),
http.get("/api/v2/templates/:templateId/daus", () => {
return HttpResponse.json(M.MockTemplateDAUResponse);
}),
@@ -139,9 +130,6 @@ export const handlers = [
http.get("/api/v2/templateversions/:templateVersionId", () => {
return HttpResponse.json(M.MockTemplateVersion);
}),
http.get("/api/v2/templateversions/:templateVersionId/presets", () => {
return HttpResponse.json<Preset[]>([]);
}),
http.get("/api/v2/templateversions/:templateVersionId/resources", () => {
return HttpResponse.json([
M.MockWorkspaceResource,