Skip to content

Commit

Permalink
Home page is back
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Mar 9, 2023
1 parent 2b646df commit 93369f0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 44 deletions.
45 changes: 22 additions & 23 deletions src/Tools/_framework/Paths/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { lazy, Suspense, useEffect, useRef, useState } from 'react';
import { useLoaderData, useNavigate } from 'react-router';
import { useLoaderData } from 'react-router';
import styled from 'styled-components';
import Button from '../../../_reactComponents/PanelHeaderComponents/Button';
// import { checkIfUserClearedOut } from '../../../_utils/applicationUtils';
// import PageViewer from '../../../Viewer/PageViewer';
// import { pageVariantInfoAtom, pageVariantPanelAtom } from '../../../_sharedRecoil/PageViewerRecoil';
// import { useRecoilState, useSetRecoilState } from 'recoil';
import PageViewer from '../../../Viewer/PageViewer';
import { pageVariantInfoAtom, pageVariantPanelAtom } from '../../../_sharedRecoil/PageViewerRecoil';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { Carousel } from '../../../_reactComponents/PanelHeaderComponents/Carousel';
// import RouterLogo from '../RouterLogo';

Expand Down Expand Up @@ -226,22 +226,22 @@ export async function loader(){
export function Home(props) {
const loaderData = useLoaderData();
const favorites = loaderData?.carouselData?.[3];
let navigate = useNavigate();

// const setVariantPanel = useSetRecoilState(pageVariantPanelAtom);
// const [variantInfo, setVariantInfo] = useRecoilState(pageVariantInfoAtom);

// function variantCallback(generatedVariantInfo, allPossibleVariants) {
// // console.log(">>>variantCallback",generatedVariantInfo,allPossibleVariants)
// const cleanGeneratedVariant = JSON.parse(JSON.stringify(generatedVariantInfo))
// setVariantPanel({
// index: cleanGeneratedVariant.index,
// allPossibleVariants,
// });
// setVariantInfo({
// index: cleanGeneratedVariant.index,
// });
// }
// let navigate = useNavigate();

const setVariantPanel = useSetRecoilState(pageVariantPanelAtom);
const [variantInfo, setVariantInfo] = useRecoilState(pageVariantInfoAtom);

function variantCallback(generatedVariantInfo, allPossibleVariants) {
// console.log(">>>variantCallback",generatedVariantInfo,allPossibleVariants)
const cleanGeneratedVariant = JSON.parse(JSON.stringify(generatedVariantInfo))
setVariantPanel({
index: cleanGeneratedVariant.index,
allPossibleVariants,
});
setVariantInfo({
index: cleanGeneratedVariant.index,
});
}


// let signInButton = <Button dataTest="Nav to course" size="medium" onClick={() => navigate('/course')} value="Go to Course" />
Expand Down Expand Up @@ -297,8 +297,7 @@ export function Home(props) {
background: 'white',
padding: '20px 0px 20px 0px'
}}>
<div>Doenet Example Here</div>
{/* <PageViewer
<PageViewer
key={`HPpageViewer`}
doenetML={doenetML}
flags={{
Expand All @@ -320,7 +319,7 @@ export function Home(props) {

// setIsInErrorState={setIsInErrorState}
pageIsActive={true}
/> */}
/>
</div>
</div>

Expand Down
56 changes: 35 additions & 21 deletions src/Tools/singlepage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import {
Link,
Outlet,
} from "react-router-dom";
// import { RecoilRoot } from 'recoil';
import { RecoilRoot } from 'recoil';
// import HomePage from "../_framework/Pages/HomePage";
// import CommunityPage from "../_framework/Pages/CommunityPage";
// import PortfolioPage from "../_framework/Pages/PortfolioPage";
// import PortfolioAddActivityPage from "../_framework/Pages/PortfolioAddActivityPage";

// import ToolRoot from '../_framework/NewToolRoot';
// import { MathJaxContext } from 'better-react-mathjax';
// import { mathjaxConfig } from '../../Core/utils/math';
// import DarkmodeController from '../_framework/DarkmodeController';
import ToolRoot from '../_framework/NewToolRoot';
import { MathJaxContext } from 'better-react-mathjax';
import { mathjaxConfig } from '../../Core/utils/math';
import DarkmodeController from '../_framework/DarkmodeController';
import SiteHeader from "../_framework/Paths/SiteHeader";
import Community from "../_framework/Paths/Community";
import Portfolio from "../_framework/Paths/Portfolio";
Expand All @@ -45,30 +45,44 @@ const router = createBrowserRouter([
{
path: "/",
loader: caroselLoader,
element:<Home />,
element: <RecoilRoot>
<DarkmodeController>
<MathJaxContext
version={2}
config={mathjaxConfig}
onStartup={(mathJax) => (mathJax.Hub.processSectionDelay = 0)}
>
<Home />
</MathJaxContext>
</DarkmodeController>
</RecoilRoot>,
},
{
path: "community",
element: <h1>community</h1>
},
{
path: "portfolio",
element: <h1>portfolio</h1>
},

]
},
// {
// path: "*",
// errorElement: <div>Error!</div>,
// element: <RecoilRoot>
// <DarkmodeController>
// <MathJaxContext
// version={2}
// config={mathjaxConfig}
// onStartup={(mathJax) => (mathJax.Hub.processSectionDelay = 0)}
// >
// <ToolRoot />
// </MathJaxContext>
// </DarkmodeController>
// </RecoilRoot>,
// },
{
path: "*",
errorElement: <div>Error!</div>,
element: <RecoilRoot>
<DarkmodeController>
<MathJaxContext
version={2}
config={mathjaxConfig}
onStartup={(mathJax) => (mathJax.Hub.processSectionDelay = 0)}
>
<ToolRoot />
</MathJaxContext>
</DarkmodeController>
</RecoilRoot>,
},
]);

ReactDOM.render(<RouterProvider router={router} />,
Expand Down

0 comments on commit 93369f0

Please sign in to comment.