Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
tcaiger committed Nov 7, 2024
1 parent 068a72f commit 29ab916
Show file tree
Hide file tree
Showing 47 changed files with 27 additions and 94 deletions.
12 changes: 7 additions & 5 deletions packages/datatrak-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
<!-- End of bes-support Zendesk Widget script -->
<% } %>

<!-- Temporarily disable PWA on production environments -->
<% if (process.env.REACT_APP_DEPLOYMENT_NAME !== 'master' &&
process.env.REACT_APP_DEPLOYMENT_NAME === 'main' && process.env.REACT_APP_DEPLOYMENT_NAME !==
'production') { %>
<link rel="manifest" id="manifest" href="/manifest.json"/>
<% } %>

<link rel="icon" type="image/png" href="/favicon.ico" />
<!-- Add media='print' and onload="this.media='all'" to stop the resource being render-blocking on load: see https://pagespeedchecklist.com/asynchronous-google-fonts -->
<link
Expand Down Expand Up @@ -96,11 +103,6 @@
crossorigin=""
/>
</noscript>



<link rel="manifest" id="manifest" href="/manifest.json"/>

</head>
<body>
<noscript>
Expand Down
8 changes: 2 additions & 6 deletions packages/datatrak-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@material-ui/lab": "^4.0.0-alpha.57",
"@material-ui/pickers": "^3.2.10",
"@material-ui/styles": "^4.9.10",
"@sqlite.org/sqlite-wasm": "^3.46.1-build3",
"@tanstack/react-query": "4.36.1",
"@testing-library/react-hooks": "^8.0.1",
"@tupaia/expression-parser": "workspace:*",
Expand Down Expand Up @@ -60,14 +59,11 @@
"msw": "^1.3.1",
"npm-run-all": "^4.1.5",
"vite": "^4.5.3",
"workbox-cli": "^7.1.0",
"workbox-recipes": "^7.1.0",
"workbox-routing": "^7.1.0",
"workbox-strategies": "^7.1.0"
"workbox-cli": "^7.1.0"
},
"scripts": {
"build:worker": "esbuild --outfile=dist/sw.js --bundle service-worker.ts && workbox injectManifest workbox-config.js",
"build": "yarn package:build:types && yarn package:build:vite",
"build": "yarn package:build:types && yarn package:build:vite && yarn build:worker",
"lint": "yarn package:lint",
"lint:fix": "yarn lint --fix",
"preview": "vite preview",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
21 changes: 14 additions & 7 deletions packages/datatrak-web/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"name": "Tupaia",
"short_name": "Tupaia",
"theme_color": "#ffcbe4",
"background_color": "#fa99ca",
"id": "datatrak",
"name": "Tupaia DataTrak",
"short_name": "Tupaia DataTrak",
"theme_color": "#000000",
"background_color": "#ffffff",
"display": "standalone",
"scope": "/",
"start_url": "/",
"description": "Pacific Health Information System",
"description": "Data collection and visualisation for the most remote settings in the world",
"screenshots": [
{
"src": "screenshots/login.png",
"sizes": "2000x1000",
"type": "image/png",
"form_factor": "wide",
"label": "Login"
"label": "Login screen"
},
{
"src": "screenshots/dashboard.png",
Expand All @@ -27,7 +28,7 @@
"sizes": "381x667",
"type": "image/png",
"form_factor": "narrow",
"label": "Login Mobile"
"label": "Mobile login screen"
}
],
"icons": [
Expand Down Expand Up @@ -55,5 +56,11 @@
"type": "image/png",
"purpose": "maskable"
}
],
"shortcuts": [
{
"name": "Tasks",
"url": "/tasks"
}
]
}
Binary file modified packages/datatrak-web/public/screenshots/dashboard.png
Binary file modified packages/datatrak-web/public/screenshots/login-mobile.png
Binary file modified packages/datatrak-web/public/screenshots/login.png
10 changes: 0 additions & 10 deletions packages/datatrak-web/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@
* Tupaia
* Copyright (c) 2017 - 2024 Beyond Essential Systems Pty Ltd
*/
import { offlineFallback } from 'workbox-recipes';
import { precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { CacheFirst } from 'workbox-strategies';

declare const self: ServiceWorkerGlobalScope;

precacheAndRoute(self.__WB_MANIFEST);

registerRoute(
({ url }) => url.pathname.startsWith('/v1/'),
new CacheFirst({ cacheName: 'apiResponses' }),
);

offlineFallback();
3 changes: 0 additions & 3 deletions packages/datatrak-web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
import React from 'react';
import { render as renderReactApp } from 'react-dom';
import { App } from './App';
import { initializeSQLite } from './sqlite';

renderReactApp(<App />, document.getElementById('root'));

await initializeSQLite();

window.addEventListener('load', () => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js');
Expand Down
41 changes: 0 additions & 41 deletions packages/datatrak-web/src/sqlite.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/datatrak-web/workbox-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module.exports = {
globPatterns: ['**/*.{svg,png,ico,jpg,json,js,txt,html}'],
swSrc: 'dist/sw.js',
swDest: 'dist/sw.js',
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // 5MB
};
5 changes: 0 additions & 5 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ export default defineConfig(({ command, mode }) => {
},
},
},

optimizeDeps: {
exclude: ['@sqlite.org/sqlite-wasm'],
},

plugins: [
ViteEjsPlugin(), // Enables use of EJS templates in the index.html file, for analytics scripts etc
viteCompression(),
Expand Down
19 changes: 3 additions & 16 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 29ab916

Please sign in to comment.