From 7c64d5ba27ae9fcb8fc9c74cae6282ff218c46cf Mon Sep 17 00:00:00 2001 From: eti Date: Thu, 3 Sep 2026 17:31:52 +0200 Subject: [PATCH] web/pulls: add animation and limit conflict results to 10 Signed-off-by: eti --- .../[version]/[[range]]/PullViewPage.svelte | 106 +++++++++++------- 1 file changed, 64 insertions(+), 42 deletions(-) diff --git a/web/src/routes/[handle]/[repo]/pulls/[aturi]/[version]/[[range]]/PullViewPage.svelte b/web/src/routes/[handle]/[repo]/pulls/[aturi]/[version]/[[range]]/PullViewPage.svelte index c763fba3c..a2bcd5274 100644 --- a/web/src/routes/[handle]/[repo]/pulls/[aturi]/[version]/[[range]]/PullViewPage.svelte +++ b/web/src/routes/[handle]/[repo]/pulls/[aturi]/[version]/[[range]]/PullViewPage.svelte @@ -4,8 +4,8 @@ import { now as tidNow } from "@atcute/tid"; import BellPlus from "$icon/bell-plus"; import BellMinus from "$icon/bell-minus"; - import ChevronDown from "$icon/chevron-down"; - import ChevronRight from "$icon/chevron-right"; + import ChevronUp from "$icon/chevron-up"; + import ArrowDown from "$icon/arrow-down"; import IterationCcw from "$icon/iteration-ccw"; import PanelRightClose from "$icon/panel-right-close"; import MessagesSquare from "$icon/messages-square"; @@ -60,6 +60,7 @@ import TicketInfoBar from "$lib/components/repo/tickets/TicketInfoBar.svelte"; import type { PageData } from "./$types"; import Separator from "$lib/components/ui/Separator.svelte"; + import { CROSSFADE_DURATION, CROSSFADE_EASING } from "$lib/motion/spring"; type PullViewData = PageData & Exclude, { redirectTo: string }> & { @@ -184,23 +185,15 @@ }); }); - const conflictLabels: Record = { - "content conflict": "Edited", - "modify/delete conflict": "Edited & deleted", - "add/add conflict": "Added", - "rename conflict": "Renamed" - }; + const CONFLICT_PREVIEW_COUNT = 10; - const conflictGroups = $derived.by(() => { - const groups: { label: string; filenames: string[] }[] = []; - for (const conflict of check.data?.conflicts ?? []) { - const label = conflictLabels[conflict.reason] ?? conflict.reason; - const group = groups.find((candidate) => candidate.label === label); - if (group) group.filenames.push(conflict.filename); - else groups.push({ label, filenames: [conflict.filename] }); - } - return groups; - }); + let allConflictsShown = $state(false); + + const conflicts = $derived(check.data?.conflicts ?? []); + const shownConflicts = $derived( + allConflictsShown ? conflicts : conflicts.slice(0, CONFLICT_PREVIEW_COUNT) + ); + const hiddenConflictCount = $derived(conflicts.length - shownConflicts.length); const short = (hash: string) => hash.slice(0, 8); @@ -646,10 +639,7 @@ -
+
+
@@ -668,33 +659,31 @@ style={discussionWidth ? `width: ${discussionWidth}px` : ""} class="fixed right-0 bottom-0 w-[max(20vw,21rem)] space-y-2 border-l border-border-default bg-background-default p-2" > - {#if check.data?.conflicts?.length} + {#if conflicts.length}
- - {check.data?.conflicts.length}{conflicts.length} -
- {#each conflictGroups as group (group.label)} - {group.label} -
- {#each group.filenames as filename (filename)} - {@const anchor = conflictAnchor(filename)} +
+
+
+ {#each shownConflicts as conflict (conflict.filename)} + {@const anchor = conflictAnchor(conflict.filename)} - {filename} + {conflict.filename} {/each} + {#if hiddenConflictCount > 0} +
+ +
+ {/if}
- {/each} +
+
@@ -734,3 +735,24 @@ {/if} + + -- 2.51.2