A desktop coding agent with free access to frontier models.
TypeScript
fix: drop New and Preview from the account badge
ogsamrat49293897b243
diff --git a/apps/app/src/app/lib/quality.ts b/apps/app/src/app/lib/quality.tsindex a04c017b..2f9f02e7 100644--- a/apps/app/src/app/lib/quality.ts+++ b/apps/app/src/app/lib/quality.ts@@ -49,9 +49,14 @@ export function qualityTierLabel(tier: QualityTier): string {return TIER_LABELS[tier] ?? "Standard";}-/** The badge's text: "Gold", or "Gold · Preview" while spins pay nothing. */+/** The badge's text: the tier alone. Preview (spins pay nothing) lives in the tooltip. */export function qualityBadgeText(quality: AccountQuality): string {- return quality.preview ? `${qualityTierLabel(quality.tier)} · Preview` : qualityTierLabel(quality.tier);+ return qualityTierLabel(quality.tier);+}++/** No badge while the account is still New: there is no tier to show yet. */+export function showsQualityBadge(quality: AccountQuality | null | undefined): quality is AccountQuality {+ return !!quality && quality.tier !== "new";}/** The badge's tooltip: the hint to the next tier and, while limited, the token cut. */diff --git a/apps/app/src/react-app/domains/quality/quality-parts.tsx b/apps/app/src/react-app/domains/quality/quality-parts.tsxindex 6cdce0a3..e8f88b8f 100644--- a/apps/app/src/react-app/domains/quality/quality-parts.tsx+++ b/apps/app/src/react-app/domains/quality/quality-parts.tsx@@ -4,12 +4,12 @@ import { cn } from "@/lib/utils";import { compactTokenCount } from "../../../app/lib/omnirush-usage";import { goodSessionWording } from "../../../app/lib/good-session";-import { qualityBadgeText, qualityBadgeTitle, type AccountQuality } from "../../../app/lib/quality";+import { qualityBadgeText, qualityBadgeTitle, showsQualityBadge, type AccountQuality } from "../../../app/lib/quality";-/** The tier, as a small neutral badge. Dashed in preview (spins pay nothing). */+/** The tier, as a small neutral badge; preview only in the tooltip. */export function QualityTierBadge({ quality, className }: { quality: AccountQuality | null; className?: string }) {- // Null: quality rewards are switched off, and nothing shows.- if (!quality) return null;+ // Null: quality rewards are switched off. New: no tier earned yet. Nothing shows.+ if (!showsQualityBadge(quality)) return null;return (<Badgevariant="outline"@@ -17,11 +17,7 @@ export function QualityTierBadge({ quality, className }: { quality: AccountQualidata-tier={quality.tier}data-preview={quality.preview ? "" : undefined}title={qualityBadgeTitle(quality)}- className={cn(- "h-4 px-1.5 text-[10px] font-normal text-muted-foreground",- quality.preview && "border-dashed",- className,- )}+ className={cn("h-4 px-1.5 text-[10px] font-normal text-muted-foreground", className)}>{qualityBadgeText(quality)}</Badge>diff --git a/apps/app/tests/quality.test.tsx b/apps/app/tests/quality.test.tsxindex 531a8614..440f69a0 100644--- a/apps/app/tests/quality.test.tsx+++ b/apps/app/tests/quality.test.tsx@@ -81,7 +81,7 @@ function memoryStorage() {describe("tier badge", () => {const labels: Record<QualityTier, string> = { new: "New", standard: "Standard", gold: "Gold", coaching: "Coaching", limited: "Limited" };- for (const [tier, label] of Object.entries(labels) as [QualityTier, string][]) {+ for (const [tier, label] of (Object.entries(labels) as [QualityTier, string][]).filter(([tier]) => tier !== "new")) {test(`shows ${label} for ${tier}`, () => {const html = renderToStaticMarkup(<QualityTierBadge quality={{ ...quality, tier, preview: false }} />);expect(html).toContain(`data-tier="${tier}"`);@@ -90,12 +90,17 @@ describe("tier badge", () => {});}- test("preview: dashed, and says Preview", () => {+ test("new: no badge beside the name", () => {+ expect(renderToStaticMarkup(<QualityTierBadge quality={{ ...quality, tier: "new", preview: true }} />)).toBe("");+ });++ test("preview: the tier alone, preview only in the tooltip", () => {const html = renderToStaticMarkup(<QualityTierBadge quality={{ ...quality, preview: true }} />);- expect(qualityBadgeText({ ...quality, preview: true })).toBe("Gold · Preview");- expect(html).toContain("Gold · Preview");- expect(html).toContain("data-preview");- expect(html).toContain("border-dashed");+ expect(qualityBadgeText({ ...quality, preview: true })).toBe("Gold");+ expect(html).toContain(">Gold</span>");+ expect(html).not.toContain("Preview<");+ expect(html).not.toContain("border-dashed");+ expect(html).toContain("preview: spins pay 0 tokens");});test("renders nothing while quality is null (feature off)", () => {