Skip to content

Commit c5c8f53

Browse files
committed
scrubbed console.logs
Co-authored-by: Derrick Oh <juneparkoh@gmail.com> Co-authored-by: Christopher Long <93620761+cvalong@users.noreply.github.com> Co-authored-by: Daniel Chang <Chang254@mail.chapman.edu> Co-authored-by: Matthew Fukudome <matthewfukudome@gmail.com> Co-authored-by: Ryan Motamen <ryanmotamen@gmail.com>
1 parent e504617 commit c5c8f53

7 files changed

Lines changed: 259 additions & 208 deletions

File tree

electron-react/src/App.tsx

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// import Update from '@/components/update'
2-
import React, { useContext, useEffect } from 'react';
3-
import Workshop from './pages/Workshop';
4-
import UIPage from './pages/UIPage';
5-
import { useUserComp } from './hooks/useContextHooks';
6-
import './App.scss';
7-
import FileExplorer from './components/FileExplorer/FileExplorer';
8-
import { ShowUIContext } from './components/context/ShowUIContext';
9-
import { motion } from 'framer-motion';
10-
import path from 'path';
11-
import fs from 'fs';
12-
import { PayloadType, UserActionType } from './components/context/ContextTypes';
13-
const os = require('os');
2+
import React, { useContext, useEffect } from "react";
3+
import Workshop from "./pages/Workshop";
4+
import UIPage from "./pages/UIPage";
5+
import { useUserComp } from "./hooks/useContextHooks";
6+
import "./App.scss";
7+
import FileExplorer from "./components/FileExplorer/FileExplorer";
8+
import { ShowUIContext } from "./components/context/ShowUIContext";
9+
import { motion } from "framer-motion";
10+
import path from "path";
11+
import fs from "fs";
12+
import { PayloadType, UserActionType } from "./components/context/ContextTypes";
13+
const os = require("os");
1414

1515
const pageVariants = {
1616
initial: {
1717
opacity: 0,
1818
y: 5,
19-
scale: 0.9
19+
scale: 0.9,
2020
},
2121
animate: {
2222
opacity: 1,
@@ -26,39 +26,37 @@ const pageVariants = {
2626
type: "spring",
2727
stiffness: 800,
2828
damping: 100,
29-
duration: 1
30-
}
29+
duration: 1,
30+
},
3131
},
3232
exit: {
3333
opacity: 0,
3434
y: -100,
3535
scale: 1.2,
3636
transition: {
37-
duration: 1
38-
}
39-
}
37+
duration: 1,
38+
},
39+
},
4040
};
4141

4242
function App() {
4343
// for more info on useContext with typescript: https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context
44-
const contextVal = useContext(ShowUIContext) ?? { showUI: [null, null] }
45-
const [showUIVal, setShowUIVal] = contextVal.showUI
44+
const contextVal = useContext(ShowUIContext) ?? { showUI: [null, null] };
45+
const [showUIVal, setShowUIVal] = contextVal.showUI;
4646
const { components, dispatch } = useUserComp();
4747

48-
4948
useEffect(() => {
50-
const filePath = path.join(os.homedir(), 'AthenaData123.json');
49+
const filePath = path.join(os.homedir(), "AthenaData123.json");
5150

5251
// Read the file's contents
53-
fs.readFile(filePath, 'utf8', (err, data) => {
52+
fs.readFile(filePath, "utf8", (err, data) => {
5453
if (err) {
5554
console.error(`Error reading file: ${err.message}`);
5655
} else {
5756
// Parse the JSON data
5857
const jsonData = JSON.parse(data);
59-
console.log(jsonData);
6058
// Set user components
61-
dispatch({ type: 'SET_COMPS', payload: jsonData });
59+
dispatch({ type: "SET_COMPS", payload: jsonData });
6260
}
6361
});
6462
}, []);
@@ -71,28 +69,26 @@ function App() {
7169
initial="initial"
7270
animate="animate"
7371
exit="exit"
74-
className='App'
72+
className="App"
7573
>
7674
<UIPage />
7775
</motion.div>
78-
)
79-
}
80-
81-
else {
76+
);
77+
} else {
8278
return (
8379
<motion.div
8480
key={2}
8581
variants={pageVariants}
8682
initial="initial"
8783
animate="animate"
8884
exit="exit"
89-
className='App'
85+
className="App"
9086
>
9187
<FileExplorer />
9288
<Workshop />
9389
</motion.div>
94-
)
90+
);
9591
}
9692
}
9793

98-
export default App
94+
export default App;

electron-react/src/components/FileExplorer/DirectoryComponent.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import React, { useState } from "react";
2-
import { Folder } from './FileExplorer';
2+
import { Folder } from "./FileExplorer";
33

44
interface DirectoryProps {
55
name: string;
66
files: Folder[];
77
fileParser: Function;
88
path: string;
9-
109
}
1110

12-
const DirectoryComponent: React.FC<DirectoryProps> = ({ name, files, fileParser, path }) => {
11+
const DirectoryComponent: React.FC<DirectoryProps> = ({
12+
name,
13+
files,
14+
fileParser,
15+
path,
16+
}) => {
1317
// each directory component has access to it's name and files on property object
1418
// hook to tell whether button is opened or not
1519
const [isOpen, setOpen] = useState(false);
@@ -18,26 +22,39 @@ const DirectoryComponent: React.FC<DirectoryProps> = ({ name, files, fileParser,
1822
setOpen(!isOpen);
1923
};
2024

21-
// TODO: readability refactor for recursive call
2225
return (
2326
<div className="folder">
2427
<button className="folder-button" onClick={handleFolderToggle}>
25-
<svg className={isOpen ? 'folder-button-icon chevron-down' : 'folder-button-icon'}
26-
xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
27-
<path fillRule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
28+
<svg
29+
className={
30+
isOpen ? "folder-button-icon chevron-down" : "folder-button-icon"
31+
}
32+
xmlns="http://www.w3.org/2000/svg"
33+
width="16"
34+
height="16"
35+
viewBox="0 0 16 16"
36+
>
37+
<path
38+
fillRule="evenodd"
39+
d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"
40+
/>
2841
</svg>
2942
<span className="file-button-text">{name}</span>
3043
</button>
3144

3245
{/* when isOpen is true, render all of the subfiles of the directory component */}
3346
{isOpen && (
3447
<div className="sub-files">
35-
<div className = 'vl'/>
48+
<div className="vl" />
3649
{/* map over each subfile */}
3750
{files.map((file) => {
38-
{/* generate subPath */}
51+
{
52+
/* generate subPath */
53+
}
3954
const subPath = `${path}/${file.name}`; // create a variable to store the path
40-
{/* recursively render directory component with updated path, filename, and subfiles */}
55+
{
56+
/* recursively render directory component with updated path, filename, and subfiles */
57+
}
4158
return (
4259
<div key={file.name}>
4360
{file.directory ? (

0 commit comments

Comments
 (0)