mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(web): add modality to fuse search keys, merge docs+files in fullscreen grid
This commit is contained in:
@@ -5,12 +5,13 @@ import { useMemo } from "react";
|
|||||||
|
|
||||||
const FUSE_OPTIONS: IFuseOptions<Tool> = {
|
const FUSE_OPTIONS: IFuseOptions<Tool> = {
|
||||||
keys: [
|
keys: [
|
||||||
{ name: "name", weight: 0.4 },
|
{ name: "name", weight: 0.35 },
|
||||||
{ name: "description", weight: 0.3 },
|
{ name: "description", weight: 0.25 },
|
||||||
{ name: "id", weight: 0.2 },
|
{ name: "modality", weight: 0.15 },
|
||||||
|
{ name: "id", weight: 0.15 },
|
||||||
{ name: "category", weight: 0.1 },
|
{ name: "category", weight: 0.1 },
|
||||||
],
|
],
|
||||||
threshold: 0.4,
|
threshold: 0.45,
|
||||||
ignoreLocation: true,
|
ignoreLocation: true,
|
||||||
minMatchCharLength: 2,
|
minMatchCharLength: 2,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ const MODALITY_TABS = [
|
|||||||
{ id: "image", label: "Image", icon: Image },
|
{ id: "image", label: "Image", icon: Image },
|
||||||
{ id: "video", label: "Video", icon: Video },
|
{ id: "video", label: "Video", icon: Video },
|
||||||
{ id: "audio", label: "Audio", icon: AudioLines },
|
{ id: "audio", label: "Audio", icon: AudioLines },
|
||||||
{ id: "document", label: "Documents", icon: FileText },
|
{ id: "document", label: "Docs", icon: FileText },
|
||||||
{ id: "file", label: "Data & Files", icon: Table },
|
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export function FullscreenGridPage() {
|
export function FullscreenGridPage() {
|
||||||
@@ -72,6 +71,8 @@ export function FullscreenGridPage() {
|
|||||||
|
|
||||||
const modalityFiltered = useMemo(() => {
|
const modalityFiltered = useMemo(() => {
|
||||||
if (modalityTab === "all") return visibleTools;
|
if (modalityTab === "all") return visibleTools;
|
||||||
|
if (modalityTab === "document")
|
||||||
|
return visibleTools.filter((t) => t.modality === "document" || t.modality === "file");
|
||||||
return visibleTools.filter((t) => t.modality === modalityTab);
|
return visibleTools.filter((t) => t.modality === modalityTab);
|
||||||
}, [visibleTools, modalityTab]);
|
}, [visibleTools, modalityTab]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user