Spaces:
Running
Running
Show catalog alphabetically.
Browse files
lynxkite-app/web/src/workspace/NodeSearch.tsx
CHANGED
|
@@ -25,9 +25,14 @@ export default function (props: {
|
|
| 25 |
}),
|
| 26 |
[props.boxes],
|
| 27 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
const hits: { item: OpsOp }[] = searchText
|
| 29 |
? fuse.search<OpsOp>(searchText)
|
| 30 |
-
:
|
| 31 |
const [selectedIndex, setSelectedIndex] = useState(0);
|
| 32 |
useEffect(() => searchBox.current.focus());
|
| 33 |
function typed(text: string) {
|
|
|
|
| 25 |
}),
|
| 26 |
[props.boxes],
|
| 27 |
);
|
| 28 |
+
const allOps = useMemo(() => {
|
| 29 |
+
const boxes = Object.values(props.boxes).map((box) => ({ item: box }));
|
| 30 |
+
boxes.sort((a, b) => a.item.name.localeCompare(b.item.name));
|
| 31 |
+
return boxes;
|
| 32 |
+
}, [props.boxes]);
|
| 33 |
const hits: { item: OpsOp }[] = searchText
|
| 34 |
? fuse.search<OpsOp>(searchText)
|
| 35 |
+
: allOps;
|
| 36 |
const [selectedIndex, setSelectedIndex] = useState(0);
|
| 37 |
useEffect(() => searchBox.current.focus());
|
| 38 |
function typed(text: string) {
|