Skip to content

Features/categories#4

Open
SergeiKalachev wants to merge 24 commits intoMikhailSemichev:masterfrom
SergeiKalachev:features/Categories
Open

Features/categories#4
SergeiKalachev wants to merge 24 commits intoMikhailSemichev:masterfrom
SergeiKalachev:features/Categories

Conversation

@SergeiKalachev
Copy link
Contributor

According to technical task I've developed Categories.
I'm going to show how the result looks like.

Here is a text-area on creating/edit page. It is readonly for editing, because it causes problems if we edit it. Also I think it is not logical to edit it. It is better to create a new one with desired categories.

text_area_categories

If we don't type categories then voting is on original way:

original-way-of-voting

The switcher for information about all categories:

switcher-additional-info

Comments are displayed by popover:

comments

Behavior of the modal window:

  1. You can vote only if you choose category.
  2. You can remove your vote by unchecking categories.

vote-only-with-checked-checkbox

  1. Votes are being splitted by categories.
  2. Tooltips work as required.

votes-splitting

  1. You can simply update your vote. Just choose new ones and press save:

update-vote

I've tried to save structure of files as possible, but I've splited several components into small ones.

I think the most dangerous part of my work is in votesStore because there is some fat logic and I don't know is it ok or not. May be it would be better to remove it from client and pass to server. I think it's up to you.

SARATOV\Sergei_Kalachev added 23 commits January 28, 2018 12:01
…s being saved. Extract method for uniq, filter and map.
… a part of logic from this.state to mobX store (votesStore)
…most of the logic from components to voteStore. Add support of categories and comment to socket and store and components.
… components into small ones. Changed logic (user can't vote now if he haven't choosen category)
…xtracted exact component for comments. Added function to votesStore which defines list of comments
…e new topic than edit categories in it. Fixed bug when you choose topic without categories (app crashed).
…is logic is about defining logins and count of votes in each category for candidate.
@SergeiKalachev
Copy link
Contributor Author

SergeiKalachev commented Feb 6, 2018

UPGRADE

Like I said there was a fat logic on the client side, so I've migrated it from client to the server.

Now every client doesn't calculate information by each candidate about logins in each categories and count of votes in each category. It does server and it does calculations only once and then send it to all clients via socket. So client just receives info, calculate minimal things he needs, and render it.

Added sorting:

sorting

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.

1 participant