Skip to content

Commit

Permalink
fix(ui): correct the display of Issue/Pull Request documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Nov 22, 2024
1 parent 55caabc commit ffa0d10
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
18 changes: 14 additions & 4 deletions ee/tabby-ui/app/search/components/assistant-message-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ import {
IconBlocks,
IconBug,
IconChevronRight,
IconCircleCheck,
IconCircleDot,
IconEdit,
IconGitMerge,
IconGitPullRequest,
IconLayers,
IconPlus,
Expand Down Expand Up @@ -516,14 +518,22 @@ function SourceCardContent({
<div className="flex shrink-0 items-center gap-1">
{isIssue && (
<>
<IconCircleDot className="h-3.5 w-3.5" />
<span>{source.closed ? 'Closed' : 'Not closed'}</span>
{source.closed ? (
<IconCircleCheck className="h-3.5 w-3.5" />
) : (
<IconCircleDot className="h-3.5 w-3.5" />
)}
<span>{source.closed ? 'Closed' : 'Open'}</span>
</>
)}
{isPR && (
<>
<IconGitPullRequest className="h-3.5 w-3.5" />
{source.merged ? 'Merged' : 'Not merged'}
{source.merged ? (
<IconGitMerge className="h-3.5 w-3.5" />
) : (
<IconGitPullRequest className="h-3.5 w-3.5" />
)}
{source.merged ? 'Merged' : 'Open'}
</>
)}
</div>
Expand Down
31 changes: 22 additions & 9 deletions ee/tabby-ui/components/message-markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ import {

import { Mention } from '../mention-tag'
import { Badge } from '../ui/badge'
import { IconCircleDot, IconGitPullRequest } from '../ui/icons'
import {
IconCircleCheck,
IconCircleDot,
IconGitMerge,
IconGitPullRequest
} from '../ui/icons'
import { Skeleton } from '../ui/skeleton'

type RelevantDocItem = {
Expand Down Expand Up @@ -487,13 +492,17 @@ function IssueStateBadge({ closed }: { closed: boolean }) {
return (
<Badge
variant="outline"
className={cn('gap-1 text-xs text-white', {
className={cn('border-0 py-1 gap-1 text-xs text-white', {
'bg-[#7b52d7] dark:bg-[#8259dd]': closed,
'bg-gray-500 dark:bg-gray-500': !closed
'bg-green-600 dark:bg-green-600/80': !closed
})}
>
<IconCircleDot className="h-3.5 w-3.5" />
{closed ? 'Closed' : 'Not closed'}
{closed ? (
<IconCircleCheck className="h-3.5 w-3.5" />
) : (
<IconCircleDot className="h-3.5 w-3.5" />
)}
{closed ? 'Closed' : 'Open'}
</Badge>
)
}
Expand All @@ -502,13 +511,17 @@ function PRStateBadge({ merged }: { merged: boolean }) {
return (
<Badge
variant="outline"
className={cn('gap-1 text-xs text-white', {
className={cn('border-0 py-1 gap-1 text-xs text-white', {
'bg-[#7b52d7] dark:bg-[#8259dd]': merged,
'bg-gray-500 dark:bg-gray-500': !merged
'bg-green-600 dark:bg-green-600/80': !merged
})}
>
<IconGitPullRequest className="h-3.5 w-3.5" />
{merged ? 'Merged' : 'Not merged'}
{merged ? (
<IconGitMerge className="h-3.5 w-3.5" />
) : (
<IconGitPullRequest className="h-3.5 w-3.5" />
)}
{merged ? 'Merged' : 'Open'}
</Badge>
)
}
11 changes: 10 additions & 1 deletion ee/tabby-ui/components/ui/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
FileText,
Filter,
GitFork,
GitMerge,
GitPullRequest,
Globe,
Hash,
Expand Down Expand Up @@ -1729,6 +1730,13 @@ function IconGitPullRequest({
return <GitPullRequest className={cn('h-4 w-4', className)} {...props} />
}

function IconGitMerge({
className,
...props
}: React.ComponentProps<typeof GitMerge>) {
return <GitMerge className={cn('h-4 w-4', className)} {...props} />
}

export {
IconEdit,
IconNextChat,
Expand Down Expand Up @@ -1839,5 +1847,6 @@ export {
IconEyeOff,
IconCircleDot,
IconGitPullRequest,
IconCircleCheck
IconCircleCheck,
IconGitMerge
}

0 comments on commit ffa0d10

Please sign in to comment.