From c82606319c9ad91d00de876bbb5678a2ee7fb838 Mon Sep 17 00:00:00 2001 From: Andrew Simonson Date: Sat, 28 Jan 2023 12:26:44 -0600 Subject: [PATCH] Convert React pages to Flask oorah. --- .vscode/settings.json | 3 + src/app.py | 68 +++++++++++--- src/requirements.txt | Bin 472 -> 930 bytes src/static/css/head.css | 2 +- src/static/json/projects.json | 117 ++++++++++++++++++++++++ src/static/json/timeline.json | 37 ++++++++ src/templates/about.html | 131 +++++++++++++++++++++++++++ src/templates/header.html | 21 +++-- src/templates/partials/project.html | 33 +++++++ src/templates/partials/skills.html | 5 + src/templates/partials/socials.html | 7 ++ src/templates/partials/timeline.html | 13 +++ src/templates/projects.html | 46 ++++++++++ 13 files changed, 460 insertions(+), 23 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 src/static/json/projects.json create mode 100644 src/static/json/timeline.json create mode 100644 src/templates/about.html create mode 100644 src/templates/partials/project.html create mode 100644 src/templates/partials/skills.html create mode 100644 src/templates/partials/socials.html create mode 100644 src/templates/partials/timeline.html create mode 100644 src/templates/projects.html diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..de288e1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.formatting.provider": "black" +} \ No newline at end of file diff --git a/src/app.py b/src/app.py index 5d402ed..903cfbc 100644 --- a/src/app.py +++ b/src/app.py @@ -1,19 +1,50 @@ import flask +from flask_minify import Minify +import json + +proj = json.load(open('./static/json/projects.json', 'r')) +timeline = json.load(open('./static/json/timeline.json', 'r')) app = flask.Flask(__name__) +Minify(app=app, html=True, js=True, cssless=True) -@app.route('/') + +@app.route("/") def home(): - return flask.render_template('home.html', title='Andrew Simonson - Portfolio Home', description="Andrew Simonson's Digital portfolio home", canonical='') + return flask.render_template( + "home.html", + title="Andrew Simonson - Portfolio Home", + description="Andrew Simonson's Digital portfolio home", + canonical="", + ) -@app.route('/about') + +@app.route("/about") def about(): - return flask.render_template('about.html', title='Andrew Simonson - About Me', description="About Andrew Simonson", canonical='about') + return flask.render_template( + "about.html", + timeline=timeline, + title="Andrew Simonson - About Me", + description="About Andrew Simonson", + canonical="about", + ) -@app.route('/resume') -@app.route('/Resume.pdf') + +@app.route("/projects") +def projects(): + return flask.render_template( + "projects.html", + projects=proj, + title="Andrew Simonson - Projects", + description="Recent projects by Andrew Simonson on his lovely portfolio website :)", + canonical="projects", + ) + + +@app.route("/resume") +@app.route("/Resume.pdf") def resume(): - return flask.send_file('./static/resume.pdf') + return flask.send_file("./static/Resume.pdf") @app.errorhandler(Exception) @@ -23,14 +54,25 @@ def page404(e): try: message = e.length finally: - return flask.render_template('error.html', error=eCode, message=message, title=f'{eCode} - Simonson Portfolio'), eCode + return ( + flask.render_template( + "error.html", + error=eCode, + message=message, + title=f"{eCode} - Simonson Portfolio", + ), + eCode, + ) -@app.route('/sitemap.xml') -@app.route('/robots.txt') + +@app.route("/sitemap.xml") +@app.route("/robots.txt") def static_from_root(): return flask.send_from_directory(app.static_folder, flask.request.path[1:]) -if __name__ == '__main__': + +if __name__ == "__main__": import sass - sass.compile(dirname=('static/scss', 'static/css'), output_style='compressed') - app.run() + + sass.compile(dirname=("static/scss", "static/css"), output_style="compressed") + app.run(debug=True) diff --git a/src/requirements.txt b/src/requirements.txt index 092dc061d34b4c3e8edca36f938b6d4f7d77f37f..1246f6ba6cccf7e63d1958116fba21bb77ccc6c9 100644 GIT binary patch literal 930 zcmZ`%!A`1dLp-Okq*Z>849Quelh|?!M z24I~S202<=hBr0(R`!m=n|(8JM&5w;z3`)Ll}-ya{Z#|m>4^MuP2Pc}6gt)Hi0;sn zv=L)Y?r#s?9!~{*$$f$RQ$@gzdT_HYy7N7{{{^rUQXavv#QzOAS?8OMDh}Z1j11@* z&T3@ULwBn?@^X8=-wsTJHK^%OTiqrX^6is5ZFs;$Zs&lk0`8O$^YnyR>Ha($cTYV_ za7SlMlnR{vbVX8jzSEct)t{xy-~0Bsj{$o4MTA=pDe*x$@Jrd++rL>*MN;yLIwpL< gJ)$qB%Y@zE8A=-Ms1Zt+MBT{+N;*93i~b|_1G3 +
+
+

