Skip to content

Commit e4349b9

Browse files
dcramerPeloWriter
andauthored
feat: Add auto generated next steps to PHP (#2386)
- Add nextPages and header attributes to PageGrid - Add sidebar_order to all sections - Add descriptions for various pages Co-authored-by: Fiona <[email protected]>
1 parent 84bc46e commit e4349b9

File tree

10 files changed

+54
-19
lines changed

10 files changed

+54
-19
lines changed

src/components/pageGrid.tsx

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,51 @@ const query = graphql`
2020
}
2121
`;
2222

23-
export default (): JSX.Element => {
23+
type Props = {
24+
nextPages: boolean;
25+
header?: string;
26+
};
27+
28+
export default ({ nextPages = false, header }: Props): JSX.Element => {
2429
const data = useStaticQuery(query);
2530
const location = useLocation();
2631

2732
const currentPath = location.pathname;
2833
const currentPathLen = currentPath.length;
2934

30-
const matches = sortPages(
35+
let matches = sortPages(
3136
data.allSitePage.nodes.filter(
3237
n =>
3338
n.context &&
3439
n.context.title &&
35-
n.path !== currentPath &&
3640
n.path.indexOf(currentPath) === 0 &&
3741
n.path.slice(currentPathLen).split("/", 2)[1] === ""
3842
)
3943
);
4044

45+
if (nextPages) {
46+
matches = matches.slice(
47+
matches.indexOf(matches.find(n => n.path === currentPath))
48+
);
49+
} else {
50+
matches = matches.filter(n => n.path !== currentPath);
51+
}
52+
53+
if (!matches.length) return null;
54+
4155
return (
42-
<ul>
43-
{matches.map(n => (
44-
<li key={n.path} style={{ marginBottom: "1rem" }}>
45-
<h4 style={{ marginBottom: 0 }}>
46-
<SmartLink to={n.path}>{n.context.title}</SmartLink>
47-
</h4>
48-
{n.context.description ?? <p>{n.context.description}</p>}
49-
</li>
50-
))}
51-
</ul>
56+
<nav>
57+
{header && <h2>{header}</h2>}
58+
<ul>
59+
{matches.map(n => (
60+
<li key={n.path} style={{ marginBottom: "1rem" }}>
61+
<h4 style={{ marginBottom: 0 }}>
62+
<SmartLink to={n.path}>{n.context.title}</SmartLink>
63+
</h4>
64+
{n.context.description ?? <p>{n.context.description}</p>}
65+
</li>
66+
))}
67+
</ul>
68+
</nav>
5269
);
5370
};

src/docs/contributing/pages/components.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ Render all child pages of this document, including their `description` if availa
117117
<PageGrid />
118118
```
119119

120+
Attributes:
121+
122+
- `header` (string) - optional header value to include, rendered as an H2
123+
- `nextPages` (boolean) - only render pages which come next based on sidebar ordering
124+
120125
## PlatformContent
121126

122127
Render an include based on the currently selected `platform` in context.

src/platforms/common/configuration/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: Configuration
3-
notSupported: ["native.ue4", "native.breakpad", "native.crashpad", "native.minidumps"]
3+
notSupported:
4+
["native.ue4", "native.breakpad", "native.crashpad", "native.minidumps"]
5+
description: Additional configuration options for the SDK.
46
sidebar_order: 5
57
---
68

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
title: Data Management
3+
sidebar_order: 4000
4+
description: Manage your events by applying pre-filtering, scrubbing sensitive information, and forwarding them other systems.
35
---
46

57
<PageGrid />

src/platforms/common/enriching-events/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
title: Enriching Events
3+
sidebar_order: 3000
4+
description: Enrich events with additional context to make debugging simpler.
35
notSupported:
46
- native.breakpad
57
- native.crashpad

src/platforms/common/usage/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Usage
33
sidebar_order: 10
44
excerpt: ""
5-
description: "Learn more about automatically reporting errors, exceptions, and rejections as well as how to manually capture errors and enable message capture."
5+
description: "Use the SDK to manually capture errors and other events."
66
notSupported:
77
- native.breakpad
88
- native.crashpad

src/platforms/javascript/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ Learn more about sampling in [Filtering Events Reported to Sentry](configuration
128128

129129
## Next Steps
130130

131+
<PageGrid nextSteps />
132+
131133
- **[Manage Configuration Options](./configuration/)**
132134

133135
Sentry's JavaScript SDK includes many configuration options that are automatically set. You can configure your SDK using the options outlined in these pages.

src/platforms/php/common/default-integrations.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: Default Integrations
3-
sidebar_order: 1000
3+
description: "Default integrations are integrations enabled by default that integrate into the
4+
standard library or the interpreter itself."
5+
sidebar_order: 500
46
---
57

68
Default integrations are integrations enabled by default that integrate into the

src/platforms/php/common/performance.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Performance
3+
sidebar_order: 2000
34
description: "Configure our Performance Monitoring integration to suit the needs of your organization. You can use the Performance Monitoring homepage to search or browse for transaction data."
45
---
56

@@ -94,10 +95,10 @@ You can also use this to filter for specific conditions when you don't want to s
9495

9596
```php
9697
$transaction = SentrySdk::getCurrentHub()->getTransaction();
97-
98+
9899
if ($transaction instanceof Transaction) {
99100
// $transaction->setSampled(false); // __DONT__ SEND TRANSACTION
100-
// $transaction->setSampled(true); // __DO__ SEND TRANSACTION
101+
// $transaction->setSampled(true); // __DO__ SEND TRANSACTION
101102
}
102103
```
103104

@@ -131,4 +132,4 @@ Add the following line to your blade template rendering the `<head/>` of your pa
131132

132133
This helper function will render a meta tag similar to this `<meta name="sentry-trace" content="49879feb76c84743ba5034bd2d3f1ca3-7cb5535c930d4666-1"/>` which our JS SDK will pick up and continue the trace. Therefore your frontend and your backend are connected via the same trace.
133134

134-
</PlatformSection>
135+
</PlatformSection>

src/platforms/php/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ Sentry\init([
6868
Performance data is transmitted using a new event type called "transactions", which you can learn about in [Distributed Tracing](/performance-monitoring/distributed-tracing/#traces-transactions-and-spans). **To capture transactions, you must install and configure your SDK to set the `traces_sample_rate` option to a nonzero value.** The example configuration above will transmit 100% of captured traces. Be sure to lower this value in production otherwise you could burn through your quota quickly.
6969

7070
Learn more about sampling in [Using Your SDK to Filter Events](configuration/filtering/).
71+
72+
<PageGrid header="Next Steps" nextSteps />

0 commit comments

Comments
 (0)