Skip to content

Commit

Permalink
Merge pull request #730 from totegamma/develop
Browse files Browse the repository at this point in the history
update emergency page
  • Loading branch information
totegamma authored Nov 29, 2024
2 parents 7d6eede + 31e89f7 commit 4641598
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
5 changes: 0 additions & 5 deletions public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ self.addEventListener('push', event => {
event.waitUntil(notify());
});

self.addEventListener('install', _event => {
self.skipWaiting();
console.log('Service Worker installed');
})

const Schemas = {
markdownMessage: 'https://schema.concrnt.world/m/markdown.json',
replyMessage: 'https://schema.concrnt.world/m/reply.json',
Expand Down
33 changes: 31 additions & 2 deletions src/components/EmergencyKit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const buttonStyle = {
maxWidth: '400px'
}

const messages = [
'インターネットは素晴らしいものですが、時々問題が発生します。以下のボタンをお試しください。',
'コンピューターは不思議なものです。再読み込みすると問題が解決するかもしれません。',
'時には不思議なことが起きますね。この現象を一緒に解決していきましょう。以下のボタンをお試しください。',
'システムに小さなつまずきがありました。もう一度試すことで乗り越えられるかもしれません。',
'何かが予定通りに進みませんでした。再読み込みを試してみてください。',
'一時的にうまく動いていないようです。再読み込みを試してみてください。',
'おおっと!何かがおかしいようです。再読み込みを試してみてください。'
]

export function EmergencyKit({ error }: FallbackProps): JSX.Element {
const gracefulResetLocalStorage = (): void => {
for (const key in localStorage) {
Expand Down Expand Up @@ -89,7 +99,7 @@ Viewport: ${window.innerWidth}x${window.innerHeight}
>
Crash Report
</h1>
予期しないエラーが発生しました。ごめんなさい...
{messages[(messages.length * Math.random()) | 0]}
<button
style={{
...buttonStyle,
Expand All @@ -100,7 +110,23 @@ Viewport: ${window.innerWidth}x${window.innerHeight}
padding: '20px'
}}
onClick={(): void => {
window.location.replace('/')
// delete all caches
if (window.caches) {
window.caches
.keys()
.then((keys) => {
return Promise.all(
keys.map((key) => {
return caches.delete(key)
})
)
})
.then(() => {
window.location.replace('/')
})
} else {
window.location.replace('/')
}
}}
>
リロード
Expand Down Expand Up @@ -128,6 +154,9 @@ Viewport: ${window.innerWidth}x${window.innerHeight}
>
すべてリセットする(ログイン情報も失われます)
</button>
<h2 style={{ marginBottom: 0 }}>Support</h2>
リロードしても解決しない場合、何か重大な問題が発生中かもしれません。以下のリンクから最新情報を確認できます。
<a href="https://discord.gg/M2UbHquT8B">Discord</a>
<h2
style={{
marginBottom: 0
Expand Down

0 comments on commit 4641598

Please sign in to comment.