diff --git a/src/main/java/nl/herpiederpiee/appie_scraper/WebServer.java b/src/main/java/nl/herpiederpiee/appie_scraper/WebServer.java index ff010b3..7aed3e1 100644 --- a/src/main/java/nl/herpiederpiee/appie_scraper/WebServer.java +++ b/src/main/java/nl/herpiederpiee/appie_scraper/WebServer.java @@ -4,6 +4,7 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; @@ -11,10 +12,15 @@ import java.util.ArrayList; public class WebServer { @GetMapping("/") - public String index(@RequestParam(value = "fuzzySearch", required = false) String fuzzySearch, Model model) { - // Call your BonusManager or service to get items - ArrayList items = BonusManager.getBonusItems(fuzzySearch); - model.addAttribute("items", items); + public String index() { return "index"; } + + @GetMapping("/api/fuzzy") + @ResponseBody + public ArrayList index(@RequestParam(value = "q", required = true) String fuzzySearch, Model model){ + // Call your BonusManager or service to get items + ArrayList items = BonusManager.getBonusItems(fuzzySearch); + return items; + } } diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 6d9c227..218d617 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -9,13 +9,25 @@ padding: 20px; background-color: #f5f5f5; } - form { + .search-container { margin-bottom: 20px; } input[type="text"] { padding: 8px; width: 300px; font-size: 14px; + border: 2px solid #ddd; + border-radius: 4px; + transition: border-color 0.3s; + } + input[type="text"]:focus { + outline: none; + border-color: #4CAF50; + } + .search-info { + margin-top: 10px; + font-size: 12px; + color: #666; } table { width: 100%; @@ -50,14 +62,44 @@ a:hover { text-decoration: underline; } + .no-results { + text-align: center; + padding: 40px; + color: #999; + font-size: 16px; + } + .score-badge { + display: inline-block; + background-color: #4CAF50; + color: white; + padding: 2px 8px; + border-radius: 4px; + font-size: 12px; + font-weight: bold; + margin-left: 8px; + } + .score-badge.medium { + background-color: #ff9800; + } + .score-badge.low { + background-color: #f44336; + }

Appie Bonus Items

-
- -
+
+ +
+ Showing all items +
+
@@ -70,7 +112,7 @@ - + @@ -85,5 +127,93 @@
More Info
Item Name Description
+ + - \ No newline at end of file +