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

[Feat] Responses: update to new UI #299

Merged
merged 66 commits into from
Nov 27, 2020

Conversation

Andrei0872
Copy link
Contributor

@Andrei0872 Andrei0872 commented Nov 18, 2020

Closes #232

This PR comes with a significant change: the /answers route will be rendered with the help of a lazy-loaded module. The reason behind it is that if we keep adding stuff to our bundle, it will start to take more and more time to load the page. Although the loading time is not a problem at the moment, I thought it was a good idea to follow this approach now, so that it will not become more complicated in the long run. Moreover, this change is easy to add and it also improves the file's organization.

There are a few things that are unclear to me/left undone:

  1. when filtering from the /answers page, the filters are not used when sending the request
  2. some columns that are required in the table are missing from the answer's properties: Location Type and Date&Time
  3. what is the API for updating the answers(check/uncheck option, new text) from the sections page? also, should the updates be done as the user does them, or should there be confirmation button?
  4. where should the extraDetails be added? For example, here the details are added before the form tabs
  5. where should notes that do not belong to a specific question be displayed?
  6. some options of some questions can be of type text, instead of type checkbox; should that be a textarea?
  7. in some cases, after a route is rendered, the corresponding data is refetched, although what's needed is already in the store. should I fix this in this PR or should it be considered a separate issue?
  8. What's the API for sending a notification? (referring to the action that should be done after pressing the Send Notification button)

And this is my todo list:

  • fix the hamburger menu's height; although not related to the problem in question, right now the hamburger menu does not contain all of its items; the fix is simple, I just have to increase its max-height value.
  • add a canLoad guard to the answers module
  • add some translations
  • Send Notification page

@vercel
Copy link

vercel bot commented Nov 18, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/code4romania/monitorizare-vot-ong/azbacv4j2
✅ Preview: https://monitorizare-vot-ong-git-feat-responses-update-to-new-ui.code4romania.vercel.app

@Utwo
Copy link
Member

Utwo commented Nov 19, 2020

Congrats for the hard work! Impressive skills! Really like the detailed PR comment and the lazy-route approach. 💯

@aniri
Copy link
Member

aniri commented Nov 20, 2020

@Andrei0872 Woooh, looks great!! 🚀

I'll add some small adjustments that could be made (in this PR or we could open separate issues):

  • the filter by county input should be a dropdown with available counties (GET ​/api​/v1​/county)
  • the total number of responses shown at the top of the page is wrong, it only shows the total from the current page (please mention if an api update is needed for this)
  • the clear filter button doesn't seem to reset the search
  • after filtering by phone number, then deleting the number and pressing 'filter' again (with empty filters) -> the number of responses shown on a page changes from 10 to 5 :/
  • the location & time should be taken from polling-station-info -> arrival time and urban / rural (the ones that are shown here https://monitorizare-vot-ong-git-feat-observers-update-to-new-ui.code4romania.vercel.app/answers/details/12/3530 above the tabs)

And to answer your questions:

  1. when filtering from the /answers page, the filters are not used when sending the request

I think we could comment out the from/to filters that are not used until the API will support these as well

  1. some columns that are required in the table are missing from the answer's properties: Location Type and Date&Time

These correspond to the arrival time and location type (urban or rural) from the polling-station-info

  1. what is the API for updating the answers(check/uncheck option, new text) from the sections page? also, should the updates be done as the user does them, or should there be confirmation button?

Everything should be readonly :) The answers are send by the users of the mobile apps and only viewed by admins here.

  1. where should the extraDetails be added? For example, here the details are added before the form tabs

Those details should be added here and in the table (arrival time & location type)
details card

  1. where should notes that do not belong to a specific question be displayed?

There should be another tab with all notes, as seen in the design. This is a bigger fix though and also added as a separate issue #290 . It could be implemented in this PR or another :)

  1. some options of some questions can be of type text, instead of type checkbox; should that be a textarea?

Yes

  1. in some cases, after a route is rendered, the corresponding data is refetched, although what's needed is already in the store. should I fix this in this PR or should it be considered a separate issue?

Good catch! If it you could fix it in this PR it would be awesome, if not, we'll add a different issue.

  1. What's the API for sending a notification? (referring to the action that should be done after pressing the Send Notification button)

The api is POST ​/api​/v1​/notification​/send with body:

{
  "channel": "Firebase",
  "from": "Monitorizare Vot",
  "title": "string",
  "message": "string",
  "recipients": [
    "THE_ID_OF_THE_OBSERVER"
  ]
}

