Skip to content

Commit

Permalink
Fixes for links and recoil root
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Mar 30, 2023
1 parent 74b27cf commit 062c36c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Tools/_framework/Paths/Portfolio.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function action({request}) {

if (response.ok) {
let { doenetId, pageDoenetId } = await response.json();
return redirect(`/portfolioeditor?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`);
return redirect(`/portfolioeditor/${doenetId}?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`);
}else{
throw Error(response.message)
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/_framework/Paths/PortfolioActivitySettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function action({ request, params }) {
})

if (referrer == "portfolioeditor"){
return redirect(`/portfolioeditor?tool=editor&doenetId=${updates.doenetId}&pageId=${updates.pageDoenetId}`)
return redirect(`/portfolioeditor/${updates.doenetId}?tool=editor&doenetId=${updates.doenetId}&pageId=${updates.pageDoenetId}`)
}else{
const portfolioCourseId = response.data.portfolioCourseId;
return redirect(`/portfolio/${portfolioCourseId}`)
Expand Down
26 changes: 11 additions & 15 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,27 @@ const router = createBrowserRouter([
{
path: "/",
loader: siteLoader,
element: <RecoilRoot><ChakraProvider theme={theme}><SiteHeader /></ChakraProvider></RecoilRoot>,
element: <ChakraProvider theme={theme}><SiteHeader /></ChakraProvider>,
children: [
{
path: "/",
loader: caroselLoader,
element: (<RecoilRoot>
element: (
<DarkmodeController>
<MathJaxContext
version={2}
config={mathjaxConfig}
onStartup={(mathJax) => (mathJax.Hub.processSectionDelay = 0)}
>
<Home />
<ChakraProvider theme={theme}><Home /></ChakraProvider>
</MathJaxContext>
</DarkmodeController>
</RecoilRoot>),
),
},
{
path: "community",
loader: caroselLoader,
element: <Community />,
element: <ChakraProvider theme={theme}><Community /></ChakraProvider>,
},
{
path: "portfolio/:courseId",
Expand All @@ -88,7 +88,7 @@ const router = createBrowserRouter([
path: "/portfolio/:doenetId/viewer",
loader: portfolioActivityViewerLoader,
// action: portfolioActivitySettingsAction,
element: (<RecoilRoot>
element: (
<DarkmodeController>
<MathJaxContext
version={2}
Expand All @@ -100,21 +100,20 @@ const router = createBrowserRouter([
</ChakraProvider>
</MathJaxContext>
</DarkmodeController>
</RecoilRoot>),
),
},
{
path: "/portfolio/:doenetId/settings",
loader: portfolioActivitySettingsLoader,
action: portfolioActivitySettingsAction,
ErrorBoundary: portfolioActivitySettingsError,
element: <RecoilRoot><PortfolioActivitySettings /></RecoilRoot>,
element: <PortfolioActivitySettings />,
},
{
path: "/portfolioeditor/:doenetId",
loader: portfolioEditorMenuCapLoader,
// errorElement: <div>Error!</div>,
element: (
<RecoilRoot>
<DarkmodeController>
<MathJaxContext
version={2}
Expand All @@ -124,14 +123,12 @@ const router = createBrowserRouter([
<ToolRoot />
</MathJaxContext>
</DarkmodeController>
</RecoilRoot>

),
},
{
path: "*",
// errorElement: <div>Error!</div>,
element: (<RecoilRoot>
element: (
<DarkmodeController>
<MathJaxContext
version={2}
Expand All @@ -140,11 +137,10 @@ const router = createBrowserRouter([
>
<ToolRoot />
</MathJaxContext>
</DarkmodeController>
</RecoilRoot>),
</DarkmodeController>),
},

]);

const root = createRoot(document.getElementById('root'));
root.render(<RouterProvider router={router} />);
root.render(<RecoilRoot><RouterProvider router={router} /></RecoilRoot>);

0 comments on commit 062c36c

Please sign in to comment.