Repository navigation
🔀 feat: Show the Conversation Pull Request in the Chat Header #16794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7492a35
feat: Show the Conversation Pull Request in the Chat Header
berry-13 0d7b80a
feat: Place the Pull Request Chip Beside the Model Controls and Move …
berry-13 f0f90fa
fix: Address Review Findings on Pull Request Polling, Badges and Tool…
berry-13 6dc3fd8
fix: Address Second Round Review Findings on the Pull Request Dialog …
berry-13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import { memo } from 'react'; | ||
| import { Button, Chip, GithubIcon, TooltipAnchor } from '@librechat/client'; | ||
| import type { TConversationPullRequest } from 'librechat-data-provider'; | ||
| import { presentPullRequest } from './status'; | ||
| import { useLocalize } from '~/hooks'; | ||
| import PullRequestIcon from './Icon'; | ||
|
|
||
| type CardProps = { | ||
| pullRequest: TConversationPullRequest; | ||
| /** A refresh failed; the last known pull request stays visible with a way to retry. */ | ||
| refreshFailed?: boolean; | ||
| onRetry?: () => void; | ||
| /** The layer the card lives in, so its tooltip is not painted behind it. */ | ||
| portalElement?: HTMLElement | null; | ||
| }; | ||
|
|
||
| function PullRequestCard({ | ||
| pullRequest, | ||
| refreshFailed = false, | ||
| onRetry, | ||
| portalElement, | ||
| }: CardProps) { | ||
| const localize = useLocalize(); | ||
| const view = presentPullRequest(pullRequest); | ||
| const openLabel = localize('com_ui_pr_open_in_github'); | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-3 p-3" data-testid="pull-request-card"> | ||
| <div className="flex items-center gap-2"> | ||
| <PullRequestIcon icon={view.icon} tone={view.iconTone} className="size-4 shrink-0" /> | ||
| <span className="text-text-primary text-sm font-medium"> | ||
| {localize('com_ui_pr_label', { 0: pullRequest.number })} | ||
| </span> | ||
| <span className="ml-auto flex items-center gap-1.5 text-xs font-medium"> | ||
| <span | ||
| className="text-status-success" | ||
| aria-label={localize('com_ui_pr_additions', { 0: pullRequest.additions })} | ||
| > | ||
| +{pullRequest.additions} | ||
| </span> | ||
| <span | ||
| className="text-status-error" | ||
| aria-label={localize('com_ui_pr_deletions', { 0: pullRequest.deletions })} | ||
| > | ||
| -{pullRequest.deletions} | ||
| </span> | ||
| </span> | ||
| <TooltipAnchor | ||
| description={openLabel} | ||
| portalElement={portalElement} | ||
| render={ | ||
| <a | ||
| href={pullRequest.url} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| aria-label={openLabel} | ||
| data-testid="pull-request-github-link" | ||
| className="text-text-secondary hover:bg-surface-hover hover:text-text-primary focus-visible:ring-text-primary flex size-7 shrink-0 items-center justify-center rounded-md outline-hidden focus-visible:ring-2" | ||
| > | ||
| <GithubIcon /> | ||
| </a> | ||
| } | ||
| /> | ||
| </div> | ||
| <p className="text-text-primary line-clamp-3 text-sm break-words">{pullRequest.title}</p> | ||
| <div className="flex flex-wrap gap-2"> | ||
| <Chip tone={view.stateTone} shape="theme" data-testid="pull-request-state-badge"> | ||
| {localize('com_ui_pr_state', { 0: localize(view.stateKey) })} | ||
| </Chip> | ||
| <Chip tone={view.checksTone} shape="theme" data-testid="pull-request-checks-badge"> | ||
| {localize('com_ui_pr_checks', { 0: localize(view.checksKey) })} | ||
| </Chip> | ||
| </div> | ||
| {refreshFailed && ( | ||
| <div role="status" className="text-status-warning flex items-center gap-2 text-xs"> | ||
| <span>{localize('com_ui_pr_refresh_failed')}</span> | ||
| {onRetry != null && ( | ||
| <Button type="button" variant="outline" size="sm" onClick={onRetry}> | ||
| {localize('com_ui_retry')} | ||
| </Button> | ||
| )} | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default memo(PullRequestCard); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.