From 4b277064509768fdf6ae78eb33974a8fb12e4978 Mon Sep 17 00:00:00 2001 From: wwayne Date: Mon, 13 May 2024 14:50:19 +0800 Subject: [PATCH 1/5] feat(ui): add ide links on the home page --- ee/tabby-ui/app/(home)/page.tsx | 28 ++++++++++++++++++++-- ee/tabby-ui/components/ui/icons.tsx | 36 ++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/ee/tabby-ui/app/(home)/page.tsx b/ee/tabby-ui/app/(home)/page.tsx index 19ea1c57541e..8bde970b0007 100644 --- a/ee/tabby-ui/app/(home)/page.tsx +++ b/ee/tabby-ui/app/(home)/page.tsx @@ -3,7 +3,10 @@ import { useState } from 'react' import { useRouter } from 'next/navigation' import { noop } from 'lodash-es' +import Link from 'next/link' +import { useTheme } from 'next-themes' +import { cn } from '@/lib/utils' import { graphql } from '@/lib/gql/generates' import { useHealth } from '@/lib/hooks/use-health' import { useMe } from '@/lib/hooks/use-me' @@ -11,7 +14,7 @@ import { useExternalURL } from '@/lib/hooks/use-network-setting' import { useIsChatEnabled } from '@/lib/hooks/use-server-info' import { useSignOut } from '@/lib/tabby/auth' import { useMutation } from '@/lib/tabby/gql' -import { Button } from '@/components/ui/button' +import { Button, buttonVariants } from '@/components/ui/button' import { CardContent, CardFooter } from '@/components/ui/card' import { IconChat, @@ -20,7 +23,9 @@ import { IconLogout, IconMail, IconRotate, - IconSpinner + IconSpinner, + IconVSCode, + IconJetBrains } from '@/components/ui/icons' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' @@ -41,6 +46,7 @@ const resetUserAuthTokenDocument = graphql(/* GraphQL */ ` function Configuration({ className }: { className?: string }) { const [{ data }, reexecuteQuery] = useMe() const externalUrl = useExternalURL() + const { theme } = useTheme() const resetUserAuthToken = useMutation(resetUserAuthTokenDocument, { onCompleted: () => reexecuteQuery() @@ -100,6 +106,24 @@ function Configuration({ className }: { className?: string }) { for details + +
+ + +

VS Code

+ + + +

JetBrains

+ + +
) } diff --git a/ee/tabby-ui/components/ui/icons.tsx b/ee/tabby-ui/components/ui/icons.tsx index 28dfb7da1336..da9821bfa5ee 100644 --- a/ee/tabby-ui/components/ui/icons.tsx +++ b/ee/tabby-ui/components/ui/icons.tsx @@ -1414,6 +1414,38 @@ const IconGitFork = ({ ) +function IconVSCode({ className, ...props }: React.ComponentProps<'svg'>) { + return ( + + + + ) +} + +function IconJetBrains({ className, ...props }: React.ComponentProps<'svg'>) { + return ( + + + + + ) +} + export { IconEdit, IconNextChat, @@ -1487,5 +1519,7 @@ export { IconMail, IconChevronsDownUp, IconStar, - IconGitFork + IconGitFork, + IconVSCode, + IconJetBrains } From 69fd288f22d22e11b4c7cfcfca4e3ad99f46e461 Mon Sep 17 00:00:00 2001 From: wwayne Date: Tue, 14 May 2024 14:35:46 +0800 Subject: [PATCH 2/5] icon-only --- ee/tabby-ui/app/(home)/page.tsx | 57 +++++++++++++++++++++-------- ee/tabby-ui/components/ui/icons.tsx | 15 ++++---- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/ee/tabby-ui/app/(home)/page.tsx b/ee/tabby-ui/app/(home)/page.tsx index 8bde970b0007..f4016bd8b692 100644 --- a/ee/tabby-ui/app/(home)/page.tsx +++ b/ee/tabby-ui/app/(home)/page.tsx @@ -6,7 +6,6 @@ import { noop } from 'lodash-es' import Link from 'next/link' import { useTheme } from 'next-themes' -import { cn } from '@/lib/utils' import { graphql } from '@/lib/gql/generates' import { useHealth } from '@/lib/hooks/use-health' import { useMe } from '@/lib/hooks/use-me' @@ -14,7 +13,7 @@ import { useExternalURL } from '@/lib/hooks/use-network-setting' import { useIsChatEnabled } from '@/lib/hooks/use-server-info' import { useSignOut } from '@/lib/tabby/auth' import { useMutation } from '@/lib/tabby/gql' -import { Button, buttonVariants } from '@/components/ui/button' +import { Button } from '@/components/ui/button' import { CardContent, CardFooter } from '@/components/ui/card' import { IconChat, @@ -34,6 +33,11 @@ import { CopyButton } from '@/components/copy-button' import SlackDialog from '@/components/slack-dialog' import { ThemeToggle } from '@/components/theme-toggle' import { UserAvatar } from '@/components/user-avatar' +import { + Tooltip, + TooltipContent, + TooltipTrigger +} from '@/components/ui/tooltip' import Stats from './components/stats' @@ -107,27 +111,48 @@ function Configuration({ className }: { className?: string }) { -
- + - -

VS Code

- - } + /> + - -

JetBrains

- - + name='JetBrains' + icon={} + />
) } +function IDELink ({ + href, + name, + icon +}: { + href: string; + name: string; + icon: React.ReactNode; +}) { + return ( + + + + {icon} + + + +

{name}

+
+
+ ) +} + function MainPanel() { const { data: healthInfo } = useHealth() const [{ data }] = useMe() diff --git a/ee/tabby-ui/components/ui/icons.tsx b/ee/tabby-ui/components/ui/icons.tsx index da9821bfa5ee..39798b0e8a39 100644 --- a/ee/tabby-ui/components/ui/icons.tsx +++ b/ee/tabby-ui/components/ui/icons.tsx @@ -1420,10 +1420,11 @@ function IconVSCode({ className, ...props }: React.ComponentProps<'svg'>) { xmlns="http://www.w3.org/2000/svg" className={cn('h-4 w-4', className)} viewBox="0 0 1024 1024" + fill="currentColor" {...props}> + /> ) } @@ -1434,14 +1435,14 @@ function IconJetBrains({ className, ...props }: React.ComponentProps<'svg'>) { xmlns="http://www.w3.org/2000/svg" className={cn('h-4 w-4', className)} viewBox="0 0 1024 1024" + fill="currentColor" {...props}> - + d="M64 960h896V64H64z" /> + ) } From 88b693e97610c69eee2da0371060113ed9d419d7 Mon Sep 17 00:00:00 2001 From: wwayne Date: Tue, 14 May 2024 14:41:05 +0800 Subject: [PATCH 3/5] clean --- ee/tabby-ui/app/(home)/page.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/ee/tabby-ui/app/(home)/page.tsx b/ee/tabby-ui/app/(home)/page.tsx index f4016bd8b692..35db0f3db25a 100644 --- a/ee/tabby-ui/app/(home)/page.tsx +++ b/ee/tabby-ui/app/(home)/page.tsx @@ -4,7 +4,6 @@ import { useState } from 'react' import { useRouter } from 'next/navigation' import { noop } from 'lodash-es' import Link from 'next/link' -import { useTheme } from 'next-themes' import { graphql } from '@/lib/gql/generates' import { useHealth } from '@/lib/hooks/use-health' @@ -50,7 +49,6 @@ const resetUserAuthTokenDocument = graphql(/* GraphQL */ ` function Configuration({ className }: { className?: string }) { const [{ data }, reexecuteQuery] = useMe() const externalUrl = useExternalURL() - const { theme } = useTheme() const resetUserAuthToken = useMutation(resetUserAuthTokenDocument, { onCompleted: () => reexecuteQuery() From 11d2ebdb7aaece393a57c0b39052b3ae98511893 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 06:42:31 +0000 Subject: [PATCH 4/5] [autofix.ci] apply automated fixes --- ee/tabby-ui/app/(home)/page.tsx | 31 +++++++++++++++-------------- ee/tabby-ui/components/ui/icons.tsx | 25 +++++++++++++---------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/ee/tabby-ui/app/(home)/page.tsx b/ee/tabby-ui/app/(home)/page.tsx index 35db0f3db25a..0a2285e394fc 100644 --- a/ee/tabby-ui/app/(home)/page.tsx +++ b/ee/tabby-ui/app/(home)/page.tsx @@ -1,9 +1,9 @@ 'use client' import { useState } from 'react' +import Link from 'next/link' import { useRouter } from 'next/navigation' import { noop } from 'lodash-es' -import Link from 'next/link' import { graphql } from '@/lib/gql/generates' import { useHealth } from '@/lib/hooks/use-health' @@ -18,25 +18,25 @@ import { IconChat, IconCode, IconGear, + IconJetBrains, IconLogout, IconMail, IconRotate, IconSpinner, - IconVSCode, - IconJetBrains + IconVSCode } from '@/components/ui/icons' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Separator } from '@/components/ui/separator' -import { CopyButton } from '@/components/copy-button' -import SlackDialog from '@/components/slack-dialog' -import { ThemeToggle } from '@/components/theme-toggle' -import { UserAvatar } from '@/components/user-avatar' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' +import { CopyButton } from '@/components/copy-button' +import SlackDialog from '@/components/slack-dialog' +import { ThemeToggle } from '@/components/theme-toggle' +import { UserAvatar } from '@/components/user-avatar' import Stats from './components/stats' @@ -112,12 +112,12 @@ function Configuration({ className }: { className?: string }) {
} /> } />
@@ -125,14 +125,14 @@ function Configuration({ className }: { className?: string }) { ) } -function IDELink ({ +function IDELink({ href, name, icon }: { - href: string; - name: string; - icon: React.ReactNode; + href: string + name: string + icon: React.ReactNode }) { return ( @@ -140,8 +140,9 @@ function IDELink ({ - {icon} + target="_blank" + > + {icon} diff --git a/ee/tabby-ui/components/ui/icons.tsx b/ee/tabby-ui/components/ui/icons.tsx index 39798b0e8a39..fe43d205bfe0 100644 --- a/ee/tabby-ui/components/ui/icons.tsx +++ b/ee/tabby-ui/components/ui/icons.tsx @@ -1421,10 +1421,9 @@ function IconVSCode({ className, ...props }: React.ComponentProps<'svg'>) { className={cn('h-4 w-4', className)} viewBox="0 0 1024 1024" fill="currentColor" - {...props}> - + {...props} + > + ) } @@ -1436,13 +1435,17 @@ function IconJetBrains({ className, ...props }: React.ComponentProps<'svg'>) { className={cn('h-4 w-4', className)} viewBox="0 0 1024 1024" fill="currentColor" - {...props}> - - + {...props} + > + + + ) } From f2a81588ff790551ab496793422ccce98a75378e Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Tue, 14 May 2024 10:47:01 -0700 Subject: [PATCH 5/5] Update ee/tabby-ui/app/(home)/page.tsx --- ee/tabby-ui/app/(home)/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/tabby-ui/app/(home)/page.tsx b/ee/tabby-ui/app/(home)/page.tsx index 0a2285e394fc..6aaf0d2d7d65 100644 --- a/ee/tabby-ui/app/(home)/page.tsx +++ b/ee/tabby-ui/app/(home)/page.tsx @@ -112,7 +112,7 @@ function Configuration({ className }: { className?: string }) {
} />