From bfc7cab1f2b1cf29d749cfc8990fd7ff6f490ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20=C3=98hlenschl=C3=A6ger=20Frederiksen?= Date: Fri, 5 Mar 2021 08:36:30 +0100 Subject: [PATCH 1/3] Added page files --- demoReactPage/package.json | 33 ++++++++++++ demoReactPage/src/createServiceWorker.js | 52 +++++++++++++++++++ demoReactPage/src/demo.js | 66 ++++++++++++++++++++++++ demoReactPage/src/index.js | 7 +++ demoReactPage/src/package.json | 14 +++++ 5 files changed, 172 insertions(+) create mode 100644 demoReactPage/package.json create mode 100644 demoReactPage/src/createServiceWorker.js create mode 100644 demoReactPage/src/demo.js create mode 100644 demoReactPage/src/index.js create mode 100644 demoReactPage/src/package.json diff --git a/demoReactPage/package.json b/demoReactPage/package.json new file mode 100644 index 00000000..4c60eb5b --- /dev/null +++ b/demoReactPage/package.json @@ -0,0 +1,33 @@ +{ + "title": "demoDMSPage", + "devDependencies": { + "react-scripts": "latest" + }, + "dependencies": { + "@material-ui/core": "latest", + "@material-ui/icons": "latest", + "@material-ui/lab": "latest", + "react": "latest", + "react-dom": "latest" + }, + "name": "DMS-demo", + "version": "0.0.0", + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test --env=jsdom", + "eject": "react-scripts eject" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/demoReactPage/src/createServiceWorker.js b/demoReactPage/src/createServiceWorker.js new file mode 100644 index 00000000..5445ef54 --- /dev/null +++ b/demoReactPage/src/createServiceWorker.js @@ -0,0 +1,52 @@ +// In production, we register a service worker to serve assets from local cache. + +// This lets the app load faster on subsequent visits in production, and gives +// it offline capabilities. However, it also means that developers (and users) +// will only see deployed updates on the "N+1" visit to a page, since previously +// cached resources are updated in the background. + +// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. +// This link also includes instructions on opting out of this behavior. + +export default function register() { + if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + window.addEventListener('load', () => { + const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; + navigator.serviceWorker + .register(swUrl) + .then(registration => { + // eslint-disable-next-line no-param-reassign + registration.onupdatefound = () => { + const installingWorker = registration.installing; + installingWorker.onstatechange = () => { + if (installingWorker.state === 'installed') { + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and + // the fresh content will have been added to the cache. + // It's the perfect time to display a "New content is + // available; please refresh." message in your web app. + console.log('New content is available; please refresh.'); // eslint-disable-line no-console + } else { + // At this point, everything has been precached. + // It's the perfect time to display a + // "Content is cached for offline use." message. + console.log('Content is cached for offline use.'); // eslint-disable-line no-console + } + } + }; + }; + }) + .catch(error => { + console.error('Error during service worker registration:', error); + }); + }); + } +} + +export function unregister() { + if ('serviceWorker' in navigator) { + navigator.serviceWorker.ready.then(registration => { + registration.unregister(); + }); + } +} diff --git a/demoReactPage/src/demo.js b/demoReactPage/src/demo.js new file mode 100644 index 00000000..06b62a71 --- /dev/null +++ b/demoReactPage/src/demo.js @@ -0,0 +1,66 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import TreeView from '@material-ui/lab/TreeView'; +import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import ChevronRightIcon from '@material-ui/icons/ChevronRight'; +import TreeItem from '@material-ui/lab/TreeItem'; + +const useStyles = makeStyles({ + root: { + height: 240, + flexGrow: 1, + maxWidth: 400, + }, +}); + +export default function FileSystemNavigator() { + const classes = useStyles(); + + return ( + } + defaultExpandIcon={} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} diff --git a/demoReactPage/src/index.js b/demoReactPage/src/index.js new file mode 100644 index 00000000..af36039a --- /dev/null +++ b/demoReactPage/src/index.js @@ -0,0 +1,7 @@ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import Demo from './demo'; + +ReactDOM.render(, document.querySelector('#root')); + \ No newline at end of file diff --git a/demoReactPage/src/package.json b/demoReactPage/src/package.json new file mode 100644 index 00000000..2245e394 --- /dev/null +++ b/demoReactPage/src/package.json @@ -0,0 +1,14 @@ +{ + "title": "Material demo", + "devDependencies": { + "react-scripts": "latest" + }, + "description": "https://github.com/mui-org/material-ui/blob/master/docs/src/pages/components/tree-view/FileSystemNavigator.js", + "dependencies": { + "react-dom": "latest", + "react": "latest", + "@material-ui/lab": "latest", + "@material-ui/icons": "latest", + "@material-ui/core": "latest" + } +} \ No newline at end of file From 171cfec86500c95ec46430a0fb25fdb39476ea31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20=C3=98hlenschl=C3=A6ger=20Frederiksen?= Date: Fri, 5 Mar 2021 08:51:31 +0100 Subject: [PATCH 2/3] added gitignore --- demoReactPage/.gitignore | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 demoReactPage/.gitignore diff --git a/demoReactPage/.gitignore b/demoReactPage/.gitignore new file mode 100644 index 00000000..d30f40ef --- /dev/null +++ b/demoReactPage/.gitignore @@ -0,0 +1,21 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* From c6a9f1bbc59369d62b0c37cf2acedb2b28107d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20=C3=98hlenschl=C3=A6ger=20Frederiksen?= Date: Fri, 5 Mar 2021 09:46:16 +0100 Subject: [PATCH 3/3] change in path --- demoReactPage/package.json | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/demoReactPage/package.json b/demoReactPage/package.json index 4c60eb5b..898be9cc 100644 --- a/demoReactPage/package.json +++ b/demoReactPage/package.json @@ -1,23 +1,31 @@ { - "title": "demoDMSPage", - "devDependencies": { - "react-scripts": "latest" - }, + "homepage": "http://skat.github.io//dms-public//demoReactPage", + "name": "demoReactPage", + "version": "0.1.0", + "private": true, "dependencies": { - "@material-ui/core": "latest", - "@material-ui/icons": "latest", - "@material-ui/lab": "latest", - "react": "latest", - "react-dom": "latest" + "@testing-library/jest-dom": "^5.11.9", + "@testing-library/react": "^11.2.5", + "@testing-library/user-event": "^12.8.1", + "react": "^17.0.1", + "react-dom": "^17.0.1", + "react-scripts": "4.0.3", + "web-vitals": "^1.1.0" }, - "name": "DMS-demo", - "version": "0.0.0", "scripts": { + "predeploy": "npm run build", + "deploy": "gh-pages -d build", "start": "react-scripts start", "build": "react-scripts build", - "test": "react-scripts test --env=jsdom", + "test": "react-scripts test", "eject": "react-scripts eject" }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, "browserslist": { "production": [ ">0.2%", @@ -29,5 +37,8 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "devDependencies": { + "gh-pages": "^3.1.0" } -} +}