summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2022-08-29 10:24:51 +0300
committerYuval Adam <_@yuv.al>2022-08-29 10:24:51 +0300
commit44a1c5b7e62e83af4d670e011f5998b9b8aedfef (patch)
tree4ad1299c0f5ba83a6d7783bdc0d6d649c037072b /src
parent5e346930cb9e0672e15fbda4621a9b72e8b072e4 (diff)
Update all .tsx files and remove unused
Diffstat (limited to 'src')
-rw-r--r--src/Datetime.tsx (renamed from src/Datetime.js)0
-rw-r--r--src/Geshem.test.tsx (renamed from src/Geshem.test.js)0
-rw-r--r--src/Geshem.tsx (renamed from src/Geshem.js)0
-rw-r--r--src/Map.tsx (renamed from src/Map.js)0
-rw-r--r--src/Slider.tsx (renamed from src/Slider.js)0
-rw-r--r--src/config.tsx (renamed from src/config.js)0
-rw-r--r--src/index.tsx (renamed from src/index.js)7
-rw-r--r--src/react-app-env.d.ts1
-rw-r--r--src/serviceWorker.js135
-rw-r--r--src/setupTests.ts (renamed from src/setupTests.js)0
10 files changed, 4 insertions, 139 deletions
diff --git a/src/Datetime.js b/src/Datetime.tsx
index 9807211..9807211 100644
--- a/src/Datetime.js
+++ b/src/Datetime.tsx
diff --git a/src/Geshem.test.js b/src/Geshem.test.tsx
index 185b1f4..185b1f4 100644
--- a/src/Geshem.test.js
+++ b/src/Geshem.test.tsx
diff --git a/src/Geshem.js b/src/Geshem.tsx
index 1eecdd0..1eecdd0 100644
--- a/src/Geshem.js
+++ b/src/Geshem.tsx
diff --git a/src/Map.js b/src/Map.tsx
index c39e1ac..c39e1ac 100644
--- a/src/Map.js
+++ b/src/Map.tsx
diff --git a/src/Slider.js b/src/Slider.tsx
index 9e86f66..9e86f66 100644
--- a/src/Slider.js
+++ b/src/Slider.tsx
diff --git a/src/config.js b/src/config.tsx
index f74382c..f74382c 100644
--- a/src/config.js
+++ b/src/config.tsx
diff --git a/src/index.js b/src/index.tsx
index 6203150..8d5df82 100644
--- a/src/index.js
+++ b/src/index.tsx
@@ -5,10 +5,9 @@ import App from './Geshem';
console.log()
-
-const root = ReactDOM.createRoot(document.getElementById('root'));
+const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<React.StrictMode>
<App />
- </React.StrictMode>
-);
+ </React.StrictMode >
+); \ No newline at end of file
diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts
new file mode 100644
index 0000000..6431bc5
--- /dev/null
+++ b/src/react-app-env.d.ts
@@ -0,0 +1 @@
+/// <reference types="react-scripts" />
diff --git a/src/serviceWorker.js b/src/serviceWorker.js
deleted file mode 100644
index 85daadc..0000000
--- a/src/serviceWorker.js
+++ /dev/null
@@ -1,135 +0,0 @@
-// This optional code is used to register a service worker.
-// register() is not called by default.
-
-// 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 subsequent visits to a page, after all the
-// existing tabs open on the page have been closed, since previously cached
-// resources are updated in the background.
-
-// To learn more about the benefits of this model and instructions on how to
-// opt-in, read http://bit.ly/CRA-PWA
-
-const isLocalhost = Boolean(
- window.location.hostname === 'localhost' ||
- // [::1] is the IPv6 localhost address.
- window.location.hostname === '[::1]' ||
- // 127.0.0.1/8 is considered localhost for IPv4.
- window.location.hostname.match(
- /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
- )
-);
-
-export function register(config) {
- if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
- // The URL constructor is available in all browsers that support SW.
- const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
- if (publicUrl.origin !== window.location.origin) {
- // Our service worker won't work if PUBLIC_URL is on a different origin
- // from what our page is served on. This might happen if a CDN is used to
- // serve assets; see https://github.com/facebook/create-react-app/issues/2374
- return;
- }
-
- window.addEventListener('load', () => {
- const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
-
- if (isLocalhost) {
- // This is running on localhost. Let's check if a service worker still exists or not.
- checkValidServiceWorker(swUrl, config);
-
- // Add some additional logging to localhost, pointing developers to the
- // service worker/PWA documentation.
- navigator.serviceWorker.ready.then(() => {
- console.log(
- 'This web app is being served cache-first by a service ' +
- 'worker. To learn more, visit http://bit.ly/CRA-PWA'
- );
- });
- } else {
- // Is not localhost. Just register service worker
- registerValidSW(swUrl, config);
- }
- });
- }
-}
-
-function registerValidSW(swUrl, config) {
- navigator.serviceWorker
- .register(swUrl)
- .then(registration => {
- registration.onupdatefound = () => {
- const installingWorker = registration.installing;
- if (installingWorker == null) {
- return;
- }
- installingWorker.onstatechange = () => {
- if (installingWorker.state === 'installed') {
- if (navigator.serviceWorker.controller) {
- // At this point, the updated precached content has been fetched,
- // but the previous service worker will still serve the older
- // content until all client tabs are closed.
- console.log(
- 'New content is available and will be used when all ' +
- 'tabs for this page are closed. See http://bit.ly/CRA-PWA.'
- );
-
- // Execute callback
- if (config && config.onUpdate) {
- config.onUpdate(registration);
- }
- } 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.');
-
- // Execute callback
- if (config && config.onSuccess) {
- config.onSuccess(registration);
- }
- }
- }
- };
- };
- })
- .catch(error => {
- console.error('Error during service worker registration:', error);
- });
-}
-
-function checkValidServiceWorker(swUrl, config) {
- // Check if the service worker can be found. If it can't reload the page.
- fetch(swUrl)
- .then(response => {
- // Ensure service worker exists, and that we really are getting a JS file.
- const contentType = response.headers.get('content-type');
- if (
- response.status === 404 ||
- (contentType != null && contentType.indexOf('javascript') === -1)
- ) {
- // No service worker found. Probably a different app. Reload the page.
- navigator.serviceWorker.ready.then(registration => {
- registration.unregister().then(() => {
- window.location.reload();
- });
- });
- } else {
- // Service worker found. Proceed as normal.
- registerValidSW(swUrl, config);
- }
- })
- .catch(() => {
- console.log(
- 'No internet connection found. App is running in offline mode.'
- );
- });
-}
-
-export function unregister() {
- if ('serviceWorker' in navigator) {
- navigator.serviceWorker.ready.then(registration => {
- registration.unregister();
- });
- }
-}
diff --git a/src/setupTests.js b/src/setupTests.ts
index 8f2609b..8f2609b 100644
--- a/src/setupTests.js
+++ b/src/setupTests.ts