|
@@ -8,17 +8,12 @@ import {space} from 'sentry/styles/space';
|
|
export enum StepType {
|
|
export enum StepType {
|
|
INSTALL = 'install',
|
|
INSTALL = 'install',
|
|
CONFIGURE = 'configure',
|
|
CONFIGURE = 'configure',
|
|
- /**
|
|
|
|
- * This step is used only for JavaScript SDKs
|
|
|
|
- */
|
|
|
|
- UPLOAD_SOURCE_MAPS = 'upload_source_maps',
|
|
|
|
VERIFY = 'verify',
|
|
VERIFY = 'verify',
|
|
}
|
|
}
|
|
|
|
|
|
export const StepTitle = {
|
|
export const StepTitle = {
|
|
[StepType.INSTALL]: t('Install'),
|
|
[StepType.INSTALL]: t('Install'),
|
|
[StepType.CONFIGURE]: t('Configure SDK'),
|
|
[StepType.CONFIGURE]: t('Configure SDK'),
|
|
- [StepType.UPLOAD_SOURCE_MAPS]: t('Upload Source Maps'),
|
|
|
|
[StepType.VERIFY]: t('Verify'),
|
|
[StepType.VERIFY]: t('Verify'),
|
|
};
|
|
};
|
|
|
|
|
|
@@ -31,41 +26,59 @@ type ConfigurationType = {
|
|
* The language of the code to be rendered (python, javascript, etc)
|
|
* The language of the code to be rendered (python, javascript, etc)
|
|
*/
|
|
*/
|
|
language: string;
|
|
language: string;
|
|
|
|
+ /**
|
|
|
|
+ * Additional information to be displayed below the code snippet
|
|
|
|
+ */
|
|
|
|
+ additionalInfo?: React.ReactNode;
|
|
/**
|
|
/**
|
|
* A brief description of the configuration
|
|
* A brief description of the configuration
|
|
*/
|
|
*/
|
|
description?: React.ReactNode;
|
|
description?: React.ReactNode;
|
|
};
|
|
};
|
|
|
|
|
|
-export type StepProps = {
|
|
|
|
- configurations: ConfigurationType[];
|
|
|
|
- /**
|
|
|
|
- * The step type (install, configure, verify). The list can grow as we add more steps
|
|
|
|
- */
|
|
|
|
- type: StepType;
|
|
|
|
|
|
+interface BaseStepProps {
|
|
|
|
+ configurations?: ConfigurationType[];
|
|
/**
|
|
/**
|
|
* A brief description of the step
|
|
* A brief description of the step
|
|
*/
|
|
*/
|
|
description?: React.ReactNode;
|
|
description?: React.ReactNode;
|
|
-};
|
|
|
|
|
|
+}
|
|
|
|
+interface StepPropsWithTitle extends BaseStepProps {
|
|
|
|
+ title: string;
|
|
|
|
+ type?: undefined;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+interface StepPropsWithoutTitle extends BaseStepProps {
|
|
|
|
+ type: StepType;
|
|
|
|
+ title?: undefined;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+export type StepProps = StepPropsWithTitle | StepPropsWithoutTitle;
|
|
|
|
|
|
-export function Step({type, configurations, description}: StepProps) {
|
|
|
|
|
|
+export function Step({title, type, configurations, description}: StepProps) {
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
- <h4>{StepTitle[type]}</h4>
|
|
|
|
- {description}
|
|
|
|
- <Configurations>
|
|
|
|
- {configurations.map((configuration, index) => (
|
|
|
|
- <Configuration key={index}>
|
|
|
|
- {configuration.description}
|
|
|
|
- <CodeSnippet dark language={configuration.language}>
|
|
|
|
- {configuration.language === 'javascript'
|
|
|
|
- ? beautify.js(configuration.code, {indent_size: 2, e4x: true})
|
|
|
|
- : beautify.html(configuration.code, {indent_size: 2})}
|
|
|
|
- </CodeSnippet>
|
|
|
|
- </Configuration>
|
|
|
|
- ))}
|
|
|
|
- </Configurations>
|
|
|
|
|
|
+ <h4>{title ?? StepTitle[type]}</h4>
|
|
|
|
+ {description && <Description>{description}</Description>}
|
|
|
|
+ {!!configurations?.length && (
|
|
|
|
+ <Configurations>
|
|
|
|
+ {configurations.map((configuration, index) => (
|
|
|
|
+ <Configuration key={index}>
|
|
|
|
+ {configuration.description && (
|
|
|
|
+ <Description>{configuration.description}</Description>
|
|
|
|
+ )}
|
|
|
|
+ <CodeSnippet dark language={configuration.language}>
|
|
|
|
+ {configuration.language === 'javascript'
|
|
|
|
+ ? beautify.js(configuration.code, {indent_size: 2, e4x: true})
|
|
|
|
+ : beautify.html(configuration.code, {indent_size: 2})}
|
|
|
|
+ </CodeSnippet>
|
|
|
|
+ {configuration.additionalInfo && (
|
|
|
|
+ <AdditionalInfo>{configuration.additionalInfo}</AdditionalInfo>
|
|
|
|
+ )}
|
|
|
|
+ </Configuration>
|
|
|
|
+ ))}
|
|
|
|
+ </Configurations>
|
|
|
|
+ )}
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -79,3 +92,7 @@ const Configuration = styled('div')`
|
|
const Configurations = styled(Configuration)`
|
|
const Configurations = styled(Configuration)`
|
|
margin-top: ${space(2)};
|
|
margin-top: ${space(2)};
|
|
`;
|
|
`;
|
|
|
|
+
|
|
|
|
+const Description = styled(Configuration)``;
|
|
|
|
+
|
|
|
|
+const AdditionalInfo = styled(Configuration)``;
|