π OpenHands: AI-Driven Development
fix(files): fit the file discovery dialog on phone screens (#18398)
Engel Nystaaf7018cf057
diff --git a/__tests__/components/features/files-tab/workspace-file-discovery-settings.test.tsx b/__tests__/components/features/files-tab/workspace-file-discovery-settings.test.tsxindex 0a1145615b..46e99c220c 100644--- a/__tests__/components/features/files-tab/workspace-file-discovery-settings.test.tsx+++ b/__tests__/components/features/files-tab/workspace-file-discovery-settings.test.tsx@@ -6,6 +6,10 @@ import { WorkspaceFileDiscoverySettings } from "#/components/features/files-tab/import SettingsService from "#/api/settings-service/settings-service.api";import { DEFAULT_SETTINGS } from "#/services/settings";import { DEFAULT_FILE_DISCOVERY } from "#/utils/workspace-file-discovery";+import {+ MODAL_MAX_WIDTH_VIEWPORT,+ MODAL_WIDTH_CLASS,+} from "#/components/shared/modals/modal-body";import { useSettings } from "#/hooks/query/use-settings";vi.mock("#/api/settings-service/settings-service.api", () => ({@@ -94,6 +98,17 @@ describe("workspace discovery settings", () => {});});+ it("caps the 520px dialog at 90vw so phone viewports cannot clip it", async () => {+ const { user } = setup();+ await user.click(+ await screen.findByRole("button", { name: "FILES$DISCOVERY_SETTINGS" }),+ );++ const modal = screen.getByTestId("file-discovery-settings-modal");+ expect(modal).toHaveClass(MODAL_WIDTH_CLASS.md);+ expect(modal).toHaveClass(MODAL_MAX_WIDTH_VIEWPORT);+ });+it("hydrates saved options, discards canceled drafts and restores defaults only on Save", async () => {vi.mocked(SettingsService.getSettings).mockResolvedValue({...DEFAULT_SETTINGS,diff --git a/src/components/features/files-tab/workspace-file-discovery-settings.tsx b/src/components/features/files-tab/workspace-file-discovery-settings.tsxindex 569c863c4c..99e07eba58 100644--- a/src/components/features/files-tab/workspace-file-discovery-settings.tsx+++ b/src/components/features/files-tab/workspace-file-discovery-settings.tsx@@ -8,8 +8,12 @@ import {type WorkspaceFileDiscovery,} from "#/utils/workspace-file-discovery";import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";-import { ModalBody } from "#/components/shared/modals/modal-body";+import {+ MODAL_MAX_WIDTH_VIEWPORT,+ ModalBody,+} from "#/components/shared/modals/modal-body";import { BrandButton } from "#/components/features/settings/brand-button";+import { cn } from "#/utils/utils";function DiscoveryForm({options,@@ -53,8 +57,12 @@ function DiscoveryForm({closeOnBackdropClick={!isSaving}><ModalBody+ testID="file-discovery-settings-modal"width="md"- className="items-stretch max-h-[90vh] overflow-y-auto"+ className={cn(+ "items-stretch max-h-[90vh] overflow-y-auto",+ MODAL_MAX_WIDTH_VIEWPORT,+ )}><h2 className="text-lg font-semibold">{t(I18nKey.FILES$DISCOVERY_SETTINGS)}