Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5b290bc
remove padding from FieldControls element
shanbady Jun 11, 2024
4b63ed8
making margin on breadcrumb 16px
shanbady Jun 11, 2024
c701be5
font size adjustments
shanbady Jun 11, 2024
3e271da
fixing width for right panel
shanbady Jun 11, 2024
6032b84
adding mail outline icon
shanbady Jun 11, 2024
165fcd6
adjusting margins around text container and subscribe button
shanbady Jun 11, 2024
b5d3eb7
visual tweaks
shanbady Jun 11, 2024
c4d4f90
changing body text
shanbady Jun 11, 2024
66a0fd3
minor visual tweaks
shanbady Jun 11, 2024
f623538
padding tweaks
shanbady Jun 11, 2024
e96ede0
fixing background placement and padding adjustments
shanbady Jun 11, 2024
7a06117
Merge branch 'main' into shanbady/topic-channel-page-header-fixes
shanbady Jun 11, 2024
ce18b20
style fixes
shanbady Jun 11, 2024
a5eaa51
slight width adjustment
shanbady Jun 11, 2024
0f37a53
font fixes
shanbady Jun 11, 2024
2f04538
ui tweaks
shanbady Jun 12, 2024
2e8a4da
removing unused alt attributes
shanbady Jun 12, 2024
9a72754
adding reversed banner images
shanbady Jun 12, 2024
9a45c26
Revert "adding reversed banner images"
shanbady Jun 12, 2024
88ece46
Reapply "adding reversed banner images"
shanbady Jun 12, 2024
0b3b0ee
adding dimmable background
shanbady Jun 12, 2024
25009ca
some lint
shanbady Jun 12, 2024
23cc337
removing some margin
shanbady Jun 12, 2024
4d9e426
removing duplicate css
shanbady Jun 12, 2024
d5b1997
fixing lint
shanbady Jun 12, 2024
cd1ead3
fixing broken test
shanbady Jun 12, 2024
7d41f1c
background image size adjustment
shanbady Jun 12, 2024
a97aec9
adding default bg constant
shanbady Jun 12, 2024
64f5463
fixing background dimming and zindex issues
shanbady Jun 12, 2024
edc51ef
fixing banner padding to match figma
shanbady Jun 13, 2024
7e332f4
fixing responsive sizing of channel box
shanbady Jun 13, 2024
0e9775d
fixing padding
shanbady Jun 13, 2024
599eb9c
fix ordering of elements
shanbady Jun 13, 2024
baa4149
lint fix and padding
shanbady Jun 13, 2024
b7e97b9
fixing interior padding for sm dimension
shanbady Jun 13, 2024
22e291b
lint fix
shanbady Jun 13, 2024
4035eb6
lint fix
shanbady Jun 13, 2024
af8493d
padding adjustment
shanbady Jun 13, 2024
a5aa4bd
pushed fix for padding
shanbady Jun 14, 2024
59cb03a
revert heading change
shanbady Jun 14, 2024
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
Binary file modified frontends/mit-open/public/images/unit_banners/see.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontends/mit-open/public/images/unit_banners/xpro.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const FACETS_BY_CHANNEL_TYPE: Record<ChannelTypeEnum, string[]> = {
[ChannelTypeEnum.Unit]: [
"offerings",
"audience",
"fee",
"formats",
"content_types",
"certifications",
Expand All @@ -47,34 +48,42 @@ const getFacetManifest = (channelType: ChannelTypeEnum) => {
{
name: "topic",
title: "Topic",
order: 0,
},
{
name: "formats",
title: "Formats",
order: 0,
},
{
name: "fee",
title: "Fee",
order: 0,
},
{
name: "department",
title: "Department",
order: 0,
},
{
name: "offerings",
title: "Offerings",
order: -1,
},
{
name: "level",
title: "Level",
order: 0,
},
{
name: "content_types",
title: "Type of Content",
order: 0,
},
{
name: "audience",
title: "Audience",
order: 0,
},
{
name: "more_information",
Expand All @@ -84,22 +93,27 @@ const getFacetManifest = (channelType: ChannelTypeEnum) => {
{channelTitle} website <OpenInNewIcon fontSize="inherit" />
</a>
),
order: 1,
},
{
name: "platform",
title: "Platform",
order: 0,
},
{
name: "offered_by",
title: "Offered By",
order: 0,
},
{
name: "certifications",
title: "Certificate",
order: 0,
},
{
name: "learning_format",
title: "Format",
order: 0,
labelFunction: (key: string) =>
key
.split("_")
Expand Down Expand Up @@ -127,12 +141,15 @@ const InfoLabel = styled(Typography)(({ theme }) => ({
const ChannelDetailsCard = styled(Box)(({ theme }) => ({
borderRadius: "12px",
backgroundColor: "white",
minWidth: "300px",
padding: "32px",
padding: "36px",
display: "flex",
flexDirection: "column",
gap: "16px",
[theme.breakpoints.up("md")]: {
minWidth: "408px",
},
[theme.breakpoints.down("md")]: {
padding: "16px",
width: "100%",
},
}))
Expand All @@ -142,36 +159,45 @@ const ChannelDetails: React.FC<ChannelDetailsProps> = (props) => {
const channelDetails = getChannelDetails(field)
const channelType = field.channel_type
const channelTitle = field.title

const facetManifest = useMemo(
() => getFacetManifest(channelType),
[channelType],
)

const body = facetManifest.map((value) => {
const detailValue = (
channelDetails as unknown as { [key: string]: string }
)[value.name]
if (detailValue) {
const label = value?.labelFunction
? value.labelFunction(detailValue, channelTitle)
: detailValue
const body = facetManifest
.sort((a, b) =>
a?.order && b?.order && a?.order > b?.order
? 1
: a?.order && b?.order && b?.order > a?.order
? -1
: 0,
)
.map((value) => {
const detailValue = (
channelDetails as unknown as { [key: string]: string }
)[value.name]
if (detailValue) {
const label = value?.labelFunction
? value.labelFunction(detailValue, channelTitle)
: detailValue

return (
<Box key={value.title}>
<InfoLabel
variant="subtitle2"
sx={{ marginBottom: (theme) => theme.typography.pxToRem(4) }}
>
{value.title}:
</InfoLabel>
<Typography variant="body3" color="text.secondary">
{Array.isArray(label) ? label.join(" | ") : label}
</Typography>
</Box>
)
}
return null
})
return (
<Box key={value.title}>
<InfoLabel
variant="subtitle2"
sx={{ marginBottom: (theme) => theme.typography.pxToRem(4) }}
>
{value.title}
</InfoLabel>
<Typography variant="body3" color="text.secondary">
{Array.isArray(label) ? label.join(" | ") : label}
</Typography>
</Box>
)
}
return null
})
return <ChannelDetailsCard>{body}</ChannelDetailsCard>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { SimpleMenuItem } from "ol-components"
import ExpandMoreSharpIcon from "@mui/icons-material/ExpandMoreSharp"
import { useUserMe } from "api/hooks/user"
import { SourceTypeEnum } from "api"
import MailOutlineIcon from "@mui/icons-material/MailOutline"

const SearchSubscriptionToggle = ({
searchParams,
Expand Down Expand Up @@ -71,6 +72,7 @@ const SearchSubscriptionToggle = ({
<Button
variant="primary"
disabled={subscriptionCreate.isLoading}
startIcon={<MailOutlineIcon />}
onClick={() =>
subscriptionCreate.mutateAsync({
PercolateQuerySubscriptionRequestRequest: subscribeParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const ArticlesDetailPage: React.FC = () => {
return (
<BannerPage
src="/static/images/course_search_banner.png"
alt=""
className="articles-detail-page"
>
<MetaTags>
Expand Down
8 changes: 5 additions & 3 deletions frontends/mit-open/src/pages/FieldPage/FieldPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ describe("FieldPage", () => {
const header = title[0].closest("header")
assertInstanceOf(header, HTMLElement)
const images = within(header).getAllByRole("img") as HTMLImageElement[]

expect(images[0].src).toContain(field.configuration.banner_background)
expect(images[1].src).toContain(field.configuration.logo)
const headerStyles = getComputedStyle(header)
expect(headerStyles.backgroundImage).toContain(
field.configuration.banner_background,
)
expect(images[0].src).toContain(field.configuration.logo)
})

it("Displays the field search if search_filter is not undefined", async () => {
Expand Down
54 changes: 37 additions & 17 deletions frontends/mit-open/src/pages/FieldPage/FieldPageSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const FieldControls = styled.div`
position: relative;
min-height: 38px;
display: flex;
margin-bottom: 1em;
`

interface FieldSkeletonProps {
Expand All @@ -42,7 +41,10 @@ const NAV_PATH: { [key: string]: string } = {

const NavText = styled(Typography)(({ theme }) => ({
color: theme.custom.colors.lightGray2,
marginBottom: "10px",
marginBottom: "16px",
[theme.breakpoints.down("md")]: {
marginBottom: "32px",
},
".current": {
color: theme.custom.colors.silverGrayLight,
},
Expand All @@ -68,10 +70,11 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
displayConfiguration?.banner_background ??
"/static/images/background_steps.jpeg"
}
alt=""
omitBackground={field.isLoading}
backgroundSize="2000px auto"
dim={30}
bannerContent={
<Container sx={{ my: 2, py: "48px" }}>
<Container sx={{ pt: "48px", pb: "64px" }}>
<NavText variant="subtitle3">
Home / {NAV_PATH[channelType]} /{" "}
<span className="current">{field.data?.title}</span>
Expand All @@ -94,13 +97,28 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
display="flex"
flexDirection="column"
alignItems="start"
sx={{ flexGrow: 24, flexShrink: 0, order: 1, width: "60%" }}
sx={{
flexGrow: 1,
flexShrink: 0,
order: 1,
width: "50%",
}}
>
<Box
display="flex"
flexDirection="row"
alignItems="center"
sx={{ flexGrow: 1, flexShrink: 0, order: 1, mt: 3 }}
sx={(theme) => ({
flexGrow: 1,
flexShrink: 0,
order: 1,
py: "24px",

[theme.breakpoints.down("md")]: {
py: 0,
pb: "8px",
},
})}
>
{displayConfiguration?.logo ? (
<FieldAvatar
Expand All @@ -110,7 +128,7 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
field={field.data}
/>
) : (
<Typography variant="h3" data-testid="header">
<Typography variant="h1" data-testid="header">
<Link
to={routes.makeFieldViewPath(
field.data.channel_type,
Expand All @@ -131,8 +149,8 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
flexGrow: 0,
flexShrink: 0,
order: 2,
width: "90%",
my: 2,
width: { md: "80%", sm: "100%" },
my: 1,
}}
>
<Typography variant="h4">
Expand All @@ -150,11 +168,11 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
flexGrow: 0,
flexShrink: 0,
order: 2,
width: "60%",
my: 2,
width: { md: "80%", sm: "100%" },
my: 1,
}}
>
<Typography variant="body2">
<Typography variant="body1">
{displayConfiguration.sub_heading}
</Typography>
</Box>
Expand All @@ -168,7 +186,8 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
width: "100%",
flexShrink: 1,
order: 3,
my: 2,
mt: { xs: "8px" },
mb: { xs: "48px" },
}}
>
<FieldControls>
Expand Down Expand Up @@ -196,9 +215,9 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
display="flex"
sx={{
order: 2,
flexGrow: 1,
flexGrow: 0,
flexShrink: 0,
width: { md: "300px", xs: "100%" },
width: { md: "408px", xs: "100%" },
}}
>
<ChannelDetails field={field.data} />
Expand All @@ -209,11 +228,12 @@ const FieldSkeletonProps: React.FC<FieldSkeletonProps> = ({
flexDirection="row"
alignItems="end"
sx={{
flexGrow: 1,
flexGrow: 0,
width: { md: "15%", xs: "100%" },
flexShrink: 0,
order: 2,
my: 1,
mt: { md: "0px", sm: "8px" },
mb: { md: "0px", sm: "48px" },
}}
>
<FieldControls>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ const LearningPathListingPage: React.FC = () => {
return (
<BannerPage
src="/static/images/course_search_banner.png"
alt=""
className="learningpaths-page"
>
<MetaTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ const ListDetailsPage: React.FC<ListDetailsPageProps> = ({
return (
<BannerPage
src="/static/images/course_search_banner.png"
alt=""
className="learningpaths-page"
>
<MetaTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ const UserListListingPage: React.FC = () => {
return (
<BannerPage
src="/static/images/course_search_banner.png"
alt=""
className="learningpaths-page"
>
<MetaTags>
Expand Down
Loading