Skip to content

Commit 4c8be4b

Browse files
authored
Merge pull request lowcoder-org#712 from lowcoder-org/dev
Display Fix for Marketplaces
2 parents 0a4fd6c + 3320fe2 commit 4c8be4b

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

client/packages/lowcoder/src/pages/ApplicationV2/HomeLayout.tsx

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { isFetchingFolderElements } from "../../redux/selectors/folderSelector";
3434
import { checkIsMobile } from "util/commonUtils";
3535
import MarketplaceHeaderImage from "assets/images/marketplaceHeaderImage.jpg";
3636
import { Divider } from "antd";
37-
import { Margin } from "../setting/theme/styledComponents";
37+
import { Margin } from "../setting/theme/styledComponents";
3838

3939
const Wrapper = styled.div`
4040
display: flex;
@@ -239,6 +239,7 @@ const LayoutSwitcher = styled.div`
239239
}
240240
`;
241241

242+
242243
function showNewUserGuide(user: User) {
243244
return (
244245
user.orgDev &&
@@ -278,7 +279,7 @@ export function HomeLayout(props: HomeLayoutProps) {
278279
const { breadcrumb = [], elements = [], localMarketplaceApps = [], globalMarketplaceApps = [],mode } = props;
279280
const user = useSelector(getUser);
280281
const isFetching = useSelector(isFetchingFolderElements);
281-
282+
const isSelfHost = window.location.host !== 'app.lowcoder.cloud';
282283
const [filterBy, setFilterBy] = useState<HomeResKey>("All");
283284
const [searchValue, setSearchValue] = useState("");
284285
const [layout, setLayout] = useState<HomeLayoutType>(
@@ -294,14 +295,16 @@ export function HomeLayout(props: HomeLayoutProps) {
294295
}
295296

296297
var displayElements = elements;
297-
if (mode === "marketplace") {
298+
if (mode === "marketplace" && isSelfHost) {
298299
const markedLocalApps = localMarketplaceApps.map(app => ({ ...app, isLocalMarketplace: true }));
299300
const markedGlobalApps = globalMarketplaceApps.map(app => ({ ...app, isLocalMarketplace: false }));
300301
// Merge local and global apps into the elements array
301302
displayElements = [...markedLocalApps, ...markedGlobalApps];
302303
}
303-
304-
console.log("HomeLayout: displayElements", displayElements);
304+
else if (mode === "marketplace") {
305+
const markedLocalApps = localMarketplaceApps.map(app => ({ ...app, isLocalMarketplace: true }));
306+
displayElements = [...markedLocalApps];
307+
}
305308

306309
const resList: HomeRes[] = displayElements
307310
.filter((e) =>
@@ -454,19 +457,37 @@ export function HomeLayout(props: HomeLayoutProps) {
454457
<>
455458
{layout === "list" ? (
456459
<>
457-
<h2 style={{padding: "0 36px"}}>{trans("home.localMarketplaceTitle")}</h2>
458-
<HomeTableView resources={resList.filter(app => app.isLocalMarketplace)} />
459-
<Divider style={{padding: "0 36px", margin: "0 36px", width: "calc(100% - 72px) !important"}}/>
460-
<h2 style={{padding: "0 36px"}}>{trans("home.globalMarketplaceTitle")}</h2>
461-
<HomeTableView resources={resList.filter(app => !app.isLocalMarketplace)} />
460+
{isSelfHost ? (
461+
<>
462+
<h2 style={{ padding: "0 36px" }}>{trans("home.localMarketplaceTitle")}</h2>
463+
<HomeTableView resources={resList.filter(app => app.isLocalMarketplace)} />
464+
<Divider style={{ padding: "0 36px", margin: "0 36px", width: "calc(100% - 72px) !important" }} />
465+
<h2 style={{ padding: "0 36px" }}>{trans("home.globalMarketplaceTitle")}</h2>
466+
<HomeTableView resources={resList.filter(app => !app.isLocalMarketplace)} />
467+
</>
468+
) : (
469+
<>
470+
<h2 style={{padding: "0 36px"}}>{trans("home.globalMarketplaceTitle")}</h2>
471+
<HomeTableView resources={resList.filter(app => app.isLocalMarketplace)} />
472+
</>
473+
)}
462474
</>
463475
) : (
464-
<>
465-
<h2 style={{padding: "0 36px"}}>{trans("home.localMarketplaceTitle")}</h2>
466-
<HomeCardView resources={resList.filter(app => app.isLocalMarketplace)} />
467-
<Divider style={{padding: "0 36px", margin: "12px 36px", width: "calc(100% - 72px) !important"}}/>
468-
<h2 style={{padding: "0 36px"}}>{trans("home.globalMarketplaceTitle")}</h2>
469-
<HomeCardView resources={resList.filter(app => !app.isLocalMarketplace)} />
476+
<>
477+
{isSelfHost ? (
478+
<>
479+
<h2 style={{padding: "0 36px"}}>{trans("home.localMarketplaceTitle")}</h2>
480+
<HomeCardView resources={resList.filter(app => app.isLocalMarketplace)} />
481+
<Divider style={{padding: "0 36px", margin: "12px 36px", width: "calc(100% - 72px) !important"}}/>
482+
<h2 style={{padding: "0 36px"}}>{trans("home.globalMarketplaceTitle")}</h2>
483+
<HomeCardView resources={resList.filter(app => !app.isLocalMarketplace)} />
484+
</>
485+
) : (
486+
<>
487+
<h2 style={{padding: "0 36px"}}>{trans("home.globalMarketplaceTitle")}</h2>
488+
<HomeCardView resources={resList.filter(app => app.isLocalMarketplace)} />
489+
</>
490+
)}
470491
</>
471492
)}
472493
</>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy