diff --git a/css/list.css b/css/list.css index 53e4db6..f899fa9 100644 --- a/css/list.css +++ b/css/list.css @@ -29,6 +29,8 @@ } .menuItem { + margin-left: var(--space-xs); + cursor: pointer; transition: 0.3s ease; diff --git a/index.html b/index.html index 463e9f0..f8fec08 100644 --- a/index.html +++ b/index.html @@ -22,6 +22,7 @@ Something from Your Mind + @@ -111,6 +112,7 @@
ALL THOUGHTS
+
@@ -127,6 +129,9 @@ } + + + diff --git a/main.js b/main.js index 0697dc6..9067809 100644 --- a/main.js +++ b/main.js @@ -108,3 +108,20 @@ function displayThoughts(items) { function deleteItem(timestamp) { db.thoughts.delete(timestamp).then(getAndDisplayThoughts); } + +document.addEventListener("DOMContentLoaded", () => { + const exportLink = document.getElementById("exportLink"); + + exportLink.onclick = async () => { + try { + const blob = await db.export({ prettyJson: true, progressCallback }); + download(blob, "my_smthmind_data.json", "application/json"); + } catch (error) { + console.error("" + error); + } + }; +}); + +function progressCallback({ totalRows, completedRows }) { + console.log(`Progress: ${completedRows} of ${totalRows} rows completed`); +}