Skip to content

Commit 768a862

Browse files
committed
fix 控えめにオフラインを出すようにする
1 parent e32949e commit 768a862

4 files changed

Lines changed: 8 additions & 18 deletions

File tree

frontend/src/lib/components/atoms/OfflineBanner.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<div
1010
role="status"
1111
aria-live="polite"
12-
class="fixed bottom-0 left-0 right-0 z-50 bg-yellow-500 dark:bg-yellow-600 text-white px-4 py-2 flex items-center justify-center gap-2 text-sm shadow-lg"
12+
class="fixed top-16 right-4 z-50 bg-gray-800 dark:bg-gray-700 text-white px-3 py-2 rounded-lg shadow-lg flex items-center gap-2 text-xs"
1313
>
1414
<svg
15-
class="w-4 h-4 flex-shrink-0"
15+
class="w-3.5 h-3.5 flex-shrink-0 text-yellow-400"
1616
fill="none"
1717
stroke="currentColor"
1818
viewBox="0 0 24 24"
@@ -25,6 +25,6 @@
2525
d="M18.364 5.636l-12.728 12.728m0 0L5.636 18.364m12.728-12.728L18.364 18.364M12 12h.01"
2626
/>
2727
</svg>
28-
<span>{$_("offline.banner.message")}</span>
28+
<span>{$_("offline.title")}</span>
2929
</div>
3030
{/if}

frontend/src/locales/en.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030
},
3131
"connectionStatus": "When connection is restored, click the button below to refresh the page.",
3232
"retryConnection": "Retry Connection",
33-
"backToHome": "Back to Home",
34-
"banner": {
35-
"message": "You are offline. Previously visited pages are available from cache."
36-
}
33+
"backToHome": "Back to Home"
3734
},
3835
"pwa": {
3936
"install": {

frontend/src/locales/ja.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030
},
3131
"connectionStatus": "接続が復旧したら、下のボタンをクリックしてページを更新してください。",
3232
"retryConnection": "接続を再試行",
33-
"backToHome": "ホームに戻る",
34-
"banner": {
35-
"message": "オフライン中です。過去に閲覧したページはキャッシュから表示されます。"
36-
}
33+
"backToHome": "ホームに戻る"
3734
},
3835
"pwa": {
3936
"install": {

frontend/vite.config.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,23 @@ export default defineConfig({
1212
SvelteKitPWA({
1313
registerType: "autoUpdate",
1414
devOptions: {
15-
enabled: true,
16-
type: "module",
15+
enabled: false,
1716
},
1817
injectRegister: "auto",
1918
mode:
2019
process.env.NODE_ENV === "development" ? "development" : "production",
2120
workbox: {
2221
globPatterns: ["**/*.{js,css,html,ico,png,svg}"],
23-
// オフライン時にナビゲーションが失敗した場合のフォールバックページ
24-
navigateFallback: "/offline",
25-
// APIルートはフォールバック対象から除外
26-
navigateFallbackDenylist: [/^\/api\//],
2722
runtimeCaching: [
2823
{
2924
// SvelteKitのナビゲーションリクエスト(HTMLページ)をキャッシュ
25+
// SSRアプリのため navigateFallback は使用しない(SPA専用のためSSRと相性が悪い)
3026
urlPattern: ({ request }) => request.mode === "navigate",
3127
handler: "NetworkFirst",
3228
options: {
3329
cacheName: "pages-cache",
3430
cacheableResponse: { statuses: [0, 200] },
35-
networkTimeoutSeconds: 3,
31+
networkTimeoutSeconds: 10,
3632
},
3733
},
3834
],

0 commit comments

Comments
 (0)