From 9901ec2c391c22c4ab4241a9f55e4478e62a10bc Mon Sep 17 00:00:00 2001 From: Camerin Figueroa Date: Mon, 17 Nov 2025 19:13:02 -0500 Subject: [PATCH] HOTFIX - Fixed isssue with bugged merge --- src/components/ArticleEditor.js | 34 ---- src/components/Bai.js | 109 ---------- src/components/subcomponents/Buttons.js | 48 ----- src/components/subcomponents/GithubRepos.js | 210 -------------------- src/components/subcomponents/Listing.js | 25 --- src/components/subcomponents/ProgressBar.js | 25 --- 6 files changed, 451 deletions(-) delete mode 100644 src/components/ArticleEditor.js delete mode 100644 src/components/Bai.js delete mode 100644 src/components/subcomponents/Buttons.js delete mode 100644 src/components/subcomponents/GithubRepos.js delete mode 100644 src/components/subcomponents/Listing.js delete mode 100644 src/components/subcomponents/ProgressBar.js diff --git a/src/components/ArticleEditor.js b/src/components/ArticleEditor.js deleted file mode 100644 index 4f9b8d8..0000000 --- a/src/components/ArticleEditor.js +++ /dev/null @@ -1,34 +0,0 @@ -import React, { useState } from 'react'; -import Article from './Article'; -import "./css/ArticleEditor.css"; - -const ArticleEditor = (props) => { - const [content, setContent] = useState("Hello World"); - - let article = { - "id":"0", - "title": "Article Editor", - "desc":"This is a place to edit articles", - "contents": content - }; - - let copyToClipboard = () => { - navigator.clipboard.writeText(content).then(function() { - console.log('Async: Copying to clipboard was successful!'); - }, function(err) { - console.error('Async: Could not copy text: ', err); - }); - }; - - return ( -
-
-
Copy to Clipboard
-
-
- -
- ); -}; - -export default ArticleEditor; \ No newline at end of file diff --git a/src/components/Bai.js b/src/components/Bai.js deleted file mode 100644 index 5c473b6..0000000 --- a/src/components/Bai.js +++ /dev/null @@ -1,109 +0,0 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import {downloadModel, loadingModel, predict, error_msg} from '../actions' -import ProgressBar from "./subcomponents/ProgressBar"; -//import { Link } from 'react-router-dom'; -import './css/Bai.css'; - - -class Bai extends React.Component { - /** - * Blank AI - Artificial Intelligence designed to distinguish photos of blank vs. non-blank paper scans - */ - - classes = {0: "Blank", 1: "Not Blank"} - - componentDidMount () { - document.title = "Blank AI"; - } - - extExtractor (filename) { - let name = filename.split('.'); - let ext = name[name.length-1]; - return ext - } - - async fileUpload (target, predict) { - - const [file] = target.files; - - let image = document.getElementById("preview") - - let image_ext = ['jpg', 'png']; - - let file_ext = await this.extExtractor(file.name); - - if (file && image_ext.includes(file_ext)) { - - let imageBM = await createImageBitmap(file); - - let prediction = await predict(imageBM); - - console.log(this.declassify(prediction[0])); - - image.src = await URL.createObjectURL(file); - image.classList.add('show'); - } else { - this.props.error_msg('Please pass JPG or PNG file Only'); - } - } - - declassify(prediction) { - if (prediction > 0.5) { - return this.classes[1]; - } else { - return this.classes[0]; - } - } - - render() { - - let content = (this.props.model === null)? - ( -
-

Would you like to download the model?

-

By clicking Accept below, you will download the model which may be between 100 mb in size to 1 gb.

- -

{this.props.loading}

- -

{this.props.loading?this.props.downloadProgress+"%":""}

