fix: set auto-connect to false by default

fixes #25
This commit is contained in:
2023-11-26 22:17:52 +01:00
parent e38d952e1d
commit f73b8c1453
2 changed files with 9 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
import type {Action} from "svelte/action" import type { Action } from "svelte/action"
import {persistentWritable} from "$lib/storage" import { persistentWritable } from "$lib/storage"
export interface UserPreferences { export interface UserPreferences {
backup: boolean backup: boolean
@@ -13,7 +13,7 @@ export const theme = persistentWritable("user-theme", {
export const userPreferences = persistentWritable<UserPreferences>("user-preferences", { export const userPreferences = persistentWritable<UserPreferences>("user-preferences", {
backup: false, backup: false,
autoConnect: true, autoConnect: false,
}) })
export const preference: Action<HTMLInputElement, keyof UserPreferences> = (node, key) => { export const preference: Action<HTMLInputElement, keyof UserPreferences> = (node, key) => {

View File

@@ -1,12 +1,12 @@
import type {Action} from "svelte/action" import type { Action } from "svelte/action"
import tippy from "tippy.js" import tippy from "tippy.js"
import type {SvelteComponent} from "svelte" import type { SvelteComponent } from "svelte"
import Tooltip from "$lib/components/Tooltip.svelte" import Tooltip from "$lib/components/Tooltip.svelte"
import hotkeys from "hotkeys-js" import hotkeys from "hotkeys-js"
export const action: Action<HTMLElement, {title?: string; shortcut?: string}> = ( export const action: Action<HTMLElement, { title?: string; shortcut?: string }> = (
node: HTMLElement, node: HTMLElement,
{title, shortcut}, { title, shortcut },
) => { ) => {
let component: SvelteComponent | undefined let component: SvelteComponent | undefined
const tooltip = tippy(node, { const tooltip = tippy(node, {
@@ -16,7 +16,7 @@ export const action: Action<HTMLElement, {title?: string; shortcut?: string}> =
onShow(instance) { onShow(instance) {
component ??= new Tooltip({ component ??= new Tooltip({
target: instance.popper.querySelector(".tippy-content") as HTMLElement, target: instance.popper.querySelector(".tippy-content") as HTMLElement,
props: {title, shortcut}, props: { title, shortcut },
}) })
}, },
onHidden() { onHidden() {
@@ -26,7 +26,7 @@ export const action: Action<HTMLElement, {title?: string; shortcut?: string}> =
}) })
if (shortcut) { if (shortcut) {
hotkeys(shortcut, function (keyboardEvent) { hotkeys(shortcut, function(keyboardEvent) {
keyboardEvent.preventDefault() keyboardEvent.preventDefault()
node.click() node.click()
}) })