Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 99f5725

Browse files
committedApr 18, 2025·
allow media pack subscribers to use icon scout assets
1 parent 4b50843 commit 99f5725

File tree

3 files changed

+194
-187
lines changed

3 files changed

+194
-187
lines changed
 

‎client/packages/lowcoder/src/app.tsx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import GlobalInstances from 'components/GlobalInstances';
6060
import { fetchHomeData, fetchServerSettingsAction } from "./redux/reduxActions/applicationActions";
6161
import { getNpmPackageMeta } from "./comps/utils/remote";
6262
import { packageMetaReadyAction, setLowcoderCompsLoading } from "./redux/reduxActions/npmPluginActions";
63+
import { SimpleSubscriptionContextProvider } from "./util/context/SimpleSubscriptionContext";
6364

6465
const LazyUserAuthComp = React.lazy(() => import("pages/userAuth"));
6566
const LazyInviteLanding = React.lazy(() => import("pages/common/inviteLanding"));
@@ -310,33 +311,35 @@ class AppIndex extends React.Component<AppIndexProps, any> {
310311
component={LazyPublicAppEditor}
311312
/>
312313

313-
<LazyRoute
314-
fallback="layout"
315-
path={APP_EDITOR_URL}
316-
component={LazyAppEditor}
317-
/>
318-
<LazyRoute
319-
fallback="layout"
320-
path={[
321-
USER_PROFILE_URL,
322-
NEWS_URL,
323-
ORG_HOME_URL,
324-
ALL_APPLICATIONS_URL,
325-
DATASOURCE_CREATE_URL,
326-
DATASOURCE_EDIT_URL,
327-
DATASOURCE_URL,
328-
SUPPORT_URL,
329-
QUERY_LIBRARY_URL,
330-
FOLDERS_URL,
331-
FOLDER_URL,
332-
TRASH_URL,
333-
SETTING_URL,
334-
MARKETPLACE_URL,
335-
ADMIN_APP_URL
336-
]}
337-
// component={ApplicationListPage}
338-
component={LazyApplicationHome}
339-
/>
314+
<SimpleSubscriptionContextProvider>
315+
<LazyRoute
316+
fallback="layout"
317+
path={APP_EDITOR_URL}
318+
component={LazyAppEditor}
319+
/>
320+
<LazyRoute
321+
fallback="layout"
322+
path={[
323+
USER_PROFILE_URL,
324+
NEWS_URL,
325+
ORG_HOME_URL,
326+
ALL_APPLICATIONS_URL,
327+
DATASOURCE_CREATE_URL,
328+
DATASOURCE_EDIT_URL,
329+
DATASOURCE_URL,
330+
SUPPORT_URL,
331+
QUERY_LIBRARY_URL,
332+
FOLDERS_URL,
333+
FOLDER_URL,
334+
TRASH_URL,
335+
SETTING_URL,
336+
MARKETPLACE_URL,
337+
ADMIN_APP_URL
338+
]}
339+
// component={ApplicationListPage}
340+
component={LazyApplicationHome}
341+
/>
342+
</SimpleSubscriptionContextProvider>
340343
<LazyRoute exact path={ADMIN_AUTH_URL} component={LazyUserAuthComp} />
341344
<LazyRoute path={USER_AUTH_URL} component={LazyUserAuthComp} />
342345
<LazyRoute

‎client/packages/lowcoder/src/comps/controls/iconscoutControl.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import LoadingOutlined from "@ant-design/icons/LoadingOutlined";
3030
import Badge from "antd/es/badge";
3131
import { CrownFilled } from "@ant-design/icons";
3232
import { SUBSCRIPTION_SETTING } from "@lowcoder-ee/constants/routesURL";
33+
import { useSimpleSubscriptionContext } from "@lowcoder-ee/util/context/SimpleSubscriptionContext";
34+
import { SubscriptionProductsEnum } from "@lowcoder-ee/constants/subscriptionConstants";
3335

3436
const ButtonWrapper = styled.div`
3537
width: 100%;
@@ -227,6 +229,11 @@ export const IconPicker = (props: {
227229
const [ downloading, setDownloading ] = useState(false)
228230
const [ searchText, setSearchText ] = useState<string>('')
229231
const [ searchResults, setSearchResults ] = useState<Array<any>>([]);
232+
const { subscriptions } = useSimpleSubscriptionContext();
233+
234+
const mediaPackSubscription = subscriptions.find(
235+
sub => sub.product === SubscriptionProductsEnum.MEDIAPACKAGE && sub.status === 'active'
236+
);
230237

231238
const onChangeRef = useRef(props.onChange);
232239
onChangeRef.current = props.onChange;
@@ -319,7 +326,7 @@ export const IconPicker = (props: {
319326
onClick={() => {
320327
// check if premium content then show subscription popup
321328
// TODO: if user has subscription then skip this if block
322-
if (icon.price !== 0) {
329+
if (!mediaPackSubscription) {
323330
CustomModal.confirm({
324331
title: trans("iconScout.buySubscriptionTitle"),
325332
content: trans("iconScout.buySubscriptionContent"),

‎client/packages/lowcoder/src/pages/ApplicationV2/index.tsx

Lines changed: 156 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ import { SubscriptionProductsEnum } from '@lowcoder-ee/constants/subscriptionCon
6969
import AppEditor from "../editor/AppEditor";
7070
import { fetchDeploymentIdAction } from "@lowcoder-ee/redux/reduxActions/configActions";
7171
import { getDeploymentId } from "@lowcoder-ee/redux/selectors/configSelectors";
72-
import { SimpleSubscriptionContextProvider } from '@lowcoder-ee/util/context/SimpleSubscriptionContext';
7372
import {LoadingBarHideTrigger} from "@lowcoder-ee/util/hideLoading";
7473

7574
const TabLabel = styled.div`
@@ -154,171 +153,169 @@ export default function ApplicationHome() {
154153
return (
155154
<DivStyled>
156155
<LoadingBarHideTrigger />
157-
<SimpleSubscriptionContextProvider>
158-
<Layout
159-
sections={[
160-
{
161-
items: [
162-
{
163-
text: <TabLabel>{trans("home.profile")}</TabLabel>,
164-
routePath: USER_PROFILE_URL,
165-
routeComp: UserProfileView,
166-
icon: ({ selected, ...otherProps }) => selected ? <UserIcon {...otherProps} width={"24px"}/> : <UserIcon {...otherProps} width={"24px"}/>,
167-
mobileVisible: true,
168-
},
169-
{
170-
text: <TabLabel>{trans("home.news")}</TabLabel>,
171-
routePath: NEWS_URL,
172-
routeComp: NewsView,
173-
icon: ({ selected, ...otherProps }) => selected ? <NewsIcon {...otherProps} width={"24px"}/> : <NewsIcon {...otherProps} width={"24px"}/>,
174-
visible: ({ user }) => user.orgDev,
175-
style: { color: "red" },
176-
mobileVisible: false,
177-
},
178-
{
179-
text: <TabLabel>{trans("home.orgHome")}</TabLabel>,
180-
routePath: ORG_HOME_URL,
181-
routePathExact: false,
182-
routeComp: OrgView,
183-
icon: ({ selected, ...otherProps }) => selected ? <WorkspacesIcon {...otherProps} width={"24px"}/> : <WorkspacesIcon {...otherProps} width={"24px"}/>,
184-
visible: ({ user }) => !user.orgDev,
185-
mobileVisible: true,
186-
},
187-
{
188-
text: <TabLabel>{trans("home.marketplace")}</TabLabel>,
189-
routePath: MARKETPLACE_URL,
190-
routePathExact: false,
191-
routeComp: MarketplaceView,
192-
icon: ({ selected, ...otherProps }) => selected ? <MarketplaceIcon {...otherProps} width={"24px"}/> : <MarketplaceIcon {...otherProps} width={"24px"}/>,
193-
mobileVisible: false,
194-
},
195-
]
196-
},
156+
<Layout
157+
sections={[
158+
{
159+
items: [
160+
{
161+
text: <TabLabel>{trans("home.profile")}</TabLabel>,
162+
routePath: USER_PROFILE_URL,
163+
routeComp: UserProfileView,
164+
icon: ({ selected, ...otherProps }) => selected ? <UserIcon {...otherProps} width={"24px"}/> : <UserIcon {...otherProps} width={"24px"}/>,
165+
mobileVisible: true,
166+
},
167+
{
168+
text: <TabLabel>{trans("home.news")}</TabLabel>,
169+
routePath: NEWS_URL,
170+
routeComp: NewsView,
171+
icon: ({ selected, ...otherProps }) => selected ? <NewsIcon {...otherProps} width={"24px"}/> : <NewsIcon {...otherProps} width={"24px"}/>,
172+
visible: ({ user }) => user.orgDev,
173+
style: { color: "red" },
174+
mobileVisible: false,
175+
},
176+
{
177+
text: <TabLabel>{trans("home.orgHome")}</TabLabel>,
178+
routePath: ORG_HOME_URL,
179+
routePathExact: false,
180+
routeComp: OrgView,
181+
icon: ({ selected, ...otherProps }) => selected ? <WorkspacesIcon {...otherProps} width={"24px"}/> : <WorkspacesIcon {...otherProps} width={"24px"}/>,
182+
visible: ({ user }) => !user.orgDev,
183+
mobileVisible: true,
184+
},
185+
{
186+
text: <TabLabel>{trans("home.marketplace")}</TabLabel>,
187+
routePath: MARKETPLACE_URL,
188+
routePathExact: false,
189+
routeComp: MarketplaceView,
190+
icon: ({ selected, ...otherProps }) => selected ? <MarketplaceIcon {...otherProps} width={"24px"}/> : <MarketplaceIcon {...otherProps} width={"24px"}/>,
191+
mobileVisible: false,
192+
},
193+
]
194+
},
197195

198-
{
199-
items: [
200-
// {
201-
// text: <MoreFoldersWrapper>{trans("home.allFolders")}</MoreFoldersWrapper>,
202-
// routePath: FOLDERS_URL,
203-
// routeComp: RootFolderListView,
204-
// icon: ({ selected, ...otherProps }) => selected ? <FolderIcon {...otherProps} width={"24px"}/> : <FolderIcon {...otherProps} width={"24px"}/>,
205-
// },
206-
{
207-
text: <TabLabel>{trans("home.allApplications")}</TabLabel>,
208-
routePath: ALL_APPLICATIONS_URL,
209-
routeComp: HomeView,
210-
icon: ({ selected, ...otherProps }) => selected ? <AppsIcon {...otherProps} width={"24px"}/> : <AppsIcon {...otherProps} width={"24px"}/>,
211-
mobileVisible: true,
212-
},
213-
],
214-
},
215-
216-
{
217-
items: [
218-
219-
{
220-
text: <TabLabel>{trans("home.queryLibrary")}</TabLabel>,
221-
routePath: QUERY_LIBRARY_URL,
222-
routeComp: QueryLibraryEditor,
223-
icon: ({ selected, ...otherProps }) => selected ? <HomeQueryLibraryIcon {...otherProps} width={"24px"}/> : <HomeQueryLibraryIcon {...otherProps} width={"24px"}/>,
224-
visible: ({ user }) => user.orgDev,
225-
mobileVisible: false,
226-
},
227-
{
228-
text: <TabLabel>{trans("home.datasource")}</TabLabel>,
229-
routePath: DATASOURCE_URL,
230-
routePathExact: false,
231-
routeComp: DatasourceHome,
232-
icon: ({ selected, ...otherProps }) => selected ? <HomeDataSourceIcon {...otherProps} width={"24px"}/> : <HomeDataSourceIcon {...otherProps} width={"24px"}/>,
233-
visible: ({ user }) => user.orgDev,
234-
onSelected: (_, currentPath) => currentPath.split("/")[1] === "datasource",
235-
mobileVisible: false,
236-
},
237-
],
238-
},
239-
isEE() ? {
240-
items: [
241-
{
242-
text: <TabLabel>{trans("settings.AppUsage")}</TabLabel>,
243-
routePath: "/ee/6600ae8724a23f365ba2ed4c/admin",
244-
routePathExact: false,
245-
routeComp: AppEditor,
246-
icon: ({ selected, ...otherProps }) => selected ? ( <EnterpriseIcon {...otherProps} width={"24px"}/> ) : ( <EnterpriseIcon {...otherProps} width={"24px"}/> ),
247-
visible: ({ user }) => user.orgDev,
248-
mobileVisible: false,
249-
},
250-
],
251-
} : { items: [] },
196+
{
197+
items: [
198+
// {
199+
// text: <MoreFoldersWrapper>{trans("home.allFolders")}</MoreFoldersWrapper>,
200+
// routePath: FOLDERS_URL,
201+
// routeComp: RootFolderListView,
202+
// icon: ({ selected, ...otherProps }) => selected ? <FolderIcon {...otherProps} width={"24px"}/> : <FolderIcon {...otherProps} width={"24px"}/>,
203+
// },
204+
{
205+
text: <TabLabel>{trans("home.allApplications")}</TabLabel>,
206+
routePath: ALL_APPLICATIONS_URL,
207+
routeComp: HomeView,
208+
icon: ({ selected, ...otherProps }) => selected ? <AppsIcon {...otherProps} width={"24px"}/> : <AppsIcon {...otherProps} width={"24px"}/>,
209+
mobileVisible: true,
210+
},
211+
],
212+
},
213+
214+
{
215+
items: [
216+
217+
{
218+
text: <TabLabel>{trans("home.queryLibrary")}</TabLabel>,
219+
routePath: QUERY_LIBRARY_URL,
220+
routeComp: QueryLibraryEditor,
221+
icon: ({ selected, ...otherProps }) => selected ? <HomeQueryLibraryIcon {...otherProps} width={"24px"}/> : <HomeQueryLibraryIcon {...otherProps} width={"24px"}/>,
222+
visible: ({ user }) => user.orgDev,
223+
mobileVisible: false,
224+
},
225+
{
226+
text: <TabLabel>{trans("home.datasource")}</TabLabel>,
227+
routePath: DATASOURCE_URL,
228+
routePathExact: false,
229+
routeComp: DatasourceHome,
230+
icon: ({ selected, ...otherProps }) => selected ? <HomeDataSourceIcon {...otherProps} width={"24px"}/> : <HomeDataSourceIcon {...otherProps} width={"24px"}/>,
231+
visible: ({ user }) => user.orgDev,
232+
onSelected: (_, currentPath) => currentPath.split("/")[1] === "datasource",
233+
mobileVisible: false,
234+
},
235+
],
236+
},
237+
isEE() ? {
238+
items: [
239+
{
240+
text: <TabLabel>{trans("settings.AppUsage")}</TabLabel>,
241+
routePath: "/ee/6600ae8724a23f365ba2ed4c/admin",
242+
routePathExact: false,
243+
routeComp: AppEditor,
244+
icon: ({ selected, ...otherProps }) => selected ? ( <EnterpriseIcon {...otherProps} width={"24px"}/> ) : ( <EnterpriseIcon {...otherProps} width={"24px"}/> ),
245+
visible: ({ user }) => user.orgDev,
246+
mobileVisible: false,
247+
},
248+
],
249+
} : { items: [] },
252250

253-
!supportSubscription && user.orgDev ? {
254-
items: [
255-
{
256-
text: <TabLabel>{trans("home.support")}</TabLabel>,
257-
routePath: SUBSCRIPTION_SETTING,
258-
routeComp: Subscription,
259-
routePathExact: false,
260-
icon: ({ selected, ...otherProps }) => selected ? <SupportIcon {...otherProps} width={"24px"}/> : <SupportIcon {...otherProps} width={"24px"}/>,
261-
mobileVisible: true,
262-
},
263-
],
264-
} : { items: [] },
251+
!supportSubscription && user.orgDev ? {
252+
items: [
253+
{
254+
text: <TabLabel>{trans("home.support")}</TabLabel>,
255+
routePath: SUBSCRIPTION_SETTING,
256+
routeComp: Subscription,
257+
routePathExact: false,
258+
icon: ({ selected, ...otherProps }) => selected ? <SupportIcon {...otherProps} width={"24px"}/> : <SupportIcon {...otherProps} width={"24px"}/>,
259+
mobileVisible: true,
260+
},
261+
],
262+
} : { items: [] },
265263

266-
supportSubscription && user.orgDev ? {
267-
items: [
268-
{
269-
text: <TabLabel>{trans("home.support")}</TabLabel>,
270-
routePath: SUPPORT_URL,
271-
routeComp: Support,
272-
routePathExact: false,
273-
icon: ({ selected, ...otherProps }) => selected ? <SupportIcon {...otherProps} width={"24px"}/> : <SupportIcon {...otherProps} width={"24px"}/>,
274-
mobileVisible: true,
275-
},
276-
],
277-
} : { items: [] },
264+
supportSubscription && user.orgDev ? {
265+
items: [
266+
{
267+
text: <TabLabel>{trans("home.support")}</TabLabel>,
268+
routePath: SUPPORT_URL,
269+
routeComp: Support,
270+
routePathExact: false,
271+
icon: ({ selected, ...otherProps }) => selected ? <SupportIcon {...otherProps} width={"24px"}/> : <SupportIcon {...otherProps} width={"24px"}/>,
272+
mobileVisible: true,
273+
},
274+
],
275+
} : { items: [] },
278276

279-
{
280-
items: [
281-
{
282-
text: <TabLabel>{trans("settings.title")}</TabLabel>,
283-
routePath: SETTING_URL,
284-
routePathExact: false,
285-
routeComp: Setting,
286-
icon: ({ selected, ...otherProps }) => selected ? <HomeSettingIcon {...otherProps} width={"24px"}/> : <HomeSettingIcon {...otherProps} width={"24px"}/>,
287-
visible: ({ user }) => user.orgDev,
288-
onSelected: (_, currentPath) => currentPath.split("/")[1] === "setting",
289-
mobileVisible: false,
290-
}
291-
]
292-
},
277+
{
278+
items: [
279+
{
280+
text: <TabLabel>{trans("settings.title")}</TabLabel>,
281+
routePath: SETTING_URL,
282+
routePathExact: false,
283+
routeComp: Setting,
284+
icon: ({ selected, ...otherProps }) => selected ? <HomeSettingIcon {...otherProps} width={"24px"}/> : <HomeSettingIcon {...otherProps} width={"24px"}/>,
285+
visible: ({ user }) => user.orgDev,
286+
onSelected: (_, currentPath) => currentPath.split("/")[1] === "setting",
287+
mobileVisible: false,
288+
}
289+
]
290+
},
293291

294-
{
295-
items: [
296-
{
297-
text: <TabLabel>{trans("home.trash")}</TabLabel>,
298-
routePath: TRASH_URL,
299-
routeComp: TrashView,
300-
icon: ({ selected, ...otherProps }) => selected ? <RecyclerIcon {...otherProps} width={"24px"}/> : <RecyclerIcon {...otherProps} width={"24px"}/>,
301-
visible: ({ user }) => user.orgDev,
302-
mobileVisible: false,
303-
},
304-
],
305-
},
292+
{
293+
items: [
294+
{
295+
text: <TabLabel>{trans("home.trash")}</TabLabel>,
296+
routePath: TRASH_URL,
297+
routeComp: TrashView,
298+
icon: ({ selected, ...otherProps }) => selected ? <RecyclerIcon {...otherProps} width={"24px"}/> : <RecyclerIcon {...otherProps} width={"24px"}/>,
299+
visible: ({ user }) => user.orgDev,
300+
mobileVisible: false,
301+
},
302+
],
303+
},
306304

307-
// this we need to show the Folders view in the Admin Area
308-
{
309-
items: [
310-
{
311-
text: "",
312-
routePath: FOLDER_URL,
313-
routeComp: FolderView,
314-
visible: () => false,
315-
}
316-
]
317-
}
305+
// this we need to show the Folders view in the Admin Area
306+
{
307+
items: [
308+
{
309+
text: "",
310+
routePath: FOLDER_URL,
311+
routeComp: FolderView,
312+
visible: () => false,
313+
}
314+
]
315+
}
318316

319-
]}
320-
/>
321-
</SimpleSubscriptionContextProvider>
317+
]}
318+
/>
322319
</DivStyled>
323320
);
324321
}

0 commit comments

Comments
 (0)
Please sign in to comment.