Skip to content

Commit 276eac4

Browse files
committed
fix checks
1 parent c50312c commit 276eac4

File tree

3 files changed

+37
-28
lines changed

3 files changed

+37
-28
lines changed

web/src/lib/components/diff/ConciseDiffView.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@
442442
{#if canAddComments && lineNum !== undefined && line.type !== PatchLineType.HEADER}
443443
<button
444444
class="comment-button"
445+
aria-label="Add comment"
445446
class:visible={hoveredLineKey === lineKey || isSelected}
446447
class:selected={isSelected}
447448
onmousedown={(e) => handleMouseDown(e, line, side)}
@@ -465,6 +466,9 @@
465466
class:line-selected={leftSelected}
466467
onmouseenter={() => (hoveredLineKey = leftLineKey)}
467468
onmouseleave={() => (hoveredLineKey = null)}
469+
aria-label="Add comment"
470+
role="button"
471+
tabindex="0"
468472
>
469473
<div class="line-number select-none {lineType.lineNoClasses}">{getDisplayLineNo(line, line.oldLineNo)}</div>
470474
{@render commentButton(line, "LEFT")}
@@ -474,6 +478,9 @@
474478
class:line-selected={rightSelected}
475479
onmouseenter={() => (hoveredLineKey = rightLineKey)}
476480
onmouseleave={() => (hoveredLineKey = null)}
481+
aria-label="Add comment"
482+
role="button"
483+
tabindex="0"
477484
>
478485
<div class="line-number select-none {lineType.lineNoClasses}">{getDisplayLineNo(line, line.newLineNo)}</div>
479486
{@render commentButton(line, "RIGHT")}

web/src/lib/components/settings-popover/SettingsPopover.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<script module>
2+
export { globalThemeSetting, sectionHeader };
3+
</script>
4+
15
<script lang="ts">
26
import SettingsPopoverGroup from "./SettingsPopoverGroup.svelte";
37
import type { RestProps } from "$lib/types";
@@ -33,7 +37,7 @@
3337
</Popover.Trigger>
3438
<Popover.Portal>
3539
<Popover.Content aria-label="Options" class="z-50 mx-2 flex flex-col gap-1 rounded-sm border bg-neutral py-1 text-sm shadow">
36-
{@render children?.({ globalThemeSetting, sectionHeader })}
40+
{@render children?.()}
3741
<Popover.Arrow class="text-edge" />
3842
</Popover.Content>
3943
</Popover.Portal>

web/src/routes/+page.svelte

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
import ImageDiff from "$lib/components/diff/ImageDiff.svelte";
1717
import AddedOrRemovedImage from "$lib/components/diff/AddedOrRemovedImage.svelte";
1818
import DiffStats from "$lib/components/diff/DiffStats.svelte";
19-
import SettingsPopover from "$lib/components/settings-popover/SettingsPopover.svelte";
19+
import SettingsPopover, { globalThemeSetting } from "$lib/components/settings-popover/SettingsPopover.svelte";
2020
import SettingsPopoverGroup from "$lib/components/settings-popover/SettingsPopoverGroup.svelte";
2121
import LabeledCheckbox from "$lib/components/LabeledCheckbox.svelte";
2222
import ShikiThemeSelector from "$lib/components/settings-popover/ShikiThemeSelector.svelte";
2323
import SimpleRadioGroup from "$lib/components/settings-popover/SimpleRadioGroup.svelte";
2424
import DiffSearch from "./DiffSearch.svelte";
2525
import FileHeader from "./FileHeader.svelte";
2626
import DiffTitle from "./DiffTitle.svelte";
27-
import { type Action } from "svelte";
27+
import { type Action } from "svelte/action";
2828
import { on } from "svelte/events";
2929
import ActionsPopover from "./ActionsPopover.svelte";
3030
import OpenDiffDialog from "./OpenDiffDialog.svelte";
@@ -114,31 +114,29 @@
114114

115115
{#snippet settingsPopover()}
116116
<SettingsPopover class="self-center">
117-
{#snippet children({ globalThemeSetting })}
118-
{@render globalThemeSetting()}
119-
<SettingsPopoverGroup title="Syntax Highlighting">
120-
<LabeledCheckbox labelText="Enable" bind:checked={globalOptions.syntaxHighlighting} />
121-
<ShikiThemeSelector mode="light" bind:value={globalOptions.syntaxHighlightingThemeLight} />
122-
<ShikiThemeSelector mode="dark" bind:value={globalOptions.syntaxHighlightingThemeDark} />
123-
</SettingsPopoverGroup>
124-
<SettingsPopoverGroup title="Misc.">
125-
<LabeledCheckbox labelText="Concise nested diffs" bind:checked={globalOptions.omitPatchHeaderOnlyHunks} />
126-
<LabeledCheckbox labelText="Word diffs" bind:checked={globalOptions.wordDiffs} />
127-
<LabeledCheckbox labelText="Line wrapping" bind:checked={globalOptions.lineWrap} />
128-
{#if viewer.isPRDiff()}
129-
<LabeledCheckbox labelText="Show PR comments" bind:checked={viewer.showComments} />
130-
{/if}
131-
<div class="flex justify-between px-2 py-1">
132-
<Label.Root id="sidebarLocationLabel" for="sidebarLocation">Sidebar location</Label.Root>
133-
<SimpleRadioGroup
134-
id="sidebarLocation"
135-
aria-labelledby="sidebarLocationLabel"
136-
values={["left", "right"]}
137-
bind:value={globalOptions.sidebarLocation}
138-
/>
139-
</div>
140-
</SettingsPopoverGroup>
141-
{/snippet}
117+
{@render globalThemeSetting()}
118+
<SettingsPopoverGroup title="Syntax Highlighting">
119+
<LabeledCheckbox labelText="Enable" bind:checked={globalOptions.syntaxHighlighting} />
120+
<ShikiThemeSelector mode="light" bind:value={globalOptions.syntaxHighlightingThemeLight} />
121+
<ShikiThemeSelector mode="dark" bind:value={globalOptions.syntaxHighlightingThemeDark} />
122+
</SettingsPopoverGroup>
123+
<SettingsPopoverGroup title="Misc.">
124+
<LabeledCheckbox labelText="Concise nested diffs" bind:checked={globalOptions.omitPatchHeaderOnlyHunks} />
125+
<LabeledCheckbox labelText="Word diffs" bind:checked={globalOptions.wordDiffs} />
126+
<LabeledCheckbox labelText="Line wrapping" bind:checked={globalOptions.lineWrap} />
127+
{#if viewer.isPRDiff()}
128+
<LabeledCheckbox labelText="Show PR comments" bind:checked={viewer.showComments} />
129+
{/if}
130+
<div class="flex justify-between px-2 py-1">
131+
<Label.Root id="sidebarLocationLabel" for="sidebarLocation">Sidebar location</Label.Root>
132+
<SimpleRadioGroup
133+
id="sidebarLocation"
134+
aria-labelledby="sidebarLocationLabel"
135+
values={["left", "right"]}
136+
bind:value={globalOptions.sidebarLocation}
137+
/>
138+
</div>
139+
</SettingsPopoverGroup>
142140
</SettingsPopover>
143141
{/snippet}
144142

0 commit comments

Comments
 (0)