Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c5c06ea85d | |||
| 681b0bbc91 | |||
| e9e5a0c5d1 | |||
| 1122bff8dd |
50
public/service-worker.js
Normal file
50
public/service-worker.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
const CACHE_NAME = 'grunauer-cache-v1';
|
||||||
|
const urlsToCache = [
|
||||||
|
'/',
|
||||||
|
'/index.html',
|
||||||
|
// Add other critical static assets here, e.g., images, fonts, main CSS/JS bundles
|
||||||
|
// For a Next.js app, consider using a library like Workbox for more robust asset pre-caching and runtime caching strategies.
|
||||||
|
'/favicon.ico'
|
||||||
|
];
|
||||||
|
|
||||||
|
self.addEventListener('install', (event) => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.open(CACHE_NAME)
|
||||||
|
.then((cache) => {
|
||||||
|
console.log('Service Worker: Opened cache');
|
||||||
|
return cache.addAll(urlsToCache);
|
||||||
|
})
|
||||||
|
.then(() => self.skipWaiting()) // Forces the waiting service worker to become the active service worker.
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', (event) => {
|
||||||
|
const cacheWhitelist = [CACHE_NAME];
|
||||||
|
event.waitUntil(
|
||||||
|
caches.keys().then((cacheNames) => {
|
||||||
|
return Promise.all(
|
||||||
|
cacheNames.map((cacheName) => {
|
||||||
|
if (cacheWhitelist.indexOf(cacheName) === -1) {
|
||||||
|
console.log('Service Worker: Deleting old cache', cacheName);
|
||||||
|
return caches.delete(cacheName); // Delete old caches
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}).then(() => self.clients.claim()) // Takes control of the clients associated with the current service worker.
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', (event) => {
|
||||||
|
event.respondWith(
|
||||||
|
caches.match(event.request)
|
||||||
|
.then((response) => {
|
||||||
|
// Cache hit - return response
|
||||||
|
if (response) {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
// No cache hit - fetch from network
|
||||||
|
return fetch(event.request);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -1,19 +1,22 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
|
||||||
|
import React, { Suspense } from "react";
|
||||||
import ReactLenis from "lenis/react";
|
import ReactLenis from "lenis/react";
|
||||||
import ContactCenter from '@/components/sections/contact/ContactCenter';
|
|
||||||
import FaqDouble from '@/components/sections/faq/FaqDouble';
|
|
||||||
import FeatureCardTwentyEight from '@/components/sections/feature/FeatureCardTwentyEight';
|
import FeatureCardTwentyEight from '@/components/sections/feature/FeatureCardTwentyEight';
|
||||||
import FooterLogoReveal from '@/components/sections/footer/FooterLogoReveal';
|
|
||||||
import HeroBillboard from '@/components/sections/hero/HeroBillboard';
|
import HeroBillboard from '@/components/sections/hero/HeroBillboard';
|
||||||
import MetricCardThree from '@/components/sections/metrics/MetricCardThree';
|
|
||||||
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
|
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
|
||||||
import ProductCardThree from '@/components/sections/product/ProductCardThree';
|
import ProductCardThree from '@/components/sections/product/ProductCardThree';
|
||||||
import TestimonialCardSixteen from '@/components/sections/testimonial/TestimonialCardSixteen';
|
|
||||||
import TextAbout from '@/components/sections/about/TextAbout';
|
import TextAbout from '@/components/sections/about/TextAbout';
|
||||||
import { Star, Utensils, Globe } from "lucide-react";
|
import { Star, Utensils, Globe } from "lucide-react";
|
||||||
|
|
||||||
|
// Lazy imports for below-the-fold sections
|
||||||
|
const LazyTestimonialCardSixteen = React.lazy(() => import('@/components/sections/testimonial/TestimonialCardSixteen'));
|
||||||
|
const LazyMetricCardThree = React.lazy(() => import('@/components/sections/metrics/MetricCardThree'));
|
||||||
|
const LazyFaqDouble = React.lazy(() => import('@/components/sections/faq/FaqDouble'));
|
||||||
|
const LazyContactCenter = React.lazy(() => import('@/components/sections/contact/ContactCenter'));
|
||||||
|
const LazyFooterLogoReveal = React.lazy(() => import('@/components/sections/footer/FooterLogoReveal'));
|
||||||
|
|
||||||
export default function LandingPage() {
|
export default function LandingPage() {
|
||||||
return (
|
return (
|
||||||
<ThemeProvider
|
<ThemeProvider
|
||||||
@@ -170,7 +173,8 @@ export default function LandingPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="reviews" data-section="reviews">
|
<div id="reviews" data-section="reviews">
|
||||||
<TestimonialCardSixteen
|
<Suspense fallback={<div>Loading Reviews...</div>}>
|
||||||
|
<LazyTestimonialCardSixteen
|
||||||
animationType="slide-up"
|
animationType="slide-up"
|
||||||
textboxLayout="default"
|
textboxLayout="default"
|
||||||
useInvertedBackground={false}
|
useInvertedBackground={false}
|
||||||
@@ -206,10 +210,12 @@ export default function LandingPage() {
|
|||||||
description="Hear from diners who have experienced the authentic taste and warm hospitality of Grünauer. With over 4,000 positive reviews, our reputation speaks for itself."
|
description="Hear from diners who have experienced the authentic taste and warm hospitality of Grünauer. With over 4,000 positive reviews, our reputation speaks for itself."
|
||||||
tag="Guest Reviews"
|
tag="Guest Reviews"
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="metrics" data-section="metrics">
|
<div id="metrics" data-section="metrics">
|
||||||
<MetricCardThree
|
<Suspense fallback={<div>Loading Metrics...</div>}>
|
||||||
|
<LazyMetricCardThree
|
||||||
animationType="slide-up"
|
animationType="slide-up"
|
||||||
textboxLayout="default"
|
textboxLayout="default"
|
||||||
useInvertedBackground={true}
|
useInvertedBackground={true}
|
||||||
@@ -228,10 +234,12 @@ export default function LandingPage() {
|
|||||||
description="Proudly serving our community with culinary excellence and unwavering dedication."
|
description="Proudly serving our community with culinary excellence and unwavering dedication."
|
||||||
tag="Our Achievements"
|
tag="Our Achievements"
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="faq" data-section="faq">
|
<div id="faq" data-section="faq">
|
||||||
<FaqDouble
|
<Suspense fallback={<div>Loading FAQ...</div>}>
|
||||||
|
<LazyFaqDouble
|
||||||
textboxLayout="default"
|
textboxLayout="default"
|
||||||
useInvertedBackground={false}
|
useInvertedBackground={false}
|
||||||
faqs={[
|
faqs={[
|
||||||
@@ -249,10 +257,12 @@ export default function LandingPage() {
|
|||||||
tag="Need Help?"
|
tag="Need Help?"
|
||||||
faqsAnimation="slide-up"
|
faqsAnimation="slide-up"
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="contact" data-section="contact">
|
<div id="contact" data-section="contact">
|
||||||
<ContactCenter
|
<Suspense fallback={<div>Loading Contact...</div>}>
|
||||||
|
<LazyContactCenter
|
||||||
useInvertedBackground={true}
|
useInvertedBackground={true}
|
||||||
background={{
|
background={{
|
||||||
variant: "plain"}}
|
variant: "plain"}}
|
||||||
@@ -263,18 +273,21 @@ export default function LandingPage() {
|
|||||||
buttonText="Send Inquiry"
|
buttonText="Send Inquiry"
|
||||||
termsText="By sending an inquiry, you agree to our privacy policy."
|
termsText="By sending an inquiry, you agree to our privacy policy."
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="footer" data-section="footer">
|
<div id="footer" data-section="footer">
|
||||||
<FooterLogoReveal
|
<Suspense fallback={<div>Loading Footer...</div>}>
|
||||||
|
<LazyFooterLogoReveal
|
||||||
logoText="Grünauer"
|
logoText="Grünauer"
|
||||||
leftLink={{
|
leftLink={{
|
||||||
text: "Privacy Policy", href: "#"}}
|
text: "Privacy Policy", href: "#"}}
|
||||||
rightLink={{
|
rightLink={{
|
||||||
text: "Terms of Service", href: "#"}}
|
text: "Terms of Service", href: "#"}}
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</ReactLenis>
|
</ReactLenis>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user