diff --git a/frontend/src/app.svelte b/frontend/src/app.svelte index e607b8f..14d65de 100644 --- a/frontend/src/app.svelte +++ b/frontend/src/app.svelte @@ -1,10 +1,13 @@ diff --git a/frontend/src/stores.js b/frontend/src/stores.js deleted file mode 100644 index 931c92a..0000000 --- a/frontend/src/stores.js +++ /dev/null @@ -1,117 +0,0 @@ -import { derived, writable } from 'svelte/store'; -import { Environment, Settings, UpdateSettings, UpdateViewStore, Views } from '../wailsjs/go/app/App'; - -export const busy = (() => { - const { update, subscribe } = writable(0); - - subscribe(isBusy => { - if (isBusy) { - document.body.classList.add('busy'); - } - else { - document.body.classList.remove('busy'); - } - }); - - return { - start: () => update(v => ++v), - end: () => update(v => --v), - subscribe, - }; -})(); - -export const contextMenu = (() => { - const { set, subscribe } = writable(); - - return { - show: (evt, menu) => set(Object.keys(menu || {}).length ? { - position: [ evt.clientX, evt.clientY ], - items: menu, - } : undefined), - hide: () => set(undefined), - subscribe, - }; -})(); - -export const connections = writable({}); - -export const applicationSettings = (() => { - const { set, subscribe } = writable({}); - const reload = async() => { - const newSettings = await Settings(); - set(newSettings); - return newSettings; - }; - - let skipUpdate = true; - - reload(); - subscribe(newSettings => { - if (skipUpdate) { - skipUpdate = false; - return; - } - UpdateSettings(JSON.stringify(newSettings || {})); - }); - - return { reload, set, subscribe }; -})(); - -export const environment = (() => { - const { set, subscribe } = writable({}); - const reload = async() => { - const newEnv = await Environment(); - set(newEnv); - return newEnv; - }; - - reload(); - return { reload, subscribe }; -})(); - -export const views = (() => { - const { set, subscribe } = writable({}); - - const reload = async() => { - const newViewStore = await Views(); - set(newViewStore); - return newViewStore; - }; - - const forCollection = (hostKey, dbKey, collKey) => { - let allViews; - subscribe(v => allViews = v)(); - - const entries = Object.entries(allViews).filter(v => ( - v[0] === 'list' || ( - v[1].host === hostKey && - v[1].database === dbKey && - v[1].collection === collKey - ) - )); - - return Object.fromEntries(entries); - }; - - let skipUpdate = true; - - reload(); - subscribe(newViewStore => { - if (skipUpdate) { - skipUpdate = false; - return; - } - UpdateViewStore(JSON.stringify(newViewStore)); - }); - - return { reload, set, subscribe, forCollection }; -})(); - -export const applicationInited = derived([ environment, applicationSettings ], ([ env, settings ], set) => { - if (env && settings) { - set(true); - - // Remove loading spinner. - // document.getElementById('app-loading')?.remove(); - } -}, false); diff --git a/frontend/src/loading.css b/frontend/src/styles/loading.css similarity index 100% rename from frontend/src/loading.css rename to frontend/src/styles/loading.css diff --git a/frontend/src/reset.css b/frontend/src/styles/reset.css similarity index 100% rename from frontend/src/reset.css rename to frontend/src/styles/reset.css diff --git a/frontend/src/style.css b/frontend/src/styles/style.css similarity index 98% rename from frontend/src/style.css rename to frontend/src/styles/style.css index 4a6dbb7..f631ab8 100644 --- a/frontend/src/style.css +++ b/frontend/src/styles/style.css @@ -15,7 +15,7 @@ body { cursor: default; font-size: 13px; line-height: 13px; - background-color: rgba(0, 0, 0, 0); + background-color: rgba(255, 255, 255, 0.35); } * {