Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import getFrameDetails from 'sentry/utils/replays/getFrameDetails';
import useActiveReplayTab from 'sentry/utils/replays/hooks/useActiveReplayTab';
import useCrumbHandlers from 'sentry/utils/replays/hooks/useCrumbHandlers';
import type {ReplayFrame} from 'sentry/utils/replays/types';
import type {Color} from 'sentry/utils/theme';

const NODE_SIZES = [8, 12, 16];

Expand Down Expand Up @@ -114,14 +113,14 @@ function Event({
// Sort the frame colors by color priority
// Priority order: red300, yellow300, green300, purple300, gray300
const sortedUniqueColors = uniqueColors.sort(function (x, y) {
const colorOrder: Color[] = [
'red300',
'yellow300',
'green300',
'purple300',
'gray300',
const colorOrder: string[] = [
theme.tokens.graphics.danger,
theme.tokens.graphics.warning,
theme.tokens.graphics.success,
theme.tokens.graphics.accent,
theme.tokens.graphics.muted,
];
function getColorPos(c: Color) {
function getColorPos(c: string) {
return colorOrder.indexOf(c);
}
return getColorPos(x) - getColorPos(y);
Expand Down Expand Up @@ -159,13 +158,13 @@ const getBackgroundGradient = ({
frameCount,
theme,
}: {
colors: Color[];
colors: Array<keyof Theme['tokens']['graphics']>;
frameCount: number;
theme: Theme;
}) => {
const c0 = theme[colors[0]!] ?? colors[0]!;
const c1 = theme[colors[1]!] ?? colors[1]! ?? c0;
const c2 = theme[colors[2]!] ?? colors[2]! ?? c1;
const c0 = theme.tokens.graphics[colors[0]!] ?? colors[0]!;
const c1 = theme.tokens.graphics[colors[1]!] ?? colors[1]! ?? c0;
const c2 = theme.tokens.graphics[colors[2]!] ?? colors[2]! ?? c1;

if (frameCount === 1) {
return `background: ${c0};`;
Expand All @@ -190,7 +189,10 @@ const getBackgroundGradient = ({
);`;
};

const IconNode = styled('button')<{colors: Color[]; frameCount: number}>`
const IconNode = styled('button')<{
colors: Array<keyof Theme['tokens']['graphics']>;
frameCount: number;
}>`
padding: 0;
border: none;
grid-column: 1;
Expand Down
Loading
Loading