add back reload prompt but it never shows up...

This commit is contained in:
Paul Miller
2023-04-10 10:48:29 -05:00
parent c93e0e8332
commit a3800f6bc5
2 changed files with 25 additions and 26 deletions

View File

@@ -4,10 +4,10 @@ import SafeArea from "~/components/SafeArea";
import NavBar from "~/components/NavBar";
import Card from "~/components/Card";
import { ButtonLink } from "~/components/Button";
import PeerConnectModal from "./PeerConnectModal";
import PeerConnectModal from "~/components/PeerConnectModal";
// TODO: use this reload prompt for real
// import ReloadPrompt from "./Reload";
import ReloadPrompt from "~/components/Reload";
export default function App() {
return (
@@ -16,8 +16,8 @@ export default function App() {
<header>
<img src={logo} class="App-logo" alt="logo" />
</header>
{/* <ReloadPrompt /> */}
<BalanceBox />
<ReloadPrompt />
<Card title="Kitchen Sink">
<PeerConnectModal />
<ButtonLink target="_blank" rel="noopener noreferrer" href="https://faucet.mutinynet.com/?address=abc123">Tap the Faucet</ButtonLink>

View File

@@ -1,6 +1,10 @@
import type { Component } from 'solid-js'
import { Show } from 'solid-js'
// pwa-register doesn't have types apparently
// @ts-ignore
import { useRegisterSW } from 'virtual:pwa-register/solid'
import Card from './Card'
import { Button } from './Button'
const ReloadPrompt: Component = () => {
const {
@@ -21,29 +25,24 @@ const ReloadPrompt: Component = () => {
setNeedRefresh(false)
}
// TODO: for now we're just going to have it be invisible
return (<></>)
// return (
// <div>
// <Show when={offlineReady() || needRefresh()}>
// <div>
// <div>
// <Show
// fallback={<span>New content available, click on reload button to update.</span>}
// when={offlineReady()}
// >
// <span>App ready to work offline</span>
// </Show>
// </div>
// <Show when={needRefresh()}>
// <button onClick={() => updateServiceWorker(true)}>Reload</button>
// </Show>
// <button onClick={() => close()}>Close</button>
// </div>
// </Show>
// </div>
// )
return (
<Show when={offlineReady() || needRefresh()}>
<Card title="PWA settings">
<div>
<Show
fallback={<span>New content available, click on reload button to update.</span>}
when={offlineReady()}
>
<span>App ready to work offline</span>
</Show>
</div>
<Show when={needRefresh()}>
<Button onClick={() => updateServiceWorker(true)}>Reload</Button>
</Show>
<Button onClick={() => close()}>Close</Button>
</Card>
</Show>
)
}
export default ReloadPrompt