(search) Add refresh link to explore mode.

This is a QOL improvement for mobile users, who otherwise would have to scroll all the way up to refresh.

Also removed the confusing "this is a random set of domains"-message when viewing adjacent websites, as it's not random.
This commit is contained in:
Viktor Lofgren 2023-08-22 12:43:44 +02:00
parent fca62f261e
commit 6f222b9800
3 changed files with 12 additions and 12 deletions

View File

@ -1,12 +1,9 @@
package nu.marginalia.browse.model; package nu.marginalia.browse.model;
import lombok.AllArgsConstructor; import java.util.Collection;
import lombok.Getter;
import java.util.List; public record BrowseResultSet(Collection<BrowseResult> results, String focusDomain) {
public BrowseResultSet(Collection<BrowseResult> results) {
@AllArgsConstructor this(results, "");
@Getter }
public class BrowseResultSet {
public final List<BrowseResult> results;
} }

View File

@ -62,7 +62,10 @@ public class BrowseCommand implements SearchCommandInterface {
} }
return Optional.ofNullable(browseSite(ctx, query)) return Optional.ofNullable(browseSite(ctx, query))
.map(results -> browseResultsRenderer.render(results, Map.of("query", query, "profile", parameters.profileStr()))); .map(results -> browseResultsRenderer.render(results,
Map.of("query", query,
"profile", parameters.profileStr(),
"focusDomain", results.focusDomain())));
} }
@ -89,7 +92,7 @@ public class BrowseCommand implements SearchCommandInterface {
} }
private BrowseResultSet getRandomEntries(int set) { private BrowseResultSet getRandomEntries(int set) {
var results = randomDomains.getRandomDomains(25, blacklist, set); List<BrowseResult> results = randomDomains.getRandomDomains(25, blacklist, set);
results.removeIf(browseResultCleaner.shouldRemoveResultPredicate()); results.removeIf(browseResultCleaner.shouldRemoveResultPredicate());
@ -115,7 +118,7 @@ public class BrowseCommand implements SearchCommandInterface {
// shuffle the items for a less repetitive experience // shuffle the items for a less repetitive experience
shuffle(neighbors); shuffle(neighbors);
return new BrowseResultSet(neighbors); return new BrowseResultSet(neighbors, word);
} }
} }

View File

@ -36,7 +36,7 @@
<h2>Random Domains</h2> <h2>Random Domains</h2>
<p class="description"> <p class="description">
This list of domains is random. <b>Refresh</b> to get This list of domains is random. <a href="/explore/random">Refresh</a> to get
new domains, or click <b>Similar Domains</b> to new domains, or click <b>Similar Domains</b> to
take the helm. take the helm.
</p> </p>