Skip to content

Commit

Permalink
Fixed two more missing tool root updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Mar 30, 2023
1 parent 2128239 commit bb11479
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 14 deletions.
40 changes: 27 additions & 13 deletions src/Tools/_framework/Paths/PortfolioActivitySettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { useDropzone } from 'react-dropzone';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFileImage } from '@fortawesome/free-solid-svg-icons';
import { Box, Image } from '@chakra-ui/react';
import { useSetRecoilState } from 'recoil';
import { pageToolViewAtom } from '../NewToolRoot';


export async function action({ request, params }) {
Expand Down Expand Up @@ -137,6 +139,8 @@ export function PortfolioActivitySettings(){
let data = useLoaderData();
const navigate = useNavigate();
let numberOfFilesUploading = useRef(0);
const setPageToolView = useSetRecoilState(pageToolViewAtom);


let [imagePath,setImagePath] = useState(data.imagePath);

Expand Down Expand Up @@ -217,7 +221,7 @@ export function PortfolioActivitySettings(){
<Form method="post">
<MainGrid>
<Slot1>
<div>{data.isNew ? <h1>Add Activity</h1> : <h1>Activity Settings</h1>}</div>
<div><h1>Activity Settings</h1></div>
</Slot1>
<Slot2>
<Table>
Expand Down Expand Up @@ -279,18 +283,28 @@ export function PortfolioActivitySettings(){
</Table>
</Slot2>
<Slot3>

{data.isNew ? <SideBySide>
<Button alert value="Cancel" onClick={(e) => {e.preventDefault(); navigate(-1)}}/>
<Button type="submit" value="Create" />
</SideBySide>
:
<SideBySide>
<Button alert value="Cancel" onClick={(e) => {e.preventDefault(); navigate(-1)}}/>
<Button type="submit" value="Update" />
</SideBySide>
}

<SideBySide>
<Button alert value="Cancel" onClick={(e) => {
e.preventDefault();
//Assume that they came from the editor to orient Tool Root
setPageToolView({
page: 'portfolioeditor',
tool: 'editor',
view: '',
params:{},
});
navigate(-1);
}}/>
<Button type="submit" value="Update" onClick={()=>{
//Assume that they came from the editor to orient Tool Root
setPageToolView({
page: 'portfolioeditor',
tool: 'editor',
view: '',
params:{},
});
}} />
</SideBySide>
</Slot3>
</MainGrid>
<input type="hidden" name="imagePath" value={imagePath}></input>
Expand Down
14 changes: 13 additions & 1 deletion src/Tools/_framework/Paths/PortfolioActivityViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useRecoilState, useSetRecoilState } from 'recoil';
import { checkIfUserClearedOut } from '../../../_utils/applicationUtils';
import { Link } from 'react-router-dom';
import { Avatar } from '@chakra-ui/react';
import { pageToolViewAtom } from '../NewToolRoot';

export async function loader({params}){
//Check if signedIn
Expand Down Expand Up @@ -141,6 +142,8 @@ export function PortfolioActivityViewer() {
} = useLoaderData();

const navigate = useNavigate();
const setPageToolView = useSetRecoilState(pageToolViewAtom);


const setVariantPanel = useSetRecoilState(pageVariantPanelAtom);
const [variantInfo, setVariantInfo] = useRecoilState(pageVariantInfoAtom);
Expand Down Expand Up @@ -168,7 +171,16 @@ export function PortfolioActivityViewer() {
<Avatar size='sm' name={fullName} /> <Byline>By {fullName}</Byline></AvatarLink></HeaderSectionLeft>
</div>
<div>
<HeaderSectionRight><Button value="See Inside" onClick={()=>navigate(`/public?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`)} /></HeaderSectionRight>
<HeaderSectionRight><Button value="See Inside" onClick={()=>{
setPageToolView({
page: 'public',
tool: 'editor',
view: '',
params:{},
});
navigate(`/public?tool=editor&doenetId=${doenetId}&pageId=${pageDoenetId}`)
}
} /></HeaderSectionRight>
{signedIn ? <HeaderSectionRight><Button value="Remix" onClick={()=>{}} /></HeaderSectionRight> : null}
</div>
</HeaderContent>
Expand Down

0 comments on commit bb11479

Please sign in to comment.