Skip to content

Commit

Permalink
feat(Projects): automatically open OER Remixer in context of linked W…
Browse files Browse the repository at this point in the history
…orkbench
  • Loading branch information
ethanaturner committed Feb 11, 2024
1 parent ed581d4 commit 1f49ce6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
13 changes: 8 additions & 5 deletions client/src/components/projects/ProjectView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1431,11 +1431,14 @@ const ProjectView = (props) => {
}

function handleGoToRemixer() {
if(project.libreLibrary){
window.open(buildRemixerURL(project.libreLibrary));
} else {
window.open(buildRemixerURL('chem'));
}
window.open(
buildRemixerURL(
project.libreLibrary ?? 'chem',
project.didCreateWorkbench && project.libreLibrary && project.libreCoverID
? buildWorkbenchURL(project.libreLibrary, project.libreCoverID)
: undefined
)
);
}

// Rendering Helper Booleans
Expand Down
10 changes: 8 additions & 2 deletions client/src/utils/projectHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ export function buildWorkbenchURL(libreLibrary: string, libreCoverID: string) {
return `https://${libreLibrary}.libretexts.org/@go/page/${libreCoverID}`;
}

export function buildRemixerURL(libreLibrary: string) {
return `https://${libreLibrary}.libretexts.org/Under_Construction/Development_Details/OER_Remixer`;
export function buildRemixerURL(libreLibrary: string, workbenchURL: string) {
const queryParams = new URLSearchParams();
if (workbenchURL) {
queryParams.set('remixURL', workbenchURL);
queryParams.set('autoLoad', 'true');
}
const queryString = queryParams.toString();
return `https://${libreLibrary}.libretexts.org/Under_Construction/Development_Details/OER_Remixer${queryString ? `?${queryString}` : ''}`;
}

export function buildCommonsUrl(libreLibrary: string, libreCoverID: string) {
Expand Down

0 comments on commit 1f49ce6

Please sign in to comment.