mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-09 12:30:49 +02:00
cleaner citations (#3389)
This commit is contained in:
parent
264df3441b
commit
fa84eb657f
@ -30,57 +30,31 @@ export function Citation({
|
||||
? children?.toString().split("[")[1].split("]")[0]
|
||||
: index;
|
||||
|
||||
if (link) {
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
onMouseDown={() => {
|
||||
if (document.source_type == ValidSources.File) {
|
||||
updatePresentingDocument(document);
|
||||
} else {
|
||||
window.open(link, "_blank");
|
||||
}
|
||||
}}
|
||||
className="inline-flex items-center ml-1 cursor-pointer transition-all duration-200 ease-in-out"
|
||||
>
|
||||
<span className="relative min-w-[1.4rem] text-center no-underline -top-0.5 px-1.5 py-0.5 text-xs font-medium text-gray-700 bg-gray-100 rounded-full border border-gray-300 hover:bg-gray-200 hover:text-gray-900 shadow-sm no-underline">
|
||||
{innerText}
|
||||
</span>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent width="mb-2 max-w-lg" className="bg-background">
|
||||
<CompactDocumentCard url={url} icon={icon} document={document} />
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
onMouseDown={() => {
|
||||
if (document.source_type == ValidSources.File) {
|
||||
updatePresentingDocument(document);
|
||||
} else {
|
||||
window.open(document.link, "_blank");
|
||||
}
|
||||
}}
|
||||
className="inline-flex items-center ml-1 cursor-pointer transition-all duration-200 ease-in-out"
|
||||
>
|
||||
<span className="relative min-w-[1.4rem] pchatno-underline -top-0.5 px-1.5 py-0.5 text-xs font-medium text-gray-700 bg-gray-100 rounded-full border border-gray-300 hover:bg-gray-200 hover:text-gray-900 shadow-sm no-underline">
|
||||
{innerText}
|
||||
</span>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent width="mb-2 max-w-lg" backgroundColor="bg-background">
|
||||
<CompactDocumentCard url={url} icon={icon} document={document} />
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
const onClick = () => {
|
||||
if (document.source_type == ValidSources.File) {
|
||||
updatePresentingDocument(document);
|
||||
} else {
|
||||
window.open(link || document.link, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
onMouseDown={onClick}
|
||||
className="inline-flex items-center cursor-pointer transition-all duration-200 ease-in-out"
|
||||
>
|
||||
<span className="flex items-center justify-center w-6 h-6 text-[11px] font-medium text-gray-700 bg-gray-100 rounded-full border border-gray-300 hover:bg-gray-200 hover:text-gray-900 shadow-sm">
|
||||
{innerText}
|
||||
</span>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent width="mb-2 max-w-lg" className="bg-background">
|
||||
<CompactDocumentCard url={url} icon={icon} document={document} />
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user