From 70bb880cf7205d60ae45f6231810ee6a4513288d Mon Sep 17 00:00:00 2001 From: David Camp Date: Sun, 3 May 2020 13:32:02 -0700 Subject: [PATCH 1/3] First Pass at a 'Start New Week' feature --- css/styles.css | 5 +++++ index.html | 3 +++ js/scripts.js | 16 ++++++++++++++++ locales/en.json | 4 +++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/css/styles.css b/css/styles.css index a51c333a..cd42273e 100644 --- a/css/styles.css +++ b/css/styles.css @@ -322,6 +322,11 @@ input[type=number] { color: #E45B5B; } +.button.button--newweek { + color: #49b87f; + display: none; +} + .table-wrapper { display: inline-block; max-width: 98%; diff --git a/index.html b/index.html index 04f0e9e8..7f075f5a 100644 --- a/index.html +++ b/index.html @@ -196,7 +196,10 @@
+
+ +
diff --git a/js/scripts.js b/js/scripts.js index 51fd89b1..84602658 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -92,6 +92,15 @@ const initialize = function () { update(); } }); + + $("#new-week").on("click", function() { + if (window.confirm(i18next.t("prices.week-warning"))) { + var prev = $("#new-week").attr("nextPattern") + sell_inputs.forEach(input => input.value = '') + fillFields([], false, prev) + update() + } + }); }; const updateLocalStorage = function (prices, first_buy, previous_pattern) { @@ -294,6 +303,13 @@ const calculateOutput = function (data, first_buy, previous_pattern) { .filter(val => val.pattern_number == poss.pattern_number) .length; out_line += `${displayPercentage(poss.category_total_probability)}`; + if(poss.category_total_probability >= .9995) { + $("#new-week").show(); + $("#new-week").attr("nextPattern", poss.pattern_number); + } else { + $("#new-week").hide(); + $("#new-week").attr("nextPattern", -1); + } } out_line += `${displayPercentage(poss.probability)}`; for (let day of poss.prices.slice(2)) { diff --git a/locales/en.json b/locales/en.json index b1bfcfa0..9537573e 100644 --- a/locales/en.json +++ b/locales/en.json @@ -33,7 +33,9 @@ "copy-permalink": "Copy permalink", "permalink-copied": "Permalink copied!", "reset": "Reset Turnip Prophet", - "reset-warning": "Are you sure you want to reset all fields?\n\nThis cannot be undone!" + "reset-warning": "Are you sure you want to reset all fields?\n\nThis cannot be undone!", + "new-week": "Start New Week", + "week-warning": "Are you sure you want to reset prices?\nThis will also automatically set the input for the Previous Pattern\nThis cannot be undone!" }, "weekdays": { "monday": "Monday", From 8b7f54540334be91dea7344997a390f539e0f759 Mon Sep 17 00:00:00 2001 From: David Camp Date: Sun, 3 May 2020 14:26:11 -0700 Subject: [PATCH 2/3] fixed buttons sometimes appearing on seperate lines --- css/styles.css | 7 +++++++ index.html | 8 ++++---- js/scripts.js | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/css/styles.css b/css/styles.css index cd42273e..7352f21b 100644 --- a/css/styles.css +++ b/css/styles.css @@ -318,13 +318,20 @@ input[type=number] { box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05), 0 3px 6px rgba(0, 0, 0, 0.09); } +#reset-btns { + display: flex; + padding: 10px; +} + .button.button--reset { color: #E45B5B; + margin: 10px; } .button.button--newweek { color: #49b87f; display: none; + margin: 10px; } .table-wrapper { diff --git a/index.html b/index.html index 7f075f5a..59553c26 100644 --- a/index.html +++ b/index.html @@ -196,10 +196,10 @@
-
- - -
+
+ + +
diff --git a/js/scripts.js b/js/scripts.js index 84602658..00625262 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -98,6 +98,7 @@ const initialize = function () { var prev = $("#new-week").attr("nextPattern") sell_inputs.forEach(input => input.value = '') fillFields([], false, prev) + $("#new-week").hide(); update() } }); From a903d5932e23af545bb64edf4c6850bc34994304 Mon Sep 17 00:00:00 2001 From: David Camp Date: Sat, 16 May 2020 10:03:12 -0700 Subject: [PATCH 3/3] updated new button to use color variables --- css/styles.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/css/styles.css b/css/styles.css index 1b0e0a49..a54ebb81 100644 --- a/css/styles.css +++ b/css/styles.css @@ -56,6 +56,7 @@ --button-text-color: var(--nook-phone-text-color); --button-reset-text-color: #E45B5B; + --button-newweek-text-color: #49b87f; --table-range0: hsl(140, 80%, 85%); --table-range1: hsl(90, 80%, 85%); @@ -108,6 +109,7 @@ --button-text-color: var(--nook-phone-text-color); --button-reset-text-color: #E45B5B; + --button-newweek-text-color: #49b87f; --table-range0: hsl(140, 80%, 27%); --table-range1: hsl(90, 80%, 20%); @@ -444,7 +446,7 @@ input[type=number] { } .button.button--newweek { - color: #49b87f; + color: var(--button-newweek-text-color); display: none; margin: 10px; }