mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: remove pwa
This commit is contained in:
1 parent
0929825555
commit
7f919ebb87
4 files changed
-185
No files matched your search
@@ -1,37 +0,0 @@
|
||||
---
|
||||
import { pwaInfo } from "virtual:pwa-info";
|
||||
---
|
||||
|
||||
<script>
|
||||
import { pwaInstallHandler } from "pwa-install-handler";
|
||||
import { registerSW } from "virtual:pwa-register";
|
||||
|
||||
registerSW({
|
||||
immediate: true,
|
||||
|
||||
onRegisterError: console.error,
|
||||
|
||||
onRegisteredSW() {
|
||||
console.log("PWA registered service worker");
|
||||
},
|
||||
|
||||
onOfflineReady() {
|
||||
console.log("PWA offline ready");
|
||||
},
|
||||
|
||||
onNeedRefresh() {
|
||||
document.documentElement.classList.add("pwa-refresh");
|
||||
},
|
||||
});
|
||||
|
||||
pwaInstallHandler.addListener((canInstall) => {
|
||||
document.documentElement.classList.remove(
|
||||
canInstall ? "pwa-disabled" : "pwa-enabled"
|
||||
);
|
||||
document.documentElement.classList.add(
|
||||
canInstall ? "pwa-enabled" : "pwa-disabled"
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
{pwaInfo && <Fragment set:html={pwaInfo.webManifest.linkTag} />}
|
||||
@@ -1,136 +0,0 @@
|
||||
---
|
||||
import { Cross2Icon, DownloadIcon } from "@radix-ui/react-icons";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
Flex,
|
||||
Inset,
|
||||
Link,
|
||||
Spinner,
|
||||
Text,
|
||||
} from "@radix-ui/themes";
|
||||
import { getStrings } from "../core/i18n/getStrings";
|
||||
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
||||
|
||||
type Props = LocaleAcceptorProps & {
|
||||
floating?: boolean;
|
||||
};
|
||||
|
||||
const { locale, floating } = Astro.props;
|
||||
const strings = getStrings(locale);
|
||||
---
|
||||
|
||||
<style>
|
||||
#pwa-prompter[data-floating="true"] {
|
||||
position: fixed;
|
||||
bottom: var(--space-6);
|
||||
right: var(--space-6);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#pwa-prompter[data-floating="true"] .card {
|
||||
box-shadow: var(--shadow-6);
|
||||
}
|
||||
|
||||
.pwa-logo {
|
||||
width: 6rem;
|
||||
height: 6rem;
|
||||
background-image: url(/assets/images/pwa-promo.png);
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
html.pwa-enabled .compatibility-checker,
|
||||
html.pwa-disabled .compatibility-checker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#pwa-install,
|
||||
#pwa-incompatible,
|
||||
#pwa-prompter[data-floating="true"],
|
||||
#pwa-dismiss {
|
||||
display: none;
|
||||
}
|
||||
|
||||
html.pwa-enabled #pwa-install,
|
||||
html.pwa-disabled #pwa-incompatible,
|
||||
html.pwa-enabled #pwa-prompter[data-floating="true"],
|
||||
#pwa-prompter[data-floating="true"] #pwa-dismiss {
|
||||
display: unset;
|
||||
}
|
||||
|
||||
.pwa-actions button {
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { pwaInstallHandler } from "pwa-install-handler";
|
||||
|
||||
const pwaInstallButton = document.getElementById("pwa-install");
|
||||
const pwaDismissButton = document.getElementById("pwa-dismiss");
|
||||
const pwaPrompter = document.getElementById("pwa-prompter");
|
||||
|
||||
pwaInstallButton?.addEventListener("click", () => {
|
||||
pwaInstallHandler.install();
|
||||
});
|
||||
|
||||
pwaDismissButton?.addEventListener("click", () => {
|
||||
pwaPrompter?.remove();
|
||||
});
|
||||
</script>
|
||||
|
||||
<Flex id="pwa-prompter" justify="center" mt="4" data-floating={floating}>
|
||||
<Card variant="classic" className="card">
|
||||
<Inset>
|
||||
<Flex align="center">
|
||||
<Box className="pwa-logo" />
|
||||
|
||||
<Flex direction="column" gap="2" px="4" py="3">
|
||||
<Flex align="center" gap="2">
|
||||
<Text size="4" weight="medium">
|
||||
{strings.website.home.pwa.title}
|
||||
</Text>
|
||||
<Badge color="jade" variant="outline">
|
||||
{strings.website.home.pwa.new}
|
||||
</Badge>
|
||||
</Flex>
|
||||
|
||||
<Flex className="compatibility-checker" align="center" gap="2">
|
||||
<Spinner />
|
||||
<Text color="gray">
|
||||
{strings.website.home.pwa.checking}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
<Link
|
||||
id="pwa-incompatible"
|
||||
trim="end"
|
||||
underline="always"
|
||||
target="_blank"
|
||||
href="https://www.cdc.gov/niosh/mining/tools/installpwa.html"
|
||||
>
|
||||
{strings.website.home.pwa.instructions}
|
||||
</Link>
|
||||
|
||||
<Flex className="pwa-actions" gap="2">
|
||||
<Button id="pwa-dismiss" color="tomato" variant="outline">
|
||||
<Flex align="center" gap="1" justify="center">
|
||||
<Cross2Icon />
|
||||
{strings.website.home.pwa.dismiss}
|
||||
</Flex>
|
||||
</Button>
|
||||
<Button id="pwa-install" color="jade">
|
||||
<Flex align="center" gap="1" justify="center">
|
||||
<DownloadIcon />
|
||||
{strings.website.home.pwa.install}
|
||||
</Flex>
|
||||
</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Flex>
|
||||
</Inset>
|
||||
</Card>
|
||||
</Flex>
|
||||
@@ -9,8 +9,6 @@ import Footer from "../components/Footer.astro";
|
||||
import LocaleRedirector from "../components/LocaleRedirector.astro";
|
||||
import Meta from "../components/Meta.astro";
|
||||
import Navbar from "../components/Navbar.astro";
|
||||
import PWA from "../components/PWA.astro";
|
||||
import PWAPrompter from "../components/PWAPrompter.astro";
|
||||
import Servicing from "../components/Servicing.astro";
|
||||
import "./base.css";
|
||||
|
||||
@@ -29,7 +27,6 @@ const locale = Astro.params.locale;
|
||||
<head>
|
||||
<meta property="og:site_name" content={strings.common.name} />
|
||||
|
||||
<PWA />
|
||||
<Meta />
|
||||
<Analytics />
|
||||
<LocaleRedirector />
|
||||
@@ -39,12 +36,6 @@ const locale = Astro.params.locale;
|
||||
|
||||
<body class={noNavbar ? "no-navbar" : ""}>
|
||||
<BlitzKitTheme>
|
||||
{
|
||||
Astro.routePattern !== "/[...locale]" && (
|
||||
<PWAPrompter {locale} floating />
|
||||
)
|
||||
}
|
||||
|
||||
<Flex direction="column" minHeight="100vh">
|
||||
<Navbar {integrated} />
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import type { GetStaticPaths } from "astro";
|
||||
import { AesonPlug } from "../../components/AesonPlug";
|
||||
import HomeHero from "../../components/HomeHero.astro";
|
||||
import { Plugs } from "../../components/Plugs";
|
||||
import PWAPrompter from "../../components/PWAPrompter.astro";
|
||||
import ToolCard from "../../components/ToolCard.astro";
|
||||
import { tools, type Tool } from "../../constants/tools";
|
||||
import { getStrings } from "../../core/i18n/getStrings";
|
||||
@@ -65,8 +64,6 @@ export const getStaticPaths = (() => {
|
||||
<BaseLayout>
|
||||
<HomeHero />
|
||||
|
||||
<PWAPrompter {locale} />
|
||||
|
||||
<!-- <Flex justify="center" py="6" px="4" justify="center">
|
||||
<Flex
|
||||
wrap="wrap"
|
||||
|
||||
Reference in new issue
Block a user