🤯 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
import { Flexbox, PreviewGroup, ScrollShadow } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useChatInputUploadKey } from '@/features/ChatInput/hooks/useChatInputUpload';
import { useChatInputStore } from '@/features/ChatInput/store';
import { fileChatSelectors, useFileStore } from '@/store/file';
import FileItem from './FileItem';
const styles = stylex.create({ container: { overflowX: 'scroll', width: '100%' } });
const FilePreview = memo(() => {
const expand = useChatInputStore((s) => s.expand);
const contextKey = useChatInputUploadKey();
const list = useFileStore(fileChatSelectors.chatUploadFileList(contextKey), isEqual);
if (!list || list?.length === 0) return null;
return (
<ScrollShadow
hideScrollBar
horizontal
className={stylex.props(styles.container).className}
orientation={'horizontal'}
size={8}
>
<Flexbox horizontal gap={6} paddingBlock={8} paddingInline={expand ? 0 : 12}>
<PreviewGroup>
{list.map((i) => (
<FileItem {...i} key={i.id} loading={i.status === 'pending'} />
))}
</PreviewGroup>
</Flexbox>
</ScrollShadow>
);
});
export default FilePreview;