DigixGlobal / governance-ui-components

Governance UI reusable components library
Other
3 stars 2 forks source link

Move active project tab (stage) to redux instead of in the react stat… #371

Closed crypto-supporter closed 5 years ago

crypto-supporter commented 5 years ago

WHY

Going to a proposal page from the review tab and then clicking back button takes you to the All tab. It would be more logical to go back to the tab where you left off.

WHAT

Move the stage react state to redux to preserv that data even if a user moves to another page. That way the state will be preserved even if a user moves to another page.

HOW TO TEST

  1. Go to https://localhost:3000/#/
  2. Go to Review tab and click on a proposal
  3. Click back button
  4. Expected -> You should be at the Review tab

PS

I would consider refactoring the menu logic a bit. Make links of them so it would be https://localhost:3000/#/all, https://localhost:3000/#/review, etc.. That way we get a lot of good UX for free from the way the browser behaves. It would also be easier to maintain and codesplit if needed and also fix the issue that the whole components get rerendered even if the data is the same.

mikej-digix commented 5 years ago

iteration: 1 status: PASSED environment: LOCAL

Test Condition:

mandres-digix commented 5 years ago

Hey @crypto-supporter, just a heads up. We reverted your changes temporarily because we noticed that the API endpoint for filtering proposal likes by stage is not available for some stage values. We'll bring the change back once the endpoint has been fixed.

Issue Description

http://localhost:3005/proposals?stage=<stage> does not work for some values of stage because the filter list in the API is incomplete. So what happens is that the likes counter on the dashboard will be 0 for some proposals.

How to fix

Are you familiar with developing in Ruby on Rails? I believe this should be an easy fix in the dao-server repository. We just need to add the missing filters in app/models/concerns/stage_field.rb .

# frozen_string_literal: true

module StageField
  extend ActiveSupport::Concern
  included do
    enum stage: { idea: 1, draft: 2, archived: 9 } # add missing filters here
  end
end

The numerical values are arbitrary, though let's not change the existing ones (so we don't have to do a migration) and let's keep them in order (e.g. the value for idea should be less than draft, which is less than proposal).

If you have questions or encounter any problems, feel free to tag @FrancisMurillo in your dao-server PR. He will be the one reviewing dao-server changes.

mandres-digix commented 4 years ago

It looks like additional changes will be needed to accommodate the all filter. We either change the logic in the frontend to remove the all filter and replace the usage of REST endpoints with GraphQL, or we update the backend to accommodate all the filters. Regardless, this PR is reverted for now until either change is made.

@crypto-supporter