Skip to content

Commit

Permalink
search: update current URL when filtering, add nes
Browse files Browse the repository at this point in the history
  • Loading branch information
avivace committed Dec 14, 2024
1 parent 736633d commit 1b6765b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions pages/game/[slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,9 @@ export default {
linear-gradient(90deg, black, #1c1c1c); /* Grey tones for background */
background-origin: border-box;
background-clip: content-box, border-box;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.5), /* Subtle shadow for depth */
inset 0 0 2px 0 rgba(255, 255, 255, 0.3); /* Inset effect */
box-shadow:
0 0 4px 0 rgba(0, 0, 0, 0.5),
/* Subtle shadow for depth */ inset 0 0 2px 0 rgba(255, 255, 255, 0.3); /* Inset effect */
color: white; /* White text for contrast */
text-shadow: 1px 1px 0 #000000; /* Retro pixelated text shadow */
}
Expand Down
15 changes: 9 additions & 6 deletions pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {
handlesearch: function () {
let config = useRuntimeConfig().public;
let baseurl = config.BASE_API_URL + "/api/search?";
let params = { results: 1000 };
let params = {};
let tags = [];
if (this.selectedTags) {
this.selectedTags.forEach((tagobj) => {
Expand All @@ -112,22 +112,24 @@ export default {
if (this.textQuery) {
params["q"] = this.textQuery;
}
let url = baseurl + new URLSearchParams(params);
console.log(url);
let url = baseurl + new URLSearchParams({ results: 1000, ...params });
fetch(url).then((response) => {
let gameblob = response.json().then((data) => {
this.entries = data["entries"];
});
});
this.$router.push({ query: params });
},
setSearchParameters: function () {
// Let's check if there are some query param we should honor
if (this.$route.query.title) {
this.textQuery = this.$route.query.title;
if (this.$route.query.q) {
this.textQuery = this.$route.query.q;
}
if (this.$route.query.platform) {
if (
["gb", "gbc", "gba"].includes(
["gb", "gbc", "gba", "nes"].includes(
this.$route.query.platform.toLowerCase(),
)
) {
Expand Down Expand Up @@ -166,6 +168,7 @@ export default {
{ name: "GB", code: "GB" },
{ name: "GBC", code: "GBC" },
{ name: "GBA", code: "GBA" },
{ name: "NES", code: "NES" },
],
selectedType: { name: "All", code: "all" },
types: [
Expand Down

0 comments on commit 1b6765b

Please sign in to comment.