11import { PageLayout , SharedLayout } from "./quartz/cfg"
22import * as Component from "./quartz/components"
33
4- // Função auxiliar para extrair o prefixo numérico "01-", "02-", etc.
5- // Usa `name`, que é o último segmento do slug (ex.: "01-finquant").
6- const getNumericPrefix = ( node : any ) : number => {
7- const key : string = node . name ?? ""
8- const match = key . match ( / ^ ( \d + ) - / )
9- return match ? parseInt ( match [ 1 ] , 10 ) : Number . POSITIVE_INFINITY
10- }
11-
124// components shared across all pages
135export const sharedPageComponents : SharedLayout = {
146 head : Component . Head ( ) ,
@@ -46,33 +38,7 @@ export const defaultContentPageLayout: PageLayout = {
4638 { Component : Component . ReaderMode ( ) } ,
4739 ] ,
4840 } ) ,
49- Component . Explorer ( {
50- sortFn : ( a , b ) => {
51- const aPrefix = getNumericPrefix ( a )
52- const bPrefix = getNumericPrefix ( b )
53-
54- // Folders x files (padrão do Quartz: pastas primeiro)
55- if ( ( ! a . file && ! b . file ) || ( a . file && b . file ) ) {
56- // Se ambos são da mesma “categoria”, usa o prefixo numérico se existir
57- if ( aPrefix !== bPrefix ) {
58- return aPrefix - bPrefix
59- }
60-
61- // Empate → ordem alfabética natural
62- return a . displayName . localeCompare ( b . displayName , undefined , {
63- numeric : true ,
64- sensitivity : "base" ,
65- } )
66- }
67-
68- // a.file = true significa que é arquivo
69- if ( a . file && ! b . file ) {
70- return 1
71- } else {
72- return - 1
73- }
74- } ,
75- } ) ,
41+ Component . Explorer ( ) ,
7642 ] ,
7743 right : [
7844 Component . Graph ( ) ,
@@ -96,29 +62,7 @@ export const defaultListPageLayout: PageLayout = {
9662 { Component : Component . Darkmode ( ) } ,
9763 ] ,
9864 } ) ,
99- Component . Explorer ( {
100- sortFn : ( a , b ) => {
101- const aPrefix = getNumericPrefix ( a )
102- const bPrefix = getNumericPrefix ( b )
103-
104- if ( ( ! a . file && ! b . file ) || ( a . file && b . file ) ) {
105- if ( aPrefix !== bPrefix ) {
106- return aPrefix - bPrefix
107- }
108-
109- return a . displayName . localeCompare ( b . displayName , undefined , {
110- numeric : true ,
111- sensitivity : "base" ,
112- } )
113- }
114-
115- if ( a . file && ! b . file ) {
116- return 1
117- } else {
118- return - 1
119- }
120- } ,
121- } ) ,
65+ Component . Explorer ( ) ,
12266 ] ,
12367 right : [ ] ,
12468}
0 commit comments