changedTransactions.tsx 23 KB

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