Skip to content

Commit 8050726

Browse files
authored
dashboard home org cards (#2630)
* add cards to dashboard home page for each org contract * display contract name on org tab * fix tests * add tests * don't pass in empty dict * fix mobile tab title * fix typescript issue * use paginated factory for contracts * simplify user query * pass OrganizationPage directly in and rename props * missed one property * restyle card for multiple contracts as indicated in figma * bold the org name in the tab * fix typescript error * updated mobile styling * fix bottom border on mobile cards * don't use separate queries for contracts because they're already coming across as part of the org
1 parent e137067 commit 8050726

File tree

10 files changed

+695
-28
lines changed

10 files changed

+695
-28
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { faker } from "@faker-js/faker/locale/en"
2+
import type { ContractPage } from "@mitodl/mitxonline-api-axios/v2"
3+
import { makePaginatedFactory } from "ol-test-utilities"
4+
5+
const contract = (overrides: Partial<ContractPage> = {}): ContractPage => ({
6+
id: faker.number.int(),
7+
active: true,
8+
contract_end: faker.date.future().toISOString(),
9+
contract_start: faker.date.past().toISOString(),
10+
description: faker.lorem.sentence(),
11+
integration_type: "non-sso" as const,
12+
name: faker.company.name(),
13+
organization: faker.number.int(),
14+
slug: faker.lorem.slug(),
15+
membership_type: faker.helpers.arrayElement(["managed", "unmanaged"]),
16+
...overrides,
17+
})
18+
19+
const contracts = makePaginatedFactory(contract)
20+
21+
export { contract, contracts }

frontends/api/src/mitxonline/test-utils/factories/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as courses from "./courses"
55
import * as organizations from "./organization"
66
import * as user from "./user"
77
import * as requirements from "./requirements"
8+
import * as contracts from "./contracts"
89

910
export {
1011
mitx as enrollment,
@@ -14,4 +15,5 @@ export {
1415
user,
1516
pages,
1617
requirements,
18+
contracts,
1719
}

frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/DashboardCard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,4 +540,8 @@ const DashboardCard: React.FC<DashboardCardProps> = ({
540540
)
541541
}
542542

543-
export { DashboardCard, getDefaultContextMenuItems }
543+
export {
544+
DashboardCard,
545+
CardRoot as DashboardCardRoot,
546+
getDefaultContextMenuItems,
547+
}

frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/EnrollmentDisplay.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const Wrapper = styled.div(({ theme }) => ({
3030
padding: "0",
3131
},
3232
}))
33+
3334
const DashboardCardStyled = styled(DashboardCard)({
3435
borderRadius: "8px",
3536
boxShadow: "0px 1px 6px 0px rgba(3, 21, 45, 0.05)",

0 commit comments

Comments
 (0)