Files
searchi/apps/desktop/src/icons.ts
T
karl caf6a2f82e
Core CI / core (ubuntu-latest) (push) Failing after 3m27s
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Successful in 5m45s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
feat: integrate Google semantic search and branded desktop launcher
2026-10-12 17:44:56 +02:00

65 lines
2.0 KiB
TypeScript

// Optimized library assets only. No handcrafted SVG or runtime icon requests.
import search from "@fluentui/svg-icons/icons/search_24_regular.svg?raw";
import settings from "@fluentui/svg-icons/icons/settings_20_regular.svg?raw";
import filter from "@fluentui/svg-icons/icons/filter_20_regular.svg?raw";
import dismiss from "@fluentui/svg-icons/icons/dismiss_20_regular.svg?raw";
import folder from "@fluentui/svg-icons/icons/folder_24_regular.svg?raw";
import folderAdd from "@fluentui/svg-icons/icons/folder_add_20_regular.svg?raw";
import document from "@fluentui/svg-icons/icons/document_24_regular.svg?raw";
import pdf from "@fluentui/svg-icons/icons/document_pdf_24_regular.svg?raw";
import code from "@fluentui/svg-icons/icons/code_24_regular.svg?raw";
import lock from "@fluentui/svg-icons/icons/lock_closed_20_regular.svg?raw";
import arrowUp from "@fluentui/svg-icons/icons/arrow_up_16_regular.svg?raw";
import arrowDown from "@fluentui/svg-icons/icons/arrow_down_16_regular.svg?raw";
import open from "@fluentui/svg-icons/icons/open_20_regular.svg?raw";
import chevron from "@fluentui/svg-icons/icons/chevron_down_16_regular.svg?raw";
import sparkles from "@fluentui/svg-icons/icons/sparkle_20_regular.svg?raw";
const assets = {
search,
settings,
filter,
dismiss,
folder,
folderAdd,
document,
pdf,
code,
lock,
arrowUp,
arrowDown,
open,
chevron,
sparkles,
};
export function icon(name: keyof typeof assets) {
return `<span class="icon" aria-hidden="true">${assets[name]}</span>`;
}
export function fileIcon(filename: string) {
const extension = filename.split(".").pop()?.toLowerCase();
if (extension === "pdf") return { html: icon("pdf"), type: "pdf" };
if (
extension &&
[
"rs",
"js",
"ts",
"tsx",
"py",
"json",
"html",
"css",
"toml",
"yaml",
"yml",
].includes(extension)
)
return { html: icon("code"), type: "code" };
return {
html: icon("document"),
type: ["doc", "docx"].includes(extension || "")
? "document-word"
: "document",
};
}