Skip to content

Commit aa96509

Browse files
BYKcursoragentgetsantry[bot]seer-by-sentry[bot]
authored
chore: Refactor onboarding options for unique titles (#14231)
Fixes #14221. --------- Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com> Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com>
1 parent 23ef09b commit aa96509

File tree

5 files changed

+107
-37
lines changed

5 files changed

+107
-37
lines changed

app/globals.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,18 @@ body {
165165
{
166166
color: rgb(134, 142, 150) !important;
167167
}
168+
169+
/* CSS Counters for Onboarding Steps */
170+
.onboarding-steps {
171+
counter-reset: onboarding-step;
172+
}
173+
174+
.onboarding-step {
175+
counter-increment: onboarding-step;
176+
}
177+
178+
.onboarding-step .step-heading::before,
179+
.onboarding-step h2::before {
180+
content: "Step " counter(onboarding-step) ": ";
181+
font-weight: inherit;
182+
}

docs/platforms/javascript/guides/react/index.mdx

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ categories:
1111

1212
<PlatformContent includePath="getting-started-prerequisites" />
1313

14-
## Step 1: Install
14+
<OnboardingSteps>
15+
16+
<OnboardingOption isStep>
17+
18+
## Install
1519

1620
Choose the features you want to configure, and this guide will show you how:
1721

@@ -37,7 +41,11 @@ yarn add @sentry/react
3741
pnpm add @sentry/react
3842
```
3943

40-
## Step 2: Configure
44+
</OnboardingOption>
45+
46+
<OnboardingOption isStep>
47+
48+
## Configure
4149

4250
### Initialize the Sentry SDK
4351

@@ -112,8 +120,9 @@ const container = document.getElementById(“app”);
112120
const root = createRoot(container);
113121
root.render(<App />);
114122
```
115-
116-
## Step 3: Capture React Errors
123+
</OnboardingOption>
124+
<OnboardingOption isStep>
125+
## Capture React Errors
117126

118127
To make sure Sentry captures all your app's errors, configure error handling based on your React version.
119128

@@ -159,8 +168,10 @@ import * as Sentry from "@sentry/react";
159168
[here](features/error-boundary/#manually-capturing-errors).
160169
</Alert>
161170

162-
<OnboardingOption optionId="performance">
163-
## Step 4: Set Up React Router
171+
</OnboardingOption>
172+
173+
<OnboardingOption optionId="performance" isStep>
174+
## Set Up React Router
164175
If you're using `react-router` in your application, you need to set up the Sentry integration for your specific React Router version to trace `navigation` events.\
165176
Select your React Router version to start instrumenting your routing:
166177

@@ -169,43 +180,34 @@ Select your React Router version to start instrumenting your routing:
169180
- [Older React Router versions](features/react-router)
170181
- [TanStack Router](features/tanstack-router)
171182

172-
## Step 5: Capture Redux State Data (Optional)
173-
174183
</OnboardingOption>
175184

176-
<OnboardingOption optionId="performance" hideForThisOption>
177-
## Step 4: Capture Redux State Data (Optional)
178-
</OnboardingOption>
185+
<OnboardingOption isStep>
186+
## Capture Redux State Data (Optional)
179187

180188
To capture Redux state data, use `Sentry.createReduxEnhancer` when initializing your Redux store.
181189

182190
<PlatformContent includePath="configuration/redux-init" />
183191

184-
<OnboardingOption optionId="performance">
185-
## Step 6: Add Readable Stack Traces With Source Maps (Optional)
186-
</OnboardingOption>
187-
<OnboardingOption optionId="performance" hideForThisOption>
188-
## Step 5: Add Readable Stack Traces With Source Maps (Optional)
189192
</OnboardingOption>
190193

194+
<OnboardingOption isStep>
195+
## Add Readable Stack Traces With Source Maps (Optional)
196+
191197
<PlatformContent includePath="getting-started-sourcemaps-short-version" />
192198

193-
<OnboardingOption optionId="performance">
194-
## Step 7: Avoid Ad Blockers With Tunneling (Optional)
195-
</OnboardingOption>
196-
<OnboardingOption optionId="performance" hideForThisOption>
197-
## Step 6: Avoid Ad Blockers With Tunneling (Optional)
198199
</OnboardingOption>
199200

201+
<OnboardingOption isStep>
202+
## Avoid Ad Blockers With Tunneling (Optional)
203+
200204
<PlatformContent includePath="getting-started-tunneling" />
201205

202-
<OnboardingOption optionId="performance">
203-
## Step 8: Verify Your Setup
204-
</OnboardingOption>
205-
<OnboardingOption optionId="performance" hideForThisOption>
206-
## Step 7: Verify Your Setup
207206
</OnboardingOption>
208207

208+
<OnboardingOption isStep>
209+
## Verify Your Setup
210+
209211
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
210212

211213
### Issues
@@ -230,6 +232,8 @@ To verify that Sentry captures errors and creates issues in your Sentry project,
230232

231233
<PlatformContent includePath="getting-started-browser-sandbox-warning" />
232234

235+
</OnboardingOption>
236+
233237
<OnboardingOption optionId="performance">
234238
### Tracing
235239

@@ -254,6 +258,8 @@ Open the page in a browser (for most React applications, this will be at localho
254258

255259
</OnboardingOption>
256260

261+
<OnboardingOption>
262+
257263
### View Captured Data in Sentry
258264

259265
Now, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear).
@@ -277,3 +283,7 @@ Now's a good time to customize your setup and look into more advanced topics. Ou
277283
- [Get support](https://sentry.zendesk.com/hc/en-us/)
278284

279285
</Expandable>
286+
287+
</OnboardingOption>
288+
289+
</OnboardingSteps>

docs/platforms/javascript/guides/svelte/index.mdx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ categories:
99

1010
<PlatformContent includePath="getting-started-prerequisites" />
1111

12-
## Step 1: Install
12+
<OnboardingSteps>
13+
14+
<OnboardingOption isStep>
15+
16+
## Install
1317

1418
Choose the features you want to configure, and this guide will show you how:
1519

@@ -34,8 +38,11 @@ yarn add @sentry/svelte
3438
```bash {tabTitle:pnpm}
3539
pnpm add @sentry/svelte
3640
```
41+
</OnboardingOption>
42+
43+
<OnboardingOption isStep>
3744

38-
## Step 2: Configure
45+
## Configure
3946

4047
To use the SDK, initialize it in your Svelte entry point before bootstrapping your app. In a typical Svelte project, that is your `main.js` or `main.ts` file.
4148

@@ -160,16 +167,25 @@ const app = new App({
160167

161168
export default app;
162169
```
170+
</OnboardingOption>
171+
172+
<OnboardingOption isStep>
163173

164-
## Step 3: Add Readable Stack Traces With Source Maps (Optional)
174+
## Add Readable Stack Traces With Source Maps (Optional)
165175

166176
<PlatformContent includePath="getting-started-sourcemaps-short-version" />
167177

168-
## Step 4: Avoid Ad Blockers With Tunneling (Optional)
178+
</OnboardingOption>
179+
180+
<OnboardingOption isStep>
181+
## Avoid Ad Blockers With Tunneling (Optional)
169182

170183
<PlatformContent includePath="getting-started-tunneling" />
171184

172-
## Step 5: Verify Your Setup
185+
</OnboardingOption>
186+
187+
<OnboardingOption isStep>
188+
## Verify Your Setup
173189

174190
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
175191

@@ -205,6 +221,8 @@ To verify that Sentry captures errors and creates issues in your Sentry project,
205221

206222
<PlatformContent includePath="getting-started-browser-sandbox-warning" />
207223

224+
</OnboardingOption>
225+
208226
<OnboardingOption optionId="performance">
209227
### Tracing
210228

@@ -244,6 +262,7 @@ Open the page in a browser and click the button to trigger a frontend error and
244262

245263
</OnboardingOption>
246264

265+
<OnboardingOption>
247266
### View Captured Data in Sentry
248267

249268
Now, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear).
@@ -267,3 +286,7 @@ Now's a good time to customize your setup and look into more advanced topics. Ou
267286
- [Get support](https://sentry.zendesk.com/hc/en-us/)
268287

269288
</Expandable>
289+
290+
</OnboardingOption>
291+
292+
</OnboardingSteps>

src/components/onboarding/index.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,42 @@ const validateOptionIds = (options: Pick<OnboardingOptionType, 'id'>[]) => {
142142

143143
export function OnboardingOption({
144144
children,
145-
optionId,
145+
optionId = 'all',
146146
hideForThisOption,
147+
isStep = false,
147148
}: {
148-
children: React.ReactNode;
149-
optionId: OptionId;
149+
children: ReactNode;
150+
optionId: OptionId | 'all';
150151
hideForThisOption?: boolean;
152+
isStep?: boolean;
151153
}) {
152-
validateOptionIds([{id: optionId}]);
154+
if (optionId !== 'all') {
155+
// Allow not passing an optionId when isStep is true
156+
validateOptionIds([{id: optionId}]);
157+
}
158+
const className = [hideForThisOption ? 'hidden' : '', isStep ? 'onboarding-step' : '']
159+
.filter(Boolean)
160+
.join(' ');
161+
153162
return (
154163
<div
155164
data-onboarding-option={optionId}
156165
data-hide-for-this-option={hideForThisOption}
157-
className={hideForThisOption ? 'hidden' : ''}
166+
className={className}
158167
>
159168
{children}
160169
</div>
161170
);
162171
}
163172

173+
/**
174+
* Wrapper component that provides CSS counter context for numbered onboarding steps
175+
* @param children - OnboardingOption components that should be numbered as steps
176+
*/
177+
export function OnboardingSteps({children}: {children: ReactNode}) {
178+
return <div className="onboarding-steps">{children}</div>;
179+
}
180+
164181
/**
165182
* Updates DOM elements' visibility based on selected onboarding options
166183
*/

src/mdxComponents.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import {GuideGrid} from './components/guideGrid';
1818
import {JsBundleList} from './components/jsBundleList';
1919
import {LambdaLayerDetail} from './components/lambdaLayerDetail';
2020
import {LinkWithPlatformIcon} from './components/linkWithPlatformIcon';
21-
import {OnboardingOption, OnboardingOptionButtons} from './components/onboarding';
21+
import {
22+
OnboardingOption,
23+
OnboardingOptionButtons,
24+
OnboardingSteps,
25+
} from './components/onboarding';
2226
import {OrgAuthTokenNote} from './components/orgAuthTokenNote';
2327
import {PageGrid} from './components/pageGrid';
2428
import {ParamTable} from './components/paramTable';
@@ -84,6 +88,7 @@ export function mdxComponents(
8488
PlatformSdkPackageName,
8589
OnboardingOption,
8690
OnboardingOptionButtons,
91+
OnboardingSteps,
8792
RelayMetrics,
8893
SandboxLink,
8994
SignInNote,

0 commit comments

Comments
 (0)