It is similar to the endpoint used in the notifications page.

@Andrei0872
Copy link
Contributor Author

@aniri Thanks for such a detailed reply!

I think we could comment out the from/to filters that are not used until the API will support these as well

So, I guess I should hide the form controls from the UI as well, right?

Everything should be readonly :) The answers are send by the users of the mobile apps and only viewed by admins here.

Makes sense! :)

I'd say everything can be done in this PR. If that's okay, I could also include #290, it would be my pleasure. I'll start working tomorrow and I'll keep you updated. Thanks!

@aniri
Copy link
Member

aniri commented Nov 20, 2020

So, I guess I should hide the form controls from the UI as well, right?

Yes, please :)

I'd say everything can be done in this PR. If that's okay, I could also include #290, it would be my pleasure. I'll start working tomorrow and I'll keep you updated.

@Andrei0872 That sounds awesome!! Thank you!! 🚀

@Andrei0872
Copy link
Contributor Author

Andrei0872 commented Nov 26, 2020

Hello @aniri, I've just submitted the latest changes, please let me know if I missed something.

Here are some things that I think are worth mentioning:

  1. When the user is on the /answer/details/ page, if it refreshed the page, it will be redirected back to /answers page.

  2. In the Notes tab, I didn't manage to also add an image/video at the right of the note's text, since I think a much smaller image should be used there.

  3. When a note does not belong to a question(i.e the note does not have a question link), I've simply put '/'. Should there by other message?

…modal content

* reason: both `notes` and `answer-questions` are bound to use the same modal template
* this is to show the questions with notes from the crt tab properly
… previous one visited

* when, from `Notes` tabm the user is redirected to a form tab which is different than the previous one, shown exactly before the user had visited the `Notes` tab
Copy link
Member

@aniri aniri left a comment

Choose a reason for hiding this comment

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

awesome work!!! 🚀

@aniri aniri merged commit fb7c53c into code4romania:develop Nov 27, 2020
aniri pushed a commit that referenced this pull request Nov 30, 2020
* chore(observers ): adjust header title according to the design

* feat(answers): add `answers` module

* i18n(answers): add translations for table columns

* feat(answers): add the `download` functionality to the export button

* feat(answers): add filters according to the design

* refactor(table-container): extract types & interfaces into a separate file

* feat(table-container): allow to use custom `no-rows-found` content

* feat(answers): add `no-rows-found` message

* feat(table-container): allow rows to be clicked

* feat(answers): add `answer-detail` component

* allows to view an answer in detail

* feat(answers): add `answer-details` component

* wip(answer-details): build the base for the forms container

* chore(scss): add global variables for gray common colors

* border-color-gray / dim-gray

* fix(answers): remove unwanted `answer-detail` component

* feat(base-checkbox): add transparent variant

* feat(answer-details): display sections, their forms, alongside checked/unchecked answers

* fix(visually-hidden): remove absolute position

* by using `position: absolute`, in Chrome(and Brave as well) we get a weird error: looks like although the content that overflows is hidden by the `sections container`, the scroll bar behaves as if it wouldn't overflow
* in Firefox we don't have this error

* feat(answer-details): show question's note

* fix(answers): fetch answers without previous `state.urgent` value

* fix(header): make hambuger menu contain all of its items

* feat(answers): add `CanLoad` guard to `answers` module

* feat(answer-notification): add page for sending notifications

* feat(base-button): allow to have inheritet color

* particularly useful when we want the button's color to depend on the class applied on the `container`

* fix(answer-details): change `View Note` button's color in accordance with the question's flagged status