-
- ) - :( -
-

BAI Model Prediction

- -

{this.props.last_prediction ? this.declassify(this.props.last_prediction[0]):"Waiting for Prediction"}

- -
- {this.props.error} -
- - preview of predicted file - - this.fileUpload(target, this.props.predict)} /> - - - -
- ); - - return ( -
- {content} -
-

About

-

- You can find the source, dataset and model created for BAI on github at -

- https://www.github.com/RaspberryProgramming/BAI -
-
- ); - } -} -const mapStateToProps = (state) => { - return {model: state.model.model, loading: state.model.loading, last_prediction: state.model.last_prediction, downloadProgress: state.model.progress, error: state.model.error}; -} - -export default connect(mapStateToProps, {downloadModel, loadingModel, predict, error_msg})(Bai); diff --git a/src/components/subcomponents/Buttons.js b/src/components/subcomponents/Buttons.js deleted file mode 100644 index c081d7c..0000000 --- a/src/components/subcomponents/Buttons.js +++ /dev/null @@ -1,48 +0,0 @@ -import React, { useState } from 'react'; -import '../css/Buttons.css'; -import { ArrowUpShort, ArrowDownShort } from 'react-bootstrap-icons'; - -/** - * Buttons - set of button components that are reusable throughout the app. - */ - -export const ToggleButton = ({ - defVal=true, - icons=[, ], - text="", - clickAction=()=>{} - }) => { - /** - * ToggleButton - A button component for making a toggle button - * defVal: default value, true/false - * icons: array of two jsx values that are displayed depending on value - * text: text next to toggle button - * clickAction: function that will run when clicked. value is passed to this function. - */ - - const [value, setValue] = useState(defVal); - - return ( -
{setValue(!value); clickAction(value);}} > -
{icons[0]}
-
{icons[1]}
- {text} -
- ); -}; - -export const Button = ({children, onClick=()=>{}, href=null, className=""}) => { - if (href === null) { - return ( - - ); - } else { - return ( - - {children} - - ); - } -} \ No newline at end of file diff --git a/src/components/subcomponents/GithubRepos.js b/src/components/subcomponents/GithubRepos.js deleted file mode 100644 index 3b032f3..0000000 --- a/src/components/subcomponents/GithubRepos.js +++ /dev/null @@ -1,210 +0,0 @@ -import React from 'react'; -import { connect } from 'react-redux'; -import { getRepos, getUser, getRepoLanguages, nextPage, setSortValue } from '../../actions'; -import { ToggleButton, Button } from './Buttons'; - -class GithubRepos extends React.Component { - - perPage = 5; - sortOptions = [ - // text: displayed text, value: value used for sorting - {text: "Created Date", value: "created_at"}, - {text: "Last Pushed", value: "pushed_at"}, - {text: "Name", value: "name"}, - {text: "Number of Forks", value: "forks"}, - {text: "Size", value: "size"}, - {text: "Last Updated", value: "updated_at"}, - ]; - - componentDidMount() { - - document.title = "Github Repos"; - - if (!this.props.repos) { - - this.props.getUser(this.props.username); // Receive the repos at start - this.props.getRepos(this.props.username); // Receive the repos at start - - } - - } - - renderLanguages(name) { - this.props.getRepoLanguages(this.props.username, name); - - // Given that we've already received the repo's languages - if (this.props.repoLanguages && this.props.repoLanguages[name]) { - - // Create a bubble for each language - return Object.keys(this.props.repoLanguages[name]).map(language=>{ - - return
{language}
; // Language bubble JSX - - }); - } - - } - - roundUp(num) { - return num%1 === 0? num : num-(num%1)+1 - } - - objArrayBubbleSort(arr, value) { - /** - * arrayBubbleSort - */ - let unsorted; - let tmp; - - do { - unsorted = false; - - for (let i = 0; i < arr.length-1; i++) { - if ( - (value.asc && arr[i][value.value] > arr[i+1][value.value]) // Ascending - || (!value.asc && arr[i][value.value] < arr[i+1][value.value]) // Descending - ) { - tmp = arr[i+1]; - arr[i+1] = arr[i]; - arr[i] = tmp; - - unsorted = true; - } - } - - - } while (unsorted); - - return arr; - - } - - renderRepos() { - - if (this.props.repos) { // If the repos have been received - - if (this.props.repos.length > 0) { - // Render each repo - let repos = this.props.single ? [this.props.repos[0]] : this.props.repos - - let pages = this.roundUp(repos.length/this.perPage); - - let sortedRepos = this.objArrayBubbleSort([...repos], this.props.sortedValue); - - const render = sortedRepos.slice(0, this.props.page*this.perPage).map((repo) =>{ - let updated = (new Date (repo.updated_at)).toLocaleString(); - let created = (new Date (repo.created_at)).toLocaleString(); - - return ( -
- - {repo.name} - -
-

{repo.description ? repo.description : "No Description"}

- - { - repo.homepage ? // If the repo has a homepage, render a button - Project Website : - "" - } -
- -
- Languages: - - { - this.renderLanguages(repo.name) // Render each language for the repo - } -
-
- Last Updated: {updated} -
-
- Created: {created} -
-
- - ); - }); - - return ( -
-
-
-

Sort By: 

- -
-   - { - console.warn(val); - this.props.setSortValue({ - ...this.props.sortedValue, - asc: val - }); - }} /> -
- - {render} - - {this.props.page < pages ? - - : "" - } -
- ); // display the repo list with the rendered repos - - } else { - - return
User doesn't have any repositories
- - } - - } - - // Return nothing if repos haven't been received - - return
Loading Repositories...
; // Return nothing if repos haven't been collected - } - - render = () => { - return (
{this.renderRepos()}
); - } - -} - - -const mapStateToProps = (state) => { - return { - repos: state.github.repos, - repoLanguages: state.github.repoLanguages, - page: state.github.page, - sortedValue: state.github.sortedValue - }; -} - -export default connect(mapStateToProps, { - getRepos, - getRepoLanguages, - getUser, - nextPage, - setSortValue -})(GithubRepos); \ No newline at end of file diff --git a/src/components/subcomponents/Listing.js b/src/components/subcomponents/Listing.js deleted file mode 100644 index 6fb3bb1..0000000 --- a/src/components/subcomponents/Listing.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { Link } from 'react-router-dom'; -import '../css/Listing.css'; - -const Listing = (props) => { - /** - * Listing - A subcomponent for making lists of content, mostly to make a list of links. - * - * - * title - The title of the listing - * children - JSX that is necessary in the content of the component - */ - return ( -
- -
{props.title}
-
- {props.children} -
- -
- ); -}; - -export default Listing; \ No newline at end of file diff --git a/src/components/subcomponents/ProgressBar.js b/src/components/subcomponents/ProgressBar.js deleted file mode 100644 index 7c87dcc..0000000 --- a/src/components/subcomponents/ProgressBar.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import '../css/ProgressBar.css'; - -class ProgressBar extends React.Component { - render () { - let pg = document.getElementById("ProgressBar"); - - let width = 0; - - if (pg !== null) { - - width = pg.offsetWidth*(this.props.progress/100); - - } - - - return ( -
-
-
- ); - } -}; - -export default ProgressBar; \ No newline at end of file