diff --git a/tunictracker/tracker/forms.py b/tunictracker/tracker/forms.py index b2870f4..d902d38 100644 --- a/tunictracker/tracker/forms.py +++ b/tunictracker/tracker/forms.py @@ -5,9 +5,9 @@ from json import loads class ServerAddressForm(forms.Form): server_address_form = forms.URLField( max_length=1312, initial="http://localhost:8000/", empty_value="http://localhost:8000/", label="") - server_address_form.widget.attrs["class"] = "w-full text-sm rounded-xl border-2 border-bluelight-dark bg-[#242424]/10" + server_address_form.widget.attrs["class"] = "w-full rounded-xl border-none shadow-inner shadow-[#242424] bg-white bg-opacity-10" class BackendFilepathForm(forms.Form): backend_filepath_form = forms.CharField() - backend_filepath_form.widget.attrs["class"] = "w-full text-sm rounded-xl border-2 border-bluelight-dark bg-[#242424]/10" + backend_filepath_form.widget.attrs["class"] = "w-full rounded-xl border-none shadow-inner shadow-[#242424] bg-white bg-opacity-10" diff --git a/tunictracker/tracker/static/tracker/assets/refresh.js b/tunictracker/tracker/static/tracker/assets/refresh.js index 41dd624..0ffc4a3 100644 --- a/tunictracker/tracker/static/tracker/assets/refresh.js +++ b/tunictracker/tracker/static/tracker/assets/refresh.js @@ -20,6 +20,27 @@ window.onload = () => { ); }; +function banana(event) { + show_breakdown(event.dataset.scene); +} + +function show_breakdown(scene) { + console.log(scene); + Array.from(document.getElementById("breakdown-list").children).forEach( + (breakdown) => { + if (breakdown.id == `${scene}-breakdown`) { + breakdown.classList.remove("hidden"); + } else { + breakdown.classList.add("hidden"); + } + } + ); +} + +function notices_ur_debug() { + document.getElementById("debug-block").classList.toggle("hidden"); +} + async function get_updated_filepath() { fetch(`${document.URL}get/settings`) .then((response) => response.json()) @@ -112,16 +133,15 @@ async function refresh_elements(cross_codes) { .getElementById("overview-totals") .querySelector(".overview-entrances"); let summary_block = document - .getElementById("overview") - .querySelector(".summary-list") + .getElementById("summary-list") .firstElementChild.firstElementChild.cloneNode(true); + summary_block.id = ""; let breakdown_block = document - .getElementById("overview") - .querySelector(".breakdown-list") + .getElementById("breakdown-list") .firstElementChild.cloneNode(true); + breakdown_block.id = ""; let cross_codes_block = document - .getElementById("overview") - .querySelector(".breakdown-list") + .getElementById("breakdown-list") .firstElementChild.querySelector(".codes-block") .cloneNode(true); breakdown_block.classList.remove("hidden"); @@ -130,16 +150,20 @@ async function refresh_elements(cross_codes) { .firstElementChild.cloneNode(true); debug_item.classList.remove("hidden"); let new_breakdown_list = document - .getElementById("overview") - .querySelector(".breakdown-list") + .getElementById("breakdown-list") .cloneNode(true); let new_summary_list = document - .getElementById("overview") - .querySelector(".summary-list") + .getElementById("summary-list") .cloneNode(true); let new_debug_block = document .getElementById("debug-block") .cloneNode(true); + let current_open_breakdown = ""; + Array.from(new_breakdown_list.children).forEach((scene) => { + if (!Array.from(scene.classList).includes("hidden")) { + current_open_breakdown = scene.id; + } + }); // Clear out the current lists. new_breakdown_list.innerHTML = ""; @@ -154,8 +178,7 @@ async function refresh_elements(cross_codes) { Object.keys(all_scenes).forEach((scene) => { // Create variables for element pointers. summary_block = document - .getElementById("overview") - .querySelector(".summary-list") + .getElementById("summary-list") .firstElementChild.firstElementChild.cloneNode(true); summary_block.classList.remove("hidden"); let summary_title = summary_block.querySelector(".summary-title"); @@ -164,10 +187,8 @@ async function refresh_elements(cross_codes) { summary_block.querySelector(".summary-entrances"); breakdown_block = document - .getElementById("overview") - .querySelector(".breakdown-list") + .getElementById("breakdown-list") .firstElementChild.cloneNode(true); - breakdown_block.classList.remove("hidden"); let breakdown_block_title = breakdown_block.querySelector( ".breakdown-block-title" ); @@ -197,8 +218,7 @@ async function refresh_elements(cross_codes) { .firstElementChild.cloneNode(true); cross_codes_block = document - .getElementById("overview") - .querySelector(".breakdown-list") + .getElementById("breakdown-list") .firstElementChild.querySelector(".codes-block") .cloneNode(true); let new_cross_codes_block_list = cross_codes_block @@ -253,13 +273,19 @@ async function refresh_elements(cross_codes) { } }); Object.keys(all_scenes[scene].Entrances).forEach((entrances) => { - if (all_scenes[scene].Entrances[entrances] == "") { + if (all_scenes[scene].Entrances[entrances].Door == "") { breakdown_block_entrances_list_item.textContent = `❌ ${entrances}`; new_breakdown_block_entrances_list.appendChild( breakdown_block_entrances_list_item.cloneNode(true) ); } else { - breakdown_block_mapped_list_item.textContent = `✔️ ${entrances} -> ${all_scenes[scene].Entrances[entrances]}`; + breakdown_block_mapped_list_item.textContent = `✔️ ${entrances} -> ${all_scenes[scene].Entrances[entrances].Door}`; + breakdown_block_mapped_list_item.id = `${entrances}-mapped`; + breakdown_block_mapped_list_item.dataset.scene = + all_scenes[scene].Entrances[entrances].Scene; + // breakdown_block_mapped_list_item.onclick = () => { + // show_breakdown(all_scenes[scene].Entrances[entrances].Scene); + // }; new_breakdown_block_mapped_list.appendChild( breakdown_block_mapped_list_item.cloneNode(true) ); @@ -325,22 +351,30 @@ async function refresh_elements(cross_codes) { // Apply color coding to summary block summary_block.firstElementChild.classList.remove( - "bg-highlight-both-translucent", - "bg-highlight-checks-translucent", - "bg-highlight-entrances-translucent" + "from-highlight-both-translucent-light", + "from-highlight-checks-translucent-light", + "from-highlight-entrances-translucent-light", + "to-highlight-both-translucent-dark", + "to-highlight-checks-translucent-dark", + "to-highlight-entrances-translucent-dark" ); if ( scene_checks_undiscovered > 0 && scene_entrances_undiscovered > 0 ) { - summary_block.firstElementChild.classList.add("bg-highlight-both-translucent"); + summary_block.firstElementChild.classList.add( + "from-highlight-both-translucent-light", + "to-highlight-both-translucent-dark" + ); } else if (scene_checks_undiscovered > 0) { summary_block.firstElementChild.classList.add( - "bg-highlight-checks-translucent" + "from-highlight-checks-translucent-light", + "to-highlight-checks-translucent-dark" ); } else if (scene_entrances_undiscovered > 0) { summary_block.firstElementChild.classList.add( - "bg-highlight-entrances-translucent" + "from-highlight-entrances-translucent-light", + "to-highlight-entrances-translucent-dark" ); } @@ -359,9 +393,21 @@ async function refresh_elements(cross_codes) { .querySelector(".codes-list") .replaceWith(new_cross_codes_block_list); + breakdown_block.id = `${ + breakdown_block.querySelector(".breakdown-block-title").textContent + }-breakdown`; + summary_block.id = `${ + summary_block.querySelector(".summary-title").textContent + }-summary`; + breakdown_block.classList.add("hidden"); + // Append relevant elements to lists. + if (current_open_breakdown == breakdown_block.id) { + breakdown_block.classList.remove("hidden"); + } if (scene == current_scene_name) { summary_block.classList.add("hidden"); + breakdown_block.classList.remove("hidden"); breakdown_block .querySelector(".codes-block") .classList.remove("hidden"); @@ -369,9 +415,12 @@ async function refresh_elements(cross_codes) { .getElementById("breakdown-current") .firstElementChild.replaceWith(breakdown_block.cloneNode(true)); breakdown_block.classList.add("hidden"); + breakdown_block + .querySelector(".codes-block") + .classList.add("hidden"); } else if ( scene_checks_undiscovered <= 0 && - scene_entrances_undiscovered <= 0 + scene_entrances_total <= 0 ) { summary_block.classList.add("hidden"); } @@ -387,16 +436,30 @@ async function refresh_elements(cross_codes) { // Replace with new data. document - .getElementById("overview") - .querySelector(".summary-list") + .getElementById("summary-list") .replaceWith(new_summary_list.cloneNode(true)); document - .getElementById("overview") - .querySelector(".breakdown-list") + .getElementById("breakdown-list") .replaceWith(new_breakdown_list.cloneNode(true)); document .getElementById("debug-block") .replaceWith(new_debug_block.cloneNode(true)); + + Object.keys(all_scenes).forEach((scene) => { + document.getElementById(`${scene}-summary`).onclick = () => { + show_breakdown(scene); + }; + // Object.keys(all_scenes[scene].Entrances).forEach((entrance) => { + // if (all_scenes[scene].Entrances[entrance].Door != "") { + // let test = document.getElementById(`${entrance}-mapped`); + // console.log(all_scenes[scene].Entrances[entrance].Scene); + // document.getElementById(`${entrance}-mapped`).onclick = () => { + // console.log("aaaaa"); + // // show_breakdown(all_scenes[scene].Entrances[entrance].Scene); + // }; + // } + // }); + }); }, (error) => { document.getElementById("status-block").classList.remove("hidden"); diff --git a/tunictracker/tracker/templates/index.html b/tunictracker/tracker/templates/index.html index 4cf74ff..2a547fb 100644 --- a/tunictracker/tracker/templates/index.html +++ b/tunictracker/tracker/templates/index.html @@ -13,7 +13,7 @@ {% tailwind_css %} - + {% block content %} {% endblock content %} diff --git a/tunictracker/tracker/templates/tracker/address/index.html b/tunictracker/tracker/templates/tracker/address/index.html index f5382e7..9ae569b 100644 --- a/tunictracker/tracker/templates/tracker/address/index.html +++ b/tunictracker/tracker/templates/tracker/address/index.html @@ -1,14 +1,13 @@
- {% csrf_token %} + class="my-auto justify-center align-top min-w-fit text-md text-nowrap">Backend {% for field in server_address_form %}{{ field }}{% endfor %} - +
diff --git a/tunictracker/tracker/templates/tracker/breakdown/block.html b/tunictracker/tracker/templates/tracker/breakdown/block.html index 33ec664..1a6e46e 100644 --- a/tunictracker/tracker/templates/tracker/breakdown/block.html +++ b/tunictracker/tracker/templates/tracker/breakdown/block.html @@ -1,4 +1,5 @@ -
+
{{ scene_title }}
@@ -32,7 +33,7 @@ {% for entrance_origin, entrance_destination in scene_data.Entrances.items %} - {% if entrance_destination == "" %} + {% if entrance_destination.Door == "" %}
    ❌ {{ entrance_origin }}
@@ -46,18 +47,24 @@
-
- +
+ {% for entrance_origin, entrance_destination in scene_data.Entrances.items %} {% if entrance_destination %} -
    - ✔️ {{ entrance_origin }} -> {{ entrance_destination }} -
+ {% endif %} {% endfor %}
{% include "tracker/codes/index.html" %}
+
diff --git a/tunictracker/tracker/templates/tracker/codes/index.html b/tunictracker/tracker/templates/tracker/codes/index.html index 7ac5690..740b68d 100644 --- a/tunictracker/tracker/templates/tracker/codes/index.html +++ b/tunictracker/tracker/templates/tracker/codes/index.html @@ -1,4 +1,4 @@ -
+
Holy Cross Codes
diff --git a/tunictracker/tracker/templates/tracker/index.html b/tunictracker/tracker/templates/tracker/index.html index ec990d0..1b1a83b 100644 --- a/tunictracker/tracker/templates/tracker/index.html +++ b/tunictracker/tracker/templates/tracker/index.html @@ -1,19 +1,19 @@ {% extends "index.html" %} {% load static %} {% block content %} -
-
+
+
{% if debug != '' %}
- + A trans pride fox emoji. - + A trans pride fox emoji.

-
Checks: {{ totals.Checks.Undiscovered }}/{{ totals.Checks.Total }}
Entrances: {{ totals.Entrances.Undiscovered }}/{{ totals.Entrances.Total }}
+
+ Summary +
+
+
{% include "tracker/summary/list.html" %}
+
+

-
{% include "tracker/status/index.html" %} -
-
-
- {% include "tracker/breakdown/block.html" with scene_title=current_scene.title scene_data=current_scene.data %} -
-
-
- Summary -
-
-
{% include "tracker/summary/list.html" %}
-
-
-
- Breakdown -
- {% include "tracker/breakdown/block.html" with extra_classes="hidden" %} - {% for scene_title, scene_data in scenes.items %} - {% if scene_title == current_scene.title %} - {% include "tracker/breakdown/block.html" with extra_classes="hidden" %} - {% else %} - {% include "tracker/breakdown/block.html" %} - {% endif %} - {% endfor %} -
-
+
+
+ {% include "tracker/breakdown/block.html" with extra_classes="hidden" %} + {% for scene_title, scene_data in scenes.items %} + {% include "tracker/breakdown/block.html" with extra_classes="hidden" %} + {% endfor %} +
+
+ {% include "tracker/breakdown/block.html" with scene_title=current_scene.title scene_data=current_scene.data %}
-
+
Settings -
- {% include "tracker/settings/index.html" %} - {% include "tracker/address/index.html" %} -
-
-
- Tracker Debug -
- - {% for name, value in debug.items %} -
    - {{ name }}: {{ value }} -
- {% endfor %} + {% include "tracker/settings/index.html" %} + {% include "tracker/address/index.html" %} +
+
{% else %}
{% endif %}
+
{% endblock content %} diff --git a/tunictracker/tracker/templates/tracker/settings/index.html b/tunictracker/tracker/templates/tracker/settings/index.html index 5b2d31c..66769c9 100644 --- a/tunictracker/tracker/templates/tracker/settings/index.html +++ b/tunictracker/tracker/templates/tracker/settings/index.html @@ -1,14 +1,13 @@
- - {% csrf_token %} - - {% for field in backend_filepath_form %}{{ field }}{% endfor %} - + + {% csrf_token %} + + {% for field in backend_filepath_form %}{{ field }}{% endfor %} +
diff --git a/tunictracker/tracker/templates/tracker/summary/block.html b/tunictracker/tracker/templates/tracker/summary/block.html index 6e42ba6..729f571 100644 --- a/tunictracker/tracker/templates/tracker/summary/block.html +++ b/tunictracker/tracker/templates/tracker/summary/block.html @@ -1,5 +1,7 @@ -