π OpenHands: AI-Driven Development
fix(agent-canvas): replace dead Tailwind classes with theme tokens on device verify page (#17603)
Harsh Kashyap462928ed24bb
diff --git a/__tests__/routes/device-verify.test.tsx b/__tests__/routes/device-verify.test.tsxindex 248f28665a..e42679693d 100644--- a/__tests__/routes/device-verify.test.tsx+++ b/__tests__/routes/device-verify.test.tsx@@ -592,4 +592,58 @@ describe("DeviceVerify", () => {expect(reloadMock).toHaveBeenCalled();});});++ describe("Theme tokens", () => {+ it("should style the authorization card with theme surface and muted text tokens", async () => {+ useIsAuthedMock.mockReturnValue({+ data: true,+ isLoading: false,+ });++ render(+ <RouterStub initialEntries={["/device-verify?user_code=ABC-123"]} />,+ {+ wrapper: createWrapper(),+ },+ );++ await waitFor(() => {+ expect(+ screen.getByText("DEVICE$AUTHORIZATION_REQUEST"),+ ).toBeInTheDocument();+ });++ const prompt = screen.getByText("DEVICE$CONFIRM_PROMPT");+ expect(prompt).toHaveClass("text-muted");+ expect(prompt).not.toHaveClass("text-muted-foreground");++ const card = prompt.closest("div.rounded-2xl");+ expect(card).not.toBeNull();+ expect(card).toHaveClass("bg-surface-raised");+ expect(card).not.toHaveClass("bg-card");+ });++ it("should style the manual entry input with theme border and focus ring tokens", async () => {+ useIsAuthedMock.mockReturnValue({+ data: true,+ isLoading: false,+ });++ render(<RouterStub initialEntries={["/device-verify"]} />, {+ wrapper: createWrapper(),+ });++ await waitFor(() => {+ expect(+ screen.getByLabelText("DEVICE$CODE_INPUT_LABEL"),+ ).toBeInTheDocument();+ });++ const input = screen.getByLabelText("DEVICE$CODE_INPUT_LABEL");+ expect(input).toHaveClass("border-border-input");+ expect(input).toHaveClass("focus:ring-focus");+ expect(input).not.toHaveClass("border-input");+ expect(input).not.toHaveClass("focus:ring-ring");+ });+ });});diff --git a/src/routes/device-verify.tsx b/src/routes/device-verify.tsxindex cffb468e4f..f82afc18d6 100644--- a/src/routes/device-verify.tsx+++ b/src/routes/device-verify.tsx@@ -64,7 +64,7 @@ export default function DeviceVerify() {if (verificationResult) {return (<div className="min-h-screen flex items-center justify-center bg-background">- <div className="max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg">+ <div className="max-w-md w-full mx-auto p-6 bg-surface-raised rounded-lg shadow-lg"><div className="text-center"><divclassName={cn(@@ -107,7 +107,7 @@ export default function DeviceVerify() {? t(I18nKey.DEVICE$SUCCESS_TITLE): t(I18nKey.DEVICE$ERROR_TITLE)}</h2>- <p className="text-muted-foreground mb-4">+ <p className="text-muted mb-4">{t(verificationResult.messageKey)}</p>{!verificationResult.success && (@@ -128,12 +128,10 @@ export default function DeviceVerify() {if (isProcessing) {return (<div className="min-h-screen flex items-center justify-center bg-background">- <div className="max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg">+ <div className="max-w-md w-full mx-auto p-6 bg-surface-raised rounded-lg shadow-lg"><div className="text-center"><div className="animate-spin rounded-full h-8 w-8 border-b-2 border-contrast mx-auto mb-4" />- <p className="text-muted-foreground">- {t(I18nKey.DEVICE$PROCESSING)}- </p>+ <p className="text-muted">{t(I18nKey.DEVICE$PROCESSING)}</p></div></div></div>@@ -144,7 +142,7 @@ export default function DeviceVerify() {return (<div className="min-h-screen flex items-center justify-center bg-background p-4"><div className="flex flex-col items-center gap-6 w-full max-w-md">- <div className="flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-card rounded-2xl shadow-lg border border-border-subtle">+ <div className="flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-surface-raised rounded-2xl shadow-lg border border-border-subtle"><H1 className="text-2xl mb-4 text-center">{t(I18nKey.DEVICE$AUTHORIZATION_REQUEST)}</H1>@@ -164,7 +162,7 @@ export default function DeviceVerify() {{t(I18nKey.DEVICE$SECURITY_WARNING)}</p></div>- <p className="text-muted-foreground mb-6 text-center">+ <p className="text-muted mb-6 text-center">{t(I18nKey.DEVICE$CONFIRM_PROMPT)}</p><div className="flex gap-3">@@ -192,11 +190,11 @@ export default function DeviceVerify() {if (isAuthed && !userCode) {return (<div className="min-h-screen flex items-center justify-center bg-background">- <div className="max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg">+ <div className="max-w-md w-full mx-auto p-6 bg-surface-raised rounded-lg shadow-lg"><H1 className="text-2xl mb-4 text-center">{t(I18nKey.DEVICE$AUTHORIZATION_TITLE)}</H1>- <p className="text-muted-foreground mb-6 text-center">+ <p className="text-muted mb-6 text-center">{t(I18nKey.DEVICE$ENTER_CODE_PROMPT)}</p><form onSubmit={handleManualSubmit}>@@ -212,7 +210,7 @@ export default function DeviceVerify() {id="user_code"name="user_code"required- className="w-full px-3 py-2 border border-input rounded-md focus:outline-none focus:ring-2 focus:ring-ring"+ className="w-full px-3 py-2 border border-border-input rounded-md focus:outline-none focus:ring-2 focus:ring-focus"placeholder={t(I18nKey.DEVICE$CODE_PLACEHOLDER)}/></div>@@ -233,9 +231,7 @@ export default function DeviceVerify() {<div className="min-h-screen flex items-center justify-center bg-background"><div className="text-center"><div className="animate-spin rounded-full h-8 w-8 border-b-2 border-contrast mx-auto mb-4" />- <p className="text-muted-foreground">- {t(I18nKey.DEVICE$PROCESSING)}- </p>+ <p className="text-muted">{t(I18nKey.DEVICE$PROCESSING)}</p></div></div>);@@ -243,11 +239,9 @@ export default function DeviceVerify() {return (<div className="min-h-screen flex items-center justify-center bg-background">- <div className="max-w-md w-full mx-auto p-6 bg-card rounded-lg shadow-lg text-center">+ <div className="max-w-md w-full mx-auto p-6 bg-surface-raised rounded-lg shadow-lg text-center"><H1 className="text-2xl mb-4">{t(I18nKey.DEVICE$AUTH_REQUIRED)}</H1>- <p className="text-muted-foreground">- {t(I18nKey.DEVICE$SIGN_IN_PROMPT)}- </p>+ <p className="text-muted">{t(I18nKey.DEVICE$SIGN_IN_PROMPT)}</p></div></div>);