Skip to content

Commit

Permalink
Revert "remove frontend stuff"
Browse files Browse the repository at this point in the history
This reverts commit 7052296.
  • Loading branch information
schew2381 committed Aug 12, 2024
1 parent 47a1134 commit 8aa314f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
7 changes: 5 additions & 2 deletions static/app/components/modals/projectCreationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import {trackAnalytics} from 'sentry/utils/analytics';
import slugify from 'sentry/utils/slugify';
import useApi from 'sentry/utils/useApi';
import useOrganization from 'sentry/utils/useOrganization';
import type {IssueAlertFragment} from 'sentry/views/projectInstall/createProject';
import {
getAlertStepName,
type IssueAlertFragment,
} from 'sentry/views/projectInstall/createProject';
import IssueAlertOptions from 'sentry/views/projectInstall/issueAlertOptions';

type Props = ModalRenderProps & {
Expand Down Expand Up @@ -150,7 +153,7 @@ export default function ProjectCreationModal({
)}
{step === 1 && (
<Fragment>
<Subtitle>{t('Set your alert frequency')}</Subtitle>
<Subtitle>{getAlertStepName(organization)}</Subtitle>
<IssueAlertOptions
platformLanguage={platform?.language as SupportedLanguages}
onChange={updatedData => setAlertRuleConfig(updatedData)}
Expand Down
10 changes: 8 additions & 2 deletions static/app/views/projectInstall/createProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {Tooltip} from 'sentry/components/tooltip';
import {t, tct} from 'sentry/locale';
import ProjectsStore from 'sentry/stores/projectsStore';
import {space} from 'sentry/styles/space';
import type {OnboardingSelectedSDK, Team} from 'sentry/types';
import type {OnboardingSelectedSDK, Organization, Team} from 'sentry/types';
import {trackAnalytics} from 'sentry/utils/analytics';
import {browserHistory} from 'sentry/utils/browserHistory';
import useRouteAnalyticsEventNames from 'sentry/utils/routeAnalytics/useRouteAnalyticsEventNames';
Expand All @@ -44,6 +44,12 @@ export type IssueAlertFragment = Parameters<
React.ComponentProps<typeof IssueAlertOptions>['onChange']
>[0];

export function getAlertStepName(organization: Organization) {
return organization.features.includes('default-metric-alerts-new-projects')
? t('Set your alerts')
: t('Set your alert frequency');
}

function CreateProject() {
const api = useApi();
const organization = useOrganization();
Expand Down Expand Up @@ -341,7 +347,7 @@ function CreateProject() {
showOther
noAutoFilter
/>
<StyledListItem>{t('Set your alert frequency')}</StyledListItem>
<StyledListItem>{getAlertStepName(organization)}</StyledListItem>
<IssueAlertOptions
{...alertFrequencyDefaultValues}
platformLanguage={platform?.language as SupportedLanguages}
Expand Down
22 changes: 14 additions & 8 deletions static/app/views/projectInstall/issueAlertOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,29 @@ class IssueAlertOptions extends DeprecatedAsyncComponent<Props, State> {
</CustomizeAlert>,
];

const default_label = this.shouldUseNewDefaultSetting()
? t('Alert me on high priority issues')
: t('Alert me on every new issue');

const options: [string, React.ReactNode][] = [
[RuleAction.DEFAULT_ALERT.toString(), default_label],
...(hasProperlyLoadedConditions ? [customizedAlertOption] : []),
[RuleAction.CREATE_ALERT_LATER.toString(), t("I'll create my own alerts later")],
];

if (this.props.organization.features.includes('default-metric-alerts-new-projects')) {
options.unshift([RuleAction.DEFAULT_ALERT.toString(), t('Alert me on issues')]);
} else {
options.unshift(
[RuleAction.DEFAULT_ALERT.toString(), this.getDefaultLabel()],
...(hasProperlyLoadedConditions ? [customizedAlertOption] : [])
);
}

return options.map(([choiceValue, node]) => [
choiceValue,
<RadioItemWrapper key={choiceValue}>{node}</RadioItemWrapper>,
]);
}

shouldUseNewDefaultSetting(): boolean {
return this.props.organization.features.includes('priority-ga-features');
getDefaultLabel(): string {
return this.props.organization.features.includes('priority-ga-features')
? t('Alert me on high priority issues')
: t('Alert me on every new issue');
}

getUpdatedData(): RequestDataFragment {
Expand Down

0 comments on commit 8aa314f

Please sign in to comment.