diff --git a/code/services-application/search-service/build.gradle b/code/services-application/search-service/build.gradle index e572f6dd..8f4bb977 100644 --- a/code/services-application/search-service/build.gradle +++ b/code/services-application/search-service/build.gradle @@ -92,9 +92,11 @@ task compileTailwind { def inputFile = file('tailwind/globals.css') def configFile = file('tailwind/tailwind.config.js') def outputFile = file('resources/static/css/style.css') + def jteDir = file('resources/jte') inputs.file inputFile inputs.file configFile + inputs.files fileTree(jteDir).include('**/*.jte') outputs.file outputFile doLast { diff --git a/code/services-application/search-service/java/nu/marginalia/search/model/ClusteredUrlDetails.java b/code/services-application/search-service/java/nu/marginalia/search/model/ClusteredUrlDetails.java index 8be43e19..d939fb32 100644 --- a/code/services-application/search-service/java/nu/marginalia/search/model/ClusteredUrlDetails.java +++ b/code/services-application/search-service/java/nu/marginalia/search/model/ClusteredUrlDetails.java @@ -113,20 +113,21 @@ public class ClusteredUrlDetails implements Comparable { return Objects.compare(first, o.first, UrlDetails::compareTo); } - public enum PostColorScheme { - Slate("bg-white", "text-blue-800", "bg-blue-50", "text-black", "text-black"), - Green("bg-white", "text-green-800", "bg-green-50", "text-black", "text-black"), - Purple("bg-white", "text-purple-800", "bg-purple-50", "text-black", "text-black"), - White("bg-white", "text-blue-950", "bg-gray-100", "text-black", "text-black"); - PostColorScheme(String backgroundColor, String textColor, String backgroundColor2, String textColor2, String descColor) { + public enum PostColorScheme { + // Hack: ensure these classes are also in jte/part/warmup.jte! + + Slate( "text-blue-800", "bg-blue-50"), + Green( "text-green-800", "bg-green-50"), + Purple("text-purple-800", "bg-purple-50"), + White("text-blue-950", "bg-gray-100"); + + PostColorScheme(String textColor, String backgroundColor) { this.backgroundColor = backgroundColor; this.textColor = textColor; - this.backgroundColor2 = backgroundColor2; - this.textColor2 = textColor2; - this.descColor = descColor; } + public static PostColorScheme select(UrlDetails result) { long encodedMetadata = result.resultItem.encodedDocMetadata; if (DocumentFlags.PlainText.isPresent(encodedMetadata)) { @@ -145,8 +146,5 @@ public class ClusteredUrlDetails implements Comparable { public final String backgroundColor; public final String textColor; - public final String backgroundColor2; - public final String textColor2; - public final String descColor; } } diff --git a/code/services-application/search-service/resources/jte/part/warmup.jte b/code/services-application/search-service/resources/jte/part/warmup.jte new file mode 100644 index 00000000..a781e996 --- /dev/null +++ b/code/services-application/search-service/resources/jte/part/warmup.jte @@ -0,0 +1,9 @@ +This is a bit of a hack! + +This class exists to let tailwind we're using these classes even though they aren't visible in the code, +as we sometimes generate classes from Java code! + + + + + \ No newline at end of file diff --git a/code/services-application/search-service/resources/jte/serp/part/result.jte b/code/services-application/search-service/resources/jte/serp/part/result.jte index cd7ab181..70fa8e26 100644 --- a/code/services-application/search-service/resources/jte/serp/part/result.jte +++ b/code/services-application/search-service/resources/jte/serp/part/result.jte @@ -2,12 +2,11 @@ @import nu.marginalia.search.command.SearchParameters @import nu.marginalia.search.model.ClusteredUrlDetails @import nu.marginalia.search.model.UrlDetails - @param ClusteredUrlDetails result @param SearchParameters parameters @param boolean domainSearch -
+
@@ -31,7 +30,7 @@
-

+

$unsafe{result.first.descriptionHyphenHints()}

@@ -52,7 +51,7 @@
@if (result.hasMultiple() && !domainSearch)
-

Also from ${result.getDomain().toString()}:

+

Also from ${result.getDomain().toString()}:

    @for(UrlDetails item : result.rest)