Skip to content

Commit d74d514

Browse files
authored
Merge pull request #688 from refly-ai/feat/project
Feat/project
2 parents 5de2fe2 + 3cbc3ae commit d74d514

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

packages/ai-workspace-common/src/components/canvas-template/template-list.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ export const TemplateCard = ({
7171
<div className="font-light truncate text-xs text-gray-500">{`@${template.shareUser?.name}`}</div>
7272
</div>
7373
</div>
74-
) : (
75-
<div className="mx-2 mb-2 px-2 h-[26px]" />
76-
)}
74+
) : null}
7775

7876
<div className="mx-2 px-2 h-[50px]">
7977
<Typography.Paragraph

packages/ai-workspace-common/src/components/common/header-actions.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ReactNode, useMemo } from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import { Popconfirm, Button, Input, Tooltip } from 'antd';
3+
import { Popconfirm, Button, Input, Tooltip, Affix } from 'antd';
44
import {
55
IconDelete,
66
IconRemove,
@@ -29,6 +29,8 @@ export interface HeaderActionsProps {
2929
onAddSelectedSourcesToCanvas?: () => void;
3030
addButtonNode?: ReactNode;
3131
itemCountText?: string;
32+
useAffix?: boolean;
33+
target: () => HTMLElement;
3234
}
3335

3436
const HeaderActions = ({
@@ -46,6 +48,8 @@ const HeaderActions = ({
4648
onAddSelectedSourcesToCanvas,
4749
addButtonNode,
4850
itemCountText,
51+
useAffix = false,
52+
target,
4953
}: HeaderActionsProps) => {
5054
const { t } = useTranslation();
5155

@@ -169,16 +173,28 @@ const HeaderActions = ({
169173
addButtonNode,
170174
onAddItem,
171175
t,
176+
source,
177+
onAddSelectedSourcesToCanvas,
172178
]);
173179

174-
return (
180+
const headerContent = (
175181
<div
176-
className={`mb-2 px-3 ${isMultiSelectMode || isSearchMode ? '' : 'flex justify-between items-center'}`}
182+
className={`mb-2 px-3 ${isMultiSelectMode || isSearchMode ? '' : 'flex justify-between items-center'} ${useAffix ? 'bg-white py-2 z-20 w-full shadow-sm' : ''}`}
177183
>
178184
{itemCountText && <div className="text-[10px] text-gray-500">{itemCountText}</div>}
179185
{actions}
180186
</div>
181187
);
188+
189+
if (useAffix) {
190+
return (
191+
<Affix offsetTop={0} className="z-20 w-full" target={target}>
192+
<div className="w-full overflow-hidden">{headerContent}</div>
193+
</Affix>
194+
);
195+
}
196+
197+
return headerContent;
182198
};
183199

184200
export default React.memo(HeaderActions);

packages/ai-workspace-common/src/components/project/project-directory/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export const ProjectDirectory = ({ projectId, source }: ProjectDirectoryProps) =
150150
source === 'sider' ? 'h-[calc(100vh)]' : 'h-[calc(100vh-100px)] rounded-r-lg',
151151
)}
152152
>
153-
<div className="project-directory flex h-full flex-col py-3 pb-0 overflow-y-auto">
153+
<div className="project-directory flex h-full flex-col py-3 pb-0 overflow-y-auto overflow-x-hidden">
154154
<ProjectSettings
155155
source={source}
156156
setCollapse={setCollapse}
@@ -162,7 +162,7 @@ export const ProjectDirectory = ({ projectId, source }: ProjectDirectoryProps) =
162162

163163
<Divider className="my-2" />
164164

165-
<div className="flex-1 overflow-y-auto">
165+
<div className="flex-1 overflow-y-auto overflow-x-hidden project-directory-content">
166166
<CanvasMenu
167167
isFetching={isLoadingCanvas}
168168
canvasList={canvasList}

packages/ai-workspace-common/src/components/project/project-settings/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const ProjectSettings = ({
113113
{data?.customInstructions && (
114114
<Paragraph
115115
className="text-xs p-1 mt-1 !mb-0 bg-gray-50 text-gray-400 rounded-md"
116-
ellipsis={{ rows: 1, tooltip: { placement: 'right' } }}
116+
ellipsis={{ rows: 3, tooltip: { placement: 'right' } }}
117117
>
118118
{data?.customInstructions}
119119
</Paragraph>

packages/ai-workspace-common/src/components/project/source-menu/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ export const SourcesMenu = ({
485485
</div>
486486
),
487487
children: (
488-
<div className="h-full flex flex-col">
488+
<div className="h-full flex flex-col overflow-hidden">
489489
<HeaderActions
490490
source="source"
491491
isSearchMode={isSearchMode}
@@ -501,8 +501,10 @@ export const SourcesMenu = ({
501501
onAddSelectedSourcesToCanvas={addSelectedSourcesToCanvas}
502502
itemCountText={itemCountText}
503503
addButtonNode={addButtonNode}
504+
useAffix={true}
505+
target={() => document.querySelector('.project-directory-content') as HTMLElement}
504506
/>
505-
<div className="flex-grow overflow-y-auto px-3">
507+
<div className="flex-grow overflow-y-auto px-3 source-list-container">
506508
{isFetching ? (
507509
<div className="flex justify-center h-full pt-4">
508510
<Skeleton active paragraph={{ rows: 8 }} title={false} />

0 commit comments

Comments
 (0)