mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +08:00
### What problem does this PR solve? Fix: Fixed an issue where knowledge base could not be shared #9634 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { RAGFlowAvatar } from '@/components/ragflow-avatar';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
interface IProps {
|
||||
data: {
|
||||
@ -11,8 +12,9 @@ interface IProps {
|
||||
};
|
||||
onClick?: () => void;
|
||||
moreDropdown: React.ReactNode;
|
||||
sharedBadge?: ReactNode;
|
||||
}
|
||||
export function HomeCard({ data, onClick, moreDropdown }: IProps) {
|
||||
export function HomeCard({ data, onClick, moreDropdown, sharedBadge }: IProps) {
|
||||
return (
|
||||
<Card
|
||||
className="bg-bg-card border-colors-outline-neutral-standard"
|
||||
@ -41,10 +43,11 @@ export function HomeCard({ data, onClick, moreDropdown }: IProps) {
|
||||
<div className="whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
{data.description}
|
||||
</div>
|
||||
<div>
|
||||
<div className="flex justify-between items-center">
|
||||
<p className="text-sm opacity-80">
|
||||
{formatDate(data.update_time)}
|
||||
</p>
|
||||
{sharedBadge}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@ -5,6 +5,7 @@ import {
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from '@/components/ui/form';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ReactNode, cloneElement, isValidElement } from 'react';
|
||||
import { ControllerRenderProps, useFormContext } from 'react-hook-form';
|
||||
|
||||
@ -13,6 +14,7 @@ type RAGFlowFormItemProps = {
|
||||
label: ReactNode;
|
||||
tooltip?: ReactNode;
|
||||
children: ReactNode | ((field: ControllerRenderProps) => ReactNode);
|
||||
horizontal?: boolean;
|
||||
};
|
||||
|
||||
export function RAGFlowFormItem({
|
||||
@ -20,6 +22,7 @@ export function RAGFlowFormItem({
|
||||
label,
|
||||
tooltip,
|
||||
children,
|
||||
horizontal = false,
|
||||
}: RAGFlowFormItemProps) {
|
||||
const form = useFormContext();
|
||||
return (
|
||||
@ -27,8 +30,14 @@ export function RAGFlowFormItem({
|
||||
control={form.control}
|
||||
name={name}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel tooltip={tooltip}>{label}</FormLabel>
|
||||
<FormItem
|
||||
className={cn({
|
||||
'flex items-center': horizontal,
|
||||
})}
|
||||
>
|
||||
<FormLabel tooltip={tooltip} className={cn({ 'w-1/4': horizontal })}>
|
||||
{label}
|
||||
</FormLabel>
|
||||
<FormControl>
|
||||
{typeof children === 'function'
|
||||
? children(field)
|
||||
|
||||
@ -8,9 +8,5 @@ export function SharedBadge({ children }: PropsWithChildren) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="bg-text-secondary rounded-sm px-1 text-bg-base text-xs">
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
return <span className="bg-bg-card rounded-sm px-1 text-xs">{children}</span>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user