Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/publish-pages.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -26,7 +26,7 @@ jobs:
run: yarn workspace mit-open build-storybook

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: ./frontends/mit-open/storybook-static

Expand All @@ -45,4 +45,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
14 changes: 14 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Release Notes
=============

Version 0.13.19
---------------

- change xpro ETL dict key back (#1252)
- reindexing fixes (#1247)
- Pin dependencies (#1225)
- Plain text news/events titles/authors; standardize html cleanup (#1248)
- Condensed list card components for user lists (#1251)
- Change readable_id values for podcasts and episodes (#1232)
- adjust / refactor channel detail header (#1234)
- use main not "$default-branch" (#1249)
- Update dependency ruff to v0.5.1 (#1241)
- Update dependency Django to v4.2.14 (#1240)

Version 0.13.18 (Released July 10, 2024)
---------------

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React, { useCallback, useMemo, useState } from "react"
import { LearningResourceCard, LearningResourceListCard } from "ol-components"
import {
LearningResourceCard,
LearningResourceListCard,
LearningResourceListCardCondensed,
} from "ol-components"
import * as NiceModal from "@ebay/nice-modal-react"
import type {
LearningResourceCardProps,
Expand Down Expand Up @@ -104,7 +108,9 @@ const ResourceCard: React.FC<ResourceCardProps> = ({ resource, ...others }) => {
type ResourceListCardProps = Omit<
LearningResourceListCardProps,
"href" | "onAddToLearningPathClick" | "onAddToUserListClick"
>
> & {
condensed?: boolean
}

/**
* Just like `ol-components/LearningResourceListCard`, but with builtin actions:
Expand All @@ -115,7 +121,8 @@ type ResourceListCardProps = Omit<
*/
const ResourceListCard: React.FC<ResourceListCardProps> = ({
resource,
...others
condensed,
...props
}) => {
const {
getDrawerHref,
Expand All @@ -126,16 +133,20 @@ const ResourceListCard: React.FC<ResourceListCardProps> = ({
inUserList,
inLearningPath,
} = useResourceCard(resource)

const ListCardComponent = condensed
? LearningResourceListCardCondensed
: LearningResourceListCard
return (
<>
<LearningResourceListCard
<ListCardComponent
resource={resource}
href={resource ? getDrawerHref(resource.id) : undefined}
onAddToLearningPathClick={handleAddToLearningPathClick}
onAddToUserListClick={handleAddToUserListClick}
inUserList={inUserList}
inLearningPath={inLearningPath}
{...others}
{...props}
/>
<SignupPopover anchorEl={anchorEl} onClose={handleClosePopover} />
</>
Expand Down
58 changes: 42 additions & 16 deletions frontends/mit-open/src/pages/ChannelPage/ChannelPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,43 @@ const setupApis = (

describe("ChannelPage", () => {
it("Displays the channel title, banner, and avatar", async () => {
const { channel } = setupApis()
const { channel } = setupApis({
search_filter: "offered_by=ocw",
channel_type: "unit",
})
renderTestApp({ url: `/c/${channel.channel_type}/${channel.name}` })

const title = await screen.findAllByText(channel.title)
const header = title[0].closest("header")
const findTitle = (titles: HTMLElement[]) => {
return titles[
titles.findIndex(
(title: HTMLElement) =>
title.textContent === channel.title ||
title.textContent === channel.configuration.heading,
)
]
}
await waitFor(() => {
const titles = screen.getAllByRole("heading")
const title = findTitle(titles)
expect(title).toBeInTheDocument()
})
const titles = screen.getAllByRole("heading")
const title = findTitle(titles)
expect(title).toBeInTheDocument()
const header = title.closest("header")
assertInstanceOf(header, HTMLElement)
const images = within(header).getAllByRole("img") as HTMLImageElement[]
const headerStyles = getComputedStyle(header)
expect(headerStyles.backgroundImage).toContain(
channel.configuration.banner_background,
)
if (channel.channel_type !== "unit") {
/*
* unit channels are filtered out from this assertion
* because they wrap the background image in a linear-gradient,
* which causes react testing library to not render the background-image
* property at all
*/
expect(headerStyles.backgroundImage).toContain(
channel.configuration.banner_background,
)
}
expect(images[0].src).toContain(channel.configuration.logo)
})
it("Displays a featured carousel if the channel type is 'unit'", async () => {
Expand Down Expand Up @@ -158,7 +184,7 @@ describe("ChannelPage", () => {
"platform=ocw&platform=mitxonline&department=8&department=9",
})
renderTestApp({ url: `/c/${channel.channel_type}/${channel.name}` })
await screen.findByText(channel.title)
await screen.findAllByText(channel.title)
const expectedProps = expect.objectContaining({
constantSearchParams: {
platform: ["ocw", "mitxonline"],
Expand All @@ -176,7 +202,7 @@ describe("ChannelPage", () => {
const { channel } = setupApis()
channel.search_filter = undefined
renderTestApp({ url: `/c/${channel.channel_type}/${channel.name}` })
await screen.findByText(channel.title)
await screen.findAllByText(channel.title)

expect(mockedChannelSearch).toHaveBeenCalledTimes(0)
})
Expand All @@ -185,17 +211,17 @@ describe("ChannelPage", () => {
const { channel } = setupApis()
channel.search_filter = undefined
renderTestApp({ url: `/c/${channel.channel_type}/${channel.name}` })
await screen.findByText(channel.title)
await screen.findAllByText(channel.title)

await waitFor(() => {
expect(
screen.getByText(channel.configuration.sub_heading),
).toBeInTheDocument()
screen.getAllByText(channel.configuration.sub_heading).forEach((el) => {
expect(el).toBeInTheDocument()
})
})
await waitFor(() => {
expect(
screen.getByText(channel.configuration.heading),
).toBeInTheDocument()
screen.getAllByText(channel.configuration.heading).forEach((el) => {
expect(el).toBeInTheDocument()
})
})
})

Expand Down
14 changes: 7 additions & 7 deletions frontends/mit-open/src/pages/ChannelPage/ChannelPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react"
import { useParams } from "react-router"
import ChannelPageSkeleton from "./ChannelPageSkeleton"
import { ChannelPageTemplate } from "./ChannelPageTemplate"
import { useChannelDetail } from "api/hooks/channels"
import FieldSearch from "./ChannelSearch"
import type {
Facets,
FacetKey,
BooleanFacets,
import {
type Facets,
type FacetKey,
type BooleanFacets,
} from "@mitodl/course-search-utils"
import { ChannelTypeEnum } from "api/v0"
import TestimonialDisplay from "@/page-components/TestimonialDisplay/TestimonialDisplay"
Expand Down Expand Up @@ -41,7 +41,7 @@ const ChannelPage: React.FC = () => {
return (
name &&
channelType && (
<ChannelPageSkeleton name={name} channelType={channelType}>
<ChannelPageTemplate name={name} channelType={channelType}>
<p>{channelQuery.data?.public_description}</p>
{channelType === "unit" ? (
<StyledTestimonialDisplay offerors={[name]} />
Expand All @@ -52,7 +52,7 @@ const ChannelPage: React.FC = () => {
channelType={channelType}
/>
)}
</ChannelPageSkeleton>
</ChannelPageTemplate>
)
)
}
Expand Down
Loading