From 08e026c5ddb266663bc41eab02eecad390772dd4 Mon Sep 17 00:00:00 2001 From: Jack Keane Date: Tue, 1 Sep 2020 13:40:02 -0600 Subject: [PATCH 1/2] change home buttons from tabs to list --- src/pages/home.js | 211 +++++----------------------------------------- 1 file changed, 23 insertions(+), 188 deletions(-) diff --git a/src/pages/home.js b/src/pages/home.js index 0f8d272..4d7fa98 100644 --- a/src/pages/home.js +++ b/src/pages/home.js @@ -3,21 +3,19 @@ import React, { useState, useEffect } from 'react'; import { connect } from 'react-redux'; import { makeStyles } from '@material-ui/core/styles'; -import Tabs from '@material-ui/core/Tabs'; -import Tab from '@material-ui/core/Tab'; -import Typography from '@material-ui/core/Typography'; -import Box from '@material-ui/core/Box'; -/* import List from '@material-ui/core/List'; +import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; -import FolderIcon from '@material-ui/icons/Folder'; */ +import DescriptionIcon from '@material-ui/icons/Description'; +import DescriptionOutlinedIcon from '@material-ui/icons/DescriptionOutlined'; +import BookIcon from '@material-ui/icons/Book'; +import BookOutlinedIcon from '@material-ui/icons/BookOutlined'; import Fab from '@material-ui/core/Fab'; import { NavLink } from 'react-router-dom'; import Drawer from '@material-ui/core/Drawer'; import NavBar from '../components/navbar'; -// import TutorialOptions from '../components/tutorialOptions'; import { getDoFiles, createDoFile, getTutorialFiles } from '../actions'; @@ -28,112 +26,6 @@ const mapStateToProps = (reduxState) => ({ const drawerWidth = 248; -// temporary until we set up the database... -/* const data = { - content: { - tutorials: [ - { - mod: { - name: 'Introduction', - options: [ - { - tutorialName: 'Lesson 1.1: Getting Started', - content: 'tutorial goes here', - }, - { - tutorialName: 'Lesson 1.2: Basic Commands', - content: 'tutorial goes here', - }, - { - tutorialName: 'Lesson 1.3: Data Import/Export', - content: 'tutorial goes here', - }, - ], - }, - }, - { - mod: { - name: 'Intermediate', - options: [ - { - tutorialName: 'Lesson 2.1: Data Transformation Commands', - content: 'tutorial goes here', - }, - { - tutorialName: 'Lesson 2.1: Data Analysis Commands', - content: 'tutorial goes here', - }, - { - tutorialName: 'Lesson 2.1: Graphing Commands', - content: 'tutorial goes here', - }, - ], - }, - }, - { - mod: { - name: 'Bonus', - options: [ - { - tutorialName: 'Lesson 3.1: Bonus 1', - content: 'tutorial goes here', - }, - { - tutorialName: 'Lesson 3.2: Bonus 2', - content: 'tutorial goes here', - }, - { - tutorialName: 'Lesson 3.3: Bonus 3', - content: 'tutorial goes here', - }, - ], - }, - }, - ], - - projects: [ - { - mod: { - name: 'My Do Files', - options: [ - { - projectName: 'Hello world', - content: 'My first file', - }, - { - projectName: 'Test file', - content: 'Some other file', - }, - { - projectName: 'Example file', - content: 'A file', - }, - ], - }, - }, - { - mod: { - name: 'Other Do Files', - options: [ - { - projectName: 'Project Mod 2 Project 1', - content: 'Project goes here', - }, - { - projectName: 'Project Mod 2 Project 2', - content: 'Project goes here', - }, - { - projectName: 'Project Mod 2 Project 3', - content: 'Project goes here', - }, - ], - }, - }, - ], - }, -}; */ - const useStyles = makeStyles((theme) => ({ appBar: { zIndex: theme.zIndex.drawer + 1, @@ -147,54 +39,9 @@ const useStyles = makeStyles((theme) => ({ }, })); -function TabPanel(props) { - // eslint-disable-next-line object-curly-newline - const { children, value, index, ...other } = props; - - return ( - - ); -} - -function a11yProps(index) { - return { - id: `simple-tab-${index}`, - 'aria-controls': `simple-tabpanel-${index}`, - }; -} - -/* function populateProjectModules() { - return ( - - {data.content.projects.map((key) => ( - console.log('hello')}> - - - - - - ))} - - ); -} */ - function HomePage(props) { const classes = useStyles(); - const [value, setValue] = useState(0); const [isTutorial, setIsTutorial] = useState(null); - // const [displayModule, setDisplayModule] = useState(''); const [initialized, setInitialized] = useState(false); useEffect(() => { @@ -263,23 +110,6 @@ function HomePage(props) { }); } - const handleChange = (event, newValue) => { - setValue(newValue); - - if (newValue === 1) { - setIsTutorial(true); - } else { - setIsTutorial(false); - } - }; - - const tabStyle = { - minWidth: 124, - paddingLeft: 10, - paddingRight: 10, - backgroundColor: 'white', - }; - return (
@@ -292,19 +122,24 @@ function HomePage(props) { paper: classes.drawerPaper, }} > - - - - - {!isTutorial ? ( - - ) : ( - - )} + + setIsTutorial(false)}> + + {!isTutorial ? : } + + + + setIsTutorial(true)}> + + {isTutorial ? ( + + ) : ( + + )} + + + +
{!isTutorial ? ( From 33a6293ca9bd5a1d474fb4789a62e2e5fbd2190d Mon Sep 17 00:00:00 2001 From: Jack Keane Date: Tue, 1 Sep 2020 13:46:36 -0600 Subject: [PATCH 2/2] show current file in editor --- src/pages/codeEditor.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/codeEditor.js b/src/pages/codeEditor.js index 4246f5d..a90be20 100644 --- a/src/pages/codeEditor.js +++ b/src/pages/codeEditor.js @@ -31,6 +31,7 @@ import ExpandLessIcon from '@material-ui/icons/ExpandLess'; import DeleteIcon from '@material-ui/icons/Delete'; import Snackbar from '@material-ui/core/Snackbar'; import MuiAlert from '@material-ui/lab/Alert'; +import DescriptionOutlinedIcon from '@material-ui/icons/DescriptionOutlined'; import StorageIcon from '@material-ui/icons/Storage'; import uploadFile from '../actions/s3'; import RunButton, { UploadButton } from '../components/custom-buttons'; @@ -444,7 +445,11 @@ Statistics/Data Analysis`; onClick={() => handleFileNav(file)} > - + {props.match.params.fileid === file.id ? ( + + ) : ( + + )} @@ -466,7 +471,11 @@ Statistics/Data Analysis`; onClick={() => handleLogNav(log)} > - + {props.match.params.fileid === log.id ? ( + + ) : ( + + )}