From ec3a72cf07c1b3d6faffae5a6d4eafee90ac9333 Mon Sep 17 00:00:00 2001 From: Adam <24621027+WhiteDopeOnPunk@users.noreply.github.com> Date: Tue, 17 Jan 2023 02:41:58 -0500 Subject: [PATCH] purdy --- .gitignore | 23 +++++- README.md | 2 +- enigma/.gitignore | 23 ------ enigma/README.md | 70 ------------------ enigma/package.json | 39 ---------- enigma/src/Machine.css | 6 -- enigma/src/Machine.js | 41 ---------- enigma/package-lock.json => package-lock.json | 0 package.json | 37 ++++++++- {enigma/public => public}/favicon.ico | Bin {enigma/public => public}/index.html | 0 {enigma/public => public}/logo192.png | Bin {enigma/public => public}/logo512.png | Bin {enigma/public => public}/manifest.json | 4 +- {enigma/public => public}/robots.txt | 0 src/Machine.css | 7 ++ src/Machine.js | 21 ++++++ src/components/Keyboard.css | 20 +++++ src/components/Keyboard.js | 34 +++++++++ src/components/Lightbox.css | 23 ++++++ src/components/Lightbox.js | 34 +++++++++ {enigma/src => src}/components/Rotor.css | 0 {enigma/src => src}/components/Rotor.js | 11 --- {enigma/src => src}/components/Rotorbox.css | 1 - {enigma/src => src}/components/Rotorbox.js | 43 +++-------- {enigma/src => src}/index.css | 1 - {enigma/src => src}/index.js | 1 - .../media/mixkit-hard-click-1118.wav | Bin 28 files changed, 210 insertions(+), 231 deletions(-) delete mode 100644 enigma/.gitignore delete mode 100644 enigma/README.md delete mode 100644 enigma/package.json delete mode 100644 enigma/src/Machine.css delete mode 100644 enigma/src/Machine.js rename enigma/package-lock.json => package-lock.json (100%) rename {enigma/public => public}/favicon.ico (100%) rename {enigma/public => public}/index.html (100%) rename {enigma/public => public}/logo192.png (100%) rename {enigma/public => public}/logo512.png (100%) rename {enigma/public => public}/manifest.json (86%) rename {enigma/public => public}/robots.txt (100%) create mode 100644 src/Machine.css create mode 100644 src/Machine.js create mode 100644 src/components/Keyboard.css create mode 100644 src/components/Keyboard.js create mode 100644 src/components/Lightbox.css create mode 100644 src/components/Lightbox.js rename {enigma/src => src}/components/Rotor.css (100%) rename {enigma/src => src}/components/Rotor.js (72%) rename {enigma/src => src}/components/Rotorbox.css (69%) rename {enigma/src => src}/components/Rotorbox.js (64%) rename {enigma/src => src}/index.css (95%) rename {enigma/src => src}/index.js (87%) rename {enigma/src => src}/media/mixkit-hard-click-1118.wav (100%) diff --git a/.gitignore b/.gitignore index d502512..4d29575 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies /node_modules -/package-lock.json +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/README.md b/README.md index 496e196..09d6f12 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# enigma +[https://doordesk.net/enigma](https://doordesk.net/enigma) diff --git a/enigma/.gitignore b/enigma/.gitignore deleted file mode 100644 index 4d29575..0000000 --- a/enigma/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/enigma/README.md b/enigma/README.md deleted file mode 100644 index 58beeac..0000000 --- a/enigma/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# Getting Started with Create React App - -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). - -## Available Scripts - -In the project directory, you can run: - -### `npm start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in your browser. - -The page will reload when you make changes.\ -You may also see any lint errors in the console. - -### `npm test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `npm run build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `npm run eject` - -**Note: this is a one-way operation. Once you `eject`, you can't go back!** - -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. - -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `npm run build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) diff --git a/enigma/package.json b/enigma/package.json deleted file mode 100644 index 02ba458..0000000 --- a/enigma/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "enigma", - "version": "0.1.0", - "private": true, - "dependencies": { - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", - "@testing-library/user-event": "^13.5.0", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-router-dom": "^6.6.2", - "react-scripts": "5.0.1", - "web-vitals": "^2.1.4" - }, - "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } -} diff --git a/enigma/src/Machine.css b/enigma/src/Machine.css deleted file mode 100644 index e1c31ea..0000000 --- a/enigma/src/Machine.css +++ /dev/null @@ -1,6 +0,0 @@ -.machine { - margin: .5em; - width: 11.5em; - outline-style: solid; - outline-color: #DA9475; -} diff --git a/enigma/src/Machine.js b/enigma/src/Machine.js deleted file mode 100644 index fa50aec..0000000 --- a/enigma/src/Machine.js +++ /dev/null @@ -1,41 +0,0 @@ -import { Component } from 'react'; -import './Machine.css'; -import Rotorbox from './components/Rotorbox.js'; - -function Lightbox() { - return ( -
-
 Q W E R T Z U I O
