-
Notifications
You must be signed in to change notification settings - Fork 2
feat: unstaking time format improved #496
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
Conversation
🦋 Changeset detectedLatest commit: 931a269 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull request overview
This pull request improves the user experience by replacing the simple day count display for unstaking times with a more granular, human-readable duration format using the date-fns library. The change converts durations into appropriate time units (days, hours, minutes, or seconds) based on the remaining time, making the interface more informative and user-friendly.
Key changes:
- Replaced the
daysUntilDateutility function withformatDurationUntilDatethat usesdate-fnsto generate human-readable duration strings - Updated translation keys from pluralized
unstaking_days_*to a singleunstaking_durationkey that accepts a formatted duration string - Added
date-fnsv4.1.0 as a new dependency
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/widget/src/utils/date.ts | Replaced day calculation with duration formatting using date-fns library |
| packages/widget/src/pages/position-details/components/position-balances.tsx | Updated to use new duration formatting function and changed conditional rendering logic |
| packages/widget/src/translation/English/translations.json | Changed pluralized translation keys to single duration key |
| packages/widget/src/translation/French/translations.json | Changed pluralized translation keys to single duration key |
| packages/widget/package.json | Added date-fns v4.1.0 dependency |
| pnpm-lock.yaml | Updated lock file with date-fns dependency and resolution |
| .changeset/seven-feet-bathe.md | Added changeset documenting the feature improvement |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request improves the display of unstaking time in the widget by switching from a simple day count to a more user-friendly duration format (e.g., "3 days", "5 hours", "20 minutes"). The changes update both the calculation logic and the UI, and add the necessary dependency for formatting durations.
User experience improvements:
Code and dependency updates:
daysUntilDateutility with a newformatDurationUntilDatefunction using thedate-fnslibrary to generate more precise duration strings.date-fnsas a new dependency inpackage.jsonand updatedpnpm-lock.yamlaccordingly. [1] [2] [3] [4]