🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
lint: Create consts for URLs
Rene Wangf2dd3894c6c7
diff --git a/packages/business/const/src/branding.ts b/packages/business/const/src/branding.tsindex 80d490d9cde..fc80bebd85f 100644--- a/packages/business/const/src/branding.ts+++ b/packages/business/const/src/branding.ts@@ -25,6 +25,10 @@ export const SOCIAL_URL = {youtube: 'https://www.youtube.com/@lobehub',};+export const FILE_URL = {+ importFromNotionGuide: 'https://hub-apac-1.lobeobjects.space/assets/notion.mp4',+};+export const BRANDING_EMAIL = {business: '[email protected]',support: '[email protected]',diff --git a/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx b/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsxindex 1e2be96c866..86068a95ca8 100644--- a/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx+++ b/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx@@ -2,8 +2,11 @@import { useDroppable } from '@dnd-kit/core';import { Center, Flexbox, Skeleton, Text } from '@lobehub/ui';+import { Dropdown } from 'antd';+import type { MenuProps } from 'antd';import { createStyles } from 'antd-style';-import { memo, useCallback } from 'react';+import { ChevronsUpDown } from 'lucide-react';+import { memo, useCallback, useMemo } from 'react';import { useNavigate } from 'react-router-dom';import { useDragActive } from '@/app/[variants]/(main)/resource/features/DndContextWrapper';@@ -29,6 +32,17 @@ const useStyles = createStyles(({ css, token }) => ({color: ${token.colorBgElevated} !important;}`,+ icon: css`+ color: ${token.colorTextSecondary};+ transition: all 0.2s;++ &:hover {+ color: ${token.colorText};+ }+ `,+ menuIcon: css`+ color: ${token.colorTextTertiary};+ `,}));const Head = memo<{ id: string }>(({ id }) => {@@ -38,6 +52,9 @@ const Head = memo<{ id: string }>(({ id }) => {const setMode = useResourceManagerStore((s) => s.setMode);const isDragActive = useDragActive();+ const useFetchKnowledgeBaseList = useKnowledgeBaseStore((s) => s.useFetchKnowledgeBaseList);+ const { data: libraries } = useFetchKnowledgeBaseList();+// Special droppable ID for root folder - matches the pattern expected by DndContextWrapperconst ROOT_DROP_ID = `__root__:${id}`;@@ -57,15 +74,38 @@ const Head = memo<{ id: string }>(({ id }) => {setMode('explorer');}, [id, navigate, setMode]);+ const handleLibrarySwitch = useCallback(+ (libraryId: string) => {+ navigate(`/resource/library/${libraryId}`);+ setMode('explorer');+ },+ [navigate, setMode],+ );++ const menuItems: MenuProps['items'] = useMemo(() => {+ if (!libraries) return [];++ return libraries.map((library) => ({+ icon: (+ <Center className={styles.menuIcon} style={{ minWidth: 16 }} width={16}>+ <RepoIcon size={14} />+ </Center>+ ),+ key: library.id,+ label: library.name,+ onClick: () => handleLibrarySwitch(library.id),+ style: library.id === id ? { backgroundColor: 'var(--ant-control-item-bg-active)' } : {},+ }));+ }, [libraries, handleLibrarySwitch, id, styles.menuIcon]);+return (<Flexboxalign={'center'}className={cx(styles.clickableHeader, isOver && styles.dropZoneActive)}gap={8}horizontal- onClick={handleClick}paddingBlock={6}- paddingInline={'10px 6px'}+ paddingInline={'12px 14px'}ref={setNodeRef}><Center style={{ minWidth: 24 }} width={24}>@@ -74,9 +114,21 @@ const Head = memo<{ id: string }>(({ id }) => {{!name ? (<Skeleton active paragraph={false} title={{ style: { marginBottom: 0 }, width: 80 }} />) : (- <Text ellipsis strong style={{ fontSize: 16 }}>- {name}- </Text>+ <Flexbox align={'center'} flex={1} gap={4} horizontal onClick={handleClick}>+ <Text ellipsis strong style={{ flex: 1, fontSize: 16 }}>+ {name}+ </Text>+ </Flexbox>+ )}+ {name && (+ <Dropdown menu={{ items: menuItems }} placement="bottomRight" trigger={['click']}>+ <ChevronsUpDown+ className={styles.icon}+ onClick={(e) => e.stopPropagation()}+ size={16}+ style={{ cursor: 'pointer', flex: 'none' }}+ />+ </Dropdown>)}</Flexbox>);diff --git a/src/features/PageExplorer/PageExplorerPlaceholder.tsx b/src/features/PageExplorer/PageExplorerPlaceholder.tsxindex e983b9aeb9b..173fb138b89 100644--- a/src/features/PageExplorer/PageExplorerPlaceholder.tsx+++ b/src/features/PageExplorer/PageExplorerPlaceholder.tsx@@ -1,3 +1,4 @@+import { FILE_URL } from '@lobechat/business-const';import { Notion } from '@lobehub/icons';import { Center, FileTypeIcon, Flexbox, Icon, Text } from '@lobehub/ui';import { Upload } from 'antd';@@ -14,7 +15,6 @@ import { useFileStore } from '@/store/file';import { DocumentSourceType } from '@/types/document';const ICON_SIZE = 80;-const NOTION_GUIDE_VIDEO_SRC = 'https://hub-apac-1.lobeobjects.space/assets/notion.mp4';const useStyles = createStyles(({ css, token }) => ({actionTitle: css`@@ -259,7 +259,7 @@ const PageExplorerPlaceholder = memo<PageExplorerPlaceholderProps>(</Center><GuideModalcancelText={t('header.actions.notionGuide.cancel')}- cover={<GuideVideo height={269} src={NOTION_GUIDE_VIDEO_SRC} width={358} />}+ cover={<GuideVideo height={269} src={FILE_URL.importFromNotionGuide} width={358} />}desc={t('header.actions.notionGuide.desc')}okText={t('header.actions.notionGuide.ok')}onCancel={notionImport.handleCloseNotionGuide}diff --git a/src/features/ResourceManager/components/Header/AddButton.tsx b/src/features/ResourceManager/components/Header/AddButton.tsxindex e168b8750df..c2376bac8a4 100644--- a/src/features/ResourceManager/components/Header/AddButton.tsx+++ b/src/features/ResourceManager/components/Header/AddButton.tsx@@ -1,5 +1,6 @@'use client';+import { FILE_URL } from '@lobechat/business-const';import { Notion } from '@lobehub/icons';import { Button, Dropdown, Icon, MenuProps } from '@lobehub/ui';import { Upload } from 'antd';@@ -27,8 +28,6 @@ const hotArea = css`}`;-const NOTION_GUIDE_VIDEO_SRC = 'https://hub-apac-1.lobeobjects.space/assets/notion.mp4';-const AddButton = () => {const { t } = useTranslation('file');const pushDockFileList = useFileStore((s) => s.pushDockFileList);@@ -219,7 +218,7 @@ const AddButton = () => {</Dropdown><GuideModalcancelText={t('header.actions.notionGuide.cancel')}- cover={<GuideVideo height={269} src={NOTION_GUIDE_VIDEO_SRC} width={358} />}+ cover={<GuideVideo height={269} src={FILE_URL.importFromNotionGuide} width={358} />}desc={t('header.actions.notionGuide.desc')}okText={t('header.actions.notionGuide.ok')}onCancel={handleCloseNotionGuide}