import type { Component } from 'solid-js' import { untracked } from '@wovin/core/mobx' import { Logger } from 'besonders-logger' import { debounce } from 'lodash-es' import { createEffect, createSignal, on, Show } from 'solid-js' import { deleteAllApplogs } from '../../data/datalog/local-applog-idb' import { syncState } from '../../ipfs/sync-service' import { useAppSettings } from '../../ui/app-settings' import { DeleteWithConfirmDialog } from '../mini-components' import { pwaReloadFuncSignal, pwaUnregisterFuncSignal, pwaUpdateFuncSignal } from '../PwaReloadPrompt' import { AgentSettings } from './AgentSettings' const { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.INFO) // eslint-disable-line unused-imports/no-unused-vars export const AppSettings: Component<{}> = () => { DEBUG('Creating ') // const thread = useCurrentThread() // const agent = useAgent() const appSettings = useAppSettings() const [syncInterval, setSyncInterval] = createSignal(untracked(() => syncState.syncInterval?.toString() || '')) const debouncedUpdateSyncInterval = debounce(() => syncState.syncInterval = syncInterval() ? Number.parseInt(syncInterval()) : 0, 700) createEffect(on(() => syncInterval(), () => debouncedUpdateSyncInterval(), { defer: true })) const onSelectionChanged = (e) => { const blockID = e.target.value // TODO some sanity checks that the block exists and .? appSettings.update({ homeBlock: blockID }) DEBUG('set home block', e) } return (
App Settings
Start page
appSettings.update({ startPage: target.value })}> Empty note Timeline Home block
Home Block
{/* */} setSyncInterval(e.target.value)} onsl-clear={() => setSyncInterval('')} /> (syncState.minIdle = e.target.value)} />
Autocollapse Settings
Control how deeply nested blocks are displayed before being automatically collapsed. Higher numbers show more levels.
appSettings.update({ autocollapseDepth: Number.parseInt(e.target.value) || 2 })} min='0' max='12' /> appSettings.update({ autocollapseDepthFocussed: Number.parseInt(e.target.value) || 2 })} min='0' max='12' /> appSettings.update({ autocollapseDepthTimeline: Number.parseInt(e.target.value) || 1 })} min='0' max='12' /> appSettings.update({ autocollapseDepthTimelineSmartlist: Number.parseInt(e.target.value) || 0 })} min='0' max='12' />
Local App & Data
PWA (locally installed webapp)
pwaReloadFuncSignal()(false)} size='small'> Update PWA (no reload) pwaReloadFuncSignal()(true)} size='small'> Update PWA (with reload) pwaUpdateFuncSignal()()} size='small'> Update (on SW) pwaUnregisterFuncSignal()()} size='small'> Unregister PWA
Database
{ await deleteAllApplogs({ sure: 'I am' }) window.location.reload() }} size='small' />
) }