Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light dark" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="manifest" href="/manifest.json" />
<link rel="icon" href="/icons/placeholder.svg" sizes="any" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/icons/placeholder.svg" />
<!-- TODO: заменить SVG-заглушку на реальные PNG-иконки и splash-экраны (см. тикет X) -->
<link rel="manifest" href="./manifest.json" />
<link rel="icon" href="./icons/placeholder.svg" sizes="any" type="image/svg+xml" />
<link rel="apple-touch-icon" href="./icons/placeholder.svg" />
<title>Scriptrans</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>
9 changes: 8 additions & 1 deletion app/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
"scope": "/scriptrans/",
"display": "standalone",
"theme_color": "#ffffff",
"background_color": "#ffffff",
"icons": [
{ "src": "/icons/placeholder.svg", "sizes": "any", "type": "image/svg+xml" }
{ "src": "icons/placeholder.svg", "sizes": "any", "type": "image/svg+xml" },
{
"src": "icons/placeholder.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "maskable"
}
]
}
3 changes: 2 additions & 1 deletion app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FileContext } from './FileContext';

function Header() {
const location = useLocation();
const iconPath = `${import.meta.env.BASE_URL}icons/placeholder.svg`;
const step =
location.pathname === '/progress'
? 'Progress'
Expand All @@ -17,7 +18,7 @@ function Header() {
<header className="sticky top-0 bg-[color:var(--accent)] text-[color:var(--bg)] p-4">
<div className="flex flex-wrap items-center justify-between gap-4">
<div className="flex items-center gap-4">
<img src="/icons/placeholder.svg" alt="logo" className="h-6 w-6" />
<img src={iconPath} alt="logo" className="h-6 w-6" />
<span className="font-bold">{step}</span>
</div>
<nav className="flex flex-wrap gap-2 justify-center">
Expand Down
10 changes: 6 additions & 4 deletions app/src/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare const self: ServiceWorkerGlobalScope;
declare const __SW_VERSION__: string;

const CACHE_NAME = `shell-v${__SW_VERSION__}`;
const OFFLINE_URL = new URL('offline.html', self.registration.scope).pathname;
setCacheNameDetails({ precache: CACHE_NAME, prefix: '', suffix: '' });

self.addEventListener('install', () => {
Expand All @@ -32,11 +33,13 @@ self.addEventListener('activate', (event) => {
});

self.addEventListener('message', (event) => {
if (event.data === 'SKIP_WAITING') self.skipWaiting();
if (event.data === 'SKIP_WAITING' || event.data?.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});

precacheAndRoute(self.__WB_MANIFEST);
precacheAndRoute([{ url: '/offline.html', revision: '' }]);
precacheAndRoute([{ url: OFFLINE_URL, revision: null }]);

registerRoute(
/\.(?:js|css|html|ico|png|svg)$/,
Expand All @@ -53,7 +56,6 @@ registerRoute(
} catch {
/* ignore errors */
}
return (response ?? (await caches.match('/offline.html'))) as Response;
return (response ?? (await caches.match(OFFLINE_URL))) as Response;
}
);

9 changes: 8 additions & 1 deletion app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ export default defineConfig({
scope: '/scriptrans/',
display: 'standalone',
theme_color: '#ffffff',
background_color: '#ffffff',
icons: [
{
src: '/icons/placeholder.svg',
src: 'icons/placeholder.svg',
sizes: 'any',
type: 'image/svg+xml'
},
{
src: 'icons/placeholder.svg',
sizes: 'any',
type: 'image/svg+xml',
purpose: 'maskable'
}
]
}
Expand Down
Loading