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 ability to select a default country for the Address and Phone fields #8081

Open
123remodeling opened this issue Oct 25, 2024 · 14 comments · May be fixed by #8614
Open

Add ability to select a default country for the Address and Phone fields #8081

123remodeling opened this issue Oct 25, 2024 · 14 comments · May be fixed by #8614
Assignees
Labels
-PR: wip good first issue Good for newcomers scope: back+front Issues requiring full-stack knowledge

Comments

@123remodeling
Copy link

123remodeling commented Oct 25, 2024

Scope & Context

All our opportunities, employees and other contacts are in the US and I would like to make Address field to use the United States as a default country. It's tiresome to change it manually all the time.

Current behavior

Currently, the Country in the Address field defaults to null (but shows Ascention Island for some reason, which is confusing).

Expected behavior

Ability to select the default country on the field level for Address field. I think it would be also useful to add an ability to use a default State for companies that operate only in a single State.

@FelixMalfait
Copy link
Member

FelixMalfait commented Oct 28, 2024

Good point. We already have a similar capabilty for currency (default unit) so whoever implements this can take inspiration from it.

We should also consider adding it for phones (but for phone we should be able to leave it as blank / with no default country, like today)

@FelixMalfait FelixMalfait added the scope: back+front Issues requiring full-stack knowledge label Oct 28, 2024
@Bonapara
Copy link
Member

Bonapara commented Oct 28, 2024

image

https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=34845-128087&node-type=frame&t=WdI3ZY5Lsc7ylyqB-11

@123remodeling
Copy link
Author

@Bonapara looks good!

@FelixMalfait FelixMalfait added the good first issue Good for newcomers label Oct 29, 2024
@sreyas-b-anand
Copy link

Can you assign this to me?

@Bonapara
Copy link
Member

Sure @sreyas-b-anand, thanks for contributing!

@sreyas-b-anand sreyas-b-anand removed their assignment Oct 30, 2024
@sri-c9
Copy link

sri-c9 commented Oct 30, 2024

I see that the previous contributor was removed, would you be able to assign this to me? @Bonapara

@Bonapara
Copy link
Member

Sure @sri-c9 , thanks for contributing!

@sri-c9
Copy link

sri-c9 commented Oct 30, 2024

sorry i thought this was nextjs not nestjs

@sri-c9 sri-c9 removed their assignment Oct 30, 2024
@FelixMalfait FelixMalfait changed the title Add ability to select a default country for the Address field Add ability to select a default country for the Address and Phone fields Nov 12, 2024
@guillim
Copy link
Contributor

guillim commented Nov 19, 2024

Question to @Bonapara :

  • I cannot remove a country today. It should be an option for the users ?

Image

  • If I start from an empty address, and I click only to open the INPUT without filling anything. If we prefill the country by default, should it save automatically when I click outside ? or not ?
Screen.Recording.2024-11-19.at.18.33.40.mov

ping @FelixMalfait @charlesBochet

@Bonapara
Copy link
Member

@FelixMalfait
Copy link
Member

@guillim I checked after our conversation and the default currency is actually set on the frontend when editing a currency field. Which means it's set to null by default but if you open/close the input then it'll be set to your default value. We don't really feel it on the currency field because there's also an additional condition so that we shouldn't display anything unless the amount is not null.
I think that behavior is fine and we could have the same behavior on phone numbers (also hiding the number if only the country has been recorded).

For the address field type it's slightly more annoying because if we open/close the address field and it has a default value, then the country will become visible in read-only mode because we don't require setting an address to display it.
I don't think it's a big issue because:

  • the user can always set the value back to null manually since you'll introduce that option
  • in the future, we will likely introduce additional settings on the address field later to allow the user adjust the address display format.
  • in the future, there will be other evolutions to the address field which could impact the decision (e.g. add Google Maps auto-complete)

Overall I don't think it's worth overthinking this feature. We should go with whatever makes more sense for you.

@guillim guillim linked a pull request Nov 20, 2024 that will close this issue
@JorgeGraciaViveros
Copy link

Hi @Bonapara! I am currently working in a group of 5 students from CMU taking an introductory software engineering course and our final project is to contribute to an open-source repo. Our project has multiple checkpoints and will be due on December 8 (meaning our PR will take longer to open). Would it be possible for us to be assigned to this issue (or any issues that you think would be a good fit)? Thanks!

@Bonapara
Copy link
Member

Sorry @JorgeGraciaViveros, @guillim is already on it

@guillim
Copy link
Contributor

guillim commented Nov 25, 2024

Technical consideration:

The default value already exist in the Metadata object. Therefore it's better to use it instead of the Settings field.

TODO items (#8614 )

  • Address country backend validator
  • Address country backend test
  • Phone country backend
  • Address preview country update (front)
    Viewed with @Bonapara , we only update the country, not the number and the street.
    So 456 Oak Street, Unit 3B, Springfield, United States would become 456 Oak Street, Unit 3B, Springfield, India. We do not make it reactive, waiting for Preview : Inline Settings not reactive #8556 for that
  • Address CountrySelect component (front)
  • Address Country Form component (front)
  • Phone Country Form component (front)
  • Make sure using the functions stripSimpleQuotesFromString and its alter-ego

@charlesBochet charlesBochet moved this from 🆕 New to 🔖 Planned in Product development ✅ Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-PR: wip good first issue Good for newcomers scope: back+front Issues requiring full-stack knowledge
Projects
Status: 🔖 Planned
Development

Successfully merging a pull request may close this issue.

7 participants