hasadna / open-bus-map-search

open-bus-map-search
https://open-bus-map-search.hasadna.org.il/dashboard
MIT License
48 stars 85 forks source link

fix: DateSelector selector validation message issues #823

Open YuvalMasada opened 1 week ago

YuvalMasada commented 1 week ago

@NoamGaash - This time at the right direction I've added 2 short fixes.

  1. For wrong validation message I added a different message for the specific case. The message will pop for min/max, but I think that the max message will never appear( so maybe it would be better to delete it? not 100% sure ).
  2. To make the message re-render when language changed I've extend the useMemo dependency array with t function that should be reassign as the DateSelector component been re-rendered.
github-actions[bot] commented 1 week ago

Preview: https://s3.amazonaws.com/noam-gaash.co.il/9701321637/open-bus/32/index.html Preview Storybook: https://s3.amazonaws.com/noam-gaash.co.il/9701321637/open-bus/32/storybook/index.html

YuvalMasada commented 1 week ago

@NoamGaash At first I did something like your suggestion, but then typescript got mad at me. It doesn't like that getErrorMessage can return undefined( the t function we got from the useTranslation hook). I'll be happy to understand why typescript complain about it.

NoamGaash commented 1 week ago

@YuvalMasada I'll try