From eb307a8a14600024d6ef6b8379276d1cc83d5848 Mon Sep 17 00:00:00 2001 From: Stephen Zweibel Date: Thu, 14 Sep 2023 10:24:36 -0400 Subject: [PATCH] in process --- components/ConvertMarkdown.js | 5 +-- components/Download.js | 2 +- components/SecretComponent.js | 4 +-- components/Sidebar.js | 21 ++++++------ components/Uploads.js | 43 ++++++++++++++++++++++++ components/useWorkshop.js | 51 +++++++++++++++++++++++++++++ pages/dynamic/index.js | 61 ++++++++++------------------------- 7 files changed, 126 insertions(+), 61 deletions(-) create mode 100644 components/Uploads.js create mode 100644 components/useWorkshop.js diff --git a/components/ConvertMarkdown.js b/components/ConvertMarkdown.js index e9d7fcee..6875adbf 100644 --- a/components/ConvertMarkdown.js +++ b/components/ConvertMarkdown.js @@ -19,13 +19,10 @@ import he from 'he'; export default function ConvertMarkdown(markdown, uploads, workshop, language, setCode, setEditorOpen, setAskToRun, gitUser, gitRepo, gitFile) { - + console.log(uploads) const Imager = ({ className, ...props }) => { let newProps = { ...props }; - // if (process.env.NEXT_PUBLIC_GITHUB_ACTIONS === "true") { - // newProps.src = '/' + process.env.NEXT_PUBLIC_REPO_NAME + newProps.src; - // } const [src, setSrc] = useState(newProps.src); const builtURL = `https://raw.githubusercontent.com/${gitUser}/${gitRepo}/main/${newProps.src}` return ( diff --git a/components/Download.js b/components/Download.js index 7e29ca3f..544426b4 100644 --- a/components/Download.js +++ b/components/Download.js @@ -6,7 +6,7 @@ export default function Download(props) { const allUploads = props.allUploads; const chosenUploads = typeof props.files === 'string' ? props.files.split(',') : []; - + console.log(allUploads); var filteredUploads = []; if (chosenUploads != undefined) { diff --git a/components/SecretComponent.js b/components/SecretComponent.js index 5d783e21..7fff6a3d 100644 --- a/components/SecretComponent.js +++ b/components/SecretComponent.js @@ -1,10 +1,10 @@ -import React from 'react'; +import { useState } from 'react'; import { Button } from '@mui/material/'; import { ArrowDropDown } from '@mui/material/'; export default function SecretComponent(props) { - const [show, setShow] = React.useState(false); + const [show, setShow] = useState(false); const children = props.text; return ( diff --git a/components/Sidebar.js b/components/Sidebar.js index 080bea80..d053b1ec 100644 --- a/components/Sidebar.js +++ b/components/Sidebar.js @@ -1,4 +1,5 @@ -import * as React from 'react'; +// import * as React from 'react'; +import { useState, useEffect, Fragment} from 'react'; import Drawer from '@mui/material/Drawer'; import useMediaQuery from '@mui/material/useMediaQuery'; import Button from '@mui/material/Button'; @@ -16,7 +17,7 @@ import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; export default function SidebarDrawer({ pages, currentPage, handlePageChange }) { - const [state, setState] = React.useState({ + const [state, setState] = useState({ top: false, left: false, bottom: false, @@ -43,13 +44,13 @@ export default function SidebarDrawer({ pages, currentPage, handlePageChange }) } const newPages = rearrangePages(pages); const CollapsibleList = ({ pages }) => { - const [open, setOpen] = React.useState(false) + const [open, setOpen] = useState(false) const handleClick = () => { setOpen(!open) } return ( // top items are also pages with children - + {pages.children.length == 0 && } - {pages.children.length > 0 && + {pages.children.length > 0 && - } - + } + ) } - React.useEffect(() => { + useEffect(() => { // set the active page // const newPages = [...pages] newPages.forEach((page, index) => { @@ -130,7 +131,7 @@ export default function SidebarDrawer({ pages, currentPage, handlePageChange }) return ( // icon and button to open top drawer - +