1
+ import '../tailwind.css' ;
1
2
import './Application.scss' ;
2
3
import Nullstack from 'nullstack' ;
3
- import { readdirSync , readFileSync } from 'fs' ;
4
- import prismjs from 'prismjs' ;
5
- import { Remarkable } from 'remarkable' ;
6
- import meta from 'remarkable-meta' ;
7
4
import Home from './home/Home' ;
8
5
import Articles from './articles/Articles' ;
9
6
import Article from './article/Article' ;
@@ -14,46 +11,11 @@ import MiniCourse from './mini-course/MiniCourse';
14
11
import MiniCourseThankPage from './delivery-mini-course/MiniCourseThankPage' ;
15
12
import MiniCourseClasses from './delivery-mini-course/MiniCourseClasses' ;
16
13
import PageVideoDepo from './delivery-mini-course/PageVideoDepo' ;
17
-
18
14
import GoogleAnalytics from './layout/GoogleAnalytics' ;
19
15
import FacebookPixel from './layout/FacebookPixel' ;
20
16
21
- import FacePixelFullStack from './course-fullstack-turbo/FacePixelFullStack' ;
22
- import FacePixelReact from './course-react-pro/FacePixelReact' ;
23
-
24
17
class Application extends Nullstack {
25
18
26
- static async start ( context ) {
27
- await import ( 'prismjs/components/prism-jsx.min' ) ;
28
- const articles = readdirSync ( 'articles' ) ;
29
- const md = new Remarkable ( {
30
- // eslint-disable-next-line no-undef
31
- highlight : ( code ) => Prism . highlight ( code , prismjs . languages . jsx , 'javascript' ) ,
32
- } ) ;
33
- md . use ( meta ) ;
34
- md . use ( ( md ) => {
35
- const originalRender = md . renderer . rules . link_open ;
36
- md . renderer . rules . link_open = ( ...args ) => {
37
- let result = originalRender ( ...args ) ;
38
- const regexp = / h r e f = " ( [ ^ " ] * ) " / ;
39
- const href = regexp . exec ( result ) [ 1 ] ;
40
- if ( ! href . startsWith ( '/' ) ) {
41
- result = result . replace ( '>' , ' target="_blank" rel="noopener">' ) ;
42
- }
43
- return result ;
44
- } ;
45
- } ) ;
46
- context . articles = articles . map ( ( name ) => {
47
- const markdown = readFileSync ( `articles/${ name } ` , 'utf-8' ) ;
48
- const [ slug ] = name . split ( '.' ) ;
49
- const content = md . render ( markdown ) ;
50
- const { date : dateString , ...meta } = md . meta ;
51
- const date = new Date ( dateString ) ;
52
- const readingTime = ~ ~ ( content . split ( ' ' ) . length / 200 ) ;
53
- return { slug, content, date, readingTime, ...meta } ;
54
- } ) . sort ( ( a , b ) => b . date - a . date ) ;
55
- }
56
-
57
19
prepare ( { page } ) {
58
20
page . locale = 'pt-BR' ;
59
21
}
@@ -70,21 +32,24 @@ class Application extends Nullstack {
70
32
) ;
71
33
}
72
34
73
- render ( { router } ) {
35
+ renderTrackers ( ) {
74
36
return (
75
- < main class = "bg-tips-light" >
76
- < div >
77
- {
78
- router . url . endsWith ( '/curso-fullstack-turbo' ) ? < FacePixelFullStack id = "294337825339805" /> : < FacebookPixel id = "294337825339805" />
79
- }
80
-
81
- {
82
- router . url . endsWith ( '/curso-react-pro' ) ? < FacePixelReact id = "729313284878557" /> : < FacebookPixel id = "294337825339805" />
83
- }
84
- < GoogleAnalytics id = "AW-641358523" />
85
- < GoogleAnalytics id = "UA-120538403-3" />
86
- </ div >
37
+ < >
38
+ < FacebookPixel id = "294337825339805" />
39
+ < GoogleAnalytics id = "UA-120538403-3" />
40
+ < script
41
+ async
42
+ src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7630588299359214"
43
+ crossorigin = "anonymous"
44
+ />
45
+ </ >
46
+ ) ;
47
+ }
87
48
49
+ render ( ) {
50
+ return (
51
+ < main class = "bg-tips-light" >
52
+ < Trackers />
88
53
< Head />
89
54
< Home route = "/" />
90
55
< Articles route = "/artigos" />
@@ -97,12 +62,10 @@ class Application extends Nullstack {
97
62
< MiniCourseClasses route = "/aulas-do-mini-curso" />
98
63
< PageVideoDepo route = "/entrevista-com-aluno" />
99
64
< Article route = "/:slug" />
100
-
101
- < span href = "/curso-react-pro" > </ span >
102
- < span href = "/obrigado-por-entrar-no-mini-curso" > </ span >
103
- < span href = "/aulas-do-mini-curso" > </ span >
104
- < span href = "/entrevista-com-aluno" > </ span >
105
-
65
+ < span href = "/curso-react-pro" />
66
+ < span href = "/obrigado-por-entrar-no-mini-curso" />
67
+ < span href = "/aulas-do-mini-curso" />
68
+ < span href = "/entrevista-com-aluno" />
106
69
</ main >
107
70
) ;
108
71
}
0 commit comments