From 0d187b35eca851fb5fb47a770269539160590ddf Mon Sep 17 00:00:00 2001 From: Chris kerr Date: Sun, 4 Feb 2024 15:21:15 -0500 Subject: [PATCH] template bluprinting, refactoring, --- app.py | 11 +----- static/style/output.css | 13 +++---- templates/.layout.html | 15 ++++++++ templates/app.html | 84 ++++++++++++++++++++++++++++++++++------- templates/breeds.html | 80 ++++++++++++++++----------------------- templates/footer.html | 29 -------------- templates/index.html | 58 ---------------------------- templates/stats.html | 83 ++++++++++++++++++---------------------- 8 files changed, 163 insertions(+), 210 deletions(-) create mode 100644 templates/.layout.html delete mode 100644 templates/footer.html delete mode 100644 templates/index.html diff --git a/app.py b/app.py index 446b0f1..9e5f8a3 100644 --- a/app.py +++ b/app.py @@ -28,9 +28,9 @@ def get_js_files(): @app.route("/") -def show_index(): +def show_app(): js_files = get_js_files() - return render_template("index.html", js_files=js_files) + return render_template("app.html", js_files=js_files) @app.route("/get_families") @@ -120,11 +120,9 @@ def monster_stats(monster_name): ) - # Add this route for fetching breeding combinations @app.route("/breeds") def get_breeding_combinations(): - selected_monster = request.args.get("monster") if not selected_monster: return jsonify({"error": "Invalid input"}) @@ -197,10 +195,5 @@ def get_breeding_pairs(breed_id): return base_pair, mate_pair -@app.route("/footer") -def show_footer(): - return render_template("footer.html") - - if __name__ == "__main__": app.run(debug=True) diff --git a/static/style/output.css b/static/style/output.css index 4f309b2..3e43150 100644 --- a/static/style/output.css +++ b/static/style/output.css @@ -586,10 +586,6 @@ video { margin: 0.5rem; } -.m-4 { - margin: 1rem; -} - .mx-auto { margin-left: auto; margin-right: auto; @@ -679,12 +675,13 @@ video { background-color: rgb(30 41 59 / var(--tw-bg-opacity)); } -.p-2 { - padding: 0.5rem; +.bg-slate-900 { + --tw-bg-opacity: 1; + background-color: rgb(15 23 42 / var(--tw-bg-opacity)); } -.p-4 { - padding: 1rem; +.p-2 { + padding: 0.5rem; } .pl-2 { diff --git a/templates/.layout.html b/templates/.layout.html new file mode 100644 index 0000000..a81cc81 --- /dev/null +++ b/templates/.layout.html @@ -0,0 +1,15 @@ + + + + + + + + {% block head %}{% endblock %} + + + {% block body %}{% endblock %} + + + + diff --git a/templates/app.html b/templates/app.html index 22a9a10..bd2bfff 100644 --- a/templates/app.html +++ b/templates/app.html @@ -1,13 +1,71 @@ - - - - - - - - {% block head %}{% endblock %} - - - {% block body %}{% endblock %} - - +{% extends '.layout.html' %} {% block head %}{% endblock %} {% block body %} +

+ Welcome to the Dragon Warrior Monsters 2 App +

+
+ + + + + +
+ +
+ + +
+
+
+ +{% for file in js_files %} + +{% endfor %} {% endblock %} diff --git a/templates/breeds.html b/templates/breeds.html index 47fc48a..e72428b 100644 --- a/templates/breeds.html +++ b/templates/breeds.html @@ -1,48 +1,34 @@ - - - - - - Breeding Pairs - - - -
- {% if selected_monster %} -

Breeding Pairs

-
-
-

Base

-
    - {% for pair in selected_monster.base_pair %} -
  • - - {{ pair }} - -
  • - {% endfor %} -
-
-
-

Mates

-
    - {% for pair in selected_monster.mate_pair %} -
  • - - {{ pair }} - -
  • - {% endfor %} -
-
-
- {% endif %} +{% extends '.layout.html' %} {% block head %}{% endblock %} {% block body %} +
+ {% if selected_monster %} +

Breeding Pairs

+
+
+

Base

+
    + {% for pair in selected_monster.base_pair %} +
  • + {{ pair }} +
  • + {% endfor %} +
- {% for file in js_files %} - - {% endfor %} - - +
+

Mates

+
    + {% for pair in selected_monster.mate_pair %} +
  • + {{ pair }} +
  • + {% endfor %} +
+
+
+ {% endif %} +
+{% for file in js_files %} + +{% endfor %} {% endblock %} diff --git a/templates/footer.html b/templates/footer.html deleted file mode 100644 index 2cd6fd9..0000000 --- a/templates/footer.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - About - - - - - -
-

About The App

-

- Dragon Warrior Monsters 2 App, an open-source project where you can explore information about monsters, breeding pairs, and more. -

-

- You can contribute to the development and improvement of this app on our Git repository. Feel free to explore the code, report issues, and submit pull requests. -

- -
- - - - diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index b0519e3..0000000 --- a/templates/index.html +++ /dev/null @@ -1,58 +0,0 @@ -{% extends 'app.html' %} {% block head %}{% endblock %} {% block body %} -

- Welcome to the Dragon Warrior Monsters 2 App -

-
- - - - - -
- -
- - -
-
- -
-{% for file in js_files %} - -{% endfor %} {% endblock %} diff --git a/templates/stats.html b/templates/stats.html index ec73a06..03adbc1 100644 --- a/templates/stats.html +++ b/templates/stats.html @@ -1,48 +1,39 @@ - - - - - - Monster Stats - - - -
-

{{ monster.name }}

-

Family: {{ monster.family }}

-
-

Stats:

-
    -
    -
  • - {{ monster.maxlvl }} -
  • -
  • {{ monster.exp }}
  • -
  • {{ monster.hp }}
  • -
  • {{ monster.atk }}
  • -
  • {{ monster.mp }}
  • -
  • {{ monster.def }}
  • -
  • {{ monster.agl }}
  • -
  • {{ monster.int }}
  • -
    -
+{% extends '.layout.html' %} {% block head %}{% endblock %} {% block body %} +
+

{{ monster.name }}

+

Family: {{ monster.family }}

+
+

Stats:

+
    +
    +
  • + {{ monster.maxlvl }} +
  • +
  • {{ monster.exp }}
  • +
  • {{ monster.hp }}
  • +
  • {{ monster.atk }}
  • +
  • {{ monster.mp }}
  • +
  • {{ monster.def }}
  • +
  • {{ monster.agl }}
  • +
  • {{ monster.int }}
  • +
+
-

Skills:

-
    - {% for skill in monster.skills %} -
  • {{ skill }}
  • - {% endfor %} -
-
-

In Story: {{ monster.in_story }}

-

Spawn Locations:

-
-
    - {% for location in monster.spawn_locations %} -
  • {{ location.map }} - {{ location.description }}
  • - {% endfor %} -
-
- - +

Skills:

+
    + {% for skill in monster.skills %} +
  • {{ skill }}
  • + {% endfor %} +
+
+

In Story: {{ monster.in_story }}

+

Spawn Locations:

+
+
    + {% for location in monster.spawn_locations %} +
  • {{ location.map }} - {{ location.description }}
  • + {% endfor %} +
+
+{% endblock %}