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

Separate component for Recommendations #1133

Merged
merged 9 commits into from Oct 15, 2020

Conversation

vansika
Copy link
Member

@vansika vansika commented Oct 10, 2020

Separate component to render recommendations.

@vansika
Copy link
Member Author

vansika commented Oct 10, 2020

@MonkeyDo @shivam-kapila I shared the screenshot on IRC, I don't understand why the recommendation card is not getting rendered, From the first look I understand that all the cards are overlapping each other, hence, we can see only one card, might be an issue of table reference, not sure.

@vansika vansika changed the base branch from master to rec-component-feedback October 12, 2020 08:03
Copy link
Collaborator

@shivam-kapila shivam-kapila left a comment

Choose a reason for hiding this comment

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

This is a coarse review. I will review again once classes are over.

@vansika vansika changed the title Refactor RecentListens.tsx: Separate component for Recommendations Separate component for Recommendations Oct 12, 2020
@vansika
Copy link
Member Author

vansika commented Oct 12, 2020

I have reused @shivam-kapila 's code in this PR at places, Thank you. I have tried to keep everything separate for recommendations (from less file to recommendation controls) so that it is easy to update things in future.

@vansika vansika marked this pull request as ready for review October 12, 2020 12:01
Copy link
Collaborator

@shivam-kapila shivam-kapila left a comment

Choose a reason for hiding this comment

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

We need tests

Copy link
Collaborator

@shivam-kapila shivam-kapila left a comment

Choose a reason for hiding this comment

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

LGTM overall. Tests needed.

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

Not sure if I was meant to review the styles of the recommendation card component, I had to modify similar_artist.html to point to recommendations.js instead of main.js in order to see them.

@shivam-kapila
Copy link
Collaborator

@vansika kindly run lint.sh to fix the build

@vansika
Copy link
Member Author

vansika commented Oct 14, 2020

@MonkeyDo I think I am happy with this PR now, I am not touching listened_at for Listens type (people freaking out), that means I will have to supply listened_at with recommendations which is okay for me. If you feel the changes are okay, I will want to write tests and merge it.

@vansika
Copy link
Member Author

vansika commented Oct 14, 2020

image

@MonkeyDo here is a screenshot for your reference :)

Copy link
Collaborator

@paramsingh paramsingh left a comment

Choose a reason for hiding this comment

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

I think we should change BrainzPlayer to not require a listened_at prop instead of changing the recommendation type to keep a listened at there.

@vansika
Copy link
Member Author

vansika commented Oct 14, 2020

@paramsingh I will not be doing that in this PR. In another Pr, for sure

@vansika
Copy link
Member Author

vansika commented Oct 14, 2020

@paramsingh why not open a ticket :) will help me track

@paramsingh
Copy link
Collaborator

OK, sounds like a plan.

@vansika vansika requested a review from MonkeyDo October 15, 2020 06:55
Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

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

We'll need to go over the CSS, but it's not blocking for merging this PR.


declare type Listen = BaseListenFormat & {
listened_at_iso?: string | null;
playing_now?: boolean | null;
score?: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this is relevant anywhere.
Doesn't need to be addressed in this PR, but maybe have a closer look at it when we tackle listened_at/BP changes.

score?: number;
};

declare type Recommendation = BaseListenFormat;
Copy link
Contributor

Choose a reason for hiding this comment

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

That'll work nicely, and means you can easily extend the type with more fields as you need in the future, without having to change anything else( like we're gonna have to do for BP).
Yay future-proofing !

@@ -0,0 +1,61 @@
#recommendations {
&:extend(#listens);
padding: 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this less file will need a good refactor soon (and the listens-page file along with it), as there is still some duplicated css rules and a few things I'd like to change.
However, it ends up as just a few lines of extra unused CSS, which is not a blocker for this PR.
Considering how the rec styles are in flux, let's keep it for another PR.

Comment on lines +14 to +16
> .col-xs-9, .col-xs-11 {

> .col-xs-9, .col-xs-11 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you based this styling on what was there before, but a worthy comment:

Among the things that need changing that I mentioned above (for another PR), this use of bootstrap classes that are meant for layout to be used for styling should be replaced.
The reason is that for example if we decide to change the size of the columns but not the styling, we'll have to modify the less rules even though we haven't changed any of the styling.
Instead, we'll want them to be decoupled by using separate classes for styling and layout (like you do below with .smile, .laugh, .angry, .disappoint, .meh instead of > span).

Comment on lines +6 to +8
padding: 15px;
margin-bottom: 7px;
max-height: 72px;
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll have to review this before deploying. Spacing looks off to me:
Capture d’écran 2020-10-15 à 11 37 44

@vansika vansika merged commit dd7c379 into metabrainz:rec-component-feedback Oct 15, 2020
vansika added a commit to vansika/listenbrainz-server that referenced this pull request Dec 24, 2020
* recommendation componeent and recommendation card

* CSS for recommendation component

* shift recommendationPaginationControl to main method
don't modify bootstrap classes in recommendation-page.less

* fix utils.tsx error

* html emoticons for rec feddback

* update func name

* revamp listens and recommendations type

* tests for recommendation component

* tests for rec component
vansika added a commit to vansika/listenbrainz-server that referenced this pull request Jan 17, 2021
* recommendation componeent and recommendation card

* CSS for recommendation component

* shift recommendationPaginationControl to main method
don't modify bootstrap classes in recommendation-page.less

* fix utils.tsx error

* html emoticons for rec feddback

* update func name

* revamp listens and recommendations type

* tests for recommendation component

* tests for rec component
mayhem pushed a commit that referenced this pull request Jan 20, 2021
* schema for storing recommendation feedback (#1126)

* schema for recommendation feedback

* rename enum strings and enum name

* Separate component for Recommendations (#1133)

* recommendation componeent and recommendation card

* CSS for recommendation component

* shift recommendationPaginationControl to main method
don't modify bootstrap classes in recommendation-page.less

* fix utils.tsx error

* html emoticons for rec feddback

* update func name

* revamp listens and recommendations type

* tests for recommendation component

* tests for rec component

* Refactor RecentListens - Remove recommendations code (#1146)

* refactor recentListens

* fix indentation

* remove unused const

* Recommendation feedback [DB + API] (#1143)

* recommendation feedback model

* use enum vals as feeeback to store in db

* db and api script for recommendation feedback

* PEP-8 fixes

* tests feedback (db)

* tests feedback (API)

* tests update

* don't create two objects

* Sync recommendation feedback with emoticons (#1149)

* tests feedback (db)

* tests update

* sync feedback

* add missing props to test file

* simplify get feedback for multiple recording query

* keep recommendationFeedback type same as recommendationFeedback enum
don't mutate the previous state

* add event.stopPagination to stop closing of dropdown when submitting feedback

* use Icon + text for feedback

* use regular font awsome icons in place of stroke

* if feedback given render corresponding feedback solid

* remove redundant log statements

* don't use prevState value in currRecPage

* remove componentDidUpdate

* adjust alignement of feedback for mobile view

* capitalize feedback text

* don't show feedbacks options for user != currentUser

* define mediaquery after regular padding

* tests for feedback

* don't overwrite afterRecommendationDisplay in tests

* add comment to instruct eslint to ignore import issue

* tests for db

* check for html elements before and after updating feedback

* test interdependency of button and dropdown

* format tests - nitpicks

* remove bad_recommendation feddback type

* adjust spacing between emoticons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants