diff --git a/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx b/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx index d32774be3..7ec2e79bd 100644 --- a/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx +++ b/gui/src/components/mainInput/Lump/sections/docs/DocsIndexingStatus.tsx @@ -11,6 +11,7 @@ import { setDialogMessage, setShowDialog, } from "../../../../../redux/slices/uiSlice"; +import { getFontSize } from "../../../../../util"; import ConfirmationDialog from "../../../../dialogs/ConfirmationDialog"; import { StatusIndicator } from "./StatusIndicator"; @@ -83,7 +84,7 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) { className={`flex flex-row items-center justify-between gap-2 text-sm`} >
{ if (status?.url) { ideMessenger.post("openUrl", status.url); @@ -94,19 +95,33 @@ function DocsIndexingStatus({ docConfig }: IndexingStatusViewerProps) { doc icon ) : null} -

+

{docConfig.title ?? docConfig.startUrl}

- +
{status?.status === "pending" ? (
Pending...
) : (
- {true && {progressPercentage}%} + {true && ( + + {progressPercentage}% + + )} {status?.status !== "indexing" ? ( { const sorter = (status: IndexingStatus["status"]) => { - // TODO - further sorting? - if (status === "indexing" || status === "paused") return 0; - if (status === "failed") return 1; - if (status === "aborted" || status === "pending") return 2; - return 3; + if (status === "complete") return 0; + if (status === "indexing" || status === "paused") return 1; + if (status === "failed") return 2; + if (status === "aborted" || status === "pending") return 3; + return 4; }; const docs = [...(config.docs ?? [])]; - docs.sort((a, b) => - sorter(indexingStatuses[b.startUrl]?.status ?? "pending") > - sorter(indexingStatuses[a.startUrl]?.status ?? "pending") - ? -1 - : 1, - ); + docs.sort((a, b) => { + const statusA = indexingStatuses[a.startUrl]?.status ?? "pending"; + const statusB = indexingStatuses[b.startUrl]?.status ?? "pending"; + + // First, compare by status + const statusCompare = sorter(statusB) - sorter(statusA); + if (statusCompare !== 0) return statusCompare; + + // If status is the same, sort by presence of icon + const hasIconA = !!a.faviconUrl; + const hasIconB = !!b.faviconUrl; + return hasIconB === hasIconA ? 0 : hasIconB ? 1 : -1; + }); return docs; }, [config, indexingStatuses]); diff --git a/gui/src/components/mainInput/Lump/sections/docs/StatusIndicator.tsx b/gui/src/components/mainInput/Lump/sections/docs/StatusIndicator.tsx index b39c5f391..d878c09ac 100644 --- a/gui/src/components/mainInput/Lump/sections/docs/StatusIndicator.tsx +++ b/gui/src/components/mainInput/Lump/sections/docs/StatusIndicator.tsx @@ -7,8 +7,8 @@ interface StatusIndicatorProps { } const STATUS_TO_COLOR: Record = { - indexing: "bg-blue-500", - paused: "bg-yellow-500", + indexing: "bg-yellow-500", + paused: "bg-blue-500", complete: "bg-green-500", aborted: "bg-gray-500", pending: "bg-gray-300",