Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions client/src/components/commons/CommonsCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ const CommonsCatalog = () => {
return;
}

// Authors and minirepos always use React Query (no browse endpoints)
if (activeTab === "authors") {
authorsSearch.fetchNextPage();
return;
}
if (activeTab === "minirepos") {
miniReposSearch.fetchNextPage();
return;
}

// In search mode, use React Query's fetchNextPage
if (isSearchMode) {
switch (activeTab) {
Expand All @@ -498,12 +508,6 @@ const CommonsCatalog = () => {
case "projects":
if (isProjectsSearchMode) projectsSearch.fetchNextPage();
break;
case "authors":
authorsSearch.fetchNextPage();
break;
case "minirepos":
miniReposSearch.fetchNextPage();
break;
}
} else {
// In browse mode, manually load more with incremented page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Card, CardContentProps, CardHeader } from "semantic-ui-react";
import { ConductorSearchResponseAuthor } from "../../../../types";
import { Author } from "../../../../types";
import { truncateString } from "../../../util/HelperFunctions";
import { useMemo } from "react";
import CardMetaWIcon from "../../../util/CardMetaWIcon";

interface AuthorCardContentProps extends CardContentProps {
author: ConductorSearchResponseAuthor;
author: Author;
}

const AuthorCardContent: React.FC<AuthorCardContentProps> = ({
Expand All @@ -29,26 +29,6 @@ const AuthorCardContent: React.FC<AuthorCardContentProps> = ({
<div className="line-clamp-1">{truncateString(author.companyName || author.programName || "", 50)}</div>
</CardMetaWIcon>
)}
{author.projects?.length > 0 && (
<CardMetaWIcon icon="wrench">
<div className="line-clamp-2">
{author.projects.map((p, idx) => (
<a
href={`/commons-project/${p.projectID}`}
key={p.projectID}
className="hover:underline cursor-pointer !text-blue-500 !hover:text-blue-500"
>
{`${p.title}${
author.projects.length > 1 &&
idx !== author.projects.length - 1
? ", "
: ""
}`}
</a>
))}
</div>
</CardMetaWIcon>
)}
{author.nameURL && (
<CardMetaWIcon icon="linkify">
<div className="line-clamp-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Link } from "react-router-dom";
import { Card, CardProps } from "semantic-ui-react";
import {
Book,
ConductorSearchResponseAuthor,
Author,
ConductorSearchResponseFile,
Project,
} from "../../../../types";
Expand All @@ -18,7 +18,7 @@ interface CatalogCardProps extends CardProps {
| Book
| ConductorSearchResponseFile
| Project
| ConductorSearchResponseAuthor;
| Author;
onDetailClick?: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Modal } from "semantic-ui-react";
import {
Book,
ConductorSearchResponseAuthor,
Author,
ConductorSearchResponseFile,
Project,
} from "../../../../types";
Expand All @@ -12,7 +12,7 @@ interface DetailModalProps {
| Book
| ConductorSearchResponseFile
| Project
| ConductorSearchResponseAuthor;
| Author;
open: boolean;
onClose: () => void;
}
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/commons/CommonsCatalog/VisualMode.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Book,
ConductorSearchResponseAuthor,
Author,
ConductorSearchResponseFile,
Project,
} from "../../../types";
Expand All @@ -19,7 +19,7 @@ const VisualMode = ({
| Book
| ConductorSearchResponseFile
| Project
| ConductorSearchResponseAuthor
| Author
)[];
loading?: boolean;
noResultsMessage?: string;
Expand All @@ -29,7 +29,7 @@ const VisualMode = ({
| Book
| ConductorSearchResponseFile
| Project
| ConductorSearchResponseAuthor
| Author
| undefined
>(undefined);

Expand Down
4 changes: 2 additions & 2 deletions client/src/context/CatalogContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
Book,
BookFilters,
CommonsModule,
ConductorSearchResponseAuthor,
Author,
ConductorSearchResponseFile,
Project,
ProjectFilters,
Expand Down Expand Up @@ -51,7 +51,7 @@ export interface CatalogContextValue {
miniRepos: CatalogEntityData<Project, ProjectFilters>;

// Authors entity
authors: CatalogEntityData<ConductorSearchResponseAuthor, AuthorFilters>;
authors: CatalogEntityData<Author, AuthorFilters>;

// Stop loading trigger (for infinite scroll)
triggerStopLoading: () => void;
Expand Down
5 changes: 1 addition & 4 deletions client/src/types/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ export type UserSearchParams = {
sort?: "first" | "last";
} & _commonSearchParams;

export type ConductorSearchResponseAuthor = Author & {
projects: Pick<Project, "projectID" | "title">[];
};
export type ConductorSearchResponseFile = ProjectFileWProjectData<
"title" | "thumbnail" | "description" | "projectURL"
>;
Expand All @@ -112,7 +109,7 @@ export type ConductorSearchResponse<
: T extends "users"
? User[]
: T extends "authors"
? ConductorSearchResponseAuthor[]
? Author[]
: T extends "minirepos"
? Project[]
: never;
Expand Down
3 changes: 0 additions & 3 deletions server/api/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import Author from "../models/author.js";
import Fuse from "fuse.js";
import Organization from "../models/organization.js";
import AssetTagFramework from "../models/assettagframework.js";
import authorsAPI from "./authors.js";
import SearchQuery, {
SearchQueryInterface_Raw,
} from "../models/searchquery.js";
Expand All @@ -37,7 +36,6 @@ import { _getBookPublicOrInstructorAssetsCount, buildOrganizationNamesList } fro
import CustomCatalog, { CustomCatalogInterface } from "../models/customcatalog.js";
import { normalizedSort } from "../util/searchutils.js";
import SearchService from "./services/search-service.js";
import AuthorService from "./services/author-service.js";

const searchQueryCache: SearchQueryInterface_Raw[] = []; // in-memory cache for search queries

Expand Down Expand Up @@ -1892,7 +1890,6 @@ async function authorsSearch(
nameKey: { $exists: true, $ne: null },
},
},
AuthorService.LOOKUP_AUTHOR_PROJECTS_STAGE,
{
$project: {
userUUID: 0,
Expand Down
1 change: 1 addition & 0 deletions server/models/supporticketmessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ SupportTicketMessageSchema.virtual("sender", {
});

SupportTicketMessageSchema.index({ uuid: 1 });
SupportTicketMessageSchema.index({ ticket: 1, type: 1, createdAt: -1 });
SupportTicketMessageSchema.set("toObject", { virtuals: true });
SupportTicketMessageSchema.set("toJSON", { virtuals: true });

Expand Down
Loading