From 7c1ab1afb718194350f346433473afe8f0e73f91 Mon Sep 17 00:00:00 2001 From: Nilesh <19304+nileshtrivedi@users.noreply.github.com> Date: Fri, 3 Jun 2022 14:35:57 +0100 Subject: [PATCH] Combobox fix, map fix, tag search --- src/FormatDetail.svelte | 11 +++++------ src/SearchForm.svelte | 33 ++++++++------------------------- src/TopicDetail.svelte | 8 +++----- src/TopicList.svelte | 2 +- src/TopicMasonryGrid.svelte | 2 +- src/tailwindui/ComboBox.svelte | 19 ++++++++++++++----- static/map.html | 22 ++++++++++++---------- templates/index.html | 1 + 8 files changed, 45 insertions(+), 53 deletions(-) diff --git a/src/FormatDetail.svelte b/src/FormatDetail.svelte index 49b816a..40194aa 100644 --- a/src/FormatDetail.svelte +++ b/src/FormatDetail.svelte @@ -10,28 +10,27 @@ let query = { text: "", topic: "", - format: "", level: "", - tags: "", + tag: "", sortby: "rating" }; - $: fetch(`/learn/items.json?_shape=array&links__contains=${format}|`) + $: query && fetch(`/learn/items.json?_shape=array&_size=100&links__contains=${format}|&topics__contains=${query.topic}`) .then(r => r.json()) .then(data => { items = data; }); function handleQueryChanged(event){ - console.log("queryChanged: ", event.detail); + // console.log("queryChanged: ", event.detail); query = event.detail; } $: filteredItems = items.filter(item => { if(query.text && !item.name.toLowerCase().includes(query.text.toLowerCase())){ return false; } - if(query.format && !item.links.includes(query.format)) { return false; } + if(query.topic && !item.topics.includes(query.topic)){ return false; } if(query.level && item.difficulty != query.level){ return false; } - // TODO Apply tags filter + if(query.tag && !item.tags.includes(query.tag)){ return false; } return true; }).sort((a,b) => { if(query.sortby == 'rating') { return (a.rating - b.rating) }; diff --git a/src/SearchForm.svelte b/src/SearchForm.svelte index f18d591..59fd4c5 100644 --- a/src/SearchForm.svelte +++ b/src/SearchForm.svelte @@ -3,16 +3,12 @@ import { createEventDispatcher } from 'svelte'; export let alltopics; - export let hideFormat = false; export let hideTopic = false; - export let hideQuality = true; let query = { text: "", topic: "", - format: "", level: "", - quality: "", sortby: "rating", tag: "" }; @@ -24,24 +20,19 @@