mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-07 02:11:11 +03:00
fix: Toggle on:click handler and section double event handling
This commit is contained in:
parent
aab2047d45
commit
407c60ded2
@ -12,17 +12,17 @@
|
|||||||
const metricsEnabled = appMetricsEnabled();
|
const metricsEnabled = appMetricsEnabled();
|
||||||
const nonAnonMetricsEnabled = appNonAnonMetricsEnabled();
|
const nonAnonMetricsEnabled = appNonAnonMetricsEnabled();
|
||||||
|
|
||||||
function toggleErrorReporting(e: MouseEvent | CustomEvent<boolean>) {
|
function toggleErrorReporting(e: MouseEvent) {
|
||||||
$errorReportingEnabled = !$errorReportingEnabled;
|
$errorReportingEnabled = !$errorReportingEnabled;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMetrics(e: MouseEvent | CustomEvent<boolean>) {
|
function toggleMetrics(e: MouseEvent) {
|
||||||
$metricsEnabled = !$metricsEnabled;
|
$metricsEnabled = !$metricsEnabled;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNonAnonMetrics(e: MouseEvent | CustomEvent<boolean>) {
|
function toggleNonAnonMetrics(e: MouseEvent) {
|
||||||
$nonAnonMetricsEnabled = !$nonAnonMetricsEnabled;
|
$nonAnonMetricsEnabled = !$nonAnonMetricsEnabled;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="analytics-settings__actions">
|
<div class="analytics-settings__actions">
|
||||||
<SectionCard labelFor="errorReportngToggle" on:click={toggleErrorReporting} orientation="row">
|
<SectionCard labelFor="errorReportngToggle" orientation="row">
|
||||||
<svelte:fragment slot="title">Error reporting</svelte:fragment>
|
<svelte:fragment slot="title">Error reporting</svelte:fragment>
|
||||||
<svelte:fragment slot="caption">
|
<svelte:fragment slot="caption">
|
||||||
Toggle reporting of application crashes and errors.
|
Toggle reporting of application crashes and errors.
|
||||||
@ -62,24 +62,20 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="errorReportngToggle"
|
id="errorReportngToggle"
|
||||||
checked={$errorReportingEnabled}
|
checked={$errorReportingEnabled}
|
||||||
on:change={toggleErrorReporting}
|
on:click={toggleErrorReporting}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
|
||||||
<SectionCard labelFor="metricsEnabledToggle" on:click={toggleMetrics} orientation="row">
|
<SectionCard labelFor="metricsEnabledToggle" orientation="row">
|
||||||
<svelte:fragment slot="title">Usage metrics</svelte:fragment>
|
<svelte:fragment slot="title">Usage metrics</svelte:fragment>
|
||||||
<svelte:fragment slot="caption">Toggle sharing of usage statistics.</svelte:fragment>
|
<svelte:fragment slot="caption">Toggle sharing of usage statistics.</svelte:fragment>
|
||||||
<svelte:fragment slot="actions">
|
<svelte:fragment slot="actions">
|
||||||
<Toggle id="metricsEnabledToggle" checked={$metricsEnabled} on:change={toggleMetrics} />
|
<Toggle id="metricsEnabledToggle" checked={$metricsEnabled} on:click={toggleMetrics} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
|
||||||
<SectionCard
|
<SectionCard labelFor="nonAnonMetricsEnabledToggle" orientation="row">
|
||||||
labelFor="nonAnonMetricsEnabledToggle"
|
|
||||||
on:click={toggleNonAnonMetrics}
|
|
||||||
orientation="row"
|
|
||||||
>
|
|
||||||
<svelte:fragment slot="title">Non-anonymous usage metrics</svelte:fragment>
|
<svelte:fragment slot="title">Non-anonymous usage metrics</svelte:fragment>
|
||||||
<svelte:fragment slot="caption"
|
<svelte:fragment slot="caption"
|
||||||
>Toggle sharing of identifiable usage statistics.</svelte:fragment
|
>Toggle sharing of identifiable usage statistics.</svelte:fragment
|
||||||
@ -88,7 +84,7 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="nonAnonMetricsEnabledToggle"
|
id="nonAnonMetricsEnabledToggle"
|
||||||
checked={$nonAnonMetricsEnabled}
|
checked={$nonAnonMetricsEnabled}
|
||||||
on:change={toggleNonAnonMetrics}
|
on:click={toggleNonAnonMetrics}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
@ -79,30 +79,25 @@
|
|||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<SectionCard labelFor="aiGenEnabled" on:click={aiGenToggle} orientation="row">
|
<SectionCard labelFor="aiGenEnabled" orientation="row">
|
||||||
<svelte:fragment slot="title">Enable branch and commit message generation</svelte:fragment>
|
<svelte:fragment slot="title">Enable branch and commit message generation</svelte:fragment>
|
||||||
<svelte:fragment slot="caption">
|
<svelte:fragment slot="caption">
|
||||||
If enabled, diffs will sent to OpenAI or Anthropic's servers when pressing the "Generate
|
If enabled, diffs will sent to OpenAI or Anthropic's servers when pressing the "Generate
|
||||||
message" and "Generate branch name" button.
|
message" and "Generate branch name" button.
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="actions">
|
<svelte:fragment slot="actions">
|
||||||
<Toggle id="aiGenEnabled" checked={$aiGenEnabled} on:change={aiGenToggle} />
|
<Toggle id="aiGenEnabled" checked={$aiGenEnabled} on:click={aiGenToggle} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
|
||||||
<SectionCard
|
<SectionCard labelFor="branchNameGen" disabled={!$aiGenEnabled} orientation="row">
|
||||||
labelFor="branchNameGen"
|
|
||||||
disabled={!$aiGenEnabled}
|
|
||||||
on:click={aiGenBranchNamesToggle}
|
|
||||||
orientation="row"
|
|
||||||
>
|
|
||||||
<svelte:fragment slot="title">Automatically generate branch names</svelte:fragment>
|
<svelte:fragment slot="title">Automatically generate branch names</svelte:fragment>
|
||||||
<svelte:fragment slot="actions">
|
<svelte:fragment slot="actions">
|
||||||
<Toggle
|
<Toggle
|
||||||
id="branchNameGen"
|
id="branchNameGen"
|
||||||
disabled={!$aiGenEnabled}
|
disabled={!$aiGenEnabled}
|
||||||
checked={$aiGenAutoBranchNamingEnabled}
|
checked={$aiGenAutoBranchNamingEnabled}
|
||||||
on:change={aiGenBranchNamesToggle}
|
on:click={aiGenBranchNamesToggle}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
@ -133,11 +128,7 @@
|
|||||||
<Section spacer>
|
<Section spacer>
|
||||||
<svelte:fragment slot="title">Full data synchronization</svelte:fragment>
|
<svelte:fragment slot="title">Full data synchronization</svelte:fragment>
|
||||||
|
|
||||||
<SectionCard
|
<SectionCard labelFor="historySync" orientation="row">
|
||||||
labelFor="historySync"
|
|
||||||
on:change={async (e) => await onSyncChange(e.detail)}
|
|
||||||
orientation="row"
|
|
||||||
>
|
|
||||||
<svelte:fragment slot="caption">
|
<svelte:fragment slot="caption">
|
||||||
Sync my history, repository and branch data for backup, sharing and team features.
|
Sync my history, repository and branch data for backup, sharing and team features.
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
@ -145,7 +136,7 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="historySync"
|
id="historySync"
|
||||||
checked={project.api?.sync || false}
|
checked={project.api?.sync || false}
|
||||||
on:change={async (e) => await onSyncChange(e.detail)}
|
on:click={async (e) => await onSyncChange(e.detail)}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="allowForcePush"
|
id="allowForcePush"
|
||||||
bind:checked={allowForcePushing}
|
bind:checked={allowForcePushing}
|
||||||
on:change={async () => await setWithForcePush(allowForcePushing)}
|
on:click={async () => await setWithForcePush(allowForcePushing)}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="omitCertificateCheck"
|
id="omitCertificateCheck"
|
||||||
bind:checked={omitCertificateCheck}
|
bind:checked={omitCertificateCheck}
|
||||||
on:change={async () => await setOmitCertificateCheck(omitCertificateCheck)}
|
on:click={async () => await setOmitCertificateCheck(omitCertificateCheck)}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tooltip } from '$lib/utils/tooltip';
|
import { tooltip } from '$lib/utils/tooltip';
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
export let small = false;
|
export let small = false;
|
||||||
export let disabled = false;
|
export let disabled = false;
|
||||||
@ -8,18 +7,11 @@
|
|||||||
export let value = '';
|
export let value = '';
|
||||||
export let help = '';
|
export let help = '';
|
||||||
export let id = '';
|
export let id = '';
|
||||||
|
|
||||||
let input: HTMLInputElement;
|
|
||||||
const dispatch = createEventDispatcher<{ change: boolean }>();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
bind:this={input}
|
|
||||||
bind:checked
|
bind:checked
|
||||||
on:click|stopPropagation
|
on:click|stopPropagation
|
||||||
on:change={() => {
|
|
||||||
dispatch('change', checked);
|
|
||||||
}}
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="toggle"
|
class="toggle"
|
||||||
class:small
|
class:small
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="baseBranchSwitching"
|
id="baseBranchSwitching"
|
||||||
checked={$baseBranchSwitching}
|
checked={$baseBranchSwitching}
|
||||||
on:change={() => ($baseBranchSwitching = !$baseBranchSwitching)}
|
on:click={() => ($baseBranchSwitching = !$baseBranchSwitching)}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<svelte:fragment slot="actions">
|
<svelte:fragment slot="actions">
|
||||||
<Toggle id="committerSigning" checked={annotateCommits} on:change={toggleCommitterSigning} />
|
<Toggle id="committerSigning" checked={annotateCommits} on:click={toggleCommitterSigning} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
{#if $user}
|
{#if $user}
|
||||||
<SectionCard>
|
<SectionCard>
|
||||||
<form on:submit={onSubmit} class="profile-form">
|
<form on:submit={onSubmit} class="profile-form">
|
||||||
<label id="profile-picture" class="focus-state profile-pic-wrapper" for="picture">
|
<label id="profile-picture" class="profile-pic-wrapper focus-state" for="picture">
|
||||||
<input
|
<input
|
||||||
on:change={onPictureChange}
|
on:change={onPictureChange}
|
||||||
type="file"
|
type="file"
|
||||||
@ -174,7 +174,7 @@
|
|||||||
<Toggle
|
<Toggle
|
||||||
id="hoverScrollbarVisability"
|
id="hoverScrollbarVisability"
|
||||||
checked={$userSettings.scrollbarVisabilityOnHover}
|
checked={$userSettings.scrollbarVisabilityOnHover}
|
||||||
on:change={() =>
|
on:click={() =>
|
||||||
userSettings.update((s) => ({
|
userSettings.update((s) => ({
|
||||||
...s,
|
...s,
|
||||||
scrollbarVisabilityOnHover: !s.scrollbarVisabilityOnHover
|
scrollbarVisabilityOnHover: !s.scrollbarVisabilityOnHover
|
||||||
|
Loading…
Reference in New Issue
Block a user