Skip to content
Merged
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
14 changes: 14 additions & 0 deletions admin/src/components/SearchField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {ChangeEventHandler, FC} from "react";
import {Search} from 'lucide-react'
export type SearchFieldProps = {
value: string,
onChange: ChangeEventHandler<HTMLInputElement>,
placeholder?: string
}

export const SearchField:FC<SearchFieldProps> = ({onChange,value, placeholder})=>{
return <span className="search-field">
<input value={value} onChange={onChange} placeholder={placeholder}/>
<Search/>
</span>
}
6 changes: 6 additions & 0 deletions admin/src/utils/sorting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const determineSorting = (sortBy: string, ascending: boolean, currentSymbol: string) => {
if (sortBy === currentSymbol) {
return ascending ? 'sort up' : 'sort down';
}
return 'sort none';
}
22 changes: 16 additions & 6 deletions src/tests/backend-new/specs/admin-i18n-source-lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,26 @@ describe('admin i18n source lint', () => {
"SearchParams['sortBy'] still includes 'downloads'").toBe(false);
});

it('orphan modules from pre-rework admin are gone', () => {
// SearchField.tsx and sorting.ts were imported by the pre-rework admin
// pages but the rework dropped both. Delete-then-grep here so a future
// unrelated import accidentally re-adding them fails review.
it('SearchField + sorting modules exist and are consumed by AuthorPage', () => {
// History: PR #7716 (admin design rework) dropped the last consumer of
// these helpers, then PR #7736 deleted both modules calling them
// "orphans". PR #7667 (GDPR author-erasure) merged afterwards from an
// older base and reintroduced imports of SearchField + determineSorting
// in admin/src/pages/AuthorPage.tsx, breaking the admin build on
// develop. The files have been restored; this test pins both the file
// presence and the AuthorPage consumption so a future "orphan" sweep
// cannot quietly remove them again without also updating AuthorPage.
const fs = require('fs');
const join = require('path').join;
expect(fs.existsSync(join(repoRoot, 'admin/src/components/SearchField.tsx')),
'admin/src/components/SearchField.tsx is dead code from pre-rework admin').toBe(false);
'admin/src/components/SearchField.tsx is missing — AuthorPage imports it').toBe(true);
expect(fs.existsSync(join(repoRoot, 'admin/src/utils/sorting.ts')),
'admin/src/utils/sorting.ts is dead code from pre-rework admin').toBe(false);
'admin/src/utils/sorting.ts is missing — AuthorPage imports determineSorting from it').toBe(true);
const authorPage = read('admin/src/pages/AuthorPage.tsx');
expect(authorPage.includes("from \"../components/SearchField.tsx\""),
'AuthorPage no longer imports SearchField — delete SearchField.tsx too').toBe(true);
expect(authorPage.includes("from \"../utils/sorting.ts\""),
'AuthorPage no longer imports determineSorting — delete sorting.ts too').toBe(true);
});

it('PadPage sort dropdown is paired with a direction toggle', () => {
Expand Down
Loading