About Me

+

+ I'm Andrew Simonson, a second year (third year standing) student at + Rochester Institute of Technology + in the Computer Science BS program, pursuing a career in data + science with a focus on predictive analytics. +

+

+ When I'm not in class, you can find me working on extra collaborative + projects, building discord bots, playing chess, reading up on some + recent geopolitical development, or haphazardly expanding my list of + unusable, yet bizzarely wise quotes. +

+ +
+
+
+
+

Skills

+ {% from 'partials/skills.html' import skills %} + {{ skills([ "Python", "JavaScript", "Java", "C", "C++", "MIPS Assembly", + "Processing", "P5.js", "SQL", "SQLite", "PostgreSQL", "SQLAlchemy", + "HTML", "CSS", "Docker", "LaTeX", "ArcGIS", "Git", "Github", "Linux", + "OKD4", "Kubernetes", "Angular", "Flask", "Jinja", "DOM Scraping", + "Google API", "React", "Node.js", "ArcGIS", ]) }} + +
+ {% from 'partials/chess.html' import chess %} + {{ chess('asimonson1125') }} +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ {% from 'partials/timeline.html' import timeitem %} + {% for i in timeline %} + {{ timeitem(i, timeline[i]["classes"], timeline[i]["date"], timeline[i]["content"])}} + {% endfor %} +
+ +
+ +{% endblock %} diff --git a/src/templates/header.html b/src/templates/header.html index 2679c72..57a9ec3 100644 --- a/src/templates/header.html +++ b/src/templates/header.html @@ -7,19 +7,23 @@ + - + + + + + @@ -59,7 +63,6 @@ -
@@ -98,11 +101,11 @@
-
{% block content %}{% endblock %}
+ diff --git a/src/templates/partials/project.html b/src/templates/partials/project.html new file mode 100644 index 0000000..91ce459 --- /dev/null +++ b/src/templates/partials/project.html @@ -0,0 +1,33 @@ +{% macro project(title, classes, status, bgi, content, links) %} +
+
+
+

{{ title }}

+

+
+
+ {% if bgi|length > 0 %} + {% set path = url_for('static', filename='photos/' + bgi) %} +
+ {% endif %} +
+

{{ content }}

+
+
+ {% for i in links %} {% set src = 'icons/' + i[0] + '.svg' %} + + {{i[0]}} + + {% endfor %} {% if links|length == 0 %} +
+ no links! +
+ {% endif %} +
+
+
+
+{% endmacro %} diff --git a/src/templates/partials/skills.html b/src/templates/partials/skills.html new file mode 100644 index 0000000..840bbd9 --- /dev/null +++ b/src/templates/partials/skills.html @@ -0,0 +1,5 @@ +{% macro skills(skills) %} +
    + {% for i in skills %}
  • {{i}}
  • {% endfor %} +
+{% endmacro %} \ No newline at end of file diff --git a/src/templates/partials/socials.html b/src/templates/partials/socials.html new file mode 100644 index 0000000..367928b --- /dev/null +++ b/src/templates/partials/socials.html @@ -0,0 +1,7 @@ +
+ Github + Instagram + LinkedIn + E-mail +
+
\ No newline at end of file diff --git a/src/templates/partials/timeline.html b/src/templates/partials/timeline.html new file mode 100644 index 0000000..dc0bf6c --- /dev/null +++ b/src/templates/partials/timeline.html @@ -0,0 +1,13 @@ +{% macro timeitem(title, classes, date, deets) %} +
+

{{date}}

+
+

{{title}}

+
+

+ {{deets}} +

+
+
+
+{% endmacro %} \ No newline at end of file diff --git a/src/templates/projects.html b/src/templates/projects.html new file mode 100644 index 0000000..0d4ab1d --- /dev/null +++ b/src/templates/projects.html @@ -0,0 +1,46 @@ +{% extends "header.html" %} {% block content %} +
+
+

Projects

+

+ Project status is indicated by the color of the project card: +
+ - Complete +
+ - Work In Progress +
+ - Incomplete +

+
+
+
+ +
+
+ +
+
+ +
+
+
+ {% from 'partials/project.html' import project %} + {% for i in projects %} + {{ project(i, projects[i]["classes"], projects[i]["status"], projects[i]["bgi"], projects[i]["content"], projects[i]["links"]) }} + {% endfor %} +
+
+ +{% endblock %} \ No newline at end of file