├── .gitignore
├── .vscode
└── launch.json
├── LICENSE
├── README.md
├── json-screenshot.png
├── package-lock.json
├── package.json
├── public
└── index.html
├── src
├── assets
│ └── json-screenshot.png
├── components
│ ├── ConfigScreen.spec.tsx
│ ├── ConfigScreen.tsx
│ ├── Dialog.spec.tsx
│ ├── Dialog.tsx
│ ├── EntryEditor.spec.tsx
│ ├── EntryEditor.tsx
│ ├── Field.spec.tsx
│ ├── Field.tsx
│ ├── LocalhostWarning.tsx
│ ├── Page.spec.tsx
│ ├── Page.tsx
│ ├── Sidebar.spec.tsx
│ ├── Sidebar.tsx
│ └── styles.ts
├── index.css
├── index.tsx
├── react-app-env.d.ts
└── setupTests.ts
├── test
└── mocks
│ └── mockSdk.ts
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "pwa-chrome",
9 | "request": "launch",
10 | "name": "Launch Chrome against localhost",
11 | "url": "http://localhost:8080",
12 | "webRoot": "${workspaceFolder}"
13 | }
14 | ]
15 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Mariano Alvarez
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Contentful JSON Viewer
3 | [](https://app.contentful.com/deeplink?link=apps&id=69mKkEFmMO9ue4lwWfto2C)
4 |
5 |
6 | This app adds a new tab on the entry aditor allowing you to visualize the JSON payload for the current entry. This object is the result of calling the `space.getEntry(entryId)` App framework method on the entry.
7 |
8 | It leverages an open source library called [react-json-view](https://github.com/mac-s-g/react-json-view) to format the JSON object in a user-friendly manner.
9 |
10 | 
11 |
12 | ## Installation
13 |
14 | When creating the App definition within the Contentful Org, make sure to select the following app locations:
15 | 
16 |
17 |
18 | ## Available Scripts
19 |
20 | In the project directory, you can run:
21 |
22 | #### `npm start`
23 |
24 | Creates or updates your app definition in Contentful, and runs the app in development mode.
25 | Open your app to view it in the browser.
26 |
27 | The page will reload if you make edits.
28 | You will also see any lint errors in the console.
29 |
30 | #### `npm run build`
31 |
32 | Builds the app for production to the `build` folder.
33 | It correctly bundles React in production mode and optimizes the build for the best performance.
34 |
35 | The build is minified and the filenames include the hashes.
36 | Your app is ready to be deployed!
37 |
38 |
--------------------------------------------------------------------------------
/json-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/marianoa/contentful-json-viewer/ed94193601fac6514ed016c7dfccc306e7156c02/json-screenshot.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "json-viewer",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@contentful/app-sdk": "^4.3.0",
7 | "@contentful/field-editor-single-line": "^0.14.1",
8 | "@contentful/field-editor-test-utils": "^0.11.1",
9 | "@contentful/forma-36-fcss": "^0.3.1",
10 | "@contentful/forma-36-react-components": "^3.89.0",
11 | "@contentful/forma-36-tokens": "^0.10.1",
12 | "@testing-library/jest-dom": "^5.12.0",
13 | "@testing-library/react": "^11.2.6",
14 | "@testing-library/user-event": "^13.1.8",
15 | "@emotion/react": "^11.4.0",
16 | "@emotion/core": "^11.0.0",
17 | "@emotion/styled": "^11.3.0",
18 | "@types/jest": "^26.0.23",
19 | "@types/node": "^14.14.43",
20 | "@types/react": "^17.0.4",
21 | "@types/react-dom": "^17.0.3",
22 | "cross-env": "^7.0.3",
23 | "react": "^17.0.2",
24 | "react-dom": "^17.0.2",
25 | "react-scripts": "4.0.3",
26 | "typescript": "^4.2.4",
27 | "react-json-view": "latest",
28 | "contentful-management": "^7.5.1"
29 | },
30 | "scripts": {
31 | "start": "cross-env BROWSER=none react-scripts start",
32 | "build": "react-scripts build",
33 | "test": "react-scripts test",
34 | "eject": "react-scripts eject"
35 | },
36 | "eslintConfig": {
37 | "extends": "react-app"
38 | },
39 | "browserslist": {
40 | "production": [
41 | ">0.2%",
42 | "not dead",
43 | "not op_mini all"
44 | ],
45 | "development": [
46 | "last 1 chrome version",
47 | "last 1 firefox version",
48 | "last 1 safari version"
49 | ]
50 | },
51 | "homepage": "."
52 | }
53 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
103 |
104 | About the JSON Viewer app
105 |
106 |
107 | This app adds a new tab on the entry aditor allowing you to visualize the JSON payload for the current entry. This object is the result of calling the Preview API on the entry.
108 |
109 |
110 |
111 | Installing this app will add the entry editor tab to all Content Types in your space.
112 |
113 |
114 |
12 |
13 |
14 | Contentful Apps need to run inside the Contentful web app to function properly. Install
15 | the app into a space and render your app into one of the{' '}
16 |
17 | available locations
18 |
19 | .
20 |
21 |
22 |
23 |
24 | Follow{' '}
25 |
26 | our guide
27 | {' '}
28 | to get started or{' '}
29 | open Contentful{' '}
30 | to manage your app.
31 |
32 |
33 |