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
Remove flare tag from title and hightlight it within the tags row #10528
Remove flare tag from title and hightlight it within the tags row #10528
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh damn, I love it! Thank you so much! I have one very tiny change request - other than that it's awesome!
| color: flare_tag.text_color_hex, | ||
| }} | ||
| > | ||
| {`#${flare_tag.name}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap # with <span className="crayons-tag__prefix"> similar to how we do it with other tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing!
|
I've just realized, that when you scroll down quite a lot on your feed we actually load feed cards differently (I don't know why...) - so the feed card code is generated in multiple places. That jsx component is one of them and it works great. But we gonna need it in other places too.. Do you think you can look at it as well? You can also spot it in logged out version of the page where we also load feed card differently. |
|
Sure.. I'll look into it.. |
|
@akshayymahajan awesome! I'm super excited about this one :) Btw. here are some references you may find useful: |
|
Hey @ludwiczakpawel, I have updated both files and tested in the logged out page and the search results. Can you check again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I left few last change request - nothing really major :)
| flareTag = | ||
| "<a href='/t/" + | ||
| article.flare_tag.name + | ||
| "' class='crayons-tag'>" + | ||
| "<span class='crayons-story__flare-tag' style='background:" + | ||
| article.flare_tag.bg_color_hex + | ||
| ';color:' + | ||
| article.flare_tag.text_color_hex + | ||
| "'><span className='crayons-tag__prefix'>#</span>" + | ||
| article.flare_tag.name + | ||
| '</span>' + | ||
| '</a>'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should drop this extra container crayons-story__flare-tag - it's not needed anymore.
| flareTag = | |
| "<a href='/t/" + | |
| article.flare_tag.name + | |
| "' class='crayons-tag'>" + | |
| "<span class='crayons-story__flare-tag' style='background:" + | |
| article.flare_tag.bg_color_hex + | |
| ';color:' + | |
| article.flare_tag.text_color_hex + | |
| "'><span className='crayons-tag__prefix'>#</span>" + | |
| article.flare_tag.name + | |
| '</span>' + | |
| '</a>'; | |
| flareTag = `<a href="/t/${article.flare_tag.name}" class="crayons-tag" style="background: ${article.flare_tag.bg_color_hex}; color: ${article.flare_tag.text_color_hex};"> | |
| <span class="crayons-tag__prefix>#</span> | |
| ${article.flare_tag.name} | |
| </a>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flare tag is basically now a classic crayons-tag with custom background and color.
| @@ -135,7 +135,7 @@ | |||
|
|
|||
| &__flare-tag { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should now be able to remove this entire class, right?
| {flare_tag && ( | ||
| <a className="crayons-tag" href={`/t/${flare_tag.name}`}> | ||
| <span | ||
| className="crayons-story__flare-tag" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to what I suggested in previous comment, we should drop .crayons-stroy__flare-tag
| <% story.cached_tag_list_array.each do |tag| %> | ||
| <% flare_tag = FlareTag.new(story, @tag).tag %> | ||
| <% if flare_tag %> | ||
| <a href="/t/<%= flare_tag.name %>" class="crayons-tag"><span class="crayons-story__flare-tag" style="background:<%= flare_tag.bg_color_hex %>;color:<%= flare_tag.text_color_hex %>"><span className="crayons-tag__prefix">#</span><%= flare_tag.name %></span></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And same here.
|
@ludwiczakpawel updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny change and it's ready!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thank you :) This looks great.
|
@akshayymahajan it looks like some of the tests are failing, please take a look at the build here: https://github.com/forem/forem/pull/10528/checks?check_run_id=1201884642 |
|
Hey @rhymes, I have updated the code to fix the failing test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I've taken it for another ride and there's still something a little bit off, when I scroll down the feed. Here's a video showing the issue. Looks like on the feed cards that are being loaded with infinity scroll we don't apply appropriate colors/styling to the flare tag.
|
Hey @ludwiczakpawel, looks like the data being returned from the API has some null values. Not sure if this is related to the changes I made. Would really appreciate some help. |
|
Interesting. I can see this working properly on prod dev.to... @rhymes I SUMMON YOU. |
|
Hi @akshayymahajan, that indicates that the tag has no defined colors: Lines 26 to 27 in a943f04
both hex colors can be |
|
Thanks, @rhymes. @ludwiczakpawel in that case, I think it would be best to add back the |
|
@rhymes are you sure? can you please checkout the screen recording here: https://d.pr/v/Pzx0DE - it's the same tag. one time it has colors applied and the other time it does not... which means that this tag in general has colors applied but they are not returned in certain cases. |
|
@ludwiczakpawel I'm not very familiar with how flare tags work but I came up with these two clues:
Lines 312 to 314 in a943f04
forem/app/services/flare_tag.rb Lines 18 to 21 in a943f04
It looks to me that if forem/app/services/flare_tag.rb Lines 37 to 40 in a943f04
The clue for what might be going on in your recording is to be found in: forem/app/views/articles/_tag_identifier.html.erb Lines 1 to 3 in a943f04
which is passing This comes from https://github.com/forem/forem/blob/master/app/views/articles/_single_story.html.erb I seem to recall that the first page of the feed is rendered one way, subsequent pages are rendered in a different way but I'm not sure how all that works, @joshpuetz or @nickytonline might instantly know what's going on here. There might be a different behavior between the flare tag appearing in the first batch of articles and the following batches |
|
I tried removing the "except tag" from the call, but it still returns |
|
@akshayymahajan let me give it another look tomorrow and I'll get back to you then. |
|
Yea, looks like it's being broken on master as well.. So I'll go ahead and approve this PR :) Thanks for all the work you've done, it's really something I've been looking for for a quite long time so I appreciate your effort :) |
…rem#10528) * Remove flare tag from title and hightlight it within the tags row * wrap flare tag # in a span with class crayons-tag__prefix * updated buildArticleHTML.js to show flare tag in the tags row * updated _single_story.html.erb to show flare tag in the tags row * fixed missing opening tag * removed crayons-story__flare-tag class and containers * added .crayons-story__flare-tag back to stories.scss for search results * added check for undefined tagList in buildArticleHTML.js


What type of PR is this? (check all applicable)
Description
This PR does 2 things:
Related Tickets & Documents
Closes #10523
QA Instructions, Screenshots, Recordings
Added tests?
Added to documentation?