diff --git a/src/background/index.js b/src/background/index.js index 15961cf..0a3c008 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -2,7 +2,7 @@ import browser from 'webextension-polyfill' import dayjs from 'dayjs' import { dashboard } from '../shared/utils' -import { insertLog, normalizeTimestamp, Limits, DB } from '../shared/db' +import { insertLog, normalizeTimestamp, DB } from '../shared/db' import { getUsageForHost, percentagesToBool } from '../shared/lib' browser.browserAction.onClicked.addListener(() => browser.tabs.create({ url: dashboard, active: true })) diff --git a/src/dashboard/App.svelte b/src/dashboard/App.svelte index 8e5d9ac..521e067 100644 --- a/src/dashboard/App.svelte +++ b/src/dashboard/App.svelte @@ -4,17 +4,36 @@ import Dev from './components/Dev.svelte' import Dashboard from './pages/Dashboard.svelte' import Limits from './pages/Limits.svelte' - import Footer from '../shared/footer.svelte' + import Footer from './components/Footer.svelte' + import Options from './components/Options.svelte' import { isDev } from '../shared/utils' const routes = { '/': Dashboard, - + '/options': Options, '/limits': Limits, } +{#if isDev} + +{/if} +
+
+ + + + + + +
+ + + +
+
+ - -{#if isDev} - -{/if} -
- - - - -
-
diff --git a/src/dashboard/components/Chart.svelte b/src/dashboard/components/Chart.svelte index 38fbb41..f98bed5 100644 --- a/src/dashboard/components/Chart.svelte +++ b/src/dashboard/components/Chart.svelte @@ -89,6 +89,8 @@ onMount(render) + + - - diff --git a/src/dashboard/components/Dev.svelte b/src/dashboard/components/Dev.svelte index 23de26c..a275422 100644 --- a/src/dashboard/components/Dev.svelte +++ b/src/dashboard/components/Dev.svelte @@ -1,5 +1,5 @@ +
+ + +
+ - -
- - -
diff --git a/src/options/FileUpload.svelte b/src/dashboard/components/FileUpload.svelte similarity index 100% rename from src/options/FileUpload.svelte rename to src/dashboard/components/FileUpload.svelte diff --git a/src/shared/footer.svelte b/src/dashboard/components/Footer.svelte similarity index 59% rename from src/shared/footer.svelte rename to src/dashboard/components/Footer.svelte index 2be2240..e8e155d 100644 --- a/src/shared/footer.svelte +++ b/src/dashboard/components/Footer.svelte @@ -1,6 +1,10 @@ - + - - diff --git a/src/dashboard/components/Options.svelte b/src/dashboard/components/Options.svelte new file mode 100644 index 0000000..91cb1bf --- /dev/null +++ b/src/dashboard/components/Options.svelte @@ -0,0 +1,93 @@ + + +

Settings

+
+
+ + +
+ + +
+
+
+

Your Data

+
+ + + + +
diff --git a/src/dashboard/index.html b/src/dashboard/index.html index 1c12c08..aaa4e9c 100644 --- a/src/dashboard/index.html +++ b/src/dashboard/index.html @@ -3,16 +3,26 @@ - + + Ora -
- +
+ diff --git a/src/dashboard/pages/Dashboard.svelte b/src/dashboard/pages/Dashboard.svelte index f3a6c0d..38678b9 100644 --- a/src/dashboard/pages/Dashboard.svelte +++ b/src/dashboard/pages/Dashboard.svelte @@ -53,21 +53,6 @@ onMount(calculate) - -

Dashboard

@@ -91,3 +76,18 @@ {/each} {/if} + + diff --git a/src/dashboard/pages/Limits.svelte b/src/dashboard/pages/Limits.svelte index cd8158a..778e20c 100644 --- a/src/dashboard/pages/Limits.svelte +++ b/src/dashboard/pages/Limits.svelte @@ -30,12 +30,6 @@ onMount(load) - -
@@ -70,3 +64,9 @@ {:else}
{/if} + + diff --git a/src/options/App.svelte b/src/options/App.svelte deleted file mode 100644 index 249ff1c..0000000 --- a/src/options/App.svelte +++ /dev/null @@ -1,109 +0,0 @@ - - - - -
- - -

Settings

-
-
- - -
- - -
-
-
-

Your Data

-
- - - - -
- -
-
diff --git a/src/options/index.html b/src/options/index.html deleted file mode 100644 index 5258548..0000000 --- a/src/options/index.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - -
-

Ora

-

Ora helps you track down time consuming websites

- - -
-
-
- -
-

Settings

-
- - - - -
-
-
-
- - - diff --git a/src/options/main.js b/src/options/main.js deleted file mode 100644 index 4894e6a..0000000 --- a/src/options/main.js +++ /dev/null @@ -1,42 +0,0 @@ -import browser from 'webextension-polyfill' - -const DEFAULT = { - frequency: 3, - retention: 90, -} - -async function load() { - try { - return await browser.storage.local.get() - } catch { - return DEFAULT - } -} - -async function save(settings) { - return browser.storage.local.set(settings) -} - -function init() { - const frequency = window.document.getElementById('frequency') - const retention = window.document.getElementById('retention') - const reset = window.document.getElementById('reset') - const form = window.document.getElementById('form') - - form.addEventListener('submit', (e) => { - e.preventDefault() - save({ frequency: frequency.value, retention: retention.value }) - }) - - reset.addEventListener('click', async () => { - await browser.storage.local.clear() - window.location.reload() - }) - - load().then((saved) => { - frequency.value = saved.frequency - retention.value = saved.retention - }) -} - -window.document.addEventListener('DOMContentLoaded', init) diff --git a/src/shared/index.html b/src/shared/index.html deleted file mode 100644 index 7154e39..0000000 --- a/src/shared/index.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - Ora - - -
- - - diff --git a/src/shared/main.js b/src/shared/main.js deleted file mode 100644 index ab54b46..0000000 --- a/src/shared/main.js +++ /dev/null @@ -1,3 +0,0 @@ -import App from './App.svelte' - -new App({ target: window.document.getElementById('root') })