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

Add unit switching within the "Amount" input #2511

Open
stackingsaunter opened this issue Jun 24, 2023 · 14 comments
Open

Add unit switching within the "Amount" input #2511

stackingsaunter opened this issue Jun 24, 2023 · 14 comments
Assignees
Labels
frontend All things frontend development related

Comments

@stackingsaunter
Copy link
Contributor

Currently there are two important missing features while creating an invoice that are often used and requested:

  • creating invoiced priced in fiat currency
  • being able to see/use units in BTC not sats

Let's add both being able to set an input by user in fiat and also change sats to BTC.
You can play how desired outcome should work in this prototype

You can see the behaviour flow and hanoff HERE.

Changes description:

  1. Add trailing users input "sats" or "BTC" unit:
    image

  2. Those units should be clickable and change to BTC (and vice versa)
    image

  3. Clicking on fiat unit should switch it's place with bitcoin units, thus making it possible for the user to create an invoice priced in fiat:
    image

  4. If fiat unit has a symbol, we show it in front of the number. If it uses 3 letters (USD, ARS, TRY, PLN etc) we should show it after the fiat amount:
    image

  5. All units have hover states I also found one colouring inconsistency. Amount input in dark mode uses "gray" instead of "neutral" like all the rest units, so we could upgrade it to "neutral" with PR related to this issue^
    image Screenshot 2023-06-24 at 22 01 02

Handoff

image
image
image
image

@stackingsaunter stackingsaunter added the frontend All things frontend development related label Jun 30, 2023
@abhiShandy
Copy link

I would like to work on this for Hacktoberfest.

@stackingsaunter
Copy link
Contributor Author

@abhiShandy I assigned you

@abhiShandy
Copy link

abhiShandy commented Sep 30, 2023

First phase

  • Add trailing "sats"
  • Make trailing "sats" clickable to switch to "BTC" and vice versa
  • Fix the text color in dark mode fix: dual currency input styles #2784
  • Add hover states to units
  • Show three letter fiat code after the fiat amount

Second phase

  • Switch from fiat to bitcoin and vice-versa

@abhiShandy
Copy link

The Intl.NumberFormat displays fiat in different formats when locale is changed. Check this example.

@stackingsaunter
Copy link
Contributor Author

@abhiShandy I changed a bit colors in the inputs. Please refer to those colors:

image

@abhiShandy
Copy link

@stackingsaunter Adding a trailing unit in the user input is difficult with HTML and CSS. I'll try to find a JavaScript trick. Meanwhile, have you considered an alternative design?

@bumi
Copy link
Collaborator

bumi commented Oct 2, 2023

I was wondering if an auto-growing input field maybe might work? - to have the unit not as part of the input but after the input.
though avoiding JS would be nice.

@abhiShandy
Copy link

I was wondering if an auto-growing input field maybe might work? - to have the unit not as part of the input but after the input. though avoiding JS would be nice.

width: fit-content doesn't work on Chrome at least. Check this Tailwind Playground.

@abhiShandy
Copy link

abhiShandy commented Oct 5, 2023

This CSS trick uses <span contenteditable> instead of <input type="number"/>. Is that an acceptable solution?

@stackingsaunter
Copy link
Contributor Author

@abhiShandy hey are you still working on this?

@abhiShandy
Copy link

@abhiShandy hey are you still working on this?

No. I'm not working on this.

@abhiShandy abhiShandy removed their assignment Nov 16, 2023
@bumi bumi added this to 🐝 Alby Jan 8, 2024
@bumi bumi moved this to 📝 To-Do in 🐝 Alby Jan 8, 2024
@bumi
Copy link
Collaborator

bumi commented Jan 8, 2024

maybe we start without 2 - and just do the fiat - sat switch first?

@stackingsaunter
Copy link
Contributor Author

@bumi you mean add a button somewhere?

@ffrediani
Copy link

ffrediani commented Aug 20, 2024

This is indeed very well missed feature. Being able to see the equivalent fiat amount when entering the amount of sats in a new invoice is very useful thing to have. Remember to add somewhere an option to choose the available fiat to be the default used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend All things frontend development related
Projects
Status: 📝 To-Do
Development

No branches or pull requests

5 participants