diff --git a/react/resume/build.sh b/react/resume/build.sh deleted file mode 100755 index ca1f044..0000000 --- a/react/resume/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -rm -rf dist/* -yarn run build $* - -for f in ../../public/static/dist/*; do - if [ "$f" != ".gitignore" ] - then - rm -rf "$f" - fi -done -cp -r dist ../../public/static \ No newline at end of file diff --git a/react/resume/package.json b/react/resume/package.json index b049b56..c919fec 100644 --- a/react/resume/package.json +++ b/react/resume/package.json @@ -1,27 +1,22 @@ { "name": "resume", "version": "1.0.0", - "description": "", + "main": "src/resume.js", "source": "src/index.html", - "browserslist": "> 0.5%, last 2 versions, not dead", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "parcel", - "build": "parcel build src/resume.js --no-source-maps" - }, "author": "blek", "license": "MIT", "devDependencies": { - "@parcel/reporter-bundle-analyzer": "^2.8.3", - "buffer": "^5.5.0", "parcel": "^2.8.3", - "process": "^0.11.10", - "parcel-namer-without-hash": "^0.0.1" + "parcel-namer-without-hash": "^0.0.1", + "process": "^0.11.10" }, "dependencies": { - "@babel/runtime": "^7.21.0", "react": "^18.2.0", - "react-console-emulator": "^5.0.2", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "xterm-for-react": "^1.0.4", + "xterm-js-shell": "^1.1.3" + }, + "scripts": { + "start": "parcel" } } diff --git a/react/resume/src/Base.js b/react/resume/src/Base.js deleted file mode 100644 index d8758ed..0000000 --- a/react/resume/src/Base.js +++ /dev/null @@ -1,73 +0,0 @@ -import React, { Component } from 'react'; -import Terminal from 'react-console-emulator'; -import Files from './emulation/files'; -import commands from './emulation/commands'; -import Colored from './helpers/color'; - -import './font/sourcecode.css'; - -const welcome =
-Welcome to my resume!
-Type - help -for a list of commands. -
; - -const inputStyle = { color: '#4d6663', fontWeight: 'bold', minWidth: 'fit-content' }; - -export class Base extends Component { - constructor(props) { - super(props); - this.terminal = React.createRef(); - } - render() { - return ( - - - - user@blek.codes - - ~/resume - - - ( - - - master - - ) - - - $ - - - - */ - data.ip ? - (data.ip + '@blek.codes ~/resume $ ') : - '$ ' - } - - errorText={'zsh: command not found: [command]'} - - className='console' - - promptLabelStyle={inputStyle} - inputTextStyle={{...inputStyle, transform: 'translate(2px, 2px)'}} - - styleEchoBack={'fullInherit'} - noDefaults - /> - ) - } - - componentDidMount() { - this.terminal.current.focusTerminal(); - } -} \ No newline at end of file diff --git a/react/resume/src/Console.js b/react/resume/src/Console.js new file mode 100644 index 0000000..d190641 --- /dev/null +++ b/react/resume/src/Console.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { XTerm } from 'xterm-for-react' + +export class Console extends React.Component { + constructor(props) { + super(props); + this.terminal = React.createRef(null); + } + + render() { + return
+ +
; + } + + componentDidMount() { + require('./emulator')(this.terminal.current.terminal); + this.terminal.current.terminal.focus(); + } +} \ No newline at end of file diff --git a/react/resume/src/Style.css b/react/resume/src/Style.css deleted file mode 100644 index 165d871..0000000 --- a/react/resume/src/Style.css +++ /dev/null @@ -1,34 +0,0 @@ -td { - padding-right: 16px !important -} - -.console { - font-family: 'Source Code Pro', monospace; - max-width: 800px; - word-wrap: break-word; -} -.prompt_table tbody tr *, .prompt_table { - padding-right: 0px !important; -} -.prompt_table { - display: inline; -} - -.prompt_spacing { - padding-right: 10px !important; -} - -a, a:visited { - color: rgb(36, 85, 126) !important; - text-decoration: none; - font-weight: 500; - transition: 150ms ease; -} -a:hover { - text-shadow: 0 0 4px #24557e30; -} - -th { - text-align: left; - padding-right: 16px !important; -} \ No newline at end of file diff --git a/react/resume/src/emulation/commands/cat.js b/react/resume/src/emulation/commands/cat.js deleted file mode 100644 index f738b53..0000000 --- a/react/resume/src/emulation/commands/cat.js +++ /dev/null @@ -1,7 +0,0 @@ -import Files from '../files'; - -module.exports = (args) => { - if (args == undefined) args = ''; - if (Files[args]) return Files[args]; - return `cat: cannot open file '${args}': no such file or directory` -} \ No newline at end of file diff --git a/react/resume/src/emulation/commands/index.js b/react/resume/src/emulation/commands/index.js deleted file mode 100644 index 5195ff2..0000000 --- a/react/resume/src/emulation/commands/index.js +++ /dev/null @@ -1,77 +0,0 @@ -import Files from '../files'; - -import Colored from '../../helpers/color'; - -const commands = (terminal) => { - const commands = { - cat: { - description: 'Show contents of a file', - fn: require('./cat') - }, - ls: { - description: 'Show files in current directory', - fn: () => { - return '\'ls\' is not recognized as an internal or external command, operable program or batch file.'; - }, - unlisted: true - }, - dir: { - description: 'Show files in current directory', - fn: () => { - return
-                    {Object.keys(Files).join('   ')}
-                
; - } - }, - skills: { - description: 'My skills data', - fn: require('./skills') - }, - - clear: { - description: 'Clear the terminal.', - fn: () => { - terminal.current.clearStdout(); - } - }, - - socials: { - description: 'View my social links', - fn: require('./social') - }, - social: { - description: 'View my sociala links', - fn: require('./social'), - unlisted: true, - } - }; - - commands.help = { - unlisted: true, - fn: () => { - return ( -
-                    Commands list:
-                    
-                        
-                            {
-                                Object.keys(commands).map((cmd, i) => {
-                                    if (commands[cmd].unlisted) return;
-                                    return 
-                                        
-                                        
-                                        
-                                    
-                                })
-                            }
-                        
-                    
{cmd} : {commands[cmd].description}
-
- ); - } - } - - return commands; -} - -module.exports = commands; \ No newline at end of file diff --git a/react/resume/src/emulation/commands/skills.js b/react/resume/src/emulation/commands/skills.js deleted file mode 100644 index 2a8aa6d..0000000 --- a/react/resume/src/emulation/commands/skills.js +++ /dev/null @@ -1,128 +0,0 @@ -import Colored from '../../helpers/color'; - -const Title = (p) => {return

{...p.children}

} - -const projects = { - web: [ - { - name: 'blek! Site', - source: 'https://github.com/b1ek/blekSite', - desc: 'Second rewrite of my website in Laravel' - }, - { - name: 'homepage.js', - source: 'https://git.blek.codes/blek/homepage.js', - desc: 'Third re write of my website in Node/Express.JS/Pug and couple other libs' - }, - { - name: 'blek! Sail', - source: 'https://github.com/b1ek/sail', - desc: 'A production-ready server for serving Laravel projects' - }, - { - name: 'blek! ID', - source: 'https://github.com/b1ek/blekID', - desc: 'An auth server. Not really proud of this one, as the code is very spaghetti and practically useless.' - }, - { - name: 'blek! Bin', - source: 'https://git.blek.codes/blek/bin', - desc: 'Privacy-respecting, js-free alternative to Pastebin. Inspired by Librebin.' - }, - { - name: 'College project', - source: '#', - desc: 'Work in progress. Planned to be a site with rental apartments for students' - } - ] -} - -const skills = { - web: ( -
-            My web experience
-            

- Most of my web projects are listed on GitHub.
- I like Express.JS and Laravel, but also want to try Rust.
-
- On frontend, i like to write no-js HTML using
- template engines, or use React for complex apps like this one. -

-
-

- My projects: -

- - - - - - - - - - { - Object.keys(projects.web).map((key, i) => { - const proj = projects.web[key]; - return ( - - - - - - ) - }) - } - -
NameSourcesDescription
{proj.name} - Link - {proj.desc}
-
- ), - nt: ( -
-            My native dev experience
-            

- It isn't much.
- I have only one project that is made with - Qt/C++: CuteSchedule (Cute - stands fot Qt).
-
- But I do have a lot of experience with C and C++, as I like to write
- a lot of programs in those languages in my free time.
- An example of these programs: f2bin - , BrainHeck. -

-
- ) -} - -module.exports = (args) => { - - if (skills[args]) return skills[args]; - - return (
-        Web dev (PHP & JS)
-        
- [#####] 100%
- My main work field
- More: skills web
-
- - C/C++/Rust native dev
- [## ] 40%
- I do this... sometimes
- More: skills nt
-
- - Linux skills
- [#####] 100%
- Do this all the time. I run linux on my laptop, pc and server
-
- - Being cis
- [ ] 0%
- Never liked it
-
-
) -} \ No newline at end of file diff --git a/react/resume/src/emulation/commands/social.js b/react/resume/src/emulation/commands/social.js deleted file mode 100644 index e4b38cf..0000000 --- a/react/resume/src/emulation/commands/social.js +++ /dev/null @@ -1,17 +0,0 @@ -import Color from '../../helpers/color'; -const Link = (prop) => { - return {...prop.children} -} - -module.exports = () => { - return

- My socials are listed below:
-
- {'>'} My website
- {'>'} Github page
- {'>'} Gitea page
- {'>'} Email
- {'>'} Telegram
- (all links are clickable) -

; -} \ No newline at end of file diff --git a/react/resume/src/emulation/files.js b/react/resume/src/emulation/files.js deleted file mode 100644 index 61ce674..0000000 --- a/react/resume/src/emulation/files.js +++ /dev/null @@ -1,43 +0,0 @@ -const Hi = (props) => { - return {...props.children} -} -const HR = () => { - return
; -} - -module.exports = { - 'README.md': <> -

# Hello there!

-
- My name is Alice and I am a fullstack web developer.
- I am a trans girl and I live in Russia.
-
- This app was built with React.JS and Parcel.
- -

## About me

-
- I am vegan and like to listen to hyperpop/jpop. - Though being vegan, I do eat fried chicken occasionally.
-
- I honestly believe that governments are spying on us - every time they get a chance to, which is always. - This is why I run linux and use little to none of proprietary - software, all my connections are proxied through an offshore server - and I don't use The Internet when I don't have to.
-
- I like PHP+JS and C. I use PHP+JS for work and C for passion projects, - as I find it too much of work and possible memory leaks and a lot of nasty - stuff. To be honestly, I don't imagine building a site or an IDE using just C. - Perhaps, if speed is very much important, I would look into C++, Rust or Go.
-
- Also I have some experience with stuff like Arduino and/or Raspberry Pi. - I used to have a team of other makers and we tried to build a vending machine on a bunch of Arduinos and one Raspberry Orange Pi.
-
- Read this app's source code - on Gitea - or Github - , - - 'super_secret_password.txt': -

UwU

, -} \ No newline at end of file diff --git a/react/resume/src/emulator/index.js b/react/resume/src/emulator/index.js new file mode 100644 index 0000000..e8c5a0f --- /dev/null +++ b/react/resume/src/emulator/index.js @@ -0,0 +1,8 @@ +module.exports = (terminal) => { + + terminal.writeln('Welcome to my online resume!') + terminal.writeln('Type \033[1;32mhelp\033[0m for list of commands') + terminal.writeln(''); + + require('./zsh')(terminal); +} \ No newline at end of file diff --git a/react/resume/src/emulator/zsh.js b/react/resume/src/emulator/zsh.js new file mode 100644 index 0000000..c3fe7ba --- /dev/null +++ b/react/resume/src/emulator/zsh.js @@ -0,0 +1,74 @@ + +import { Terminal } from 'xterm'; + +/** + * @type {Terminal} + */ +let terminal; + +const prompt = '\033[1;32muser@blek.codes \033[36m~ $ \033[0m'; +let cmd = ''; + +function pr_char(char) { + cmd += char; + terminal.write(char); +} + +function exec_cmd() { + let c = cmd; + reset_cmd(); + terminal.writeln('zsh: command not found: ' + c); + print_prompt(); +} + +function print_prompt() { + terminal.write(prompt); +} + +function reset_cmd() { + cmd = ''; + terminal.writeln(''); +} + +function control_char(char) { + const id = char.codePointAt(0); + switch (id) { + + // backspace + case 127: + if (terminal.buffer.active.cursorX == prompt.length) break; + terminal.write('\b \b'); + cmd = cmd.substring(0, cmd.length - 1); + break; + + // enter + case 13: + exec_cmd(); + break; + + // Ctrl+c + case 3: + terminal.write('^C'); + reset_cmd(); + print_prompt(); + break; + + default: + console.log('Unknown special char: ' + id); + break; + } +} + +function key(e) { + if (RegExp(/^\p{L}/,'u').test(e.key)) { + pr_char(e.key); + } else { + control_char(e.key); + } +} + +module.exports = (t) => { + terminal = t; + terminal.onKey(key); + terminal.write(prompt); +} \ No newline at end of file diff --git a/react/resume/src/font/SourceCodeBold.ttf b/react/resume/src/font/SourceCodeBold.ttf deleted file mode 100644 index e034f70..0000000 Binary files a/react/resume/src/font/SourceCodeBold.ttf and /dev/null differ diff --git a/react/resume/src/font/SourceCodeMedium.ttf b/react/resume/src/font/SourceCodeMedium.ttf deleted file mode 100644 index 1e42b5e..0000000 Binary files a/react/resume/src/font/SourceCodeMedium.ttf and /dev/null differ diff --git a/react/resume/src/font/SourceCodeRegular.ttf b/react/resume/src/font/SourceCodeRegular.ttf deleted file mode 100644 index daad874..0000000 Binary files a/react/resume/src/font/SourceCodeRegular.ttf and /dev/null differ diff --git a/react/resume/src/font/SourceCodeSemiBold.ttf b/react/resume/src/font/SourceCodeSemiBold.ttf deleted file mode 100644 index 7dc26d9..0000000 Binary files a/react/resume/src/font/SourceCodeSemiBold.ttf and /dev/null differ diff --git a/react/resume/src/font/sourcecode.css b/react/resume/src/font/sourcecode.css deleted file mode 100644 index 95ea7b6..0000000 --- a/react/resume/src/font/sourcecode.css +++ /dev/null @@ -1,23 +0,0 @@ -@font-face { - font-family: 'Source Code Pro'; - src: url(./SourceCodeRegular.ttf); - font-weight: 400; -} - -@font-face { - font-family: 'Source Code Pro'; - src: url(./SourceCodeMedium.ttf); - font-weight: 500; -} - -@font-face { - font-family: 'Source Code Pro'; - src: url(./SourceCodeSemiBold.ttf); - font-weight: 600; -} - -@font-face { - font-family: 'Source Code Pro'; - src: url(./SourceCodeBold.ttf); - font-weight: 700; -} \ No newline at end of file diff --git a/react/resume/src/helpers/color.js b/react/resume/src/helpers/color.js deleted file mode 100644 index a6c787d..0000000 --- a/react/resume/src/helpers/color.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = (p) => { - return {...p.children} -} \ No newline at end of file diff --git a/react/resume/src/index.html b/react/resume/src/index.html index 5aba79d..3f231d9 100644 --- a/react/resume/src/index.html +++ b/react/resume/src/index.html @@ -1,12 +1,13 @@ - - - Resume debug mode - - - - -
- - + + resume.js + + + + + +
+ + + \ No newline at end of file diff --git a/react/resume/src/resume.js b/react/resume/src/resume.js index 398e401..3ebaa75 100644 --- a/react/resume/src/resume.js +++ b/react/resume/src/resume.js @@ -1,10 +1,6 @@ import { createRoot } from "react-dom/client"; -import { Base } from './Base'; -import './Style.css'; +import { Console } from "./Console"; -setTimeout(() => { - document.getElementById('resume_js_app').innerHTML = ''; - const container = document.getElementById("resume_js_app"); - const root = createRoot(container) - root.render(); -}, (Math.random() * 50) + 50) \ No newline at end of file +const container = document.getElementById("resume_js_app"); +const root = createRoot(container) +root.render(); \ No newline at end of file diff --git a/react/resume/src/styles.css b/react/resume/src/rootstyle.css similarity index 100% rename from react/resume/src/styles.css rename to react/resume/src/rootstyle.css