* i18n(answers/*): add translations

* fix(answers): show total number of all records

* instead of the number of current records shown in page

* feat(table): identify a table column by using a custom directive

* feat(answers): make `filters` work

* feat(answers): reset filters

* as a result, the entries will be shown accordingly

* feat(county): add `county` store slice

* feat(answers): select `counties` filter from `select` tag

* feat(answers): show `Location Type` & `Date&Time` columns in table

* feat(answer-details): show `Location Type` & `Date&Time` stats

* refactor(answers): remove `from` & `to` filters

* feat(base-checkbox): allow checkbox to be readonly(disabled)

* feat(answer-details): make every answer readonly

* fix(observers): allow the `table` comp to query the tableColumn properly

* fix(answers.effects): avoid calling for extra details when initial response is empty

* feat(answers/form): fetch forms when only needed

* feat(answers): fetch data only when needed & don't refetch redundantly

* feat(answers-notification): send notification

* feat(notes): fetch data only when needed & don't refetch redundantly

* refactor: replace `/urgents` route with `urgent` filter in `/answers`

* feat(answer-questions): display questions & answers in separate component

* feat(answer-details): add `Notes` tab

* feat(answer-details): add `Notes` tab

* feat(answer-details): scroll to question from `Notes` tab

* feat(answer-details): open modals with content decided by child components

* feat(notes): open modal with note on row click

* refactor(notes): let the `answer-details` hold the template with the modal content

* reason: both `notes` and `answer-questions` are bound to use the same modal template

* feat(answer-questions): show note in modal when the `View Note` is called

* feat(notes): display shrunk note text with ellipsis when necessaryy

* feat(answer-questions): improve highlight of flagged question

* fix: make `visually-hidden` class work on both Chrome and Firefox

* fix(answer-questions): remove empty spaces from `textarea`

* feat(answers): make layout responsive

* fix(notes): fetch notes immediately as `answer-details` is rendered

* this is to show the questions with notes from the crt tab properly

* feat(answers): add loading icon

* feat(answer-details): add loading icon

* fix(login): redirect to `/answers` instead of the old `/urgents`

* feat: reset state after logout

* fix(answers): make `Export` button work

* fix(answer-details): scroll to question from a tab different than the previous one visited

* when, from `Notes` tabm the user is redirected to a form tab which is different than the previous one, shown exactly before the user had visited the `Notes` tab

* i18n(answer-details): add translations

* feat(answer-notification): show message after notification has been sent

* refactor(notes): display '-' when a question link is missing
aniri added a commit that referenced this pull request Nov 30, 2020
* add build yaml

* Update azure-pipelines.yml for Azure Pipelines

* Add names for tasks

* remove what is thought to be a useless task

* Bump npm-registry-fetch from 4.0.2 to 4.0.5 in /frontend

Bumps [npm-registry-fetch](https://github.com/npm/registry-fetch) from 4.0.2 to 4.0.5.
- [Release notes](https://github.com/npm/registry-fetch/releases)
- [Changelog](https://github.com/npm/npm-registry-fetch/blob/latest/CHANGELOG.md)
- [Commits](https://github.com/npm/registry-fetch/commits)

Signed-off-by: dependabot[bot] <support@github.com>

* updated backend link added local env config and cleanup up readme

* removed duble entry

* force older typescript version

* Update README.md

* Update README.md

* Updated angular to last version of 8

* Updated older module dependencies

* Reverted over shooting packages back to version 9

* Upgraded version of ngx-bootstrap due to compilation issues

* Refused analytics prompt

* Changed ngrx and toastr versions

* Caped typescript version to be below 3.9

* Implemented forms tab (#246)

* setting to and from variables correctly (#260)

* Add loader for download answers action #257 (#261)

* Add loader for download answers action #257

* Feature: answer.component.html download button disabled if data is loading

* chore: fix sourceMap flag for build script (#249)

In `--sourcemap` is not a valid flag anymore, see `--sourceMap` https://angular.io/cli/build

* Refactor (#263)

* Move frontend to root. Remove testing libraries.

* Remove dummy spec files

* Remove unused dependencies

* Update bootsrap. Change angular and tsconfig so that it reflects the latest angular version

* Update azure pipeline

* Move frontend to root. Remove testing libraries.

* Remove dummy spec files

* Remove unused dependencies

* Update bootsrap. Change angular and tsconfig so that it reflects the latest angular version

* Update azure pipeline

* Resolve checkbox and tabs problem.

* Resolve tabs problem

* Resolve azure pipeline

* Add loading to download button

Co-authored-by: Irina Borozan <anirib@gmail.com>

* More design (#270)

* Resolve some design problems

* More design fixes. Remove all unused imports

* Try to rollback old design with the new bootstrap

* Create codeql-analysis.yml

* add flagged answer option; fix flag icon spelling (#272)

* [Forms] Add delete confirmation when deleting forms #264 (#271)

* feat: add confirmation shared model for delete confirmation

* feat: add delete modal for forms

* refactor: cleanup#1

* feat: remove: modal spec file

* updates readme and custom repo files (#278)

* Issue #267 - Added tooltip for option icons. (#273)

Signed-off-by: Ajinkya Jeurkar <ajeurkar@proximabiz.com>

* Feature/268 update form view to new ui (#274)

* Updated form UI

* Missed the name change

* Updated comments in PR, Fixed Translations and added Description Textarea

* adding logout functionality (#281)

* fix(header): make hambuger menu work on smaller screens (#283)

* refers to #275

Co-authored-by: Irina Borozan <anirib@gmail.com>

* Updated login to new UI (#282)

* Updated login to new UI

* translations added

* larger image added

* Update CODEOWNERS

* updated form spacing and mobile (#285)

* updated form spacing and mobile

* fixed spacing

* Updated authentication API to V2 (#286)

* feat/observers: update to new ui (#287)

* Feature/284 new ui statics page (#288)

* Implemented DELETE /api/v1/observer endpoint in observers list. (#297)

* Implemented DELETE /api/v1/observer endpoint in observers list.

* Added localized strings for observer delete dialog.

* Added localized strings for previously implemented observer delete dialog.

* Style navbar (#295)

* 1 line on cards (#298)

* 1 line on cards

* removed the dash

* AnswerFilter mdl rm observerId add observerPhone (#259)

* AnswerFilter mdl rm observerId add observerPhone

Added phoneObserver param to srvc

Filter by observerPhone instead of observerId

* added translations

* add observer phone number filter

Co-authored-by: Irina Borozan <anirib@gmail.com>

* Added modal component for predefined form options. (#300)

* [Feat] Responses: update to new UI (#299)

* chore(observers ): adjust header title according to the design

* feat(answers): add `answers` module

* i18n(answers): add translations for table columns

* feat(answers): add the `download` functionality to the export button

* feat(answers): add filters according to the design

* refactor(table-container): extract types & interfaces into a separate file

* feat(table-container): allow to use custom `no-rows-found` content

* feat(answers): add `no-rows-found` message

* feat(table-container): allow rows to be clicked

* feat(answers): add `answer-detail` component

* allows to view an answer in detail

* feat(answers): add `answer-details` component

* wip(answer-details): build the base for the forms container

* chore(scss): add global variables for gray common colors

* border-color-gray / dim-gray

* fix(answers): remove unwanted `answer-detail` component

* feat(base-checkbox): add transparent variant

* feat(answer-details): display sections, their forms, alongside checked/unchecked answers

* fix(visually-hidden): remove absolute position

* by using `position: absolute`, in Chrome(and Brave as well) we get a weird error: looks like although the content that overflows is hidden by the `sections container`, the scroll bar behaves as if it wouldn't overflow
* in Firefox we don't have this error

* feat(answer-details): show question's note

* fix(answers): fetch answers without previous `state.urgent` value

* fix(header): make hambuger menu contain all of its items

* feat(answers): add `CanLoad` guard to `answers` module

* feat(answer-notification): add page for sending notifications

* feat(base-button): allow to have inheritet color

* particularly useful when we want the button's color to depend on the class applied on the `container`

* fix(answer-details): change `View Note` button's color in accordance with the question's flagged status

* i18n(answers/*): add translations

* fix(answers): show total number of all records

* instead of the number of current records shown in page

* feat(table): identify a table column by using a custom directive

* feat(answers): make `filters` work

* feat(answers): reset filters

* as a result, the entries will be shown accordingly

* feat(county): add `county` store slice

* feat(answers): select `counties` filter from `select` tag

* feat(answers): show `Location Type` & `Date&Time` columns in table

* feat(answer-details): show `Location Type` & `Date&Time` stats

* refactor(answers): remove `from` & `to` filters

* feat(base-checkbox): allow checkbox to be readonly(disabled)

* feat(answer-details): make every answer readonly

* fix(observers): allow the `table` comp to query the tableColumn properly

* fix(answers.effects): avoid calling for extra details when initial response is empty

* feat(answers/form): fetch forms when only needed

* feat(answers): fetch data only when needed & don't refetch redundantly

* feat(answers-notification): send notification

* feat(notes): fetch data only when needed & don't refetch redundantly

* refactor: replace `/urgents` route with `urgent` filter in `/answers`

* feat(answer-questions): display questions & answers in separate component

* feat(answer-details): add `Notes` tab

* feat(answer-details): add `Notes` tab

* feat(answer-details): scroll to question from `Notes` tab

* feat(answer-details): open modals with content decided by child components

* feat(notes): open modal with note on row click

* refactor(notes): let the `answer-details` hold the template with the modal content

* reason: both `notes` and `answer-questions` are bound to use the same modal template

* feat(answer-questions): show note in modal when the `View Note` is called

* feat(notes): display shrunk note text with ellipsis when necessaryy

* feat(answer-questions): improve highlight of flagged question

* fix: make `visually-hidden` class work on both Chrome and Firefox

* fix(answer-questions): remove empty spaces from `textarea`

* feat(answers): make layout responsive

* fix(notes): fetch notes immediately as `answer-details` is rendered

* this is to show the questions with notes from the crt tab properly

* feat(answers): add loading icon

* feat(answer-details): add loading icon

* fix(login): redirect to `/answers` instead of the old `/urgents`

* feat: reset state after logout

* fix(answers): make `Export` button work

* fix(answer-details): scroll to question from a tab different than the previous one visited

* when, from `Notes` tabm the user is redirected to a form tab which is different than the previous one, shown exactly before the user had visited the `Notes` tab

* i18n(answer-details): add translations

* feat(answer-notification): show message after notification has been sent

* refactor(notes): display '-' when a question link is missing

* Feature/210 notifications page new ui (#301)

* 210 - Started notification page adjustments

* 210 - Optimize imports

* 210 - Finalized UI refactor

* 210 - Added min/max pollingStation number

* 210 - Fixed scenario of empty filter; translated validation message

* 210 - Fix remove county scenario to clear the filter

* Update en.json

Co-authored-by: Irina Borozan <anirib@gmail.com>

* Feature/218 show notification history (#303)

* 210 - Started notification page adjustments

* 210 - Optimize imports

* 210 - Finalized UI refactor

* 210 - Added min/max pollingStation number

* 210 - Fixed scenario of empty filter; translated validation message

* 210 - Fix remove county scenario to clear the filter

* 218 - Initial commit (empty table)

* 218 - Fixed table data

* 218 - Added notification history back button; aligned translations

* 218 - Fix merge issues

* 218 - Fix merge issues 2

* 218 - Fixed missing directive in notification-history.component.html

* 218 - Reverted changes outside scope; reduced notification history table size

* Updated the 'Forms' list to the new UI mock-up. (#302)

* AnswerFilter mdl rm observerId add observerPhone

Added phoneObserver param to srvc

Filter by observerPhone instead of observerId

* form list updated to new ui

* Removed package-lock.json

* Added package-lock.json to gitignore

* Added some translations.

* Made the template look more similar to the mock-up.

Also disabled columns that are yet to be implemented.

* Added publish/unpublish button to dropdown in 'Forms' list.

* Re-commented a piece of code which was un-commented for some unknown reason.

* Merged two methods into one as there was no reason to have them both.

* Fixed a bug where the app would crash if there were no drafts returned.

* Reverted a change in formDelete action

* Removed accidental duplicate key in ro.json

Co-authored-by: Robert Kovacs <kovrobert@yahoo.com>

* Feature/227 notification from observer screen (#304)

* 210 - Started notification page adjustments

* 210 - Optimize imports

* 210 - Finalized UI refactor

* 210 - Added min/max pollingStation number

* 210 - Fixed scenario of empty filter; translated validation message

* 210 - Fix remove county scenario to clear the filter

* 218 - Initial commit (empty table)

* 218 - Fixed table data

* 218 - Added notification history back button; aligned translations

* 218 - Fix merge issues

* 218 - Fix merge issues 2

* 218 - Fixed missing directive in notification-history.component.html

* 227 - Progress focused notification

* 218 - Reverted changes outside scope; reduced notification history table size

* 227 - Send notifications from observers table

* updated texts (#307)

* updated texts

* change file extension for export

Co-authored-by: Bogdan Vizureanu <bogdan.vizureanu@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert-Andrei Damian <damian.robert.andrei@gmail.com>
Co-authored-by: JR Strayhorn <jrstrayhorn@gmail.com>
Co-authored-by: Aleksandr Maniunin <46249326+aamanunin@users.noreply.github.com>
Co-authored-by: Andrew Luca <thendrluca@gmail.com>
Co-authored-by: Utwo <mihai.legat@gmail.com>
Co-authored-by: Pushpika Wanniachchi <PushpikaWan@users.noreply.github.com>
Co-authored-by: Ajinkya Jeurkar <52557440+ajeurkar@users.noreply.github.com>
Co-authored-by: Developer.Dave <44526601+Botosio@users.noreply.github.com>
Co-authored-by: Gatej Andrei <andreigtj01@gmail.com>
Co-authored-by: sandrohanea <40202887+sandrohanea@users.noreply.github.com>
Co-authored-by: Vlad Cuciureanu <vlad.c.cuciureanu@gmail.com>
Co-authored-by: Ion Dormenco <idormenco@gmail.com>
Co-authored-by: Robert Kovacs <kovrobert@yahoo.com>
Co-authored-by: Nicolae Stihhi <nicolae.stihhi@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.

[Responses] Update responses page to new UI
3 participants