mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Change the style of all cards according to the design #10703 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
17
web/src/components/card-container.tsx
Normal file
17
web/src/components/card-container.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
import { PropsWithChildren } from 'react';
|
||||||
|
|
||||||
|
type CardContainerProps = { className?: string } & PropsWithChildren;
|
||||||
|
|
||||||
|
export function CardContainer({ children, className }: CardContainerProps) {
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
className={cn(
|
||||||
|
'grid gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -24,7 +24,6 @@ export function HomeCard({
|
|||||||
}: IProps) {
|
}: IProps) {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
className="bg-bg-card border-colors-outline-neutral-standard"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// navigateToSearch(data?.id);
|
// navigateToSearch(data?.id);
|
||||||
onClick?.();
|
onClick?.();
|
||||||
|
|||||||
@ -8,7 +8,10 @@ const Card = React.forwardRef<
|
|||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn('rounded-lg bg-bg-card shadow-sm', className)}
|
className={cn(
|
||||||
|
'rounded-lg border-border-default border shadow-sm bg-bg-input',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|||||||
@ -83,12 +83,19 @@ export interface IFlowTemplate {
|
|||||||
canvas_type: string;
|
canvas_type: string;
|
||||||
create_date: string;
|
create_date: string;
|
||||||
create_time: number;
|
create_time: number;
|
||||||
description: string;
|
canvas_category?: string;
|
||||||
dsl: DSL;
|
dsl: DSL;
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
|
||||||
update_date: string;
|
update_date: string;
|
||||||
update_time: number;
|
update_time: number;
|
||||||
|
description: {
|
||||||
|
en: string;
|
||||||
|
zh: string;
|
||||||
|
};
|
||||||
|
title: {
|
||||||
|
en: string;
|
||||||
|
zh: string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IGenerateForm {
|
export interface IGenerateForm {
|
||||||
|
|||||||
@ -10,9 +10,10 @@ import {
|
|||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
|
||||||
import { useFetchAgentTemplates, useSetAgent } from '@/hooks/use-agent-request';
|
import { useFetchAgentTemplates, useSetAgent } from '@/hooks/use-agent-request';
|
||||||
import { IFlowTemplate } from '@/interfaces/database/flow';
|
|
||||||
|
|
||||||
|
import { CardContainer } from '@/components/card-container';
|
||||||
import { AgentCategory } from '@/constants/agent';
|
import { AgentCategory } from '@/constants/agent';
|
||||||
|
import { IFlowTemplate } from '@/interfaces/database/agent';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { CreateAgentDialog } from './create-agent-dialog';
|
import { CreateAgentDialog } from './create-agent-dialog';
|
||||||
@ -121,7 +122,7 @@ export default function AgentTemplates() {
|
|||||||
></SideBar>
|
></SideBar>
|
||||||
|
|
||||||
<main className="flex-1 bg-text-title-invert/50 h-dvh">
|
<main className="flex-1 bg-text-title-invert/50 h-dvh">
|
||||||
<div className="grid gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 max-h-[94vh] overflow-auto px-8 pt-8">
|
<CardContainer className="max-h-[94vh] overflow-auto px-8 pt-8">
|
||||||
{tempListFilter?.map((x) => {
|
{tempListFilter?.map((x) => {
|
||||||
return (
|
return (
|
||||||
<TemplateCard
|
<TemplateCard
|
||||||
@ -131,14 +132,13 @@ export default function AgentTemplates() {
|
|||||||
></TemplateCard>
|
></TemplateCard>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</CardContainer>
|
||||||
{creatingVisible && (
|
{creatingVisible && (
|
||||||
<CreateAgentDialog
|
<CreateAgentDialog
|
||||||
loading={loading}
|
loading={loading}
|
||||||
visible={creatingVisible}
|
visible={creatingVisible}
|
||||||
hideModal={hideCreatingModal}
|
hideModal={hideCreatingModal}
|
||||||
onOk={handleOk}
|
onOk={handleOk}
|
||||||
canvasCategory={template?.canvas_category}
|
|
||||||
></CreateAgentDialog>
|
></CreateAgentDialog>
|
||||||
)}
|
)}
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { CardContainer } from '@/components/card-container';
|
||||||
import ListFilterBar from '@/components/list-filter-bar';
|
import ListFilterBar from '@/components/list-filter-bar';
|
||||||
import { RenameDialog } from '@/components/rename-dialog';
|
import { RenameDialog } from '@/components/rename-dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@ -113,7 +114,7 @@ export default function Agents() {
|
|||||||
</ListFilterBar>
|
</ListFilterBar>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 overflow-auto">
|
<div className="flex-1 overflow-auto">
|
||||||
<div className="grid gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
<CardContainer className="max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
||||||
{data.map((x) => {
|
{data.map((x) => {
|
||||||
return (
|
return (
|
||||||
<AgentCard
|
<AgentCard
|
||||||
@ -123,7 +124,7 @@ export default function Agents() {
|
|||||||
></AgentCard>
|
></AgentCard>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</CardContainer>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-8 px-8 pb-8">
|
<div className="mt-8 px-8 pb-8">
|
||||||
<RAGFlowPagination
|
<RAGFlowPagination
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { RAGFlowAvatar } from '@/components/ragflow-avatar';
|
import { RAGFlowAvatar } from '@/components/ragflow-avatar';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { IFlowTemplate } from '@/interfaces/database/flow';
|
import { IFlowTemplate } from '@/interfaces/database/agent';
|
||||||
import i18n from '@/locales/config';
|
import i18n from '@/locales/config';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { CardContainer } from '@/components/card-container';
|
||||||
import ListFilterBar from '@/components/list-filter-bar';
|
import ListFilterBar from '@/components/list-filter-bar';
|
||||||
import { RenameDialog } from '@/components/rename-dialog';
|
import { RenameDialog } from '@/components/rename-dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@ -70,7 +71,7 @@ export default function Datasets() {
|
|||||||
</Button>
|
</Button>
|
||||||
</ListFilterBar>
|
</ListFilterBar>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<div className="grid gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
<CardContainer className="max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
||||||
{kbs.map((dataset) => {
|
{kbs.map((dataset) => {
|
||||||
return (
|
return (
|
||||||
<DatasetCard
|
<DatasetCard
|
||||||
@ -80,7 +81,7 @@ export default function Datasets() {
|
|||||||
></DatasetCard>
|
></DatasetCard>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</CardContainer>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-8 px-8">
|
<div className="mt-8 px-8">
|
||||||
<RAGFlowPagination
|
<RAGFlowPagination
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { CardContainer } from '@/components/card-container';
|
||||||
import ListFilterBar from '@/components/list-filter-bar';
|
import ListFilterBar from '@/components/list-filter-bar';
|
||||||
import { RenameDialog } from '@/components/rename-dialog';
|
import { RenameDialog } from '@/components/rename-dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
@ -50,7 +51,7 @@ export default function ChatList() {
|
|||||||
</ListFilterBar>
|
</ListFilterBar>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 overflow-auto">
|
<div className="flex-1 overflow-auto">
|
||||||
<div className="grid gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
<CardContainer className="max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
||||||
{data.dialogs.map((x) => {
|
{data.dialogs.map((x) => {
|
||||||
return (
|
return (
|
||||||
<ChatCard
|
<ChatCard
|
||||||
@ -60,7 +61,7 @@ export default function ChatList() {
|
|||||||
></ChatCard>
|
></ChatCard>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</CardContainer>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-8 px-8 pb-8">
|
<div className="mt-8 px-8 pb-8">
|
||||||
<RAGFlowPagination
|
<RAGFlowPagination
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { CardContainer } from '@/components/card-container';
|
||||||
import { IconFont } from '@/components/icon-font';
|
import { IconFont } from '@/components/icon-font';
|
||||||
import ListFilterBar from '@/components/list-filter-bar';
|
import ListFilterBar from '@/components/list-filter-bar';
|
||||||
import { RenameDialog } from '@/components/rename-dialog';
|
import { RenameDialog } from '@/components/rename-dialog';
|
||||||
@ -64,7 +65,7 @@ export default function SearchList() {
|
|||||||
</ListFilterBar>
|
</ListFilterBar>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<div className="grid gap-6 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
<CardContainer className="max-h-[calc(100dvh-280px)] overflow-auto px-8">
|
||||||
{list?.data.search_apps.map((x) => {
|
{list?.data.search_apps.map((x) => {
|
||||||
return (
|
return (
|
||||||
<SearchCard
|
<SearchCard
|
||||||
@ -76,7 +77,7 @@ export default function SearchList() {
|
|||||||
></SearchCard>
|
></SearchCard>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</CardContainer>
|
||||||
</div>
|
</div>
|
||||||
{list?.data.total && list?.data.total > 0 && (
|
{list?.data.total && list?.data.total > 0 && (
|
||||||
<div className="px-8 mb-4">
|
<div className="px-8 mb-4">
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { BulkOperateBar } from '@/components/bulk-operate-bar';
|
import { BulkOperateBar } from '@/components/bulk-operate-bar';
|
||||||
|
import { CardContainer } from '@/components/card-container';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { SearchInput } from '@/components/ui/input';
|
import { SearchInput } from '@/components/ui/input';
|
||||||
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
|
||||||
@ -60,7 +61,7 @@ export default function McpServer() {
|
|||||||
className="mb-2.5"
|
className="mb-2.5"
|
||||||
></BulkOperateBar>
|
></BulkOperateBar>
|
||||||
)}
|
)}
|
||||||
<section className="flex gap-5 flex-wrap">
|
<CardContainer>
|
||||||
{data.mcp_servers.map((item) => (
|
{data.mcp_servers.map((item) => (
|
||||||
<McpCard
|
<McpCard
|
||||||
key={item.id}
|
key={item.id}
|
||||||
@ -70,8 +71,8 @@ export default function McpServer() {
|
|||||||
showEditModal={showEditModal}
|
showEditModal={showEditModal}
|
||||||
></McpCard>
|
></McpCard>
|
||||||
))}
|
))}
|
||||||
</section>
|
</CardContainer>
|
||||||
<div className="mt-8 px-8">
|
<div className="mt-8">
|
||||||
<RAGFlowPagination
|
<RAGFlowPagination
|
||||||
{...pick(pagination, 'current', 'pageSize')}
|
{...pick(pagination, 'current', 'pageSize')}
|
||||||
total={pagination.total || 0}
|
total={pagination.total || 0}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ export function McpCard({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Card key={data.id} className="w-64">
|
<Card key={data.id}>
|
||||||
<CardContent className="p-2.5 pt-2 group">
|
<CardContent className="p-2.5 pt-2 group">
|
||||||
<section className="flex justify-between pb-2">
|
<section className="flex justify-between pb-2">
|
||||||
<h3 className="text-lg font-semibold truncate flex-1">{data.name}</h3>
|
<h3 className="text-lg font-semibold truncate flex-1">{data.name}</h3>
|
||||||
|
|||||||
@ -14,7 +14,7 @@ module.exports = {
|
|||||||
center: true,
|
center: true,
|
||||||
padding: '2rem',
|
padding: '2rem',
|
||||||
screens: {
|
screens: {
|
||||||
'2xl': '1400px',
|
'2xl': '1536px',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
screens: {
|
screens: {
|
||||||
@ -22,7 +22,7 @@ module.exports = {
|
|||||||
md: '768px',
|
md: '768px',
|
||||||
lg: '1024px',
|
lg: '1024px',
|
||||||
xl: '1280px',
|
xl: '1280px',
|
||||||
'2xl': '1400px',
|
'2xl': '1536px',
|
||||||
'3xl': '1780px',
|
'3xl': '1780px',
|
||||||
'4xl': '1980px',
|
'4xl': '1980px',
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user