mirror of
https://github.com/outline/outline.git
synced 2026-11-23 06:11:04 +03:00
* wip * generalize * refactor * Extract SearchResultIcon for command bar results Both search action builders rendered the same document icon inline. Move it into a shared component alongside the other command bar pieces, forwarding size so the command bar can continue to size icons via cloneElement. Also drop the redundant charAt(0).toUpperCase() on the initial, as the Icon component already normalizes it. Co-Authored-By: Claude <noreply@anthropic.com> * PR feedback Prevent same doc showing twice in cmd k Improve result ordering in main app command bar Refactor to flattenTree * Upgrade Fuse to 7.5.0, use workers * fix: Re-register search actions when index is enriched Include result contexts in the command bar registration key so that snippets refresh when the same documents are enriched, and only mark a server search as cached once its results are actually fed to the index. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
30 lines
767 B
TypeScript
30 lines
767 B
TypeScript
import { DocumentIcon } from "outline-icons";
|
|
import Icon from "@shared/components/Icon";
|
|
import type { SearchIndexDocument } from "./SearchIndex";
|
|
|
|
interface Props {
|
|
/** The matched document to show an icon for. */
|
|
document: SearchIndexDocument;
|
|
/** Icon size, applied by the command bar when rendering the action. */
|
|
size?: number;
|
|
}
|
|
|
|
/**
|
|
* Displays the icon for a document in the command bar, falling back to a
|
|
* generic document icon when it has none of its own.
|
|
*/
|
|
export function SearchResultIcon({ document, size }: Props) {
|
|
if (!document.icon) {
|
|
return <DocumentIcon size={size} />;
|
|
}
|
|
|
|
return (
|
|
<Icon
|
|
value={document.icon}
|
|
initial={document.title}
|
|
color={document.color ?? undefined}
|
|
size={size}
|
|
/>
|
|
);
|
|
}
|