-
Notifications
You must be signed in to change notification settings - Fork 222
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
ui: Combine relative and absolute range picker #4777
Conversation
🤖 Meticulous spotted visual differences in 368 of 488 screens tested: view and approve differences detected. Last updated for commit e1c1ecd. This comment will update as new commits are pushed. |
…arca into combine-date-pickers
onRangeSelection, | ||
}: DateTimeRangePickerTextProps): JSX.Element => { | ||
const isRelativeRange = range.from.isRelative(); | ||
const dateString = `${formatDateStringForUI(range.from)} → ${formatDateStringForUI(range.to)}`; |
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.
Maybe we can try something like
parca/ui/packages/shared/components/src/DateTimeRangePicker/utils.ts
Lines 115 to 125 in c56e0c2
getRangeStringForUI(): string { | |
if (this.from.isRelative() && this.to.isRelative() && (this.to as RelativeDate).value === 0) { | |
const from = this.from as RelativeDate; | |
return `Last ${from.value} ${from.unit}${from.value > 1 ? 's' : ''}`; | |
} | |
const formattedFrom = formatDateStringForUI(this.from); | |
const formattedTo = formatDateStringForUI(this.to) | |
.replace(getUtcStringForDate(this.from as AbsoluteDate, 'll'), '') | |
.trim(); | |
return `${formattedFrom} → ${formattedTo}`; | |
} |
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.
yeah this is better, thanks for the suggestion
return ( | ||
<div className="flex flex-col gap-3 items-center text-sm p-4"> | ||
{presetRanges.map(({value, unit, text}) => ( | ||
<Button |
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.
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.
sgtm!
…arca into combine-date-pickers
9ed6b70
to
0b3e32b
Compare
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 a minor comment to fix the width
changes when switching around the tabs, otherwise lgtm!
This PR combines the relative and absolute range pickers to be in a tab switcher so as to make it easier to switch between both range pickers.
Resolves #4748