Skip to content

Commit eb17bc6

Browse files
authored
Merge pull request #9409 from gitbutlerapp/move-hooks-toggle-to-details
Move pre-commit hooks setting to project details form
2 parents bfc8bd8 + 9654da9 commit eb17bc6

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

apps/desktop/src/components/DetailsForm.svelte

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
<script lang="ts">
2+
import { projectRunCommitHooks } from '$lib/config/config';
23
import { Project } from '$lib/project/project';
34
import { ProjectsService } from '$lib/project/projectsService';
45
import { getContext } from '@gitbutler/shared/context';
56
import SectionCard from '@gitbutler/ui/SectionCard.svelte';
67
import Spacer from '@gitbutler/ui/Spacer.svelte';
78
import Textarea from '@gitbutler/ui/Textarea.svelte';
89
import Textbox from '@gitbutler/ui/Textbox.svelte';
10+
import Toggle from '@gitbutler/ui/Toggle.svelte';
911
1012
const project = getContext(Project);
1113
const projectsService = getContext(ProjectsService);
1214
15+
const runCommitHooks = $derived(projectRunCommitHooks(project.id));
16+
1317
let title = $state(project?.title);
1418
let description = $state(project?.description);
1519
</script>
@@ -49,6 +53,20 @@
4953

5054
<Spacer />
5155

56+
<SectionCard labelFor="runHooks" orientation="row">
57+
{#snippet title()}
58+
Run commit hooks
59+
{/snippet}
60+
{#snippet caption()}
61+
Enabling this will run any git pre and post commit hooks you have configured in your repository.
62+
{/snippet}
63+
{#snippet actions()}
64+
<Toggle id="runHooks" bind:checked={$runCommitHooks} />
65+
{/snippet}
66+
</SectionCard>
67+
68+
<Spacer />
69+
5270
<style>
5371
.fields-wrapper {
5472
display: flex;

apps/desktop/src/components/PreferencesForm.svelte

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<script lang="ts">
22
import Section from '$components/Section.svelte';
3-
import { projectRunCommitHooks } from '$lib/config/config';
43
import { Project } from '$lib/project/project';
54
import { ProjectsService } from '$lib/project/projectsService';
65
import { getContext } from '@gitbutler/shared/context';
@@ -14,8 +13,6 @@
1413
let snaphotLinesThreshold = project?.snapshot_lines_threshold || 20; // when undefined, the default is 20
1514
let omitCertificateCheck = project?.omit_certificate_check;
1615
17-
const runCommitHooks = projectRunCommitHooks(project.id);
18-
1916
async function setOmitCertificateCheck(value: boolean | undefined) {
2017
project.omit_certificate_check = !!value;
2118
await projectsService.updateProject(project);
@@ -48,19 +45,6 @@
4845
{/snippet}
4946
</SectionCard>
5047

51-
<SectionCard labelFor="runHooks" orientation="row">
52-
{#snippet title()}
53-
Run commit hooks
54-
{/snippet}
55-
{#snippet caption()}
56-
Enabling this will run any git pre and post commit hooks you have configured in your
57-
repository.
58-
{/snippet}
59-
{#snippet actions()}
60-
<Toggle id="runHooks" bind:checked={$runCommitHooks} />
61-
{/snippet}
62-
</SectionCard>
63-
6448
<SectionCard orientation="row" centerAlign>
6549
{#snippet title()}
6650
Snapshot lines threshold

0 commit comments

Comments
 (0)