hover message on status dot for docs
This commit is contained in:
parent
745d450aba
commit
bb37638a16
2 changed files with 19 additions and 2 deletions
|
|
@ -147,7 +147,12 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) {
|
|||
/>
|
||||
) : null} */}
|
||||
|
||||
<StatusIndicator status={status?.status} />
|
||||
<StatusIndicator
|
||||
status={status?.status}
|
||||
hoverMessage={
|
||||
status?.status === "failed" ? status?.debugInfo : undefined
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { IndexingStatus } from "core";
|
||||
import { ToolTip } from "../../../../gui/Tooltip";
|
||||
|
||||
interface StatusIndicatorProps {
|
||||
status?: IndexingStatus["status"];
|
||||
className?: string;
|
||||
size?: number;
|
||||
hoverMessage?: string;
|
||||
}
|
||||
|
||||
const STATUS_TO_COLOR: Record<IndexingStatus["status"], string> = {
|
||||
|
|
@ -19,14 +21,24 @@ export function StatusIndicator({
|
|||
status,
|
||||
className = "",
|
||||
size = 2,
|
||||
hoverMessage,
|
||||
}: StatusIndicatorProps) {
|
||||
if (!status) return null;
|
||||
|
||||
return (
|
||||
const indicator = (
|
||||
<div
|
||||
data-tooltip-id={hoverMessage ? "status-tooltip" : undefined}
|
||||
data-tooltip-content={hoverMessage}
|
||||
className={`h-${size} w-${size} rounded-full ${STATUS_TO_COLOR[status]} ${
|
||||
status === "indexing" ? "animate-pulse" : ""
|
||||
} ${className}`}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{indicator}
|
||||
{hoverMessage && <ToolTip id="status-tooltip" />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue