changedTransactions.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. import {Fragment, useCallback, useState} from 'react';
  2. import styled from '@emotion/styled';
  3. import type {Location} from 'history';
  4. import type {Client} from 'sentry/api';
  5. import Feature from 'sentry/components/acl/feature';
  6. import {HeaderTitleLegend} from 'sentry/components/charts/styles';
  7. import Count from 'sentry/components/count';
  8. import {DropdownMenu} from 'sentry/components/dropdownMenu';
  9. import Duration from 'sentry/components/duration';
  10. import EmptyStateWarning from 'sentry/components/emptyStateWarning';
  11. import {RadioLineItem} from 'sentry/components/forms/controls/radioGroup';
  12. import IdBadge from 'sentry/components/idBadge';
  13. import Link from 'sentry/components/links/link';
  14. import LoadingIndicator from 'sentry/components/loadingIndicator';
  15. import type {CursorHandler} from 'sentry/components/pagination';
  16. import Pagination from 'sentry/components/pagination';
  17. import Panel from 'sentry/components/panels/panel';
  18. import QuestionTooltip from 'sentry/components/questionTooltip';
  19. import Radio from 'sentry/components/radio';
  20. import {Tooltip} from 'sentry/components/tooltip';
  21. import {IconArrow, IconEllipsis} from 'sentry/icons';
  22. import {t} from 'sentry/locale';
  23. import {space} from 'sentry/styles/space';
  24. import type {Organization} from 'sentry/types/organization';
  25. import type {AvatarProject, Project} from 'sentry/types/project';
  26. import {trackAnalytics} from 'sentry/utils/analytics';
  27. import {browserHistory} from 'sentry/utils/browserHistory';
  28. import getDuration from 'sentry/utils/duration/getDuration';
  29. import {formatPercentage} from 'sentry/utils/number/formatPercentage';
  30. import {useMetricsCardinalityContext} from 'sentry/utils/performance/contexts/metricsCardinality';
  31. import TrendsDiscoverQuery from 'sentry/utils/performance/trends/trendsDiscoverQuery';
  32. import {decodeScalar} from 'sentry/utils/queryString';
  33. import {MutableSearch} from 'sentry/utils/tokenizeSearch';
  34. import useApi from 'sentry/utils/useApi';
  35. import withOrganization from 'sentry/utils/withOrganization';
  36. import withProjects from 'sentry/utils/withProjects';
  37. import {
  38. DisplayModes,
  39. transactionSummaryRouteWithQuery,
  40. } from 'sentry/views/performance/transactionSummary/utils';
  41. import {PerformanceChangeExplorer} from 'sentry/views/performance/trends/changeExplorer';
  42. import getSelectedQueryKey from 'sentry/views/performance/trends/utils/getSelectedQueryKey';
  43. import {getSelectedTransaction} from 'sentry/views/performance/utils/getSelectedTransaction';
  44. import Chart from './chart';
  45. import type {
  46. NormalizedTrendsTransaction,
  47. TrendFunctionField,
  48. TrendParameter,
  49. TrendParameterColumn,
  50. TrendsStats,
  51. TrendView,
  52. } from './types';
  53. import {TrendChangeType} from './types';
  54. import {
  55. getCurrentTrendFunction,
  56. getCurrentTrendParameter,
  57. getTrendProjectId,
  58. modifyTrendView,
  59. normalizeTrends,
  60. transformDeltaSpread,
  61. transformValueDelta,
  62. trendCursorNames,
  63. trendToColor,
  64. } from './utils';
  65. type Props = {
  66. location: Location;
  67. organization: Organization;
  68. projects: Project[];
  69. setError: (msg: string | undefined) => void;
  70. trendChangeType: TrendChangeType;
  71. trendView: TrendView;
  72. previousTrendColumn?: TrendParameterColumn;
  73. previousTrendFunction?: TrendFunctionField;
  74. withBreakpoint?: boolean;
  75. };
  76. type TrendsCursorQuery = {
  77. improvedCursor?: string;
  78. regressionCursor?: string;
  79. };
  80. const makeTrendsCursorHandler =
  81. (trendChangeType: TrendChangeType): CursorHandler =>
  82. (cursor, path, query) => {
  83. const cursorQuery = {} as TrendsCursorQuery;
  84. if (trendChangeType === TrendChangeType.IMPROVED) {
  85. cursorQuery.improvedCursor = cursor;
  86. } else if (trendChangeType === TrendChangeType.REGRESSION) {
  87. cursorQuery.regressionCursor = cursor;
  88. }
  89. const selectedQueryKey = getSelectedQueryKey(trendChangeType);
  90. delete query[selectedQueryKey];
  91. browserHistory.push({
  92. pathname: path,
  93. query: {...query, ...cursorQuery},
  94. });
  95. };
  96. function getChartTitle(trendChangeType: TrendChangeType): string {
  97. switch (trendChangeType) {
  98. case TrendChangeType.IMPROVED:
  99. return t('Most Improved Transactions');
  100. case TrendChangeType.REGRESSION:
  101. return t('Most Regressed Transactions');
  102. default:
  103. throw new Error('No trend type passed');
  104. }
  105. }
  106. function handleChangeSelected(
  107. location: Location,
  108. organization: Organization,
  109. trendChangeType: TrendChangeType
  110. ) {
  111. return function updateSelected(transaction?: NormalizedTrendsTransaction) {
  112. const selectedQueryKey = getSelectedQueryKey(trendChangeType);
  113. const query = {
  114. ...location.query,
  115. };
  116. if (!transaction) {
  117. delete query[selectedQueryKey];
  118. } else {
  119. query[selectedQueryKey] = transaction
  120. ? `${transaction.transaction}-${transaction.project}`
  121. : undefined;
  122. }
  123. browserHistory.push({
  124. pathname: location.pathname,
  125. query,
  126. });
  127. trackAnalytics('performance_views.trends.widget_interaction', {
  128. organization,
  129. widget_type: trendChangeType,
  130. });
  131. };
  132. }
  133. enum FilterSymbols {
  134. GREATER_THAN_EQUALS = '>=',
  135. LESS_THAN_EQUALS = '<=',
  136. }
  137. function handleFilterTransaction(location: Location, transaction: string) {
  138. const queryString = decodeScalar(location.query.query);
  139. const conditions = new MutableSearch(queryString ?? '');
  140. conditions.addFilterValues('!transaction', [transaction]);
  141. const query = conditions.formatString();
  142. browserHistory.push({
  143. pathname: location.pathname,
  144. query: {
  145. ...location.query,
  146. query: String(query).trim(),
  147. },
  148. });
  149. }
  150. function handleFilterDuration(
  151. location: Location,
  152. organization: Organization,
  153. value: number,
  154. symbol: FilterSymbols,
  155. trendChangeType: TrendChangeType,
  156. projects: Project[],
  157. projectIds: Readonly<number[]>
  158. ) {
  159. const durationTag = getCurrentTrendParameter(location, projects, projectIds).column;
  160. const queryString = decodeScalar(location.query.query);
  161. const conditions = new MutableSearch(queryString ?? '');
  162. const existingValues = conditions.getFilterValues(durationTag);
  163. const alternateSymbol = symbol === FilterSymbols.GREATER_THAN_EQUALS ? '>' : '<';
  164. if (existingValues) {
  165. existingValues.forEach(existingValue => {
  166. if (existingValue.startsWith(symbol) || existingValue.startsWith(alternateSymbol)) {
  167. conditions.removeFilterValue(durationTag, existingValue);
  168. }
  169. });
  170. }
  171. conditions.addFilterValues(durationTag, [`${symbol}${value}`]);
  172. const query = conditions.formatString();
  173. browserHistory.push({
  174. pathname: location.pathname,
  175. query: {
  176. ...location.query,
  177. query: String(query).trim(),
  178. },
  179. });
  180. trackAnalytics('performance_views.trends.change_duration', {
  181. organization,
  182. widget_type: getChartTitle(trendChangeType),
  183. value: `${symbol}${value}`,
  184. });
  185. }
  186. function ChangedTransactions(props: Props) {
  187. const {
  188. location,
  189. trendChangeType,
  190. previousTrendFunction,
  191. previousTrendColumn,
  192. organization,
  193. projects,
  194. setError,
  195. withBreakpoint,
  196. } = props;
  197. const api = useApi();
  198. const {isLoading: isCardinalityCheckLoading, outcome} = useMetricsCardinalityContext();
  199. const canUseMetricsTrends = withBreakpoint && !outcome?.forceTransactionsOnly;
  200. const trendView = props.trendView.clone();
  201. const chartTitle = getChartTitle(trendChangeType);
  202. modifyTrendView(trendView, location, trendChangeType, projects, canUseMetricsTrends);
  203. const onCursor = makeTrendsCursorHandler(trendChangeType);
  204. const cursor = decodeScalar(location.query[trendCursorNames[trendChangeType]]);
  205. const paginationAnalyticsEvent = (direction: string) => {
  206. trackAnalytics('performance_views.trends.widget_pagination', {
  207. organization,
  208. direction,
  209. widget_type: getChartTitle(trendChangeType),
  210. });
  211. };
  212. return (
  213. <TrendsDiscoverQuery
  214. eventView={trendView}
  215. orgSlug={organization.slug}
  216. location={location}
  217. trendChangeType={trendChangeType}
  218. cursor={cursor}
  219. limit={5}
  220. setError={error => setError(error?.message)}
  221. withBreakpoint={canUseMetricsTrends}
  222. >
  223. {({isLoading, trendsData, pageLinks}) => {
  224. const trendFunction = getCurrentTrendFunction(location);
  225. const trendParameter = getCurrentTrendParameter(
  226. location,
  227. projects,
  228. trendView.project
  229. );
  230. const events = normalizeTrends(trendsData?.events?.data || []);
  231. const selectedTransaction = getSelectedTransaction(
  232. location,
  233. trendChangeType,
  234. events
  235. );
  236. const statsData = trendsData?.stats || {};
  237. const transactionsList = events?.slice ? events.slice(0, 5) : [];
  238. const currentTrendFunction =
  239. isLoading && previousTrendFunction
  240. ? previousTrendFunction
  241. : trendFunction.field;
  242. const currentTrendColumn =
  243. isLoading && previousTrendColumn ? previousTrendColumn : trendParameter.column;
  244. const titleTooltipContent = t(
  245. 'This compares the baseline (%s) of the past with the present.',
  246. trendFunction.legendLabel
  247. );
  248. return (
  249. <TransactionsListContainer data-test-id="changed-transactions">
  250. <TrendsTransactionPanel>
  251. <StyledHeaderTitleLegend>
  252. {chartTitle}
  253. <QuestionTooltip size="sm" position="top" title={titleTooltipContent} />
  254. </StyledHeaderTitleLegend>
  255. {isLoading || isCardinalityCheckLoading ? (
  256. <LoadingIndicator
  257. style={{
  258. margin: '237px auto',
  259. }}
  260. />
  261. ) : (
  262. <Fragment>
  263. {transactionsList.length ? (
  264. <Fragment>
  265. <ChartContainer>
  266. <Chart
  267. statsData={statsData}
  268. query={trendView.query}
  269. project={trendView.project}
  270. environment={trendView.environment}
  271. start={trendView.start}
  272. end={trendView.end}
  273. statsPeriod={trendView.statsPeriod}
  274. transaction={selectedTransaction}
  275. isLoading={isLoading}
  276. {...props}
  277. />
  278. </ChartContainer>
  279. {transactionsList.map((transaction, index) => (
  280. <TrendsListItem
  281. api={api}
  282. currentTrendFunction={currentTrendFunction}
  283. currentTrendColumn={currentTrendColumn}
  284. trendView={trendView}
  285. organization={organization}
  286. transaction={transaction}
  287. key={transaction.transaction}
  288. index={index}
  289. trendChangeType={trendChangeType}
  290. transactions={transactionsList}
  291. location={location}
  292. projects={projects}
  293. statsData={statsData}
  294. handleSelectTransaction={handleChangeSelected(
  295. location,
  296. organization,
  297. trendChangeType
  298. )}
  299. isLoading={isLoading}
  300. trendParameter={trendParameter}
  301. />
  302. ))}
  303. </Fragment>
  304. ) : (
  305. <StyledEmptyStateWarning small>
  306. {t('No results')}
  307. </StyledEmptyStateWarning>
  308. )}
  309. </Fragment>
  310. )}
  311. </TrendsTransactionPanel>
  312. <Pagination
  313. pageLinks={pageLinks}
  314. onCursor={onCursor}
  315. paginationAnalyticsEvent={paginationAnalyticsEvent}
  316. />
  317. </TransactionsListContainer>
  318. );
  319. }}
  320. </TrendsDiscoverQuery>
  321. );
  322. }
  323. type TrendsListItemProps = {
  324. api: Client;
  325. currentTrendColumn: string;
  326. currentTrendFunction: string;
  327. handleSelectTransaction: (transaction: NormalizedTrendsTransaction) => void;
  328. index: number;
  329. isLoading: boolean;
  330. location: Location;
  331. organization: Organization;
  332. projects: Project[];
  333. statsData: TrendsStats;
  334. transaction: NormalizedTrendsTransaction;
  335. transactions: NormalizedTrendsTransaction[];
  336. trendChangeType: TrendChangeType;
  337. trendParameter: TrendParameter;
  338. trendView: TrendView;
  339. };
  340. function TrendsListItem(props: TrendsListItemProps) {
  341. const {
  342. transaction,
  343. transactions,
  344. trendChangeType,
  345. currentTrendFunction,
  346. currentTrendColumn,
  347. index,
  348. location,
  349. organization,
  350. projects,
  351. handleSelectTransaction,
  352. trendView,
  353. statsData,
  354. isLoading,
  355. trendParameter,
  356. } = props;
  357. const color = trendToColor[trendChangeType].default;
  358. const [openedTransaction, setOpenedTransaction] = useState<null | string>(null);
  359. const selectedTransaction = getSelectedTransaction(
  360. location,
  361. trendChangeType,
  362. transactions
  363. );
  364. const isSelected = selectedTransaction === transaction;
  365. const project = projects.find(
  366. ({slug}) => slug === transaction.project
  367. ) as AvatarProject;
  368. const currentPeriodValue = transaction.aggregate_range_2;
  369. const previousPeriodValue = transaction.aggregate_range_1;
  370. const absolutePercentChange = formatPercentage(
  371. Math.abs(transaction.trend_percentage - 1),
  372. 0
  373. );
  374. const previousDuration = getDuration(
  375. previousPeriodValue / 1000,
  376. previousPeriodValue < 1000 && previousPeriodValue > 10 ? 0 : 2
  377. );
  378. const currentDuration = getDuration(
  379. currentPeriodValue / 1000,
  380. currentPeriodValue < 1000 && currentPeriodValue > 10 ? 0 : 2
  381. );
  382. const percentChangeExplanation = t(
  383. 'Over this period, the %s for %s has %s %s from %s to %s',
  384. currentTrendFunction,
  385. currentTrendColumn,
  386. trendChangeType === TrendChangeType.IMPROVED ? t('decreased') : t('increased'),
  387. absolutePercentChange,
  388. previousDuration,
  389. currentDuration
  390. );
  391. const longestPeriodValue =
  392. trendChangeType === TrendChangeType.IMPROVED
  393. ? previousPeriodValue
  394. : currentPeriodValue;
  395. const longestDuration =
  396. trendChangeType === TrendChangeType.IMPROVED ? previousDuration : currentDuration;
  397. return (
  398. <Fragment>
  399. <ListItemContainer data-test-id={'trends-list-item-' + trendChangeType}>
  400. <ItemRadioContainer color={color}>
  401. {transaction.count_range_1 && transaction.count_range_2 ? (
  402. <Tooltip
  403. title={
  404. <TooltipContent>
  405. <span>{t('Total Events')}</span>
  406. <span>
  407. <Count value={transaction.count_range_1} />
  408. <StyledIconArrow direction="right" size="xs" />
  409. <Count value={transaction.count_range_2} />
  410. </span>
  411. </TooltipContent>
  412. }
  413. >
  414. <RadioLineItem index={index} role="radio">
  415. <Radio
  416. checked={isSelected}
  417. onChange={() => handleSelectTransaction(transaction)}
  418. />
  419. </RadioLineItem>
  420. </Tooltip>
  421. ) : (
  422. <RadioLineItem index={index} role="radio">
  423. <Radio
  424. checked={isSelected}
  425. onChange={() => handleSelectTransaction(transaction)}
  426. />
  427. </RadioLineItem>
  428. )}
  429. </ItemRadioContainer>
  430. <TransactionSummaryLink {...props} onItemClicked={setOpenedTransaction} />
  431. <ItemTransactionPercentage>
  432. <Tooltip title={percentChangeExplanation}>
  433. <Fragment>
  434. {trendChangeType === TrendChangeType.REGRESSION ? '+' : ''}
  435. {formatPercentage(transaction.trend_percentage - 1, 0)}
  436. </Fragment>
  437. </Tooltip>
  438. </ItemTransactionPercentage>
  439. <DropdownMenu
  440. triggerProps={{
  441. size: 'xs',
  442. icon: <IconEllipsis />,
  443. 'aria-label': t('Actions'),
  444. showChevron: false,
  445. }}
  446. items={[
  447. ...(organization.features.includes('performance-new-trends')
  448. ? []
  449. : [
  450. {
  451. key: 'shortestDuration',
  452. label: t('Show \u2264 %s', longestDuration),
  453. onAction: () =>
  454. handleFilterDuration(
  455. location,
  456. organization,
  457. longestPeriodValue,
  458. FilterSymbols.LESS_THAN_EQUALS,
  459. trendChangeType,
  460. projects,
  461. trendView.project
  462. ),
  463. },
  464. {
  465. key: 'longestDuration',
  466. label: t('Show \u2265 %s', longestDuration),
  467. onAction: () =>
  468. handleFilterDuration(
  469. location,
  470. organization,
  471. longestPeriodValue,
  472. FilterSymbols.GREATER_THAN_EQUALS,
  473. trendChangeType,
  474. projects,
  475. trendView.project
  476. ),
  477. },
  478. ]),
  479. {
  480. key: 'hide',
  481. label: t('Hide from list'),
  482. onAction: () => handleFilterTransaction(location, transaction.transaction),
  483. },
  484. ]}
  485. position="bottom-end"
  486. />
  487. <ItemTransactionDurationChange>
  488. {project && (
  489. <Tooltip title={transaction.project}>
  490. <IdBadge avatarSize={16} project={project} hideName />
  491. </Tooltip>
  492. )}
  493. <CompareDurations {...props} />
  494. </ItemTransactionDurationChange>
  495. <ItemTransactionStatus color={color}>
  496. <ValueDelta {...props} />
  497. </ItemTransactionStatus>
  498. </ListItemContainer>
  499. <Feature features="performance-change-explorer">
  500. <PerformanceChangeExplorer
  501. collapsed={openedTransaction === null}
  502. onClose={() => setOpenedTransaction(null)}
  503. transaction={transaction}
  504. trendChangeType={trendChangeType}
  505. trendFunction={currentTrendFunction}
  506. trendView={trendView}
  507. statsData={statsData}
  508. isLoading={isLoading}
  509. organization={organization}
  510. projects={projects}
  511. trendParameter={trendParameter}
  512. location={location}
  513. />
  514. </Feature>
  515. </Fragment>
  516. );
  517. }
  518. export function CompareDurations({
  519. transaction,
  520. }: {
  521. transaction: TrendsListItemProps['transaction'];
  522. }) {
  523. const {fromSeconds, toSeconds, showDigits} = transformDeltaSpread(
  524. transaction.aggregate_range_1,
  525. transaction.aggregate_range_2
  526. );
  527. return (
  528. <DurationChange>
  529. <Duration seconds={fromSeconds} fixedDigits={showDigits ? 1 : 0} abbreviation />
  530. <StyledIconArrow direction="right" size="xs" />
  531. <Duration seconds={toSeconds} fixedDigits={showDigits ? 1 : 0} abbreviation />
  532. </DurationChange>
  533. );
  534. }
  535. function ValueDelta({transaction, trendChangeType}: TrendsListItemProps) {
  536. const {seconds, fixedDigits, changeLabel} = transformValueDelta(
  537. transaction.trend_difference,
  538. trendChangeType
  539. );
  540. return (
  541. <span>
  542. <Duration seconds={seconds} fixedDigits={fixedDigits} abbreviation /> {changeLabel}
  543. </span>
  544. );
  545. }
  546. type TransactionSummaryLinkProps = TrendsListItemProps & {
  547. onItemClicked: React.Dispatch<React.SetStateAction<null | string>>;
  548. };
  549. function TransactionSummaryLink(props: TransactionSummaryLinkProps) {
  550. const {
  551. organization,
  552. trendView: eventView,
  553. transaction,
  554. projects,
  555. location,
  556. currentTrendFunction,
  557. onItemClicked: onTransactionSelection,
  558. } = props;
  559. const summaryView = eventView.clone();
  560. const projectID = getTrendProjectId(transaction, projects);
  561. const target = transactionSummaryRouteWithQuery({
  562. orgSlug: organization.slug,
  563. transaction: String(transaction.transaction),
  564. query: summaryView.generateQueryStringObject(),
  565. projectID,
  566. display: DisplayModes.TREND,
  567. trendFunction: currentTrendFunction,
  568. additionalQuery: {
  569. trendParameter: location.query.trendParameter?.toString(),
  570. },
  571. });
  572. const handleClick = useCallback<React.MouseEventHandler>(
  573. event => {
  574. event.preventDefault();
  575. onTransactionSelection(transaction.transaction);
  576. trackAnalytics('performance_views.performance_change_explorer.open', {
  577. organization,
  578. transaction: transaction.transaction,
  579. });
  580. },
  581. [onTransactionSelection, transaction.transaction, organization]
  582. );
  583. if (organization.features.includes('performance-change-explorer')) {
  584. return (
  585. <ItemTransactionName
  586. to={location}
  587. data-test-id="item-transaction-name"
  588. onClick={handleClick}
  589. >
  590. {transaction.transaction}
  591. </ItemTransactionName>
  592. );
  593. }
  594. return (
  595. <ItemTransactionName to={target} data-test-id="item-transaction-name">
  596. {transaction.transaction}
  597. </ItemTransactionName>
  598. );
  599. }
  600. const TransactionsListContainer = styled('div')`
  601. display: flex;
  602. flex-direction: column;
  603. `;
  604. const TrendsTransactionPanel = styled(Panel)`
  605. margin: 0;
  606. flex-grow: 1;
  607. `;
  608. const ChartContainer = styled('div')`
  609. padding: ${space(3)};
  610. `;
  611. const StyledHeaderTitleLegend = styled(HeaderTitleLegend)`
  612. border-radius: ${p => p.theme.borderRadius};
  613. margin: ${space(2)} ${space(3)};
  614. `;
  615. const MenuAction = styled('div')<{['data-test-id']?: string}>`
  616. white-space: nowrap;
  617. color: ${p => p.theme.textColor};
  618. `;
  619. MenuAction.defaultProps = {
  620. 'data-test-id': 'menu-action',
  621. };
  622. const StyledEmptyStateWarning = styled(EmptyStateWarning)`
  623. min-height: 300px;
  624. justify-content: center;
  625. `;
  626. const ListItemContainer = styled('div')`
  627. display: grid;
  628. grid-template-columns: 24px auto 100px 30px;
  629. grid-template-rows: repeat(2, auto);
  630. grid-column-gap: ${space(1)};
  631. border-top: 1px solid ${p => p.theme.border};
  632. padding: ${space(1)} ${space(2)};
  633. `;
  634. const ItemRadioContainer = styled('div')`
  635. grid-row: 1/3;
  636. input {
  637. cursor: pointer;
  638. }
  639. input:checked::after {
  640. background-color: ${p => p.color};
  641. }
  642. `;
  643. const ItemTransactionName = styled(Link)`
  644. font-size: ${p => p.theme.fontSizeMedium};
  645. margin-right: ${space(1)};
  646. ${p => p.theme.overflowEllipsis};
  647. `;
  648. const ItemTransactionDurationChange = styled('div')`
  649. display: flex;
  650. align-items: center;
  651. font-size: ${p => p.theme.fontSizeSmall};
  652. `;
  653. const DurationChange = styled('span')`
  654. color: ${p => p.theme.gray300};
  655. margin: 0 ${space(1)};
  656. `;
  657. const ItemTransactionPercentage = styled('div')`
  658. text-align: right;
  659. font-size: ${p => p.theme.fontSizeMedium};
  660. `;
  661. const ItemTransactionStatus = styled('div')`
  662. color: ${p => p.color};
  663. text-align: right;
  664. font-size: ${p => p.theme.fontSizeSmall};
  665. `;
  666. const TooltipContent = styled('div')`
  667. display: flex;
  668. flex-direction: column;
  669. align-items: center;
  670. `;
  671. const StyledIconArrow = styled(IconArrow)`
  672. margin: 0 ${space(1)};
  673. `;
  674. export default withProjects(withOrganization(ChangedTransactions));