From 19771c01101a233a6ebf4b022853b3f2415625db Mon Sep 17 00:00:00 2001 From: Steven Harris Date: Tue, 10 Mar 2026 23:05:47 -0500 Subject: [PATCH 1/3] add previous and next --- .../pr-review/stores/pr-navigation.store.ts | 73 ++++++++++++++++++ src/shared/navigation/Breadcrumb.svelte | 76 +++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 src/features/pr-review/stores/pr-navigation.store.ts diff --git a/src/features/pr-review/stores/pr-navigation.store.ts b/src/features/pr-review/stores/pr-navigation.store.ts new file mode 100644 index 0000000..77610eb --- /dev/null +++ b/src/features/pr-review/stores/pr-navigation.store.ts @@ -0,0 +1,73 @@ +import { derived, type Readable } from 'svelte/store'; +import { allPullRequests, pullRequestConfigs, getRepoKey } from '$shared/stores/repository-service'; +import type { PullRequest } from '$integrations/github'; + +export interface PRNavigationEntry { + owner: string; + repo: string; + number: number; + title: string; +} + +/** + * Derives a flat, ordered list of all PRs from the dashboard, + * maintaining the same order as displayed (configs order → PRs order within each repo). + */ +export const prNavigationList: Readable = derived( + [pullRequestConfigs, allPullRequests], + ([$configs, $allPRs]) => { + const entries: PRNavigationEntry[] = []; + const configs = Array.isArray($configs) ? $configs : []; + + for (const config of configs) { + const repoKey = getRepoKey(config); + const prs: PullRequest[] = $allPRs[repoKey] || []; + for (const pr of prs) { + entries.push({ + owner: config.org, + repo: config.repo, + number: pr.number, + title: pr.title, + }); + } + } + + return entries; + } +); + +/** + * Given the current PR identifiers, returns the previous and next PR navigation entries. + * Wraps around at the boundaries. + */ +export function getAdjacentPRs( + list: PRNavigationEntry[], + owner: string, + repo: string, + prNumber: number +): { prev: PRNavigationEntry | null; next: PRNavigationEntry | null } { + if (list.length === 0) { + return { prev: null, next: null }; + } + + const currentIndex = list.findIndex( + (entry) => entry.owner === owner && entry.repo === repo && entry.number === prNumber + ); + + if (currentIndex === -1) { + return { prev: null, next: null }; + } + + // If there's only one PR, no navigation needed + if (list.length === 1) { + return { prev: null, next: null }; + } + + const prevIndex = (currentIndex - 1 + list.length) % list.length; + const nextIndex = (currentIndex + 1) % list.length; + + return { + prev: list[prevIndex], + next: list[nextIndex], + }; +} diff --git a/src/shared/navigation/Breadcrumb.svelte b/src/shared/navigation/Breadcrumb.svelte index 7cb3c3b..79f6ca0 100644 --- a/src/shared/navigation/Breadcrumb.svelte +++ b/src/shared/navigation/Breadcrumb.svelte @@ -1,5 +1,7 @@ {#if shouldShowBreadcrumbs} {/if} @@ -82,4 +128,34 @@ .breadcrumb-current { color: #d1d5db; } + + .pr-nav-btn { + display: inline-flex; + align-items: center; + gap: 0.25rem; + padding: 0.25rem 0.625rem; + border-radius: 0.375rem; + border: 1px solid #4b5563; + color: #d1d5db; + font-size: 0.8125rem; + font-weight: 500; + transition: all 0.2s ease; + background-color: rgba(55, 65, 81, 0.5); + } + + .pr-nav-btn:hover:not(:disabled) { + background-color: rgba(59, 130, 246, 0.15); + border-color: #60a5fa; + color: #60a5fa; + } + + .pr-nav-btn:disabled { + opacity: 0.3; + cursor: not-allowed; + } + + .pr-nav-btn:focus { + outline: none; + box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); + } From 9d4597d95528295da5785ddb0b90ba632a4c145e Mon Sep 17 00:00:00 2001 From: Steven Harris Date: Tue, 10 Mar 2026 23:07:30 -0500 Subject: [PATCH 2/3] fix show more --- src/features/pr-review/PRDescription.svelte | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/features/pr-review/PRDescription.svelte b/src/features/pr-review/PRDescription.svelte index 718c8d6..77831ba 100644 --- a/src/features/pr-review/PRDescription.svelte +++ b/src/features/pr-review/PRDescription.svelte @@ -55,16 +55,12 @@ const cleanText = $derived.by(() => stripMarkdown(displayText)); const renderedMarkdown = $derived.by(() => { - // Always render markdown when expanded, or when there's no toggle needed - if ((expanded && shouldShowToggle) || !shouldShowToggle) { - try { - return marked.parse(displayText); - } catch (error) { - console.error('Error rendering markdown:', error); - return displayText; - } + try { + return marked.parse(displayText); + } catch (error) { + console.error('Error rendering markdown:', error); + return displayText; } - return null; }); // Check if the content has markdown formatting @@ -84,13 +80,11 @@
- {#if hasMarkdown && (renderedMarkdown || (!shouldShowToggle && !expanded))} - + {#if hasMarkdown}
{@html renderedMarkdown}
{:else} -
{cleanText}
From d472014d7e07212bfc3dc254972d0e5d918ec633 Mon Sep 17 00:00:00 2001 From: Steven Harris Date: Tue, 10 Mar 2026 23:11:46 -0500 Subject: [PATCH 3/3] fix approval buttons --- .../pr-review/components/ReviewSubmissionSection.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/pr-review/components/ReviewSubmissionSection.svelte b/src/features/pr-review/components/ReviewSubmissionSection.svelte index af7f6c0..e65ba1e 100644 --- a/src/features/pr-review/components/ReviewSubmissionSection.svelte +++ b/src/features/pr-review/components/ReviewSubmissionSection.svelte @@ -52,11 +52,11 @@
-
+