-
  A S D F G H J K
-
 P Y X C V B N M L
-
- ); -} - -class Keyboard extends Component{ - render() { - return ( -
-
 Q W E R T Z U I O
-
  A S D F G H J K
-
 P Y X C V B N M L
-
- ); - } -} - -class Machine extends Component { - render() { - return ( -
- -
- -
- -
- ); - } -} - -export default Machine; diff --git a/enigma/package-lock.json b/package-lock.json similarity index 100% rename from enigma/package-lock.json rename to package-lock.json diff --git a/package.json b/package.json index 548f420..6d90a5e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,40 @@ { + "homepage": "https://doordesk.net/enigma", + "name": "enigma", + "version": "0.1.0", + "private": true, "dependencies": { - "create-react-app": "^5.0.1" + "@testing-library/jest-dom": "^5.16.5", + "@testing-library/react": "^13.4.0", + "@testing-library/user-event": "^13.5.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-router-dom": "^6.6.2", + "react-scripts": "5.0.1", + "web-vitals": "^2.1.4" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] } } diff --git a/enigma/public/favicon.ico b/public/favicon.ico similarity index 100% rename from enigma/public/favicon.ico rename to public/favicon.ico diff --git a/enigma/public/index.html b/public/index.html similarity index 100% rename from enigma/public/index.html rename to public/index.html diff --git a/enigma/public/logo192.png b/public/logo192.png similarity index 100% rename from enigma/public/logo192.png rename to public/logo192.png diff --git a/enigma/public/logo512.png b/public/logo512.png similarity index 100% rename from enigma/public/logo512.png rename to public/logo512.png diff --git a/enigma/public/manifest.json b/public/manifest.json similarity index 86% rename from enigma/public/manifest.json rename to public/manifest.json index 080d6c7..794c04a 100644 --- a/enigma/public/manifest.json +++ b/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "React App", - "name": "Create React App Sample", + "short_name": "Enigma", + "name": "Enigma", "icons": [ { "src": "favicon.ico", diff --git a/enigma/public/robots.txt b/public/robots.txt similarity index 100% rename from enigma/public/robots.txt rename to public/robots.txt diff --git a/src/Machine.css b/src/Machine.css new file mode 100644 index 0000000..675b100 --- /dev/null +++ b/src/Machine.css @@ -0,0 +1,7 @@ +.Machine { + margin: auto; + width: 350px; + outline-style: solid; + outline-color: #DA9475; + background-color: #111; +} diff --git a/src/Machine.js b/src/Machine.js new file mode 100644 index 0000000..86871df --- /dev/null +++ b/src/Machine.js @@ -0,0 +1,21 @@ +import { Component } from 'react'; +import './Machine.css'; +import Rotorbox from './components/Rotorbox.js'; +import Lightbox from './components/Lightbox.js'; +import Keyboard from './components/Keyboard.js'; + +class Machine extends Component { + render() { + return ( +
+ +
+ +
+ +
+ ); + } +} + +export default Machine; diff --git a/src/components/Keyboard.css b/src/components/Keyboard.css new file mode 100644 index 0000000..788d62b --- /dev/null +++ b/src/components/Keyboard.css @@ -0,0 +1,20 @@ +:root { + --keysize: 1.3em; + --keyspacing: .2em; + --keyback: #353535; + --keytext: #ddd; +} +.Keyboard { + margin: auto; +} +.Key { + text-align: center; + width: var(--keysize); + height: var(--keysize); + border-radius: var(--keysize); + margin: var(--keyspacing); + background-color: var(--keyback); + color: var(--keytext); + outline-style: solid; + outline-color: #555; +} diff --git a/src/components/Keyboard.js b/src/components/Keyboard.js new file mode 100644 index 0000000..8f9c728 --- /dev/null +++ b/src/components/Keyboard.js @@ -0,0 +1,34 @@ +import { Component } from 'react'; +import './Keyboard.css'; + +class Keyboard extends Component{ + bulb(i) { + return ( + + {i} + + );} + row(letters) { + const buffer = []; + for (const i of letters) { + buffer.push( + this.bulb(i) + )} + return ( +
+ {buffer} +
+ ); + } + render() { + return ( +
+ {this.row('QWERTZUIO')} + {this.row('ASDFGHJK')} + {this.row('PYXCVBNML')} +
+ ); + } +} + +export default Keyboard; diff --git a/src/components/Lightbox.css b/src/components/Lightbox.css new file mode 100644 index 0000000..8de1a26 --- /dev/null +++ b/src/components/Lightbox.css @@ -0,0 +1,23 @@ +:root { + --bulbsize: 1.3em; + --spacing: .1em; + --bulbdim: #151515; + --textdim: #454545; +} +.Lightbox { + margin: auto; +} +.row { + display: flex; + justify-content:center; + padding: var(--spacing); +} +.Bulb { + margin: var(--spacing); + width: var(--bulbsize); + height: var(--bulbsize); + border-radius: var(--bulbsize); + text-align: center; + background-color: var(--bulbdim); + color: var(--textdim); +} diff --git a/src/components/Lightbox.js b/src/components/Lightbox.js new file mode 100644 index 0000000..dfcb3e1 --- /dev/null +++ b/src/components/Lightbox.js @@ -0,0 +1,34 @@ +import { Component } from 'react'; +import './Lightbox.css'; + +class Lightbox extends Component{ + bulb(i) { + return ( + + {i} + + );} + row(letters) { + const buffer = []; + for (const i of letters) { + buffer.push( + this.bulb(i) + )} + return ( +
+ {buffer} +
+ ); + } + render() { + return ( +
+ {this.row('QWERTZUIO')} + {this.row('ASDFGHJK')} + {this.row('PYXCVBNML')} +
+ ); + } +} + +export default Lightbox; diff --git a/enigma/src/components/Rotor.css b/src/components/Rotor.css similarity index 100% rename from enigma/src/components/Rotor.css rename to src/components/Rotor.css diff --git a/enigma/src/components/Rotor.js b/src/components/Rotor.js similarity index 72% rename from enigma/src/components/Rotor.js rename to src/components/Rotor.js index f802a7f..2f960f0 100644 --- a/enigma/src/components/Rotor.js +++ b/src/components/Rotor.js @@ -2,9 +2,6 @@ import React from 'react'; import './Rotor.css'; class Rotor extends React.Component { - constructor(props) { - super(props) - } letter(i) { const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' if (i > 25) { @@ -17,14 +14,6 @@ class Rotor extends React.Component { return alphabet[i] } } - tick() { - if (this.state.pos === 25) { - this.setState((state) => ({pos: 0})); - } - else { - this.setState((state) => ({pos: state.pos + 1})); - } - } render() { return ( diff --git a/enigma/src/components/Rotorbox.css b/src/components/Rotorbox.css similarity index 69% rename from enigma/src/components/Rotorbox.css rename to src/components/Rotorbox.css index e849399..8f70601 100644 --- a/enigma/src/components/Rotorbox.css +++ b/src/components/Rotorbox.css @@ -1,5 +1,4 @@ .Rotorbox { padding-left: 20%; - background: #010101; display: flex; } diff --git a/enigma/src/components/Rotorbox.js b/src/components/Rotorbox.js similarity index 64% rename from enigma/src/components/Rotorbox.js rename to src/components/Rotorbox.js index 0938dbd..66bddb5 100644 --- a/enigma/src/components/Rotorbox.js +++ b/src/components/Rotorbox.js @@ -10,8 +10,8 @@ class Rotorbox extends React.Component { rotor0: 11, rotor1: 8, rotor2: 6, - rotor3: 12, - rotor4: 0 + rotor3: 11, + rotor4: 23 }; } tick() { @@ -19,60 +19,37 @@ class Rotorbox extends React.Component { audio.loop = false; audio.playbackRate = 3.0; audio.play(); - if (this.state.rotor4 > 24) { + this.setState(state => ({ + rotor4: state.rotor4 +1 + })); + if (this.state.rotor4 === 25) { this.setState(state => ({ rotor3: state.rotor3 +1, rotor4: 0 })); } - if (this.state.rotor3 > 24) { + if (this.state.rotor3 === 25) { this.setState(state => ({ rotor2: state.rotor2 +1, rotor3: 0 })); } - if (this.state.rotor2 > 24) { + if (this.state.rotor2 === 25) { this.setState(state => ({ rotor1: state.rotor1 +1, rotor2: 0 })); } - if (this.state.rotor1 > 24) { + if (this.state.rotor1 === 25) { this.setState(state => ({ rotor0: state.rotor0 +1, rotor1: 0 })); } - else { - this.setState(state => ({ - rotor4: state.rotor4 +1 - })); - } - } - componentDidMount() { - this.timerID = setInterval( - () => this.tick(), - 200 - ); - } - componentWillUnmount() { - clearInterval(this.timerID); - } - lulz() { - let balls = { - rotor0: 2, - rotor1: 0, - rotor2: 11, - rotor3: 11, - rotor4: 25 - } - if (this.state !== balls) { - } - } render() { return ( -
+
this.tick()}> diff --git a/enigma/src/index.css b/src/index.css similarity index 95% rename from enigma/src/index.css rename to src/index.css index 8bf312a..b50bfbe 100644 --- a/enigma/src/index.css +++ b/src/index.css @@ -3,7 +3,6 @@ html { } body { - margin: 0; font-family: monospace; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/enigma/src/index.js b/src/index.js similarity index 87% rename from enigma/src/index.js rename to src/index.js index 015d032..19ffb3f 100644 --- a/enigma/src/index.js +++ b/src/index.js @@ -1,4 +1,3 @@ -import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; diff --git a/enigma/src/media/mixkit-hard-click-1118.wav b/src/media/mixkit-hard-click-1118.wav similarity index 100% rename from enigma/src/media/mixkit-hard-click-1118.wav rename to src/media/mixkit-hard-click-1118.wav