Skip to content

fix: platform booker icons and address property for type inPerson #15207

Merged
Ryukemeister merged 6 commits intomainfrom
fix-platform-booker-icons-inperson
May 27, 2024
Merged

fix: platform booker icons and address property for type inPerson #15207
Ryukemeister merged 6 commits intomainfrom
fix-platform-booker-icons-inperson

Conversation

@Ryukemeister
Copy link
Copy Markdown
Contributor

What does this PR do?

  • Fixes CAL-3774

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • I have added a Docs issue here if this PR makes changes that would require a documentation change
  • I have added or modified automated tests that prove my fix is effective or that my feature works (PRs might be rejected if logical changes are not properly tested)

How should this be tested?

Running the webapp and the examples app that we have in packages/platform/examples/base should be good enough

@linear
Copy link
Copy Markdown

linear Bot commented May 27, 2024

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2024

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@keithwillcode keithwillcode added core area: core, team members only platform Anything related to our platform plan labels May 27, 2024
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2024

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

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview May 27, 2024 10:43am
cal ⬜️ Ignored (Inspect) Visit Preview May 27, 2024 10:43am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview May 27, 2024 10:43am

@graphite-app graphite-app Bot requested a review from a team May 27, 2024 07:29
@dosubot dosubot Bot added bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working labels May 27, 2024
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented May 27, 2024

Graphite Automations

"Add platform team as reviewer" took an action on this PR • (05/27/24)

1 reviewer was added to this PR based on Keith Williams's automation.

return {
// XYZ: is considered a namespace in i18next https://www.i18next.com/principles/namespaces and thus it get's cleaned up.
// Beacause there can be a URL in here, simply don't translate it if it starts with http: or https:. This would allow us to keep supporting namespaces if we plan to use them
label: locationString.search(/^https?:/) !== -1 ? locationString : t(locationString),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This conditional was the reason why the inPerson address was not being displayed. The logic above states that we only check for URL's above and keep them as it is in the locationString variable and translate all the other values of locationString variable, hence that check will only work for the type: link. So if we have a location value like { type: "address", address: "King Street 1234, London" } then our locationString value becomes King Street 1234, London and according to the above since this location doesn't contain https: it will try to translate it which will result in a blank string being returned since we don't have any value for this inside translations common.json file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The getTranslatedLocation function that I'm using now to get the correctly translated location is already being used in the tooltip in one of the Booker components which can be found under the file packages/features/bookings/components/event-meta/AvailableEventLocations.tsx line 59

@Ryukemeister Ryukemeister changed the title fix: platform booker icons for type inPerson and address fix: platform booker icons and property address for type inPerson May 27, 2024
@Ryukemeister Ryukemeister changed the title fix: platform booker icons and property address for type inPerson fix: platform booker icons and address property for type inPerson May 27, 2024
supalarry
supalarry previously approved these changes May 27, 2024
Copy link
Copy Markdown
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

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

Super great work Rajiv and super happy that you found what was going wrong - respect!

Tested locally and it works, besides small comment below I approve this PR.

After merge: need to update stonealgo in this thread that they can now make stuff work without a workaround.

// XYZ: is considered a namespace in i18next https://www.i18next.com/principles/namespaces and thus it get's cleaned up.
// Beacause there can be a URL in here, simply don't translate it if it starts with http: or https:. This would allow us to keep supporting namespaces if we plan to use them
label: locationString.search(/^https?:/) !== -1 ? locationString : t(locationString),
label: translatedLocation || "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we have:

label: translatedLocation || locationString

Because if translation returns null, then it's better we display original one to at least know what is going on, because now simply rendering empty "" makes it easier to understand where did the original "locationString".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True it's better to return the original locationString value to understand whats going on, will fix this.

@Ryukemeister Ryukemeister enabled auto-merge May 27, 2024 10:43
@Ryukemeister Ryukemeister added this pull request to the merge queue May 27, 2024
Merged via the queue into main with commit bddc235 May 27, 2024
@Ryukemeister Ryukemeister deleted the fix-platform-booker-icons-inperson branch May 27, 2024 11:27
p6l-richard pushed a commit to p6l-richard/cal.com-fork that referenced this pull request Jul 22, 2024
…lcom#15207)

* fix: platform booker icons

* fix label not being shown for address

* fix type check

* PR feedback

---------

Co-authored-by: Morgan Vernay <morgan@cal.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working core area: core, team members only platform Anything related to our platform plan

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants