This commit is contained in:
Camerin Figueroa 2022-06-14 21:22:59 -04:00
commit 7db92b80a0
8 changed files with 708 additions and 2316 deletions

2929
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,25 +3,22 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@tensorflow/tfjs": "^3.12.0", "@tensorflow/tfjs": "^3.18.0",
"@tensorflow/tfjs-converter": "^3.12.0", "@tensorflow/tfjs-converter": "^3.18.0",
"@testing-library/jest-dom": "^5.14.1", "axios": "^0.27.2",
"@testing-library/react": "^11.2.7", "history": "^5.3.0",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.4",
"history": "^5.0.1",
"memoize": "^0.1.1", "memoize": "^0.1.1",
"react": "^18.1.0", "react": "^18.1.0",
"react-bootstrap-icons": "^1.5.0", "react-bootstrap-icons": "^1.8.0",
"react-dom": "^18.1.0", "react-dom": "^18.1.0",
"react-redux": "^7.2.5", "react-redux": "^8.0.2",
"react-router": "^5.2.1", "react-router": "^6.3.0",
"react-router-dom": "^5.3.0", "react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1", "react-scripts": "^5.0.1",
"redux": "^4.1.1", "redux": "^4.2.0",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.4.1",
"tfjs": "^0.6.0", "tfjs": "^0.6.0",
"web-vitals": "^1.1.2" "web-vitals": "^2.1.4"
}, },
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom'; import { BrowserRouter, Route, Routes } from 'react-router-dom';
import "./css/App.css"; import "./css/App.css";
import Navigation from './Navigation'; import Navigation from './Navigation';
import Github from './Github'; import Github from './Github';
@ -15,14 +15,15 @@ const App = (props) => {
<div className="App"> <div className="App">
<Navigation /> <Navigation />
<div className="app-content"> <div className="app-content">
<Switch> <Routes>
<Route path="/" exact component={Intro} /> <Route path="/" exact element={<Intro />} />
<Route path="/github" render={(props) => <Github {...props} />} /> <Route path="/github" element={<Github />} />
<Route path="/about" component={About} /> <Route path="/about" element={<About />} />
<Route path="/articles" component={Articles} /> <Route path="/articles" element={<Articles />} />
<Route path="/bai" component={Bai} /> <Route path="/articles/:id" element={<Articles />} />
<Route path="/articleEditor" component={ArticleEditor} /> <Route path="/bai" element={<Bai />} />
</Switch> <Route path="/articleEditor" element={<ArticleEditor />} />
</Routes>
</div> </div>
</div> </div>
</BrowserRouter> </BrowserRouter>

View File

@ -3,6 +3,7 @@ import Theater from './subcomponents/Theater';
import './css/Articles.css'; import './css/Articles.css';
const Article = ({article}) => { const Article = ({article}) => {
const [show, setShow] = useState(""); const [show, setShow] = useState("");
const [currArticle, setCurrArticle] = useState(""); const [currArticle, setCurrArticle] = useState("");
@ -48,7 +49,7 @@ const Article = ({article}) => {
let loc = 0; // Stores the current location in output that we're working with let loc = 0; // Stores the current location in output that we're working with
let tmp; let tmp;
let i = 0; let i = 0;
console.log(text);
while (i < text.length) { // Iterate through the entire text string while (i < text.length) { // Iterate through the entire text string
if (text.slice(i, i+4) === "http"){ // slice from i to 4 chars plus and check for http if (text.slice(i, i+4) === "http"){ // slice from i to 4 chars plus and check for http
let x = i; // store i in x so the location is not modified let x = i; // store i in x so the location is not modified
@ -125,7 +126,7 @@ const Article = ({article}) => {
for (let i = 0; i < text.length; i++) { // Iterate through input for (let i = 0; i < text.length; i++) { // Iterate through input
if (delimiters.indexOf(text[i]) >= 0) { // Detect Code Delimiter if (delimiters.indexOf(text[i]) >= 0) { // Detect Code Delimiter
console.log(text[i])
if (tick) { // Close the code section if (tick) { // Close the code section
output[++ind] = "" output[++ind] = ""
tick = false; tick = false;

View File

@ -4,8 +4,11 @@ import './css/Articles.css';
import Article from './Article'; import Article from './Article';
import Listing from './subcomponents/Listing'; import Listing from './subcomponents/Listing';
import { getArticles } from '../actions'; import { getArticles } from '../actions';
import { Route } from 'react-router-dom'; import { useParams } from 'react-router-dom';
const withParams = (Component) => {
return ()=><Component params={useParams()} />;
}
class Articles extends React.Component { class Articles extends React.Component {
/** /**
@ -39,9 +42,9 @@ class Articles extends React.Component {
); );
} }
article(match) { article(articleId) {
if (this.props.articles.length > 0) { if (this.props.articles.length > 0) {
return <Article article={this.props.articles[match.params.id]}/>; return <Article article={this.props.articles[articleId]}/>;
} else { } else {
return <div></div>; return <div></div>;
} }
@ -51,7 +54,7 @@ class Articles extends React.Component {
return ( return (
<div className="Articles"> <div className="Articles">
<Route path="/articles/:id" render={({match})=>{return this.article(match)}} /> {this.props.params.id ? this.article(this.props.params.id):''}
<h1>Articles</h1> <h1>Articles</h1>
{this.renderArticles()} {this.renderArticles()}
</div> </div>
@ -63,5 +66,5 @@ const mapStateToProps = (state) => {
return { articles: state.articles.articles}; return { articles: state.articles.articles};
} }
export default connect(mapStateToProps, { getArticles })(Articles); export default withParams(connect(mapStateToProps, { getArticles })(Articles));

View File

@ -54,7 +54,30 @@
height: fit-content; height: fit-content;
} }
.modal input.large { .modal textarea {
display:flex;
text-align: flex-start;
justify-content: flex-start;
}
.modal textarea.large {
height: 10rem; height: 10rem;
width: 20rem; width: 20rem;
} }
@media only screen and (max-width: 600px) {
.modal .box {
border: 2px solid #544545;
border-radius: 10px;
background-color: white;
padding: 25px;
max-width: 80vw;
}
.modal textarea.large {
height: 15rem;
width: auto;
}
}

View File

@ -26,7 +26,7 @@ const ContactModal = props => {
// Render the contact modal form // Render the contact modal form
return ( return (
<form onSubmit={(e)=>onSubmit(e)}> <form onSubmit={(e)=>onSubmit(e)}>
<input className="large" onKeyUp={(e)=>{props.updateEmailBody(e);}}/> <textarea className="large" onKeyUp={(e)=>{props.updateEmailBody(e);}}/>
<button>Open In Email Editor</button> <button>Open In Email Editor</button>
</form> </form>
); );

View File

@ -89,7 +89,7 @@ class GithubRepos extends React.Component {
let pages = this.roundUp(repos.length/this.perPage); let pages = this.roundUp(repos.length/this.perPage);
let sortedRepos = this.objArrayBubbleSort([...repos], this.props.sortedValue); let sortedRepos = this.objArrayBubbleSort([...repos], this.props.sortedValue);
console.log(sortedRepos);
const render = sortedRepos.slice(0, this.props.page*this.perPage).map((repo) =>{ const render = sortedRepos.slice(0, this.props.page*this.perPage).map((repo) =>{
let updated = (new Date (repo.updated_at)).toLocaleString(); let updated = (new Date (repo.updated_at)).toLocaleString();
let created = (new Date (repo.created_at)).toLocaleString(); let created = (new Date (repo.created_at)).toLocaleString();