Skip to content

Commit

Permalink
Merge pull request #75 from dartmouth-cs52-20X/jk/finaltouches
Browse files Browse the repository at this point in the history
Jk/finaltouches
  • Loading branch information
jakeane authored Sep 1, 2020
2 parents bbd1377 + 33a6293 commit a7e7c65
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 190 deletions.
13 changes: 11 additions & 2 deletions src/pages/codeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -452,7 +453,11 @@ Statistics/Data Analysis`;
onClick={() => handleFileNav(file)}
>
<ListItemIcon>
<Description />
{props.match.params.fileid === file.id ? (
<Description />
) : (
<DescriptionOutlinedIcon />
)}
</ListItemIcon>
<ListItemText primary={file.fileName} />
</ListItem>
Expand All @@ -474,7 +479,11 @@ Statistics/Data Analysis`;
onClick={() => handleLogNav(log)}
>
<ListItemIcon>
<Description />
{props.match.params.fileid === log.id ? (
<Description />
) : (
<DescriptionOutlinedIcon />
)}
</ListItemIcon>
<ListItemText primary={log.fileName} />
</ListItem>
Expand Down
211 changes: 23 additions & 188 deletions src/pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
Expand All @@ -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 (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && (
<Box p={0}>
<Typography component="span">{children}</Typography>
</Box>
)}
</div>
);
}

function a11yProps(index) {
return {
id: `simple-tab-${index}`,
'aria-controls': `simple-tabpanel-${index}`,
};
}

/* function populateProjectModules() {
return (
<List className="listItem" component="nav" aria-label="projects">
{data.content.projects.map((key) => (
<ListItem button onClick={() => console.log('hello')}>
<ListItemIcon>
<FolderIcon />
</ListItemIcon>
<ListItemText primary={key.mod.name} />
</ListItem>
))}
</List>
);
} */

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(() => {
Expand Down Expand Up @@ -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 (
<div>
<NavBar className={classes.appBar} page="home" />
Expand All @@ -292,19 +122,24 @@ function HomePage(props) {
paper: classes.drawerPaper,
}}
>
<Tabs
value={value}
onChange={handleChange}
aria-label="simple tabs example"
>
<Tab style={tabStyle} label="Tutorials" {...a11yProps(0)} />
<Tab style={tabStyle} label="Do Files" {...a11yProps(1)} />
</Tabs>
{!isTutorial ? (
<TabPanel value={value} index={0} />
) : (
<TabPanel value={value} index={1} />
)}
<List>
<ListItem button key={1} onClick={() => setIsTutorial(false)}>
<ListItemIcon>
{!isTutorial ? <BookIcon /> : <BookOutlinedIcon />}
</ListItemIcon>
<ListItemText primary="Tutorials" />
</ListItem>
<ListItem button key={2} onClick={() => setIsTutorial(true)}>
<ListItemIcon>
{isTutorial ? (
<DescriptionIcon />
) : (
<DescriptionOutlinedIcon />
)}
</ListItemIcon>
<ListItemText primary="Do Files" />
</ListItem>
</List>
</Drawer>
</div>
{!isTutorial ? (
Expand Down

0 comments on commit a7e7c65

Please sign in to comment.