@@ -8,10 +8,9 @@ import {
8
8
MARKETPLACE_URL ,
9
9
MODULE_APPLICATIONS_URL ,
10
10
QUERY_LIBRARY_URL ,
11
- SETTING ,
12
- SUPPORT ,
11
+ SETTING_URL ,
12
+ SUPPORT_URL ,
13
13
TRASH_URL ,
14
- // ADMIN_APP_URL,
15
14
NEWS_URL ,
16
15
ORG_HOME_URL ,
17
16
} from "constants/routesURL" ;
@@ -47,7 +46,6 @@ import { Layout } from "../../components/layout/Layout";
47
46
import { HomeView } from "./HomeView" ;
48
47
import { UserProfileView } from "./UserProfileView" ;
49
48
import { NewsView } from "./NewsView" ;
50
- // import { ApiDocView } from "./ApiDocView";
51
49
import { OrgView } from "./OrgView" ;
52
50
import styled , { css } from "styled-components" ;
53
51
import history from "../../util/history" ;
@@ -66,10 +64,11 @@ import Setting from "pages/setting";
66
64
import { TypographyText } from "../../components/TypographyText" ;
67
65
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances" ;
68
66
import { isEE } from "util/envUtils" ;
69
- import { checkSubscriptions , SubscriptionProducts } from "@lowcoder-ee/api/subscriptionApi" ;
67
+ import { CheckSubscriptions , SubscriptionProducts , Subscription } from "@lowcoder-ee/api/subscriptionApi" ;
70
68
71
69
// adding App Editor, so we can show Apps inside the Admin Area
72
70
import AppEditor from "../editor/AppEditor" ;
71
+ import { set } from "lodash" ;
73
72
74
73
const TabLabel = styled . div `
75
74
font-weight: 500;
@@ -237,32 +236,22 @@ export default function ApplicationHome() {
237
236
const allFoldersCount = allFolders . length ;
238
237
const orgHomeId = "root" ;
239
238
const isSelfHost = window . location . host !== 'app.lowcoder.cloud' ;
240
-
241
- const subscriptions = useSelector ( state => state . subscriptions . subscriptions ) ;
242
- const subscriptionDataLoaded = useSelector ( state => ! state . subscriptions . loading ) ;
243
- const subscriptionDataError = useSelector ( state => state . subscriptions . error ) ;
239
+ const [ supportSubscription , setSupportSubscription ] = useState ( true ) ;
244
240
245
241
// const handleFolderCreate = useCreateFolder();
246
-
247
- const isOrgAdmin = org ?. createdBy == user . id ? true : false ;
248
-
249
- // Fetch subscriptions once on component mount
250
- useEffect ( ( ) => {
251
- dispatch ( checkSubscriptions ( ) ) ;
252
- } , [ dispatch ] ) ;
253
242
254
- // Calculate support subscription status
255
- const supportSubscription = useMemo ( ( ) => {
256
- return subscriptions . some ( ( sub : { product : SubscriptionProducts ; } ) => sub . product === SubscriptionProducts . SUPPORT ) ;
257
- } , [ subscriptions ] ) ;
243
+ // we also want to check the subscription
244
+ /* const { subscriptions: subscriptionData, subscriptionDataLoaded, subscriptionDataError } = dispatch(CheckSubscriptions());
258
245
259
- // Early return if data is still loading or there was an error
260
- if ( fetchingUser || ! subscriptionDataLoaded || subscriptionDataError ) {
261
- return < ProductLoading /> ;
262
- }
246
+ if (subscriptionDataLoaded && !subscriptionDataError) {
247
+ setSupportSubscription(subscriptionData.some(sub => sub.product === SubscriptionProducts.SUPPORT));
248
+ } */
249
+
250
+ const isOrgAdmin = org ?. createdBy == user . id ? true : false ;
263
251
264
252
useEffect ( ( ) => {
265
253
dispatch ( fetchHomeData ( { } ) ) ;
254
+
266
255
} , [ user . currentOrgId ] ) ;
267
256
268
257
useEffect ( ( ) => {
@@ -296,10 +285,6 @@ export default function ApplicationHome() {
296
285
return < ProductLoading /> ;
297
286
}
298
287
299
- if ( fetchingUser || ! isPreloadCompleted || ! subscriptionDataLoaded || subscriptionDataError ) {
300
- return < ProductLoading /> ;
301
- }
302
-
303
288
return (
304
289
< DivStyled >
305
290
< Layout
@@ -392,10 +377,10 @@ export default function ApplicationHome() {
392
377
supportSubscription ? {
393
378
items : [
394
379
{
395
- text : < TabLabel > { trans ( "home.trash " ) } </ TabLabel > ,
396
- routePath : TRASH_URL ,
380
+ text : < TabLabel > { trans ( "home.support " ) } </ TabLabel > ,
381
+ routePath : SUPPORT_URL ,
397
382
routeComp : TrashView ,
398
- icon : ( { selected, ...otherProps } ) => selected ? < RecyclerIcon { ...otherProps } width = { "24px" } /> : < RecyclerIcon { ...otherProps } width = { "24px" } /> ,
383
+ icon : ( { selected, ...otherProps } ) => selected ? < SupportIcon { ...otherProps } width = { "24px" } /> : < SupportIcon { ...otherProps } width = { "24px" } /> ,
399
384
} ,
400
385
] ,
401
386
} : { items : [ ] } ,
@@ -404,7 +389,7 @@ export default function ApplicationHome() {
404
389
items : [
405
390
{
406
391
text : < TabLabel > { trans ( "settings.title" ) } </ TabLabel > ,
407
- routePath : SETTING ,
392
+ routePath : SETTING_URL ,
408
393
routePathExact : false ,
409
394
routeComp : Setting ,
410
395
icon : ( { selected, ...otherProps } ) => selected ? < HomeSettingIcon { ...otherProps } width = { "24px" } /> : < HomeSettingIcon { ...otherProps } width = { "24px" } /> ,
0 commit comments