Skip to content
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

fix(ui): correct the display of Issue/Pull Request documentation #3452

Merged
merged 4 commits into from
Nov 22, 2024
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
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 @@ -37,9 +37,11 @@ import {
import {
IconBlocks,
IconBug,
IconCheckCircled,
IconChevronRight,
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 ? (
<IconCheckCircled 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
37 changes: 22 additions & 15 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 {
IconCheckCircled,
IconCircleDot,
IconGitMerge,
IconGitPullRequest
} from '../ui/icons'
import { Skeleton } from '../ui/skeleton'

type RelevantDocItem = {
Expand Down Expand Up @@ -486,29 +491,31 @@ export function SiteFavicon({
function IssueStateBadge({ closed }: { closed: boolean }) {
return (
<Badge
variant="outline"
className={cn('gap-1 text-xs text-white', {
'bg-[#7b52d7] dark:bg-[#8259dd]': closed,
'bg-gray-500 dark:bg-gray-500': !closed
})}
variant={closed ? 'default' : 'secondary'}
className="gap-1 py-1 text-xs"
>
<IconCircleDot className="h-3.5 w-3.5" />
{closed ? 'Closed' : 'Not closed'}
{closed ? (
<IconCheckCircled className="h-3.5 w-3.5" />
) : (
<IconCircleDot className="h-3.5 w-3.5" />
)}
{closed ? 'Closed' : 'Open'}
</Badge>
)
}

function PRStateBadge({ merged }: { merged: boolean }) {
return (
<Badge
variant="outline"
className={cn('gap-1 text-xs text-white', {
'bg-[#7b52d7] dark:bg-[#8259dd]': merged,
'bg-gray-500 dark:bg-gray-500': !merged
})}
variant={merged ? 'default' : 'secondary'}
className="gap-1 py-1 text-xs"
>
<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>
)
}
16 changes: 8 additions & 8 deletions ee/tabby-ui/components/ui/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
CaseSensitive,
ChevronsDownUp,
CircleAlert,
CircleCheck,
CircleDot,
CircleHelp,
CirclePlay,
Expand All @@ -23,6 +22,7 @@ import {
FileText,
Filter,
GitFork,
GitMerge,
GitPullRequest,
Globe,
Hash,
Expand Down Expand Up @@ -1715,18 +1715,18 @@ function IconCircleDot({
return <CircleDot className={cn('h-4 w-4', className)} {...props} />
}

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

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

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