From 8f2ad8902709cb3815383d2ea2ac63c2a1e03343 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Fri, 27 Jun 2025 15:01:33 +0800 Subject: [PATCH] datasource page --- web/app/components/base/dropdown/index.tsx | 32 ++++++-- .../data-source-page-new/card.tsx | 45 ++++++++++++ .../data-source-page-new/index.tsx | 12 +++ .../data-source-page-new/item.tsx | 25 +++++++ .../data-source-page-new/operator.tsx | 73 +++++++++++++++++++ .../header/account-setting/index.tsx | 2 +- 6 files changed, 180 insertions(+), 9 deletions(-) create mode 100644 web/app/components/header/account-setting/data-source-page-new/card.tsx create mode 100644 web/app/components/header/account-setting/data-source-page-new/index.tsx create mode 100644 web/app/components/header/account-setting/data-source-page-new/item.tsx create mode 100644 web/app/components/header/account-setting/data-source-page-new/operator.tsx diff --git a/web/app/components/base/dropdown/index.tsx b/web/app/components/base/dropdown/index.tsx index cdee1535c4..e8aebc74c1 100644 --- a/web/app/components/base/dropdown/index.tsx +++ b/web/app/components/base/dropdown/index.tsx @@ -1,5 +1,6 @@ import type { FC } from 'react' import { useState } from 'react' +import cn from '@/utils/classnames' import { RiMoreFill, } from '@remixicon/react' @@ -8,6 +9,8 @@ import { PortalToFollowElemContent, PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' +import ActionButton from '@/app/components/base/action-button' +import type { ActionButtonProps } from '@/app/components/base/action-button' export type Item = { value: string | number @@ -18,14 +21,20 @@ type DropdownProps = { secondItems?: Item[] onSelect: (item: Item) => void renderTrigger?: (open: boolean) => React.ReactNode + triggerProps?: ActionButtonProps popupClassName?: string + itemClassName?: string + secondItemClassName?: string } const Dropdown: FC = ({ items, onSelect, secondItems, renderTrigger, + triggerProps, popupClassName, + itemClassName, + secondItemClassName, }) => { const [open, setOpen] = useState(false) @@ -45,14 +54,15 @@ const Dropdown: FC = ({ renderTrigger ? renderTrigger(open) : ( -
-
+ ) } @@ -65,7 +75,10 @@ const Dropdown: FC = ({ items.map(item => (
handleSelect(item)} > {item.text} @@ -87,7 +100,10 @@ const Dropdown: FC = ({ secondItems.map(item => (
handleSelect(item)} > {item.text} diff --git a/web/app/components/header/account-setting/data-source-page-new/card.tsx b/web/app/components/header/account-setting/data-source-page-new/card.tsx new file mode 100644 index 0000000000..08b8bbb7bb --- /dev/null +++ b/web/app/components/header/account-setting/data-source-page-new/card.tsx @@ -0,0 +1,45 @@ +import { RiAddLine } from '@remixicon/react' +import Item from './item' +import Button from '@/app/components/base/button' + +const Card = () => { + return ( +
+
+
+
+
+ Notion Data Source +
+
+ langgenius +
/
+ notion-data-source +
+
+ +
+
+ Connected workspace +
+
+
+ + + +
+
+
+ Please configure authentication +
+
+
+ ) +} + +export default Card diff --git a/web/app/components/header/account-setting/data-source-page-new/index.tsx b/web/app/components/header/account-setting/data-source-page-new/index.tsx new file mode 100644 index 0000000000..108267fa51 --- /dev/null +++ b/web/app/components/header/account-setting/data-source-page-new/index.tsx @@ -0,0 +1,12 @@ +import Card from './card' + +const DataSourcePage = () => { + return ( +
+ + +
+ ) +} + +export default DataSourcePage diff --git a/web/app/components/header/account-setting/data-source-page-new/item.tsx b/web/app/components/header/account-setting/data-source-page-new/item.tsx new file mode 100644 index 0000000000..5b5dfc822b --- /dev/null +++ b/web/app/components/header/account-setting/data-source-page-new/item.tsx @@ -0,0 +1,25 @@ +import Indicator from '@/app/components/header/indicator' +import Operator from './operator' + +const Item = () => { + return ( +
+
+
+ Evan’s Notion +
+
+
+ +
+
+ connected +
+
+
+ +
+ ) +} + +export default Item diff --git a/web/app/components/header/account-setting/data-source-page-new/operator.tsx b/web/app/components/header/account-setting/data-source-page-new/operator.tsx new file mode 100644 index 0000000000..dd84f1ac7c --- /dev/null +++ b/web/app/components/header/account-setting/data-source-page-new/operator.tsx @@ -0,0 +1,73 @@ +import { + useCallback, + useMemo, +} from 'react' +import { + RiDeleteBinLine, + RiLoopLeftLine, + RiStickyNoteAddLine, +} from '@remixicon/react' +import Dropdown from '@/app/components/base/dropdown' +import type { Item } from '@/app/components/base/dropdown' + +const Operator = () => { + const items = useMemo(() => { + return [ + { + value: 'change', + text: ( +
+ +
+
Change authorized pages
+
18 Pages authorized
+
+
+ ), + }, + { + value: 'sync', + text: ( +
+ +
Sync
+
+ ), + }, + ] + }, []) + + const secondItems = useMemo(() => { + return [ + { + value: 'delete', + text: ( +
+ +
Remove
+
+ ), + }, + ] + }, []) + + const handleSelect = useCallback((item: Item) => { + console.log('Selected item:', item) + }, []) + + return ( + + ) +} + +export default Operator diff --git a/web/app/components/header/account-setting/index.tsx b/web/app/components/header/account-setting/index.tsx index b2a3c8245b..970b7c8e31 100644 --- a/web/app/components/header/account-setting/index.tsx +++ b/web/app/components/header/account-setting/index.tsx @@ -21,7 +21,7 @@ import Button from '../../base/button' import MembersPage from './members-page' import LanguagePage from './language-page' import ApiBasedExtensionPage from './api-based-extension-page' -import DataSourcePage from './data-source-page' +import DataSourcePage from './data-source-page-new' import ModelProviderPage from './model-provider-page' import cn from '@/utils/classnames' import BillingPage from '@/app/components/billing/billing-page'