Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions resources/js/components/commit-search-results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
import { CommitCard } from '@/components/commit-card';
import { CommitSkeleton, EmptyFeed } from '@/components/commit-feed';
import { GraphCanvas } from '@/components/graph-canvas';
import { authorLaneColor } from '@/lib/utils';
import type { Commit } from '@/types';

export type SearchResultSet = { term: string; commits: Commit[] };
Expand All @@ -11,11 +12,13 @@ export function SearchResults({
isWaiting = false,
heading = 'Most relevant commits',
empty = 'Try describing the idea in other words, or pick one of the searches below.',
isStandalone = false,
}: {
results: SearchResultSet | null;
isWaiting?: boolean;
heading?: string;
empty?: ReactNode;
isStandalone?: boolean;
}) {
if (results === null) {
return (
Expand Down Expand Up @@ -55,13 +58,33 @@ export function SearchResults({
</div>
) : (
<GraphCanvas>
{results.commits.map((commit) => (
<CommitCard
key={commit.id}
commit={commit}
endsWithDot
/>
))}
{results.commits.map((commit, index) => {
if (isStandalone) {
return (
<CommitCard
key={commit.id}
commit={commit}
endsWithDot
/>
);
}

const previous = results.commits[index - 1];

return (
<CommitCard
key={commit.id}
commit={commit}
previousLane={
previous && authorLaneColor(previous.author)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
graphAfter={previous?.id}
endsWithDot={
index === results.commits.length - 1
}
/>
);
})}
</GraphCanvas>
)}
</section>
Expand Down
1 change: 1 addition & 0 deletions resources/js/pages/headline/show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function Show({
results={results}
heading="What nullers have been saying"
empty="No matching commits from the past week."
isStandalone
/>
</>
);
Expand Down