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

chore: standardize date/number formatting #676

Merged
merged 9 commits into from
Jun 26, 2024
Merged

chore: standardize date/number formatting #676

merged 9 commits into from
Jun 26, 2024

Conversation

tyleroooo
Copy link
Contributor

@tyleroooo tyleroooo commented Jun 14, 2024

Made a helper function version of Output that takes a value and type and returns a string. We can use this in places we are rendering numbers that isn't JSX and ensure we are using the exact same logic for consistency.

Copy link

vercel bot commented Jun 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
v4-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 6:50pm
v4-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 6:50pm

@tyleroooo tyleroooo marked this pull request as ready for review June 25, 2024 21:23
@tyleroooo tyleroooo changed the title chore: pull out date/number formatting for strings chore: standardize date/number formatting Jun 25, 2024
@@ -100,7 +98,7 @@ export const OrderDetailsDialog = ({
);

const renderOrderTime = ({ timeInMs }: { timeInMs: Nullable<number> }) =>
timeInMs ? <time>{relativeTimeString({ timeInMs, selectedLocale })}</time> : '-';
timeInMs ? <Output type={OutputType.DateTime} value={timeInMs} /> : '-';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need to use a ternary here since the <Output> component handles timeInMs = null by rendering -

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell that is only true for numbers. Dates and relative dates bail early and return null if things aren't quite right I think.

We can make dates behave similarly, I'd just do a quick audit to make sure it doesn't break any existing behavior.

@tyleroooo tyleroooo merged commit b10abde into main Jun 26, 2024
6 checks passed
@tyleroooo tyleroooo deleted the tu/outputs-nicer branch June 26, 2024 22:01
DavideSegullo added a commit to nabla-studio/v4-web that referenced this pull request Jun 28, 2024
commit dc02b27
Author: yujin512 <yujin@dydx.exchange>
Date:   Thu Jun 27 16:30:17 2024 -0400

    feat: add blast and metadata (dydxprotocol#738)

    Co-authored-by: jaredvu <jaredvu@gmail.com>

commit cf2c9f2
Author: moo-onthelawn <70078372+moo-onthelawn@users.noreply.github.com>
Date:   Thu Jun 27 13:09:58 2024 -0400

    chore(memo): clean up memo flag + flip staking to be true in mainnet (dydxprotocol#741)

commit 27115fd
Author: Jeremy Lee <37092291+yogurtandjam@users.noreply.github.com>
Date:   Wed Jun 26 20:11:42 2024 -0400

    chore: observability for skip migration [OTE-432] (dydxprotocol#737)

commit b85c1eb
Author: moo-onthelawn <70078372+moo-onthelawn@users.noreply.github.com>
Date:   Wed Jun 26 19:08:56 2024 -0400

    chore(staking): update faq to have see more here link to published help article (dydxprotocol#735)

commit b10abde
Author: tyleroooo <tyler@dydx.exchange>
Date:   Wed Jun 26 18:01:08 2024 -0400

    chore: standardize date/number formatting (dydxprotocol#676)

commit 23a4bd2
Author: yang-dydx <117109716+yang-dydx@users.noreply.github.com>
Date:   Wed Jun 26 14:30:08 2024 -0700

    chore(staking): add default validator as part of stake transaction event (dydxprotocol#736)

commit 83908b3
Author: tyleroooo <tyler@dydx.exchange>
Date:   Wed Jun 26 17:15:34 2024 -0400

    fix: back to linear scale orderbook bars (dydxprotocol#734)

commit b5ef243
Author: moo-onthelawn <70078372+moo-onthelawn@users.noreply.github.com>
Date:   Wed Jun 26 16:40:17 2024 -0400

    fix(staking): fix chart not loading properly (dydxprotocol#733)

commit 22125a6
Author: aleka <aforaleka@gmail.com>
Date:   Wed Jun 26 13:39:41 2024 -0400

    chore: another pass for the markets panels padding (dydxprotocol#732)

commit 131292e
Author: moo-onthelawn <70078372+moo-onthelawn@users.noreply.github.com>
Date:   Wed Jun 26 12:18:25 2024 -0400

    fix(staking): update button styling on tokens page + add error if wallet balance < gas fees on stake form page (dydxprotocol#731)
DavideSegullo added a commit to nabla-studio/v4-web that referenced this pull request Jun 28, 2024
fix(staking): update button styling on tokens page + add error if wallet balance < gas fees on stake form page (dydxprotocol#731)

chore: another pass for the markets panels padding (dydxprotocol#732)

fix(staking): fix chart not loading properly (dydxprotocol#733)

fix: back to linear scale orderbook bars (dydxprotocol#734)

chore(staking): add default validator as part of stake transaction event (dydxprotocol#736)

chore: standardize date/number formatting (dydxprotocol#676)

chore(staking): update faq to have see more here link to published help article (dydxprotocol#735)

chore: observability for skip migration [OTE-432] (dydxprotocol#737)

chore(memo): clean up memo flag + flip staking to be true in mainnet (dydxprotocol#741)

feat: add blast and metadata (dydxprotocol#738)

Co-authored-by: jaredvu <jaredvu@gmail.com>
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.

None yet

2 participants