@@ -50,6 +50,7 @@ export default function Page({ params }: PageProps) {
5050 const [ guideHtml , setGuideHtml ] = useState ( '' )
5151 const [ creditsHtml , setCreditsHtml ] = useState ( '' )
5252 const [ isClient , setIsClient ] = useState ( false )
53+ const [ showGoodDollarButton , setShowGoodDollarButton ] = useState ( false )
5354
5455 const htmlDeMd = useCallback ( ( md : string | undefined ) => {
5556 if ( ! md ) return ''
@@ -116,7 +117,11 @@ export default function Page({ params }: PageProps) {
116117
117118 const response = await axios . get ( nurl )
118119 if ( response . data && response . data . markdown ) {
119- setGuideHtml ( htmlDeMd ( response . data . markdown ) )
120+ const markdown = response . data . markdown
121+ const hasGoodDollarButton = markdown . includes ( '{GoodDollarButton}' )
122+ setShowGoodDollarButton ( hasGoodDollarButton )
123+ const mdWithoutButton = markdown . replace ( '{GoodDollarButton}' , '' )
124+ setGuideHtml ( htmlDeMd ( mdWithoutButton ) )
120125 } else if ( response . data && response . data . message ) {
121126 throw new Error ( response . data . message )
122127 }
@@ -168,8 +173,7 @@ export default function Page({ params }: PageProps) {
168173 < div className = "mt-8 pt-2 dark:bg-gray-100 dark:text-gray-800" >
169174 < div className = "container p-2 px-8 md:px-16 mx-auto pt-16 space-y-1" >
170175 < h3 className = "pb-1 text-1xl font-bold md:text-1xl text-center" >
171- { course . idioma === 'en' ? 'Course: ' : 'Curso: ' }
172- { course . titulo }
176+ { course . idioma === 'en' ? 'Course: ' : 'Curso: ' } { course . titulo }
173177 </ h3 >
174178 </ div >
175179 < h1 className = "py-3 px-16 text-[2rem] font-bold text-left" >
@@ -183,7 +187,7 @@ export default function Page({ params }: PageProps) {
183187 className = "py-3 px-16 text-1xl md:text-1xl text-justify **:list-inside"
184188 dangerouslySetInnerHTML = { { __html : guideHtml } }
185189 />
186- { isClient && pathPrefix === 'gooddollar' && pathSuffix === 'guide1' && (
190+ { isClient && showGoodDollarButton && (
187191 < GoodDollarClaimButton
188192 lang = { course . idioma }
189193 pathPrefix = { pathPrefix }
@@ -248,7 +252,8 @@ export default function Page({ params }: PageProps) {
248252 </ div >
249253
250254 < div > </ div >
251- </ > )
255+ </ >
256+ )
252257}
253258
254259
0 commit comments