Skip to content

Commit 763b4c1

Browse files
authored
Merge pull request #106 from contentstack/staging
Staging --> Main
2 parents 83dafea + 823cc12 commit 763b4c1

File tree

7 files changed

+139
-3
lines changed

7 files changed

+139
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "marketplace-app-boilerplate",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"private": true,
55
"files": [
66
"dist"

src/common/locales/en-us/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ const localeTexts = {
6363
url: "https://www.contentstack.com/docs/developers/developer-hub/full-page-location/",
6464
},
6565
},
66+
GlobalFullPage: {
67+
title: "Global Full Page App",
68+
body: "This is the location that contains your Global Full Page App.",
69+
button: {
70+
text: "Learn More",
71+
url: "https://www.contentstack.com/docs/developers/developer-hub/global-full-page/",
72+
},
73+
},
6674
FieldModifier: {
6775
title: "Field Modifier App",
6876
body: "This is the location that contains your Field Modifier app.",

src/containers/App/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const AppConfigurationExtension = React.lazy(() => import("../AppConfiguration/A
1818
const AssetSidebarExtension = React.lazy(() => import("../AssetSidebarWidget/AssetSidebar"));
1919
const StackDashboardExtension = React.lazy(() => import("../DashboardWidget/StackDashboard"));
2020
const FullPageExtension = React.lazy(() => import("../FullPage/FullPage"));
21+
const GlobalFullPageExtension = React.lazy(() => import("../GlobalFullPage/GlobalFullPage"));
2122
const PageNotFound = React.lazy(() => import("../404/404"));
2223
const DefaultPage = React.lazy(() => import("../index"));
2324
const ContentTypeSidebarExtension = React.lazy(() => import("../ContentTypeSidebar/ContentTypeSidebar"));
@@ -82,6 +83,14 @@ function App() {
8283
</Suspense>
8384
}
8485
/>
86+
<Route
87+
path="/global-full-page"
88+
element={
89+
<Suspense>
90+
<GlobalFullPageExtension />
91+
</Suspense>
92+
}
93+
/>
8594
<Route
8695
path="/field-modifier"
8796
element={
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* Full Page UI Location styles */
2+
3+
body {
4+
overflow: hidden;
5+
}
6+
7+
.layout-container {
8+
padding: 1.5rem 1.875rem;
9+
flex-direction: column;
10+
flex-shrink: 0;
11+
margin: auto;
12+
height: 95vh;
13+
}
14+
15+
.ui-location {
16+
padding: 1.5rem 1rem;
17+
flex-direction: column;
18+
justify-content: center;
19+
align-items: center;
20+
gap: 1.9375rem;
21+
flex: 1 0 0;
22+
height: 80vh;
23+
width: 95vw;
24+
max-height: 89vh;
25+
}
26+
27+
.ui-container {
28+
padding: 1.5rem 0rem;
29+
justify-content: center;
30+
}
31+
32+
.config-container {
33+
width: 23.5625rem;
34+
justify-content: center;
35+
gap: 0.25rem;
36+
}
37+
38+
.label {
39+
font-size: 0.875rem;
40+
}
41+
42+
.info {
43+
font-size: 0.875rem;
44+
}
45+
46+
.location-description {
47+
width: 25.5625rem;
48+
}
49+
50+
.location-description-text {
51+
white-space: nowrap;
52+
word-wrap: break-word;
53+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import React, { useCallback, useState } from "react";
2+
import localeTexts from "../../common/locales/en-us/index";
3+
import parse from "html-react-parser";
4+
import { useAppConfig } from "../../common/hooks/useAppConfig";
5+
import Icon from "../../assets/Full-Page-Logo.svg";
6+
import ReadOnly from "../../assets/lock.svg";
7+
import JsonView from "../../assets/JsonView.svg";
8+
import ConfigModal from "../../components/ConfigModal/ConfigModal";
9+
10+
import "../index.css";
11+
import "./GlobalFullPage.css";
12+
13+
const GlobalFullPageExtension = () => {
14+
const appConfig = useAppConfig();
15+
const [isRawConfigModalOpen, setRawConfigModalOpen] = useState<boolean>(false);
16+
17+
const handleViewRawConfig = useCallback(() => {
18+
setRawConfigModalOpen(true);
19+
}, []);
20+
21+
const handleCloseModal = useCallback(() => {
22+
setRawConfigModalOpen(false);
23+
}, []);
24+
25+
const sampleAppConfig = appConfig?.["sample_app_configuration"] || "";
26+
const trimmedSampleAppConfig =
27+
sampleAppConfig.length > 19 ? `${sampleAppConfig.substring(0, 19)}...` : sampleAppConfig;
28+
29+
return (
30+
<div className="layout-container">
31+
<div className="ui-location">
32+
<div className="ui-container">
33+
<div className="logo-container">
34+
<img src={Icon} alt="Logo" />
35+
<p>{localeTexts.GlobalFullPage.title}</p>
36+
</div>
37+
<div className="config-container">
38+
<div className="label-container">
39+
<p className="label">Sample App Configuration</p>
40+
<p className="info">(read only)</p>
41+
</div>
42+
<div className="input-wrapper">
43+
<div className="input-container">
44+
<p className="config-value">{trimmedSampleAppConfig}</p>
45+
<img src={ReadOnly} alt="ReadOnlyLogo" />
46+
</div>
47+
48+
<img src={JsonView} alt="Show-Json-CTA" className="show-json-cta" onClick={handleViewRawConfig} />
49+
{isRawConfigModalOpen && <ConfigModal config={appConfig!} onClose={handleCloseModal} />}
50+
</div>
51+
</div>
52+
<div className="location-description">
53+
<p className="location-description-text">{parse(localeTexts.GlobalFullPage.body)}</p>
54+
<a target="_blank" rel="noreferrer" href={localeTexts.GlobalFullPage.button.url}>
55+
<span className="location-description-link">{localeTexts.GlobalFullPage.button.text}</span>
56+
</a>
57+
</div>
58+
</div>
59+
</div>
60+
</div>
61+
);
62+
};
63+
export default GlobalFullPageExtension;

src/containers/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ const DefaultPage = () => {
2626
<li>
2727
<a href="/field-modifier">Field Modifier</a>
2828
</li>
29+
<li>
30+
<a href="/global-full-page">Global Full Page</a>
31+
</li>
2932
</ul>
3033
</div>
3134
</div>

0 commit comments

Comments
 (0)