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

Providing some context to how long ago a version was released #4352

Merged
merged 4 commits into from
Jul 30, 2024

Conversation

robbyrussell
Copy link
Contributor

Proposal: When you're looking at a particular Rubygem (version), it would be nice if we could convey the age of a particular gem version.

Example:

2024011222

2024011219

This change uses time_ago_in_words, and we pass in the authored_at timestamp.

Considerations:

I'm not 100% confident in all the translations. I used Google Translate; it might help to have additional people review it.

Copy link

codecov bot commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.02%. Comparing base (656d882) to head (26e7b3f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4352   +/-   ##
=======================================
  Coverage   97.02%   97.02%           
=======================================
  Files         420      420           
  Lines        8726     8726           
=======================================
  Hits         8466     8466           
  Misses        260      260           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

<h2 class="gem__ruby-version__heading t-list__heading">
<%= t('.gem_version_age') %>:
<span class="gem__rubygem-version-age">
<p><%= time_ago_in_words(@latest_version.authored_at) %> ago</p>
Copy link
Member

Choose a reason for hiding this comment

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

@segiddins if I understand it well, this is going to break caching, since the page content will change in time even with no resource update. Would it be better to use JS solution like https://momentjs.com/docs/#/displaying/fromnow/?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@robbyrussell would you mind to try to use local_time gem? Feel free to ping me if you need help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry for not considering the caching aspect that is in production.

The install instructions for the current releases of local_time assume you might have importmaps and/or webpacker in place. Are there plans for this project to use either approach going forward? (and past versions on NPM)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@robbyrussell there is PR introducing importmaps at #4392. Maybe it is worth to wait for that one to land before tackling this.

@simi
Copy link
Member

simi commented Feb 22, 2024

@robbyrussell import maps has landed already. Are you still interested in finishing this?

@martinemde martinemde self-assigned this May 5, 2024
@martinemde
Copy link
Member

Assigning so I can try to get this into the design refresh that is coming.

@simi simi force-pushed the rr-show-version-released-age branch from 30c984d to 78508de Compare June 14, 2024 00:12
@simi
Copy link
Member

simi commented Jun 14, 2024

I have updated this to use local_time gem since import maps are onboarded. WDYT @martinemde @segiddins @colby-swandale?

.gem__rubygem-version-age {
margin-top: 10px;
margin-bottom: 30px;
display: block;
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this, maybe use a div instead of a span?

Copy link
Member

Choose a reason for hiding this comment

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

it follows the rest, IMHO ok

@robbyrussell
Copy link
Contributor Author

Thanks @martinemde, I didn't see the last comments. If you need anything from me, don't hesitate to let me know

@martinemde martinemde removed their assignment Jun 21, 2024
@simi simi merged commit 19eb557 into rubygems:master Jul 30, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants