chore: add icon, add pwa support

This commit is contained in:
Khairul Hidayat 2024-03-24 03:03:44 +07:00
parent 254df638c1
commit 33c91ac0a7
27 changed files with 2388 additions and 80 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
backend/public/icon-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
backend/public/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,10 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Home Lab</title>
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/manifest.json" />
<!-- The `react-native-web` recommended style reset: https://necolas.github.io/react-native-web/docs/setup/#root-element -->
<style id="expo-reset">
/* These styles make the body full-height */
@ -12,10 +17,12 @@
body {
height: 100%;
}
/* These styles disable body scrolling if you are using <ScrollView> */
body {
overflow: hidden;
}
/* These styles make the root element full-height */
#root {
display: flex;
@ -23,15 +30,28 @@
flex: 1;
}
</style>
<link rel="preload" href="/_expo/static/css/xterm-85f8ec7ddb3d8117e8ea88fe44ec1bcc.css" as="style"><link rel="stylesheet" href="/_expo/static/css/xterm-85f8ec7ddb3d8117e8ea88fe44ec1bcc.css"><link rel="shortcut icon" href="/favicon.ico" /></head>
<body>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').then(registration => {
console.log('Service Worker registered with scope:', registration.scope);
}).catch(error => {
console.error('Service Worker registration failed:', error);
});
});
}
</script>
<link rel="preload" href="/_expo/static/css/xterm-85f8ec7ddb3d8117e8ea88fe44ec1bcc.css" as="style"><link rel="stylesheet" href="/_expo/static/css/xterm-85f8ec7ddb3d8117e8ea88fe44ec1bcc.css"></head>
<body>
<!-- Use static rendering with Expo Router to support running without JavaScript. -->
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<!-- The root element for your Expo app. -->
<div id="root"></div>
<script src="/_expo/static/js/web/entry-9340d9b06450719c5ea70c9e7acab050.js" defer></script>
<script src="/_expo/static/js/web/entry-9340d9b06450719c5ea70c9e7acab050.js" defer></script>
</body>
</html>

View File

@ -0,0 +1,25 @@
{
"short_name": "Home Lab",
"name": "Home Lab",
"icons": [
{ "src": "/favicon.ico", "type": "image/x-icon", "sizes": "16x16 32x32" },
{ "src": "/icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "/icon-512.png", "type": "image/png", "sizes": "512x512" },
{
"src": "/icon-192-maskable.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "/icon-512-maskable.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

2
backend/public/sw.js Normal file
View File

@ -0,0 +1,2 @@
if(!self.define){let e,c={};const i=(i,s)=>(i=new URL(i+".js",s).href,c[i]||new Promise((c=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=c,document.head.appendChild(e)}else e=i,importScripts(i),c()})).then((()=>{let e=c[i];if(!e)throw new Error(`Module ${i} didnt register its module`);return e})));self.define=(s,n)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(c[r])return;let o={};const f=e=>i(e,r),d={module:{uri:r},exports:o,require:f};c[r]=Promise.all(s.map((e=>d[e]||f(e)))).then((e=>(n(...e),o)))}}define(["./workbox-9a84fccb"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"_expo/static/css/xterm-85f8ec7ddb3d8117e8ea88fe44ec1bcc.css",revision:"85f8ec7ddb3d8117e8ea88fe44ec1bcc"},{url:"apple-touch-icon.png",revision:"8668f7cf9e58f759e672dd81eabf1e89"},{url:"assets/src/assets/images/audioplayer-bg.d856ca6914e55cd1d83b5259af0ae439.jpeg",revision:"d856ca6914e55cd1d83b5259af0ae439"},{url:"favicon.ico",revision:"7e3f9db4b2961963925d10e6aef9ba47"},{url:"icon-192-maskable.png",revision:"c61df7f670bef41d26d7babc4daa1344"},{url:"icon-192.png",revision:"5be5ff0ac45d2c93fc15e03c21b87ce5"},{url:"icon-512-maskable.png",revision:"bb3e702963630ffbd21819b61e55f8ef"},{url:"icon-512.png",revision:"9cb5b08e4b6d09fc354f9d9566cc2b7d"},{url:"index.html",revision:"056f639c0e65ae437af6e2b61bcac002"},{url:"manifest.json",revision:"e5357a35e5205b044b5465f14af5a61b"},{url:"metadata.json",revision:"37cb2e8fcdd3b2523b9bd2f4b09087db"}],{ignoreURLParametersMatching:[/^utm_/,/^fbclid$/]})}));
//# sourceMappingURL=sw.js.map

1
backend/public/sw.js.map Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"sw.js","sources":["../../../../../tmp/0c9c1ebe3fb2fa39e8b2c3833c99d659/sw.js"],"sourcesContent":["import {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/khai/projects/khai/home-monitoring/node_modules/workbox-precaching/precacheAndRoute.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.addEventListener('message', (event) => {\n if (event.data && event.data.type === 'SKIP_WAITING') {\n self.skipWaiting();\n }\n});\n\n\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"_expo/static/css/xterm-85f8ec7ddb3d8117e8ea88fe44ec1bcc.css\",\n \"revision\": \"85f8ec7ddb3d8117e8ea88fe44ec1bcc\"\n },\n {\n \"url\": \"apple-touch-icon.png\",\n \"revision\": \"8668f7cf9e58f759e672dd81eabf1e89\"\n },\n {\n \"url\": \"assets/src/assets/images/audioplayer-bg.d856ca6914e55cd1d83b5259af0ae439.jpeg\",\n \"revision\": \"d856ca6914e55cd1d83b5259af0ae439\"\n },\n {\n \"url\": \"favicon.ico\",\n \"revision\": \"7e3f9db4b2961963925d10e6aef9ba47\"\n },\n {\n \"url\": \"icon-192-maskable.png\",\n \"revision\": \"c61df7f670bef41d26d7babc4daa1344\"\n },\n {\n \"url\": \"icon-192.png\",\n \"revision\": \"5be5ff0ac45d2c93fc15e03c21b87ce5\"\n },\n {\n \"url\": \"icon-512-maskable.png\",\n \"revision\": \"bb3e702963630ffbd21819b61e55f8ef\"\n },\n {\n \"url\": \"icon-512.png\",\n \"revision\": \"9cb5b08e4b6d09fc354f9d9566cc2b7d\"\n },\n {\n \"url\": \"index.html\",\n \"revision\": \"056f639c0e65ae437af6e2b61bcac002\"\n },\n {\n \"url\": \"manifest.json\",\n \"revision\": \"e5357a35e5205b044b5465f14af5a61b\"\n },\n {\n \"url\": \"metadata.json\",\n \"revision\": \"37cb2e8fcdd3b2523b9bd2f4b09087db\"\n }\n], {\n \"ignoreURLParametersMatching\": [/^utm_/, /^fbclid$/]\n});\n\n\n\n\n\n\n\n\n"],"names":["self","addEventListener","event","data","type","skipWaiting","workbox_precaching_precacheAndRoute","url","revision","ignoreURLParametersMatching"],"mappings":"0nBAmBAA,KAAKC,iBAAiB,WAAYC,IAC5BA,EAAMC,MAA4B,iBAApBD,EAAMC,KAAKC,MAC3BJ,KAAKK,aACP,IAWFC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,8DACPC,SAAY,oCAEd,CACED,IAAO,uBACPC,SAAY,oCAEd,CACED,IAAO,gFACPC,SAAY,oCAEd,CACED,IAAO,cACPC,SAAY,oCAEd,CACED,IAAO,wBACPC,SAAY,oCAEd,CACED,IAAO,eACPC,SAAY,oCAEd,CACED,IAAO,wBACPC,SAAY,oCAEd,CACED,IAAO,eACPC,SAAY,oCAEd,CACED,IAAO,aACPC,SAAY,oCAEd,CACED,IAAO,gBACPC,SAAY,oCAEd,CACED,IAAO,gBACPC,SAAY,qCAEb,CACDC,4BAA+B,CAAC,QAAS"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"build:web": "expo export -p web && rm -rf backend/public && cp -r ./dist backend/public",
"build:web": "expo export -p web && npx workbox-cli generateSW workbox-config.js && rm -rf backend/public && cp -r ./dist backend/public",
"postinstall": "patch-package"
},
"dependencies": {
@ -56,7 +56,8 @@
"@types/react-helmet": "^6.1.11",
"babel-plugin-module-resolver": "^5.0.0",
"patch-package": "^8.0.0",
"react-native-svg-transformer": "^1.3.0"
"react-native-svg-transformer": "^1.3.0",
"workbox-cli": "^7.0.0"
},
"private": true
}

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
public/icon-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/icon-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

56
public/index.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="%LANG_ISO_CODE%">
<head>
<meta charset="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>%WEB_TITLE%</title>
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/manifest.json" />
<!-- The `react-native-web` recommended style reset: https://necolas.github.io/react-native-web/docs/setup/#root-element -->
<style id="expo-reset">
/* These styles make the body full-height */
html,
body {
height: 100%;
}
/* These styles disable body scrolling if you are using <ScrollView> */
body {
overflow: hidden;
}
/* These styles make the root element full-height */
#root {
display: flex;
height: 100%;
flex: 1;
}
</style>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').then(registration => {
console.log('Service Worker registered with scope:', registration.scope);
}).catch(error => {
console.error('Service Worker registration failed:', error);
});
});
}
</script>
</head>
<body>
<!-- Use static rendering with Expo Router to support running without JavaScript. -->
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<!-- The root element for your Expo app. -->
<div id="root"></div>
</body>
</html>

25
public/manifest.json Normal file
View File

@ -0,0 +1,25 @@
{
"short_name": "Home Lab",
"name": "Home Lab",
"icons": [
{ "src": "/favicon.ico", "type": "image/x-icon", "sizes": "16x16 32x32" },
{ "src": "/icon-192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "/icon-512.png", "type": "image/png", "sizes": "512x512" },
{
"src": "/icon-192-maskable.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "/icon-512-maskable.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

11
workbox-config.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = {
globDirectory: 'dist/',
globPatterns: [
'**/*.{css,js,png,jpeg,ico,html,json}'
],
swDest: 'dist/sw.js',
ignoreURLParametersMatching: [
/^utm_/,
/^fbclid$/
]
};

2254
yarn.lock

File diff suppressed because it is too large Load Diff