feat: course libraries review tab [FC-0076] (#1699)

Adds review tab to course libraries page. Also refactors all libraries page as per new designs.
This commit is contained in:
Navin Karkera
2025-03-12 17:58:27 +00:00
committed by GitHub
parent 3aa409d065
commit 77a55d9ad3
36 changed files with 1868 additions and 712 deletions

View File

@@ -197,6 +197,7 @@ interface FetchSearchParams {
/** How many results to skip, e.g. if limit=20 then passing offset=20 gets the second page. */
offset?: number,
skipBlockTypeFetch?: boolean,
limit?: number,
}
export async function fetchSearchResults({
@@ -211,6 +212,7 @@ export async function fetchSearchResults({
sort,
offset = 0,
skipBlockTypeFetch = false,
limit = 20,
}: FetchSearchParams): Promise<{
hits: (ContentHit | CollectionHit)[],
nextOffset: number | undefined,
@@ -232,8 +234,6 @@ export async function fetchSearchResults({
const tagsFilterFormatted = formatTagsFilter(tagsFilter);
const limit = 20; // How many results to retrieve per page.
// To filter normal block types and problem types as 'OR' query
const typeFilters = [[
...blockTypesFilterFormatted,
@@ -521,29 +521,3 @@ export async function fetchTagsThatMatchKeyword({
return { matches: Array.from(matches).map((tagPath) => ({ tagPath })), mayBeMissingResults: hits.length === limit };
}
/**
* Generic one-off fetch from meilisearch index.
*/
export const fetchIndexDocuments = async (
client: MeiliSearch,
indexName: string,
filter?: Filter,
limit?: number,
attributesToRetrieve?: string[],
attributesToCrop?: string[],
sort?: SearchSortOption[],
): Promise<ContentHit[]> => {
// Convert 'extraFilter' into an array
const filterFormatted = forceArray(filter);
const { hits } = await client.index(indexName).search('', {
filter: filterFormatted,
limit,
attributesToRetrieve,
attributesToCrop,
sort,
});
return hits.map(formatSearchHit) as ContentHit[];
};