@@ -2,6 +2,8 @@ import { useSegmentTree, type SegmentTrieNode } from '../../segment-explorer'
2
2
import { css } from '../../utils/css'
3
3
import { cx } from '../../utils/cx'
4
4
5
+ const BUILTIN_PREFIX = '__next_builtin__'
6
+
5
7
const isFileNode = ( node : SegmentTrieNode ) => {
6
8
return ! ! node . value ?. type && ! ! node . value ?. pagePath
7
9
}
@@ -115,7 +117,10 @@ function PageSegmentTreeLayerPresentation({
115
117
return null
116
118
}
117
119
const filePath = childNode . value . pagePath
118
- const fileName = filePath . split ( '/' ) . pop ( ) || ''
120
+ const lastSegment = filePath . split ( '/' ) . pop ( ) || ''
121
+ const isBuiltin = filePath . startsWith ( BUILTIN_PREFIX )
122
+ const fileName = lastSegment . replace ( BUILTIN_PREFIX , '' )
123
+
119
124
return (
120
125
< span
121
126
key = { fileChildSegment }
@@ -124,10 +129,18 @@ function PageSegmentTreeLayerPresentation({
124
129
} }
125
130
className = { cx (
126
131
'segment-explorer-file-label' ,
127
- `segment-explorer-file-label--${ childNode . value . type } `
132
+ `segment-explorer-file-label--${ childNode . value . type } ` ,
133
+ isBuiltin && 'segment-explorer-file-label--builtin'
128
134
) }
129
135
>
130
136
{ fileName }
137
+ { isBuiltin && (
138
+ < TooltipSpan
139
+ title = { `The default Next.js not found is being shown. You can customize this page by adding your own ${ fileName } file to the app/ directory.` }
140
+ >
141
+ < InfoIcon />
142
+ </ TooltipSpan >
143
+ ) }
131
144
</ span >
132
145
)
133
146
} ) }
@@ -250,6 +263,17 @@ export const DEV_TOOLS_INFO_RENDER_FILES_STYLES = css`
250
263
background-color : var (--color-red-300 );
251
264
color : var (--color-red-900 );
252
265
}
266
+
267
+ .segment-explorer-file-label--builtin {
268
+ background-color : transparent;
269
+ color : var (--color-gray-900 );
270
+ border : 1px dashed var (--color-gray-500 );
271
+ }
272
+
273
+ .segment-explorer-file-label--builtin svg {
274
+ margin-left : 4px ;
275
+ margin-right : -4px ;
276
+ }
253
277
`
254
278
255
279
function openInEditor ( { filePath } : { filePath : string } ) {
@@ -265,3 +289,35 @@ function openInEditor({ filePath }: { filePath: string }) {
265
289
} /__nextjs_launch-editor?${ params . toString ( ) } `
266
290
)
267
291
}
292
+
293
+ function InfoIcon ( props : React . SVGProps < SVGSVGElement > ) {
294
+ return (
295
+ < svg
296
+ width = "16"
297
+ height = "16"
298
+ viewBox = "0 0 16 16"
299
+ fill = "none"
300
+ xmlns = "http://www.w3.org/2000/svg"
301
+ { ...props }
302
+ >
303
+ < path
304
+ d = "M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z"
305
+ fill = "var(--color-gray-400)"
306
+ />
307
+ < path
308
+ d = "M7.75 7C8.30228 7.00001 8.75 7.44772 8.75 8V11.25H7.25V8.5H6.25V7H7.75ZM8 4C8.55228 4 9 4.44772 9 5C9 5.55228 8.55228 6 8 6C7.44772 6 7 5.55228 7 5C7 4.44772 7.44772 4 8 4Z"
309
+ fill = "var(--color-gray-900)"
310
+ />
311
+ </ svg >
312
+ )
313
+ }
314
+
315
+ function TooltipSpan ( {
316
+ children,
317
+ title,
318
+ } : {
319
+ children : React . ReactNode
320
+ title : string
321
+ } ) {
322
+ return < span title = { title } > { children } </ span >
323
+ }
0 commit comments