diff --git a/src/components/tagItem.svelte b/src/components/tagItem.svelte
index a22c1d0..ec99587 100644
--- a/src/components/tagItem.svelte
+++ b/src/components/tagItem.svelte
@@ -4,5 +4,5 @@
- {tag}
+ {tag}
diff --git a/src/datastore.js b/src/datastore.js
index 4100127..a008e22 100644
--- a/src/datastore.js
+++ b/src/datastore.js
@@ -13,8 +13,9 @@ export const fetchData = async () => {
const res = await fetch(data_source);
const data_json = await res.json();
- console.log('data_json ', data_json);
- tagslist.set(data.tags);
+ data.set(data_json);
+ tagslist.set(data_json.tags);
+ tagslist.subscribe(array => console.log('tagslist: ', array));
loaded = true;
} catch (err) {
console.log(err);
diff --git a/src/routes/index.svelte b/src/routes/index.svelte
index 3081299..fb623f1 100644
--- a/src/routes/index.svelte
+++ b/src/routes/index.svelte
@@ -5,17 +5,33 @@
let searchTerm = "";
let filteredTags = [];
+ let num_tags = 0;
+ let tag = "";
+
+ function saveTag() {
+ console.log('running saveTag with tag: '+ tag);
+ if (filteredTags.includes(tag)) {
+ console.log('We already have tag ', tag);
+ return;
+ }
+ $tagslist = [...$tagslist, tag].sort();
+ console.log('tags: ', $tagslist);
+ }
$: {
if (searchTerm) {
//console.log('$tagslist: ', $tagslist);
- filteredTags = $tagslist.filter(tag => tag.toLowerCast().includes(searchTerm.toLowerCase()));
+ filteredTags = $tagslist.filter(tag => tag.toLowerCase().includes(searchTerm.toLowerCase()));
} else {
- console.log('$tagslist: ', $tagslist);
- filteredTags = [... $tagslist];
+ //console.log('$tagslist: ', $tagslist);
+ filteredTags = [...$tagslist];
}
}
+ $: {
+ num_tags = $tagslist.length;
+ }
fetchData();
+ //tagslist.subscribe(tags => sortTags(tags));
//console.log('$tagslist: ', $tagslist);
@@ -25,9 +41,22 @@
Number of tags: {num_tags}
-