Skip to content

Commit 1f4ba8d

Browse files
authored
ref(ui): Remove getDynamicText from components (#97808)
Removes calls to getDynamicText from components directory
1 parent fe479ea commit 1f4ba8d

File tree

10 files changed

+42
-113
lines changed

10 files changed

+42
-113
lines changed

static/app/components/errorBoundary.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import DetailedError from 'sentry/components/errors/detailedError';
77
import {IconClose} from 'sentry/icons';
88
import {t} from 'sentry/locale';
99
import {space} from 'sentry/styles/space';
10-
import getDynamicText from 'sentry/utils/getDynamicText';
1110

1211
type DefaultProps = {
1312
mini: boolean;
@@ -139,10 +138,7 @@ class ErrorBoundary extends Component<Props, State> {
139138
return (
140139
<Wrapper data-test-id="error-boundary">
141140
<DetailedError
142-
heading={getDynamicText({
143-
value: getExclamation(),
144-
fixed: exclamation[0],
145-
})}
141+
heading={getExclamation()}
146142
message={t(
147143
`Something went horribly wrong rendering this page.
148144
We use a decent error reporting service so this will probably be fixed soon. Unless our error reporting service is also broken. That would be awkward.

static/app/components/events/eventMetadata.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {t} from 'sentry/locale';
99
import {space} from 'sentry/styles/space';
1010
import type {Event} from 'sentry/types/event';
1111
import type {OrganizationSummary} from 'sentry/types/organization';
12-
import getDynamicText from 'sentry/utils/getDynamicText';
1312
import Projects from 'sentry/utils/projects';
1413

1514
type Props = {
@@ -30,12 +29,7 @@ function EventMetadata({event, organization, projectId}: Props) {
3029
<SectionHeading>{t('Event ID')}</SectionHeading>
3130
<MetadataContainer data-test-id="event-id">{event.eventID}</MetadataContainer>
3231
<MetadataContainer>
33-
<DateTime
34-
date={getDynamicText({
35-
value: event.dateCreated || (event.endTimestamp || 0) * 1000,
36-
fixed: 'Dummy timestamp',
37-
})}
38-
/>
32+
<DateTime date={event.dateCreated || (event.endTimestamp || 0) * 1000} />
3933
</MetadataContainer>
4034
<Projects orgId={organization.slug} slugs={[projectId]}>
4135
{({projects}) => {

static/app/components/events/interfaces/breadcrumbs/breadcrumb/time/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Highlight from 'sentry/components/highlight';
66
import {space} from 'sentry/styles/space';
77
import {defined} from 'sentry/utils';
88
import {getFormattedTimestamp} from 'sentry/utils/date/getFormattedTimestamp';
9-
import getDynamicText from 'sentry/utils/getDynamicText';
109

1110
type Props = {
1211
searchTerm: string;
@@ -43,10 +42,7 @@ const Time = memo(function Time({
4342
}
4443
containerDisplayMode="inline-flex"
4544
>
46-
{getDynamicText({
47-
value: <Highlight text={searchTerm}>{displayTime}</Highlight>,
48-
fixed: '00:00:00',
49-
})}
45+
<Highlight text={searchTerm}>{displayTime}</Highlight>
5046
</Tooltip>
5147
</Wrapper>
5248
);

static/app/components/events/interfaces/spans/newTraceDetailsSpanDetails.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {defined} from 'sentry/utils';
2727
import EventView from 'sentry/utils/discover/eventView';
2828
import {SavedQueryDatasets} from 'sentry/utils/discover/types';
2929
import {generateEventSlug} from 'sentry/utils/discover/urls';
30-
import getDynamicText from 'sentry/utils/getDynamicText';
3130
import {safeURL} from 'sentry/utils/url/safeURL';
3231
import {useLocation} from 'sentry/utils/useLocation';
3332
import useProjects from 'sentry/utils/useProjects';
@@ -513,25 +512,15 @@ function NewTraceDetailsSpanDetail(props: SpanDetailProps) {
513512
)}
514513
</Row>
515514
<Row title={t('Date Range')}>
516-
{getDynamicText({
517-
fixed: 'Mar 16, 2020 9:10:12 AM UTC',
518-
value: (
519-
<Fragment>
520-
<DateTime date={startTimestamp * 1000} year seconds timeZone />
521-
{` (${startTimeWithLeadingZero})`}
522-
</Fragment>
523-
),
524-
})}
515+
<Fragment>
516+
<DateTime date={startTimestamp * 1000} year seconds timeZone />
517+
{` (${startTimeWithLeadingZero})`}
518+
</Fragment>
525519
<br />
526-
{getDynamicText({
527-
fixed: 'Mar 16, 2020 9:10:13 AM UTC',
528-
value: (
529-
<Fragment>
530-
<DateTime date={endTimestamp * 1000} year seconds timeZone />
531-
{` (${endTimeWithLeadingZero})`}
532-
</Fragment>
533-
),
534-
})}
520+
<Fragment>
521+
<DateTime date={endTimestamp * 1000} year seconds timeZone />
522+
{` (${endTimeWithLeadingZero})`}
523+
</Fragment>
535524
</Row>
536525
<Row title={t('Origin')}>
537526
{span.origin === undefined ? null : String(span.origin)}

static/app/components/events/interfaces/spans/spanDetail.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import {trackAnalytics} from 'sentry/utils/analytics';
3939
import EventView from 'sentry/utils/discover/eventView';
4040
import {SavedQueryDatasets} from 'sentry/utils/discover/types';
4141
import {generateEventSlug} from 'sentry/utils/discover/urls';
42-
import getDynamicText from 'sentry/utils/getDynamicText';
4342
import type {
4443
QuickTraceEvent,
4544
TraceErrorOrIssue,
@@ -513,26 +512,16 @@ function SpanDetail(props: Props) {
513512
</Row>
514513
<Row title="Status">{span.status || ''}</Row>
515514
<Row title="Start Date">
516-
{getDynamicText({
517-
fixed: 'Mar 16, 2020 9:10:12 AM UTC',
518-
value: (
519-
<Fragment>
520-
<DateTime date={startTimestamp * 1000} year seconds timeZone />
521-
{` (${startTimeWithLeadingZero})`}
522-
</Fragment>
523-
),
524-
})}
515+
<Fragment>
516+
<DateTime date={startTimestamp * 1000} year seconds timeZone />
517+
{` (${startTimeWithLeadingZero})`}
518+
</Fragment>
525519
</Row>
526520
<Row title="End Date">
527-
{getDynamicText({
528-
fixed: 'Mar 16, 2020 9:10:13 AM UTC',
529-
value: (
530-
<Fragment>
531-
<DateTime date={endTimestamp * 1000} year seconds timeZone />
532-
{` (${endTimeWithLeadingZero})`}
533-
</Fragment>
534-
),
535-
})}
521+
<Fragment>
522+
<DateTime date={endTimestamp * 1000} year seconds timeZone />
523+
{` (${endTimeWithLeadingZero})`}
524+
</Fragment>
536525
</Row>
537526
<Row title="Duration">{durationString}</Row>
538527
<Row title="Operation">{span.op || ''}</Row>

static/app/components/fileSize.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import styled from '@emotion/styled';
22

33
import {formatBytesBase2} from 'sentry/utils/bytes/formatBytesBase2';
44
import {formatBytesBase10} from 'sentry/utils/bytes/formatBytesBase10';
5-
import getDynamicText from 'sentry/utils/getDynamicText';
65

76
type Props = {
87
bytes: number;
@@ -15,10 +14,7 @@ function FileSize(props: Props) {
1514

1615
return (
1716
<Span className={className}>
18-
{getDynamicText({
19-
value: base === 10 ? formatBytesBase10(bytes) : formatBytesBase2(bytes),
20-
fixed: 'xx KB',
21-
})}
17+
{base === 10 ? formatBytesBase10(bytes) : formatBytesBase2(bytes)}
2218
</Span>
2319
);
2420
}

static/app/components/footer.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {t} from 'sentry/locale';
99
import ConfigStore from 'sentry/stores/configStore';
1010
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
1111
import {space} from 'sentry/styles/space';
12-
import getDynamicText from 'sentry/utils/getDynamicText';
1312
import useOrganization from 'sentry/utils/useOrganization';
1413

1514
type SentryLogoProps = SVGIconProps & {
@@ -42,16 +41,8 @@ function BaseFooter({className}: Props) {
4241
{isSelfHosted && (
4342
<Fragment>
4443
{'Sentry '}
45-
{getDynamicText({
46-
fixed: 'Acceptance Test',
47-
value: version.current,
48-
})}
49-
<Build>
50-
{getDynamicText({
51-
fixed: 'test',
52-
value: version.build.substring(0, 7),
53-
})}
54-
</Build>
44+
{version.current}
45+
<Build>{version.build.substring(0, 7)}</Build>
5546
</Fragment>
5647
)}
5748
{privacyUrl && <FooterLink href={privacyUrl}>{t('Privacy Policy')}</FooterLink>}

static/app/components/group/inboxBadges/timesTag.tsx

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import TimeSince from 'sentry/components/timeSince';
44
import {IconClock} from 'sentry/icons';
55
import {t} from 'sentry/locale';
66
import {space} from 'sentry/styles/space';
7-
import getDynamicText from 'sentry/utils/getDynamicText';
87

98
/**
109
* Used in new inbox
@@ -21,34 +20,26 @@ function TimesTag({lastSeen, firstSeen}: Props) {
2120
return (
2221
<Wrapper>
2322
<StyledIconClock size="xs" color="gray300" />
24-
{lastSeen &&
25-
getDynamicText({
26-
value: (
27-
<TimeSince
28-
tooltipPrefix={t('Last Seen')}
29-
date={lastSeen}
30-
suffix={t('ago')}
31-
unitStyle="short"
32-
/>
33-
),
34-
fixed: '10s ago',
35-
})}
23+
{lastSeen && (
24+
<TimeSince
25+
tooltipPrefix={t('Last Seen')}
26+
date={lastSeen}
27+
suffix={t('ago')}
28+
unitStyle="short"
29+
/>
30+
)}
3631
{firstSeen && lastSeen && (
3732
<Separator className="hidden-xs hidden-sm">&nbsp;|&nbsp;</Separator>
3833
)}
39-
{firstSeen &&
40-
getDynamicText({
41-
value: (
42-
<TimeSince
43-
tooltipPrefix={t('First Seen')}
44-
date={firstSeen}
45-
suffix={t('old')}
46-
className="hidden-xs hidden-sm"
47-
unitStyle="short"
48-
/>
49-
),
50-
fixed: '10s old',
51-
})}
34+
{firstSeen && (
35+
<TimeSince
36+
tooltipPrefix={t('First Seen')}
37+
date={firstSeen}
38+
suffix={t('old')}
39+
className="hidden-xs hidden-sm"
40+
unitStyle="short"
41+
/>
42+
)}
5243
</Wrapper>
5344
);
5445
}

static/app/components/group/releaseStats.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import type {Organization} from 'sentry/types/organization';
1515
import type {Project} from 'sentry/types/project';
1616
import type {CurrentRelease, Release} from 'sentry/types/release';
1717
import {defined} from 'sentry/utils';
18-
import getDynamicText from 'sentry/utils/getDynamicText';
1918
import {useApiQuery} from 'sentry/utils/queryClient';
2019

2120
type Props = {
@@ -121,10 +120,7 @@ function GroupReleaseStats({
121120
organization={organization}
122121
projectId={projectId}
123122
projectSlug={projectSlug}
124-
date={getDynamicText({
125-
value: group.lastSeen,
126-
fixed: '2016-01-13T03:08:25Z',
127-
})}
123+
date={group.lastSeen}
128124
dateGlobal={allEnvironments.lastSeen}
129125
environment={shortEnvironmentLabel}
130126
release={lastRelease}
@@ -144,10 +140,7 @@ function GroupReleaseStats({
144140
organization={organization}
145141
projectId={projectId}
146142
projectSlug={projectSlug}
147-
date={getDynamicText({
148-
value: group.firstSeen,
149-
fixed: '2015-08-13T03:08:25Z',
150-
})}
143+
date={group.firstSeen}
151144
dateGlobal={allEnvironments.firstSeen}
152145
environment={shortEnvironmentLabel}
153146
release={firstRelease}

static/app/components/timeSince.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {TooltipProps} from 'sentry/components/core/tooltip';
66
import {Tooltip} from 'sentry/components/core/tooltip';
77
import {t} from 'sentry/locale';
88
import getDuration from 'sentry/utils/duration/getDuration';
9-
import getDynamicText from 'sentry/utils/getDynamicText';
109
import type {ColorOrAlias} from 'sentry/utils/theme';
1110
import {useUser} from 'sentry/utils/useUser';
1211

@@ -160,12 +159,7 @@ function TimeSince({
160159
: 'MMMM D, YYYY h:mm A z';
161160
const format = options?.clock24Hours ? 'MMMM D, YYYY HH:mm z' : tooltipFormat;
162161

163-
const tooltip = getDynamicText({
164-
fixed: options?.clock24Hours
165-
? 'November 3, 2020 08:57 UTC'
166-
: 'November 3, 2020 8:58 AM UTC',
167-
value: moment(dateObj).format(format),
168-
});
162+
const tooltip = moment(dateObj).format(format);
169163

170164
return (
171165
<Tooltip

0 commit comments

Comments
 (0)