Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Base impl for toggle buttons
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
  • Loading branch information
adhityamamallan committed Jan 16, 2026
commit dfaa203be6d3b9e6c80630fed6a62c19fda439d9
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { MdOutlineChat } from 'react-icons/md';

import { type ViewToggleTooltipContentConfig } from '../workflow-history-view-toggle-button/workflow-history-view-toggle-button.types';

const workflowHistorySwitchToV1ButtonTooltipContentConfig: ViewToggleTooltipContentConfig =
{
content: [
`The purpose of the new History view is to provide a more compact and
informative overview, including previews, flexible grouped and ungrouped
layouts, deeplinking, and several additional enhancements for
improved navigation and usability.`,
`Please feel free to share any feedback if you encounter anything
that seems suboptimal in the new History view.`,
Comment on lines +8 to +12
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The tooltip content contains excessive leading whitespace. Consider using a template literal without indentation or using array join to maintain clean formatting without extra whitespace.

Copilot uses AI. Check for mistakes.
],
linkButtons: [
{
label: 'Provide feedback',
startEnhancer: MdOutlineChat,
href: 'https://cloud-native.slack.com/archives/C09J2FQ7XU3',
},
],
};

export default workflowHistorySwitchToV1ButtonTooltipContentConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export const styled = {
},
})
),
Heading: createStyled(
'div',
({ $theme }: { $theme: Theme }): StyleObject => ({
display: 'flex',
gap: $theme.sizing.scale600,
...$theme.typography.HeadingXSmall,
})
),
Actions: createStyled(
'div',
({ $theme }: { $theme: Theme }): StyleObject => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { Button } from 'baseui/button';
import { Filter } from 'baseui/icon';
import { StatefulPopover } from 'baseui/popover';
import { SegmentedControl, Segment } from 'baseui/segmented-control';
import { HeadingXSmall } from 'baseui/typography';
import { useInView } from 'react-intersection-observer';

import PageSection from '@/components/page-section/page-section';
import WorkflowHistoryExportJsonButton from '@/views/workflow-history/workflow-history-export-json-button/workflow-history-export-json-button';
import WorkflowHistoryFiltersMenu from '@/views/workflow-history-v2/workflow-history-filters-menu/workflow-history-filters-menu';

import WorkflowHistorySwitchToV1Button from '../workflow-history-switch-to-v1-button/workflow-history-switch-to-v1-button';

import { overrides, styled } from './workflow-history-header.styles';
import { type Props } from './workflow-history-header.types';

Expand Down Expand Up @@ -49,7 +50,10 @@ export default function WorkflowHistoryHeader({
>
<PageSection>
<styled.Header>
<HeadingXSmall>Workflow history</HeadingXSmall>
<styled.Heading>
Workflow history
<WorkflowHistorySwitchToV1Button />
</styled.Heading>
<styled.Actions>
<WorkflowHistoryExportJsonButton {...wfHistoryRequestArgs} />
<SegmentedControl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useContext } from 'react';

import useConfigValue from '@/hooks/use-config-value/use-config-value';
import { WorkflowHistoryContext } from '@/views/workflow-history/workflow-history-context-provider/workflow-history-context-provider';

import workflowHistorySwitchToV1ButtonTooltipContentConfig from '../config/workflow-history-switch-to-v1-button-tooltip-content.config';
import WorkflowHistoryViewToggleButton from '../workflow-history-view-toggle-button/workflow-history-view-toggle-button';

export default function WorkflowHistorySwitchToV1Button() {
const { data: historyPageV2Config } = useConfigValue(
'HISTORY_PAGE_V2_ENABLED'
);

const { setIsWorkflowHistoryV2Enabled } = useContext(WorkflowHistoryContext);

if (historyPageV2Config === 'ENABLED') return null;

return (
<WorkflowHistoryViewToggleButton
kind="secondary"
label="Switch to the legacy History view"
onClick={() => setIsWorkflowHistoryV2Enabled(false)}
tooltipContent={workflowHistorySwitchToV1ButtonTooltipContentConfig}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { type Theme, styled as createStyled } from 'baseui';
import { type ButtonOverrides } from 'baseui/button';
import { type PopoverOverrides } from 'baseui/popover';
import { type StyleObject } from 'styletron-react';

export const styled = {
TooltipContentContainer: createStyled('div', ({ $theme }) => ({
display: 'flex',
flexDirection: 'column',
alignItems: 'stretch',
rowGap: $theme.sizing.scale600,
padding: $theme.sizing.scale600,
})),
TooltipText: createStyled('div', ({ $theme }) => ({
...$theme.typography.ParagraphXSmall,
lineHeight: '16px',
})),
TooltipLinkButtons: createStyled('div', ({ $theme }) => ({
display: 'flex',
flexDirection: 'row',
columnGap: $theme.sizing.scale300,
})),
};

export const overrides = {
buttonPrimary: {
BaseButton: {
style: ({ $theme }: { $theme: Theme }): StyleObject => ({
height: $theme.sizing.scale900,
padding: $theme.sizing.scale300,
color: $theme.colors.contentInversePrimary,
backgroundColor: $theme.colors.backgroundAccent,
':hover': {
backgroundColor: $theme.colors.accent500,
},
':active': {
backgroundColor: $theme.colors.accent500,
},
}),
},
} satisfies ButtonOverrides,
buttonSecondary: {
BaseButton: {
style: ({ $theme }: { $theme: Theme }): StyleObject => ({
height: $theme.sizing.scale900,
padding: $theme.sizing.scale300,
color: $theme.colors.contentAccent,
backgroundColor: $theme.colors.backgroundAccentLight,
':hover': {
backgroundColor: $theme.colors.accent100,
},
':active': {
backgroundColor: $theme.colors.accent100,
},
}),
},
} satisfies ButtonOverrides,
popover: {
Body: {
style: ({ $theme }) => ({
margin: $theme.sizing.scale600,
}),
},
Inner: {
style: ({ $theme }: { $theme: Theme }): StyleObject => ({
backgroundColor: $theme.colors.backgroundPrimary,
maxWidth: '400px',
}),
},
Arrow: {
style: ({ $theme }: { $theme: Theme }): StyleObject => ({
backgroundColor: $theme.colors.backgroundPrimary,
}),
},
} satisfies PopoverOverrides,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { Button } from 'baseui/button';
import { StatefulPopover } from 'baseui/popover';
import Link from 'next/link';
import { MdOutlineInfo } from 'react-icons/md';

import {
overrides,
styled,
} from './workflow-history-view-toggle-button.styles';
import { type Props } from './workflow-history-view-toggle-button.types';

export default function WorkflowHistoryViewToggleButton({
kind,
label,
onClick,
tooltipContent,
}: Props) {
const { content, linkButtons } = tooltipContent;

return (
<StatefulPopover
content={() => (
<styled.TooltipContentContainer>
{content.map((paragraph, index) => (
<styled.TooltipText key={`tooltip_paragraph_${index}`}>
{paragraph}
</styled.TooltipText>
))}
{linkButtons && linkButtons.length > 0 && (
<styled.TooltipLinkButtons>
{linkButtons.map(({ label, href, startEnhancer }) => (
<Button
key={label}
size="mini"
kind="secondary"
$as={Link}
href={href}
target="_blank"
rel="noreferrer"
startEnhancer={startEnhancer}
>
{label}
</Button>
))}
</styled.TooltipLinkButtons>
)}
</styled.TooltipContentContainer>
)}
placement="auto"
accessibilityType="tooltip"
triggerType="hover"
showArrow
popoverMargin={4}
overrides={overrides.popover}
>
<div>
<Button
size="compact"
onClick={onClick}
overrides={
kind === 'primary'
? overrides.buttonPrimary
: overrides.buttonSecondary
}
endEnhancer={<MdOutlineInfo size={16} />}
>
{label}
</Button>
</div>
</StatefulPopover>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { type ButtonProps } from 'baseui/button';

export type ViewToggleTooltipContentConfig = {
content: Array<string>;
linkButtons?: Array<{
label: string;
href: string;
startEnhancer: ButtonProps['startEnhancer'];
}>;
};

export type Props = {
kind: 'primary' | 'secondary';
label: string;
onClick: () => void;
tooltipContent: ViewToggleTooltipContentConfig;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { type ViewToggleTooltipContentConfig } from '@/views/workflow-history-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button.types';

const workflowHistorySwitchToV2ButtonTooltipContentConfig: ViewToggleTooltipContentConfig =
{
content: [
`The new Workflow History UI provides a more compact and informative
overview of your workflow's history, with several enhancements for
improved navigation and usability.`,
`Click to try it out!`,
],
};

export default workflowHistorySwitchToV2ButtonTooltipContentConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export const styled = {
},
})
),
Heading: createStyled(
'div',
({ $theme }: { $theme: Theme }): StyleObject => ({
display: 'flex',
gap: $theme.sizing.scale600,
...$theme.typography.HeadingXSmall,
})
),
Actions: createStyled(
'div',
({ $theme }: { $theme: Theme }): StyleObject => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect, useState } from 'react';

import { Button } from 'baseui/button';
import { HeadingXSmall } from 'baseui/typography';
import {
MdOutlineViewStream,
MdOutlineViewAgenda,
Expand All @@ -16,6 +15,7 @@ import PageSection from '@/components/page-section/page-section';
import workflowHistoryFiltersConfig from '../config/workflow-history-filters.config';
import WorkflowHistoryExpandAllEventsButton from '../workflow-history-expand-all-events-button/workflow-history-expand-all-events-button';
import WorkflowHistoryExportJsonButton from '../workflow-history-export-json-button/workflow-history-export-json-button';
import WorkflowHistorySwitchToV2Button from '../workflow-history-switch-to-v2-button/workflow-history-switch-to-v2-button';
import WorkflowHistoryTimelineChart from '../workflow-history-timeline-chart/workflow-history-timeline-chart';

import { styled, overrides } from './workflow-history-header.styles';
Expand Down Expand Up @@ -67,7 +67,10 @@ export default function WorkflowHistoryHeader({
>
<PageSection>
<styled.Header>
<HeadingXSmall>Workflow history</HeadingXSmall>
<styled.Heading>
Workflow history
<WorkflowHistorySwitchToV2Button />
</styled.Heading>
<styled.Actions>
<WorkflowHistoryExpandAllEventsButton
isExpandAllEvents={isExpandAllEvents}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useContext } from 'react';

import useConfigValue from '@/hooks/use-config-value/use-config-value';
import WorkflowHistoryViewToggleButton from '@/views/workflow-history-v2/workflow-history-view-toggle-button/workflow-history-view-toggle-button';

import workflowHistorySwitchToV2ButtonTooltipContentConfig from '../config/workflow-history-switch-to-v2-button-tooltip-content.config';
import { WorkflowHistoryContext } from '../workflow-history-context-provider/workflow-history-context-provider';

export default function WorkflowHistorySwitchToV2Button() {
const { data: historyPageV2Config } = useConfigValue(
'HISTORY_PAGE_V2_ENABLED'
);

const { setIsWorkflowHistoryV2Enabled } = useContext(WorkflowHistoryContext);

if (historyPageV2Config === 'DISABLED') return null;

return (
<WorkflowHistoryViewToggleButton
kind="primary"
label="Switch to the new History view"
onClick={() => setIsWorkflowHistoryV2Enabled(true)}
tooltipContent={workflowHistorySwitchToV2ButtonTooltipContentConfig}
/>
);
}