From 22dd7a45cb5633ad9dc086a9412185ce021366a2 Mon Sep 17 00:00:00 2001 From: Marianna Demenko <65931890+Mdemenko1@users.noreply.github.com> Date: Thu, 2 May 2024 15:17:59 -0400 Subject: [PATCH 1/4] 1036: wip --- .../programs/connect_for_health/calculator.py | 5 +- translations/static/js/theme.js | 11 + translations/templates/base.html | 213 +++++++++++------- 3 files changed, 146 insertions(+), 83 deletions(-) create mode 100644 translations/static/js/theme.js diff --git a/programs/programs/connect_for_health/calculator.py b/programs/programs/connect_for_health/calculator.py index 5f5758f3..f5f34fc4 100644 --- a/programs/programs/connect_for_health/calculator.py +++ b/programs/programs/connect_for_health/calculator.py @@ -45,8 +45,9 @@ def eligible(self) -> Eligibility: return e def value(self, eligible_members: int): - limits = cache.fetch() - return limits[self.screen.county] * 12 + # limits = cache.fetch() + return 0 + # return limits[self.screen.county] * 12 class CFHCache(Cache): diff --git a/translations/static/js/theme.js b/translations/static/js/theme.js new file mode 100644 index 00000000..c48c30bd --- /dev/null +++ b/translations/static/js/theme.js @@ -0,0 +1,11 @@ +(() => { + "use strict"; + const toggleDarkMode = document.querySelector("input[id=bd-theme]"); + toggleDarkMode.addEventListener("change", function () { + if (this.checked) { + document.documentElement.setAttribute("data-bs-theme", "dark"); + } else { + document.documentElement.setAttribute("data-bs-theme", "light"); + } + }); +})(); diff --git a/translations/templates/base.html b/translations/templates/base.html index 371c9086..f4b3e2b7 100644 --- a/translations/templates/base.html +++ b/translations/templates/base.html @@ -1,105 +1,156 @@ {% load static %} - + Translations Admin - --> + - + + +
+
+
+ + + +
+
+ +
+
+ + + +
+
+
-
-
-
{% block content %} {% endblock content %}
-
+ +
+
+
+
{% block content %} {% endblock content %}
+ From 3e3f2cdef259ac18ea00f74a7da0feacf65fa7fd Mon Sep 17 00:00:00 2001 From: Marianna Demenko <65931890+Mdemenko1@users.noreply.github.com> Date: Mon, 6 May 2024 21:22:26 -0400 Subject: [PATCH 2/4] Switching to Bulma --- translations/static/css/bulma_switch.css | 1 + translations/static/js/theme.js | 28 ++- translations/templates/base.html | 229 ++++++++++++----------- 3 files changed, 141 insertions(+), 117 deletions(-) create mode 100644 translations/static/css/bulma_switch.css diff --git a/translations/static/css/bulma_switch.css b/translations/static/css/bulma_switch.css new file mode 100644 index 00000000..5ec9dcad --- /dev/null +++ b/translations/static/css/bulma_switch.css @@ -0,0 +1 @@ +.switch{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.switch{cursor:pointer;display:inline-flex;align-items:center;position:relative;margin-right:0.5em}.switch+.switch:last-child{margin-right:0}.switch input[type=checkbox]{position:absolute;left:0;opacity:0;outline:none;z-index:-1}.switch input[type=checkbox]+.check{display:flex;align-items:center;flex-shrink:0;width:2.75em;height:1.575em;padding:.2em;background:#b5b5b5;border-radius:4px;transition:background 150ms ease-out,box-shadow 150ms ease-out}.switch input[type=checkbox]+.check.is-white-passive,.switch input[type=checkbox]+.check:hover{background:#fff}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-black-passive,.switch input[type=checkbox]+.check:hover{background:#0a0a0a}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-light-passive,.switch input[type=checkbox]+.check:hover{background:#f5f5f5}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-dark-passive,.switch input[type=checkbox]+.check:hover{background:#363636}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-primary-passive,.switch input[type=checkbox]+.check:hover{background:#00d1b2}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-link-passive,.switch input[type=checkbox]+.check:hover{background:#485fc7}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-info-passive,.switch input[type=checkbox]+.check:hover{background:#3e8ed0}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-success-passive,.switch input[type=checkbox]+.check:hover{background:#48c78e}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-warning-passive,.switch input[type=checkbox]+.check:hover{background:#ffe08a}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check.is-danger-passive,.switch input[type=checkbox]+.check:hover{background:#f14668}.switch input[type=checkbox]+.check.input[type=checkbox]+.switch input[type=checkbox]+.check.check{background:'pink'}.switch input[type=checkbox]+.check:before{content:"";display:block;border-radius:4px;width:1.175em;height:1.175em;background:#f5f5f5;transition:transform 150ms ease-out;will-change:transform;transform-origin:left}.switch input[type=checkbox]+.check.is-elastic:before{transform:scaleX(1.5);border-radius:4px}.switch input[type=checkbox]:checked+.check{background:#00d1b2}.switch input[type=checkbox]:checked+.check.is-white{background:#fff}.switch input[type=checkbox]:checked+.check.is-black{background:#0a0a0a}.switch input[type=checkbox]:checked+.check.is-light{background:#f5f5f5}.switch input[type=checkbox]:checked+.check.is-dark{background:#363636}.switch input[type=checkbox]:checked+.check.is-primary{background:#00d1b2}.switch input[type=checkbox]:checked+.check.is-link{background:#485fc7}.switch input[type=checkbox]:checked+.check.is-info{background:#3e8ed0}.switch input[type=checkbox]:checked+.check.is-success{background:#48c78e}.switch input[type=checkbox]:checked+.check.is-warning{background:#ffe08a}.switch input[type=checkbox]:checked+.check.is-danger{background:#f14668}.switch input[type=checkbox]:checked+.check:before{transform:translate3d(100%, 0, 0)}.switch input[type=checkbox]:checked+.check.is-elastic:before{transform:translate3d(50%, 0, 0) scaleX(1.5)}.switch input[type=checkbox]:focus,.switch input[type=checkbox]:active{outline:none}.switch .control-label{padding-left:0.5em}.switch:hover input[type=checkbox]+.check{background:rgba(181,181,181,0.9)}.switch:hover input[type=checkbox]+.check.is-white-passive{background:rgba(255,255,255,0.9)}.switch:hover input[type=checkbox]+.check.is-black-passive{background:rgba(10,10,10,0.9)}.switch:hover input[type=checkbox]+.check.is-light-passive{background:rgba(245,245,245,0.9)}.switch:hover input[type=checkbox]+.check.is-dark-passive{background:rgba(54,54,54,0.9)}.switch:hover input[type=checkbox]+.check.is-primary-passive{background:rgba(0,209,178,0.9)}.switch:hover input[type=checkbox]+.check.is-link-passive{background:rgba(72,95,199,0.9)}.switch:hover input[type=checkbox]+.check.is-info-passive{background:rgba(62,142,208,0.9)}.switch:hover input[type=checkbox]+.check.is-success-passive{background:rgba(72,199,142,0.9)}.switch:hover input[type=checkbox]+.check.is-warning-passive{background:rgba(255,224,138,0.9)}.switch:hover input[type=checkbox]+.check.is-danger-passive{background:rgba(241,70,104,0.9)}.switch:hover input[type=checkbox]:checked+.check{background:rgba(0,209,178,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-white{background:rgba(255,255,255,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-black{background:rgba(10,10,10,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-light{background:rgba(245,245,245,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-dark{background:rgba(54,54,54,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-primary{background:rgba(0,209,178,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-link{background:rgba(72,95,199,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-info{background:rgba(62,142,208,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-success{background:rgba(72,199,142,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-warning{background:rgba(255,224,138,0.9)}.switch:hover input[type=checkbox]:checked+.check.is-danger{background:rgba(241,70,104,0.9)}.switch.is-rounded input[type=checkbox]+.check{border-radius:9999px}.switch.is-rounded input[type=checkbox]+.check:before{border-radius:9999px}.switch.is-rounded input[type=checkbox].is-elastic:before{transform:scaleX(1.5);border-radius:9999px}.switch.is-outlined input[type=checkbox]+.check{background:transparent;border:0.1rem solid #b5b5b5;padding:.1em}.switch.is-outlined input[type=checkbox]+.check.is-white-passive{border:0.1rem solid rgba(255,255,255,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-white-passive:before{background:#fff}.switch.is-outlined input[type=checkbox]+.check.is-white-passive:hover{border-color:rgba(255,255,255,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-black-passive{border:0.1rem solid rgba(10,10,10,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-black-passive:before{background:#0a0a0a}.switch.is-outlined input[type=checkbox]+.check.is-black-passive:hover{border-color:rgba(10,10,10,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-light-passive{border:0.1rem solid rgba(245,245,245,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-light-passive:before{background:#f5f5f5}.switch.is-outlined input[type=checkbox]+.check.is-light-passive:hover{border-color:rgba(245,245,245,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-dark-passive{border:0.1rem solid rgba(54,54,54,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-dark-passive:before{background:#363636}.switch.is-outlined input[type=checkbox]+.check.is-dark-passive:hover{border-color:rgba(54,54,54,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-primary-passive{border:0.1rem solid rgba(0,209,178,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-primary-passive:before{background:#00d1b2}.switch.is-outlined input[type=checkbox]+.check.is-primary-passive:hover{border-color:rgba(0,209,178,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-link-passive{border:0.1rem solid rgba(72,95,199,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-link-passive:before{background:#485fc7}.switch.is-outlined input[type=checkbox]+.check.is-link-passive:hover{border-color:rgba(72,95,199,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-info-passive{border:0.1rem solid rgba(62,142,208,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-info-passive:before{background:#3e8ed0}.switch.is-outlined input[type=checkbox]+.check.is-info-passive:hover{border-color:rgba(62,142,208,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-success-passive{border:0.1rem solid rgba(72,199,142,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-success-passive:before{background:#48c78e}.switch.is-outlined input[type=checkbox]+.check.is-success-passive:hover{border-color:rgba(72,199,142,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-warning-passive{border:0.1rem solid rgba(255,224,138,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-warning-passive:before{background:#ffe08a}.switch.is-outlined input[type=checkbox]+.check.is-warning-passive:hover{border-color:rgba(255,224,138,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-danger-passive{border:0.1rem solid rgba(241,70,104,0.9)}.switch.is-outlined input[type=checkbox]+.check.is-danger-passive:before{background:#f14668}.switch.is-outlined input[type=checkbox]+.check.is-danger-passive:hover{border-color:rgba(241,70,104,0.9)}.switch.is-outlined input[type=checkbox]+.check:before{background:#b5b5b5}.switch.is-outlined input[type=checkbox]:checked+.check{border-color:#00d1b2}.switch.is-outlined input[type=checkbox]:checked+.check.is-white{background:transparent;border-color:#fff}.switch.is-outlined input[type=checkbox]:checked+.check.is-white:before{background:#fff}.switch.is-outlined input[type=checkbox]:checked+.check.is-black{background:transparent;border-color:#0a0a0a}.switch.is-outlined input[type=checkbox]:checked+.check.is-black:before{background:#0a0a0a}.switch.is-outlined input[type=checkbox]:checked+.check.is-light{background:transparent;border-color:#f5f5f5}.switch.is-outlined input[type=checkbox]:checked+.check.is-light:before{background:#f5f5f5}.switch.is-outlined input[type=checkbox]:checked+.check.is-dark{background:transparent;border-color:#363636}.switch.is-outlined input[type=checkbox]:checked+.check.is-dark:before{background:#363636}.switch.is-outlined input[type=checkbox]:checked+.check.is-primary{background:transparent;border-color:#00d1b2}.switch.is-outlined input[type=checkbox]:checked+.check.is-primary:before{background:#00d1b2}.switch.is-outlined input[type=checkbox]:checked+.check.is-link{background:transparent;border-color:#485fc7}.switch.is-outlined input[type=checkbox]:checked+.check.is-link:before{background:#485fc7}.switch.is-outlined input[type=checkbox]:checked+.check.is-info{background:transparent;border-color:#3e8ed0}.switch.is-outlined input[type=checkbox]:checked+.check.is-info:before{background:#3e8ed0}.switch.is-outlined input[type=checkbox]:checked+.check.is-success{background:transparent;border-color:#48c78e}.switch.is-outlined input[type=checkbox]:checked+.check.is-success:before{background:#48c78e}.switch.is-outlined input[type=checkbox]:checked+.check.is-warning{background:transparent;border-color:#ffe08a}.switch.is-outlined input[type=checkbox]:checked+.check.is-warning:before{background:#ffe08a}.switch.is-outlined input[type=checkbox]:checked+.check.is-danger{background:transparent;border-color:#f14668}.switch.is-outlined input[type=checkbox]:checked+.check.is-danger:before{background:#f14668}.switch.is-outlined input[type=checkbox]:checked+.check:before{background:#00d1b2}.switch.is-outlined:hover input[type=checkbox]+.check{background:transparent;border-color:rgba(181,181,181,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check{background:transparent;border-color:rgba(0,209,178,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-white{border-color:rgba(255,255,255,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-black{border-color:rgba(10,10,10,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-light{border-color:rgba(245,245,245,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-dark{border-color:rgba(54,54,54,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-primary{border-color:rgba(0,209,178,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-link{border-color:rgba(72,95,199,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-info{border-color:rgba(62,142,208,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-success{border-color:rgba(72,199,142,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-warning{border-color:rgba(255,224,138,0.9)}.switch.is-outlined:hover input[type=checkbox]:checked+.check.is-danger{border-color:rgba(241,70,104,0.9)}.switch.is-small{border-radius:2px;font-size:.75rem}.switch.is-medium{font-size:1.25rem}.switch.is-large{font-size:1.5rem}.switch[disabled]{opacity:0.5;cursor:not-allowed;color:#7a7a7a} \ No newline at end of file diff --git a/translations/static/js/theme.js b/translations/static/js/theme.js index c48c30bd..acdb322c 100644 --- a/translations/static/js/theme.js +++ b/translations/static/js/theme.js @@ -1,11 +1,27 @@ (() => { "use strict"; - const toggleDarkMode = document.querySelector("input[id=bd-theme]"); + const prefersDarkMode = window.matchMedia( + "(prefers-color-scheme: dark)" + ).matches; + const defaultTheme = prefersDarkMode ? "dark" : "light"; + const preferredTheme = localStorage.getItem("theme"); + const toggleDarkMode = document.querySelector("#bd-theme"); + const isDarkTheme = localStorage.getItem("theme") === "dark"; + + if (!preferredTheme) { + localStorage.setItem("theme", defaultTheme); + } + + document.documentElement.setAttribute( + "data-theme", + preferredTheme || defaultTheme + ); + + toggleDarkMode.checked = isDarkTheme ? true : false; + toggleDarkMode.addEventListener("change", function () { - if (this.checked) { - document.documentElement.setAttribute("data-bs-theme", "dark"); - } else { - document.documentElement.setAttribute("data-bs-theme", "light"); - } + const newTheme = isDarkTheme ? "light" : "dark"; + localStorage.setItem("theme", newTheme); + document.documentElement.setAttribute("data-theme", newTheme); }); })(); diff --git a/translations/templates/base.html b/translations/templates/base.html index f4b3e2b7..26417192 100644 --- a/translations/templates/base.html +++ b/translations/templates/base.html @@ -1,22 +1,16 @@ {% load static %} - + Translations Admin - - +
-
-
- - - -
-
- --> +
+ + +
-
- +
+
+
{% block content %} {% endblock content %}
+
- + From a254bf5f1c91a0962e154cd6025701e1e0d6fcba Mon Sep 17 00:00:00 2001 From: Marianna Demenko <65931890+Mdemenko1@users.noreply.github.com> Date: Tue, 7 May 2024 10:05:04 -0400 Subject: [PATCH 3/4] bringing back original code --- programs/programs/connect_for_health/calculator.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/programs/programs/connect_for_health/calculator.py b/programs/programs/connect_for_health/calculator.py index f5f34fc4..5f5758f3 100644 --- a/programs/programs/connect_for_health/calculator.py +++ b/programs/programs/connect_for_health/calculator.py @@ -45,9 +45,8 @@ def eligible(self) -> Eligibility: return e def value(self, eligible_members: int): - # limits = cache.fetch() - return 0 - # return limits[self.screen.county] * 12 + limits = cache.fetch() + return limits[self.screen.county] * 12 class CFHCache(Cache): From 9bbf958a8ae501cc6480a67b5c2a386f9ac13a31 Mon Sep 17 00:00:00 2001 From: Marianna Demenko <65931890+Mdemenko1@users.noreply.github.com> Date: Wed, 8 May 2024 14:00:39 -0400 Subject: [PATCH 4/4] adjustimg to the PR comments --- translations/static/js/theme.js | 52 ++++++++--------- translations/templates/base.html | 98 +++++++++++++------------------- 2 files changed, 65 insertions(+), 85 deletions(-) diff --git a/translations/static/js/theme.js b/translations/static/js/theme.js index acdb322c..692d7cbf 100644 --- a/translations/static/js/theme.js +++ b/translations/static/js/theme.js @@ -1,27 +1,27 @@ (() => { - "use strict"; - const prefersDarkMode = window.matchMedia( - "(prefers-color-scheme: dark)" - ).matches; - const defaultTheme = prefersDarkMode ? "dark" : "light"; - const preferredTheme = localStorage.getItem("theme"); - const toggleDarkMode = document.querySelector("#bd-theme"); - const isDarkTheme = localStorage.getItem("theme") === "dark"; - - if (!preferredTheme) { - localStorage.setItem("theme", defaultTheme); - } - - document.documentElement.setAttribute( - "data-theme", - preferredTheme || defaultTheme - ); - - toggleDarkMode.checked = isDarkTheme ? true : false; - - toggleDarkMode.addEventListener("change", function () { - const newTheme = isDarkTheme ? "light" : "dark"; - localStorage.setItem("theme", newTheme); - document.documentElement.setAttribute("data-theme", newTheme); - }); -})(); + "use strict"; + const prefersDarkMode = window.matchMedia( + "(prefers-color-scheme: dark)" + ).matches; + const defaultTheme = prefersDarkMode ? "dark" : "light"; + const preferredTheme = localStorage.getItem("theme"); + const toggleDarkMode = document.querySelector("#bd-theme"); + + if (!preferredTheme) { + localStorage.setItem("theme", defaultTheme); + } + + document.documentElement.setAttribute( + "data-theme", + preferredTheme || defaultTheme + ); + + toggleDarkMode.checked = preferredTheme === "dark" ? true : false; + + toggleDarkMode.addEventListener("change", function () { + const isDarkTheme = localStorage.getItem("theme") === "dark"; + const newTheme = isDarkTheme ? "light" : "dark"; + localStorage.setItem("theme", newTheme); + document.documentElement.setAttribute("data-theme", newTheme); + }); + })(); \ No newline at end of file diff --git a/translations/templates/base.html b/translations/templates/base.html index 26417192..a3bff976 100644 --- a/translations/templates/base.html +++ b/translations/templates/base.html @@ -17,65 +17,12 @@ /> -
- -
- - - -
-
-