Skip to content

Commit

Permalink
fix(ui): do not display Content-Length when it is not set (#2060)
Browse files Browse the repository at this point in the history
* fix(ui): do not display Content-Length when it is not set

* update

* update

---------

Co-authored-by: Meng Zhang <[email protected]>
  • Loading branch information
liangfung and wsxiaoys authored May 6, 2024
1 parent 6eadc5c commit c63e3fe
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export default function LinkRepositoryForm({
const form = useForm<LinkRepositoryFormValues>({
resolver: zodResolver(formSchema)
})
const [searchValue, setSearchValue] = React.useState<string>()
const commandListRef = React.useRef<HTMLDivElement>(null)

const { isSubmitting } = form.formState

Expand Down Expand Up @@ -131,6 +133,18 @@ export default function LinkRepositoryForm({
}
}

const scrollCommandListToTop = () => {
requestAnimationFrame(() => {
if (commandListRef.current) {
commandListRef.current.scrollTop = 0
}
})
}

const onSearchChange = () => {
scrollCommandListToTop()
}

return (
<Form {...form}>
<div className="grid gap-2">
Expand Down Expand Up @@ -165,9 +179,15 @@ export default function LinkRepositoryForm({
align="start"
side="bottom"
>
<Command>
<CommandInput placeholder="Search repository..." />
<CommandList className="max-h-60">
<Command className="transition-all">
<CommandInput
placeholder="Search repository..."
onValueChange={onSearchChange}
/>
<CommandList
className="max-h-[30vh]"
ref={commandListRef}
>
<CommandEmpty>{emptyText}</CommandEmpty>
<CommandGroup>
{providerStatus !==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const LinkedRepoTable: React.FC<{
<TableHead className="w-[45%]">URL</TableHead>
<TableHead className="text-right">
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent>
<DialogContent className="top-[20vh]">
<DialogHeader className="gap-3">
<DialogTitle>Add new repository</DialogTitle>
<DialogDescription>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from 'next/link'
import { useParams } from 'next/navigation'

import { RepositoryKind } from '@/lib/gql/generates/graphql'
import { IconGit, IconGitHub, IconGitLab } from '@/components/ui/icons'
import { IconGitHub, IconGitLab } from '@/components/ui/icons'
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'

export default function GitTabsHeader() {
Expand All @@ -17,7 +17,6 @@ export default function GitTabsHeader() {
<TabsList className="grid grid-cols-3">
<TabsTrigger value="git" asChild>
<Link href="/settings/repository/git">
<IconGit />
<span className="ml-2">Git</span>
</Link>
</TabsTrigger>
Expand Down
5 changes: 1 addition & 4 deletions ee/tabby-ui/app/files/components/blob-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import React from 'react'
import Image from 'next/image'
import tabbyLogo from '@/assets/tabby.png'
import { isNil } from 'lodash-es'
import prettyBytes from 'pretty-bytes'
import { toast } from 'sonner'

Expand Down Expand Up @@ -54,9 +53,7 @@ export const BlobHeader: React.FC<BlobHeaderProps> = ({
enableCodeBrowserQuickActionBar.value &&
!chatSideBarVisible

const contentLengthText = !isNil(contentLength)
? prettyBytes(contentLength)
: ''
const contentLengthText = contentLength ? prettyBytes(contentLength) : ''

const onCopy: React.MouseEventHandler<HTMLButtonElement> = async () => {
if (isCopied || !blob) return
Expand Down
1 change: 0 additions & 1 deletion ee/tabby-ui/app/files/components/file-directory-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ function getCurrentDirFromTree(
treeData: TFileTreeNode[],
path: string | undefined
): TFileTreeNode[] {
// const regx = new RegExp(`${path}\/[\\w\.\-]+$`)
if (!treeData?.length) return []
if (!path) {
const repos = treeData.map(x => omit(x, 'children')) || []
Expand Down
8 changes: 6 additions & 2 deletions ee/tabby-ui/app/files/components/repository-kind-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { RepositoryKind } from '@/lib/gql/generates/graphql'
import { IconGit, IconGitHub, IconGitLab } from '@/components/ui/icons'
import {
IconDirectorySolid,
IconGitHub,
IconGitLab
} from '@/components/ui/icons'

export function RepositoryKindIcon({
kind,
Expand All @@ -10,7 +14,7 @@ export function RepositoryKindIcon({
}) {
switch (kind) {
case RepositoryKind.Git:
return <IconGit />
return <IconDirectorySolid style={{ color: 'rgb(84, 174, 255)' }} />
case RepositoryKind.Github:
return <IconGitHub />
case RepositoryKind.Gitlab:
Expand Down

0 comments on commit c63e3fe

Please sign in to comment.