Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WAITP-1454: design updates #5079

Merged
merged 15 commits into from
Oct 15, 2023
Merged

Conversation

alexd-bes
Copy link
Contributor

Issue WAITP-1454: design updates

Changes:

  • Fix geolocate question accuracy
  • Fix UI styling
  • Change whole form validation to occur on the last survey page instead of review screen, using yup

@@ -94,11 +95,11 @@ const PinDrop = ({ lat, lng, setCoordinates }: MapComponentProps) => {
export const Map = ({ lat, lng, setCoordinates }: MapComponentProps) => {
const coordinatesInvalid = [lat, lng].some(coordinate => !coordinate && coordinate !== 0);

// round coordinates to 2 decimal places before setting them
// round coordinates to 4 decimal places before setting them - any less and the coordinates are not very accurate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good fix

@@ -0,0 +1,106 @@
import { useCallback } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the copyright and just need to reorder the imports


const componentsToValidate = isLast ? allSurveyComponents : activeScreen;

const validationSchema =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again I would find it much more readable if this function was split up a bit. I would split out the bit that turns the componentsToValidate into a validation schema
eg.
const validationSchema = makeValidationSchema(componentsToValidate);


if (!mandatory && !min && !max) return schema;

const getBaseSchema = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I would also move this out so that it's just called with type

@@ -55,3 +55,30 @@ export const getAllSurveyComponents = (surveyScreens?: SurveyScreen[]) => {
return [...components, ...screen.surveyScreenComponents];
}, [] as SurveyScreenComponent[]);
};

export const getErrorsByScreen = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice util

Copy link
Contributor

@tcaiger tcaiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall. I just have a small suggestion for a refactor of the validation hook. also it would be great if we could add the update to the order of surveys in the survey select screen to make them alphabetical. It should just be a one liner in the SurveysRoute.

Copy link
Contributor

@tcaiger tcaiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extra refactor :)

