Skip to content

Commit

Permalink
Tooltip left alignment (#97237)
Browse files Browse the repository at this point in the history
* Tooltip left alignment

* Remove today - rarely enough data
  • Loading branch information
j6ll authored Dec 10, 2024
1 parent 2c6ebb4 commit bf8b834
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export enum ChartSourceOptions {

// Define the available date range options
enum ChartSourceDateRanges {
TODAY = 'today',
YESTERDAY = 'yesterday',
LAST_7_DAYS = 'last_7_days',
LAST_14_DAYS = 'last_14_days',
Expand All @@ -119,7 +118,6 @@ enum ChartSourceDateRanges {

// User facing strings for date ranges
const ChartSourceDateRangeLabels = {
[ ChartSourceDateRanges.TODAY ]: __( 'Today' ),
[ ChartSourceDateRanges.YESTERDAY ]: __( 'Yesterday' ),
[ ChartSourceDateRanges.LAST_7_DAYS ]: __( 'Last 7 days' ),
[ ChartSourceDateRanges.LAST_14_DAYS ]: __( 'Last 14 days' ),
Expand Down Expand Up @@ -321,8 +319,7 @@ export default function CampaignItemDetails( props: Props ) {
const updateChartParams = ( newDateRange: ChartSourceDateRanges ) => {
// These shorter time frames can show hourly data, we can show up to 30 days of hourly data (max days stored in Druid)
const newResolution =
[ ChartSourceDateRanges.TODAY, ChartSourceDateRanges.YESTERDAY ].includes( newDateRange ) ||
activeDays < 3
newDateRange === ChartSourceDateRanges.YESTERDAY || activeDays < 3
? ChartResolution.Hour
: ChartResolution.Day;

Expand Down Expand Up @@ -453,16 +450,11 @@ export default function CampaignItemDetails( props: Props ) {
const chartControls = [];

// Some controls are conditional, depending on how long the campaign has been active, or if the campaign is in the past
// It would be pointless showing "today" to a finished campaign, or 30 days to a 7-day campaign
// It would be pointless showing "yesterday" to a finished campaign, or 30 days to a 7-day campaign
const conditionalControls = [
{
condition: ! campaignIsFinished,
controls: [
{
onClick: () => updateChartParams( ChartSourceDateRanges.TODAY ),
title: ChartSourceDateRangeLabels[ ChartSourceDateRanges.TODAY ],
isDisabled: selectedDateRange === ChartSourceDateRanges.TODAY,
},
{
onClick: () => updateChartParams( ChartSourceDateRanges.YESTERDAY ),
title: ChartSourceDateRangeLabels[ ChartSourceDateRanges.YESTERDAY ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,6 @@ $break-huge-collapsed-menu: $break-huge - 222px;
padding: 8px 10px;
border-radius: 4px;
display: none;
text-align: center;
min-width: 60px;
}

Expand Down

0 comments on commit bf8b834

Please sign in to comment.