diff --git a/lib/frontend/components/App.svelte b/lib/frontend/components/App.svelte new file mode 100644 index 0000000..208abda --- /dev/null +++ b/lib/frontend/components/App.svelte @@ -0,0 +1,5 @@ + + + diff --git a/lib/frontend/components/AppContainer.svelte b/lib/frontend/components/AppContainer.svelte new file mode 100644 index 0000000..4669fbc --- /dev/null +++ b/lib/frontend/components/AppContainer.svelte @@ -0,0 +1,14 @@ + + +{#if showTrackingPanel} + +{/if} + diff --git a/lib/frontend/components/TrackingPanel.svelte b/lib/frontend/components/TrackingPanel.svelte new file mode 100644 index 0000000..4f0e9fb --- /dev/null +++ b/lib/frontend/components/TrackingPanel.svelte @@ -0,0 +1,46 @@ + + + + +
+

+ Can we store anonymous logs? This data is only saved to our internal database and is used to debug the parsing of the web pages. We'll ask you only this time and won't bother you again. +

+ + + +
diff --git a/lib/frontend/index.js b/lib/frontend/index.js new file mode 100644 index 0000000..0be492e --- /dev/null +++ b/lib/frontend/index.js @@ -0,0 +1,17 @@ +import App from './components/App.svelte' + +import * as stores from './stores' + +const boot = () => { + new App({ + target: document.querySelector('#root'), + }) + + if (process.env.NODE_ENV === 'development') { + window._fb2ical = { + ...stores, + } + } +} + +export default boot diff --git a/lib/frontend/stores/configStore.js b/lib/frontend/stores/configStore.js new file mode 100644 index 0000000..adcaace --- /dev/null +++ b/lib/frontend/stores/configStore.js @@ -0,0 +1,30 @@ +import { writable } from 'svelte/store' + +const createConfigStore = () => { + const state = JSON.parse(localStorage.getItem('fb-to-ical-config') || '{}') + + const { subscribe, set, update } = writable(state) + + const setValue = (key, value) => { + update((prevState) => { + const nextState = { + ...prevState, + [key]: value, + } + + localStorage.setItem('fb-to-ical-config', JSON.stringify(nextState)) + + return nextState + }) + } + + return { + ...state, + subscribe, + set, + update, + setValue, + } +} + +export default createConfigStore() diff --git a/lib/frontend/stores/index.js b/lib/frontend/stores/index.js new file mode 100644 index 0000000..40e2cb9 --- /dev/null +++ b/lib/frontend/stores/index.js @@ -0,0 +1,5 @@ +import configStore from './configStore' + +export { + configStore, +} diff --git a/lib/static/index.html b/lib/static/index.html index 4f70a40..81be266 100644 --- a/lib/static/index.html +++ b/lib/static/index.html @@ -70,6 +70,8 @@ + +