@@ -10,11 +10,7 @@ import {
1010 DATASOURCE_URL ,
1111 IMPORT_APP_FROM_TEMPLATE_URL ,
1212 INVITE_LANDING_URL ,
13- isAuthUnRequired ,
14- ORG_AUTH_LOGIN_URL ,
15- ORG_AUTH_REGISTER_URL ,
1613 QUERY_LIBRARY_URL ,
17- USER_AUTH_URL ,
1814 ADMIN_APP_URL ,
1915} from "constants/routesURL" ;
2016import React from "react" ;
@@ -30,22 +26,17 @@ import { developEnv } from "util/envUtils";
3026import history from "util/history" ;
3127import LazyRoute from "components/LazyRoute" ;
3228import { getAntdLocale } from "i18n/antdLocale" ;
33- import { ProductLoading } from "components/ProductLoading" ;
3429import { trans } from "i18n" ; // language
3530import { loadComps } from "comps" ;
3631import { initApp } from "util/commonUtils" ;
3732import { favicon } from "assets/images" ;
3833import { hasQueryParam } from "util/urlUtils" ;
3934import { isFetchUserFinished } from "redux/selectors/usersSelectors" ; // getCurrentUser,
4035import { getIsCommonSettingFetched } from "redux/selectors/commonSettingSelectors" ;
41- import { SystemWarning } from "./components/SystemWarning" ;
42- import { getBrandingConfig } from "./redux/selectors/configSelectors" ;
43- import { buildMaterialPreviewURL } from "./util/materialUtils" ;
4436import GlobalInstances from 'components/GlobalInstances' ;
4537// import posthog from 'posthog-js'
4638import { fetchHomeData } from "./redux/reduxActions/applicationActions" ;
4739
48- const LazyUserAuthComp = React . lazy ( ( ) => import ( "pages/userAuth" ) ) ;
4940const LazyInviteLanding = React . lazy ( ( ) => import ( "pages/common/inviteLanding" ) ) ;
5041const LazyComponentDoc = React . lazy ( ( ) => import ( "pages/ComponentDoc" ) ) ;
5142const LazyComponentPlayground = React . lazy ( ( ) => import ( "pages/ComponentPlayground" ) ) ;
@@ -66,20 +57,12 @@ const Wrapper = (props: { children: React.ReactNode, language: string }) => (
6657) ;
6758
6859type AppIndexProps = {
69- isFetchUserFinished : boolean ;
70- getIsCommonSettingFetched : boolean ;
7160 currentOrgId ?: string ;
7261 currentUserId : string ;
7362 currentUserAnonymous : boolean ;
7463 orgDev : boolean ;
7564 defaultHomePage : string | null | undefined ;
76- fetchHomeDataFinished : boolean ;
77- fetchConfig : ( orgId ?: string ) => void ;
78- fetchHomeData : ( currentUserAnonymous ?: boolean | undefined ) => void ;
7965 getCurrentUser : ( ) => void ;
80- favicon : string ;
81- brandName : string ;
82- uiLanguage : string ;
8366} ;
8467
8568class AppIndex extends React . Component < AppIndexProps , any > {
@@ -91,15 +74,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
9174 }
9275
9376 componentDidUpdate ( prevProps : AppIndexProps ) {
94- if (
95- prevProps . currentOrgId !== this . props . currentOrgId &&
96- this . props . currentOrgId !== ''
97- ) {
98- this . props . fetchConfig ( this . props . currentOrgId ) ;
99- if ( ! this . props . currentUserAnonymous ) {
100- this . props . fetchHomeData ( this . props . currentUserAnonymous ) ;
101- }
102- }
10377 }
10478 render ( ) {
10579 const isTemplate = hasQueryParam ( 'template' ) ;
@@ -113,29 +87,14 @@ class AppIndex extends React.Component<AppIndexProps, any> {
11387 posthog.init('phc_lD36OXeppUehLgI33YFhioTpXqThZ5QqR8IWeKvXP7f', { api_host: 'https://eu.i.posthog.com', person_profiles: 'always' });
11488 } */
11589
116- // make sure all users in this app have checked login info
117- if ( ! this . props . isFetchUserFinished || ( this . props . currentUserId && ! this . props . fetchHomeDataFinished ) ) {
118- const hideLoadingHeader = isTemplate || isAuthUnRequired ( pathname ) ;
119- return < ProductLoading hideHeader = { hideLoadingHeader } /> ;
120- }
121- else {
122- // if the user just logged in, we send the event to posthog
123- if ( isLocalhost || isLowCoderDomain ) {
124- if ( sessionStorage . getItem ( '_just_logged_in_' ) ) {
125- // posthog.identify(this.props.currentUserId);
126- sessionStorage . removeItem ( '_just_logged_in_' ) ;
127- }
128- }
129- }
130-
13190 // persisting the language in local storage
132- localStorage . setItem ( 'lowcoder_uiLanguage' , this . props . uiLanguage ) ;
91+ localStorage . setItem ( 'lowcoder_uiLanguage' , "en_US" ) ;
13392
13493 return (
135- < Wrapper language = { this . props . uiLanguage } >
94+ < Wrapper language = "en_US" >
13695 < Helmet >
137- { < title > { this . props . brandName } </ title > }
138- { < link rel = "icon" href = { this . props . favicon } /> }
96+ { < title > Lowcoder </ title > }
97+ { < link rel = "icon" href = "" /> }
13998 < meta name = "description" content = { trans ( 'productDesc' ) } />
14099 < meta
141100 name = "keywords"
@@ -147,7 +106,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
147106 < meta
148107 key = "og:title"
149108 property = "og:title"
150- content = { this . props . brandName }
109+ content = "Lowcoder"
151110 />
152111 < meta
153112 key = "og:description"
@@ -170,7 +129,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
170129 < meta
171130 key = "twitter:title"
172131 name = "twitter:title"
173- content = { this . props . brandName }
132+ content = "Lowcoder"
174133 />
175134 < meta
176135 key = "twitter:description"
@@ -208,7 +167,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
208167 < meta
209168 key = "apple-mobile-web-app-title"
210169 name = "apple-mobile-web-app-title"
211- content = { this . props . brandName }
170+ content = "Lowcoder"
212171 />
213172 < link
214173 key = "apple-touch-icon"
@@ -224,7 +183,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
224183 < meta
225184 key = "application-name"
226185 name = "application-name"
227- content = { this . props . brandName }
186+ content = "Lowcoder"
228187 />
229188 < meta
230189 key = "msapplication-TileColor"
@@ -244,7 +203,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
244203 < meta
245204 key = "iframely:title"
246205 property = "iframely:title"
247- content = { this . props . brandName }
206+ content = "Lowcoder"
248207 /> ,
249208 < meta
250209 key = "iframely:description"
@@ -284,23 +243,13 @@ class AppIndex extends React.Component<AppIndexProps, any> {
284243 > </ script > ,
285244 ] }
286245 </ Helmet >
287- < SystemWarning />
288246 < Router history = { history } >
289247 < Switch >
290248 < LazyRoute
291249 fallback = "layout"
292250 path = { APP_EDITOR_URL }
293251 component = { LazyAppEditor }
294252 />
295- < LazyRoute path = { USER_AUTH_URL } component = { LazyUserAuthComp } />
296- < LazyRoute
297- path = { ORG_AUTH_LOGIN_URL }
298- component = { LazyUserAuthComp }
299- />
300- < LazyRoute
301- path = { ORG_AUTH_REGISTER_URL }
302- component = { LazyUserAuthComp }
303- />
304253 < LazyRoute
305254 path = { INVITE_LANDING_URL }
306255 component = { LazyInviteLanding }
@@ -332,30 +281,19 @@ class AppIndex extends React.Component<AppIndexProps, any> {
332281}
333282
334283const mapStateToProps = ( state : AppState ) => ( {
335- isFetchUserFinished : isFetchUserFinished ( state ) ,
336- getIsCommonSettingFetched : getIsCommonSettingFetched ( state ) ,
337284 orgDev : state . ui . users . user . orgDev ,
338285 currentUserId : state . ui . users . currentUser . id ,
339286 currentUserAnonymous : state . ui . users . currentUser . name === "ANONYMOUS" ,
340287 currentOrgId : state . ui . users . user . currentOrgId ,
341288 defaultHomePage : state . ui . application . homeOrg ?. commonSettings . defaultHomePage ,
342289 fetchHomeDataFinished : Boolean ( state . ui . application . homeOrg ?. commonSettings ) ,
343- favicon : getBrandingConfig ( state ) ?. favicon
344- ? buildMaterialPreviewURL ( getBrandingConfig ( state ) ?. favicon ! )
345- : favicon ,
346- brandName : getBrandingConfig ( state ) ?. brandName ?? trans ( "productName" ) ,
347290 uiLanguage : state . ui . users . user . uiLanguage ,
348291} ) ;
349292
350293const mapDispatchToProps = ( dispatch : any ) => ( {
351294 getCurrentUser : ( ) => {
352295 dispatch ( fetchUserAction ( ) ) ;
353296 } ,
354- fetchConfig : ( orgId ?: string ) => dispatch ( fetchConfigAction ( orgId ) ) ,
355-
356- fetchHomeData : ( currentUserAnonymous : boolean | undefined ) => {
357- dispatch ( fetchHomeData ( { } ) ) ;
358- }
359297} ) ;
360298
361299const AppIndexWithProps = connect ( mapStateToProps , mapDispatchToProps ) ( AppIndex ) ;
0 commit comments