Skip to content

Commit 99f5725

Browse files
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

+30-27
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

+8-1
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"),

0 commit comments

Comments
 (0)