ReqoreTier: currency symbol is dropped when price is a string

Open Beginner friendly
#675 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start in src/components/Tier/index.tsx at the currency condition shown in the issue, then check how price and salePrice are handled. Verify that numeric strings show the currency symbol while non-numeric labels such as “Custom” do not, and run the relevant Tier tests; the payload does not name a test file.

Written by the indexing model from the issue text.

Description

What happens

ReqoreTier drops the currency symbol whenever price is a string:

// src/components/Tier/index.tsx
currency && currencyPosition === 'before' && isNumber(price) ? currency : undefined

IReqoreTierProps declares price: string | number and currency: string, so
<ReqoreTier price="50" currency="$" /> is a perfectly legal call — it just renders
50 with no $, silently. Nothing warns, and the missing symbol is easy to miss in
review because the number itself is right.

Why it bites

Prices almost always arrive as strings: JSON payloads, CMS fields, Intl-formatted
amounts, anything with a decimal that must not be re-rounded. On the Qorus marketing
site both sources are strings — the pricing CMS global and the live Qorus SaaS
product catalogue (qorus_saas_product_prices.price) — so every plan card had lost
its currency symbol.

What the landing page does meanwhile

Coerces the value before handing it over, which is exactly the workaround this issue
asks to make unnecessary:

const priceOf = (price: string): string | number =>
  /^\d+(\.\d+)?$/.test(price) ? Number(price) : price;

Suggested fix

In ReqoreTier, gate the currency on "the price is an amount", not on the JS type —
e.g. isNumber(price) || /^\d/.test(String(price)), applied to price and
salePrice alike. A non-numeric price (Custom, Contact us) should keep today's
behaviour of showing no symbol.

If the type-based gate is deliberate, then price should be typed number for the
currency path and the prop doc should say the symbol is numeric-only — right now the
types promise something the render does not deliver.

Dominant language
TypeScript
Stars
4
Forks
0
Avg merge
16h 28m
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from qoretechnologies/reqore

All issues in qoretechnologies/reqore

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.