-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
chore: date filter UI fixes #10673
chore: date filter UI fixes #10673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this. Here's what I'm seeing:
- The date range select component doesn't show the active border color when focused. The border should show active blue when the field is focused. It looks like this might be affecting other selects in this context in your screenshots.
- It looks like item 4 from Date picker workflow component improvements and alignments #10640 isn't included. The main change is to show the current date in the first month position, not the second. Since the user will be selecting past dates, it'd be easier to show more past dates, than future dates in the calendar.
For the Chart Filter, the button label still has the icon, which could be removed (see screenshots)
The icons used in the chart type select are more critical. I don't think those should be removed. They reinforce chart types, layouts, etc.
Done, the reason is that this is an antd popup, but it appears only here:
Sorry, I think I didn't explain myself correctly. Since that dropdown is from antd, there's limited configuration options, and item #4 on #10640 is not achievable unless we rewrite the whole calendar picker ourselves. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really like to find a way to optimize the calendar picker for selecting dates in the past, but don't want to block this improvement based on that alone.
How about we merge these and I release the new date filter component, and then I open another PR to improve the calendar picker? |
Yup I'm a +1 on shipping it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments (plus the tests, which I see you're fixing)
|
||
.ant-picker-range-arrow { | ||
border-top: 1px solid var(--primary); | ||
border-right: 1px solid var(--primary); | ||
} | ||
.ant-picker-range-wrapper { | ||
border: 1px solid var(--primary); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These styles will apply to all such classes everywhere, not just this date picker. This may have some effect outside of just this component, I'm not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically adding a blue border to the antd date calendar popup, which makes it style-coherent with our Lemon popups.
The next step would be to remove that component and create a LemonCalendarPicker, which I'm going to do after.
Is there a better place where to move these classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just sanity checking:
Will it show when the experiment is off? Do we use some other date pickers elsewhere in the app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only in the DatePicker because the class is imported locally.
@@ -271,23 +271,23 @@ describe('dateFilterToText()', () => { | |||
const from = dayjs('2018-04-04T16:00:00.000Z') | |||
const to = dayjs('2018-04-09T15:05:00.000Z') | |||
|
|||
expect(dateFilterToText(from, to, 'custom', dateMapping, true)).toEqual('4 Apr 2018 - 9 Apr 2018') | |||
expect(dateFilterToText(from, to, 'custom', dateMapping, true)).toEqual('April 4 - April 9, 2018') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the year changes (e.g. april 4 2016 - april 9 2018), will it show both years?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does and I added a test
const DATE_FORMAT = 'D MMM YYYY' | ||
const DATE_FORMAT = 'MMMM D, YYYY' | ||
const DATE_FORMAT_WITHOUT_YEAR = 'MMMM D' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this change the dates? Just the date picker, or other random places in the app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked. Just in the Date Filter for now, unless you use dateFilterToText
with isFormatted=true
, which is not used anywhere else.
Co-authored-by: Marius Andra <marius.andra@gmail.com>
Problem
Resolves #10640
Changes
Changes that couldn't be implemented:
Why: the Calendar Picker is an antd component with limited customization, we would have to rewrite entirely the picker to enable these (out of scope for this PR)
How did you test this code?
Locally, and cypress