This commit is contained in:
LionTion committed 2026-09-09 16:20:01 +02:00
1 parent dd596f16b9
commit 3c052a8b43
25 files changed
+2252 -74

No files matched your search

+45
View File
@@ -42,8 +42,53 @@ a {
text-decoration: none;
}
.charged-button {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1.25rem;
min-width: 8rem;
height: 2.75rem;
border: 2px solid white;
border-radius: 0.625rem;
outline: none;
isolation: isolate;
cursor: pointer;
background: #000;
color: #FFF;
box-shadow: 0 0 0 1px hsl(0 0% 0% / 0.15);
transition: box-shadow 120ms ease, transform 120ms ease;
}
.charged-button:hover {
box-shadow: 0 0 0 1px hsl(0 0% 0% / 0.45);
}
.charged-button:active {
transform: scale(0.97);
}
.charged-button__label {
position: relative;
z-index: 1;
pointer-events: none;
}
.charged-button-fill {
pointer-events: none;
position: absolute;
inset: 0;
border-radius: inherit;
opacity: 0.7;
background: linear-gradient(120deg, #1ea, #2af, #e1f, #2af);
background-size: 200% 200%;
transition: opacity 120ms ease;
}
@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}
+10 -6
View File
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import { SerwistProvider } from "@serwist/turbopack/react";
import type { Metadata, Viewport } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
@@ -13,14 +14,17 @@ const geistMono = Geist_Mono({
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "Excalibur Outdoor Tour",
description: "Excalibur Outdoor Tour Web App",
};
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
<html lang="en" className={`${geistSans.variable} ${geistMono.variable}`}>
<body>{children}</body>
<html lang="en" dir="ltr" className={`${geistSans.variable} ${geistMono.variable}`}>
<meta name="apple-mobile-web-app-title" content="Excalibur Outdoor Tour" />
<body>
<SerwistProvider swUrl="/serwist/sw.js">{children}</SerwistProvider>
</body>
</html>
);
}
}
+26
View File
@@ -0,0 +1,26 @@
import type { MetadataRoute } from 'next'
export default function manifest(): MetadataRoute.Manifest {
return {
name: 'Next.js PWA',
short_name: 'NextPWA',
description: 'A Progressive Web App built with Next.js',
start_url: '/',
display: 'standalone',
orientation: "portrait-primary",
background_color: '#ffffff',
theme_color: '#000000',
icons: [
{
src: '/icon-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/icon-512x512.png',
sizes: '512x512',
type: 'image/png',
},
],
}
}
+24
View File
@@ -0,0 +1,24 @@
import Image from "next/image";
import styles from "./page.module.css";
export default function Home() {
return (
<div className={styles.page}>
<main className={styles.main}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className={styles.intro}>
<h1>
404
</h1>
</div>
</main>
</div>
);
}
+17 -58
View File
@@ -1,68 +1,27 @@
"use client";
import { useState } from "react";
import Image from "next/image";
import styles from "./page.module.css";
import ChargedButton from "@/components/ChargedButton";
import MapView from "@/components/MapView";
export default function Home() {
const [doTest, setDoTest] = useState(false);
return (
<div className={styles.page}>
<main className={styles.main}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className={styles.intro}>
<h1>
To get started, edit the{" "}
<code className={styles.code}>page.tsx</code> file.
</h1>
<p>
Looking for a starting point or more instructions? Head over to{" "}
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Templates
</a>{" "}
or the{" "}
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Learning
</a>{" "}
center.
</p>
</div>
<div className={styles.ctas}>
<a
className={styles.primary}
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className={styles.logo}
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={14}
/>
Deploy Now
</a>
<a
className={styles.secondary}
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</div>
<ChargedButton
onAction={() => {
console.log("Click!");
}}
holdDuration={2000}
>Hello</ChargedButton>
<button onClick={() => {
setDoTest(true);
}}>test</button>
{doTest && <MapView></MapView>}
</main>
</div>
);
+23
View File
@@ -0,0 +1,23 @@
import { spawnSync } from "node:child_process";
import { createSerwistRoute } from "@serwist/turbopack";
// If you are using Next.js versions older than 15.0.0, add the
// `nextConfig` option so that Serwist can configure the service
// worker according to your options. Serwist 10 and newer will
// only support Next.js 15.0.0 and above.
// import nextConfig from "$cwd/next.config.mjs";
// This is optional!
// A revision helps Serwist version a precached page. This
// avoids outdated precached responses being used. Using
// `git rev-parse HEAD` might not the most efficient way
// of determining a revision, however. You may prefer to use
// the hashes of every extra file you precache.
const revision = spawnSync("git", ["rev-parse", "HEAD"], { encoding: "utf-8" }).stdout ?? crypto.randomUUID();
export const { dynamic, dynamicParams, revalidate, generateStaticParams, GET } = createSerwistRoute({
additionalPrecacheEntries: [{ url: "/~offline", revision }],
swSrc: "src/app/sw.ts",
// nextConfig,
// If set to `false`, Serwist will attempt to use `esbuild-wasm`.
useNativeEsbuild: true,
});
+75
View File
@@ -0,0 +1,75 @@
/// <reference lib="esnext" />
/// <reference lib="webworker" />
import { defaultCache } from "@serwist/turbopack/worker";
import type { PrecacheEntry, SerwistGlobalConfig } from "serwist";
import { Serwist } from "serwist";
// This declares the value of `injectionPoint` to TypeScript.
// `injectionPoint` is the string that will be replaced by the
// actual precache manifest. By default, this string is set to
// `"self.__SW_MANIFEST"`.
declare global {
interface WorkerGlobalScope extends SerwistGlobalConfig {
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
}
}
declare const self: ServiceWorkerGlobalScope;
const serwist = new Serwist({
precacheEntries: self.__SW_MANIFEST,
precacheOptions: {
cleanupOutdatedCaches: true,
concurrency: 20,
directoryIndex: "index.html",
fallbackToNetwork: true,
},
disableDevLogs: true,
skipWaiting: true,
clientsClaim: true,
navigationPreload: true,
runtimeCaching: defaultCache,
fallbacks: {
entries: [
{
url: "/",
matcher({ request }) {
return request.destination === "document";
},
},
],
},
});
serwist.addEventListeners();
/** From Gemini */
/*
import { defaultCache } from '@serwist/next/worker';
import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist';
import { CacheFirst, Serwist } from 'serwist';
declare const self: ServiceWorkerGlobalScope &
SerwistGlobalConfig & {
__SW_MANIFEST: (string | PrecacheEntry)[];
};
const serwist = new Serwist({
precacheEntries: self.__SW_MANIFEST,
skipWaiting: true,
clientsClaim: true,
navigationPreload: true,
runtimeCaching: [
...defaultCache,
{
// Intercept map tile requests from standard OSM / tile servers
matcher: ({ url }) => url.hostname.includes('tile.openstreetmap.org') || url.pathname.includes('/tiles/'),
handler: new CacheFirst({
cacheName: 'excalibur-offline-map-tiles-v1',
}),
},
],
});
serwist.addEventListeners();
*/