@tcaiger tcaiger merged commit 9df8979 into datatrak-web-epic Oct 15, 2023
41 checks passed
@tcaiger tcaiger deleted the waitp-1454-design-updates branch October 15, 2023 21:06
@alexd-bes alexd-bes restored the waitp-1454-design-updates branch October 15, 2023 21:08
tcaiger added a commit that referenced this pull request Oct 27, 2023
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
tcaiger added a commit that referenced this pull request Nov 5, 2023
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
tcaiger added a commit that referenced this pull request Nov 13, 2023
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
tcaiger added a commit that referenced this pull request Nov 19, 2023
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* WAITP-1431: Fix survey select filter (#5177)

* Update SurveysRoute.ts

* remove tsx extentions

* Update SurveysRoute.ts

* WAITP-1387: Add survey project field (#5172)

* Responsive styling of dashboard leaderboard (#5173)

* Responsive styling of dashboard leaderboard

* Fix type error

* Survey not found error handling (#5160)

* Survey not found error handling

* Reorder imports

* Updates to route

* Fix types

* Remove unused imports

* Error page rename

* Rename page

* no-issue: Fix `location.state` null (#5179)

* extract useFromLocation

* extract `useFromLocation` to own file and use

* WAITP-1474: Update success illustration on DataTrak (#5159)

* generify high-five graphic filename

* update submission success graphic

* define margins along block/inline axes

See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout/Block_and_inline_layout_in_normal_flow

* success screen fix horizontal overflow

* define survey success image dimen with `rem`

* relabel button ‘Close’ → ‘Return to dashboard’

* Fix package error

* Fix autocomplete validation issue

* WAITP-1431: Update datatrak survey url with country code (#5182)

* add Single Entity Route

* use country url to submit

* fix tests

* make TupaiaWebEntityRequest re-usable

* Update SingleEntityRoute.ts

* update recent surveys and responses routes

* handle recent survey submissions

* Update SurveyResponsesSection.tsx

* update country id in survey page

* remove unused code

* Update processSurveyResponse.test.ts

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>
alexd-bes added a commit that referenced this pull request Nov 30, 2023
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* WAITP-1431: Fix survey select filter (#5177)

* Update SurveysRoute.ts

* remove tsx extentions

* Update SurveysRoute.ts

* WAITP-1387: Add survey project field (#5172)

* Responsive styling of dashboard leaderboard (#5173)

* Responsive styling of dashboard leaderboard

* Fix type error

* Survey not found error handling (#5160)

* Survey not found error handling

* Reorder imports

* Updates to route

* Fix types

* Remove unused imports

* Error page rename

* Rename page

* no-issue: Fix `location.state` null (#5179)

* extract useFromLocation

* extract `useFromLocation` to own file and use

* WAITP-1474: Update success illustration on DataTrak (#5159)

* generify high-five graphic filename

* update submission success graphic

* define margins along block/inline axes

See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout/Block_and_inline_layout_in_normal_flow

* success screen fix horizontal overflow

* define survey success image dimen with `rem`

* relabel button ‘Close’ → ‘Return to dashboard’

* Fix package error

* Fix autocomplete validation issue

* Create migration for surveys to project mapping

* WAITP-1431: Update datatrak survey url with country code (#5182)

* add Single Entity Route

* use country url to submit

* fix tests

* make TupaiaWebEntityRequest re-usable

* Update SingleEntityRoute.ts

* update recent surveys and responses routes

* handle recent survey submissions

* Update SurveyResponsesSection.tsx

* update country id in survey page

* remove unused code

* Update processSurveyResponse.test.ts

* Update queries

* Update preferred project on survey load

* Update queries and FE to handle project ids, and add migration for project creation

* Add toast to tell user project has been updated

* Remove unused import

* Remove unused import

* Update projectSurveyMappings.json

* Filter out new empty projects from Tupaia Web frontend

* Fix merge issues

* Update mappings

* Add new projects

* WAITP-1480: survey duplication (#5193)

* Make migration

* Update migration

* Update migration

* Remove survey responses when migrating down

* Update GETSurveyResponses.test.js

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>
Co-authored-by: RajneelR <132311480+RajneelR@users.noreply.github.com>
alexd-bes added a commit that referenced this pull request Jan 12, 2024
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* Show prompt on mobile devices and direct to app where applicable

* Change ios url

* Undo ios change

* Add fallback

* Update link

* Update AndroidManifest.xml

* Tidy links

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
alexd-bes added a commit that referenced this pull request Jan 18, 2024
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* WAITP-1431: Fix survey select filter (#5177)

* Update SurveysRoute.ts

* remove tsx extentions

* Update SurveysRoute.ts

* WAITP-1387: Add survey project field (#5172)

* Responsive styling of dashboard leaderboard (#5173)

* Responsive styling of dashboard leaderboard

* Fix type error

* Survey not found error handling (#5160)

* Survey not found error handling

* Reorder imports

* Updates to route

* Fix types

* Remove unused imports

* Error page rename

* Rename page

* no-issue: Fix `location.state` null (#5179)

* extract useFromLocation

* extract `useFromLocation` to own file and use

* WAITP-1474: Update success illustration on DataTrak (#5159)

* generify high-five graphic filename

* update submission success graphic

* define margins along block/inline axes

See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout/Block_and_inline_layout_in_normal_flow

* success screen fix horizontal overflow

* define survey success image dimen with `rem`

* relabel button ‘Close’ → ‘Return to dashboard’

* Fix package error

* Fix autocomplete validation issue

* Create migration for surveys to project mapping

* WAITP-1431: Update datatrak survey url with country code (#5182)

* add Single Entity Route

* use country url to submit

* fix tests

* make TupaiaWebEntityRequest re-usable

* Update SingleEntityRoute.ts

* update recent surveys and responses routes

* handle recent survey submissions

* Update SurveyResponsesSection.tsx

* update country id in survey page

* remove unused code

* Update processSurveyResponse.test.ts

* Update queries

* Update preferred project on survey load

* Update queries and FE to handle project ids, and add migration for project creation

* Add toast to tell user project has been updated

* Remove unused import

* Remove unused import

* Make migration

* Update migration

* Update projectSurveyMappings.json

* Update migration

* Filter out new empty projects from Tupaia Web frontend

* Fix merge issues

* Remove survey responses when migrating down

* Update mappings

* Add new projects

* Update getSocialFeed.js

* Update SurveyResponse.js

* Update Routes.tsx

* public survey route

* WAITP-1480: survey duplication (#5193)

* Make migration

* Update migration

* Update migration

* Remove survey responses when migrating down

* add survey route

* rename SurveyRoutes

* Update SurveyRoutes.tsx

* add copy button

* handle logged out user submit

* submitAsPublic

* add public user test

* generate types

* update CopySurveyUrlButton

* tweaks

* Update GETSurveyResponses.test.js

* WAITP-1495: Public entity questions (#5219)

* wip public requests

* update datatrak entity routes

* update options set permission check

* Update permissions.test.ts

* Update EntityQuestion.test.tsx

* support use Entity by code and id

* re organise entity routes

* Update useSubmitSurvey.test.ts

* fix front end tests

* fix viewing a submitted survey

* fix login loading

* update datatrak tests

* add login tests

* stub out unhandled responses

* WAITP-1514: DataTrak redirect back after login (#5262)

* fix login loading

* update datatrak tests

* add login tests

* stub out unhandled responses

* fix accessibility features

* Remove duplicate identifier

* Update handling of logged out entity descendents

* Update direct handling

* Working exportable multi value viz

* Generate types

* RN-1069: redirect after login

* Merge

* Global fieldset styles

* Remove extra types package

* Show multiValue titles for legacy reports

* Create constants for types

* Update types

* Fix types

* RN-998: Logo on export (#5330)

* en dash for date range

* another en dash for another date range

* border instead of divider

* code style

* natural casing of heading on PDF exports

* remove redundant `div`

* replace deprecated CSS

* refactor PDF export layout

* code style

* more appropriate vertical alignment

* project logo in export

* update tests to expect en dash

* fix header vertical alignment in PDF export

* clearer comment

* logotype → logo in alt description

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>

* extract prop to interface

* avoid layout shift

practically speaking, this CLS doesn’t matter because it’s only in PDF exports, but this prevents Lighthouse flagging it as an issue

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>

* no-issue: README tidy-ups (#5331)

* replace codeship references with GHA

* README tidy-ups

* logo heading

* `code-of-conduct` → `CODE_OF_CONDUCT`

* succinctness

* Markdown markup style

* experiment: `<details>` disclusure element

* fix `details > ul` render

* `<details>` experiment continued

* abandon `<details>` experiment

* unignore Codeship things

* Markdown style

* relative links

* Revert "RN-998: Logo on export"

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>
Co-authored-by: RajneelR <132311480+RajneelR@users.noreply.github.com>
Co-authored-by: Andrew <vanbeekandrew@gmail.com>
alexd-bes added a commit that referenced this pull request Jan 25, 2024
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* WAITP-1431: Fix survey select filter (#5177)

* Update SurveysRoute.ts

* remove tsx extentions

* Update SurveysRoute.ts

* WAITP-1387: Add survey project field (#5172)

* Responsive styling of dashboard leaderboard (#5173)

* Responsive styling of dashboard leaderboard

* Fix type error

* Survey not found error handling (#5160)

* Survey not found error handling

* Reorder imports

* Updates to route

* Fix types

* Remove unused imports

* Error page rename

* Rename page

* no-issue: Fix `location.state` null (#5179)

* extract useFromLocation

* extract `useFromLocation` to own file and use

* Validate related questions are mandatory

* Use parent id for entity question if parent id question is not filled in

* Update packages/central-server/src/apiV2/import/importSurveys/Validator/ConfigValidator/EntityConfigValidator.js

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>
Co-authored-by: Andrew <vanbeekandrew@gmail.com>
alexd-bes added a commit that referenced this pull request Mar 10, 2024
* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* WAITP-1431: Fix survey select filter (#5177)

* Update SurveysRoute.ts

* remove tsx extentions

* Update SurveysRoute.ts

* WAITP-1387: Add survey project field (#5172)

* Responsive styling of dashboard leaderboard (#5173)

* Responsive styling of dashboard leaderboard

* Fix type error

* Survey not found error handling (#5160)

* Survey not found error handling

* Reorder imports

* Updates to route

* Fix types

* Remove unused imports

* Error page rename

* Rename page

* no-issue: Fix `location.state` null (#5179)

* extract useFromLocation

* extract `useFromLocation` to own file and use

* WAITP-1474: Update success illustration on DataTrak (#5159)

* generify high-five graphic filename

* update submission success graphic

* define margins along block/inline axes

See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout/Block_and_inline_layout_in_normal_flow

* success screen fix horizontal overflow

* define survey success image dimen with `rem`

* relabel button ‘Close’ → ‘Return to dashboard’

* Fix package error

* Fix autocomplete validation issue

* Create migration for surveys to project mapping

* WAITP-1431: Update datatrak survey url with country code (#5182)

* add Single Entity Route

* use country url to submit

* fix tests

* make TupaiaWebEntityRequest re-usable

* Update SingleEntityRoute.ts

* update recent surveys and responses routes

* handle recent survey submissions

* Update SurveyResponsesSection.tsx

* update country id in survey page

* remove unused code

* Update processSurveyResponse.test.ts

* Update queries

* Update preferred project on survey load

* Update queries and FE to handle project ids, and add migration for project creation

* Add toast to tell user project has been updated

* Remove unused import

* Remove unused import

* Make migration

* Update migration

* Update projectSurveyMappings.json

* Update migration

* Filter out new empty projects from Tupaia Web frontend

* Fix merge issues

* Remove survey responses when migrating down

* Update mappings

* Add new projects

* Update getSocialFeed.js

* Update SurveyResponse.js

* Update Routes.tsx

* public survey route

* WAITP-1480: survey duplication (#5193)

* Make migration

* Update migration

* Update migration

* Remove survey responses when migrating down

* add survey route

* rename SurveyRoutes

* Update SurveyRoutes.tsx

* add copy button

* handle logged out user submit

* submitAsPublic

* add public user test

* generate types

* update CopySurveyUrlButton

* tweaks

* Update GETSurveyResponses.test.js

* Hide search input when in review screen

* Fix lint error

* Show cancel modal when clicking on account settings

* Edit casing of button text

* Fix markdown formatting

* Update autocomplete styling

* Alphabetize autocomplete results

* Only show project update success toast when it happens behind the scenes

* Fix build error

* Fix test

* Update filter to be from starting letter

* Update autocomplete filtering

* WAITP-1495: Public entity questions (#5219)

* wip public requests

* update datatrak entity routes

* update options set permission check

* Update permissions.test.ts

* Update EntityQuestion.test.tsx

* support use Entity by code and id

* re organise entity routes

* Update useSubmitSurvey.test.ts

* fix front end tests

* Add x button to project select modal

* fix viewing a submitted survey

* fix login loading

* update datatrak tests

* add login tests

* stub out unhandled responses

* WAITP-1514: DataTrak redirect back after login (#5262)

* fix login loading

* update datatrak tests

* add login tests

* stub out unhandled responses

* fix accessibility features

* Add admin panel permissions check to user route

* WIP form

* Autocomplete and radio questions

* Working form

* WIP

* WIP tests

* Tests and tidy ups

* Tidy up merge

* Add request timeout

* Fix error

* FIx unused variable

* PR fixes

* Fix errors

* Add date placeholder and format

* Remove duplicate identifier

* Update handling of logged out entity descendents

* Update direct handling

* Merge

* Fix merge

* Fix error

* Fix merge issue

* Change name of interface

* Fix merge error

* Fix report timezone issue

* Handle undefined dates

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>
Co-authored-by: RajneelR <132311480+RajneelR@users.noreply.github.com>
Co-authored-by: Andrew <vanbeekandrew@gmail.com>
alexd-bes added a commit that referenced this pull request Mar 17, 2024
* Waitp 1368 datatrak web fe setup (#4875)

* Added skeleton datatrak-server package

* Added datatrak-server to CI/CD

* wip datatrak front end app

* Added api-client to datatrak-server

* Added /projects route to datatrak-server

* disable eslint and re-install dependencies

* Added /entities route to datatrak-server

* add base views and downgrade react

* Update api.js

* Disabled frozen-lockfile

* Reverted yarn.lock

* Re-enabled frozen lockfile

* Add datatrak to CI/CD

* Added /surveys and /surveyScreenComponents routes

* Re-enabled exports of ui-components

* Switched to using pre-existing build and start scripts for datatrak

* add base form components

* Fix datatrak build

* format data to screens

* Got login working

* Added extra fields to FetchSurveyScreenComponents

* Got project and country selection working

* Upated yarn.lock

* Got survey selection working

* Got Survey page working

* screen steps

* add template styling

* add admin route

* Switched to using .env var for server url

* add logout

* Fixed up FetchUserRoute

* Add submitSurveyResponse route

* labels

* Add entity question

* add entity question to screen

* survey submit

* Update yarn.lock

* Update package.json

* remove anything not from fe

* Merge branch 'dev' into datatrak-hackathon

* Remove unused files

* Add initial fetch example

* Update README.md

* Revert change

* Remove unneeded change

* Add back in datatrak-app

* Add .env.example

* Update files

* Remove unnecessary code

* Fixes

* Test remove server setup

* Remove test step

* WAITP-1368: Basic page layout (#4890)

* basic page layout

* styles

* use theme colours

---------

Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1367 DataTrak Server (#4902)

* WAITP-1367 Add datatrak_session table to db

* WAITP-1367 Add request type for datatrak user request

* WAITP-1367 Add datatrak-server package

* WAITP-1367 Regenerate yarn.lock

* WAITP-1367 Fix minor copy-paste errors

* WAITP-1367 Add datatrak_session to ignored tables for hooks

* WAITP-1367 Add datatrak-server to server startup script in datatrak-web

* WAITP-1367 Add datatrak-server to CI/CD scripts

* WAITP-1367 Reduce layer count in dockerfile

* WAITP-1367 Regenerate types

* WAITP-1367 Regnerate types (again)

* WAITP-1367 Fixup clashing exports

* WAITP-1367 Rebalance test batching

* WAITP-1367: Rename datatrak-server to datatrak-web-server (#4904)

* find and replace

* rename package

* Update tupaia-ci-cd.Dockerfile

* update types

* Generate types

* Revert "Generate types"

This reverts commit 6fbbec6.

* WAITP-1277 datatrak-web login form part 1 (#4899)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* Update private routes and fix build

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 register page (#4903)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Update storybook

* Fix storybook

* Add pages to datatrak-web and mobile styling

* Fixes

* Fix route names

* Update private routes and fix build

* Fix height

* Fix type errors

* Fix types

* Generate types

* Revert "Generate types"

This reverts commit de0fb64.

* Create private route

* Fix build

* Fix casing

* Fix build error

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1379: select survey (#4925)

* Initial landing page

* Working survey select

* Fix type errors

* WAITP-1411: Setup datatrak survey screens (#4920)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* fix types

* scrren layout

* refactor context

* tidy up css

* resolve conflicts

* Update merge

* Update useSurveyScreenComponents.tsx

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* Fix circular types error

* Fix route

* Test types generate

* revert generate changes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1417 top progress bar (#4923)

* Started on progress bar commit

* added more styling and changed logic

* designed logic for progress bar

* fixed progress bar colour

* fixed pr

* ready for retest

* Added to survey page

* cleaned a few things

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1345: core question types (#4930)

* Text question

* Binary and radio questions

* Update types

* ƒix option parsing

* Date question

* Update question number logic

* Instruction question

* Update index.ts

* Handle review screen

* Fix date styles

* Update text field width

* Update line height

* Add types

* remove question number for now

* Checkbox question and styling

* Checkbox question

* Add comment

* DateTimeQuestion

* Add controller around all questions

* Add in question number

* Reorder imports

* Handle more than 26 questions on a screen

* Update casing.ts

* Fix imports

* Fixes and generate types

* Fix merge and question number logic

* Fix props

* yarn generate

* yarn generate

* WAITP-1428: datatrak design updates (#4949)

* Auth updates part 1

* Auth view

* Survey screen

* Tooltip buttons

* Use theme variable

* Update theme variable for primary text

* Auth layout

* Move styles into common form files

* Fix layout padding

* Update layout

* Update SurveySelectPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Waitp 1414 code generator hints (#4944)

* Setup reusable login form

* Working login

* User menu

* Fix versions

* Comments and tidy ups

* Fix build issue

* Add verify email view

* Update loginForm.stories.js

* FIx export

* Fix storybook

* Fixes

* Fix route names

* survey screens

* save form data

* routes

* Update Routes.tsx

* Initial landing page

* fix types

* scrren layout

* refactor context

* Working survey select

* tidy up css

* resolve conflicts

* Fix type errors

* Update merge

* Update useSurveyScreenComponents.tsx

* work in progress

* need testing

* quick fix

* styling commit

* few pr changes

* changed folder locations

* fixed imports and exports

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1346: Survey contents menu (#4958)

* Working menu

* Remove unused import

* Fixes

* WAITP-1350: Cancel survey workflow (#4964)

* WAITP-1327: Geolocate question type (#4917)

* WIP on geolocation question

* Pushing to remote for pairing

* updates to map pin drop functionality and ui

* tidying up unused imports and redundant components

* Fixes part 1

* Updates

* Fixes

---------

Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: acdunham <alex@beyondessential.com.au>

* Waitp 1427 survey submit success screen (#4965)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Fixes

* Fix types

* remove questions url

* Fix types

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* update ci cd with datatrak web

* add stub test

* WAITP-1407: Datatrak project select (#4950)

* project select modal

* save project id for a user

* fix types

* Update ProjectSelectPage.tsx

* edit project

* Update ProjectSelectPage.tsx

* Update ProjectSelectModal.tsx

* custom icons

* pr changes

* request access styles

* request access on click

* update types

* WAITP-1439: Survey review screen (#4985)

* almost done with routes

* sorted, does need cleaning up

* survey success commit

* Tidy up files

* Fix merge issues

* Review screen

* Initial mutation

* Tidy up files

* Fixes

* Update SurveyLayout.tsx

---------

Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1410: Request project access (#4997)

* Working request access

* Add access requested icon to project list

* Add 'EditUserForMe' endpoint

* Remove all countries requested view

* Refactor select list

* Fix on select issue

* Don't have onClick if is not a button

* Generate types

* Fixes

* Update types

* WAITP-1429: Autocomplete question (#5010)

* WIP

* Finish styling and get working

* Update styles

* Update font size

* Update hover colour

* Update packages/datatrak-web/src/features/Questions/AutocompleteQuestion.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1413: Datatrak Web Entity Question (#4996)

* setup entities question

* searching

* debounce

* styles

* close button

* sorting search results

* update filters

* remove old entity route

* fix filters

* fix types

* Update EntityList.js

* Update EntitiesRoute.ts

* refactor to match new list component

* Update useUser.ts

* add mock api with msw (#5019)

* WAITP-1437 toast messages (#5015)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Fixes

* Fix build errors and merge conflicts

* Fix error

* Fix broken test

* WAITP-1407: Add support for user preferences to user accounts (#5023)

* migration

* saving user preferences

* add validation to edit user endpoint

* fix tests

* WAITP-1431: Select country (#5026)

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Add country name to survey toolbar

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* Generate types

* Update schemas.ts

* Fixes

* Reorganise files

* Fix build errors

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1423: Primary entity question (#5027)

* Toast messages

* Remove buttons from landing page

* Apply error handling by default

* Generate types

* migration

* Working country display

* WIP

* saving user preferences

* Fixes

* Fix build errors and merge conflicts

* Add country name to survey toolbar

* setup submit

* Add country to entity search

* add validation to edit user endpoint

* Clean up and add comments

* Plumb in saving country

* move mocks

* primary entity handling

* Generate types

* Update schemas.ts

* attributes filter

* use country data

* Fixes

* Reorganise files

* Fix build errors

* update survey data key

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1369 Setup datatrak deployment (#5031)

* WAITP-1369 Add datatrak to servers.conf and subdomain suffixes

* WAITP-1369 Regenerate types

* WAITP-1369 Regen yarn.lock

* WAITP-1369 Fixup entity-server test

* WAITP-1369 Fixup usage of entity request type

* WAITP-1369 Remove broken include

* WAITP-1369 Regen types

* WAITP-1369 Fixup unit test

* Update tsconfig-build for datatrak-web-server

* no-issue-dedupe-react-router-dom

* WAITP-1349: Survey submit (#5032)

* Working survey submit

* Only show repeat survey button when canRepeat is true

* Fix todos

* Add loader

* Add coconut notification

* Tidy up

* Fix variable names

* Fix types

* Reorder imports

* Fix build error

* No issue: add test runner to datatrak-web (#5034)

* setup test runner

* add example survey

* change import meta to process env

* update survey test

* Update survey.test.tsx

* WAITP-1429: Autocomplete add and filtering of options (#5040)

* Enable create new option and filter options

* Tidy up code

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Update packages/datatrak-web/src/__tests__/features/Questions/AutocompleteQuestion.test.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Fix types

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1416: Visibility criteria (#5044)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* WAITP-1440: Mobile styling (#5042)

* WIP mobile styling

* WIP

* Fix project button styling

* Fix types

* Mobile app prompt

* Fix dashboard button styling

* WAITP-1347: Validation criteria (#5047)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Working validation

* Working validation

* Fix autocomplete styling

* Fix autocomplete issue

* Extract getRules function

* Fix typo

* No issue: Update survey screen fetching (#5050)

* Update get surveys endpoint

* Change to using surveys endpoint

* Fix types and visible question logic

* Remove old route

* Fix types and tests

* Generate types

* WAITP-1424: Entity question upserts (#5045)

* Enable create new option and filter options

* Tidy up code

* add filter prop

* Add tests for autocomplete question

* Update AutocompleteQuestion.test.tsx

* Add survey submit tests

* Submit Survey route

* Update useSubmitSurvey.ts

* add entities upserted

* update test suite

* fix bad merge

* update types

* set country in upsert entity

* Update schemas.ts

* fix up types

* fix tests

* fix schema

* fix tests

* wip refactor form submission

* move tests to server

* generate schemas

* fix entity test

* Update render.tsx

* Update useSubmitSurvey.test.ts

* Update render.tsx

* reuse survey request types

* Update schemas.ts

* fix question types

* fix types

* Update schemas.ts

* optional screen id

---------

Co-authored-by: acdunham <alex@beyondessential.com.au>

* WAITP-1430: condition question (#5049)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Fix tests and build

* WAITP-1453: UI updates (#5052)

* Handle location errors

* Fix redirect issue for requesting access

* Add tooltip delay

* Add delay on mobile devices

* Tidy tooltip props code

* Update popovers

* Update header heights

* Update number field width

* Make text inputs multiline when text wraps

* Make radio labels full width

* Clip side menu item length

* Center instruction only screens

* Remove horizontal centering

* Hide placeholder in review screen

* Update survey icons

* Remove unused import

* Fix build errors

* Fixes

* Fix errors

* WAITP-1412: Arithmetic question (#5054)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* Add handling for custom display text

* WAITP-1276: Forgot password (#5056)

* Add forgot passowrd view

* Working form

* Add stories

* Fix build

* Set height on forgot password screen

* Reset success screen

* Reorder imports

* WAITP-1345:Core question updates (#5066)

* Allow color to be set on radio options

* Get help text working

* Update SurveyQuestionGroup.tsx

* Update types

* WAITP-1349: Fix DataTrak survey submit (#5078)

* Update surveyResponse.js

* Update surveyResponse.js

* WAITP-1454: design updates (#5079)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* WAITP-1454: Fix sorting of surveys (#5080)

* Update hover state for primary buttons

* New validation

* Update text area focus styles

* Update project button font weight

* Update checkbox colour

* Remove menu list item hover

* Text sizing and close menu on click

* Update landing page display sizing

* Fix geolocate accuracy

* Update validation types

* Fix build

* Fix autocomplete filter

* PR fixes

* Alphabetize survey results

* Update sorting

* Fix sorting in folders

* Update FE sorting

* tile component

* Revert "tile component"

This reverts commit 7b612fb.

* WAITP-1454: UI changes (#5089)

* tile component

* Show modal when exiting survey via home button

* Remove unused imports

* Stop menu re-rendering on change of survey screen

* Update button disabled state

* Fix build errors

* Fix tests

* Close side menu on screen change on mobile

* clean up code from another branch

* Update LandingPage.tsx

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1377 Forward signup route to web config server (#5090)

* WAITP-1377 Forward signup route to web config server

* WAITP-1377 Fixup lint

* WAITP-1449: QR code generator (#5086)

* WIP visibility criteria

* Working survey visibility criteria

* Generate types

* Add tests

* Redirect user if survey screen is not visible

* Reset invisible answers

* Handle when value is not an array

* Remove only from test

* Fix tests

* Conditional questions working

* Get question fully updating

* Generate types

* Add tests and update types

* Update survey.json

* Fix types and build

* Fix tests

* Initial logic and separate out context

* Working arithmetic question

* Fix tests and build

* Generate types

* Fix types

* Add tests

* WIP

* WIP

* WIP

* WIP

* Working qr code

* Fix types

* Update test

* Fix tests

* PR fixes

* WAITP-1415: Photo upload question (#5099)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* no-issue-fix-types-after-merge

* WAITP-1357: Datatrak dashboard survey responses (#5091)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* WAITP-1461: Datatrak design feedback (#5109)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* project select page

* menu ux

* Update useSubmitSurvey.ts

* gps question

* Update index.html

* Update ProjectsRoute.ts

* theming

* Update mui.d.ts

* Update useSubmitSurvey.test.ts

* Update theme.ts

* Update SurveySelectPage.tsx

* Update SurveySelectPage.tsx

* Update useValidationResolver.ts (#5128)

* WAITP-1412: fix arithmetic questions

* one time login flow (#5138)

* WAITP-1354: Leaderboard (#5132)

* no-issue: Add @tupaia/server-utils package (#5121)

* RN-1060: (task) Moved sendEmail to @tupaia/server-utils (#5126)

* RN-1060: (task) Added dashboards/:project/:entity/:dashboard/export route to tupaia-web (#5125)

* WAITP-1354: Leaderboard

* Update copyright

* Update internal email

* Update email filter

* Fix response type

* Update packages/datatrak-web/src/features/Leaderboard/LeaderboardTable.tsx

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update background variable

* Update branch name validation script (#5136)

* Update to use new leaderboard model

* Revert "Merge branch 'dev' into waitp-1354-leaderboard"

This reverts commit c2acdbe, reversing
changes made to 747f182.

* Fix types

* Update packages/database/src/modelClasses/SurveyResponse.js

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>

* PR fixes

* Fix error

---------

Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>

* WAITP-1356: recent surveys (#5113)

* Update LandingPage.tsx

* update landing page

* data fetching layer

* fix console errors

* re organise landing page

* tooltips

* style tweaks

* update landing page layout

* horizontal scroll

* page limit

* Frontend layout

* Working request

* Refetch recent surveys on submit

* Fix recent survey request and styling

* Use grid and update heading element

* Remove unnecessary css

* PR fixes

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1469: account delete (#5134)

* WIP

* Account deletion

* Update component for section

* Update modals

* Remove forced open state

* Fix types

* fix build error

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Update packages/datatrak-web/src/api/mutations/useEditUser.ts

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* Change format

* fix bad merge

* return zeros for rewards

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1330: File upload question type (#5100)

* WIP

* Use built in functionality

* Add comment

* Fix build errors

* Working file upload

* Fix build

* Remove unused vars

* Update format of file upload answers

* Update schemas.ts

* Update processSurveyResponse.test.ts

* Update upsertAnswers.js

---------

Co-authored-by: Tom Caiger <caigertom@gmail.com>

* WAITP-1424: Datatrak PrimaryEntity question fix (#5144)

* fix rewards types

* update primary entity question name

* WIP

* Fix success screen layout

* Fix date change issue

* Fix error styling

* Working activity feed

* Tidy ups

* WAITP-1427: Fix survey cancelling (#5148)

* Update CancelSurveyModal.tsx

* tidy up landing page

* fix console errors

* No issue: Only generate QR code when createNew is true

* No issue: Fix tests

* Remove permission group and country from admin panel feed items

* No issue: Fix recent survey layout

* Working pinned posts

* No issue: Login redirect (#5151)

* Redirect to route on login or project select

* Formatting

* Always show user on leaderboard

* WAITP-1478 Single survey response endpoint (#5153)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* WAITP-1478 Update survey response answers to map by question_id

* WAITP-1478 Rename RecentSurveyResponse to SingleSurveyResponse

* WAITP-1478 Rename files

* Fix PR

* Generate types

* Fix styling

* Update Button.tsx

* Fixes

* WAITP-1452: Datatrak-web refactor survey context (#5156)

* Update useLogin.ts

* refactor survey context to be at survey level

* Create migration

* Update types

* Responsive styling (#5158)

* Responsive styling

* Fix padding on mobile

* Handle project id in queries

* Filter user rewards by project id

* Update queries to have projectId as optional param

* Fix bindings

* Update SurveyResponse.js

* Add project column to admin panel

* WAITP-1452: Recent survey response page (#5157)

* WAITP-1478 Add types definition for RecentSurveyResponseRoute

* WAITP-1478 Regen types

* WAITP-1478 Add route for RecentSurveyResponse

* WAITP-1478 Fixup export

* WAITP-1478 Update url

* WAITP-1478 Regen types

* useSurveyResponse

* survey review screen

* wip set default values

* set up route

* Update useLogin.ts

* refactor survey context to be at survey level

* remove bad merge

* survey data

* basic working setup

* remove debug changes

* split out paginator

* put page back in survey layout

* refactor layout components

* Update index.ts

* Update SurveyContext.tsx

* Update SurveyReviewSection.tsx

---------

Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>

* Update 20231112212117-AddProjectIdToSurveys-modifies-schema.js

* Add index to migration

* Fix migration

* Fix typo

* Cap survey name length at 50 characters

* WAITP-1490: Datatrak current user context (#5170)

* add current user context

* add error display

* rename context

* WAITP-1431: Fix survey select filter (#5177)

* Update SurveysRoute.ts

* remove tsx extentions

* Update SurveysRoute.ts

* WAITP-1387: Add survey project field (#5172)

* Responsive styling of dashboard leaderboard (#5173)

* Responsive styling of dashboard leaderboard

* Fix type error

* Survey not found error handling (#5160)

* Survey not found error handling

* Reorder imports

* Updates to route

* Fix types

* Remove unused imports

* Error page rename

* Rename page

* no-issue: Fix `location.state` null (#5179)

* extract useFromLocation

* extract `useFromLocation` to own file and use

* WAITP-1474: Update success illustration on DataTrak (#5159)

* generify high-five graphic filename

* update submission success graphic

* define margins along block/inline axes

See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout/Block_and_inline_layout_in_normal_flow

* success screen fix horizontal overflow

* define survey success image dimen with `rem`

* relabel button ‘Close’ → ‘Return to dashboard’

* Fix package error

* Fix autocomplete validation issue

* Create migration for surveys to project mapping

* WAITP-1431: Update datatrak survey url with country code (#5182)

* add Single Entity Route

* use country url to submit

* fix tests

* make TupaiaWebEntityRequest re-usable

* Update SingleEntityRoute.ts

* update recent surveys and responses routes

* handle recent survey submissions

* Update SurveyResponsesSection.tsx

* update country id in survey page

* remove unused code

* Update processSurveyResponse.test.ts

* Update queries

* Update preferred project on survey load

* Update queries and FE to handle project ids, and add migration for project creation

* Add toast to tell user project has been updated

* Remove unused import

* Remove unused import

* Make migration

* Update migration

* Update projectSurveyMappings.json

* Update migration

* Filter out new empty projects from Tupaia Web frontend

* Fix merge issues

* Remove survey responses when migrating down

* Update mappings

* Add new projects

* Add project filtering to activity feed

* WAITP-1480: survey duplication (#5193)

* Make migration

* Update migration

* Update migration

* Remove survey responses when migrating down

* Update PinnedFeedItem.tsx

* Fix build error

* Fix merge error

* Fix error

* WAITP-1482: activity feed changes (#5354)

* Update feed scraper to add all survey responses to feed items

* Add access policy to Datatrak

* Move endpoints over to using new model functions

* Update yarn.lock

* Update packages/datatrak-web-server/src/app/middleware/attachAccessPolicy.ts

Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>

* Fix merge error

* Update model to handle only some countries user has access to

* Update methods

* Move access policy logic to server-boilerplate

* Fix tupaia-web-server tests

* Revert "Fix tupaia-web-server tests"

This reverts commit 0e64b50.

* Fix tests

* Fix tests

* Remove unneeded fixtures

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>

* Fix merge error

* Filter feed items by feed item permissions

* Fix feed item ordering

* Reset feed on login request

* Fix ambiguous query

* Fixes

* Update datatrak activity feed filter format

* Dedupe feed items on infinite scroll

---------

Co-authored-by: acdunham <129009580+acdunham@users.noreply.github.com>
Co-authored-by: Rohan Port <rohan@beyondessential.com.au>
Co-authored-by: Tom Caiger <caigertom@gmail.com>
Co-authored-by: Ethan McQuarrie <69437175+EMcQ-BES@users.noreply.github.com>
Co-authored-by: Chao Xin Nhin <122791168+chaoxinnhin@users.noreply.github.com>
Co-authored-by: Wilhelmus Duncker <122330202+WDuncker@users.noreply.github.com>
Co-authored-by: wduncker <wduncker@LAPTOP-AFVENG10>
Co-authored-by: Chao Xin Nhin <chaon@missionreadyhq.com>
Co-authored-by: Ethan McQuarrie <ethan@beyondessential.com.au>
Co-authored-by: Rohan Port <59544282+rohan-bes@users.noreply.github.com>
Co-authored-by: Jasper Lai <33956381+jaskfla@users.noreply.github.com>
Co-authored-by: RajneelR <132311480+RajneelR@users.noreply.github.com>
Co-authored-by: Andrew <vanbeekandrew@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants