Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement UI for automatically updating lists. #38

Merged
merged 3 commits into from
Aug 25, 2022
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
## Changelog

### v0.0.12
### v0.1.0

#### Fixed

- The screen no longer appears to be blank when the LastPass browser extension is enabled.
- The advanced search input fields are now correctly aligned in Firefox.
- Spurious bullets have been removed from the search result and list entry lists.

#### Updated

- Lists can now be automatically updated using the configured search parameters.

### v0.0.11

#### Fixed
Expand Down
5 changes: 5 additions & 0 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,11 @@ export default class ActionCreator extends BaseActionCreator {
if (url) {
return dispatch(this.fetchCollection(url));
}

// If there isn't a viable search URL (i.e, no filters have been added to the advanced search
// query), just clear the results.

return dispatch(this.clear(ActionCreator.COLLECTION));
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/AdvancedSearchBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface AdvancedSearchBuilderProps {
}

export const fields = [
{ value: "distributor", label: "distributor" },
{ value: "data_source", label: "distributor" },
{ value: "publisher", label: "publisher" },
{ value: "published", label: "publication date" },
{ value: "genre", label: "genre" },
Expand Down
16 changes: 16 additions & 0 deletions src/components/CustomListEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ type CustomListEditorProps = {
entries?: CustomListEditorEntriesData;
entryPoints?: string[];
isFetchingMoreCustomListEntries: boolean;
isFetchingSearchResults: boolean;
isFetchingMoreSearchResults: boolean;
isLoaded?: boolean;
isModified?: boolean;
isValid?: boolean;
languages: LanguagesData;
Expand Down Expand Up @@ -67,7 +69,9 @@ export default function CustomListEditor({
entries,
entryPoints,
isFetchingMoreCustomListEntries,
isFetchingSearchResults,
isFetchingMoreSearchResults,
isLoaded,
isModified,
isValid,
languages,
Expand Down Expand Up @@ -97,6 +101,13 @@ export default function CustomListEditor({
}: CustomListEditorProps) {
const { collections: listCollections, name } = properties;

// Automatically execute the search when the list being edited changes, or finishes loading
// (which means a stored query may have been loaded).

React.useEffect(() => {
search?.();
}, [listId, isLoaded]);

return (
<div className="custom-list-editor">
<div className="custom-list-editor-header">
Expand Down Expand Up @@ -164,7 +175,9 @@ export default function CustomListEditor({
)}

<CustomListSearch
autoUpdate={properties.autoUpdate}
searchParams={searchParams}
updateAutoUpdate={(value) => updateProperty?.("autoUpdate", value)}
updateSearchParam={updateSearchParam}
search={search}
entryPoints={entryPoints}
Expand All @@ -180,10 +193,12 @@ export default function CustomListEditor({
</section>

<CustomListEntriesEditor
autoUpdate={properties.autoUpdate}
searchResults={searchResults}
entries={entries.current}
loadMoreSearchResults={loadMoreSearchResults}
loadMoreEntries={loadMoreEntries}
isFetchingSearchResults={isFetchingSearchResults}
isFetchingMoreSearchResults={isFetchingMoreSearchResults}
isFetchingMoreCustomListEntries={isFetchingMoreCustomListEntries}
opdsFeedUrl={`${library?.short_name}/${
Expand All @@ -195,6 +210,7 @@ export default function CustomListEditor({
addAllEntries={addAllEntries}
deleteEntry={deleteEntry}
deleteAllEntries={deleteAllEntries}
refreshResults={search}
/>
</div>
</div>
Expand Down
Loading