Skip to content

🎥 Make videos programmatically with React

simplify

Jonny Burger89a6b410be80
diff --git a/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx b/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx
index 993a7aa712..93df901674 100644
--- a/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx
+++ b/packages/cli/src/editor/components/QuickSwitcher/QuickSwitcherContent.tsx
@@ -128,7 +128,7 @@ export const QuickSwitcherContent: React.FC = () => {
}
if (mode === 'docs') {
- return [];
+ return docResults;
}
return fuzzySearch(
@@ -148,9 +148,10 @@ export const QuickSwitcherContent: React.FC = () => {
);
}, [
mode,
- compositions,
actualQuery,
+ compositions,
menuActions,
+ docResults,
selectComposition,
setSelectedModal,
]);
@@ -258,8 +259,6 @@ export const QuickSwitcherContent: React.FC = () => {
inputRef.current?.focus();
}, []);
- const completeResult = mode === 'docs' ? docResults : resultsArray;
-
return (
<div style={container}>
<div style={modeSelector}>
@@ -299,7 +298,7 @@ export const QuickSwitcherContent: React.FC = () => {
/>
</div>
<div style={results}>
- {completeResult.map((result, i) => {
+ {resultsArray.map((result, i) => {
return (
<QuickSwitcherResult
key={result.id}
@@ -308,7 +307,7 @@ export const QuickSwitcherContent: React.FC = () => {
/>
);
})}
- {completeResult.length === 0 ? (
+ {resultsArray.length === 0 ? (
<QuickSwitcherNoResults mode={mode} query={actualQuery} />
) : null}
</div>
diff --git a/packages/cli/src/editor/components/QuickSwitcher/algolia-search.ts b/packages/cli/src/editor/components/QuickSwitcher/algolia-search.ts
index 7a96f78ac7..51faeea212 100644
--- a/packages/cli/src/editor/components/QuickSwitcher/algolia-search.ts
+++ b/packages/cli/src/editor/components/QuickSwitcher/algolia-search.ts
@@ -9,32 +9,14 @@ type Levels = 'lvl0' | 'lvl1' | 'lvl2' | 'lvl3' | 'lvl4' | 'lvl5' | 'lvl6';
type Hit = {
url: string;
- content?: any;
type: Levels;
hierarchy: Record<Levels, string | null>;
objectID: string;
- _snippetResult: any;
- _highlightResult: any;
};
-type AgoliaResults = {
+type AlgoliaResults = {
results: {
hits: Hit[];
- nbHits: number;
- page: number;
- nbPages: number;
- hitsPerPage: number;
- exhaustiveNbHits: boolean;
- exhaustiveTypo: boolean;
- exhaustive: {
- nbHits: boolean;
- typo: boolean;
- };
- query: string;
- params: string;
- index: string;
- renderingContent: any;
- processingTimeMS: number;
}[];
};
@@ -65,7 +47,7 @@ export const algoliaSearch = async (
],
}),
method: 'POST',
- }).then((res) => res.json() as Promise<AgoliaResults>);
+ }).then((res) => res.json() as Promise<AlgoliaResults>);
const {hits} = results[0];