Skip to content

Commit

Permalink
drawer topic carousels should not be filtered on just courses (#1984)
Browse files Browse the repository at this point in the history
* drawer topic carousels should not be filtered on just courses

* rename argument
  • Loading branch information
gumaerc authored Jan 24, 2025
1 parent 63c0b7b commit 117af25
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 4 additions & 1 deletion frontends/main/src/app-pages/DashboardPage/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import UserListDetailsTab from "./UserListDetailsTab"
import { SettingsPage } from "./SettingsPage"
import { DASHBOARD_HOME, MY_LISTS, PROFILE, SETTINGS } from "@/common/urls"
import dynamic from "next/dynamic"
import { ResourceTypeEnum } from "api"

const LearningResourceDrawer = dynamic(
() =>
Expand Down Expand Up @@ -451,7 +452,9 @@ const DashboardPage: React.FC = () => {
titleComponent="h2"
title={`Popular courses in ${topic}`}
isLoading={isLoadingProfile}
config={TopicCarouselConfig(topic)}
config={TopicCarouselConfig(topic, [
ResourceTypeEnum.Course,
])}
data-testid={`topic-carousel-${topic}`}
/>
))}
Expand Down
17 changes: 13 additions & 4 deletions frontends/main/src/common/carousels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import type { ResourceCarouselProps } from "@/page-components/ResourceCarousel/ResourceCarousel"
import { LearningResourcesSearchRetrieveDeliveryEnum } from "api"
import type {
ResourceCarouselProps,
TabConfig,
} from "@/page-components/ResourceCarousel/ResourceCarousel"
import {
LearningResourcesSearchRetrieveDeliveryEnum,
LearningResourcesSearchRetrieveResourceTypeEnum,
} from "api"
import { Profile } from "api/v0"

type TopPicksCarouselConfigProps = (
Expand Down Expand Up @@ -38,26 +44,29 @@ const TopPicksCarouselConfig: TopPicksCarouselConfigProps = (

type TopicCarouselConfigProps = (
topic: string | undefined,
resourceTypes?: LearningResourcesSearchRetrieveResourceTypeEnum[] | undefined,
) => ResourceCarouselProps["config"]

const TopicCarouselConfig: TopicCarouselConfigProps = (
topic: string | undefined,
resourceTypes?: LearningResourcesSearchRetrieveResourceTypeEnum[] | undefined,
) => {
return [
const config: TabConfig[] = [
{
label: "All",
cardProps: { size: "small" },
data: {
type: "lr_search",
params: {
resource_type: ["course"],
resource_type: resourceTypes || [],
limit: 12,
topic: [topic || ""],
sortby: "-views",
},
},
},
]
return config
}

const CERTIFICATE_COURSES_CAROUSEL: ResourceCarouselProps["config"] = [
Expand Down

0 comments on commit 117af25

Please sign in to comment.