diff --git a/backend/Gemfile.lock b/backend/Gemfile.lock index 6033d17f..b0f3317f 100644 --- a/backend/Gemfile.lock +++ b/backend/Gemfile.lock @@ -1,77 +1,78 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.6) - actionpack (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activesupport (= 7.0.6) + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.6) - actionview (= 7.0.6) - activesupport (= 7.0.6) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.6) - actionpack (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.6) - activesupport (= 7.0.6) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.6) - activesupport (= 7.0.6) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (7.0.6) - activesupport (= 7.0.6) - activerecord (7.0.6) - activemodel (= 7.0.6) - activesupport (= 7.0.6) - activestorage (7.0.6) - actionpack (= 7.0.6) - activejob (= 7.0.6) - activerecord (= 7.0.6) - activesupport (= 7.0.6) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.6) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) ast (2.4.2) - bcrypt (3.1.18) + base64 (0.1.1) + bcrypt (3.1.19) bindex (0.8.1) bootsnap (1.16.0) msgpack (~> 1.2) - brakeman (5.4.1) + brakeman (6.0.1) builder (3.2.4) bundle-audit (0.1.0) bundler-audit @@ -81,7 +82,7 @@ GEM concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3) - debug (1.7.2) + debug (1.8.0) irb (>= 1.5.0) reline (>= 0.3.1) devise (4.9.2) @@ -90,17 +91,17 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-jwt (0.10.0) + devise-jwt (0.11.0) devise (~> 4.0) - warden-jwt_auth (~> 0.6) + warden-jwt_auth (~> 0.8) diff-lcs (1.5.0) dry-auto_inject (1.0.1) dry-core (~> 1.0) zeitwerk (~> 2.6) - dry-configurable (1.0.1) + dry-configurable (1.1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-core (1.0.0) + dry-core (1.0.1) concurrent-ruby (~> 1.0) zeitwerk (~> 2.6) erubi (1.12.0) @@ -109,22 +110,25 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (2.7.10) + faraday (2.7.11) + base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) i18n (1.14.1) concurrent-ruby (~> 1.0) io-console (0.6.0) - irb (1.6.4) - reline (>= 0.3.0) + irb (1.8.1) + rdoc + reline (>= 0.3.8) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) json (2.6.3) - jwt (2.7.0) + jwt (2.7.1) + language_server-protocol (3.17.0.3) loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -135,119 +139,127 @@ GEM net-smtp marcel (1.0.2) method_source (1.0.0) - mini_mime (1.1.2) - minitest (5.18.1) - msgpack (1.7.0) - net-imap (0.3.6) + mini_mime (1.1.5) + minitest (5.20.0) + msgpack (1.7.2) + net-imap (0.3.7) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.1) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol - newrelic_rpm (9.2.2) + newrelic_rpm (9.5.0) nio4r (2.5.9) - nokogiri (1.15.3-arm64-darwin) + nokogiri (1.15.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.3-x86_64-darwin) + nokogiri (1.15.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.3-x86_64-linux) + nokogiri (1.15.4-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) parallel (1.23.0) - parser (3.2.2.0) + parser (3.2.2.3) ast (~> 2.4.1) - pg (1.4.6) + racc + pg (1.5.4) + psych (5.1.0) + stringio puma (5.6.7) nio4r (~> 2.0) racc (1.7.1) - rack (2.2.7) + rack (2.2.8) rack-cors (2.0.1) rack (>= 2.0.0) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.6) - actioncable (= 7.0.6) - actionmailbox (= 7.0.6) - actionmailer (= 7.0.6) - actionpack (= 7.0.6) - actiontext (= 7.0.6) - actionview (= 7.0.6) - activejob (= 7.0.6) - activemodel (= 7.0.6) - activerecord (= 7.0.6) - activestorage (= 7.0.6) - activesupport (= 7.0.6) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 7.0.6) - rails-dom-testing (2.1.1) + railties (= 7.0.8) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.6) - actionpack (= 7.0.6) - activesupport (= 7.0.6) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.0) - reline (0.3.3) + rdoc (6.5.0) + psych (>= 4.0.0) + regexp_parser (2.8.1) + reline (0.3.8) io-console (~> 0.5) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.5) + rexml (3.2.6) rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.0.1) + rspec-rails (6.0.3) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.11) - rspec-expectations (~> 3.11) - rspec-mocks (~> 3.11) - rspec-support (~> 3.11) - rspec-support (3.12.0) - rubocop (1.50.2) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.12.1) + rubocop (1.56.3) + base64 (~> 0.1.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.0) + rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-rails (2.19.1) + rubocop-rails (2.21.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - smarter_csv (1.8.4) - sprockets (4.2.0) + smarter_csv (1.9.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) + stringio (3.0.8) sucker_punch (3.1.0) concurrent-ruby (~> 1.0) syntax_suggest (1.1.0) @@ -263,7 +275,7 @@ GEM dry-configurable (>= 0.13, < 2) jwt (~> 2.1) warden (~> 1.2) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -271,7 +283,7 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.9) + zeitwerk (2.6.12) PLATFORMS arm64-darwin-21 diff --git a/frontend/front/.gitignore b/frontend/front/.gitignore index ad9f18be..7439276d 100644 --- a/frontend/front/.gitignore +++ b/frontend/front/.gitignore @@ -25,4 +25,5 @@ yarn-error.log* .yarnrc.yml -.yarn \ No newline at end of file +.yarn +.yarn.lock \ No newline at end of file diff --git a/frontend/front/README.md b/frontend/front/README.md index ac88bee5..4b728a33 100644 --- a/frontend/front/README.md +++ b/frontend/front/README.md @@ -60,13 +60,14 @@ We also have a dummy json-server located at `/frontend/jsonserver`. However, it' 10. Make sure to copy the pull request link and paste into the frontend slack page so that folks notice. 11. After your pull request is approved, you can merge it and close any github issue related to the pull request. - ## Building Docker Image for Mass Open Cloud + Assuming you are pushing to the Docker registry for mzagaja, you should do: ```sh docker build --platform linux/amd64 --build-arg REACT_APP_API_URL=http://api.bostonhpa.org -t mzagaja/bhpa-frontend:latest --push . ``` + --- # Getting Started with Create React App diff --git a/frontend/front/src/App.js b/frontend/front/src/App.js index e4d457dc..409c744c 100644 --- a/frontend/front/src/App.js +++ b/frontend/front/src/App.js @@ -16,12 +16,14 @@ import { ProtectedRoute } from "./routing/ProtectedRoute"; import PublicContainer from "./pages/Public/PublicContainer"; import SurveyorContainer from "./pages/Surveyor/SurveyorContainer"; +const ONELINK_LANGUAGE_BAR_HEIGHT = "36px"; + function App() { // update jwt useLocallyStoredJWT(); return ( - + } /> diff --git a/frontend/front/src/assets/images/partnersLogo/moc.png b/frontend/front/src/assets/images/partnersLogo/moc.png new file mode 100644 index 00000000..8ee779ac Binary files /dev/null and b/frontend/front/src/assets/images/partnersLogo/moc.png differ diff --git a/frontend/front/src/components/SurveyComponent/HeatPumpDropdown.js b/frontend/front/src/components/SurveyComponent/HeatPumpDropdown.js index 68452cf2..eab4244b 100644 --- a/frontend/front/src/components/SurveyComponent/HeatPumpDropdown.js +++ b/frontend/front/src/components/SurveyComponent/HeatPumpDropdown.js @@ -5,14 +5,9 @@ import { Select, MenuItem, InputLabel, + FormLabel, } from "@mui/material"; -import React, { - useCallback, - useEffect, - useMemo, - useRef, - useState, -} from "react"; +import React, { useCallback, useMemo } from "react"; /** * A radio group to be used with react-hook-form @@ -24,29 +19,21 @@ export const HeatPumpDropdown = ({ label, disabled, required, + enableOtherField, + disableFancyLabel, }) => { - const { field: groupField, formState } = useController({ name, control }); - - const labelFormRef = useRef(null); - const [_, setResizeTrigger] = useState(0); - - useEffect(() => { - const refresh = () => setResizeTrigger((prev) => prev + 1); - - refresh(); - - window.addEventListener("resize", refresh); + const Label = disableFancyLabel ? FormLabel : InputLabel; - return () => window.removeEventListener("resize", refresh); - }); + const { field: groupField, formState } = useController({ name, control }); const otherFieldName = `${name}/other`; const showOtherInput = useMemo( () => + enableOtherField && groupField.value && typeof groupField.value == "string" && groupField.value.toLowerCase() === "other", - [groupField] + [enableOtherField, groupField] ); const mainFieldError = formState.errors[name]; @@ -56,25 +43,17 @@ export const HeatPumpDropdown = ({ (field) => { return ( - -
- {label} -
-
+ + + + + +`; + +exports[`HeatPumpDropdown renders as expected 1`] = ` +
+
+ +
+ + + +
+
+
+`; diff --git a/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/HeatPumpTextField.test.js.snap b/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/HeatPumpTextField.test.js.snap new file mode 100644 index 00000000..563d7e31 --- /dev/null +++ b/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/HeatPumpTextField.test.js.snap @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`HeatPumpTextField renders as expected when disableFancyLabel=true 1`] = ` +
+
+ +
+
+ +
+
+
+
+`; + +exports[`HeatPumpTextField renders normally with default props 1`] = ` +
+
+
+ +
+ +
+
+
+
+`; diff --git a/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/SurveyComponent.test.js.snap b/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/SurveyComponent.test.js.snap index 086e8d14..8bde17ff 100644 --- a/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/SurveyComponent.test.js.snap +++ b/frontend/front/src/components/SurveyComponent/__tests__/__snapshots__/SurveyComponent.test.js.snap @@ -33,8 +33,8 @@ exports[`SurveyComponent no errors when rendering 1`] = ` class="MuiFormControl-root MuiFormControl-fullWidth css-q8hpuo-MuiFormControl-root" >