@@ -3,25 +3,20 @@ import { Store } from './api/store';
33import { StrapiClient } from './api/api.strapi' ;
44import {
55 Container ,
6- Title ,
7- Image ,
86 Text ,
9- Stack ,
10- Paper ,
11- Group ,
12- Button ,
137 MantineProvider ,
148 Skeleton
159} from '@mantine/core' ;
16- import { IconWorld } from '@tabler/icons-react' ;
17- import ReactMarkdown from 'react-markdown' ;
1810import '@mantine/core/styles.css' ;
1911import './styles/blocks.scss' ;
2012import { Page } from './api/page' ;
21- import PageContent from './components/page.content' ;
2213import config from './config' ;
2314import { PostHogProvider } from 'posthog-js/react'
2415
16+ import HomePage from './components/home.page' ;
17+
18+ const POSTHOG_API_KEY = process . env . REACT_APP_POSTHOG_KEY as string ;
19+
2520/**
2621 * Landing page component
2722 * - Displays store basics, and home page content
@@ -81,67 +76,21 @@ function App() {
8176 ) ;
8277 }
8378
79+ if ( POSTHOG_API_KEY ) {
80+ return (
81+ < PostHogProvider apiKey = { POSTHOG_API_KEY } >
82+ < MantineProvider >
83+ < HomePage homePage = { homePage } store = { store } />
84+ </ MantineProvider >
85+ </ PostHogProvider >
86+ ) ;
87+ }
88+
8489 return (
8590 < MantineProvider >
86- < PostHogProvider apiKey = { process . env . REACT_APP_POSTHOG_KEY as string } >
87- < >
88- < Container size = "md" py = "xl" id = { window . location . hash ?. replace ( '#' , '' ) } >
89- < Paper shadow = "md" radius = "md" p = "xl" mb = "xl" >
90- < Stack align = "center" >
91- { store . Logo && (
92- < Image
93- src = { store . Logo . formats ?. small ?. url || store . Logo . url }
94- alt = { store . title }
95- width = { 200 }
96- height = { 200 }
97- fit = "contain"
98- />
99- ) }
100-
101- < Title order = { 1 } >
102- { store . title }
103- </ Title >
104-
105- { store . Description && (
106- < div className = "blocks-content" >
107- < ReactMarkdown >
108- { store . Description }
109- </ ReactMarkdown >
110- </ div >
111- ) }
112-
113- { store . URLS && store . URLS . length > 0 && (
114- < Group mt = "md" >
115- { store . URLS . map ( ( url ) => (
116- < Button
117- key = { url . id }
118- component = "a"
119- href = { url . URL }
120- target = "_blank"
121- variant = "light"
122- >
123- < IconWorld size = { 18 } /> { ` ` }
124- { url . Label }
125- </ Button >
126- ) ) }
127- </ Group >
128- ) }
129- </ Stack >
130- </ Paper >
131-
132- </ Container >
133-
134- < Container >
135- < div className = "blocks-content" >
136- { homePage && (
137- < PageContent params = { { page : homePage } } />
138- ) }
139- </ div >
140- </ Container >
141- </ >
142- </ PostHogProvider >
143- </ MantineProvider >
144- ) ;
145- }
91+ < HomePage homePage = { homePage } store = { store } />
92+ </ MantineProvider >
93+ )
94+ } ;
14695
14796export default App ;
0 commit comments