-
Notifications
You must be signed in to change notification settings - Fork 183
feat: library section and subsection page #2032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 48 commits
5cb979d
6033db1
b1f318e
035c7fa
0db3eb5
cea088c
c2114a9
1a17ad1
871eff4
14c8657
67d2c2d
5bebab4
27dba10
b96bca3
dc101ba
e3fad17
2ee04df
563ae45
5cc77a6
22db945
198381b
3cd2a42
a5e576a
e520b21
cfea873
629e269
d36b7d7
e4357f3
d8ef2ca
c05f95f
f7925a7
d071771
9fa088f
d2e4f5c
134c4dc
b91abd6
4c5f304
a51dc22
50a73e4
1d18983
81cfb18
fdee2fb
eb6a49d
3a05e2d
976006f
fb8ab56
1bcce12
e5a508e
aea42e8
4e8bc27
e36b5ae
5205375
041db18
dc5f4f4
a905019
6498ff3
0658029
1c8518e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| * @returns The block type as a string | ||
| */ | ||
| export function getBlockType(usageKey: string): string { | ||
| if (usageKey && usageKey.startsWith('lb:')) { | ||
| if (usageKey && (usageKey.startsWith('lb:') || usageKey.startsWith('lct:'))) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change means we don't really need
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. aea42e8 |
||
| const blockType = usageKey.split(':')[3]; | ||
| if (blockType) { | ||
| return blockType; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| { | ||
| "comment": "This mock is captured from a real search result and roughly edited to match the mocks in src/library-authoring/data/api.mocks.ts", | ||
| "note": "The _formatted fields have been removed from this result and should be re-added programatically when mocking.", | ||
| "results": [ | ||
| { | ||
| "indexUid": "studio_content", | ||
| "hits": [ | ||
| { | ||
| "display_name": "Test Subsection", | ||
| "block_id": "subsection-1", | ||
| "content": { | ||
| "child_usage_keys": [ | ||
| "lb:org1:Demo_course:unit:unit-0", | ||
| "lb:org1:Demo_course:unit:unit-1", | ||
| "lb:org1:Demo_course:unit:unit-2" | ||
| ], | ||
| "child_display_names": [ | ||
| "unit block 0", | ||
| "unit block 1", | ||
| "unit block 2" | ||
| ] | ||
| }, | ||
| "tags": {}, | ||
| "collections": { | ||
| "display_name": [ | ||
| "Collection 1" | ||
| ], | ||
| "key": [ | ||
| "collection-1" | ||
| ] | ||
| }, | ||
| "id": "lctunixcs1subsectiontest-subsection-4-861b09-bc0507a2", | ||
| "type": "library_container", | ||
| "breadcrumbs": [ | ||
| { | ||
| "display_name": "CS 1" | ||
| } | ||
| ], | ||
| "created": 1748341802.87277, | ||
| "modified": 1748790449.393821, | ||
| "last_published": 1748536425.317183, | ||
| "publish_status": "modified", | ||
| "usage_key": "lct:UNIX:CS1:subsection:test-subsection-4-861b09", | ||
| "block_type": "subsection", | ||
| "context_key": "lib:UNIX:CS1", | ||
| "org": "UNIX", | ||
| "access_id": 1, | ||
| "published": { | ||
| "display_name": "Test subsection 42", | ||
| "num_children": 2, | ||
| "content": { | ||
| "child_usage_keys": [ | ||
| "lb:org1:Demo_course:unit:unit-0", | ||
| "lb:org1:Demo_course:unit:unit-1" | ||
| ], | ||
| "child_display_names": [ | ||
| "unit block 0", | ||
| "unit block 1" | ||
| ] | ||
| } | ||
| }, | ||
| "num_children": 4, | ||
| "sections": { | ||
| "display_name": [ | ||
| "Test section", | ||
| "Test section 51" | ||
| ], | ||
| "key": [ | ||
| "lct:org:lib:section:test-section-1", | ||
| "lct:org:lib:section:test-section-2" | ||
| ] | ||
| }, | ||
| "_formatted": { | ||
| "display_name": "Test Subsection", | ||
| "block_id": "subsection-1", | ||
| "content": { | ||
| "child_usage_keys": [ | ||
| "lb:org1:Demo_course:unit:unit-0", | ||
| "lb:org1:Demo_course:unit:unit-1", | ||
| "lb:org1:Demo_course:unit:unit-2" | ||
| ], | ||
| "child_display_names": [ | ||
| "unit block 0", | ||
| "unit block 1", | ||
| "unit block 2" | ||
| ] | ||
| }, | ||
| "tags": {}, | ||
| "collections": { | ||
| "display_name": [ | ||
| "Collection 1" | ||
| ], | ||
| "key": [ | ||
| "collection-1" | ||
| ] | ||
| }, | ||
| "id": "lctunixcs1subsectiontest-subsection-4-861b09-bc0507a2", | ||
| "type": "library_container", | ||
| "breadcrumbs": [ | ||
| { | ||
| "display_name": "CS 1" | ||
| } | ||
| ], | ||
| "created": "1748341802.87277", | ||
| "modified": "1748790449.393821", | ||
| "last_published": "1748536425.317183", | ||
| "publish_status": "modified", | ||
| "usage_key": "lct:UNIX:CS1:subsection:test-subsection-4-861b09", | ||
| "block_type": "subsection", | ||
| "context_key": "lib:UNIX:CS1", | ||
| "org": "UNIX", | ||
| "access_id": "1", | ||
| "published": { | ||
| "display_name": "Test subsection 42", | ||
| "num_children": "2", | ||
| "content": { | ||
| "child_usage_keys": [ | ||
| "lb:org1:Demo_course:unit:unit-0", | ||
| "lb:org1:Demo_course:unit:unit-1" | ||
| ], | ||
| "child_display_names": [ | ||
| "unit block 0", | ||
| "unit block 1" | ||
| ] | ||
| } | ||
| }, | ||
| "num_children": "4", | ||
| "sections": { | ||
| "display_name": [ | ||
| "Test section 11", | ||
| "Test section 51" | ||
| ], | ||
| "key": [ | ||
| "lct:UNIX:CS1:section:test-section-1-415565", | ||
| "lct:UNIX:CS1:section:test-section-5-0c65f3" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "query": "", | ||
| "processingTimeMs": 1, | ||
| "limit": 20, | ||
| "offset": 0, | ||
| "estimatedTotalHits": 10 | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
ReactNodetyping already includesnull