@@ -23,6 +23,40 @@ const DISABLE_AUTO_FILL_PROPS = {
2323 "data-1p-ignore" : "true" ,
2424} ;
2525
26+ const buildFieldDescription = (
27+ t : ReturnType < typeof useTranslation < [ "settingsSchemaDescriptions" , "common" ] > > [ "t" ] ,
28+ property : JSONSchema7 & { requiresRestart ?: boolean } ,
29+ newPath : string ,
30+ ) => {
31+ let description : string | undefined ;
32+ const fieldDefault = property . default != null ? `${ t ( ( $ ) => $ . default , { ns : "common" } ) } : ${ property . default } ` : undefined ;
33+ const requiresRestart = property . requiresRestart ? t ( ( $ ) => $ . requires_restart , { ns : "common" } ) : undefined ;
34+
35+ if ( property . description !== null ) {
36+ description = `${ t ( ( $ ) => $ [ newPath as keyof ( typeof $ ) [ "settingsSchemaDescriptions" ] ] , { defaultValue : property . description } ) } ` ;
37+
38+ if ( fieldDefault ) {
39+ description += ` 🔹${ fieldDefault } ` ;
40+ }
41+
42+ if ( requiresRestart ) {
43+ description += ` 🔸${ requiresRestart } ` ;
44+ }
45+ } else {
46+ if ( fieldDefault ) {
47+ description = `🔹${ fieldDefault } ` ;
48+
49+ if ( requiresRestart ) {
50+ description += ` 🔸${ requiresRestart } ` ;
51+ }
52+ } else if ( requiresRestart ) {
53+ description = `🔸${ requiresRestart } ` ;
54+ }
55+ }
56+
57+ return description ;
58+ } ;
59+
2660const propertyToField = (
2761 key : string ,
2862 property : JSONSchema7 ,
@@ -249,19 +283,8 @@ const groupProperties = (
249283 ) ;
250284 }
251285 } else {
252- const feature = propertyToField (
253- key ,
254- property ,
255- data [ key ] ?? property . default ,
256- set ,
257- depth ,
258- required . includes ( key ) ,
259- property . description
260- ? `${ t ( ( $ ) => $ [ newPath as keyof ( typeof $ ) [ "settingsSchemaDescriptions" ] ] , { defaultValue : property . description } ) } ${ property . default != null ? ` (${ t ( ( $ ) => $ . default , { ns : "common" , defaultValue : "Default" } ) } : ${ property . default } )` : "" } `
261- : property . default != null
262- ? `${ t ( ( $ ) => $ . default , { ns : "common" , defaultValue : "Default" } ) } : ${ property . default } }`
263- : undefined ,
264- ) ;
286+ const description = buildFieldDescription ( t , property , newPath ) ;
287+ const feature = propertyToField ( key , property , data [ key ] ?? property . default , set , depth , required . includes ( key ) , description ) ;
265288
266289 if ( feature ) {
267290 elements . push (
0 commit comments