Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions client/__tests__/ImportSettings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const baseConfig: ImportConfig = {
libraryRoot: "/data/library",
transferMode: "hardlink",
autoDeleteAfterImport: false,
sortExtras: false,
importPlatformIds: [],
renamePattern: "{Title} ({Year})",
} as unknown as ImportConfig;
Expand Down Expand Up @@ -107,6 +108,23 @@ describe("ImportSettings", () => {
});
});

it("allows category subfolders to be enabled", async () => {
const { apiRequest } = await import("@/lib/queryClient");
renderComponent();
await screen.findByText("Sort add-on files into subfolders");

fireEvent.click(screen.getAllByRole("switch")[4]);
fireEvent.click(screen.getByRole("button", { name: /save changes/i }));

await waitFor(() => {
expect(apiRequest).toHaveBeenCalledWith(
"PATCH",
"/api/imports/config",
expect.objectContaining({ sortExtras: true })
);
});
});

it("filters platforms by search text", async () => {
renderComponent();
await screen.findByText("PC (Microsoft Windows)");
Expand Down
17 changes: 17 additions & 0 deletions client/src/components/ImportSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,23 @@
}
/>
</div>
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label>Sort add-on files into subfolders</Label>
<p className="text-xs text-muted-foreground">
For directory imports, place detected DLC, updates, and extras in
<code> dlc/</code>, <code>update/</code>, and <code>extra/</code>{" "}

Check warning on line 299 in client/src/components/ImportSettings.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Ambiguous spacing before next element code

See more on https://sonarcloud.io/project/issues?id=Doezer_Questarr&issues=AZ_IOTnAerldBbb0Ev0j&open=AZ_IOTnAerldBbb0Ev0j&pullRequest=877
subfolders inside the game folder. Single-file imports keep their
existing layout.
</p>
</div>
<Switch
checked={localConfig.sortExtras}
onCheckedChange={(checked) =>
setLocalConfig({ ...localConfig, sortExtras: checked })
}
/>
</div>
</div>

<Separator className="mb-6" />
Expand Down
1 change: 1 addition & 0 deletions migrations/0026_chemical_nightmare.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `user_settings` ADD `sort_extras` integer DEFAULT false NOT NULL;
Loading